dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] gpu/drm: mediatek: call mtk_dsi_stop() after mtk_drm_crtc_atomic_disable()
@ 2019-03-20  7:18 Hsin-Yi Wang
  2019-03-20 18:01 ` Aw: " Frank Wunderlich
  2019-03-21  1:28 ` CK Hu
  0 siblings, 2 replies; 9+ messages in thread
From: Hsin-Yi Wang @ 2019-03-20  7: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:
v1->v2:
 * update commit message.
 * call mtk_dsi_stop() in mtk_dsi_poweroff() when refcount is 0.
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index b00eb2d2e086..e152f37af57d 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -630,6 +630,8 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)
 	if (--dsi->refcount != 0)
 		return;
 
+	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 +698,6 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi)
 		}
 	}
 
-	mtk_dsi_stop(dsi);
 	mtk_dsi_poweroff(dsi);
 
 	dsi->enabled = false;
@@ -1178,6 +1179,8 @@ static int mtk_dsi_remove(struct platform_device *pdev)
 	struct mtk_dsi *dsi = platform_get_drvdata(pdev);
 
 	mtk_output_dsi_disable(dsi);
+	mtk_dsi_stop(dsi);
+	mtk_dsi_poweroff(dsi);
 	component_del(&pdev->dev, &mtk_dsi_component_ops);
 
 	return 0;
-- 
2.20.1

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

* Aw: [PATCH v2] gpu/drm: mediatek: call mtk_dsi_stop() after mtk_drm_crtc_atomic_disable()
  2019-03-20  7:18 [PATCH v2] gpu/drm: mediatek: call mtk_dsi_stop() after mtk_drm_crtc_atomic_disable() Hsin-Yi Wang
@ 2019-03-20 18:01 ` Frank Wunderlich
  2019-03-21  1:36   ` CK Hu
  2019-03-21  1:28 ` CK Hu
  1 sibling, 1 reply; 9+ messages in thread
From: Frank Wunderlich @ 2019-03-20 18:01 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: Daniel Vetter, David Airlie, linux-kernel, dri-devel, CK Hu,
	linux-mediatek, Philipp Zabel, Matthias Brugger,
	linux-arm-kernel

Hi,

i hoped this fixes my warning (maybe have similar cause) on bananapi-r2/mt7623

[    6.872034] WARNING: CPU: 2 PID: 160 at drivers/gpu/drm/drm_atomic_helper.c:1
430 drm_atomic_helper_wait_for_vblanks.part.1+0x2a4/0x2a8
[    6.872038] [CRTC:36:crtc-0] vblank wait timed out

...

[    6.872127] [<c0126e4c>] (__warn) from [<c0126fac>] (warn_slowpath_fmt+0x58/0
x74)
[    6.872136]  r9:00000000 r8:00000001 r7:00000000 r6:00000001 r5:c0d7da9c r4:c
1008c48
[    6.872145] [<c0126f58>] (warn_slowpath_fmt) from [<c05ce65c>] (drm_atomic_helper_wait_for_vblanks.part.1+0x2a4/0x2a8)
[    6.872150]  r3:00000024 r2:c0d7da9c
[    6.872154]  r5:00000000 r4:d991f440
[    6.872164] [<c05ce3b8>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c05ce684>] (drm_atomic_helper_wait_for_vblanks+0x24/0x28)
[    6.872172]  r10:dae68f28 r9:dae68f38 r8:00000000 r7:d9f759c0 r6:d991ec00 r5:d9f759c0
[    6.872175]  r4:00000005
[    6.872185] [<c05ce660>] (drm_atomic_helper_wait_for_vblanks) from [<c060af04>] (mtk_atomic_complete+0x98/0xc0)
[    6.872194] [<c060ae6c>] (mtk_atomic_complete) from [<c060aff4>] (mtk_atomic_commit+0xc8/0xcc)
[    6.872201]  r7:d9f759c0 r6:dae68e40 r5:d991ec00 r4:00000000
[    6.872211] [<c060af2c>] (mtk_atomic_commit) from [<c05efed0>] (drm_atomic_commit+0x54/0x60)
[    6.872219]  r10:00000002 r9:d9f74eac r8:00000001 r7:d98d5700 r6:d991ec00 r5:d9f759c0
[    6.872223]  r4:00000000 r3:c060af2c
[    6.872234] [<c05efe7c>] (drm_atomic_commit) from [<c05d33b8>] (restore_fbdev_mode_atomic+0x1d4/0x1e4)
[    6.872241]  r7:d98d5700 r6:00000001 r5:d991edb0 r4:d9f759c0
[    6.872251] [<c05d31e4>] (restore_fbdev_mode_atomic) from [<c05d5598>] (restore_fbdev_mode+0x5c/0x194)
[    6.872260]  r10:00000000 r9:d991ecdc r8:d98d57b4 r7:00000000 r6:d98d5700 r5:d98d5700
[    6.872263]  r4:00000000
[    6.872274] [<c05d553c>] (restore_fbdev_mode) from [<c05d7054>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x64/0xb0)
[    6.872282]  r10:00000000 r9:d991ecdc r8:d98d57b4 r7:00000000 r6:c10824c8 r5:d98d5700
[    6.872285]  r4:00000000
[    6.872296] [<c05d6ff0>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c05d70e0>] (drm_fb_helper_set_par+0x40/0x64)
[    6.872304]  r9:d991ecdc r8:d991ec8c r7:c0d82d88 r6:d98d57b4 r5:00000000 r4:00000000
[    6.872315] [<c05d70a0>] (drm_fb_helper_set_par) from [<c05d6fa4>] (drm_fb_helper_hotplug_event.part.11+0xb0/0xb8)
[    6.872319]  r5:00000000 r4:d98d5700
[    6.872330] [<c05d6ef4>] (drm_fb_helper_hotplug_event.part.11) from [<c05d72c8>] (drm_fbdev_client_hotplug+0x13c/0x1d8)
[    6.872337]  r7:c0d82d88 r6:d991eca0 r5:d991ec00 r4:d98d5700
[    6.872348] [<c05d718c>] (drm_fbdev_client_hotplug) from [<c0601640>] (drm_client_dev_hotplug+0x84/0xc0)

this crash also happens without fbdev-patch

my codebase: https://github.com/frank-w/BPI-R2-4.14/commits/5.1-hdmi

regards Frank

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

* Re: [PATCH v2] gpu/drm: mediatek: call mtk_dsi_stop() after mtk_drm_crtc_atomic_disable()
  2019-03-20  7:18 [PATCH v2] gpu/drm: mediatek: call mtk_dsi_stop() after mtk_drm_crtc_atomic_disable() Hsin-Yi Wang
  2019-03-20 18:01 ` Aw: " Frank Wunderlich
