mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 23:52:08 +02:00
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>
This commit is contained in:
parent
cfcb44872a
commit
60295feef9
|
|
@ -28,4 +28,6 @@ int bmi160_enable_irq(struct regmap *regmap, bool enable);
|
|||
|
||||
int bmi160_probe_trigger(struct iio_dev *indio_dev, int irq, u32 irq_type);
|
||||
|
||||
extern const struct dev_pm_ops bmi160_core_pm_ops;
|
||||
|
||||
#endif /* BMI160_H_ */
|
||||
|
|
|
|||
|
|
@ -890,6 +890,25 @@ int bmi160_core_probe(struct device *dev, struct regmap *regmap,
|
|||
}
|
||||
EXPORT_SYMBOL_NS_GPL(bmi160_core_probe, "IIO_BMI160");
|
||||
|
||||
static int bmi160_core_runtime_suspend(struct device *dev)
|
||||
{
|
||||
struct iio_dev *indio_dev = dev_get_drvdata(dev);
|
||||
|
||||
return iio_device_suspend_triggering(indio_dev);
|
||||
}
|
||||
|
||||
static int bmi160_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 bmi160_core_pm_ops = {
|
||||
RUNTIME_PM_OPS(bmi160_core_runtime_suspend, bmi160_core_runtime_resume, NULL)
|
||||
};
|
||||
EXPORT_SYMBOL_NS_GPL(bmi160_core_pm_ops, "IIO_BMI160");
|
||||
|
||||
MODULE_AUTHOR("Daniel Baluta <daniel.baluta@intel.com>");
|
||||
MODULE_DESCRIPTION("Bosch BMI160 driver");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include <linux/i2c.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/regmap.h>
|
||||
|
||||
#include "bmi160.h"
|
||||
|
|
@ -69,6 +70,7 @@ MODULE_DEVICE_TABLE(of, bmi160_of_match);
|
|||
static struct i2c_driver bmi160_i2c_driver = {
|
||||
.driver = {
|
||||
.name = "bmi160_i2c",
|
||||
.pm = pm_ptr(&bmi160_core_pm_ops),
|
||||
.acpi_match_table = bmi160_acpi_match,
|
||||
.of_match_table = bmi160_of_match,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
*/
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/spi/spi.h>
|
||||
|
||||
|
|
@ -61,6 +62,7 @@ static struct spi_driver bmi160_spi_driver = {
|
|||
.acpi_match_table = bmi160_acpi_match,
|
||||
.of_match_table = bmi160_of_match,
|
||||
.name = "bmi160_spi",
|
||||
.pm = pm_ptr(&bmi160_core_pm_ops),
|
||||
},
|
||||
};
|
||||
module_spi_driver(bmi160_spi_driver);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user