public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4] drm/bridge: cdns-dsi: Replace deprecated UNIVERSAL_DEV_PM_OPS()
@ 2026-04-07 14:41 Vitor Soares
  2026-04-29 13:43 ` Francesco Dolcini
  2026-04-30  8:10 ` Luca Ceresoli
  0 siblings, 2 replies; 5+ messages in thread
From: Vitor Soares @ 2026-04-07 14:41 UTC (permalink / raw)
  To: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
	Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter
  Cc: Vitor Soares, dri-devel, linux-kernel, stable, Tomi Valkeinen

From: Vitor Soares <vitor.soares@toradex.com>

The deprecated UNIVERSAL_DEV_PM_OPS() macro uses the provided callbacks
for both runtime PM and system sleep. This causes the DSI clocks to be
disabled twice: once during runtime suspend and again during system
suspend, resulting in a WARN message from the clock framework when
attempting to disable already-disabled clocks.

[   84.384540] clk:231:5 already disabled
[   84.388314] WARNING: CPU: 2 PID: 531 at /drivers/clk/clk.c:1181 clk_core_disable+0xa4/0xac
...
[   84.579183] Call trace:
[   84.581624]  clk_core_disable+0xa4/0xac
[   84.585457]  clk_disable+0x30/0x4c
[   84.588857]  cdns_dsi_suspend+0x20/0x58 [cdns_dsi]
[   84.593651]  pm_generic_suspend+0x2c/0x44
[   84.597661]  ti_sci_pd_suspend+0xbc/0x15c
[   84.601670]  dpm_run_callback+0x8c/0x14c
[   84.605588]  __device_suspend+0x1a0/0x56c
[   84.609594]  dpm_suspend+0x17c/0x21c
[   84.613165]  dpm_suspend_start+0xa0/0xa8
[   84.617083]  suspend_devices_and_enter+0x12c/0x634
[   84.621872]  pm_suspend+0x1fc/0x368

To address this issue, replace UNIVERSAL_DEV_PM_OPS() with
SET_RUNTIME_PM_OPS(), enabling suspend/resume handling through the
_enable()/_disable() hooks managed by the DRM framework for both
runtime and system-wide PM.

Cc: stable@vger.kernel.org # 6.1.x
Fixes: e19233955d9e ("drm/bridge: Add Cadence DSI driver")
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Vitor Soares <vitor.soares@toradex.com>
---
v3 -> v4
 - Add Reviewed-by from Tomi Valkeinen
 - Rebase on top of drm-misc-fixes
 - Verified issue still present on current mainline

v2 -> v3
 - Fix warning: 'cdns_dsi_suspend' defined but not used [-Wunused-function]
 - Fix warning: 'cdns_dsi_resume' defined but not used [-Wunused-function]

v1 -> v2
 - Rely only on SET_RUNTIME_PM_OPS() for the PM.

 drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
index 0dd85e26248c..e07a9892df4e 100644
--- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
+++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
@@ -1230,7 +1230,7 @@ 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_resume(struct device *dev)
 {
 	struct cdns_dsi *dsi = dev_get_drvdata(dev);
 
@@ -1241,7 +1241,7 @@ 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);
 
@@ -1251,8 +1251,9 @@ static int __maybe_unused cdns_dsi_suspend(struct device *dev)
 	return 0;
 }
 
