* [PATCH v4] gpu/drm: mediatek: call mtk_dsi_stop() after mtk_drm_crtc_atomic_disable()
@ 2019-05-30 9:18 Hsin-Yi Wang
2019-05-30 10:06 ` CK Hu
2019-06-04 2:05 ` CK Hu
0 siblings, 2 replies; 3+ messages in thread
From: Hsin-Yi Wang @ 2019-05-30 9:18 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Philipp Zabel, David Airlie, linux-kernel, dri-devel,
Matthias Brugger, linux-mediatek, Daniel Vetter, CK Hu
mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(), which needs
ovl irq for drm_crtc_wait_one_vblank(), since after mtk_dsi_stop() is called,
ovl irq will be disabled. If drm_crtc_wait_one_vblank() is called after last
irq, it will timeout with this message: "vblank wait timed out on crtc 0". This
happens sometimes when turning off the screen.
In drm_atomic_helper.c#disable_outputs(),
the calling sequence when turning off the screen is:
1. mtk_dsi_encoder_disable()
--> mtk_output_dsi_disable()
--> mtk_dsi_stop(); // sometimes make vblank timeout in atomic_disable
--> mtk_dsi_poweroff();
2. mtk_drm_crtc_atomic_disable()
--> drm_crtc_wait_one_vblank();
...
--> mtk_dsi_ddp_stop()
--> mtk_dsi_poweroff();
mtk_dsi_poweroff() has reference count design, change to make mtk_dsi_stop()
called in mtk_dsi_poweroff() when refcount is 0.
Fixes: 0707632b5bac ("drm/mediatek: update DSI sub driver flow for sending commands to panel")
Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
---
change log v3->v4:
* add comment in code.
---
drivers/gpu/drm/mediatek/mtk_dsi.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index b00eb2d2e086..730594a91440 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -630,6 +630,15 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)
if (--dsi->refcount != 0)
return;
+ /*
+ * mtk_dsi_stop() and mtk_dsi_start() is asymmetric, since
+ * mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(),
+ * which needs irq for vblank, and mtk_dsi_stop() will disable irq.
+ * mtk_dsi_start() needs to be called in mtk_output_dsi_enable(),
+ * after dsi is fully set.
+ */
+ mtk_dsi_stop(dsi);
+
if (!mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500)) {
if (dsi->panel) {
if (drm_panel_unprepare(dsi->panel)) {
@@ -696,7 +705,6 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi)
}
}
- mtk_dsi_stop(dsi);
mtk_dsi_poweroff(dsi);
dsi->enabled = false;
--
2.20.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v4] gpu/drm: mediatek: call mtk_dsi_stop() after mtk_drm_crtc_atomic_disable()
2019-05-30 9:18 [PATCH v4] gpu/drm: mediatek: call mtk_dsi_stop() after mtk_drm_crtc_atomic_disable() Hsin-Yi Wang
@ 2019-05-30 10:06 ` CK Hu
2019-06-04 2:05 ` CK Hu
1 sibling, 0 replies; 3+ messages in thread
From: CK Hu @ 2019-05-30 10:06 UTC (permalink / raw)
To: Hsin-Yi Wang
Cc: Philipp Zabel, David Airlie, linux-kernel, dri-devel,
linux-mediatek, Daniel Vetter, Matthias Brugger,
linux-arm-kernel
Hi, Hsin-Yi:
On Thu, 2019-05-30 at 17:18 +0800, Hsin-Yi Wang wrote:
> mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(), which needs
> ovl irq for drm_crtc_wait_one_vblank(), since after mtk_dsi_stop() is called,
> ovl irq will be disabled. If drm_crtc_wait_one_vblank() is called after last
> irq, it will timeout with this message: "vblank wait timed out on crtc 0". This
> happens sometimes when turning off the screen.
>
> In drm_atomic_helper.c#disable_outputs(),
> the calling sequence when turning off the screen is:
>
> 1. mtk_dsi_encoder_disable()
> --> mtk_output_dsi_disable()
> --> mtk_dsi_stop(); // sometimes make vblank timeout in atomic_disable
> --> mtk_dsi_poweroff();
> 2. mtk_drm_crtc_atomic_disable()
> --> drm_crtc_wait_one_vblank();
> ...
> --> mtk_dsi_ddp_stop()
> --> mtk_dsi_poweroff();
>
> mtk_dsi_poweroff() has reference count design, change to make mtk_dsi_stop()
> called in mtk_dsi_poweroff() when refcount is 0.
Reviewed-by: CK Hu <ck.hu@mediatek.com>
>
> Fixes: 0707632b5bac ("drm/mediatek: update DSI sub driver flow for sending commands to panel")
> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> ---
> change log v3->v4:
> * add comment in code.
> ---
> drivers/gpu/drm/mediatek/mtk_dsi.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index b00eb2d2e086..730594a91440 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -630,6 +630,15 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)
> if (--dsi->refcount != 0)
> return;
>
> + /*
> + * mtk_dsi_stop() and mtk_dsi_start() is asymmetric, since
> + * mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(),
> + * which needs irq for vblank, and mtk_dsi_stop() will disable irq.
> + * mtk_dsi_start() needs to be called in mtk_output_dsi_enable(),
> + * after dsi is fully set.
> + */
> + mtk_dsi_stop(dsi);
> +
> if (!mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500)) {
> if (dsi->panel) {
> if (drm_panel_unprepare(dsi->panel)) {
> @@ -696,7 +705,6 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi)
> }
> }
>
> - mtk_dsi_stop(dsi);
> mtk_dsi_poweroff(dsi);
>
> dsi->enabled = false;
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v4] gpu/drm: mediatek: call mtk_dsi_stop() after mtk_drm_crtc_atomic_disable()
2019-05-30 9:18 [PATCH v4] gpu/drm: mediatek: call mtk_dsi_stop() after mtk_drm_crtc_atomic_disable() Hsin-Yi Wang
2019-05-30 10:06 ` CK Hu
@ 2019-06-04 2:05 ` CK Hu
1 sibling, 0 replies; 3+ messages in thread
From: CK Hu @ 2019-06-04 2:05 UTC (permalink / raw)
To: Hsin-Yi Wang
Cc: Philipp Zabel, David Airlie, linux-kernel, dri-devel,
linux-mediatek, Daniel Vetter, Matthias Brugger,
linux-arm-kernel
Hi, Hsin-Yi:
On Thu, 2019-05-30 at 17:18 +0800, Hsin-Yi Wang wrote:
> mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(), which needs
> ovl irq for drm_crtc_wait_one_vblank(), since after mtk_dsi_stop() is called,
> ovl irq will be disabled. If drm_crtc_wait_one_vblank() is called after last
> irq, it will timeout with this message: "vblank wait timed out on crtc 0". This
> happens sometimes when turning off the screen.
>
> In drm_atomic_helper.c#disable_outputs(),
> the calling sequence when turning off the screen is:
>
> 1. mtk_dsi_encoder_disable()
> --> mtk_output_dsi_disable()
> --> mtk_dsi_stop(); // sometimes make vblank timeout in atomic_disable
> --> mtk_dsi_poweroff();
> 2. mtk_drm_crtc_atomic_disable()
> --> drm_crtc_wait_one_vblank();
> ...
> --> mtk_dsi_ddp_stop()
> --> mtk_dsi_poweroff();
>
> mtk_dsi_poweroff() has reference count design, change to make mtk_dsi_stop()
> called in mtk_dsi_poweroff() when refcount is 0.
Applied to mediatek-drm-fixes-5.2 [1], thanks.
[1]
https://github.com/ckhu-mediatek/linux.git-tags/commits/mediatek-drm-fixes-5.2
Regards,
CK
>
> Fixes: 0707632b5bac ("drm/mediatek: update DSI sub driver flow for sending commands to panel")
> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> ---
> change log v3->v4:
> * add comment in code.
> ---
> drivers/gpu/drm/mediatek/mtk_dsi.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index b00eb2d2e086..730594a91440 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -630,6 +630,15 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)
> if (--dsi->refcount != 0)
> return;
>
> + /*
> + * mtk_dsi_stop() and mtk_dsi_start() is asymmetric, since
> + * mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(),
> + * which needs irq for vblank, and mtk_dsi_stop() will disable irq.
> + * mtk_dsi_start() needs to be called in mtk_output_dsi_enable(),
> + * after dsi is fully set.
> + */
> + mtk_dsi_stop(dsi);
> +
> if (!mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500)) {
> if (dsi->panel) {
> if (drm_panel_unprepare(dsi->panel)) {
> @@ -696,7 +705,6 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi)
> }
> }
>
> - mtk_dsi_stop(dsi);
> mtk_dsi_poweroff(dsi);
>
> dsi->enabled = false;
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-04 2:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-30 9:18 [PATCH v4] gpu/drm: mediatek: call mtk_dsi_stop() after mtk_drm_crtc_atomic_disable() Hsin-Yi Wang
2019-05-30 10:06 ` CK Hu
2019-06-04 2:05 ` CK 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).