mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-21 12:36:21 -04:00
iio: bmi270: suspend and resume triggering on relevant pm operations
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 Signed-off-by: Denis Benato <benato.denis96@gmail.com> Tested-by: Justin Weiss <justin@justinweiss.com> Link: https://patch.msgid.link/20250525142530.71955-2-benato.denis96@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
committed by
Jonathan Cameron
parent
3125a5ca45
commit
cfcb44872a
@@ -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_ */
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user