mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] drm/bridge: cdns-dsi: Split pm_ops into runtime_pm and system_sleep ops
@ 2026-01-12  9:12 Abhash Kumar Jha
  2026-01-13  9:53 ` Kumar, Udit
  2026-01-16 11:57 ` Tomi Valkeinen
  0 siblings, 2 replies; 3+ messages in thread
From: Abhash Kumar Jha @ 2026-01-12  9:12 UTC (permalink / raw)
  To: andrzej.hajda, neil.armstrong, rfoss, mripard, tzimmermann,
	airlied, simona, devarsht, u-kumar1
  Cc: linux-kernel, dri-devel, Laurent.pinchart, jonas, jernej.skrabec,
	s-jain1, p-mantena, aradhya.bhatia, tomi.valkeinen, p.zabel

If runtime-pm has already suspended the device and a system suspend
occurs, then we see a kernel crash when disabling and unpreparing the
clocks.

Use pm_runtime_force_suspend/resume in system_sleep pm callbacks to let
runtime-pm take care of the coordination between system suspend and
itself. This ensures that they do not interfere with each other.

Signed-off-by: Abhash Kumar Jha <a-kumar2@ti.com>
---
Hi,

If a device is runtime_pm suspended and a system wide suspend is triggered,
we see a kernel crash. Hence split the power management ops into separate
system_sleep and runtime_pm ops.

Changes in v2:
- Improve the commit description and subject.
- Link to v1: https://lore.kernel.org/all/20260109060312.2853133-1-a-kumar2@ti.com/

Thanks,
Abhash

 .../gpu/drm/bridge/cadence/cdns-dsi-core.c    | 32 +++++++++++++------
 1 file changed, 23 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
index 09b289f0fcbf..25eaf0192013 100644
--- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
+++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
@@ -1230,7 +1230,18 @@ static const struct mipi_dsi_host_ops cdns_dsi_ops = {
 	.transfer = cdns_dsi_transfer,
 };
 
-static int __maybe_unused cdns_dsi_resume(struct device *dev)
+static int cdns_dsi_runtime_suspend(struct device *dev)
+{
+	struct cdns_dsi *dsi = dev_get_drvdata(dev);
+
+	clk_disable_unprepare(dsi->dsi_sys_clk);
+	clk_disable_unprepare(dsi->dsi_p_clk);
+	reset_control_assert(dsi->dsi_p_rst);
+
+	return 0;
+}
+
+static int cdns_dsi_runtime_resume(struct device *dev)
 {
 	struct cdns_dsi *dsi = dev_get_drvdata(dev);
 
@@ -1241,18 +1252,21 @@ static int __maybe_unused cdns_dsi_resume(struct device *dev)
 	return 0;
 }
 
-static int __maybe_unused cdns_dsi_suspend(struct device *dev)
+static int cdns_dsi_suspend(struct device *dev)
 {
-	struct cdns_dsi *dsi = dev_get_drvdata(dev);
+	return pm_runtime_force_suspend(dev);
+}
 
-	clk_disable_unprepare(dsi->dsi_sys_clk);
-	clk_disable_unprepare(dsi->dsi_p_clk);
-	reset_control_assert(dsi->dsi_p_rst);
-	return 0;
+static int cdns_dsi_resume(struct device *dev)
+{
+	return pm_runtime_force_resume(dev);
 }
 
-static UNIVERSAL_DEV_PM_OPS(cdns_dsi_pm_ops, cdns_dsi_suspend, cdns_dsi_resume,
-			    NULL);
+static const struct dev_pm_ops cdns_dsi_pm_ops = {
+	SET_RUNTIME_PM_OPS(cdns_dsi_runtime_suspend,
+			cdns_dsi_runtime_resume, NULL)
+	SET_SYSTEM_SLEEP_PM_OPS(cdns_dsi_suspend, cdns_dsi_resume)
+};
 
 static int cdns_dsi_drm_probe(struct platform_device *pdev)
 {
-- 
2.34.1


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

* Re: [PATCH v2] drm/bridge: cdns-dsi: Split pm_ops into runtime_pm and system_sleep ops
  2026-01-12  9:12 [PATCH v2] drm/bridge: cdns-dsi: Split pm_ops into runtime_pm and system_sleep ops Abhash Kumar Jha
@ 2026-01-13  9:53 ` Kumar, Udit
  2026-01-16 11:57 ` Tomi Valkeinen
  1 sibling, 0 replies; 3+ messages in thread
From: Kumar, Udit @ 2026-01-13  9:53 UTC (permalink / raw)
  To: Abhash Kumar Jha, andrzej.hajda, neil.armstrong, rfoss, mripard,
	tzimmermann, airlied, simona, devarsht
  Cc: linux-kernel, dri-devel, Laurent.pinchart, jonas, jernej.skrabec,
	s-jain1, p-mantena, aradhya.bhatia, tomi.valkeinen, p.zabel,
	u-kumar1


On 1/12/2026 2:42 PM, Abhash Kumar Jha wrote:
> If runtime-pm has already suspended the device and a system suspend
> occurs, then we see a kernel crash when disabling and unpreparing the
> clocks.
>
> Use pm_runtime_force_suspend/resume in system_sleep pm callbacks to let
> runtime-pm take care of the coordination between system suspend and
> itself. This ensures that they do not interfere with each other.
>
> Signed-off-by: Abhash Kumar Jha <a-kumar2@ti.com>
> ---
> Hi,
>
> If a device is runtime_pm suspended and a system wide suspend is triggered,
> we see a kernel crash. Hence split the power management ops into separate
> system_sleep and runtime_pm ops.
>
> Changes in v2:
> - Improve the commit description and subject.
> - Link to v1: https://lore.kernel.org/all/20260109060312.2853133-1-a-kumar2@ti.com/
>
> Thanks,
> Abhash
>
>   .../gpu/drm/bridge/cadence/cdns-dsi-core.c    | 32 +++++++++++++------
>   1 file changed, 23 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> index 09b289f0fcbf..25eaf0192013 100644
> --- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> +++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> @@ -1230,7 +1230,18 @@ static const struct mipi_dsi_host_ops cdns_dsi_ops = {
>   	.transfer = cdns_dsi_transfer,
>   };
>   
> -static int __maybe_unused cdns_dsi_resume(struct device *dev)
> +static int cdns_dsi_runtime_suspend(struct device *dev)
> +{
> +	struct cdns_dsi *dsi = dev_get_drvdata(dev);
> +
> +	clk_disable_unprepare(dsi->dsi_sys_clk);
> +	clk_disable_unprepare(dsi->dsi_p_clk);
> +	reset_control_assert(dsi->dsi_p_rst);
> +
> +	return 0;
> +}
> +

Reviewed-by: Udit Kumar <u-kumar1@ti.com>


> +static int cdns_dsi_runtime_resume(struct device *dev)
>   {
>   	struct cdns_dsi *dsi = dev_get_drvdata(dev);
>   
> @@ -1241,18 +1252,21 @@ static int __maybe_unused cdns_dsi_resume(struct device *dev)
>   	return 0;
>   }
>   
> -static int __maybe_unused cdns_dsi_suspend(struct device *dev)
> +static int cdns_dsi_suspend(struct device *dev)
>   {
> -	struct cdns_dsi *dsi = dev_get_drvdata(dev);
> +	return pm_runtime_force_suspend(dev);
> +}
>   
> -	clk_disable_unprepare(dsi->dsi_sys_clk);
> -	clk_disable_unprepare(dsi->dsi_p_clk);
> -	reset_control_assert(dsi->dsi_p_rst);
> -	return 0;
> +static int cdns_dsi_resume(struct device *dev)
> +{
> +	return pm_runtime_force_resume(dev);
>   }
>   
> -static UNIVERSAL_DEV_PM_OPS(cdns_dsi_pm_ops, cdns_dsi_suspend, cdns_dsi_resume,
> -			    NULL);
> +static const struct dev_pm_ops cdns_dsi_pm_ops = {
> +	SET_RUNTIME_PM_OPS(cdns_dsi_runtime_suspend,
> +			cdns_dsi_runtime_resume, NULL)
> +	SET_SYSTEM_SLEEP_PM_OPS(cdns_dsi_suspend, cdns_dsi_resume)
> +};
>   
>   static int cdns_dsi_drm_probe(struct platform_device *pdev)
>   {

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

* Re: [PATCH v2] drm/bridge: cdns-dsi: Split pm_ops into runtime_pm and system_sleep ops
  2026-01-12  9:12 [PATCH v2] drm/bridge: cdns-dsi: Split pm_ops into runtime_pm and system_sleep ops Abhash Kumar Jha
  2026-01-13  9:53 ` Kumar, Udit
@ 2026-01-16 11:57 ` Tomi Valkeinen
  1 sibling, 0 replies; 3+ messages in thread
From: Tomi Valkeinen @ 2026-01-16 11:57 UTC (permalink / raw)
  To: Abhash Kumar Jha
  Cc: linux-kernel, dri-devel, Laurent.pinchart, jonas, jernej.skrabec,
	s-jain1, p-mantena, aradhya.bhatia, p.zabel, andrzej.hajda,
	neil.armstrong, rfoss, mripard, tzimmermann, airlied, simona,
	devarsht, u-kumar1

Hi,

On 12/01/2026 11:12, Abhash Kumar Jha wrote:
> If runtime-pm has already suspended the device and a system suspend
> occurs, then we see a kernel crash when disabling and unpreparing the
> clocks.
> 
> Use pm_runtime_force_suspend/resume in system_sleep pm callbacks to let
> runtime-pm take care of the coordination between system suspend and
> itself. This ensures that they do not interfere with each other.
> 
> Signed-off-by: Abhash Kumar Jha <a-kumar2@ti.com>
> ---
> Hi,
> 
> If a device is runtime_pm suspended and a system wide suspend is triggered,
> we see a kernel crash. Hence split the power management ops into separate
> system_sleep and runtime_pm ops.
> 
> Changes in v2:
> - Improve the commit description and subject.
> - Link to v1: https://lore.kernel.org/all/20260109060312.2853133-1-a-kumar2@ti.com/

See:

https://lore.kernel.org/all/20250512083215.436149-1-ivitro%40gmail.com/

I think that's a better fix.

 Tomi

> 
> Thanks,
> Abhash
> 
>  .../gpu/drm/bridge/cadence/cdns-dsi-core.c    | 32 +++++++++++++------
>  1 file changed, 23 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> index 09b289f0fcbf..25eaf0192013 100644
> --- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> +++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> @@ -1230,7 +1230,18 @@ static const struct mipi_dsi_host_ops cdns_dsi_ops = {
>  	.transfer = cdns_dsi_transfer,
>  };
>  
> -static int __maybe_unused cdns_dsi_resume(struct device *dev)
> +static int cdns_dsi_runtime_suspend(struct device *dev)
> +{
> +	struct cdns_dsi *dsi = dev_get_drvdata(dev);
> +
> +	clk_disable_unprepare(dsi->dsi_sys_clk);
> +	clk_disable_unprepare(dsi->dsi_p_clk);
> +	reset_control_assert(dsi->dsi_p_rst);
> +
> +	return 0;
> +}
> +
> +static int cdns_dsi_runtime_resume(struct device *dev)
>  {
>  	struct cdns_dsi *dsi = dev_get_drvdata(dev);
>  
> @@ -1241,18 +1252,21 @@ static int __maybe_unused cdns_dsi_resume(struct device *dev)
>  	return 0;
>  }
>  
> -static int __maybe_unused cdns_dsi_suspend(struct device *dev)
> +static int cdns_dsi_suspend(struct device *dev)
>  {
> -	struct cdns_dsi *dsi = dev_get_drvdata(dev);
> +	return pm_runtime_force_suspend(dev);
> +}
>  
> -	clk_disable_unprepare(dsi->dsi_sys_clk);
> -	clk_disable_unprepare(dsi->dsi_p_clk);
> -	reset_control_assert(dsi->dsi_p_rst);
> -	return 0;
> +static int cdns_dsi_resume(struct device *dev)
> +{
> +	return pm_runtime_force_resume(dev);
>  }
>  
> -static UNIVERSAL_DEV_PM_OPS(cdns_dsi_pm_ops, cdns_dsi_suspend, cdns_dsi_resume,
> -			    NULL);
> +static const struct dev_pm_ops cdns_dsi_pm_ops = {
> +	SET_RUNTIME_PM_OPS(cdns_dsi_runtime_suspend,
> +			cdns_dsi_runtime_resume, NULL)
> +	SET_SYSTEM_SLEEP_PM_OPS(cdns_dsi_suspend, cdns_dsi_resume)
> +};
>  
>  static int cdns_dsi_drm_probe(struct platform_device *pdev)
>  {


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

end of thread, other threads:[~2026-01-16 11:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-12  9:12 [PATCH v2] drm/bridge: cdns-dsi: Split pm_ops into runtime_pm and system_sleep ops Abhash Kumar Jha
2026-01-13  9:53 ` Kumar, Udit
2026-01-16 11:57 ` Tomi Valkeinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®