All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/mediatek: ensure bridge disable happends before suspend
@ 2022-06-29 19:05 ` Hsin-Yi Wang
  0 siblings, 0 replies; 12+ messages in thread
From: Hsin-Yi Wang @ 2022-06-29 19:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Philipp Zabel, David Airlie, Daniel Vetter, Matthias Brugger,
	dri-devel, linux-mediatek, linux-arm-kernel, linux-kernel

Make sure bridge_disable will be called before suspend by calling
drm_mode_config_helper_suspend() in .prepare callback.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
---
The issue is found if suspend is called via VT2 in several MTK SoC (eg.
MT8173, MT8183, MT8186) chromebook boards with eDP bridge:
bridge disable is called through mtk-drm's suspend, and it needs to be
called before bridge pm runtime suspend.
So we move the hook to .prepare() and .complete().
---
 drivers/gpu/drm/mediatek/mtk_drm_drv.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index 13a1bbe7ead7f..a42812e490007 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -828,8 +828,7 @@ static int mtk_drm_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
-static int mtk_drm_sys_suspend(struct device *dev)
+static int mtk_drm_sys_prepare(struct device *dev)
 {
 	struct mtk_drm_private *private = dev_get_drvdata(dev);
 	struct drm_device *drm = private->drm;
@@ -840,20 +839,21 @@ static int mtk_drm_sys_suspend(struct device *dev)
 	return ret;
 }
 
-static int mtk_drm_sys_resume(struct device *dev)
+static void mtk_drm_sys_complete(struct device *dev)
 {
 	struct mtk_drm_private *private = dev_get_drvdata(dev);
 	struct drm_device *drm = private->drm;
 	int ret;
 
 	ret = drm_mode_config_helper_resume(drm);
-
-	return ret;
+	if (ret)
+		dev_err(dev, "Failed to resume\n");
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(mtk_drm_pm_ops, mtk_drm_sys_suspend,
-			 mtk_drm_sys_resume);
+static const struct dev_pm_ops mtk_drm_pm_ops = {
+	.prepare = mtk_drm_sys_prepare,
+	.complete = mtk_drm_sys_complete,
+};
 
 static struct platform_driver mtk_drm_platform_driver = {
 	.probe	= mtk_drm_probe,
-- 
2.37.0.rc0.161.g10f37bed90-goog


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

* [PATCH] drm/mediatek: ensure bridge disable happends before suspend
@ 2022-06-29 19:05 ` Hsin-Yi Wang
  0 siblings, 0 replies; 12+ messages in thread
From: Hsin-Yi Wang @ 2022-06-29 19:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: David Airlie, linux-kernel, dri-devel, linux-mediatek,
	Matthias Brugger, linux-arm-kernel

Make sure bridge_disable will be called before suspend by calling
drm_mode_config_helper_suspend() in .prepare callback.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
---
The issue is found if suspend is called via VT2 in several MTK SoC (eg.
MT8173, MT8183, MT8186) chromebook boards with eDP bridge:
bridge disable is called through mtk-drm's suspend, and it needs to be
called before bridge pm runtime suspend.
So we move the hook to .prepare() and .complete().
---
 drivers/gpu/drm/mediatek/mtk_drm_drv.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index 13a1bbe7ead7f..a42812e490007 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -828,8 +828,7 @@ static int mtk_drm_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
-static int mtk_drm_sys_suspend(struct device *dev)
+static int mtk_drm_sys_prepare(struct device *dev)
 {
 	struct mtk_drm_private *private = dev_get_drvdata(dev);
 	struct drm_device *drm = private->drm;
@@ -840,20 +839,21 @@ static int mtk_drm_sys_suspend(struct device *dev)
 	return ret;
 }
 