@ 2019-03-21  1:28 ` CK Hu
  2019-03-21  1:46   ` CK Hu
  1 sibling, 1 reply; 9+ messages in thread
From: CK Hu @ 2019-03-21  1:28 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: linux-arm-kernel, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, dri-devel, linux-mediatek, linux-kernel

Hi, Hsin-yi:

On Wed, 2019-03-20 at 15: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.
> 
> 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:
> v1->v2:
>  * update commit message.
>  * call mtk_dsi_stop() in mtk_dsi_poweroff() when refcount is 0.
> ---
>  drivers/gpu/drm/mediatek/mtk_dsi.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index b00eb2d2e086..e152f37af57d 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -630,6 +630,8 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)
>  	if (--dsi->refcount != 0)
>  		return;
>  
> +	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)) {

I think you just move mtk_dsi_stop() into mtk_dsi_poweroff() would works
fine, but I would rather like calling mtk_dsi_start() and mtk_dsi_stop()
in a symmetric manner. That means you may also move below functions into
mtk_dsi_poweron():

mtk_dsi_set_mode(dsi);
mtk_dsi_clk_hs_mode(dsi, 1);
mtk_dsi_start(dsi);


> @@ -696,7 +698,6 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi)
>  		}
>  	}
>  
> -	mtk_dsi_stop(dsi);
>  	mtk_dsi_poweroff(dsi);
>  
>  	dsi->enabled = false;
> @@ -1178,6 +1179,8 @@ static int mtk_dsi_remove(struct platform_device *pdev)
>  	struct mtk_dsi *dsi = platform_get_drvdata(pdev);
>  
>  	mtk_output_dsi_disable(dsi);
> +	mtk_dsi_stop(dsi);
> +	mtk_dsi_poweroff(dsi);

I think mtk_output_dsi_disable() would call mtk_dsi_poweroff(), and
mtk_dsi_poweroff() would call mtk_dsi_stop(), so these two line are
redundant. And I think you should remove mtk_dsi_stop() in
mtk_output_dsi_disable(), why not in this patch?

Regards,
CK

>  	component_del(&pdev->dev, &mtk_dsi_component_ops);
>  
>  	return 0;

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

* Re: Aw: [PATCH v2] gpu/drm: mediatek: call mtk_dsi_stop() after mtk_drm_crtc_atomic_disable()
  2019-03-20 18:01 ` Aw: " Frank Wunderlich
@ 2019-03-21  1:36   ` CK Hu
  0 siblings, 0 replies; 9+ messages in thread
From: CK Hu @ 2019-03-21  1:36 UTC (permalink / raw)
  To: Frank Wunderlich
  Cc: Hsin-Yi Wang, linux-arm-kernel, Philipp Zabel, David Airlie,
	linux-kernel, dri-devel, Matthias Brugger, linux-mediatek,
	Daniel Vetter

Hi, Frank:

On Wed, 2019-03-20 at 19:01 +0100, Frank Wunderlich wrote:
> Hi,
> 
> i hoped this fixes my warning (maybe have similar cause) on bananapi-r2/mt7623

This patch fix the problem of dsi driver. Your case is hdmi output which
does not go through dsi hardware. So your problem is another cause.

Regards,
CK

> 
> [    6.872034] WARNING: CPU: 2 PID: 160 at drivers/gpu/drm/drm_atomic_helper.c:1
> 430 drm_atomic_helper_wait_for_vblanks.part.1+0x2a4/0x2a8
> [    6.872038] [CRTC:36:crtc-0] vblank wait timed out
> 
> ...
> 
> [    6.872127] [<c0126e4c>] (__warn) from [<c0126fac>] (warn_slowpath_fmt+0x58/0
> x74)
> [    6.872136]  r9:00000000 r8:00000001 r7:00000000 r6:00000001 r5:c0d7da9c r4:c
> 1008c48
> [    6.872145] [<c0126f58>] (warn_slowpath_fmt) from [<c05ce65c>] (drm_atomic_helper_wait_for_vblanks.part.1+0x2a4/0x2a8)
> [    6.872150]  r3:00000024 r2:c0d7da9c
> [    6.872154]  r5:00000000 r4:d991f440
> [    6.872164] [<c05ce3b8>] (drm_atomic_helper_wait_for_vblanks.part.1) from [<c05ce684>] (drm_atomic_helper_wait_for_vblanks+0x24/0x28)
> [    6.872172]  r10:dae68f28 r9:dae68f38 r8:00000000 r7:d9f759c0 r6:d991ec00 r5:d9f759c0
> [    6.872175]  r4:00000005
> [    6.872185] [<c05ce660>] (drm_atomic_helper_wait_for_vblanks) from [<c060af04>] (mtk_atomic_complete+0x98/0xc0)
> [    6.872194] [<c060ae6c>] (mtk_atomic_complete) from [<c060aff4>] (mtk_atomic_commit+0xc8/0xcc)
> [    6.872201]  r7:d9f759c0 r6:dae68e40 r5:d991ec00 r4:00000000
> [    6.872211] [<c060af2c>] (mtk_atomic_commit) from [<c05efed0>] (drm_atomic_commit+0x54/0x60)
> [    6.872219]  r10:00000002 r9:d9f74eac r8:00000001 r7:d98d5700 r6:d991ec00 r5:d9f759c0
> [    6.872223]  r4:00000000 r3:c060af2c
> [    6.872234] [<c05efe7c>] (drm_atomic_commit) from [<c05d33b8>] (restore_fbdev_mode_atomic+0x1d4/0x1e4)
> [    6.872241]  r7:d98d5700 r6:00000001 r5:d991edb0 r4:d9f759c0
> [    6.872251] [<c05d31e4>] (restore_fbdev_mode_atomic) from [<c05d5598>] (restore_fbdev_mode+0x5c/0x194)
> [    6.872260]  r10:00000000 r9:d991ecdc r8:d98d57b4 r7:00000000 r6:d98d5700 r5:d98d5700
> [    6.872263]  r4:00000000
> [    6.872274] [<c05d553c>] (restore_fbdev_mode) from [<c05d7054>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x64/0xb0)
> [    6.872282]  r10:00000000 r9:d991ecdc r8:d98d57b4 r7:00000000 r6:c10824c8 r5:d98d5700
> [    6.872285]  r4:00000000
> [    6.872296] [<c05d6ff0>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c05d70e0>] (drm_fb_helper_set_par+0x40/0x64)
> [    6.872304]  r9:d991ecdc r8:d991ec8c r7:c0d82d88 r6:d98d57b4 r5:00000000 r4:00000000
> [    6.872315] [<c05d70a0>] (drm_fb_helper_set_par) from [<c05d6fa4>] (drm_fb_helper_hotplug_event.part.11+0xb0/0xb8)
> [    6.872319]  r5:00000000 r4:d98d5700
> [    6.872330] [<c05d6ef4>] (drm_fb_helper_hotplug_event.part.11) from [<c05d72c8>] (drm_fbdev_client_hotplug+0x13c/0x1d8)
> [    6.872337]  r7:c0d82d88 r6:d991eca0 r5:d991ec00 r4:d98d5700
> [    6.872348] [<c05d718c>] (drm_fbdev_client_hotplug) from [<c0601640>] (drm_client_dev_hotplug+0x84/0xc0)
> 
> this crash also happens without fbdev-patch
> 
> my codebase: https://github.com/frank-w/BPI-R2-4.14/commits/5.1-hdmi
> 
> regards Frank

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

