From: H. Nikolaus Schaller Date: Tue, 8 Mar 2022 12:53:03 +0000 (+0100) Subject: iio: palmas: shut up warning about calibration mismatch (due to noise) X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=a8e1f0ba138e0c7c51cdf268b2edef758581a31e;p=linux.git iio: palmas: shut up warning about calibration mismatch (due to noise) 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 Link: https://lore.kernel.org/r/1cee45bfc3fa2ab59dcc17242fb52468035360a1.1646743982.git.hns@goldelico.com Signed-off-by: Jonathan Cameron --- diff --git a/drivers/iio/adc/palmas_gpadc.c b/drivers/iio/adc/palmas_gpadc.c index 61e80bf3d05e4..fd000345ec5cf 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; }