]> git.baikalelectronics.ru Git - kernel.git/commit
iio: adc: hx711: fix bug in sampling of data
authorAndreas Klinger <ak@it-klinger.de>
Mon, 9 Sep 2019 12:37:21 +0000 (14:37 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Wed, 9 Oct 2019 18:11:25 +0000 (19:11 +0100)
commit1a1b63a70687f3c0a147db46a15ecfac67c96e09
treea98a336e51142e4dbb844fa9a5c6826af7e73028
parent3bdf68e6b85e3fb55a9ca2ddd0fbee8ff10387b8
iio: adc: hx711: fix bug in sampling of data

Fix bug in sampling function hx711_cycle() when interrupt occures while
PD_SCK is high. If PD_SCK is high for at least 60 us power down mode of
the sensor is entered which in turn leads to a wrong measurement.

Switch off interrupts during a PD_SCK high period and move query of DOUT
to the latest point of time which is at the end of PD_SCK low period.

This bug exists in the driver since it's initial addition. The more
interrupts on the system the higher is the probability that it happens.

Fixes: 9098867f142a ("iio: adc: hx711: Add IIO driver for AVIA HX711")
Signed-off-by: Andreas Klinger <ak@it-klinger.de>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/hx711.c