linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] drm: mediatek: Fix display vblank timeout when disable dsi
@ 2022-09-14 14:00 Allen-KH Cheng
  2022-09-18  4:32 ` Chun-Kuang Hu
  0 siblings, 1 reply; 4+ messages in thread
From: Allen-KH Cheng @ 2022-09-14 14:00 UTC (permalink / raw)
  To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, AngeloGioacchino Del Regno
  Cc: Project_Global_Chrome_Upstream_Group, dri-devel,
	linux-arm-kernel, linux-kernel, linux-mediatek, Xinlei Lee,
	Allen-KH Cheng

From: Xinlei Lee <xinlei.lee@mediatek.com>

Dsi is turned off at bridge.disable, causing crtc to wait for vblank
timeout. It is necessary to add count protection to turn off dsi and
turn off at post_disable.

Fixes: cde7e2e35c28 ("drm/mediatek: Separate poweron/poweroff from enable/disable and define new funcs")
Signed-off-by: Xinlei Lee <xinlei.lee@mediatek.com>
Co-developed-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
---
Change in v1:
  * Rebase to kernel/git/chunkuang.hu/linux.git, mediatek-drm-fixes
    [Allen-KH Cheng <allen-kh.cheng@mediatek.com>]
---
---
 drivers/gpu/drm/mediatek/mtk_dsi.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index 5b624e0f5b0a..e30f4244c001 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -768,14 +768,6 @@ static void mtk_dsi_bridge_mode_set(struct drm_bridge *bridge,
 	drm_display_mode_to_videomode(adjusted, &dsi->vm);
 }
 
-static void mtk_dsi_bridge_atomic_disable(struct drm_bridge *bridge,
-					  struct drm_bridge_state *old_bridge_state)
-{
-	struct mtk_dsi *dsi = bridge_to_dsi(bridge);
-
-	mtk_output_dsi_disable(dsi);
-}
-
 static void mtk_dsi_bridge_atomic_enable(struct drm_bridge *bridge,
 					 struct drm_bridge_state *old_bridge_state)
 {
@@ -803,13 +795,15 @@ static void mtk_dsi_bridge_atomic_post_disable(struct drm_bridge *bridge,
 {
 	struct mtk_dsi *dsi = bridge_to_dsi(bridge);
 
+	if (dsi->refcount == 1)
+		mtk_output_dsi_disable(dsi);
+
 	mtk_dsi_poweroff(dsi);
 }
 
 static const struct drm_bridge_funcs mtk_dsi_bridge_funcs = {
 	.attach = mtk_dsi_bridge_attach,
 	.atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
-	.atomic_disable = mtk_dsi_bridge_atomic_disable,
 	.atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
 	.atomic_enable = mtk_dsi_bridge_atomic_enable,
 	.atomic_pre_enable = mtk_dsi_bridge_atomic_pre_enable,
@@ -829,6 +823,9 @@ void mtk_dsi_ddp_stop(struct device *dev)
 {
 	struct mtk_dsi *dsi = dev_get_drvdata(dev);
 
+	if (dsi->refcount == 1)
+		mtk_output_dsi_disable(dsi);
+
 	mtk_dsi_poweroff(dsi);
 }
 
-- 
2.18.0


_______________________________________________
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] 4+ messages in thread

* Re: [PATCH v2] drm: mediatek: Fix display vblank timeout when disable dsi
  2022-09-14 14:00 [PATCH v2] drm: mediatek: Fix display vblank timeout when disable dsi Allen-KH Cheng
@ 2022-09-18  4:32 ` Chun-Kuang Hu
  2022-09-19  3:01   ` Allen-KH Cheng
  0 siblings, 1 reply; 4+ messages in thread
From: Chun-Kuang Hu @ 2022-09-18  4:32 UTC (permalink / raw)
  To: Allen-KH Cheng
  Cc: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, AngeloGioacchino Del Regno,
	Project_Global_Chrome_Upstream_Group, DRI Development, Linux ARM,
	linux-kernel, moderated list:ARM/Mediatek SoC support,
	Xinlei Lee

Hi, Allen:

Allen-KH Cheng <allen-kh.cheng@mediatek.com> 於 2022年9月14日 週三 晚上10:00寫道:
>
> From: Xinlei Lee <xinlei.lee@mediatek.com>
>
> Dsi is turned off at bridge.disable, causing crtc to wait for vblank
> timeout. It is necessary to add count protection to turn off dsi and
> turn off at post_disable.

If turn off dsi in post_disable(), you should turn on dsi in pre_enable().

There is another patch fix this problem [1], do you have any comment
on that patch?

[1] http://lists.infradead.org/pipermail/linux-mediatek/2022-August/046713.html

Regards,
Chun-Kuang.

>
> Fixes: cde7e2e35c28 ("drm/mediatek: Separate poweron/poweroff from enable/disable and define new funcs")
> Signed-off-by: Xinlei Lee <xinlei.lee@mediatek.com>
> Co-developed-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
> Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
> ---
> Change in v1:
>   * Rebase to kernel/git/chunkuang.hu/linux.git, mediatek-drm-fixes
>     [Allen-KH Cheng <allen-kh.cheng@mediatek.com>]
> ---
> ---
>  drivers/gpu/drm/mediatek/mtk_dsi.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index 5b624e0f5b0a..e30f4244c001 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -768,14 +768,6 @@ static void mtk_dsi_bridge_mode_set(struct drm_bridge *bridge,
>         drm_display_mode_to_videomode(adjusted, &dsi->vm);
>  }
>
> -static void mtk_dsi_bridge_atomic_disable(struct drm_bridge *bridge,
> -                                         struct drm_bridge_state *old_bridge_state)
> -{
> -       struct mtk_dsi *dsi = bridge_to_dsi(bridge);
> -
> -       mtk_output_dsi_disable(dsi);
> -}
> -
>  static void mtk_dsi_bridge_atomic_enable(struct drm_bridge *bridge,
>                                          struct drm_bridge_state *old_bridge_state)
>  {
> @@ -803,13 +795,15 @@ static void mtk_dsi_bridge_atomic_post_disable(struct drm_bridge *bridge,
>  {
>         struct mtk_dsi *dsi = bridge_to_dsi(bridge);
>
> +       if (dsi->refcount == 1)
> +               mtk_output_dsi_disable(dsi);
> +
>         mtk_dsi_poweroff(dsi);
>  }
>
>  static const struct drm_bridge_funcs mtk_dsi_bridge_funcs = {
>         .attach = mtk_dsi_bridge_attach,
>         .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
> -       .atomic_disable = mtk_dsi_bridge_atomic_disable,
>         .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
>         .atomic_enable = mtk_dsi_bridge_atomic_enable,
>         .atomic_pre_enable = mtk_dsi_bridge_atomic_pre_enable,
> @@ -829,6 +823,9 @@ void mtk_dsi_ddp_stop(struct device *dev)
>  {
>         struct mtk_dsi *dsi = dev_get_drvdata(dev);
>
> +       if (dsi->refcount == 1)
> +               mtk_output_dsi_disable(dsi);
> +
>         mtk_dsi_poweroff(dsi);
>  }
>
> --
> 2.18.0
>

_______________________________________________
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] 4+ messages in thread

* Re: [PATCH v2] drm: mediatek: Fix display vblank timeout when disable dsi
  2022-09-18  4:32 ` Chun-Kuang Hu
