Re: [PATCH 1/2] iio: pressure: mpl115: add system suspend/resume support

From: Jonathan Cameron

Date: Sun Feb 22 2026 - 11:40:25 EST


On Sat, 21 Feb 2026 12:26:00 -0500
Neel Bullywon <neelb2403@xxxxxxxxx> 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@xxxxxxxxx>

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@xxxxxxxxxx>");
> MODULE_DESCRIPTION("Freescale MPL115 pressure/temperature driver");