]> www.infradead.org Git - users/dwmw2/linux.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 9 Sep 2017 15:39:20 +0000 (17:39 +0200)
commit1c68b99af8eb0c48d8b3f53a76e2fc112ef40a42
tree3966c3260be97ebf353962e3fea70edf33fd2614
parent86b6c05fe2b7bbe4572372a539ea8e7940f370ad
iio: adc: ti-ads1015: avoid getting stale result after runtime resume

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>
drivers/iio/adc/ti-ads1015.c