* Re: [PATCH v2] gpu/drm: mediatek: call mtk_dsi_stop() after mtk_drm_crtc_atomic_disable()
  2019-03-21  1:28 ` CK Hu
@ 2019-03-21  1:46   ` CK Hu
  2019-03-21 14:09     ` Hsin-Yi Wang
  0 siblings, 1 reply; 9+ messages in thread
From: CK Hu @ 2019-03-21  1:46 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: linux-arm-kernel, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, dri-devel, linux-mediatek, linux-kernel

Hi, Hsin-yi:

On Thu, 2019-03-21 at 09:28 +0800, CK Hu wrote:
> Hi, Hsin-yi:
> 
> On Wed, 2019-03-20 at 15: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.
> > 
> > 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:
> > v1->v2:
> >  * update commit message.
> >  * call mtk_dsi_stop() in mtk_dsi_poweroff() when refcount is 0.
> > ---
> >  drivers/gpu/drm/mediatek/mtk_dsi.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > index b00eb2d2e086..e152f37af57d 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > @@ -630,6 +630,8 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)
> >  	if (--dsi->refcount != 0)
> >  		return;
> >  
> > +	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)) {
> 
> I think you just move mtk_dsi_stop() into mtk_dsi_poweroff() would works
> fine, but I would rather like calling mtk_dsi_start() and mtk_dsi_stop()
> in a symmetric manner. That means you may also move below functions into
> mtk_dsi_poweron():
> 
> mtk_dsi_set_mode(dsi);
> mtk_dsi_clk_hs_mode(dsi, 1);
> mtk_dsi_start(dsi);
> 
> 
> > @@ -696,7 +698,6 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi)
> >  		}
> >  	}
> >  
> > -	mtk_dsi_stop(dsi);
> >  	mtk_dsi_poweroff(dsi);
> >  
> >  	dsi->enabled = false;
> > @@ -1178,6 +1179,8 @@ static int mtk_dsi_remove(struct platform_device *pdev)
> >  	struct mtk_dsi *dsi = platform_get_drvdata(pdev);
> >  
> >  	mtk_output_dsi_disable(dsi);
> > +	mtk_dsi_stop(dsi);
> > +	mtk_dsi_poweroff(dsi);
> 
> I think mtk_output_dsi_disable() would call mtk_dsi_poweroff(), and
> mtk_dsi_poweroff() would call mtk_dsi_stop(), so these two line are
> redundant. And I think you should remove mtk_dsi_stop() in
> mtk_output_dsi_disable(), why not in this patch?

You've removed mtk_dsi_stop() in mtk_output_dsi_disable(), I just miss
it, sorry for this.

Regards,
CK

> 
> Regards,
> CK
> 
> >  	component_del(&pdev->dev, &mtk_dsi_component_ops);
> >  
> >  	return 0;
> 

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

* Re: [PATCH v2] gpu/drm: mediatek: call mtk_dsi_stop() after mtk_drm_crtc_atomic_disable()
  2019-03-21  1:46   ` CK Hu
@ 2019-03-21 14:09     ` Hsin-Yi Wang
  2019-03-22  1:21       ` CK Hu
  0 siblings, 1 reply; 9+ messages in thread
From: Hsin-Yi Wang @ 2019-03-21 14:09 UTC (permalink / raw)
  To: CK Hu
  Cc: linux-arm-kernel, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, dri-devel, linux-mediatek, linux-kernel

