Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Philipp Tomsich | 66cbacc | 2017-05-31 17:59:33 +0200 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2017 Theobroma Systems Design und Consulting GmbH |
Philipp Tomsich | 66cbacc | 2017-05-31 17:59:33 +0200 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #ifndef __RK_HDMI_H__ |
| 7 | #define __RK_HDMI_H__ |
| 8 | |
Jagan Teki | 161c67b | 2024-01-17 13:21:49 +0530 | [diff] [blame] | 9 | #include <generic-phy.h> |
| 10 | |
Philipp Tomsich | 66cbacc | 2017-05-31 17:59:33 +0200 | [diff] [blame] | 11 | struct rkhdmi_driverdata { |
| 12 | /* configuration */ |
| 13 | u8 i2c_clk_high; |
| 14 | u8 i2c_clk_low; |
| 15 | const char * const *regulator_names; |
| 16 | u32 regulator_names_cnt; |
| 17 | /* setters/getters */ |
| 18 | int (*set_input_vop)(struct udevice *dev); |
| 19 | int (*clk_config)(struct udevice *dev); |
| 20 | }; |
| 21 | |
| 22 | struct rk_hdmi_priv { |
| 23 | struct dw_hdmi hdmi; |
Jagan Teki | 161c67b | 2024-01-17 13:21:49 +0530 | [diff] [blame] | 24 | struct phy phy; |
Philipp Tomsich | 66cbacc | 2017-05-31 17:59:33 +0200 | [diff] [blame] | 25 | void *grf; |
| 26 | }; |
| 27 | |
Philipp Tomsich | 0a637e7 | 2017-06-02 16:06:17 +0200 | [diff] [blame] | 28 | /** |
| 29 | * rk_hdmi_read_edid() - read the attached HDMI/DVI monitor's EDID |
| 30 | * |
| 31 | * N.B.: The buffer should be large enough to hold 2 EDID blocks, as |
| 32 | * this function calls dw_hdmi_read_edid, which ignores buf_size |
| 33 | * argument and assumes that there's always enough space for 2 |
| 34 | * EDID blocks. |
| 35 | * |
| 36 | * @dev: device |
| 37 | * @buf: output buffer for the EDID |
| 38 | * @buf_size: number of bytes in the buffer |
Heinrich Schuchardt | 47b4c02 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 39 | * Return: number of bytes read if OK, -ve if something went wrong |
Philipp Tomsich | 0a637e7 | 2017-06-02 16:06:17 +0200 | [diff] [blame] | 40 | */ |
Philipp Tomsich | 66cbacc | 2017-05-31 17:59:33 +0200 | [diff] [blame] | 41 | int rk_hdmi_read_edid(struct udevice *dev, u8 *buf, int buf_size); |
Philipp Tomsich | 0a637e7 | 2017-06-02 16:06:17 +0200 | [diff] [blame] | 42 | |
| 43 | /** |
| 44 | * rk_hdmi_probe_regulators() - probe (autoset + enable) regulators |
| 45 | * |
| 46 | * Probes a list of regulators by performing autoset and enable |
| 47 | * operations on them. The list of regulators is an array of string |
| 48 | * pointers and any individual regulator-probe may fail without |
| 49 | * counting as an error. |
| 50 | * |
| 51 | * @dev: device |
| 52 | * @names: array of string-pointers to regulator names to probe |
| 53 | * @cnt: number of elements in the 'names' array |
| 54 | */ |
Philipp Tomsich | 66cbacc | 2017-05-31 17:59:33 +0200 | [diff] [blame] | 55 | void rk_hdmi_probe_regulators(struct udevice *dev, |
| 56 | const char * const *names, int cnt); |
Philipp Tomsich | 0a637e7 | 2017-06-02 16:06:17 +0200 | [diff] [blame] | 57 | /** |
Simon Glass | aad29ae | 2020-12-03 16:55:21 -0700 | [diff] [blame] | 58 | * rk_hdmi_of_to_plat() - common of_to_plat implementation |
Philipp Tomsich | 0a637e7 | 2017-06-02 16:06:17 +0200 | [diff] [blame] | 59 | * |
| 60 | * @dev: device |
Heinrich Schuchardt | 47b4c02 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 61 | * Return: 0 if OK, -ve if something went wrong |
Philipp Tomsich | 0a637e7 | 2017-06-02 16:06:17 +0200 | [diff] [blame] | 62 | */ |
Simon Glass | aad29ae | 2020-12-03 16:55:21 -0700 | [diff] [blame] | 63 | int rk_hdmi_of_to_plat(struct udevice *dev); |
Philipp Tomsich | 0a637e7 | 2017-06-02 16:06:17 +0200 | [diff] [blame] | 64 | |
| 65 | /** |
| 66 | * rk_hdmi_probe() - common probe implementation |
| 67 | * |
| 68 | * Performs the following, common initialisation steps: |
| 69 | * 1. checks for HPD (i.e. a HDMI monitor being attached) |
| 70 | * 2. initialises the Designware HDMI core |
| 71 | * 3. initialises the Designware HDMI PHY |
| 72 | * |
| 73 | * @dev: device |
Heinrich Schuchardt | 47b4c02 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 74 | * Return: 0 if OK, -ve if something went wrong |
Philipp Tomsich | 0a637e7 | 2017-06-02 16:06:17 +0200 | [diff] [blame] | 75 | */ |
Philipp Tomsich | 66cbacc | 2017-05-31 17:59:33 +0200 | [diff] [blame] | 76 | int rk_hdmi_probe(struct udevice *dev); |
| 77 | |
| 78 | #endif |