On 13.05.2024 04:16, Marek Vasut wrote:
> Initialize the bridge on attach already, to force lanes into LP11
> state, since attach does trigger attach of downstream bridges which
> may trigger (e)DP AUX channel mode read.
>
> This fixes a corner case where DSIM with TC9595 attached to it fails
> to operate the DP AUX channel, because the TC9595 enters some debug
> mode when it is released from reset without lanes in LP11 mode. By
> ensuring the DSIM lanes are in LP11, the TC9595 (tc358767.c driver)
> can be reset in its attach callback called from DSIM attach callback,
> and recovered out of the debug mode just before TC9595 performs first
> AUX channel access later in its attach callback.
>
> Signed-off-by: Marek Vasut <[email protected]>

This patch breaks driver operation on Samsung TM2e board with S6E3HF2 
DSI panel. The initialization procedure is very fragile and it looks 
that the changes must be done very carefully. We discussed this many 
times when converting this driver from Exynos DSI to generic Samsung DSI 
used on IMX and other SoCs.

> ---
> Cc: Adam Ford <[email protected]>
> Cc: Alexander Stein <[email protected]>
> Cc: Andrzej Hajda <[email protected]>
> Cc: Daniel Vetter <[email protected]>
> Cc: David Airlie <[email protected]>
> Cc: Frieder Schrempf <[email protected]>
> Cc: Inki Dae <[email protected]>
> Cc: Jagan Teki <[email protected]>
> Cc: Jernej Skrabec <[email protected]>
> Cc: Jonas Karlman <[email protected]>
> Cc: Laurent Pinchart <[email protected]>
> Cc: Lucas Stach <[email protected]>
> Cc: Maarten Lankhorst <[email protected]>
> Cc: Marek Szyprowski <[email protected]>
> Cc: Maxime Ripard <[email protected]>
> Cc: Michael Walle <[email protected]>
> Cc: Neil Armstrong <[email protected]>
> Cc: Robert Foss <[email protected]>
> Cc: Thomas Zimmermann <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> ---
>   drivers/gpu/drm/bridge/samsung-dsim.c | 16 ++++++++++++++--
>   1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c 
> b/drivers/gpu/drm/bridge/samsung-dsim.c
> index 95fedc68b0ae5..56093fc3d62cc 100644
> --- a/drivers/gpu/drm/bridge/samsung-dsim.c
> +++ b/drivers/gpu/drm/bridge/samsung-dsim.c
> @@ -1622,9 +1622,21 @@ static int samsung_dsim_attach(struct drm_bridge 
> *bridge,
>                              enum drm_bridge_attach_flags flags)
>   {
>       struct samsung_dsim *dsi = bridge_to_dsi(bridge);
> +     int ret;
> +
> +     ret = pm_runtime_resume_and_get(dsi->dev);
> +     if (ret < 0)
> +             return ret;
>   
> -     return drm_bridge_attach(bridge->encoder, dsi->out_bridge, bridge,
> -                              flags);
> +     ret = samsung_dsim_init(dsi);
> +     if (ret < 0)
> +             goto err;
> +
> +     ret = drm_bridge_attach(bridge->encoder, dsi->out_bridge, bridge,
> +                             flags);
> +err:
> +     pm_runtime_put_sync(dsi->dev);
> +     return ret;
>   }
>   
>   static const struct drm_bridge_funcs samsung_dsim_bridge_funcs = {

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland

Reply via email to