On Tue, Nov 22, 2016 at 12:25 AM, Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx> wrote: > On Monday 21 Nov 2016 16:37:31 John Stultz wrote: >> Secton 4.1 of the adv7511 programming guide advises one waits >> 200ms after powering on the chip before trying to communicate >> with it via i2c. Not doing so can cause reliability issues when >> probing the EDID. >> >> See: >> http://www.analog.com/media/en/technical-documentation/user-guides/ADV7511_P >> rogramming_Guide.pdf >> >> So this patch simply adds a 200ms sleep at the end of the >> power_on path. This greatly improves EDID probing reliabilty >> on hotplug with the HiKey device. >> [snip] >> --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c >> +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c >> @@ -361,6 +361,8 @@ static void __adv7511_power_on(struct adv7511 *adv7511) >> */ >> regcache_sync(adv7511->regmap); >> >> + msleep(200); >> + > > The documentation states that > > "The user should wait 200ms for the address to be decided, after the power > supplies are high, before attempting to communicate with the ADV7511W using > I2C." > > The hardware user's guide further states that > > "When initially powered up, there is a 200ms period before the device is ready > to be addressed." > > Not only the delay you add comes after lots of I2C communication, but the > driver doesn't handle regulators, and thus doesn't power down the device at > the hardware level. The initial power up should thus be long gone when this > code is reached. > > Could it be that, on the HiKey board, the power supply is controlled through > another mean that doesn't comply with the 200ms rule ? Thanks so much for the clarifications. Hopefully my confusion around flipping the POWER_DOWN register and the actual power to the chip is understandable. :) Hrm... So apparently I was mixing the result of this change up with the refactoring of the power_on logic in the previous patch. So initially I found this as I was seeing i2c_transfer() frequently return errors when trying to read the EDID, after turning off the ADV7511_POWER_POWER_DOWN register. The explanation in the guide to wait 200ms made sense, and seemed to make the i2c_transfer errors go away. But it ends up the i2c_tranfer errors are fixed by re-using the power_on logic in the patch before. However this patch still improves things, as without it I'm seeing the DDCController status in adv7511_get_edid_block() being 1 ("reading edid") and the adv7511_wait_for_edid() regularly times out. It seems like we don't get the irq and set the edid_read bit we're waiting on until much later (after we decide there's no edid and try to start using with 800x600). Interestingly, without the msleep added in this patch, removing the wait_event_interruptible_timeout() method in adv7511_wait_for_edid() and using the polling loop seems to make things just as reliable. So maybe something is off with the irq handling here instead? thanks -john _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel