ref: 752405d853d96a39199328110bce0fe5c6299e27
parent: d358e3b2524686dc233ebe7d618398f157b8000b
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Feb 15 18:02:26 EST 2025
reform: retry reading edid a bunch of times When masquerading as linux, uboot resets the lcdif and mipidsi bridge. This causes some glitching with the edid reading, so try a bunch of times.
--- a/sys/src/9/imx8/lcd.c
+++ b/sys/src/9/imx8/lcd.c
@@ -638,20 +638,22 @@
{
static uchar edid[128];
static I2Cdev aux;
+ int i;
- aux.bus = bridge->bus;
+ /* enable passthru mode for address 0x50 (EDID) */
aux.addr = 0x50;
+ aux.bus = bridge->bus;
aux.subaddr = 1;
aux.size = sizeof(edid);
-
- /* enable passthru mode for address 0x50 (EDID) */
i2cwritebyte(bridge, 0x60, aux.addr<<1 | 1);
addi2cdev(&aux);
- if(i2crecv(&aux, edid, sizeof(edid), 0) != sizeof(edid))
- return "i2crecv failed to get edid bytes";
-
- return parseedid128(mode, edid);
+ for(i = 0; i < 10; i++){
+ delay(100);
+ if(i2crecv(&aux, edid, sizeof(edid), 0) == sizeof(edid))
+ return parseedid128(mode, edid);
+ }
+ return "i2crecv failed to get edid bytes";
}
static void
@@ -955,8 +957,7 @@
* get mode information from EDID, this can only be done after the clocks
* are generated by the DPHY and the clock resets have been released.
*/
- err = getmode(&mode);
- if(err != nil)
+ if((err = getmode(&mode)) != nil)
goto out;
/* allocates the framebuffer */
--
⑨