linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/mediatek: mtk-dpi: Set out_fmt from config if not the last bridge
@ 2021-07-12  9:46 Hsin-Yi Wang
  2021-07-16  5:46 ` CK Hu
  2021-07-22 14:50 ` Chun-Kuang Hu
  0 siblings, 2 replies; 3+ messages in thread
From: Hsin-Yi Wang @ 2021-07-12  9:46 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Philipp Zabel, David Airlie, Daniel Vetter, Matthias Brugger,
	Rex-BC Chen, Jitao Shi, dri-devel, linux-mediatek,
	linux-arm-kernel, linux-kernel

atomic_get_output_bus_fmts() is only called when the bridge is the last
element in the bridge chain.

If mtk-dpi is not the last bridge, the format of output_bus_cfg is
MEDIA_BUS_FMT_FIXED, and mtk_dpi_dual_edge() will fail to write correct
value to regs.

Fixes: ec8747c52434 ("drm/mediatek: dpi: Add bus format negotiation")
Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
---
 drivers/gpu/drm/mediatek/mtk_dpi.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
index bced555648b01..25c565f9179cc 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -610,6 +610,10 @@ static int mtk_dpi_bridge_atomic_check(struct drm_bridge *bridge,
 
 	out_bus_format = bridge_state->output_bus_cfg.format;
 
+	if (out_bus_format == MEDIA_BUS_FMT_FIXED)
+		if (dpi->conf->num_output_fmts)
+			out_bus_format = dpi->conf->output_fmts[0];
+
 	dev_dbg(dpi->dev, "input format 0x%04x, output format 0x%04x\n",
 		bridge_state->input_bus_cfg.format,
 		bridge_state->output_bus_cfg.format);
-- 
2.32.0.93.g670b81a890-goog


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

* Re: [PATCH] drm/mediatek: mtk-dpi: Set out_fmt from config if not the last bridge
  2021-07-12  9:46 [PATCH] drm/mediatek: mtk-dpi: Set out_fmt from config if not the last bridge Hsin-Yi Wang
@ 2021-07-16  5:46 ` CK Hu
  2021-07-22 14:50 ` Chun-Kuang Hu
  1 sibling, 0 replies; 3+ messages in thread
From: CK Hu @ 2021-07-16  5:46 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: Chun-Kuang Hu, Jitao Shi, David Airlie, linux-kernel, dri-devel,
	Rex-BC Chen, linux-mediatek, Matthias Brugger, linux-arm-kernel

Hi, Hsin-yi:

On Mon, 2021-07-12 at 17:46 +0800, Hsin-Yi Wang wrote:
> atomic_get_output_bus_fmts() is only called when the bridge is the last
> element in the bridge chain.
> 
> If mtk-dpi is not the last bridge, the format of output_bus_cfg is
> MEDIA_BUS_FMT_FIXED, and mtk_dpi_dual_edge() will fail to write correct
> value to regs.

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

> 
> Fixes: ec8747c52434 ("drm/mediatek: dpi: Add bus format negotiation")
> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> ---
>  drivers/gpu/drm/mediatek/mtk_dpi.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index bced555648b01..25c565f9179cc 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -610,6 +610,10 @@ static int mtk_dpi_bridge_atomic_check(struct drm_bridge *bridge,
>  
>  	out_bus_format = bridge_state->output_bus_cfg.format;
>  
> +	if (out_bus_format == MEDIA_BUS_FMT_FIXED)
> +		if (dpi->conf->num_output_fmts)
> +			out_bus_format = dpi->conf->output_fmts[0];
> +
>  	dev_dbg(dpi->dev, "input format 0x%04x, output format 0x%04x\n",
>  		bridge_state->input_bus_cfg.format,
>  		bridge_state->output_bus_cfg.format);


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

* Re: [PATCH] drm/mediatek: mtk-dpi: Set out_fmt from config if not the last bridge
  2021-07-12  9:46 [PATCH] drm/mediatek: mtk-dpi: Set out_fmt from config if not the last bridge Hsin-Yi Wang
  2021-07-16  5:46 ` CK Hu
@ 2021-07-22 14:50 ` Chun-Kuang Hu
  1 sibling, 0 replies; 3+ messages in thread
From: Chun-Kuang Hu @ 2021-07-22 14:50 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, Rex-BC Chen, Jitao Shi, DRI Development,
	moderated list:ARM/Mediatek SoC support, Linux ARM, linux-kernel

Hi, Hsin-yi:

Hsin-Yi Wang <hsinyi@chromium.org> 於 2021年7月12日 週一 下午5:47寫道:
>
> atomic_get_output_bus_fmts() is only called when the bridge is the last
> element in the bridge chain.
>
> If mtk-dpi is not the last bridge, the format of output_bus_cfg is
> MEDIA_BUS_FMT_FIXED, and mtk_dpi_dual_edge() will fail to write correct
> value to regs.

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: ec8747c52434 ("drm/mediatek: dpi: Add bus format negotiation")
> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> ---
>  drivers/gpu/drm/mediatek/mtk_dpi.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index bced555648b01..25c565f9179cc 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -610,6 +610,10 @@ static int mtk_dpi_bridge_atomic_check(struct drm_bridge *bridge,
>
>         out_bus_format = bridge_state->output_bus_cfg.format;
>
> +       if (out_bus_format == MEDIA_BUS_FMT_FIXED)
> +               if (dpi->conf->num_output_fmts)
> +                       out_bus_format = dpi->conf->output_fmts[0];
> +
>         dev_dbg(dpi->dev, "input format 0x%04x, output format 0x%04x\n",
>                 bridge_state->input_bus_cfg.format,
>                 bridge_state->output_bus_cfg.format);
> --
> 2.32.0.93.g670b81a890-goog
>

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

end of thread, other threads:[~2021-07-22 14:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-12  9:46 [PATCH] drm/mediatek: mtk-dpi: Set out_fmt from config if not the last bridge Hsin-Yi Wang
2021-07-16  5:46 ` CK Hu
2021-07-22 14:50 ` 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).