From: Liu Ying <[email protected]>

Some MIPI DSI panels, like the Raydium RM68200, send DCS commands such
as MIPI_DCS_SET_DISPLAY_OFF and MIPI_DCS_ENTER_SLEEP_MODE from their
drm_panel_funcs::unprepare() callback. For those commands to reach the
panel, the DSI host controller and its PHY must still be running.

The panel bridge calls drm_panel_unprepare() from its post_disable
hook, while nwl-dsi currently shuts down the controller, the PHY and
the clocks from ->atomic_disable(). Since all ->atomic_disable() hooks
in a bridge chain run before any ->atomic_post_disable() hook, the DSI
link is already down by the time the panel tries to talk to it.

Move the disablement to ->atomic_post_disable(), so that a downstream
panel bridge that sets pre_enable_prev_first gets a chance to send its
shutdown commands first. The enable side is unaffected: the controller
is brought out of reset in ->mode_set(), which runs before any
pre_enable hook.

Fixes: 44cfc6233447 ("drm/bridge: Add NWL MIPI DSI host controller support")
Signed-off-by: Liu Ying <[email protected]>
Signed-off-by: Stefan Ghetu <[email protected]>
---
 drivers/gpu/drm/bridge/nwl-dsi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c
index 09992529f3d85..5c82f0986eabb 100644
--- a/drivers/gpu/drm/bridge/nwl-dsi.c
+++ b/drivers/gpu/drm/bridge/nwl-dsi.c
@@ -736,8 +736,8 @@ static int nwl_dsi_disable(struct nwl_dsi *dsi)
        return 0;
 }
 
-static void nwl_dsi_bridge_atomic_disable(struct drm_bridge *bridge,
-                                         struct drm_atomic_commit *state)
+static void nwl_dsi_bridge_atomic_post_disable(struct drm_bridge *bridge,
+                                              struct drm_atomic_commit *state)
 {
        struct nwl_dsi *dsi = bridge_to_dsi(bridge);
        int ret;
@@ -963,7 +963,7 @@ static const struct drm_bridge_funcs nwl_dsi_bridge_funcs = 
{
        .atomic_create_state            = drm_atomic_helper_bridge_create_state,
        .atomic_check           = nwl_dsi_bridge_atomic_check,
        .atomic_enable          = nwl_dsi_bridge_atomic_enable,
-       .atomic_disable         = nwl_dsi_bridge_atomic_disable,
+       .atomic_post_disable    = nwl_dsi_bridge_atomic_post_disable,
        .atomic_get_input_bus_fmts = nwl_bridge_atomic_get_input_bus_fmts,
        .mode_set               = nwl_dsi_bridge_mode_set,
        .mode_valid             = nwl_dsi_bridge_mode_valid,
-- 
2.53.0

Reply via email to