From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8324EC433FE for ; Sun, 20 Mar 2022 15:45:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245402AbiCTPrD (ORCPT ); Sun, 20 Mar 2022 11:47:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233295AbiCTPrB (ORCPT ); Sun, 20 Mar 2022 11:47:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E7093EA80; Sun, 20 Mar 2022 08:45:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 383B461173; Sun, 20 Mar 2022 15:45:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 447F0C340E9; Sun, 20 Mar 2022 15:45:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1647791137; bh=MnUF6wCu+lWH4VvXQgRyL0zXXsXRlGEixv7B9idCdm0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=YzLjCxph/GMrA5ekbgxwc8rsNBuZRV/sZmdrQEqkUoskYOE6GeFek46EKOMDLzi6m 2jfxaI/enLvin7gVW6JWUin2iwZsLCT4aYXTP+f7HwLHJNC0JkTOJfuv9KNgiy9uXO lfoAT0WBG6qoF76MZje/P8fI6S+IKcfqxCXdCyNdnfe0pORHN2aOWK/t/HZFWFo6/A J1krQ8yAFD2MFGZROh38QCYscasstEEzS+BEo3KSTFrDJyxvaWC/CGkmcZSjXla9Rb dB8a5IiS9uuoLn2VjHSIXJ4EaoFNxVMiGFi9JEFw/UH8sPVOigmeJ5qlmhBu4rsC0R LK3LXp4icorzQ== Date: Sun, 20 Mar 2022 15:52:59 +0000 From: Jonathan Cameron To: "H. Nikolaus Schaller" Cc: Colin Ian King , Sergiu Cuciurean , Julia Lawall , Lars-Peter Clausen , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, letux-kernel@openphoenux.org, kernel@pyra-handheld.com, linux-omap@vger.kernel.org Subject: Re: [PATCH] iio: palmas: shut up warning about calibration mismatch (due to noise) Message-ID: <20220320155259.0fc79dd3@jic23-huawei> In-Reply-To: <1cee45bfc3fa2ab59dcc17242fb52468035360a1.1646743982.git.hns@goldelico.com> References: <1cee45bfc3fa2ab59dcc17242fb52468035360a1.1646743982.git.hns@goldelico.com> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 8 Mar 2022 13:53:03 +0100 "H. Nikolaus Schaller" 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 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; > } >