33 lines
1.1 KiB
Diff
33 lines
1.1 KiB
Diff
From be23556b401c08317727a8992c84a2be30133c7c Mon Sep 17 00:00:00 2001
|
|
From: Vasily Khoruzhick <anarsoul@gmail.com>
|
|
Date: Tue, 24 Apr 2018 22:21:10 -0700
|
|
Subject: [PATCH 024/158] drv:iio:sun4i-gpadc-iio: don`t force poweroff
|
|
|
|
ignore zero samples to avoid force poweroff when reading first sample
|
|
|
|
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
|
---
|
|
drivers/iio/adc/sun4i-gpadc-iio.c | 6 ++++++
|
|
1 file changed, 6 insertions(+)
|
|
|
|
diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c
|
|
index 2889a7078..ead5d9f4d 100644
|
|
--- a/drivers/iio/adc/sun4i-gpadc-iio.c
|
|
+++ b/drivers/iio/adc/sun4i-gpadc-iio.c
|
|
@@ -716,6 +716,12 @@ static int sun4i_gpadc_get_temp(struct thermal_zone_device *tz, int *temp)
|
|
if (sun4i_gpadc_temp_read(info->indio_dev, &val, info->sensor_id))
|
|
return -ETIMEDOUT;
|
|
|
|
+ /* Ignore first sample which is always zero. 0 is either too
|
|
+ * cold or too hot, so we can safely ignore it
|
|
+ */
|
|
+ if (val == 0)
|
|
+ return -ETIMEDOUT;
|
|
+
|
|
sun4i_gpadc_temp_scale(info->indio_dev, &scale);
|
|
sun4i_gpadc_temp_offset(info->indio_dev, &offset);
|
|
|
|
--
|
|
2.35.3
|
|
|