On Thu, Mar 21, 2019 at 9:46 AM CK Hu <ck.hu@mediatek.com> wrote:
>
> Hi, Hsin-yi:
>
> On Thu, 2019-03-21 at 09:28 +0800, CK Hu wrote:
> > Hi, Hsin-yi:
> >
> > On Wed, 2019-03-20 at 15: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.
> > >
> > > 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:
> > > v1->v2:
> > >  * update commit message.
> > >  * call mtk_dsi_stop() in mtk_dsi_poweroff() when refcount is 0.
> > > ---
> > >  drivers/gpu/drm/mediatek/mtk_dsi.c | 5 ++++-
> > >  1 file changed, 4 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > > index b00eb2d2e086..e152f37af57d 100644
> > > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> > > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > > @@ -630,6 +630,8 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)
> > >     if (--dsi->refcount != 0)
> > >             return;
> > >
> > > +   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)) {
> >
> > I think you just move mtk_dsi_stop() into mtk_dsi_poweroff() would works
> > fine, but I would rather like calling mtk_dsi_start() and mtk_dsi_stop()
> > in a symmetric manner. That means you may also move below functions into
> > mtk_dsi_poweron():
> >
> > mtk_dsi_set_mode(dsi);
> > mtk_dsi_clk_hs_mode(dsi, 1);
> > mtk_dsi_start(dsi);

For MT8183 with bridge panel, calling mtk_dsi_start() in
mtk_dsi_poweron() when refcount is 0->1, like the following order,
will results in no irq, not sure why though. I think this might be the
timing issue you mentioned in patch v1. (MT8183 without bridge panel
doesn't have this issue.)

atomic_enable
  --> mtk_crtc_ddp_hw_init
    --> mtk_dsi_ddp_start
      --> mtk_dsi_poweron (ref 0->1)
        --> drm_panel_prepare
        --> *mtk_dsi_start  // results in no irq for MT8183 with bridge
  --> drm_crtc_vblank_on

mtk_output_dsi_enable
  --> mtk_dsi_poweron (ref 1->2, ignored)
  --> mtk_dsi_start //original position

For mtk_dsi_stop() both with or without bridge is fine.

> >
> >
> > > @@ -696,7 +698,6 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi)
> > >             }
> > >     }
> > >
> > > -   mtk_dsi_stop(dsi);
> > >     mtk_dsi_poweroff(dsi);
> > >
> > >     dsi->enabled = false;
> > > @@ -1178,6 +1179,8 @@ static int mtk_dsi_remove(struct platform_device *pdev)
> > >     struct mtk_dsi *dsi = platform_get_drvdata(pdev);
> > >
> > >     mtk_output_dsi_disable(dsi);
> > > +   mtk_dsi_stop(dsi);
> > > +   mtk_dsi_poweroff(dsi);
> >
> > I think mtk_output_dsi_disable() would call mtk_dsi_poweroff(), and
> > mtk_dsi_poweroff() would call mtk_dsi_stop(), so these two line are
> > redundant. And I think you should remove mtk_dsi_stop() in
> > mtk_output_dsi_disable(), why not in this patch?
>
> You've removed mtk_dsi_stop() in mtk_output_dsi_disable(), I just miss
> it, sorry for this.
>
> Regards,
> CK
>
> >
> > Regards,
> > CK
> >
> > >     component_del(&pdev->dev, &mtk_dsi_component_ops);
> > >
> > >     return 0;
> >
>
>

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