-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 = {
+	RUNTIME_PM_OPS(cdns_dsi_suspend, cdns_dsi_resume, NULL)
+};
 
 static int cdns_dsi_drm_probe(struct platform_device *pdev)
 {
@@ -1399,7 +1400,7 @@ static struct platform_driver cdns_dsi_platform_driver = {
 	.driver = {
 		.name   = "cdns-dsi",
 		.of_match_table = cdns_dsi_of_match,
-		.pm = &cdns_dsi_pm_ops,
+		.pm = pm_ptr(&cdns_dsi_pm_ops),
 	},
 };
 module_platform_driver(cdns_dsi_platform_driver);
-- 
2.53.0


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

* Re: [PATCH v4] drm/bridge: cdns-dsi: Replace deprecated UNIVERSAL_DEV_PM_OPS()
  2026-04-07 14:41 [PATCH v4] drm/bridge: cdns-dsi: Replace deprecated UNIVERSAL_DEV_PM_OPS() Vitor Soares
@ 2026-04-29 13:43 ` Francesco Dolcini
  2026-04-30  8:10 ` Luca Ceresoli
  1 sibling, 0 replies; 5+ messages in thread
From: Francesco Dolcini @ 2026-04-29 13:43 UTC (permalink / raw)
  To: Vitor Soares, Dmitry Baryshkov, Luca Ceresoli
  Cc: Andrzej Hajda, Neil Armstrong, Robert Foss, Laurent Pinchart,
	Jonas Karlman, Jernej Skrabec, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, Vitor Soares,
	dri-devel, linux-kernel, stable, Tomi Valkeinen

+Dmitry, Luca

Hello,

On Tue, Apr 07, 2026 at 03:41:41PM +0100, Vitor Soares wrote:
> From: Vitor Soares <vitor.soares@toradex.com>
> 
> The deprecated UNIVERSAL_DEV_PM_OPS() macro uses the provided callbacks
> for both runtime PM and system sleep. This causes the DSI clocks to be
> disabled twice: once during runtime suspend and again during system
> suspend, resulting in a WARN message from the clock framework when
> attempting to disable already-disabled clocks.
> 
> [   84.384540] clk:231:5 already disabled
> [   84.388314] WARNING: CPU: 2 PID: 531 at /drivers/clk/clk.c:1181 clk_core_disable+0xa4/0xac
> ...
> [   84.579183] Call trace:
> [   84.581624]  clk_core_disable+0xa4/0xac
> [   84.585457]  clk_disable+0x30/0x4c
> [   84.588857]  cdns_dsi_suspend+0x20/0x58 [cdns_dsi]
> [   84.593651]  pm_generic_suspend+0x2c/0x44
> [   84.597661]  ti_sci_pd_suspend+0xbc/0x15c
> [   84.601670]  dpm_run_callback+0x8c/0x14c
> [   84.605588]  __device_suspend+0x1a0/0x56c
> [   84.609594]  dpm_suspend+0x17c/0x21c
> [   84.613165]  dpm_suspend_start+0xa0/0xa8
> [   84.617083]  suspend_devices_and_enter+0x12c/0x634
> [   84.621872]  pm_suspend+0x1fc/0x368
> 
> To address this issue, replace UNIVERSAL_DEV_PM_OPS() with
> SET_RUNTIME_PM_OPS(), enabling suspend/resume handling through the
> _enable()/_disable() hooks managed by the DRM framework for both
> runtime and system-wide PM.
> 
> Cc: stable@vger.kernel.org # 6.1.x
> Fixes: e19233955d9e ("drm/bridge: Add Cadence DSI driver")
> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
> Signed-off-by: Vitor Soares <vitor.soares@toradex.com>

Luca, Dmitry: any chance you can help with this patch?

Thanks,
Francesco


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

* Re: [PATCH v4] drm/bridge: cdns-dsi: Replace deprecated UNIVERSAL_DEV_PM_OPS()
  2026-04-07 14:41 [PATCH v4] drm/bridge: cdns-dsi: Replace deprecated UNIVERSAL_DEV_PM_OPS() Vitor Soares
  2026-04-29 13:43 ` Francesco Dolcini
@ 2026-04-30  8:10 ` Luca Ceresoli
  2026-04-30  8:52   ` Vitor Soares
  1 sibling, 1 reply; 5+ messages in thread
From: Luca Ceresoli @ 2026-04-30  8:10 UTC (permalink / raw)
  To: Vitor Soares, Andrzej Hajda, Neil Armstrong, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter
  Cc: Vitor Soares, dri-devel, linux-kernel, stable, Tomi Valkeinen

On Tue Apr 7, 2026 at 4:41 PM CEST, Vitor Soares wrote:
> From: Vitor Soares <vitor.soares@toradex.com>
>
> The deprecated UNIVERSAL_DEV_PM_OPS() macro uses the provided callbacks
> for both runtime PM and system sleep. This causes the DSI clocks to be
> disabled twice: once during runtime suspend and again during system
> suspend, resulting in a WARN message from the clock framework when
> attempting to disable already-disabled clocks.
>
> [   84.384540] clk:231:5 already disabled
> [   84.388314] WARNING: CPU: 2 PID: 531 at /drivers/clk/clk.c:1181 clk_core_disable+0xa4/0xac
> ...
> [   84.579183] Call trace:
> [   84.581624]  clk_core_disable+0xa4/0xac
> [   84.585457]  clk_disable+0x30/0x4c
> [   84.588857]  cdns_dsi_suspend+0x20/0x58 [cdns_dsi]
> [   84.593651]  pm_generic_suspend+0x2c/0x44
> [   84.597661]  ti_sci_pd_suspend+0xbc/0x15c
> [   84.601670]  dpm_run_callback+0x8c/0x14c
> [   84.605588]  __device_suspend+0x1a0/0x56c
> [   84.609594]  dpm_suspend+0x17c/0x21c
> [   84.613165]  dpm_suspend_start+0xa0/0xa8
> [   84.617083]  suspend_devices_and_enter+0x12c/0x634
> [   84.621872]  pm_suspend+0x1fc/0x368
>
> To address this issue, replace UNIVERSAL_DEV_PM_OPS() with
> SET_RUNTIME_PM_OPS(), enabling suspend/resume handling through the

This is not what the patch does, the patch uses RUNTIME_PM_OPS.

> _enable()/_disable() hooks managed by the DRM framework for both
> runtime and system-wide PM.
>
> Cc: stable@vger.kernel.org # 6.1.x
> Fixes: e19233955d9e ("drm/bridge: Add Cadence DSI driver")
> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
> Signed-off-by: Vitor Soares <vitor.soares@toradex.com>
> ---
> v3 -> v4
>  - Add Reviewed-by from Tomi Valkeinen
>  - Rebase on top of drm-misc-fixes
>  - Verified issue still present on current mainline
>
> v2 -> v3
>  - Fix warning: 'cdns_dsi_suspend' defined but not used [-Wunused-function]
>  - Fix warning: 'cdns_dsi_resume' defined but not used [-Wunused-function]
>
> v1 -> v2
>  - Rely only on SET_RUNTIME_PM_OPS() for the PM.
>
>  drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> index 0dd85e26248c..e07a9892df4e 100644
> --- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> +++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> @@ -1230,7 +1230,7 @@ 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_resume(struct device *dev)
>  {
>  	struct cdns_dsi *dsi = dev_get_drvdata(dev);
>
> @@ -1241,7 +1241,7 @@ 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);
>
> @@ -1251,8 +1251,9 @@ static int __maybe_unused cdns_dsi_suspend(struct device *dev)
>  	return 0;
>  }
>
> -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 = {
> +	RUNTIME_PM_OPS(cdns_dsi_suspend, cdns_dsi_resume, NULL)
> +};

Not an expert here, but the docs [0] suggest using
DEFINE_RUNTIME_DEV_PM_OPS(). Is there a good reason to not do so?

[0] https://elixir.bootlin.com/linux/v7.0.1/source/include/linux/pm.h#L455-L456

Luca

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* Re: [PATCH v4] drm/bridge: cdns-dsi: Replace deprecated UNIVERSAL_DEV_PM_OPS()
  2026-04-30  8:10 ` Luca Ceresoli
@ 2026-04-30  8:52   ` Vitor Soares
  2026-04-30  9:05     ` Luca Ceresoli
  0 siblings, 1 reply; 5+ messages in thread
From: Vitor Soares @ 2026-04-30  8:52 UTC (permalink / raw)
  To: Luca Ceresoli, Andrzej Hajda, Neil Armstrong, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter
  Cc: Vitor Soares, dri-devel, linux-kernel, stable, Tomi Valkeinen

Hi Luca,

Thanks you for the feedback.

On Thu, 2026-04-30 at 10:10 +0200, Luca Ceresoli wrote:
> On Tue Apr 7, 2026 at 4:41 PM CEST, Vitor Soares wrote:
> > From: Vitor Soares <vitor.soares@toradex.com>
> > 
> > The deprecated UNIVERSAL_DEV_PM_OPS() macro uses the provided callbacks
> > for both runtime PM and system sleep. This causes the DSI clocks to be
> > disabled twice: once during runtime suspend and again during system
> > suspend, resulting in a WARN message from the clock framework when
> > attempting to disable already-disabled clocks.
> > 
> > [   84.384540] clk:231:5 already disabled
> > [   84.388314] WARNING: CPU: 2 PID: 531 at /drivers/clk/clk.c:1181
> > clk_core_disable+0xa4/0xac
> > ...
> > [   84.579183] Call trace:
> > [   84.581624]  clk_core_disable+0xa4/0xac
> > [   84.585457]  clk_disable+0x30/0x4c
> > [   84.588857]  cdns_dsi_suspend+0x20/0x58 [cdns_dsi]
> > [   84.593651]  pm_generic_suspend+0x2c/0x44
> > [   84.597661]  ti_sci_pd_suspend+0xbc/0x15c
> > [   84.601670]  dpm_run_callback+0x8c/0x14c
> > [   84.605588]  __device_suspend+0x1a0/0x56c
> > [   84.609594]  dpm_suspend+0x17c/0x21c
> > [   84.613165]  dpm_suspend_start+0xa0/0xa8
> > [   84.617083]  suspend_devices_and_enter+0x12c/0x634
> > [   84.621872]  pm_suspend+0x1fc/0x368
> > 
> > To address this issue, replace UNIVERSAL_DEV_PM_OPS() with
> > SET_RUNTIME_PM_OPS(), enabling suspend/resume handling through the
> 
> This is not what the patch does, the patch uses RUNTIME_PM_OPS.
> 

I missed changing it. I will send another version fixing the commit message
to RUNTIME_PM_OPS().

> > _enable()/_disable() hooks managed by the DRM framework for both
> > runtime and system-wide PM.
> > 
> > Cc: stable@vger.kernel.org # 6.1.x
> > Fixes: e19233955d9e ("drm/bridge: Add Cadence DSI driver")
> > Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
> > Signed-off-by: Vitor Soares <vitor.soares@toradex.com>
> > ---
> > v3 -> v4
> >  - Add Reviewed-by from Tomi Valkeinen
> >  - Rebase on top of drm-misc-fixes
> >  - Verified issue still present on current mainline
> > 
> > v2 -> v3
> >  - Fix warning: 'cdns_dsi_suspend' defined but not used [-Wunused-function]
> >  - Fix warning: 'cdns_dsi_resume' defined but not used [-Wunused-function]
> > 
> > v1 -> v2
> >  - Rely only on SET_RUNTIME_PM_OPS() for the PM.
> > 
> >  drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 11 ++++++-----
> >  1 file changed, 6 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> > b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> > index 0dd85e26248c..e07a9892df4e 100644
> > --- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> > +++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c
> > @@ -1230,7 +1230,7 @@ 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_resume(struct device *dev)
> >  {
> >         struct cdns_dsi *dsi = dev_get_drvdata(dev);
> > 
> > @@ -1241,7 +1241,7 @@ 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);
> > 
> > @@ -1251,8 +1251,9 @@ static int __maybe_unused cdns_dsi_suspend(struct
> > device *dev)
> >         return 0;
> >  }
> > 
> > -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 = {
> > +       RUNTIME_PM_OPS(cdns_dsi_suspend, cdns_dsi_resume, NULL)
> > +};
> 
> Not an expert here, but the docs [0] suggest using
> DEFINE_RUNTIME_DEV_PM_OPS(). Is there a good reason to not do so?
> 
> [0]
> https://elixir.bootlin.com/linux/v7.0.1/source/include/linux/pm.h#L455-L456
> 
> Luca
> 

