public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] iio: pressure: mpl115: add system suspend/resume support
@ 2026-02-21 17:26 Neel Bullywon
  2026-02-21 17:26 ` [PATCH 2/2] iio: pressure: mpl115: remove stale TODO comment Neel Bullywon
  2026-02-22 16:40 ` [PATCH 1/2] iio: pressure: mpl115: add system suspend/resume support Jonathan Cameron
  0 siblings, 2 replies; 6+ messages in thread
From: Neel Bullywon @ 2026-02-21 17:26 UTC (permalink / raw)
  To: jic23, dlechner, nuno.sa, andy; +Cc: linux-iio, linux-kernel, Neel Bullywon

The driver currently only implements runtime PM callbacks to control
the shutdown GPIO, but lacks system suspend/resume support. This means
the device may remain powered during system sleep, wasting energy.

Add system sleep PM ops using pm_runtime_force_suspend() and
pm_runtime_force_resume() to properly synchronize the runtime PM state
across system suspend/resume cycles. This ensures the shutdown GPIO is
asserted during system sleep when the device has a shutdown GPIO
configured.

Signed-off-by: Neel Bullywon <neelb2403@gmail.com>
---
 drivers/iio/pressure/mpl115.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/pressure/mpl115.c b/drivers/iio/pressure/mpl115.c
index 830a5065c008..29794ce53bc6 100644
--- a/drivers/iio/pressure/mpl115.c
+++ b/drivers/iio/pressure/mpl115.c
@@ -244,8 +244,10 @@ static int mpl115_runtime_resume(struct device *dev)
 	return 0;
 }
 
-EXPORT_NS_RUNTIME_DEV_PM_OPS(mpl115_dev_pm_ops, mpl115_runtime_suspend,
-			  mpl115_runtime_resume, NULL, IIO_MPL115);
+EXPORT_NS_GPL_DEV_PM_OPS(mpl115_dev_pm_ops, IIO_MPL115) = {
+	SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
+	RUNTIME_PM_OPS(mpl115_runtime_suspend, mpl115_runtime_resume, NULL)
+};
 
 MODULE_AUTHOR("Peter Meerwald <pmeerw@pmeerw.net>");
 MODULE_DESCRIPTION("Freescale MPL115 pressure/temperature driver");
-- 
2.44.0


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

* [PATCH 2/2] iio: pressure: mpl115: remove stale TODO comment
  2026-02-21 17:26 [PATCH 1/2] iio: pressure: mpl115: add system suspend/resume support Neel Bullywon
@ 2026-02-21 17:26 ` Neel Bullywon
  2026-02-21 17:46   ` David Lechner
  2026-02-22 16:40 ` [PATCH 1/2] iio: pressure: mpl115: add system suspend/resume support Jonathan Cameron
  1 sibling, 1 reply; 6+ messages in thread
From: Neel Bullywon @ 2026-02-21 17:26 UTC (permalink / raw)
  To: jic23, dlechner, nuno.sa, andy; +Cc: linux-iio, linux-kernel, Neel Bullywon

System suspend/resume support has been added in the previous commit,
so remove the TODO comment that was requesting it.

Signed-off-by: Neel Bullywon <neelb2403@gmail.com>
---
 drivers/iio/pressure/mpl115.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/iio/pressure/mpl115.c b/drivers/iio/pressure/mpl115.c
index 29794ce53bc6..93f1388cbe27 100644
--- a/drivers/iio/pressure/mpl115.c
+++ b/drivers/iio/pressure/mpl115.c
@@ -3,8 +3,6 @@
  * mpl115.c - Support for Freescale MPL115A pressure/temperature sensor
  *
  * Copyright (c) 2014 Peter Meerwald <pmeerw@pmeerw.net>
- *
- * TODO: synchronization with system suspend
  */
 
 #include <linux/module.h>
-- 
2.44.0


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

* Re: [PATCH 2/2] iio: pressure: mpl115: remove stale TODO comment
  2026-02-21 17:26 ` [PATCH 2/2] iio: pressure: mpl115: remove stale TODO comment Neel Bullywon
@ 2026-02-21 17:46   ` David Lechner
  0 siblings, 0 replies; 6+ messages in thread
From: David Lechner @ 2026-02-21 17:46 UTC (permalink / raw)
  To: Neel Bullywon, jic23, nuno.sa, andy; +Cc: linux-iio, linux-kernel

On 2/21/26 11:26 AM, Neel Bullywon wrote:
> System suspend/resume support has been added in the previous commit,
> so remove the TODO comment that was requesting it.

Why not include this in the same patch?


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

* Re: [PATCH 1/2] iio: pressure: mpl115: add system suspend/resume support
  2026-02-21 17:26 [PATCH 1/2] iio: pressure: mpl115: add system suspend/resume support Neel Bullywon
  2026-02-21 17:26 ` [PATCH 2/2] iio: pressure: mpl115: remove stale TODO comment Neel Bullywon
@ 2026-02-22 16:40 ` Jonathan Cameron
  2026-02-22 18:32   ` Paul Cercueil
  1 sibling, 1 reply; 6+ messages in thread
From: Jonathan Cameron @ 2026-02-22 16:40 UTC (permalink / raw)
  To: Neel Bullywon
  Cc: dlechner, nuno.sa, andy, linux-iio, linux-kernel, Paul Cercueil,
	Rafael J. Wysocki

On Sat, 21 Feb 2026 12:26:00 -0500
Neel Bullywon <neelb2403@gmail.com> wrote:

> The driver currently only implements runtime PM callbacks to control
> the shutdown GPIO, but lacks system suspend/resume support. This means
> the device may remain powered during system sleep, wasting energy.
> 
> Add system sleep PM ops using pm_runtime_force_suspend() and
> pm_runtime_force_resume() to properly synchronize the runtime PM state
> across system suspend/resume cycles. This ensures the shutdown GPIO is
> asserted during system sleep when the device has a shutdown GPIO
> configured.
> 
> Signed-off-by: Neel Bullywon <neelb2403@gmail.com>

Interestingly for the non exported version we have
DEFINE_RUNTIME_DEV_PM_OPS()
and the docs for that suggest we should use
EXPORT_RUNTIME_DEV_PM_OPS() but as you've realized that doesn't set the
suspend and resume callbacks. If that was intentional then the documentation
is less than clear (and I don't remember that being the intent)

+CC Paul and Rafael.

We have very few users of these macros, so it should be easy enough to
make the export variants consistent if we want to.

Jonathan

> ---
>  drivers/iio/pressure/mpl115.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/pressure/mpl115.c b/drivers/iio/pressure/mpl115.c
> index 830a5065c008..29794ce53bc6 100644
> --- a/drivers/iio/pressure/mpl115.c
> +++ b/drivers/iio/pressure/mpl115.c
> @@ -244,8 +244,10 @@ static int mpl115_runtime_resume(struct device *dev)
>  	return 0;
>  }
>  
> -EXPORT_NS_RUNTIME_DEV_PM_OPS(mpl115_dev_pm_ops, mpl115_runtime_suspend,
> -			  mpl115_runtime_resume, NULL, IIO_MPL115);
> +EXPORT_NS_GPL_DEV_PM_OPS(mpl115_dev_pm_ops, IIO_MPL115) = {
> +	SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
> +	RUNTIME_PM_OPS(mpl115_runtime_suspend, mpl115_runtime_resume, NULL)
> +};
>  
>  MODULE_AUTHOR("Peter Meerwald <pmeerw@pmeerw.net>");
>  MODULE_DESCRIPTION("Freescale MPL115 pressure/temperature driver");


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

