drm/bridge: ti-sn65dsi86: Add retries for link training
authorDouglas Anderson <dianders@chromium.org>
Fri, 2 Oct 2020 21:03:51 +0000 (14:03 -0700)
committerSam Ravnborg <sam@ravnborg.org>
Fri, 16 Oct 2020 18:34:24 +0000 (20:34 +0200)
commit137655d1ed353806b8591855b569efd090d84135
treed63d82dc2ae23780e2dde3f7c0bd13008847f7c8
parent1c902de389ff7cd6495e6a51e04b49ab00fca7d3
drm/bridge: ti-sn65dsi86: Add retries for link training

On some panels hooked up to the ti-sn65dsi86 bridge chip we found that
link training was failing.  Specifically, we'd see:

  ti_sn65dsi86 2-002d: [drm:ti_sn_bridge_enable] *ERROR* Link training failed, link is off (-5)

The panel was hooked up to a logic analyzer and it was found that, as
part of link training, the bridge chip was writing a 0x1 to DPCD
address 00600h and the panel responded NACK.  As can be seen in header
files, the write of 0x1 to DPCD address 0x600h means we were trying to
write the value DP_SET_POWER_D0 to the register DP_SET_POWER.  The
panel vendor says that a NACK in this case is not unexpected and means
"not ready, try again".

In testing, we found that this panel would respond with a NACK in
about 1/25 times.  Adding the retry logic worked fine and the most
number of tries needed was 3.  Just to be safe, we'll add 10 tries
here and we'll add a little blurb to the logs if we ever need more
than 5.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Tested-By: Steev Klimaszewski <steev@kali.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201002135920.1.I2adbc90b2db127763e2444bd5a4e5bf30e1db8e5@changeid
drivers/gpu/drm/bridge/ti-sn65dsi86.c