diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2016-09-01 11:44:48 +0200 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2016-09-18 12:35:59 +0200 |
commit | 9a9a369d6178dd4e263c49085ce1b37e1e8f63a0 (patch) | |
tree | 11561a13081f635b5e84a49cacbb49b52b694efd /drivers/iio/accel/kxsd9-i2c.c | |
parent | iio: accel: kxsd9: Replace "parent" with "dev" (diff) | |
download | linux-9a9a369d6178dd4e263c49085ce1b37e1e8f63a0.tar.xz linux-9a9a369d6178dd4e263c49085ce1b37e1e8f63a0.zip |
iio: accel: kxsd9: Deploy system and runtime PM
This deploys runtime and system PM in the KXSD9 driver:
- Use the force_runtime_suspend/resume callbacks as system PM
operations.
- Add buffer prepare/unprepare callbacks to grab the runtime
PM while we're using buffered reads and put get/put_autosuspend
in these.
- Insert get/put_autosuspend calls anywhere the IO is used from
the raw read/write callbacks.
- Move the fullscale setting to be cached in the state container
so we can restore it properly when coming back from
system/runtime suspend.
- Set the autosuspend delay to two orders of magnitude that of
the sensor start-up time (20ms) so we will autosuspend after
2s.
- Register the callbacks in both the SPI and I2C subdrivers.
Tested with the I2C KXSD9 on the Qualcomm APQ8060 Dragonboard.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/accel/kxsd9-i2c.c')
-rw-r--r-- | drivers/iio/accel/kxsd9-i2c.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/iio/accel/kxsd9-i2c.c b/drivers/iio/accel/kxsd9-i2c.c index 4aaa27d0aa32..95e20855d2ef 100644 --- a/drivers/iio/accel/kxsd9-i2c.c +++ b/drivers/iio/accel/kxsd9-i2c.c @@ -55,6 +55,7 @@ static struct i2c_driver kxsd9_i2c_driver = { .driver = { .name = "kxsd9", .of_match_table = of_match_ptr(kxsd9_of_match), + .pm = &kxsd9_dev_pm_ops, }, .probe = kxsd9_i2c_probe, .remove = kxsd9_i2c_remove, |