linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/mediatek: dsi: Fix DSI host and panel bridge pre-enable order
@ 2025-07-01  7:30 Louis-Alexis Eyraud
  2025-07-01  8:19 ` AngeloGioacchino Del Regno
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Louis-Alexis Eyraud @ 2025-07-01  7:30 UTC (permalink / raw)
  To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Simona Vetter,
	Matthias Brugger, AngeloGioacchino Del Regno, Aradhya Bhatia,
	Thomas Zimmermann, Dmitry Baryshkov, Maxime Ripard,
	Tomi Valkeinen
  Cc: kernel, dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel,
	Louis-Alexis Eyraud

Since commit c9b1150a68d9 ("drm/atomic-helper: Re-order bridge chain
pre-enable and post-disable"), the bridge pre_enable callbacks are now
called before crtc enable, and the bridge post_disable callbacks after
the crtc disable.
In the mediatek-drm driver, this change leads to transfer errors on
mtk_dsi_host_transfer callback processing during the panel bridge
pre-enable sequence because the DSI host bridge pre_enable and CRTC
enable sequences, that are enabling the required clocks and PHY using
mtk_dsi_poweron function, are called after.

So, in order to fix this call order issue, request the DSI host bridge
be pre-enabled before panel bridge by setting pre_enable_prev_first
flag on DSI device bridge in the mtk_dsi_host_attach function.

Fixes: c9b1150a68d9 ("drm/atomic-helper: Re-order bridge chain pre-enable and post-disable")
Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
---
This patch fixes an issue that can be observed on boards such as
MediatekGenio 1200-EVK or 350-EVK with a kernel based on linux-next
(tag: next-20250635) since commit c9b1150a68d9 ("drm/atomic-helper:
Re-order bridge chain pre-enable and post-disable"). 
In boot logs, there are multiples errors such as IRQ timeouts and
panel init errors, leading the DSI panel not being enabled: 

Example on Genio 1200-EVK:
```
[drm] Wait DSI IRQ(0x00000002) Timeout
panel-himax-hx8279 1c008000.dsi.0: sending generic data b0 05 failed:
  -62
[drm] Wait DSI IRQ(0x00000008) Timeout
[drm:mtk_dsi_host_transfer [mediatek_drm]] *ERROR* failed to switch cmd
 mode
panel-himax-hx8279 1c008000.dsi.0: sending DCS SET_DISPLAY_ON failed:
  -62
```
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index d7726091819c4762698b41060b3d4d8d27940238..0e2bcd5f67b767d92f2697a5b8183f67ee178a38 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -1002,6 +1002,12 @@ static int mtk_dsi_host_attach(struct mipi_dsi_host *host,
 			return PTR_ERR(dsi->next_bridge);
 	}
 
+	/*
+	 * set flag to request the DSI host bridge be pre-enabled before device bridge
+	 * in the chain, so the DSI host is ready when the device bridge is pre-enabled
+	 */
+	dsi->next_bridge->pre_enable_prev_first = true;
+
 	drm_bridge_add(&dsi->bridge);
 
 	ret = component_add(host->dev, &mtk_dsi_component_ops);

---
base-commit: c6a68d8f7b81a6ce8962885408cc2d0c1f8b9470
change-id: 20250630-mediatek-drm-fix-dsi-panel-init-1a4b534c40a6

Best regards,
-- 
Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/mediatek: dsi: Fix DSI host and panel bridge pre-enable order
  2025-07-01  7:30 [PATCH] drm/mediatek: dsi: Fix DSI host and panel bridge pre-enable order Louis-Alexis Eyraud
@ 2025-07-01  8:19 ` AngeloGioacchino Del Regno
  2025-07-03  6:51 ` CK Hu (胡俊光)
  2025-08-14 14:12 ` Chun-Kuang Hu
  2 siblings, 0 replies; 4+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-07-01  8:19 UTC (permalink / raw)
  To: Louis-Alexis Eyraud, Chun-Kuang Hu, Philipp Zabel, David Airlie,
	Simona Vetter, Matthias Brugger, Aradhya Bhatia,
	Thomas Zimmermann, Dmitry Baryshkov, Maxime Ripard,
	Tomi Valkeinen
  Cc: kernel, dri-devel, linux-mediatek, linux-kernel, linux-arm-kernel

