Commit 12d74949 authored by Mikko Koivunen's avatar Mikko Koivunen Committed by Jonathan Cameron

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: default avatarMikko Koivunen <mikko.koivunen@fi.rohmeurope.com>
Acked-by: default avatarDaniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent f87fa261
......@@ -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)
......
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