summaryrefslogtreecommitdiffstats
path: root/drivers/iio/light
diff options
context:
space:
mode:
authorMikko Koivunen <mikko.koivunen@fi.rohmeurope.com>2017-05-18 15:12:50 +0300
committerJonathan Cameron <jic23@kernel.org>2017-05-21 15:06:11 +0100
commit12d74949133e2450533894ea01ce0c56646ce006 (patch)
treec34af63d36958d341fb26b3870dc5cd59c310f14 /drivers/iio/light
parentf87fa26177ac4dd5ebcc1e598a90142ecb4973cb (diff)
downloadop-kernel-dev-12d74949133e2450533894ea01ce0c56646ce006.zip
op-kernel-dev-12d74949133e2450533894ea01ce0c56646ce006.tar.gz
iio: light: rpr0521 poweroff for probe fails
Set sensor measurement off after probe fail in pm_runtime_set_active() or iio_device_register(). Without this change sensor measurement stays on even though probe fails on these calls. This is maybe rare case, but causes constant power drain without any benefits when it happens. Power drain is 20-500uA, typically 180uA. Signed-off-by: Mikko Koivunen <mikko.koivunen@fi.rohmeurope.com> Acked-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/light')
-rw-r--r--drivers/iio/light/rpr0521.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/iio/light/rpr0521.c b/drivers/iio/light/rpr0521.c
index 03504f6..84d8d40 100644
--- a/drivers/iio/light/rpr0521.c
+++ b/drivers/iio/light/rpr0521.c
@@ -516,13 +516,26 @@ static int rpr0521_probe(struct i2c_client *client,
ret = pm_runtime_set_active(&client->dev);
if (ret < 0)
- return ret;
+ goto err_poweroff;
pm_runtime_enable(&client->dev);
pm_runtime_set_autosuspend_delay(&client->dev, RPR0521_SLEEP_DELAY_MS);
pm_runtime_use_autosuspend(&client->dev);
- return iio_device_register(indio_dev);
+ ret = iio_device_register(indio_dev);
+ if (ret)
+ goto err_pm_disable;
+
+ return 0;
+
+err_pm_disable:
+ pm_runtime_disable(&client->dev);
+ pm_runtime_set_suspended(&client->dev);
+ pm_runtime_put_noidle(&client->dev);
+err_poweroff:
+ rpr0521_poweroff(data);
+
+ return ret;
}
static int rpr0521_remove(struct i2c_client *client)
OpenPOWER on IntegriCloud