blob: dcfba3d3d7e9228b591837d4a46e7e21c760d57b [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Philipp Tomsich66cbacc2017-05-31 17:59:33 +02002/*
3 * Copyright (c) 2017 Theobroma Systems Design und Consulting GmbH
Philipp Tomsich66cbacc2017-05-31 17:59:33 +02004 */
5
6#ifndef __RK_HDMI_H__
7#define __RK_HDMI_H__
8
Jagan Teki161c67b2024-01-17 13:21:49 +05309#include <generic-phy.h>
10
Philipp Tomsich66cbacc2017-05-31 17:59:33 +020011struct 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
22struct rk_hdmi_priv {
23 struct dw_hdmi hdmi;
Jagan Teki161c67b2024-01-17 13:21:49 +053024 struct phy phy;
Philipp Tomsich66cbacc2017-05-31 17:59:33 +020025 void *grf;
26};
27
Philipp Tomsich0a637e72017-06-02 16:06:17 +020028/**
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 Schuchardt47b4c022022-01-19 18:05:50 +010039 * Return: number of bytes read if OK, -ve if something went wrong
Philipp Tomsich0a637e72017-06-02 16:06:17 +020040 */
Philipp Tomsich66cbacc2017-05-31 17:59:33 +020041int rk_hdmi_read_edid(struct udevice *dev, u8 *buf, int buf_size);
Philipp Tomsich0a637e72017-06-02 16:06:17 +020042
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 Tomsich66cbacc2017-05-31 17:59:33 +020055void rk_hdmi_probe_regulators(struct udevice *dev,
56 const char * const *names, int cnt);
Philipp Tomsich0a637e72017-06-02 16:06:17 +020057/**
Simon Glassaad29ae2020-12-03 16:55:21 -070058 * rk_hdmi_of_to_plat() - common of_to_plat implementation
Philipp Tomsich0a637e72017-06-02 16:06:17 +020059 *
60 * @dev: device
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +010061 * Return: 0 if OK, -ve if something went wrong
Philipp Tomsich0a637e72017-06-02 16:06:17 +020062 */
Simon Glassaad29ae2020-12-03 16:55:21 -070063int rk_hdmi_of_to_plat(struct udevice *dev);
Philipp Tomsich0a637e72017-06-02 16:06:17 +020064
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 Schuchardt47b4c022022-01-19 18:05:50 +010074 * Return: 0 if OK, -ve if something went wrong
Philipp Tomsich0a637e72017-06-02 16:06:17 +020075 */
Philipp Tomsich66cbacc2017-05-31 17:59:33 +020076int rk_hdmi_probe(struct udevice *dev);
77
78#endif