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