drm/bridge/synopsys: dsi: add ability to have glue-specific attach and detach
authorHeiko Stuebner <heiko@sntech.de>
Mon, 1 Oct 2018 12:38:41 +0000 (14:38 +0200)
committerAndrzej Hajda <a.hajda@samsung.com>
Tue, 30 Oct 2018 13:06:13 +0000 (14:06 +0100)
commit90910a6511238dd8d25ac007d97a2c0ddfa24e51
tree5e032b7714c05c2e25a74838f33566bd9f036f8d
parentf2b0e264657061667be7df1575b82777cf622b73
drm/bridge/synopsys: dsi: add ability to have glue-specific attach and detach

With the regular means of adding the dsi-component in probe it creates
a race condition with the panel probing, as the panel device only gets
created after the dsi-bus got created.

When the panel-driver is build as a module it currently fails hard as the
panel cannot be probed directly:

dw_mipi_dsi_bind()
  __dw_mipi_dsi_probe()
    creates dsi bus
    creates panel device
    triggers panel module load
    panel not probed (module not loaded or panel probe slow)
  drm_bridge_attach
    fails with -EINVAL due to empty panel_bridge

Additionally the panel probing can run concurrently with dsi bringup
making it possible that the panel can already be found but dsi-attach
hasn't finished running.

To solve that cleanly we may want to only create the component after
the panel has finished probing, by calling component_add from the
host-attach dsi callback.

As that is specific to glue drivers, add a new struct for host_ops
so that glue drivers can tell the bridge to call specific functions
after the common host-attach and before the common host-detach run.

Suggested-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181001123845.11818-4-heiko@sntech.de
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
include/drm/bridge/dw_mipi_dsi.h