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