iio: light: rpr0521 on-off sequence change for CONFIG_PM
authorMikko Koivunen <mikko.koivunen@fi.rohmeurope.com>
Thu, 18 May 2017 12:12:51 +0000 (15:12 +0300)
committerJonathan Cameron <jic23@kernel.org>
Sun, 21 May 2017 14:06:12 +0000 (15:06 +0100)
commit484c314b90ae240fb8e6e2924722deb92c756d93
tree2ac3a1d6fb2ab702875aa159495d3345bf4e8178
parent12d74949133e2450533894ea01ce0c56646ce006
iio: light: rpr0521 on-off sequence change for CONFIG_PM

Refactor _set_power_state(), _resume() and _suspend().
Enable measurement only when needed, not in _init(). System can suspend
during measurement and measurement is continued on resume.
Pm turns off measurement when both ps and als measurements are disabled for
2 seconds. During off-time the power save is 20-500mA, typically 180mA.

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>
drivers/iio/light/rpr0521.c