* Re: [PATCH v2] gpu/drm: mediatek: call mtk_dsi_stop() after mtk_drm_crtc_atomic_disable()
  2019-03-21 14:09     ` Hsin-Yi Wang
@ 2019-03-22  1:21       ` CK Hu
  2019-03-22  5:05         ` Hsin-Yi Wang
  0 siblings, 1 reply; 9+ messages in thread
From: CK Hu @ 2019-03-22  1:21 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: David Airlie, linux-kernel, dri-devel, linux-mediatek,
	Matthias Brugger, linux-arm-kernel

Hi, Hsin-yi:

On Thu, 2019-03-21 at 22:09 +0800, Hsin-Yi Wang wrote:
> On Thu, Mar 21, 2019 at 9:46 AM CK Hu <ck.hu@mediatek.com> wrote:
> >
> > Hi, Hsin-yi:
> >
> > On Thu, 2019-03-21 at 09:28 +0800, CK Hu wrote:
> > > Hi, Hsin-yi:
> > >
> > > On Wed, 2019-03-20 at 15: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.
> > > >
> > > > 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:
> > > > v1->v2:
> > > >  * update commit message.
> > > >  * call mtk_dsi_stop() in mtk_dsi_poweroff() when refcount is 0.
> > > > ---
> > > >  drivers/gpu/drm/mediatek/mtk_dsi.c | 5 ++++-
> > > >  1 file changed, 4 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > > > index b00eb2d2e086..e152f37af57d 100644
> > > > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> > > > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > > > @@ -630,6 +630,8 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)
> > > >     if (--dsi->refcount != 0)
> > > >             return;
> > > >
> > > > +   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)) {
> > >
> > > I think you just move mtk_dsi_stop() into mtk_dsi_poweroff() would works
> > > fine, but I would rather like calling mtk_dsi_start() and mtk_dsi_stop()
> > > in a symmetric manner. That means you may also move below functions into
> > > mtk_dsi_poweron():
> > >
> > > mtk_dsi_set_mode(dsi);
> > > mtk_dsi_clk_hs_mode(dsi, 1);
> > > mtk_dsi_start(dsi);
> 
> For MT8183 with bridge panel, calling mtk_dsi_start() in
> mtk_dsi_poweron() when refcount is 0->1, like the following order,
> will results in no irq, not sure why though. I think this might be the
> timing issue you mentioned in patch v1. (MT8183 without bridge panel
> doesn't have this issue.)
> 
> atomic_enable
>   --> mtk_crtc_ddp_hw_init
>     --> mtk_dsi_ddp_start
>       --> mtk_dsi_poweron (ref 0->1)
>         --> drm_panel_prepare
>         --> *mtk_dsi_start  // results in no irq for MT8183 with bridge
>   --> drm_crtc_vblank_on
> 
> mtk_output_dsi_enable
>   --> mtk_dsi_poweron (ref 1->2, ignored)
>   --> mtk_dsi_start //original position
> 
> For mtk_dsi_stop() both with or without bridge is fine.

I'm not familiar with dsi hardware, so I could not answer why this
problem happen. Jitao is familiar with dsi hardware, you may ask him for
help. If this is hardware behavior, I could accept asymmetric flow, but
please be sure this is hardware behavior not software bug.

Regards,
CK

> 
> > >
> > >
> > > > @@ -696,7 +698,6 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi)
> > > >             }
> > > >     }
> > > >
> > > > -   mtk_dsi_stop(dsi);
> > > >     mtk_dsi_poweroff(dsi);
> > > >
> > > >     dsi->enabled = false;
> > > > @@ -1178,6 +1179,8 @@ static int mtk_dsi_remove(struct platform_device *pdev)
> > > >     struct mtk_dsi *dsi = platform_get_drvdata(pdev);
> > > >
> > > >     mtk_output_dsi_disable(dsi);
> > > > +   mtk_dsi_stop(dsi);
> > > > +   mtk_dsi_poweroff(dsi);
> > >
> > > I think mtk_output_dsi_disable() would call mtk_dsi_poweroff(), and
> > > mtk_dsi_poweroff() would call mtk_dsi_stop(), so these two line are
> > > redundant. And I think you should remove mtk_dsi_stop() in
> > > mtk_output_dsi_disable(), why not in this patch?
> >
> > You've removed mtk_dsi_stop() in mtk_output_dsi_disable(), I just miss
> > it, sorry for this.
> >
> > Regards,
> > CK
> >
> > >
> > > Regards,
> > > CK
> > >
> > > >     component_del(&pdev->dev, &mtk_dsi_component_ops);
> > > >
> > > >     return 0;
> > >
> >
> >


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v2] gpu/drm: mediatek: call mtk_dsi_stop() after mtk_drm_crtc_atomic_disable()
  2019-03-22  1:21       ` CK Hu
@ 2019-03-22  5:05         ` Hsin-Yi Wang
  2019-05-29 10:48           ` Jitao Shi
  0 siblings, 1 reply; 9+ messages in thread
From: Hsin-Yi Wang @ 2019-03-22  5:05 UTC (permalink / raw)
  To: CK Hu
  Cc: linux-arm-kernel, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, dri-devel, linux-mediatek, linux-kernel,
	jitao.shi