-static int mtk_drm_sys_resume(struct device *dev)
+static void mtk_drm_sys_complete(struct device *dev)
 {
 	struct mtk_drm_private *private = dev_get_drvdata(dev);
 	struct drm_device *drm = private->drm;
 	int ret;
 
 	ret = drm_mode_config_helper_resume(drm);
-
-	return ret;
+	if (ret)
+		dev_err(dev, "Failed to resume\n");
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(mtk_drm_pm_ops, mtk_drm_sys_suspend,
-			 mtk_drm_sys_resume);
+static const struct dev_pm_ops mtk_drm_pm_ops = {
+	.prepare = mtk_drm_sys_prepare,
+	.complete = mtk_drm_sys_complete,
+};
 
 static struct platform_driver mtk_drm_platform_driver = {
 	.probe	= mtk_drm_probe,
-- 
2.37.0.rc0.161.g10f37bed90-goog


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

* [PATCH] drm/mediatek: ensure bridge disable happends before suspend
@ 2022-06-29 19:05 ` Hsin-Yi Wang
  0 siblings, 0 replies; 12+ messages in thread
From: Hsin-Yi Wang @ 2022-06-29 19:05 UTC (permalink / raw)
  To: Chun-Kuang Hu
  Cc: Philipp Zabel, David Airlie, Daniel Vetter, Matthias Brugger,
	dri-devel, linux-mediatek, linux-arm-kernel, linux-kernel

Make sure bridge_disable will be called before suspend by calling
drm_mode_config_helper_suspend() in .prepare callback.

Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
---
The issue is found if suspend is called via VT2 in several MTK SoC (eg.
MT8173, MT8183, MT8186) chromebook boards with eDP bridge:
bridge disable is called through mtk-drm's suspend, and it needs to be
called before bridge pm runtime suspend.
So we move the hook to .prepare() and .complete().
---
 drivers/gpu/drm/mediatek/mtk_drm_drv.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index 13a1bbe7ead7f..a42812e490007 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -828,8 +828,7 @@ static int mtk_drm_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
-static int mtk_drm_sys_suspend(struct device *dev)
+static int mtk_drm_sys_prepare(struct device *dev)
 {
 	struct mtk_drm_private *private = dev_get_drvdata(dev);
 	struct drm_device *drm = private->drm;
@@ -840,20 +839,21 @@ static int mtk_drm_sys_suspend(struct device *dev)
 	return ret;
 }
 
-static int mtk_drm_sys_resume(struct device *dev)
+static void mtk_drm_sys_complete(struct device *dev)
 {
 	struct mtk_drm_private *private = dev_get_drvdata(dev);
 	struct drm_device *drm = private->drm;
 	int ret;
 
 	ret = drm_mode_config_helper_resume(drm);
-
-	return ret;
+	if (ret)
+		dev_err(dev, "Failed to resume\n");
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(mtk_drm_pm_ops, mtk_drm_sys_suspend,
-			 mtk_drm_sys_resume);
+static const struct dev_pm_ops mtk_drm_pm_ops = {
+	.prepare = mtk_drm_sys_prepare,
+	.complete = mtk_drm_sys_complete,
+};
 
 static struct platform_driver mtk_drm_platform_driver = {
 	.probe	= mtk_drm_probe,
-- 
2.37.0.rc0.161.g10f37bed90-goog


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

* Re: [PATCH] drm/mediatek: ensure bridge disable happends before suspend
  2022-06-29 19:05 ` Hsin-Yi Wang
  (?)
@ 2022-07-04  9:16   ` CK Hu
  -1 siblings, 0 replies; 12+ messages in thread
From: CK Hu @ 2022-07-04  9:16 UTC (permalink / raw)
  To: Hsin-Yi Wang, Chun-Kuang Hu
  Cc: David Airlie, linux-kernel, dri-devel, linux-mediatek,
	Matthias Brugger, linux-arm-kernel

Hi, Hsin-yi:

On Thu, 2022-06-30 at 03:05 +0800, Hsin-Yi Wang wrote:
> Make sure bridge_disable will be called before suspend by calling
> drm_mode_config_helper_suspend() in .prepare callback.

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

> 
> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> ---
> The issue is found if suspend is called via VT2 in several MTK SoC
> (eg.
> MT8173, MT8183, MT8186) chromebook boards with eDP bridge:
> bridge disable is called through mtk-drm's suspend, and it needs to
> be
> called before bridge pm runtime suspend.
> So we move the hook to .prepare() and .complete().
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index 13a1bbe7ead7f..a42812e490007 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -828,8 +828,7 @@ static int mtk_drm_remove(struct platform_device
> *pdev)
>  	return 0;
>  }
>  
> -#ifdef CONFIG_PM_SLEEP
> -static int mtk_drm_sys_suspend(struct device *dev)
> +static int mtk_drm_sys_prepare(struct device *dev)
>  {
>  	struct mtk_drm_private *private = dev_get_drvdata(dev);
>  	struct drm_device *drm = private->drm;
> @@ -840,20 +839,21 @@ static int mtk_drm_sys_suspend(struct device
> *dev)
>  	return ret;
>  }
>  
> -static int mtk_drm_sys_resume(struct device *dev)
> +static void mtk_drm_sys_complete(struct device *dev)
>  {
>  	struct mtk_drm_private *private = dev_get_drvdata(dev);
>  	struct drm_device *drm = private->drm;
>  	int ret;
>  
>  	ret = drm_mode_config_helper_resume(drm);
> -
> -	return ret;
> +	if (ret)
> +		dev_err(dev, "Failed to resume\n");
>  }
> -#endif
>  
> -static SIMPLE_DEV_PM_OPS(mtk_drm_pm_ops, mtk_drm_sys_suspend,
> -			 mtk_drm_sys_resume);
> +static const struct dev_pm_ops mtk_drm_pm_ops = {
> +	.prepare = mtk_drm_sys_prepare,
> +	.complete = mtk_drm_sys_complete,
> +};
>  
>  static struct platform_driver mtk_drm_platform_driver = {
>  	.probe	= mtk_drm_probe,


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

* Re: [PATCH] drm/mediatek: ensure bridge disable happends before suspend
@ 2022-07-04  9:16   ` CK Hu
  0 siblings, 0 replies; 12+ messages in thread
From: CK Hu @ 2022-07-04  9:16 UTC (permalink / raw)
  To: Hsin-Yi Wang, Chun-Kuang Hu
  Cc: David Airlie, linux-kernel, dri-devel, linux-mediatek,
	Matthias Brugger, linux-arm-kernel

Hi, Hsin-yi:

On Thu, 2022-06-30 at 03:05 +0800, Hsin-Yi Wang wrote:
> Make sure bridge_disable will be called before suspend by calling
> drm_mode_config_helper_suspend() in .prepare callback.

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

> 
> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> ---
> The issue is found if suspend is called via VT2 in several MTK SoC
> (eg.
> MT8173, MT8183, MT8186) chromebook boards with eDP bridge:
> bridge disable is called through mtk-drm's suspend, and it needs to
> be
> called before bridge pm runtime suspend.
> So we move the hook to .prepare() and .complete().
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index 13a1bbe7ead7f..a42812e490007 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -828,8 +828,7 @@ static int mtk_drm_remove(struct platform_device
> *pdev)
>  	return 0;
>  }
>  
> -#ifdef CONFIG_PM_SLEEP
> -static int mtk_drm_sys_suspend(struct device *dev)
> +static int mtk_drm_sys_prepare(struct device *dev)
>  {
>  	struct mtk_drm_private *private = dev_get_drvdata(dev);
>  	struct drm_device *drm = private->drm;
> @@ -840,20 +839,21 @@ static int mtk_drm_sys_suspend(struct device
> *dev)
>  	return ret;
>  }
>  
> -static int mtk_drm_sys_resume(struct device *dev)
> +static void mtk_drm_sys_complete(struct device *dev)
>  {
>  	struct mtk_drm_private *private = dev_get_drvdata(dev);
>  	struct drm_device *drm = private->drm;
>  	int ret;
>  
>  	ret = drm_mode_config_helper_resume(drm);
> -
> -	return ret;
> +	if (ret)
> +		dev_err(dev, "Failed to resume\n");
>  }
> -#endif
>  
> -static SIMPLE_DEV_PM_OPS(mtk_drm_pm_ops, mtk_drm_sys_suspend,
> -			 mtk_drm_sys_resume);
> +static const struct dev_pm_ops mtk_drm_pm_ops = {
> +	.prepare = mtk_drm_sys_prepare,
> +	.complete = mtk_drm_sys_complete,
> +};
>  
>  static struct platform_driver mtk_drm_platform_driver = {
>  	.probe	= mtk_drm_probe,


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

* Re: [PATCH] drm/mediatek: ensure bridge disable happends before suspend
@ 2022-07-04  9:16   ` CK Hu
  0 siblings, 0 replies; 12+ messages in thread
From: CK Hu @ 2022-07-04  9:16 UTC (permalink / raw)
  To: Hsin-Yi Wang, Chun-Kuang Hu
  Cc: David Airlie, linux-kernel, dri-devel, linux-mediatek,
	Matthias Brugger, linux-arm-kernel

Hi, Hsin-yi:

On Thu, 2022-06-30 at 03:05 +0800, Hsin-Yi Wang wrote:
> Make sure bridge_disable will be called before suspend by calling
> drm_mode_config_helper_suspend() in .prepare callback.

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

> 
> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> ---
> The issue is found if suspend is called via VT2 in several MTK SoC
> (eg.
> MT8173, MT8183, MT8186) chromebook boards with eDP bridge:
> bridge disable is called through mtk-drm's suspend, and it needs to
> be
> called before bridge pm runtime suspend.
> So we move the hook to .prepare() and .complete().
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index 13a1bbe7ead7f..a42812e490007 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -828,8 +828,7 @@ static int mtk_drm_remove(struct platform_device
> *pdev)
>  	return 0;
>  }
>  
> -#ifdef CONFIG_PM_SLEEP
> -static int mtk_drm_sys_suspend(struct device *dev)
> +static int mtk_drm_sys_prepare(struct device *dev)
>  {
>  	struct mtk_drm_private *private = dev_get_drvdata(dev);
>  	struct drm_device *drm = private->drm;
> @@ -840,20 +839,21 @@ static int mtk_drm_sys_suspend(struct device
> *dev)
>  	return ret;
>  }
>  
> -static int mtk_drm_sys_resume(struct device *dev)
> +static void mtk_drm_sys_complete(struct device *dev)
>  {
>  	struct mtk_drm_private *private = dev_get_drvdata(dev);
>  	struct drm_device *drm = private->drm;
>  	int ret;
>  
>  	ret = drm_mode_config_helper_resume(drm);
> -
> -	return ret;
> +	if (ret)
> +		dev_err(dev, "Failed to resume\n");
>  }
> -#endif
>  
> -static SIMPLE_DEV_PM_OPS(mtk_drm_pm_ops, mtk_drm_sys_suspend,
> -			 mtk_drm_sys_resume);
> +static const struct dev_pm_ops mtk_drm_pm_ops = {
> +	.prepare = mtk_drm_sys_prepare,
> +	.complete = mtk_drm_sys_complete,
> +};
>  
>  static struct platform_driver mtk_drm_platform_driver = {
>  	.probe	= mtk_drm_probe,


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

* Re: [PATCH] drm/mediatek: ensure bridge disable happends before suspend
  2022-06-29 19:05 ` Hsin-Yi Wang
  (?)
@ 2022-07-04 11:44   ` AngeloGioacchino Del Regno
  -1 siblings, 0 replies; 12+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-07-04 11:44 UTC (permalink / raw)
  To: Hsin-Yi Wang, Chun-Kuang Hu
  Cc: Philipp Zabel, David Airlie, Daniel Vetter, Matthias Brugger,
	dri-devel, linux-mediatek, linux-arm-kernel, linux-kernel

Il 29/06/22 21:05, Hsin-Yi Wang ha scritto:
> Make sure bridge_disable will be called before suspend by calling
> drm_mode_config_helper_suspend() in .prepare callback.
> 
> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> Reviewed-by: CK Hu <ck.hu@mediatek.com>

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

> ---
> The issue is found if suspend is called via VT2 in several MTK SoC (eg.
> MT8173, MT8183, MT8186) chromebook boards with eDP bridge:
> bridge disable is called through mtk-drm's suspend, and it needs to be
> called before bridge pm runtime suspend.
> So we move the hook to .prepare() and .complete().
> ---
>   drivers/gpu/drm/mediatek/mtk_drm_drv.c | 16 ++++++++--------
>   1 file changed, 8 insertions(+), 8 deletions(-)
> 

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

* Re: [PATCH] drm/mediatek: ensure bridge disable happends before suspend
@ 2022-07-04 11:44   ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 12+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-07-04 11:44 UTC (permalink / raw)
  To: Hsin-Yi Wang, Chun-Kuang Hu
  Cc: Philipp Zabel, David Airlie, Daniel Vetter, Matthias Brugger,
	dri-devel, linux-mediatek, linux-arm-kernel, linux-kernel

Il 29/06/22 21:05, Hsin-Yi Wang ha scritto:
> Make sure bridge_disable will be called before suspend by calling
> drm_mode_config_helper_suspend() in .prepare callback.
> 
> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> Reviewed-by: CK Hu <ck.hu@mediatek.com>

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

> ---
> The issue is found if suspend is called via VT2 in several MTK SoC (eg.
> MT8173, MT8183, MT8186) chromebook boards with eDP bridge:
> bridge disable is called through mtk-drm's suspend, and it needs to be
> called before bridge pm runtime suspend.
> So we move the hook to .prepare() and .complete().
> ---
>   drivers/gpu/drm/mediatek/mtk_drm_drv.c | 16 ++++++++--------
>   1 file changed, 8 insertions(+), 8 deletions(-)
> 

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

* Re: [PATCH] drm/mediatek: ensure bridge disable happends before suspend
@ 2022-07-04 11:44   ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 12+ messages in thread
From: AngeloGioacchino Del Regno @ 2022-07-04 11:44 UTC (permalink / raw)
  To: Hsin-Yi Wang, Chun-Kuang Hu
  Cc: David Airlie, linux-kernel, dri-devel, linux-mediatek,
	Matthias Brugger, linux-arm-kernel

Il 29/06/22 21:05, Hsin-Yi Wang ha scritto:
> Make sure bridge_disable will be called before suspend by calling
> drm_mode_config_helper_suspend() in .prepare callback.
> 
> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> Reviewed-by: CK Hu <ck.hu@mediatek.com>

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

> ---
> The issue is found if suspend is called via VT2 in several MTK SoC (eg.
> MT8173, MT8183, MT8186) chromebook boards with eDP bridge:
> bridge disable is called through mtk-drm's suspend, and it needs to be
> called before bridge pm runtime suspend.
> So we move the hook to .prepare() and .complete().
> ---
>   drivers/gpu/drm/mediatek/mtk_drm_drv.c | 16 ++++++++--------
>   1 file changed, 8 insertions(+), 8 deletions(-)
> 

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

* Re: [PATCH] drm/mediatek: ensure bridge disable happends before suspend
  2022-06-29 19:05 ` Hsin-Yi Wang
  (?)
@ 2022-07-04 13:51   ` Chun-Kuang Hu
  -1 siblings, 0 replies; 12+ messages in thread
From: Chun-Kuang Hu @ 2022-07-04 13:51 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, DRI Development,
	moderated list:ARM/Mediatek SoC support, Linux ARM, linux-kernel

Hi, Hsin-yi:

Hsin-Yi Wang <hsinyi@chromium.org> 於 2022年6月30日 週四 凌晨3:06寫道:
>
> Make sure bridge_disable will be called before suspend by calling
> drm_mode_config_helper_suspend() in .prepare callback.

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

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

Regards,
Chun-Kuang.

>
> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> ---
> The issue is found if suspend is called via VT2 in several MTK SoC (eg.
> MT8173, MT8183, MT8186) chromebook boards with eDP bridge:
> bridge disable is called through mtk-drm's suspend, and it needs to be
> called before bridge pm runtime suspend.
> So we move the hook to .prepare() and .complete().
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index 13a1bbe7ead7f..a42812e490007 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -828,8 +828,7 @@ static int mtk_drm_remove(struct platform_device *pdev)
>         return 0;
>  }
>
> -#ifdef CONFIG_PM_SLEEP
> -static int mtk_drm_sys_suspend(struct device *dev)
> +static int mtk_drm_sys_prepare(struct device *dev)
>  {
>         struct mtk_drm_private *private = dev_get_drvdata(dev);
>         struct drm_device *drm = private->drm;
> @@ -840,20 +839,21 @@ static int mtk_drm_sys_suspend(struct device *dev)
>         return ret;
>  }
>
> -static int mtk_drm_sys_resume(struct device *dev)
> +static void mtk_drm_sys_complete(struct device *dev)
>  {
>         struct mtk_drm_private *private = dev_get_drvdata(dev);
>         struct drm_device *drm = private->drm;
>         int ret;
>
>         ret = drm_mode_config_helper_resume(drm);
> -
> -       return ret;
> +       if (ret)
> +               dev_err(dev, "Failed to resume\n");
>  }
> -#endif
>
> -static SIMPLE_DEV_PM_OPS(mtk_drm_pm_ops, mtk_drm_sys_suspend,
> -                        mtk_drm_sys_resume);
> +static const struct dev_pm_ops mtk_drm_pm_ops = {
> +       .prepare = mtk_drm_sys_prepare,
> +       .complete = mtk_drm_sys_complete,
> +};
>
>  static struct platform_driver mtk_drm_platform_driver = {
>         .probe  = mtk_drm_probe,
> --
> 2.37.0.rc0.161.g10f37bed90-goog
>

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

* Re: [PATCH] drm/mediatek: ensure bridge disable happends before suspend
@ 2022-07-04 13:51   ` Chun-Kuang Hu
  0 siblings, 0 replies; 12+ messages in thread
From: Chun-Kuang Hu @ 2022-07-04 13:51 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, DRI Development,
	moderated list:ARM/Mediatek SoC support, Linux ARM, linux-kernel

Hi, Hsin-yi:

Hsin-Yi Wang <hsinyi@chromium.org> 於 2022年6月30日 週四 凌晨3:06寫道:
>
> Make sure bridge_disable will be called before suspend by calling
> drm_mode_config_helper_suspend() in .prepare callback.

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

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

Regards,
Chun-Kuang.

>
> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> ---
> The issue is found if suspend is called via VT2 in several MTK SoC (eg.
> MT8173, MT8183, MT8186) chromebook boards with eDP bridge:
> bridge disable is called through mtk-drm's suspend, and it needs to be
> called before bridge pm runtime suspend.
> So we move the hook to .prepare() and .complete().
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index 13a1bbe7ead7f..a42812e490007 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -828,8 +828,7 @@ static int mtk_drm_remove(struct platform_device *pdev)
>         return 0;
>  }
>
> -#ifdef CONFIG_PM_SLEEP
> -static int mtk_drm_sys_suspend(struct device *dev)
> +static int mtk_drm_sys_prepare(struct device *dev)
>  {
>         struct mtk_drm_private *private = dev_get_drvdata(dev);
>         struct drm_device *drm = private->drm;
> @@ -840,20 +839,21 @@ static int mtk_drm_sys_suspend(struct device *dev)
>         return ret;
>  }
>
> -static int mtk_drm_sys_resume(struct device *dev)
> +static void mtk_drm_sys_complete(struct device *dev)
>  {
>         struct mtk_drm_private *private = dev_get_drvdata(dev);
>         struct drm_device *drm = private->drm;
>         int ret;
>
>         ret = drm_mode_config_helper_resume(drm);
> -
> -       return ret;
> +       if (ret)
> +               dev_err(dev, "Failed to resume\n");
>  }
> -#endif
>
> -static SIMPLE_DEV_PM_OPS(mtk_drm_pm_ops, mtk_drm_sys_suspend,
> -                        mtk_drm_sys_resume);
> +static const struct dev_pm_ops mtk_drm_pm_ops = {
> +       .prepare = mtk_drm_sys_prepare,
> +       .complete = mtk_drm_sys_complete,
> +};
>
>  static struct platform_driver mtk_drm_platform_driver = {
>         .probe  = mtk_drm_probe,
> --
> 2.37.0.rc0.161.g10f37bed90-goog
>

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

* Re: [PATCH] drm/mediatek: ensure bridge disable happends before suspend
@ 2022-07-04 13:51   ` Chun-Kuang Hu
  0 siblings, 0 replies; 12+ messages in thread
From: Chun-Kuang Hu @ 2022-07-04 13:51 UTC (permalink / raw)
  To: Hsin-Yi Wang
  Cc: Chun-Kuang Hu, David Airlie, linux-kernel, DRI Development,
	moderated list:ARM/Mediatek SoC support, Matthias Brugger,
	Linux ARM

Hi, Hsin-yi:

Hsin-Yi Wang <hsinyi@chromium.org> 於 2022年6月30日 週四 凌晨3:06寫道:
>
> Make sure bridge_disable will be called before suspend by calling
> drm_mode_config_helper_suspend() in .prepare callback.

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

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

Regards,
Chun-Kuang.

>
> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> ---
> The issue is found if suspend is called via VT2 in several MTK SoC (eg.
> MT8173, MT8183, MT8186) chromebook boards with eDP bridge:
> bridge disable is called through mtk-drm's suspend, and it needs to be
> called before bridge pm runtime suspend.
> So we move the hook to .prepare() and .complete().
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index 13a1bbe7ead7f..a42812e490007 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -828,8 +828,7 @@ static int mtk_drm_remove(struct platform_device *pdev)
>         return 0;
>  }
>
> -#ifdef CONFIG_PM_SLEEP
> -static int mtk_drm_sys_suspend(struct device *dev)
> +static int mtk_drm_sys_prepare(struct device *dev)
>  {
>         struct mtk_drm_private *private = dev_get_drvdata(dev);
>         struct drm_device *drm = private->drm;
> @@ -840,20 +839,21 @@ static int mtk_drm_sys_suspend(struct device *dev)
>         return ret;
>  }
>
> -static int mtk_drm_sys_resume(struct device *dev)
> +static void mtk_drm_sys_complete(struct device *dev)
>  {
>         struct mtk_drm_private *private = dev_get_drvdata(dev);
>         struct drm_device *drm = private->drm;
>         int ret;
>
>         ret = drm_mode_config_helper_resume(drm);
> -
> -       return ret;
> +       if (ret)
> +               dev_err(dev, "Failed to resume\n");
>  }
> -#endif
>
> -static SIMPLE_DEV_PM_OPS(mtk_drm_pm_ops, mtk_drm_sys_suspend,
> -                        mtk_drm_sys_resume);
> +static const struct dev_pm_ops mtk_drm_pm_ops = {
> +       .prepare = mtk_drm_sys_prepare,
> +       .complete = mtk_drm_sys_complete,
> +};
>
>  static struct platform_driver mtk_drm_platform_driver = {
>         .probe  = mtk_drm_probe,
> --
> 2.37.0.rc0.161.g10f37bed90-goog
>

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

end of thread, other threads:[~2022-07-04 16:24 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-29 19:05 [PATCH] drm/mediatek: ensure bridge disable happends before suspend Hsin-Yi Wang
2022-06-29 19:05 ` Hsin-Yi Wang
2022-06-29 19:05 ` Hsin-Yi Wang
2022-07-04  9:16 ` CK Hu
2022-07-04  9:16   ` CK Hu
2022-07-04  9:16   ` CK Hu
2022-07-04 11:44 ` AngeloGioacchino Del Regno
2022-07-04 11:44   ` AngeloGioacchino Del Regno
2022-07-04 11:44   ` AngeloGioacchino Del Regno
2022-07-04 13:51 ` Chun-Kuang Hu
2022-07-04 13:51   ` Chun-Kuang Hu
2022-07-04 13:51   ` Chun-Kuang Hu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.