]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
iio: adc: ti-ads1015: avoid getting stale result after runtime resume
authorAkinobu Mita <akinobu.mita@gmail.com>
Thu, 20 Jul 2017 15:24:20 +0000 (00:24 +0900)
committerSeth Forshee <seth.forshee@canonical.com>
Sun, 10 Sep 2017 23:08:44 +0000 (18:08 -0500)
commit5e2b50323ec8677d3bf8689eb6e2576ec6721d58
tree32b04ab6a9242237bdef7a6cd6fac7d28b292c6b
parent1df989b78d12547086b031021bd275534c0f9177
iio: adc: ti-ads1015: avoid getting stale result after runtime resume

BugLink: http://bugs.launchpad.net/bugs/1716284
commit 73e3e3fc50de50cfd68e945d85679c983ed31bd9 upstream.

This driver assumes that the device is operating in the continuous
conversion mode which performs the conversion continuously.  So this driver
doesn't insert a wait time before reading the conversion register if the
configuration is not changed from a previous request.

This assumption is broken if the device is runtime suspended and entered
a power-down state.  The forthcoming request causes reading a stale result
from the conversion register as the device is runtime resumed just before.

Fix it by adding a flag to detect that condition and insert a necessary
wait time.

Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/iio/adc/ti-ads1015.c