summaryrefslogtreecommitdiff
path: root/drivers/video/dw_hdmi.c
diff options
context:
space:
mode:
authorNiklas Schulze <me@jns.io>2019-07-27 15:07:13 +0300
committerAnatolij Gustschin <agust@denx.de>2019-07-29 01:32:59 +0300
commit60a62acfb07afb0815f28abe6f49a9b906a7c3f4 (patch)
tree84b3875ef9c441ffb7c8a5275423f68cf25a0aed /drivers/video/dw_hdmi.c
parent233358c46a753438d9f0c26dc67dad3ddecca1e9 (diff)
downloadu-boot-60a62acfb07afb0815f28abe6f49a9b906a7c3f4.tar.xz
video: dw_hdmi: Add support for ddc-i2c-bus property
Add support for the ddc-i2c-bus device tree property which allows for using an external i2c master for reading the display's EDID. Signed-off-by: Niklas Schulze <me@jns.io>
Diffstat (limited to 'drivers/video/dw_hdmi.c')
-rw-r--r--drivers/video/dw_hdmi.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/video/dw_hdmi.c b/drivers/video/dw_hdmi.c
index 463436edf3..bf74d6adf2 100644
--- a/drivers/video/dw_hdmi.c
+++ b/drivers/video/dw_hdmi.c
@@ -8,6 +8,7 @@
#include <common.h>
#include <fdtdec.h>
#include <asm/io.h>
+#include <i2c.h>
#include <media_bus_format.h>
#include "dw_hdmi.h"
@@ -812,6 +813,18 @@ static int hdmi_read_edid(struct dw_hdmi *hdmi, int block, u8 *buff)
u32 trytime = 5;
u32 n;
+ if (CONFIG_IS_ENABLED(DM_I2C) && hdmi->ddc_bus) {
+ struct udevice *chip;
+
+ edid_read_err = i2c_get_chip(hdmi->ddc_bus,
+ HDMI_I2CM_SLAVE_DDC_ADDR,
+ 1, &chip);
+ if (edid_read_err)
+ return edid_read_err;
+
+ return dm_i2c_read(chip, shift, buff, HDMI_EDID_BLOCK_SIZE);
+ }
+
/* set ddc i2c clk which devided from ddc_clk to 100khz */
hdmi_write(hdmi, hdmi->i2c_clk_high, HDMI_I2CM_SS_SCL_HCNT_0_ADDR);
hdmi_write(hdmi, hdmi->i2c_clk_low, HDMI_I2CM_SS_SCL_LCNT_0_ADDR);