From owner-svn-src-all@freebsd.org Thu Jun 11 13:45:06 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B1C03317BE; Thu, 11 Jun 2020 13:45:06 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49jQ8d6TSYz4fXr; Thu, 11 Jun 2020 13:45:05 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 05BDiwGe060075; Thu, 11 Jun 2020 06:44:58 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 05BDiwc4060074; Thu, 11 Jun 2020 06:44:58 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202006111344.05BDiwc4060074@gndrsh.dnsmgr.net> Subject: Re: svn commit: r362029 - head/sys/dev/hdmi In-Reply-To: <202006102138.05ALcZZV087863@repo.freebsd.org> To: Oleksandr Tymoshenko Date: Thu, 11 Jun 2020 06:44:58 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 49jQ8d6TSYz4fXr X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jun 2020 13:45:06 -0000 > 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 Is it possible that this bad write is what has caused me to corrupt the EDID of 3 monitors over the last year while using a Display Port to HDMI cable on them? > 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) { > -- Rod Grimes rgrimes@freebsd.org