Linux on ARM based TI OMAP SoCs
 help / color / mirror / Atom feed
* [PATCH] iio: palmas: shut up warning about calibration mismatch (due to noise)
@ 2022-03-08 12:53 H. Nikolaus Schaller
  2022-03-20 15:52 ` Jonathan Cameron
  0 siblings, 1 reply; 4+ messages in thread
From: H. Nikolaus Schaller @ 2022-03-08 12:53 UTC (permalink / raw)
  To: Jonathan Cameron, Colin Ian King, Sergiu Cuciurean, Julia Lawall,
	H. Nikolaus Schaller
  Cc: Lars-Peter Clausen, linux-iio, linux-kernel, letux-kernel, kernel,
	linux-omap

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>
---
 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;
 	}
 
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-03-27 16:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-08 12:53 [PATCH] iio: palmas: shut up warning about calibration mismatch (due to noise) H. Nikolaus Schaller
2022-03-20 15:52 ` Jonathan Cameron
2022-03-20 16:28   ` H. Nikolaus Schaller
2022-03-27 16:13     ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox