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