On Fri, Mar 22, 2019 at 9:21 AM CK Hu <ck.hu@mediatek.com> wrote:
>
> Hi, Hsin-yi:
>
> On Thu, 2019-03-21 at 22:09 +0800, Hsin-Yi Wang wrote:
> > On Thu, Mar 21, 2019 at 9:46 AM CK Hu <ck.hu@mediatek.com> wrote:
> > >
> > > Hi, Hsin-yi:
> > >
> > > On Thu, 2019-03-21 at 09:28 +0800, CK Hu wrote:
> > > > Hi, Hsin-yi:
> > > >
> > > > On Wed, 2019-03-20 at 15: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.
> > > > >
> > > > > 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:
> > > > > v1->v2:
> > > > >  * update commit message.
> > > > >  * call mtk_dsi_stop() in mtk_dsi_poweroff() when refcount is 0.
> > > > > ---
> > > > >  drivers/gpu/drm/mediatek/mtk_dsi.c | 5 ++++-
> > > > >  1 file changed, 4 insertions(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > > > > index b00eb2d2e086..e152f37af57d 100644
> > > > > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> > > > > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > > > > @@ -630,6 +630,8 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)
> > > > >     if (--dsi->refcount != 0)
> > > > >             return;
> > > > >
> > > > > +   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)) {
> > > >
> > > > I think you just move mtk_dsi_stop() into mtk_dsi_poweroff() would works
> > > > fine, but I would rather like calling mtk_dsi_start() and mtk_dsi_stop()
> > > > in a symmetric manner. That means you may also move below functions into
> > > > mtk_dsi_poweron():
> > > >
> > > > mtk_dsi_set_mode(dsi);
> > > > mtk_dsi_clk_hs_mode(dsi, 1);
> > > > mtk_dsi_start(dsi);
> >
> > For MT8183 with bridge panel, calling mtk_dsi_start() in
> > mtk_dsi_poweron() when refcount is 0->1, like the following order,
> > will results in no irq, not sure why though. I think this might be the
> > timing issue you mentioned in patch v1. (MT8183 without bridge panel
> > doesn't have this issue.)
> >
> > atomic_enable
> >   --> mtk_crtc_ddp_hw_init
> >     --> mtk_dsi_ddp_start
> >       --> mtk_dsi_poweron (ref 0->1)
> >         --> drm_panel_prepare
> >         --> *mtk_dsi_start  // results in no irq for MT8183 with bridge
> >   --> drm_crtc_vblank_on
> >
> > mtk_output_dsi_enable
> >   --> mtk_dsi_poweron (ref 1->2, ignored)
> >   --> mtk_dsi_start //original position
> >
> > For mtk_dsi_stop() both with or without bridge is fine.
Add cc Jitao.

Hi Jitao,
Do you know if this is a known hardware behavior?

Thanks
>
> I'm not familiar with dsi hardware, so I could not answer why this
> problem happen. Jitao is familiar with dsi hardware, you may ask him for
> help. If this is hardware behavior, I could accept asymmetric flow, but
> please be sure this is hardware behavior not software bug.
>
> Regards,
> CK
>
> >
> > > >
> > > >
> > > > > @@ -696,7 +698,6 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi)
> > > > >             }
> > > > >     }
> > > > >
> > > > > -   mtk_dsi_stop(dsi);
> > > > >     mtk_dsi_poweroff(dsi);
> > > > >
> > > > >     dsi->enabled = false;
> > > > > @@ -1178,6 +1179,8 @@ static int mtk_dsi_remove(struct platform_device *pdev)
> > > > >     struct mtk_dsi *dsi = platform_get_drvdata(pdev);
> > > > >
> > > > >     mtk_output_dsi_disable(dsi);
> > > > > +   mtk_dsi_stop(dsi);
> > > > > +   mtk_dsi_poweroff(dsi);
> > > >
> > > > I think mtk_output_dsi_disable() would call mtk_dsi_poweroff(), and
> > > > mtk_dsi_poweroff() would call mtk_dsi_stop(), so these two line are
> > > > redundant. And I think you should remove mtk_dsi_stop() in
> > > > mtk_output_dsi_disable(), why not in this patch?
> > >
> > > You've removed mtk_dsi_stop() in mtk_output_dsi_disable(), I just miss
> > > it, sorry for this.
> > >
> > > Regards,
> > > CK
> > >
> > > >
> > > > Regards,
> > > > CK
> > > >
> > > > >     component_del(&pdev->dev, &mtk_dsi_component_ops);
> > > > >
> > > > >     return 0;
> > > >
> > >
> > >
>
>

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

* Re: [PATCH v2] gpu/drm: mediatek: call mtk_dsi_stop() after mtk_drm_crtc_atomic_disable()
  2019-03-22  5:05         ` Hsin-Yi Wang
@ 2019-05-29 10:48           ` Jitao Shi
  0 siblings, 0 replies; 9+ messages in thread
From: Jitao Shi @ 2019-05-29 10:48 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: CK Hu (胡俊光),
	linux-arm-kernel, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, dri-devel, linux-mediatek, linux-kernel

