OpenCloudOS-Kernel/drivers/gpu/drm/bridge
Douglas Anderson c2bfc22388 drm/bridge: ti-sn65dsi86: Remove the mystery delay
Let's solve the mystery of commit bf1178c989 ("drm/bridge:
ti-sn65dsi86: Add mystery delay to enable()").  Specifically the
reason we needed that mystery delay is that we weren't paying
attention to HPD.

Looking at the datasheet for the same panel that was tested for the
original commit, I see there's a timing "t3" that times from power on
to the aux channel being operational.  This time is specced as 0 - 200
ms.  The datasheet says that the aux channel is operational at exactly
the same time that HPD is asserted.

Scoping the signals on this board showed that HPD was asserted 84 ms
after power was asserted.  That very closely matches the magic 70 ms
delay that we had.  ...and actually, in my testing the 70 ms wasn't
quite enough of a delay and some percentage of the time the display
didn't come up until I bumped it to 100 ms (presumably 84 ms would
have worked too).

To solve this, we tried to hook up the HPD signal in the bridge.
...but in doing so we found that that the bridge didn't report that
HPD was asserted until ~280 ms after we powered it (!).  This is
explained by looking at the sn65dsi86 datasheet section "8.4.5.1 HPD
(Hot Plug/Unplug Detection)".  Reading there we see that the bridge
isn't even intended to report HPD until 100 ms after it's asserted.
...but that would have left us at 184 ms.  The extra 100 ms
(presumably) comes from this part in the datasheet:

> The HPD state machine operates off an internal ring oscillator. The
> ring oscillator frequency will vary [ ... ]. The min/max range in
> the HPD State Diagram refers to the possible times based off
> variation in the ring oscillator frequency.

Given that the 280 ms we'll end up delaying if we hook up HPD is
_slower_ than the 200 ms we could just hardcode, for now we'll solve
the problem by just hardcoding a 200 ms delay in the panel driver
using the patch in this series ("drm/panel: simple: Support panels
with HPD where HPD isn't connected").

If we later find a panel that needs to use this bridge where we need
HPD then we'll have to come up with some new code to handle it.  Given
the silly debouncing in the bridge chip, though, it seems unlikely.

One last note is that I tried to solve this through another way: In
ti_sn_bridge_enable() I tried to use various combinations of
dp_dpcd_writeb() and dp_dpcd_readb() to detect when the aux channel
was up.  In theory that would let me detect _exactly_ when I could
continue and do link training.  Unfortunately even if I did an aux
transfer w/out waiting I couldn't see any errors.  Possibly I could
keep looping over link training until it came back with success, but
that seemed a little overly hacky to me.

Reviewed-by: Sean Paul <sean@poorly.run>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20181025222134.174583-4-dianders@chromium.org
2018-10-29 11:53:27 -04:00
..
adv7511 drm pull for 4.19-rc1 2018-08-15 17:39:07 -07:00
analogix drm/bridge: analogix_dp: Downgrade "Link Training" messages to dev_dbg 2018-09-13 10:47:17 +02:00
synopsys drm/bridge/synopsys: remove commented-out flag in Makefile 2018-07-27 09:34:06 +02:00
Kconfig drm/bridge: ti-sn65dsi86: Fix 0-day build error 2018-08-16 11:26:37 -04:00
Makefile drm/bridge: tc358764: Add DSI to LVDS bridge driver 2018-07-27 09:09:57 +02:00
analogix-anx78xx.c drm: drop _mode_ from drm_mode_connector_attach_encoder 2018-07-13 18:40:27 +02:00
analogix-anx78xx.h drm/bridge: Add Analogix anx78xx support 2016-05-12 11:32:14 +02:00
cdns-dsi.c drm/panel: Make of_drm_find_panel() return an ERR_PTR() instead of NULL 2018-07-10 17:59:05 +02:00
dumb-vga-dac.c drm: drop _mode_ from drm_mode_connector_attach_encoder 2018-07-13 18:40:27 +02:00
lvds-encoder.c drm/panel: Make of_drm_find_panel() return an ERR_PTR() instead of NULL 2018-07-10 17:59:05 +02:00
megachips-stdpxxxx-ge-b850v3-fw.c drm: drop _mode_ from drm_mode_connector_attach_encoder 2018-07-13 18:40:27 +02:00
nxp-ptn3460.c drm: drop _mode_ from drm_mode_connector_attach_encoder 2018-07-13 18:40:27 +02:00
panel.c drm: drop _mode_ from drm_mode_connector_attach_encoder 2018-07-13 18:40:27 +02:00
parade-ps8622.c drm: drop _mode_ from drm_mode_connector_attach_encoder 2018-07-13 18:40:27 +02:00
sii902x.c drm: drop _mode_ from drm_mode_connector_attach_encoder 2018-07-13 18:40:27 +02:00
sii9234.c drm/bridge: add Silicon Image SiI9234 driver 2017-10-06 14:28:22 +02:00
sil-sii8620.c drm/bridge/sii8620: Fix link mode selection 2018-07-04 16:27:51 +02:00
sil-sii8620.h drm/bridge/sii8620: add HSIC initialization code 2017-02-02 15:15:30 +05:30
tc358764.c drm/bridge/tc358764: fix drm helper name 2018-07-30 13:37:48 -04:00
tc358767.c drm: drop _mode_ from drm_mode_connector_attach_encoder 2018-07-13 18:40:27 +02:00
thc63lvd1024.c drm: bridge: thc63: Restrict modes based on hardware operating frequency 2018-09-25 00:40:51 +03:00
ti-sn65dsi86.c drm/bridge: ti-sn65dsi86: Remove the mystery delay 2018-10-29 11:53:27 -04:00
ti-tfp410.c drm: drop _mode_ from drm_mode_connector_attach_encoder 2018-07-13 18:40:27 +02:00