aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/hdmi
diff options
context:
space:
mode:
authorOleksandr Tymoshenko <gonzo@FreeBSD.org>2020-06-10 21:38:35 +0000
committerOleksandr Tymoshenko <gonzo@FreeBSD.org>2020-06-10 21:38:35 +0000
commitcbc596d6bfeefe8339ad7c90a5e6c9fb920e5bcc (patch)
treed3fa5e8cb60f5cd560dcfc3d2401704bac91d51d /sys/dev/hdmi
parent9b6b2f8608e24fc824404e2b47e2cecc669b189b (diff)
downloadsrc-cbc596d6bfeefe8339ad7c90a5e6c9fb920e5bcc.tar.gz
src-cbc596d6bfeefe8339ad7c90a5e6c9fb920e5bcc.zip
Fix reading EDID on TVs/monitors without E-DCC support
Writing segment id to I2C device 0x30 only required if the segment is non-zero. On the devices without E-DCC support writing to that address fails and whole transaction then fails too. To avoid this do not attempt write to the segment selection device unless required. MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=362029
Diffstat (limited to 'sys/dev/hdmi')
-rw-r--r--sys/dev/hdmi/dwc_hdmi.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/dev/hdmi/dwc_hdmi.c b/sys/dev/hdmi/dwc_hdmi.c
index b4fd5261019e..0f1388874292 100644
--- a/sys/dev/hdmi/dwc_hdmi.c
+++ b/sys/dev/hdmi/dwc_hdmi.c
@@ -658,6 +658,11 @@ hdmi_edid_read(struct dwc_hdmi_softc *sc, int block, uint8_t **edid,
int result;
uint8_t addr = block & 1 ? EDID_LENGTH : 0;
uint8_t segment = block >> 1;
+ /*
+ * Some devices do not support E-DDC so attempt
+ * writing segment address only if it's neccessary
+ */
+ unsigned char xfers = segment ? 3 : 2;
struct iic_msg msg[] = {
{ I2C_DDC_SEGADDR, IIC_M_WR, 1, &segment },
{ I2C_DDC_ADDR, IIC_M_WR, 1, &addr },
@@ -687,7 +692,7 @@ hdmi_edid_read(struct dwc_hdmi_softc *sc, int block, uint8_t **edid,
return (result);
}
- result = iicbus_transfer(i2c_dev, msg, 3);
+ result = iicbus_transfer(i2c_dev, &msg[3 - xfers], xfers);
iicbus_release_bus(i2c_dev, sc->sc_dev);
if (result) {