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: bmi160: 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>
Link: https://patch.msgid.link/20250525142530.71955-3-benato.denis96@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Denis Benato and committed by
Jonathan Cameron
60295fee cfcb4487

+25
+2
drivers/iio/imu/bmi160/bmi160.h
··· 28 28 29 29 int bmi160_probe_trigger(struct iio_dev *indio_dev, int irq, u32 irq_type); 30 30 31 + extern const struct dev_pm_ops bmi160_core_pm_ops; 32 + 31 33 #endif /* BMI160_H_ */
+19
drivers/iio/imu/bmi160/bmi160_core.c
··· 890 890 } 891 891 EXPORT_SYMBOL_NS_GPL(bmi160_core_probe, "IIO_BMI160"); 892 892 893 + static int bmi160_core_runtime_suspend(struct device *dev) 894 + { 895 + struct iio_dev *indio_dev = dev_get_drvdata(dev); 896 + 897 + return iio_device_suspend_triggering(indio_dev); 898 + } 899 + 900 + static int bmi160_core_runtime_resume(struct device *dev) 901 + { 902 + struct iio_dev *indio_dev = dev_get_drvdata(dev); 903 + 904 + return iio_device_resume_triggering(indio_dev); 905 + } 906 + 907 + const struct dev_pm_ops bmi160_core_pm_ops = { 908 + RUNTIME_PM_OPS(bmi160_core_runtime_suspend, bmi160_core_runtime_resume, NULL) 909 + }; 910 + EXPORT_SYMBOL_NS_GPL(bmi160_core_pm_ops, "IIO_BMI160"); 911 + 893 912 MODULE_AUTHOR("Daniel Baluta <daniel.baluta@intel.com>"); 894 913 MODULE_DESCRIPTION("Bosch BMI160 driver"); 895 914 MODULE_LICENSE("GPL v2");
+2
drivers/iio/imu/bmi160/bmi160_i2c.c
··· 11 11 #include <linux/i2c.h> 12 12 #include <linux/mod_devicetable.h> 13 13 #include <linux/module.h> 14 + #include <linux/pm.h> 14 15 #include <linux/regmap.h> 15 16 16 17 #include "bmi160.h" ··· 70 69 static struct i2c_driver bmi160_i2c_driver = { 71 70 .driver = { 72 71 .name = "bmi160_i2c", 72 + .pm = pm_ptr(&bmi160_core_pm_ops), 73 73 .acpi_match_table = bmi160_acpi_match, 74 74 .of_match_table = bmi160_of_match, 75 75 },
+2
drivers/iio/imu/bmi160/bmi160_spi.c
··· 7 7 */ 8 8 #include <linux/mod_devicetable.h> 9 9 #include <linux/module.h> 10 + #include <linux/pm.h> 10 11 #include <linux/regmap.h> 11 12 #include <linux/spi/spi.h> 12 13 ··· 62 61 .acpi_match_table = bmi160_acpi_match, 63 62 .of_match_table = bmi160_of_match, 64 63 .name = "bmi160_spi", 64 + .pm = pm_ptr(&bmi160_core_pm_ops), 65 65 }, 66 66 }; 67 67 module_spi_driver(bmi160_spi_driver);