In an earlier discussion [0], we concluded that bridges/panels should only deal
with runtime PM:

[0]
https://lore.kernel.org/all/a1cf67da-a0cb-46c5-b22b-10ecca8ab383@ideasonboard.com/

Best regards,
Vitor Soares

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

* Re: [PATCH v4] drm/bridge: cdns-dsi: Replace deprecated UNIVERSAL_DEV_PM_OPS()
  2026-04-30  8:52   ` Vitor Soares
@ 2026-04-30  9:05     ` Luca Ceresoli
  0 siblings, 0 replies; 5+ messages in thread
From: Luca Ceresoli @ 2026-04-30  9:05 UTC (permalink / raw)
  To: Vitor Soares, Andrzej Hajda, Neil Armstrong, Robert Foss,
	Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Simona Vetter
  Cc: Vitor Soares, dri-devel, linux-kernel, stable, Tomi Valkeinen

Hello Vitor,

On Thu Apr 30, 2026 at 10:52 AM CEST, Vitor Soares wrote:

>> > -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 = {
>> > +       RUNTIME_PM_OPS(cdns_dsi_suspend, cdns_dsi_resume, NULL)
>> > +};
>>
>> Not an expert here, but the docs [0] suggest using
>> DEFINE_RUNTIME_DEV_PM_OPS(). Is there a good reason to not do so?
>>
>> [0]
>> https://elixir.bootlin.com/linux/v7.0.1/source/include/linux/pm.h#L455-L456
>>
>> Luca
>>
>
> In an earlier discussion [0], we concluded that bridges/panels should only deal
> with runtime PM:

Ah, good. Then please mention this in the commit message in v5. It can help
others doing the right thing in future similar cases.

Luca

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

end of thread, other threads:[~2026-04-30  9:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-07 14:41 [PATCH v4] drm/bridge: cdns-dsi: Replace deprecated UNIVERSAL_DEV_PM_OPS() Vitor Soares
2026-04-29 13:43 ` Francesco Dolcini
2026-04-30  8:10 ` Luca Ceresoli
2026-04-30  8:52   ` Vitor Soares
2026-04-30  9:05     ` Luca Ceresoli

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