From 9a9a369d6178dd4e263c49085ce1b37e1e8f63a0 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Thu, 1 Sep 2016 11:44:48 +0200 Subject: 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 Signed-off-by: Jonathan Cameron --- drivers/iio/accel/kxsd9.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/iio/accel/kxsd9.h') diff --git a/drivers/iio/accel/kxsd9.h b/drivers/iio/accel/kxsd9.h index 9c0861f..7e8a281 100644 --- a/drivers/iio/accel/kxsd9.h +++ b/drivers/iio/accel/kxsd9.h @@ -8,3 +8,5 @@ int kxsd9_common_probe(struct device *dev, struct regmap *map, const char *name); int kxsd9_common_remove(struct device *dev); + +extern const struct dev_pm_ops kxsd9_dev_pm_ops; -- cgit v1.1