@ 2022-09-19  3:01   ` Allen-KH Cheng
  2022-09-20  3:47     ` Allen-KH Cheng
  0 siblings, 1 reply; 4+ messages in thread
From: Allen-KH Cheng @ 2022-09-19  3:01 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Philipp Zabel, David Airlie, Daniel Vetter, Matthias Brugger,
	AngeloGioacchino Del Regno, Project_Global_Chrome_Upstream_Group,
	DRI Development, Linux ARM, linux-kernel,
	moderated list:ARM/Mediatek SoC support,
	Xinlei Lee (李昕磊)

Hi CK,

We will test this fix on the mt8186/mt8183.
Maybe our fix is not necessary.

I appreciate your suggestion.

BRs,
Allen

On 9/18/22 12:32, Chun-Kuang Hu wrote:
> Hi, Allen:
> 
> Allen-KH Cheng <allen-kh.cheng@mediatek.com> 於 2022年9月14日 週三 晚上10:00寫道:
>>
>> From: Xinlei Lee <xinlei.lee@mediatek.com>
>>
>> Dsi is turned off at bridge.disable, causing crtc to wait for vblank
>> timeout. It is necessary to add count protection to turn off dsi and
>> turn off at post_disable.
> 
> If turn off dsi in post_disable(), you should turn on dsi in pre_enable().
> 
> There is another patch fix this problem [1], do you have any comment
> on that patch?
> 
> [1] http://lists.infradead.org/pipermail/linux-mediatek/2022-August/046713.html
> 
> Regards,
> Chun-Kuang.
> 
>>
>> Fixes: cde7e2e35c28 ("drm/mediatek: Separate poweron/poweroff from enable/disable and define new funcs")
>> Signed-off-by: Xinlei Lee <xinlei.lee@mediatek.com>
>> Co-developed-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
>> Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
>> ---
>> Change in v1:
>>   * Rebase to kernel/git/chunkuang.hu/linux.git, mediatek-drm-fixes
>>     [Allen-KH Cheng <allen-kh.cheng@mediatek.com>]
>> ---
>> ---
>>  drivers/gpu/drm/mediatek/mtk_dsi.c | 15 ++++++---------
>>  1 file changed, 6 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
>> index 5b624e0f5b0a..e30f4244c001 100644
>> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
>> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
>> @@ -768,14 +768,6 @@ static void mtk_dsi_bridge_mode_set(struct drm_bridge *bridge,
>>         drm_display_mode_to_videomode(adjusted, &dsi->vm);
>>  }
>>
>> -static void mtk_dsi_bridge_atomic_disable(struct drm_bridge *bridge,
>> -                                         struct drm_bridge_state *old_bridge_state)
>> -{
>> -       struct mtk_dsi *dsi = bridge_to_dsi(bridge);
>> -
>> -       mtk_output_dsi_disable(dsi);
>> -}
>> -
>>  static void mtk_dsi_bridge_atomic_enable(struct drm_bridge *bridge,
>>                                          struct drm_bridge_state *old_bridge_state)
>>  {
>> @@ -803,13 +795,15 @@ static void mtk_dsi_bridge_atomic_post_disable(struct drm_bridge *bridge,
>>  {
>>         struct mtk_dsi *dsi = bridge_to_dsi(bridge);
>>
>> +       if (dsi->refcount == 1)
>> +               mtk_output_dsi_disable(dsi);
>> +
>>         mtk_dsi_poweroff(dsi);
>>  }
>>
>>  static const struct drm_bridge_funcs mtk_dsi_bridge_funcs = {
>>         .attach = mtk_dsi_bridge_attach,
>>         .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
>> -       .atomic_disable = mtk_dsi_bridge_atomic_disable,
>>         .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
>>         .atomic_enable = mtk_dsi_bridge_atomic_enable,
>>         .atomic_pre_enable = mtk_dsi_bridge_atomic_pre_enable,
>> @@ -829,6 +823,9 @@ void mtk_dsi_ddp_stop(struct device *dev)
>>  {
>>         struct mtk_dsi *dsi = dev_get_drvdata(dev);
>>
>> +       if (dsi->refcount == 1)
>> +               mtk_output_dsi_disable(dsi);
>> +
>>         mtk_dsi_poweroff(dsi);
>>  }
>>
>> --
>> 2.18.0
>>

_______________________________________________
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] 4+ messages in thread

* Re: [PATCH v2] drm: mediatek: Fix display vblank timeout when disable dsi
  2022-09-19  3:01   ` Allen-KH Cheng
@ 2022-09-20  3:47     ` Allen-KH Cheng
  0 siblings, 0 replies; 4+ messages in thread
From: Allen-KH Cheng @ 2022-09-20  3:47 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Philipp Zabel, David Airlie, Daniel Vetter, Matthias Brugger,
	AngeloGioacchino Del Regno, Project_Global_Chrome_Upstream_Group,
	DRI Development, Linux ARM, linux-kernel,
	moderated list:ARM/Mediatek SoC support,
	Xinlei Lee (李昕磊)

Hi CK,

We can use [1] in mt8186. Please ignore this PATCH.

Thanks,
Allen

[1]
http://lists.infradead.org/pipermail/linux-mediatek/2022-August/046713.html

On 9/19/22 11:01, Allen-KH Cheng wrote:
> Hi CK,
> 
> We will test this fix on the mt8186/mt8183.
> Maybe our fix is not necessary.
> 
> I appreciate your suggestion.
> 
> BRs,
> Allen
> 
> On 9/18/22 12:32, Chun-Kuang Hu wrote:
>> Hi, Allen:
>>
>> Allen-KH Cheng <allen-kh.cheng@mediatek.com> 於 2022年9月14日 週三 晚上10:00寫道:
>>>
>>> From: Xinlei Lee <xinlei.lee@mediatek.com>
>>>
>>> Dsi is turned off at bridge.disable, causing crtc to wait for vblank
>>> timeout. It is necessary to add count protection to turn off dsi and
>>> turn off at post_disable.
>>
>> If turn off dsi in post_disable(), you should turn on dsi in pre_enable().
>>
>> There is another patch fix this problem [1], do you have any comment
>> on that patch?
>>
>> [1] http://lists.infradead.org/pipermail/linux-mediatek/2022-August/046713.html
>>
>> Regards,
>> Chun-Kuang.
>>
>>>
>>> Fixes: cde7e2e35c28 ("drm/mediatek: Separate poweron/poweroff from enable/disable and define new funcs")
>>> Signed-off-by: Xinlei Lee <xinlei.lee@mediatek.com>
>>> Co-developed-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
>>> Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
>>> ---
>>> Change in v1:
>>>   * Rebase to kernel/git/chunkuang.hu/linux.git, mediatek-drm-fixes
>>>     [Allen-KH Cheng <allen-kh.cheng@mediatek.com>]
>>> ---
>>> ---
>>>  drivers/gpu/drm/mediatek/mtk_dsi.c | 15 ++++++---------
>>>  1 file changed, 6 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
>>> index 5b624e0f5b0a..e30f4244c001 100644
>>> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
>>> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
>>> @@ -768,14 +768,6 @@ static void mtk_dsi_bridge_mode_set(struct drm_bridge *bridge,
>>>         drm_display_mode_to_videomode(adjusted, &dsi->vm);
>>>  }
>>>
>>> -static void mtk_dsi_bridge_atomic_disable(struct drm_bridge *bridge,
>>> -                                         struct drm_bridge_state *old_bridge_state)
>>> -{
>>> -       struct mtk_dsi *dsi = bridge_to_dsi(bridge);
>>> -
>>> -       mtk_output_dsi_disable(dsi);
>>> -}
>>> -
>>>  static void mtk_dsi_bridge_atomic_enable(struct drm_bridge *bridge,
>>>                                          struct drm_bridge_state *old_bridge_state)
>>>  {
>>> @@ -803,13 +795,15 @@ static void mtk_dsi_bridge_atomic_post_disable(struct drm_bridge *bridge,
>>>  {
>>>         struct mtk_dsi *dsi = bridge_to_dsi(bridge);
>>>
>>> +       if (dsi->refcount == 1)
>>> +               mtk_output_dsi_disable(dsi);
>>> +
>>>         mtk_dsi_poweroff(dsi);
>>>  }
>>>
>>>  static const struct drm_bridge_funcs mtk_dsi_bridge_funcs = {
>>>         .attach = mtk_dsi_bridge_attach,
>>>         .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
>>> -       .atomic_disable = mtk_dsi_bridge_atomic_disable,
>>>         .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
>>>         .atomic_enable = mtk_dsi_bridge_atomic_enable,
>>>         .atomic_pre_enable = mtk_dsi_bridge_atomic_pre_enable,
>>> @@ -829,6 +823,9 @@ void mtk_dsi_ddp_stop(struct device *dev)
>>>  {
>>>         struct mtk_dsi *dsi = dev_get_drvdata(dev);
>>>
>>> +       if (dsi->refcount == 1)
>>> +               mtk_output_dsi_disable(dsi);
>>> +
>>>         mtk_dsi_poweroff(dsi);
>>>  }
>>>
>>> --
>>> 2.18.0
>>>

_______________________________________________
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] 4+ messages in thread

end of thread, other threads:[~2022-09-20  4:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-14 14:00 [PATCH v2] drm: mediatek: Fix display vblank timeout when disable dsi Allen-KH Cheng
2022-09-18  4:32 ` Chun-Kuang Hu
2022-09-19  3:01   ` Allen-KH Cheng
2022-09-20  3:47     ` Allen-KH Cheng

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