Skip to content

Commit

Permalink
iio: palmas: shut up warning about calibration mismatch (due to noise)
Browse files Browse the repository at this point in the history
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 <[email protected]>
Link: https://lore.kernel.org/r/1cee45bfc3fa2ab59dcc17242fb52468035360a1.1646743982.git.hns@goldelico.com
Signed-off-by: Jonathan Cameron <[email protected]>
  • Loading branch information
goldelico authored and jic23 committed Apr 4, 2022
1 parent 44b0be6 commit a8e1f0b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/iio/adc/palmas_gpadc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit a8e1f0b

Please sign in to comment.