Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Jun 2020 21:38:35 +0000 (UTC)
From:      Oleksandr Tymoshenko <gonzo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r362029 - head/sys/dev/hdmi
Message-ID:  <202006102138.05ALcZZV087863@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gonzo
Date: Wed Jun 10 21:38:35 2020
New Revision: 362029
URL: https://svnweb.freebsd.org/changeset/base/362029

Log:
  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

Modified:
  head/sys/dev/hdmi/dwc_hdmi.c

Modified: head/sys/dev/hdmi/dwc_hdmi.c
==============================================================================
--- head/sys/dev/hdmi/dwc_hdmi.c	Wed Jun 10 21:18:19 2020	(r362028)
+++ head/sys/dev/hdmi/dwc_hdmi.c	Wed Jun 10 21:38:35 2020	(r362029)
@@ -658,6 +658,11 @@ hdmi_edid_read(struct dwc_hdmi_softc *sc, int block, u
 	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, u
 		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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202006102138.05ALcZZV087863>