blob: ec396682f1041140981193b43b03198fbba4a0e2 [file] [log] [blame]
Philipp Tomsich66cbacc2017-05-31 17:59:33 +02001/*
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
10struct 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
21struct rk_hdmi_priv {
22 struct dw_hdmi hdmi;
23 void *grf;
24};
25
Philipp Tomsich0a637e72017-06-02 16:06:17 +020026/**
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 */
Philipp Tomsich66cbacc2017-05-31 17:59:33 +020039int rk_hdmi_read_edid(struct udevice *dev, u8 *buf, int buf_size);
Philipp Tomsich0a637e72017-06-02 16:06:17 +020040
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 */
Philipp Tomsich66cbacc2017-05-31 17:59:33 +020053void rk_hdmi_probe_regulators(struct udevice *dev,
54 const char * const *names, int cnt);
Philipp Tomsich0a637e72017-06-02 16:06:17 +020055/**
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 */
Philipp Tomsich66cbacc2017-05-31 17:59:33 +020061int rk_hdmi_ofdata_to_platdata(struct udevice *dev);
Philipp Tomsich0a637e72017-06-02 16:06:17 +020062
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 */
Philipp Tomsich66cbacc2017-05-31 17:59:33 +020074int rk_hdmi_probe(struct udevice *dev);
75
76#endif