aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/adc/hx711.c
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2019-11-29 20:34:28 +0100
committerJiri Kosina <jkosina@suse.cz>2019-11-29 20:34:28 +0100
commitb746a1a2860f4a918f32d10dc569115d282aaf2f (patch)
tree4b30e6ff28e2783c73a1b763e819f5b41414563c /drivers/iio/adc/hx711.c
parentHID: rmi: Check that the RMI_STARTED bit is set before unregistering the RMI transport device (diff)
parentHID: quirks: remove hid-led devices from hid_have_special_driver (diff)
downloadlinux-dev-b746a1a2860f4a918f32d10dc569115d282aaf2f.tar.xz
linux-dev-b746a1a2860f4a918f32d10dc569115d282aaf2f.zip
Merge branch 'for-5.5/core' into for-linus
- hid_have_special_driver[] cleanup for LED devices (Heiner Kallweit) - HID parser improvements (Blaž Hrastnik, Candle Sun)
Diffstat (limited to 'drivers/iio/adc/hx711.c')
-rw-r--r--drivers/iio/adc/hx711.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/iio/adc/hx711.c b/drivers/iio/adc/hx711.c
index 88c7fe15003b..62e6c8badd22 100644
--- a/drivers/iio/adc/hx711.c
+++ b/drivers/iio/adc/hx711.c
@@ -100,14 +100,14 @@ struct hx711_data {
static int hx711_cycle(struct hx711_data *hx711_data)
{
- int val;
+ unsigned long flags;
/*
* if preempted for more then 60us while PD_SCK is high:
* hx711 is going in reset
* ==> measuring is false
*/
- preempt_disable();
+ local_irq_save(flags);
gpiod_set_value(hx711_data->gpiod_pd_sck, 1);
/*
@@ -117,7 +117,6 @@ static int hx711_cycle(struct hx711_data *hx711_data)
*/
ndelay(hx711_data->data_ready_delay_ns);
- val = gpiod_get_value(hx711_data->gpiod_dout);
/*
* here we are not waiting for 0.2 us as suggested by the datasheet,
* because the oscilloscope showed in a test scenario
@@ -125,7 +124,7 @@ static int hx711_cycle(struct hx711_data *hx711_data)
* and 0.56 us for PD_SCK low on TI Sitara with 800 MHz
*/
gpiod_set_value(hx711_data->gpiod_pd_sck, 0);
- preempt_enable();
+ local_irq_restore(flags);
/*
* make it a square wave for addressing cases with capacitance on
@@ -133,7 +132,8 @@ static int hx711_cycle(struct hx711_data *hx711_data)
*/
ndelay(hx711_data->data_ready_delay_ns);
- return val;
+ /* sample as late as possible */
+ return gpiod_get_value(hx711_data->gpiod_dout);
}
static int hx711_read(struct hx711_data *hx711_data)