]> git.proxmox.com Git - mirror_ubuntu-eoan-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)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 23 Oct 2019 13:04:26 +0000 (15:04 +0200)
commit3739c279d52f1befcb91fb91b4ef4d26b2518a87
treef3f1dd3f22df3ad7879ccc854ca4b5971de81566
parenteb17ebdaacc026b94704137a9e782b684f5ec16f
iio: adc: hx711: fix bug in sampling of data

BugLink: https://bugs.launchpad.net/bugs/1848750
commit 4043ecfb5fc4355a090111e14faf7945ff0fdbd5 upstream.

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: c3b2fdd0ea7e ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Connor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/iio/adc/hx711.c