Il 01/07/25 09:30, Louis-Alexis Eyraud ha scritto:
> Since commit c9b1150a68d9 ("drm/atomic-helper: Re-order bridge chain
> pre-enable and post-disable"), the bridge pre_enable callbacks are now
> called before crtc enable, and the bridge post_disable callbacks after
> the crtc disable.
> In the mediatek-drm driver, this change leads to transfer errors on
> mtk_dsi_host_transfer callback processing during the panel bridge
> pre-enable sequence because the DSI host bridge pre_enable and CRTC
> enable sequences, that are enabling the required clocks and PHY using
> mtk_dsi_poweron function, are called after.
> 
> So, in order to fix this call order issue, request the DSI host bridge
> be pre-enabled before panel bridge by setting pre_enable_prev_first
> flag on DSI device bridge in the mtk_dsi_host_attach function.
> 
> Fixes: c9b1150a68d9 ("drm/atomic-helper: Re-order bridge chain pre-enable and post-disable")
> Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

> ---
> This patch fixes an issue that can be observed on boards such as
> MediatekGenio 1200-EVK or 350-EVK with a kernel based on linux-next
> (tag: next-20250635) since commit c9b1150a68d9 ("drm/atomic-helper:
> Re-order bridge chain pre-enable and post-disable").
> In boot logs, there are multiples errors such as IRQ timeouts and
> panel init errors, leading the DSI panel not being enabled:
> 
> Example on Genio 1200-EVK:
> ```
> [drm] Wait DSI IRQ(0x00000002) Timeout
> panel-himax-hx8279 1c008000.dsi.0: sending generic data b0 05 failed:
>    -62
> [drm] Wait DSI IRQ(0x00000008) Timeout
> [drm:mtk_dsi_host_transfer [mediatek_drm]] *ERROR* failed to switch cmd
>   mode
> panel-himax-hx8279 1c008000.dsi.0: sending DCS SET_DISPLAY_ON failed:
>    -62
> ```
> ---
>   drivers/gpu/drm/mediatek/mtk_dsi.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index d7726091819c4762698b41060b3d4d8d27940238..0e2bcd5f67b767d92f2697a5b8183f67ee178a38 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -1002,6 +1002,12 @@ static int mtk_dsi_host_attach(struct mipi_dsi_host *host,
>   			return PTR_ERR(dsi->next_bridge);
>   	}
>   
> +	/*
> +	 * set flag to request the DSI host bridge be pre-enabled before device bridge
> +	 * in the chain, so the DSI host is ready when the device bridge is pre-enabled
> +	 */
> +	dsi->next_bridge->pre_enable_prev_first = true;
> +
>   	drm_bridge_add(&dsi->bridge);
>   
>   	ret = component_add(host->dev, &mtk_dsi_component_ops);
> 
> ---
> base-commit: c6a68d8f7b81a6ce8962885408cc2d0c1f8b9470
> change-id: 20250630-mediatek-drm-fix-dsi-panel-init-1a4b534c40a6
> 
> Best regards,



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/mediatek: dsi: Fix DSI host and panel bridge pre-enable order
  2025-07-01  7:30 [PATCH] drm/mediatek: dsi: Fix DSI host and panel bridge pre-enable order Louis-Alexis Eyraud
  2025-07-01  8:19 ` AngeloGioacchino Del Regno
@ 2025-07-03  6:51 ` CK Hu (胡俊光)
  2025-08-14 14:12 ` Chun-Kuang Hu
  2 siblings, 0 replies; 4+ messages in thread
From: CK Hu (胡俊光) @ 2025-07-03  6:51 UTC (permalink / raw)
  To: tzimmermann@suse.de, chunkuang.hu@kernel.org, simona@ffwll.ch,
	AngeloGioacchino Del Regno, airlied@gmail.com, a-bhatia1@ti.com,
	p.zabel@pengutronix.de, matthias.bgg@gmail.com,
	Louis-Alexis Eyraud, mripard@kernel.org,
	tomi.valkeinen@ideasonboard.com, lumag@kernel.org
  Cc: dri-devel@lists.freedesktop.org,
	linux-mediatek@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org, kernel@collabora.com,
	linux-kernel@vger.kernel.org

On Tue, 2025-07-01 at 09:30 +0200, Louis-Alexis Eyraud wrote:
> External email : Please do not click links or open attachments until you have verified the sender or the content.
> 
> 
> Since commit c9b1150a68d9 ("drm/atomic-helper: Re-order bridge chain
> pre-enable and post-disable"), the bridge pre_enable callbacks are now
> called before crtc enable, and the bridge post_disable callbacks after
> the crtc disable.
> In the mediatek-drm driver, this change leads to transfer errors on
> mtk_dsi_host_transfer callback processing during the panel bridge
> pre-enable sequence because the DSI host bridge pre_enable and CRTC
> enable sequences, that are enabling the required clocks and PHY using
> mtk_dsi_poweron function, are called after.
> 
> So, in order to fix this call order issue, request the DSI host bridge
> be pre-enabled before panel bridge by setting pre_enable_prev_first
> flag on DSI device bridge in the mtk_dsi_host_attach function.

Reviewed-by: CK Hu <ck.hu@mediatek.com>

> 
> Fixes: c9b1150a68d9 ("drm/atomic-helper: Re-order bridge chain pre-enable and post-disable")
> Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
> ---
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/mediatek: dsi: Fix DSI host and panel bridge pre-enable order
  2025-07-01  7:30 [PATCH] drm/mediatek: dsi: Fix DSI host and panel bridge pre-enable order Louis-Alexis Eyraud
  2025-07-01  8:19 ` AngeloGioacchino Del Regno
  2025-07-03  6:51 ` CK Hu (胡俊光)
@ 2025-08-14 14:12 ` Chun-Kuang Hu
  2 siblings, 0 replies; 4+ messages in thread
From: Chun-Kuang Hu @ 2025-08-14 14:12 UTC (permalink / raw)
  To: Louis-Alexis Eyraud
  Cc: Chun-Kuang Hu, Philipp Zabel, David Airlie, Simona Vetter,
	Matthias Brugger, AngeloGioacchino Del Regno, Aradhya Bhatia,
	Thomas Zimmermann, Dmitry Baryshkov, Maxime Ripard,
	Tomi Valkeinen, kernel, dri-devel, linux-mediatek, linux-kernel,
	linux-arm-kernel

Hi, Louis:

Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com> 於 2025年7月1日 週二 下午3:31寫道:
>
> Since commit c9b1150a68d9 ("drm/atomic-helper: Re-order bridge chain
> pre-enable and post-disable"), the bridge pre_enable callbacks are now
> called before crtc enable, and the bridge post_disable callbacks after
> the crtc disable.
> In the mediatek-drm driver, this change leads to transfer errors on
> mtk_dsi_host_transfer callback processing during the panel bridge
> pre-enable sequence because the DSI host bridge pre_enable and CRTC
> enable sequences, that are enabling the required clocks and PHY using
> mtk_dsi_poweron function, are called after.
>
> So, in order to fix this call order issue, request the DSI host bridge
> be pre-enabled before panel bridge by setting pre_enable_prev_first
> flag on DSI device bridge in the mtk_dsi_host_attach function.

Applied to mediatek-drm-fixes [1], thanks.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-fixes

Regards,
Chun-Kuang.

>
> Fixes: c9b1150a68d9 ("drm/atomic-helper: Re-order bridge chain pre-enable and post-disable")
> Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
> ---
> This patch fixes an issue that can be observed on boards such as
> MediatekGenio 1200-EVK or 350-EVK with a kernel based on linux-next
> (tag: next-20250635) since commit c9b1150a68d9 ("drm/atomic-helper:
> Re-order bridge chain pre-enable and post-disable").
> In boot logs, there are multiples errors such as IRQ timeouts and
> panel init errors, leading the DSI panel not being enabled:
>
> Example on Genio 1200-EVK:
> ```
> [drm] Wait DSI IRQ(0x00000002) Timeout
> panel-himax-hx8279 1c008000.dsi.0: sending generic data b0 05 failed:
>   -62
> [drm] Wait DSI IRQ(0x00000008) Timeout
> [drm:mtk_dsi_host_transfer [mediatek_drm]] *ERROR* failed to switch cmd
>  mode
> panel-himax-hx8279 1c008000.dsi.0: sending DCS SET_DISPLAY_ON failed:
>   -62
> ```
> ---
>  drivers/gpu/drm/mediatek/mtk_dsi.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index d7726091819c4762698b41060b3d4d8d27940238..0e2bcd5f67b767d92f2697a5b8183f67ee178a38 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -1002,6 +1002,12 @@ static int mtk_dsi_host_attach(struct mipi_dsi_host *host,
>                         return PTR_ERR(dsi->next_bridge);
>         }
>
> +       /*
> +        * set flag to request the DSI host bridge be pre-enabled before device bridge
> +        * in the chain, so the DSI host is ready when the device bridge is pre-enabled
> +        */
> +       dsi->next_bridge->pre_enable_prev_first = true;
> +
>         drm_bridge_add(&dsi->bridge);
>
>         ret = component_add(host->dev, &mtk_dsi_component_ops);
>
> ---
> base-commit: c6a68d8f7b81a6ce8962885408cc2d0c1f8b9470
> change-id: 20250630-mediatek-drm-fix-dsi-panel-init-1a4b534c40a6
>
> Best regards,
> --
> Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-08-14 14:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-01  7:30 [PATCH] drm/mediatek: dsi: Fix DSI host and panel bridge pre-enable order Louis-Alexis Eyraud
2025-07-01  8:19 ` AngeloGioacchino Del Regno
2025-07-03  6:51 ` CK Hu (胡俊光)
2025-08-14 14:12 ` Chun-Kuang Hu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).