Douglas Anderson has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/45744 )
Change subject: drivers/ti/sn65dsi86bridge: Fix broken HPD by just delaying ......................................................................
drivers/ti/sn65dsi86bridge: Fix broken HPD by just delaying
The HPD code we had was hilariously broken.
1. sn65dsi86_bridge_get_plug_in_status() - didn't actually check anything useful. It read the i2c part, and then checked bit 0 (not bit 4). Bit 0 is where we have manually programmed the HPD disable. Bit 4 is the actual value read from HPD. Thus it would only return CB_SUCCESS we have already programmed the HPD disable (we haven't). So it will always return CB_ERR
2. The return value of sn65dsi86_bridge_get_plug_in_status() is used directly as the stop condition for wait_ms(). That means that the error return causes us to stop waiting. So if we fix sn65dsi86_bridge_get_plug_in_status() then we'll end up exiting right away.
HPD is pretty useless on this bridge chip and on every panel I've seen so far a 200 ms delay is fine. Let's just do that.
Signed-off-by: Douglas Anderson dianders@chromium.org Change-Id: Id8b497c5ce9b6d92141b42438787485096dbcb8a --- M src/drivers/ti/sn65dsi86bridge/sn65dsi86bridge.c 1 file changed, 20 insertions(+), 22 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/44/45744/1
diff --git a/src/drivers/ti/sn65dsi86bridge/sn65dsi86bridge.c b/src/drivers/ti/sn65dsi86bridge/sn65dsi86bridge.c index e0058c4..dce3718 100644 --- a/src/drivers/ti/sn65dsi86bridge/sn65dsi86bridge.c +++ b/src/drivers/ti/sn65dsi86bridge/sn65dsi86bridge.c @@ -426,30 +426,28 @@
}
-static enum cb_err sn65dsi86_bridge_get_plug_in_status(uint8_t bus, uint8_t chip) -{ - int val; - uint8_t buf; - - val = i2c_readb(bus, chip, SN_HPD_DISABLE_REG, &buf); - if (val == 0 && (buf & HPD_DISABLE)) - return CB_SUCCESS; - - return CB_ERR; -} - -/* - * support bridge HPD function some hardware versions do not support bridge hdp, - * we use 360ms to try to get the hpd single now, if we can not get bridge hpd single, - * it will delay 360ms, also meet the bridge power timing request, to be compatible - * all of the hardware versions - */ static void sn65dsi86_bridge_wait_hpd(uint8_t bus, uint8_t chip) { - if (wait_ms(400, sn65dsi86_bridge_get_plug_in_status(bus, chip))) - return; - - printk(BIOS_WARNING, "HPD detection failed, force hpd\n"); + /* + * From the Linux kernel driver: + * + * HPD on this bridge chip is a bit useless. This is an eDP bridge + * so the HPD is an internal signal that's only there to signal that + * the panel is done powering up. ...but the bridge chip debounces + * this signal by between 100 ms and 400 ms (depending on process, + * voltage, and temperate--I measured it at about 200 ms). One + * particular panel asserted HPD 84 ms after it was powered on meaning + * that we saw HPD 284 ms after power on. + * + * Some boards may route HPD to a 2nd place on the board so it can + * be polled faster, but since we're not in a crazy hurry let's just + * hardcode a delay. + * + * Every panel datasheet I've seen says that HPD will be asserted + * within 200 ms. Let's just hardcode the delay and then tell the + * bridge to ignore HPD. + */ + mdelay(200);
/* Force HPD */ i2c_write_field(bus, chip, SN_HPD_DISABLE_REG, HPD_DISABLE, 1, 0);