From: Jonathan Cameron <jic23@kernel.org>
To: Denis Benato <benato.denis96@gmail.com>
Cc: "David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Alex Lanzano" <lanzano.alex@gmail.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Peter Zijlstra" <peterz@infradead.org>,
"Danila Tikhonov" <danila@jiaxyga.com>,
"Greg KH" <gregkh@linuxfoundation.org>,
"Derek J . Clark" <derekjohn.clark@gmail.com>,
"Philip Müller" <philm@manjaro.org>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
"Justin Weiss" <justin@justinweiss.com>
Subject: Re: [PATCH v2 1/2] iio: bmi270: suspend and resume triggering on relevant pm operations
Date: Sat, 31 May 2025 17:59:13 +0100 [thread overview]
Message-ID: <20250531175913.251d64d3@jic23-huawei> (raw)
In-Reply-To: <20250525142530.71955-2-benato.denis96@gmail.com>
On Sun, 25 May 2025 16:25:29 +0200
Denis Benato <benato.denis96@gmail.com> wrote:
> Prevent triggers from stop working after the device has entered sleep:
> use iio_device_suspend_triggering and iio_device_resume_triggering helpers.
>
> Closes: https://lore.kernel.org/all/31d7f7aa-e834-4fd0-a66a-e0ff528425dc@gmail.com
This is a tag, so no blank line here.
I've fixed this in both patches and applied them to the to testing branch of iio.
Currently I'm not planning to rush these in but I could treat them as fixes if
general view is that I should.
>
> Signed-off-by: Denis Benato <benato.denis96@gmail.com>
> Tested-by: Justin Weiss <justin@justinweiss.com>
> ---
> drivers/iio/imu/bmi270/bmi270.h | 2 ++
> drivers/iio/imu/bmi270/bmi270_core.c | 20 ++++++++++++++++++++
> drivers/iio/imu/bmi270/bmi270_i2c.c | 2 ++
> drivers/iio/imu/bmi270/bmi270_spi.c | 2 ++
> 4 files changed, 26 insertions(+)
>
> diff --git a/drivers/iio/imu/bmi270/bmi270.h b/drivers/iio/imu/bmi270/bmi270.h
> index d94525f6aee8..a6c4204032fc 100644
> --- a/drivers/iio/imu/bmi270/bmi270.h
> +++ b/drivers/iio/imu/bmi270/bmi270.h
> @@ -20,4 +20,6 @@ struct device;
> int bmi270_core_probe(struct device *dev, struct regmap *regmap,
> const struct bmi270_chip_info *chip_info);
>
> +extern const struct dev_pm_ops bmi270_core_pm_ops;
> +
> #endif /* BMI270_H_ */
> diff --git a/drivers/iio/imu/bmi270/bmi270_core.c b/drivers/iio/imu/bmi270/bmi270_core.c
> index 2e4469f30d53..b54658f972ad 100644
> --- a/drivers/iio/imu/bmi270/bmi270_core.c
> +++ b/drivers/iio/imu/bmi270/bmi270_core.c
> @@ -982,6 +982,7 @@ int bmi270_core_probe(struct device *dev, struct regmap *regmap,
> indio_dev->available_scan_masks = bmi270_avail_scan_masks;
> indio_dev->modes = INDIO_DIRECT_MODE;
> indio_dev->info = &bmi270_info;
> + dev_set_drvdata(data->dev, indio_dev);
>
> ret = bmi270_trigger_probe(data, indio_dev);
> if (ret)
> @@ -997,6 +998,25 @@ int bmi270_core_probe(struct device *dev, struct regmap *regmap,
> }
> EXPORT_SYMBOL_NS_GPL(bmi270_core_probe, "IIO_BMI270");
>
> +static int bmi270_core_runtime_suspend(struct device *dev)
> +{
> + struct iio_dev *indio_dev = dev_get_drvdata(dev);
> +
> + return iio_device_suspend_triggering(indio_dev);
> +}
> +
> +static int bmi270_core_runtime_resume(struct device *dev)
> +{
> + struct iio_dev *indio_dev = dev_get_drvdata(dev);
> +
> + return iio_device_resume_triggering(indio_dev);
> +}
> +
> +const struct dev_pm_ops bmi270_core_pm_ops = {
> + RUNTIME_PM_OPS(bmi270_core_runtime_suspend, bmi270_core_runtime_resume, NULL)
> +};
> +EXPORT_SYMBOL_NS_GPL(bmi270_core_pm_ops, "IIO_BMI270");
> +
> MODULE_AUTHOR("Alex Lanzano");
> MODULE_DESCRIPTION("BMI270 driver");
> MODULE_LICENSE("GPL");
> diff --git a/drivers/iio/imu/bmi270/bmi270_i2c.c b/drivers/iio/imu/bmi270/bmi270_i2c.c
> index 44699ab58909..c77839b03a96 100644
> --- a/drivers/iio/imu/bmi270/bmi270_i2c.c
> +++ b/drivers/iio/imu/bmi270/bmi270_i2c.c
> @@ -4,6 +4,7 @@
> #include <linux/iio/iio.h>
> #include <linux/module.h>
> #include <linux/mod_devicetable.h>
> +#include <linux/pm.h>
> #include <linux/regmap.h>
>
> #include "bmi270.h"
> @@ -52,6 +53,7 @@ static const struct of_device_id bmi270_of_match[] = {
> static struct i2c_driver bmi270_i2c_driver = {
> .driver = {
> .name = "bmi270_i2c",
> + .pm = pm_ptr(&bmi270_core_pm_ops),
> .acpi_match_table = bmi270_acpi_match,
> .of_match_table = bmi270_of_match,
> },
> diff --git a/drivers/iio/imu/bmi270/bmi270_spi.c b/drivers/iio/imu/bmi270/bmi270_spi.c
> index 88a77aba5e4f..19dd7734f9d0 100644
> --- a/drivers/iio/imu/bmi270/bmi270_spi.c
> +++ b/drivers/iio/imu/bmi270/bmi270_spi.c
> @@ -3,6 +3,7 @@
> #include <linux/iio/iio.h>
> #include <linux/mod_devicetable.h>
> #include <linux/module.h>
> +#include <linux/pm.h>
> #include <linux/regmap.h>
> #include <linux/spi/spi.h>
>
> @@ -79,6 +80,7 @@ static const struct of_device_id bmi270_of_match[] = {
> static struct spi_driver bmi270_spi_driver = {
> .driver = {
> .name = "bmi270",
> + .pm = pm_ptr(&bmi270_core_pm_ops),
> .of_match_table = bmi270_of_match,
> },
> .probe = bmi270_spi_probe,
next prev parent reply other threads:[~2025-05-31 16:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-25 14:25 [PATCH v2 0/2] iio: fix suspend and resume triggering for bmi160 and bmi270 Denis Benato
2025-05-25 14:25 ` [PATCH v2 1/2] iio: bmi270: suspend and resume triggering on relevant pm operations Denis Benato
2025-05-31 16:59 ` Jonathan Cameron [this message]
2025-05-25 14:25 ` [PATCH v2 2/2] iio: bmi160: " Denis Benato
2025-05-26 19:58 ` [PATCH v2 0/2] iio: fix suspend and resume triggering for bmi160 and bmi270 Andy Shevchenko
2025-05-26 20:13 ` Denis Benato
2025-05-26 20:18 ` Andy Shevchenko
2025-05-26 23:37 ` Denis Benato
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250531175913.251d64d3@jic23-huawei \
--to=jic23@kernel.org \
--cc=andy@kernel.org \
--cc=benato.denis96@gmail.com \
--cc=danila@jiaxyga.com \
--cc=derekjohn.clark@gmail.com \
--cc=dlechner@baylibre.com \
--cc=gregkh@linuxfoundation.org \
--cc=justin@justinweiss.com \
--cc=lanzano.alex@gmail.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=peterz@infradead.org \
--cc=philm@manjaro.org \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox