Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Denis Benato and committed by
Jonathan Cameron
cfcb4487 3125a5ca

+26
+2
drivers/iio/imu/bmi270/bmi270.h
··· 20 20 int bmi270_core_probe(struct device *dev, struct regmap *regmap, 21 21 const struct bmi270_chip_info *chip_info); 22 22 23 + extern const struct dev_pm_ops bmi270_core_pm_ops; 24 + 23 25 #endif /* BMI270_H_ */
+20
drivers/iio/imu/bmi270/bmi270_core.c
··· 982 982 indio_dev->available_scan_masks = bmi270_avail_scan_masks; 983 983 indio_dev->modes = INDIO_DIRECT_MODE; 984 984 indio_dev->info = &bmi270_info; 985 + dev_set_drvdata(data->dev, indio_dev); 985 986 986 987 ret = bmi270_trigger_probe(data, indio_dev); 987 988 if (ret) ··· 997 996 return devm_iio_device_register(dev, indio_dev); 998 997 } 999 998 EXPORT_SYMBOL_NS_GPL(bmi270_core_probe, "IIO_BMI270"); 999 + 1000 + static int bmi270_core_runtime_suspend(struct device *dev) 1001 + { 1002 + struct iio_dev *indio_dev = dev_get_drvdata(dev); 1003 + 1004 + return iio_device_suspend_triggering(indio_dev); 1005 + } 1006 + 1007 + static int bmi270_core_runtime_resume(struct device *dev) 1008 + { 1009 + struct iio_dev *indio_dev = dev_get_drvdata(dev); 1010 + 1011 + return iio_device_resume_triggering(indio_dev); 1012 + } 1013 + 1014 + const struct dev_pm_ops bmi270_core_pm_ops = { 1015 + RUNTIME_PM_OPS(bmi270_core_runtime_suspend, bmi270_core_runtime_resume, NULL) 1016 + }; 1017 + EXPORT_SYMBOL_NS_GPL(bmi270_core_pm_ops, "IIO_BMI270"); 1000 1018 1001 1019 MODULE_AUTHOR("Alex Lanzano"); 1002 1020 MODULE_DESCRIPTION("BMI270 driver");
+2
drivers/iio/imu/bmi270/bmi270_i2c.c
··· 4 4 #include <linux/iio/iio.h> 5 5 #include <linux/module.h> 6 6 #include <linux/mod_devicetable.h> 7 + #include <linux/pm.h> 7 8 #include <linux/regmap.h> 8 9 9 10 #include "bmi270.h" ··· 53 52 static struct i2c_driver bmi270_i2c_driver = { 54 53 .driver = { 55 54 .name = "bmi270_i2c", 55 + .pm = pm_ptr(&bmi270_core_pm_ops), 56 56 .acpi_match_table = bmi270_acpi_match, 57 57 .of_match_table = bmi270_of_match, 58 58 },
+2
drivers/iio/imu/bmi270/bmi270_spi.c
··· 3 3 #include <linux/iio/iio.h> 4 4 #include <linux/mod_devicetable.h> 5 5 #include <linux/module.h> 6 + #include <linux/pm.h> 6 7 #include <linux/regmap.h> 7 8 #include <linux/spi/spi.h> 8 9 ··· 80 79 static struct spi_driver bmi270_spi_driver = { 81 80 .driver = { 82 81 .name = "bmi270", 82 + .pm = pm_ptr(&bmi270_core_pm_ops), 83 83 .of_match_table = bmi270_of_match, 84 84 }, 85 85 .probe = bmi270_spi_probe,