Commit b09999ee authored by Denis Benato's avatar Denis Benato Committed by Jonathan Cameron

iio: bmi323: 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.
Signed-off-by: default avatarDenis Benato <benato.denis96@gmail.com>
Link: https://patch.msgid.link/20240807185619.7261-3-benato.denis96@gmail.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 2837efdc
...@@ -205,5 +205,6 @@ ...@@ -205,5 +205,6 @@
struct device; struct device;
int bmi323_core_probe(struct device *dev); int bmi323_core_probe(struct device *dev);
extern const struct regmap_config bmi323_regmap_config; extern const struct regmap_config bmi323_regmap_config;
extern const struct dev_pm_ops bmi323_core_pm_ops;
#endif #endif
...@@ -2121,6 +2121,29 @@ int bmi323_core_probe(struct device *dev) ...@@ -2121,6 +2121,29 @@ int bmi323_core_probe(struct device *dev)
} }
EXPORT_SYMBOL_NS_GPL(bmi323_core_probe, IIO_BMI323); EXPORT_SYMBOL_NS_GPL(bmi323_core_probe, IIO_BMI323);
#if defined(CONFIG_PM)
static int bmi323_core_runtime_suspend(struct device *dev)
{
struct iio_dev *indio_dev = dev_get_drvdata(dev);
return iio_device_suspend_triggering(indio_dev);
}
static int bmi323_core_runtime_resume(struct device *dev)
{
struct iio_dev *indio_dev = dev_get_drvdata(dev);
return iio_device_resume_triggering(indio_dev);
}
#endif
const struct dev_pm_ops bmi323_core_pm_ops = {
SET_RUNTIME_PM_OPS(bmi323_core_runtime_suspend,
bmi323_core_runtime_resume, NULL)
};
EXPORT_SYMBOL_NS_GPL(bmi323_core_pm_ops, IIO_BMI323);
MODULE_DESCRIPTION("Bosch BMI323 IMU driver"); MODULE_DESCRIPTION("Bosch BMI323 IMU driver");
MODULE_AUTHOR("Jagath Jog J <jagathjog1996@gmail.com>"); MODULE_AUTHOR("Jagath Jog J <jagathjog1996@gmail.com>");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -128,6 +128,7 @@ MODULE_DEVICE_TABLE(of, bmi323_of_i2c_match); ...@@ -128,6 +128,7 @@ MODULE_DEVICE_TABLE(of, bmi323_of_i2c_match);
static struct i2c_driver bmi323_i2c_driver = { static struct i2c_driver bmi323_i2c_driver = {
.driver = { .driver = {
.name = "bmi323", .name = "bmi323",
.pm = pm_ptr(&bmi323_core_pm_ops),
.of_match_table = bmi323_of_i2c_match, .of_match_table = bmi323_of_i2c_match,
.acpi_match_table = bmi323_acpi_match, .acpi_match_table = bmi323_acpi_match,
}, },
......
...@@ -79,6 +79,7 @@ MODULE_DEVICE_TABLE(of, bmi323_of_spi_match); ...@@ -79,6 +79,7 @@ MODULE_DEVICE_TABLE(of, bmi323_of_spi_match);
static struct spi_driver bmi323_spi_driver = { static struct spi_driver bmi323_spi_driver = {
.driver = { .driver = {
.name = "bmi323", .name = "bmi323",
.pm = pm_ptr(&bmi323_core_pm_ops),
.of_match_table = bmi323_of_spi_match, .of_match_table = bmi323_of_spi_match,
}, },
.probe = bmi323_spi_probe, .probe = bmi323_spi_probe,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment