Created
April 25, 2018 03:29
-
-
Save anarsoul/64c527c3810bf9b592546a8eabf28c95 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c | |
index f24b09022528..b169e778704c 100644 | |
--- a/drivers/iio/adc/sun4i-gpadc-iio.c | |
+++ b/drivers/iio/adc/sun4i-gpadc-iio.c | |
@@ -758,6 +758,12 @@ static int sun4i_gpadc_get_temp(void *data, 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); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment