aboutsummaryrefslogtreecommitdiff
path: root/drivers/iio/pressure
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/iio/pressure')
-rw-r--r--drivers/iio/pressure/st_pressure_buffer.c9
-rw-r--r--drivers/iio/pressure/st_pressure_core.c11
-rw-r--r--drivers/iio/pressure/st_pressure_i2c.c1
-rw-r--r--drivers/iio/pressure/st_pressure_spi.c1
4 files changed, 15 insertions, 7 deletions
diff --git a/drivers/iio/pressure/st_pressure_buffer.c b/drivers/iio/pressure/st_pressure_buffer.c
index 4013b0da7c90..ece0e9a4b734 100644
--- a/drivers/iio/pressure/st_pressure_buffer.c
+++ b/drivers/iio/pressure/st_pressure_buffer.c
@@ -19,8 +19,8 @@
#include <linux/iio/buffer.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
-
#include <linux/iio/common/st_sensors.h>
+#include <linux/pm_runtime.h>
#include "st_pressure.h"
int st_press_trig_set_state(struct iio_trigger *trig, bool state)
@@ -32,7 +32,9 @@ int st_press_trig_set_state(struct iio_trigger *trig, bool state)
static int st_press_buffer_preenable(struct iio_dev *indio_dev)
{
- return st_sensors_power_enable(indio_dev);
+ pm_runtime_get_sync(indio_dev->dev.parent);
+
+ return 0;
}
static int st_press_buffer_postenable(struct iio_dev *indio_dev)
@@ -67,7 +69,8 @@ static int st_press_buffer_predisable(struct iio_dev *indio_dev)
if (err < 0)
goto st_press_buffer_predisable_error;
- err = st_sensors_power_disable(indio_dev);
+ pm_runtime_mark_last_busy(indio_dev->dev.parent);
+ pm_runtime_put_autosuspend(indio_dev->dev.parent);
st_press_buffer_predisable_error:
kfree(press_data->buffer_data);
diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
index 84de05d03764..246476253386 100644
--- a/drivers/iio/pressure/st_pressure_core.c
+++ b/drivers/iio/pressure/st_pressure_core.c
@@ -23,6 +23,7 @@
#include <linux/iio/sysfs.h>
#include <linux/iio/trigger.h>
#include <linux/iio/buffer.h>
+#include <linux/pm_runtime.h>
#include <asm/unaligned.h>
#include <linux/iio/common/st_sensors.h>
@@ -572,7 +573,7 @@ int st_press_common_probe(struct iio_dev *indio_dev)
indio_dev->info = &press_info;
mutex_init(&press_data->tb.buf_lock);
- err = st_sensors_power_init(indio_dev);
+ err = st_sensors_pm_init(indio_dev);
if (err)
return err;
@@ -627,7 +628,9 @@ int st_press_common_probe(struct iio_dev *indio_dev)
dev_info(&indio_dev->dev, "registered pressure sensor %s\n",
indio_dev->name);
- return st_sensors_power_disable(indio_dev);
+ pm_runtime_put(indio_dev->dev.parent);
+
+ return 0;
st_press_device_register_error:
if (irq > 0)
@@ -635,7 +638,7 @@ st_press_device_register_error:
st_press_probe_trigger_error:
st_press_deallocate_ring(indio_dev);
st_press_power_off:
- st_sensors_power_disable(indio_dev);
+ st_sensors_pm_disable(indio_dev);
return err;
}
@@ -645,7 +648,7 @@ void st_press_common_remove(struct iio_dev *indio_dev)
{
struct st_sensor_data *press_data = iio_priv(indio_dev);
- st_sensors_power_disable(indio_dev);
+ st_sensors_pm_disable(indio_dev);
iio_device_unregister(indio_dev);
if (press_data->get_irq_data_ready(indio_dev) > 0)
diff --git a/drivers/iio/pressure/st_pressure_i2c.c b/drivers/iio/pressure/st_pressure_i2c.c
index 4d78e39c8a2f..47da8509d5b1 100644
--- a/drivers/iio/pressure/st_pressure_i2c.c
+++ b/drivers/iio/pressure/st_pressure_i2c.c
@@ -79,6 +79,7 @@ static struct i2c_driver st_press_driver = {
.driver = {
.name = "st-press-i2c",
.of_match_table = of_match_ptr(st_press_of_match),
+ .pm = &st_sensors_dev_pm_ops,
},
.probe = st_press_i2c_probe,
.remove = st_press_i2c_remove,
diff --git a/drivers/iio/pressure/st_pressure_spi.c b/drivers/iio/pressure/st_pressure_spi.c
index d97dcddae064..1552cefd28fb 100644
--- a/drivers/iio/pressure/st_pressure_spi.c
+++ b/drivers/iio/pressure/st_pressure_spi.c
@@ -53,6 +53,7 @@ MODULE_DEVICE_TABLE(spi, st_press_id_table);
static struct spi_driver st_press_driver = {
.driver = {
.name = "st-press-spi",
+ .pm = &st_sensors_dev_pm_ops,
},
.probe = st_press_spi_probe,
.remove = st_press_spi_remove,