* Re: [PATCH 1/2] iio: pressure: mpl115: add system suspend/resume support
  2026-02-22 16:40 ` [PATCH 1/2] iio: pressure: mpl115: add system suspend/resume support Jonathan Cameron
@ 2026-02-22 18:32   ` Paul Cercueil
  2026-02-28 19:28     ` Jonathan Cameron
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Cercueil @ 2026-02-22 18:32 UTC (permalink / raw)
  To: Jonathan Cameron, Neel Bullywon
  Cc: dlechner, nuno.sa, andy, linux-iio, linux-kernel,
	Rafael J. Wysocki

Hi,

Le dimanche 22 février 2026 à 16:40 +0000, Jonathan Cameron a écrit :
> On Sat, 21 Feb 2026 12:26:00 -0500
> Neel Bullywon <neelb2403@gmail.com> wrote:
> 
> > The driver currently only implements runtime PM callbacks to
> > control
> > the shutdown GPIO, but lacks system suspend/resume support. This
> > means
> > the device may remain powered during system sleep, wasting energy.
> > 
> > Add system sleep PM ops using pm_runtime_force_suspend() and
> > pm_runtime_force_resume() to properly synchronize the runtime PM
> > state
> > across system suspend/resume cycles. This ensures the shutdown GPIO
> > is
> > asserted during system sleep when the device has a shutdown GPIO
> > configured.
> > 
> > Signed-off-by: Neel Bullywon <neelb2403@gmail.com>
> 
> Interestingly for the non exported version we have
> DEFINE_RUNTIME_DEV_PM_OPS()
> and the docs for that suggest we should use
> EXPORT_RUNTIME_DEV_PM_OPS() but as you've realized that doesn't set
> the
> suspend and resume callbacks. If that was intentional then the
> documentation
> is less than clear (and I don't remember that being the intent)
> 
> +CC Paul and Rafael.
> 
> We have very few users of these macros, so it should be easy enough
> to
> make the export variants consistent if we want to.

Looks like the users are all in IIO which makes it even more
convenient.

It's been a while so my memory is fuzzy, but it would make sense to
have the suspend/resume callbacks, indeed.

> Jonathan
> 
> > ---
> >  drivers/iio/pressure/mpl115.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/iio/pressure/mpl115.c
> > b/drivers/iio/pressure/mpl115.c
> > index 830a5065c008..29794ce53bc6 100644
> > --- a/drivers/iio/pressure/mpl115.c
> > +++ b/drivers/iio/pressure/mpl115.c
> > @@ -244,8 +244,10 @@ static int mpl115_runtime_resume(struct device
> > *dev)
> >  	return 0;
> >  }
> >  
> > -EXPORT_NS_RUNTIME_DEV_PM_OPS(mpl115_dev_pm_ops,
> > mpl115_runtime_suspend,
> > -			  mpl115_runtime_resume, NULL,
> > IIO_MPL115);
> > +EXPORT_NS_GPL_DEV_PM_OPS(mpl115_dev_pm_ops, IIO_MPL115) = {
> > +	SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
> > pm_runtime_force_resume)
> > +	RUNTIME_PM_OPS(mpl115_runtime_suspend,
> > mpl115_runtime_resume, NULL)
> > +};

One thing I noticed is that now the symbols are exported as GPL, which
is probably fine (better than the other way around) but if that was on
purpose, it should at least be mentioned in the commit message.

Cheers,
-Paul

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

* Re: [PATCH 1/2] iio: pressure: mpl115: add system suspend/resume support
  2026-02-22 18:32   ` Paul Cercueil
@ 2026-02-28 19:28     ` Jonathan Cameron
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2026-02-28 19:28 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Neel Bullywon, dlechner, nuno.sa, andy, linux-iio, linux-kernel,
	Rafael J. Wysocki

On Sun, 22 Feb 2026 19:32:38 +0100
Paul Cercueil <paul@crapouillou.net> wrote:

> Hi,
> 
> Le dimanche 22 février 2026 à 16:40 +0000, Jonathan Cameron a écrit :
> > On Sat, 21 Feb 2026 12:26:00 -0500
> > Neel Bullywon <neelb2403@gmail.com> wrote:
> >   
> > > The driver currently only implements runtime PM callbacks to
> > > control
> > > the shutdown GPIO, but lacks system suspend/resume support. This
> > > means
> > > the device may remain powered during system sleep, wasting energy.
> > > 
> > > Add system sleep PM ops using pm_runtime_force_suspend() and
> > > pm_runtime_force_resume() to properly synchronize the runtime PM
> > > state
> > > across system suspend/resume cycles. This ensures the shutdown GPIO
> > > is
> > > asserted during system sleep when the device has a shutdown GPIO
> > > configured.
> > > 
> > > Signed-off-by: Neel Bullywon <neelb2403@gmail.com>  
> > 
> > Interestingly for the non exported version we have
> > DEFINE_RUNTIME_DEV_PM_OPS()
> > and the docs for that suggest we should use
> > EXPORT_RUNTIME_DEV_PM_OPS() but as you've realized that doesn't set
> > the
> > suspend and resume callbacks. If that was intentional then the
> > documentation
> > is less than clear (and I don't remember that being the intent)
> > 
> > +CC Paul and Rafael.
> > 
> > We have very few users of these macros, so it should be easy enough
> > to
> > make the export variants consistent if we want to.  
> 
> Looks like the users are all in IIO which makes it even more
> convenient.
> 
> It's been a while so my memory is fuzzy, but it would make sense to
> have the suspend/resume callbacks, indeed.

Ok. Neel, would you mind preparing a set to make 
EXPORT_NS_RUNTIME_DEV_PM_OPS() set the SYSTEM_SLEEP_PM_OPS()
as well?  If you can take a look at the existing callers and
shout if there any problems with this change, even better!

I foolishly always thought they were doing this so I 'think'
it'll be fine to make this change.  Also avoids the license
change thing Paul noted below.

Thanks,

Jonathan
> 
> > Jonathan
> >   
> > > ---
> > >  drivers/iio/pressure/mpl115.c | 6 ++++--
> > >  1 file changed, 4 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/iio/pressure/mpl115.c
> > > b/drivers/iio/pressure/mpl115.c
> > > index 830a5065c008..29794ce53bc6 100644
> > > --- a/drivers/iio/pressure/mpl115.c
> > > +++ b/drivers/iio/pressure/mpl115.c
> > > @@ -244,8 +244,10 @@ static int mpl115_runtime_resume(struct device
> > > *dev)
> > >  	return 0;
> > >  }
> > >  
> > > -EXPORT_NS_RUNTIME_DEV_PM_OPS(mpl115_dev_pm_ops,
> > > mpl115_runtime_suspend,
> > > -			  mpl115_runtime_resume, NULL,
> > > IIO_MPL115);
> > > +EXPORT_NS_GPL_DEV_PM_OPS(mpl115_dev_pm_ops, IIO_MPL115) = {
> > > +	SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
> > > pm_runtime_force_resume)
> > > +	RUNTIME_PM_OPS(mpl115_runtime_suspend,
> > > mpl115_runtime_resume, NULL)
> > > +};  
> 
> One thing I noticed is that now the symbols are exported as GPL, which
> is probably fine (better than the other way around) but if that was on
> purpose, it should at least be mentioned in the commit message.
> 
> Cheers,
> -Paul


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

end of thread, other threads:[~2026-02-28 19:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-21 17:26 [PATCH 1/2] iio: pressure: mpl115: add system suspend/resume support Neel Bullywon
2026-02-21 17:26 ` [PATCH 2/2] iio: pressure: mpl115: remove stale TODO comment Neel Bullywon
2026-02-21 17:46   ` David Lechner
2026-02-22 16:40 ` [PATCH 1/2] iio: pressure: mpl115: add system suspend/resume support Jonathan Cameron
2026-02-22 18:32   ` Paul Cercueil
2026-02-28 19:28     ` Jonathan Cameron

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