From patchwork Tue Mar 8 12:53:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H. Nikolaus Schaller" X-Patchwork-Id: 12773738 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 67A18C433EF for ; Tue, 8 Mar 2022 12:53:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243407AbiCHMyK (ORCPT ); Tue, 8 Mar 2022 07:54:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230080AbiCHMyJ (ORCPT ); Tue, 8 Mar 2022 07:54:09 -0500 Received: from mo4-p01-ob.smtp.rzone.de (mo4-p01-ob.smtp.rzone.de [85.215.255.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EEF930F55; Tue, 8 Mar 2022 04:53:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1646743985; s=strato-dkim-0002; d=goldelico.com; h=Message-Id:Date:Subject:Cc:To:From:Cc:Date:From:Subject:Sender; bh=ZOvjYMQJYuSAVm7O4zUbUg4wy9kHYFszMrdfygxpWys=; b=O8RdOKrMTmwe9zOW6kqefvinD0r7fr3s6gvUeGqRv2GX4fhgZ9U5SeOF0FIGOI79j1 ly/I034R7Yt7Wv91wG0PKBtH20V5vxOACjIq6Mb9hgjDue/1U4B08EjnPyB36rHN8ktZ FL9R+oCO5UkVp4Nfpjew8pWk/h3U+U3XdXyBf5XKjggaZsxacxhaQ8eZs0AUzhoUZcmK bgYxLt9RO8k2HOU8FZrSKOncZ7wfIwBaU8svYtdhBueHCT87yw+cTbEQXdw4jLM8gX0V 7fI5rG57+41O5ubL/kAV7E8+rPVpXEzGbpU5JC+LdavnRvN1XV3mgBMXRYbZlQim3Pdv KiZg== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":JGIXVUS7cutRB/49FwqZ7WcJeFKiMhflhwDubTJ9o1OAA2UMf2MwPVbpc9Y=" X-RZG-CLASS-ID: mo00 Received: from iMac.fritz.box by smtp.strato.de (RZmta 47.40.1 DYNA|AUTH) with ESMTPSA id n729cey28Cr4SGq (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Tue, 8 Mar 2022 13:53:04 +0100 (CET) From: "H. Nikolaus Schaller" To: Jonathan Cameron , Colin Ian King , Sergiu Cuciurean , Julia Lawall , "H. Nikolaus Schaller" Cc: 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: [PATCH] iio: palmas: shut up warning about calibration mismatch (due to noise) Date: Tue, 8 Mar 2022 13:53:03 +0100 Message-Id: <1cee45bfc3fa2ab59dcc17242fb52468035360a1.1646743982.git.hns@goldelico.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org 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 --- 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; }