drm/bridge: ps8640: Rework power state handling
authorEnric Balletbo i Serra <enric.balletbo@collabora.com>
Thu, 27 Aug 2020 08:59:11 +0000 (10:59 +0200)
committerNeil Armstrong <narmstrong@baylibre.com>
Tue, 15 Sep 2020 13:12:24 +0000 (15:12 +0200)
commit46f206304db0311b0920479f42accaa7cb472fdc
tree245da170922b1f178504853919919fdca8f26adb
parent9fe6bda9823ea90c22ad47436293413d5fd58991
drm/bridge: ps8640: Rework power state handling

The get_edid() callback can be triggered anytime by an ioctl, i.e

  drm_mode_getconnector (ioctl)
    -> drm_helper_probe_single_connector_modes
       -> drm_bridge_connector_get_modes
          -> ps8640_bridge_get_edid

Actually if the bridge pre_enable() function was not called before
get_edid(), the driver will not be able to get the EDID properly and
display will not work until a second get_edid() call is issued and if
pre_enable() is called before. The side effect of this, for example, is
that you see anything when `Frecon` starts, neither the splash screen,
until the graphical session manager starts.

To fix this we need to make sure that all we need is enabled before
reading the EDID. This means the following:

1. If get_edid() is called before having the device powered we need to
   power on the device. In such case, the driver will power off again the
   device.

2. If get_edid() is called after having the device powered, all should
   just work. We added a powered flag in order to avoid recurrent calls
   to ps8640_bridge_poweron() and unneeded delays.

3. This seems to be specific for this device, but we need to make sure
   the panel is powered on before do a power on cycle on this device.
   Otherwise the device fails to retrieve the EDID.

Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Tested-by: Bilal Wasim <bwasim.lkml@gmail.com>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200827085911.944899-2-enric.balletbo@collabora.com
drivers/gpu/drm/bridge/parade-ps8640.c