On Fri, 2019-03-22 at 13:05 +0800, Hsin-Yi Wang wrote:
> On Fri, Mar 22, 2019 at 9:21 AM CK Hu <ck.hu@mediatek.com> wrote:
> >
> > Hi, Hsin-yi:
> >
> > On Thu, 2019-03-21 at 22:09 +0800, Hsin-Yi Wang wrote:
> > > On Thu, Mar 21, 2019 at 9:46 AM CK Hu <ck.hu@mediatek.com> wrote:
> > > >
> > > > Hi, Hsin-yi:
> > > >
> > > > On Thu, 2019-03-21 at 09:28 +0800, CK Hu wrote:
> > > > > Hi, Hsin-yi:
> > > > >
> > > > > On Wed, 2019-03-20 at 15: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.
> > > > > >
> > > > > > 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:
> > > > > > v1->v2:
> > > > > >  * update commit message.
> > > > > >  * call mtk_dsi_stop() in mtk_dsi_poweroff() when refcount is 0.
> > > > > > ---
> > > > > >  drivers/gpu/drm/mediatek/mtk_dsi.c | 5 ++++-
> > > > > >  1 file changed, 4 insertions(+), 1 deletion(-)
> > > > > >
> > > > > > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > > > > > index b00eb2d2e086..e152f37af57d 100644
> > > > > > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> > > > > > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > > > > > @@ -630,6 +630,8 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)
> > > > > >     if (--dsi->refcount != 0)
> > > > > >             return;
> > > > > >
> > > > > > +   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)) {
> > > > >
> > > > > I think you just move mtk_dsi_stop() into mtk_dsi_poweroff() would works
> > > > > fine, but I would rather like calling mtk_dsi_start() and mtk_dsi_stop()
> > > > > in a symmetric manner. That means you may also move below functions into
> > > > > mtk_dsi_poweron():
> > > > >
> > > > > mtk_dsi_set_mode(dsi);
> > > > > mtk_dsi_clk_hs_mode(dsi, 1);
> > > > > mtk_dsi_start(dsi);
> > >
> > > For MT8183 with bridge panel, calling mtk_dsi_start() in
> > > mtk_dsi_poweron() when refcount is 0->1, like the following order,
> > > will results in no irq, not sure why though. I think this might be the
> > > timing issue you mentioned in patch v1. (MT8183 without bridge panel
> > > doesn't have this issue.)
> > >
> > > atomic_enable
> > >   --> mtk_crtc_ddp_hw_init
> > >     --> mtk_dsi_ddp_start
> > >       --> mtk_dsi_poweron (ref 0->1)
> > >         --> drm_panel_prepare
> > >         --> *mtk_dsi_start  // results in no irq for MT8183 with bridge
> > >   --> drm_crtc_vblank_on
> > >
> > > mtk_output_dsi_enable
> > >   --> mtk_dsi_poweron (ref 1->2, ignored)
> > >   --> mtk_dsi_start //original position
> > >
> > > For mtk_dsi_stop() both with or without bridge is fine.
> Add cc Jitao.
> 
> Hi Jitao,
> Do you know if this is a known hardware behavior?
> 
> Thanks

mtk_dsi_start must after dsi full setting.

If you put it in mtk_dsi_ddp_start, mtk_dsi_set_mode won't work. DSI
will keep cmd mode. So you see no irq.

I think we show keep the mtk_dsi_start in mtk_output_dsi_enable 

Best Regards
Jitao

> >
> > I'm not familiar with dsi hardware, so I could not answer why this
> > problem happen. Jitao is familiar with dsi hardware, you may ask him for
> > help. If this is hardware behavior, I could accept asymmetric flow, but
> > please be sure this is hardware behavior not software bug.
> >
> > Regards,
> > CK
> >
> > >
> > > > >
> > > > >
> > > > > > @@ -696,7 +698,6 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi)
> > > > > >             }
> > > > > >     }
> > > > > >
> > > > > > -   mtk_dsi_stop(dsi);
> > > > > >     mtk_dsi_poweroff(dsi);
> > > > > >
> > > > > >     dsi->enabled = false;
> > > > > > @@ -1178,6 +1179,8 @@ static int mtk_dsi_remove(struct platform_device *pdev)
> > > > > >     struct mtk_dsi *dsi = platform_get_drvdata(pdev);
> > > > > >
> > > > > >     mtk_output_dsi_disable(dsi);
> > > > > > +   mtk_dsi_stop(dsi);
> > > > > > +   mtk_dsi_poweroff(dsi);
> > > > >
> > > > > I think mtk_output_dsi_disable() would call mtk_dsi_poweroff(), and
> > > > > mtk_dsi_poweroff() would call mtk_dsi_stop(), so these two line are
> > > > > redundant. And I think you should remove mtk_dsi_stop() in
> > > > > mtk_output_dsi_disable(), why not in this patch?
> > > >
> > > > You've removed mtk_dsi_stop() in mtk_output_dsi_disable(), I just miss
> > > > it, sorry for this.
> > > >
> > > > Regards,
> > > > CK
> > > >
> > > > >
> > > > > Regards,
> > > > > CK
> > > > >
> > > > > >     component_del(&pdev->dev, &mtk_dsi_component_ops);
> > > > > >
> > > > > >     return 0;
> > > > >
> > > >
> > > >
> >
> >

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

end of thread, other threads:[~2019-05-29 10:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-20  7:18 [PATCH v2] gpu/drm: mediatek: call mtk_dsi_stop() after mtk_drm_crtc_atomic_disable() Hsin-Yi Wang
2019-03-20 18:01 ` Aw: " Frank Wunderlich
2019-03-21  1:36   ` CK Hu
2019-03-21  1:28 ` CK Hu
2019-03-21  1:46   ` CK Hu
2019-03-21 14:09     ` Hsin-Yi Wang
2019-03-22  1:21       ` CK Hu
2019-03-22  5:05         ` Hsin-Yi Wang
2019-05-29 10:48           ` Jitao Shi

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).