lkml.org 
[lkml]   [2022]   [Mar]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] iio: palmas: shut up warning about calibration mismatch (due to noise)
On Tue,  8 Mar 2022 13:53:03 +0100
"H. Nikolaus Schaller" <hns@goldelico.com> wrote:

> Although technically checking for ADC values below 0 is correct,
> because they are outside of the calibration values, there is usually
> noise which spuriously fills the console log with error messages if
> calculated input voltage gets close to 0V.
>
> Ignore small negative calculated values, but clamp them to 0.
>
> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Hi.

Should we treat this as a fix or a cleanup?

I don't mind either way.

Jonathan


> ---
> drivers/iio/adc/palmas_gpadc.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/palmas_gpadc.c b/drivers/iio/adc/palmas_gpadc.c
> index f9c8385c72d3..bcfa6a7f6cb2 100644
> --- a/drivers/iio/adc/palmas_gpadc.c
> +++ b/drivers/iio/adc/palmas_gpadc.c
> @@ -376,7 +376,8 @@ static int palmas_gpadc_get_calibrated_code(struct palmas_gpadc *adc,
> adc->adc_info[adc_chan].gain_error;
>
> if (val < 0) {
> - dev_err(adc->dev, "Mismatch with calibration\n");
> + if (val < -10)
> + dev_err(adc->dev, "Mismatch with calibration var = %d\n", val);
> return 0;
> }
>

\
 
 \ /
  Last update: 2022-03-20 16:46    [W:0.036 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site