Hello Stefan,

> 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]>
>
> diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c 
> b/drivers/gpu/drm/bridge/nwl-dsi.c
> index 1aab46e1a168..2b1af6d1d58b 100644
> --- a/drivers/gpu/drm/bridge/nwl-dsi.c
> +++ b/drivers/gpu/drm/bridge/nwl-dsi.c
> @@ -738,8 +738,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;
> @@ -968,7 +968,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,

Looks OK to me, and I don't think it's going to break.

However it would be good to have testing on other platforms, so I'd wait a
moment before applying, in case someone has a change to test.

Reviewed-by: Luca Ceresoli <[email protected]>

Luca

-- 
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Reply via email to