Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3487257pxp; Tue, 8 Mar 2022 15:43:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJydotZVIw6Kk+zGTVbZJ/DqGhQ4fqOg3PhUrcv3lpRF7wEVB1WoyywPliJXlbN1jG8pF2hs X-Received: by 2002:a05:6a00:21c5:b0:4f7:2e26:d142 with SMTP id t5-20020a056a0021c500b004f72e26d142mr5642204pfj.83.1646782982006; Tue, 08 Mar 2022 15:43:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646782982; cv=none; d=google.com; s=arc-20160816; b=HXVWqLAfw7W17THSJbLLrVvfN21Cexw5wTb4rIVf8vN7yXA+ahb+8eWB8jKbcWt9PG hZNmqT44Rj7eVUqddq7oUNBFI2ImmhJ5Ln43CSkX7uSUCO9jk2mg2GUex1qV1taqkIYv wXGrdmhOduKDzLnb4B3RfKBPLLMZzgyhSyaB+lUUzATyIPXyCUocsO4ciBl8JWdi0HHs bONvEW6awmVUnsCI2SFx6YVeUzBJu6nbU6sveoX1tFqQYT59vy5kxqRCQ54MwR+j9QXP AjiVCPqERQG5f4vg3RFGkjTN3LfLirXOyl73AyF6f/hstKssgwWowOJU0G8j/hhEoiaf egvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ZOvjYMQJYuSAVm7O4zUbUg4wy9kHYFszMrdfygxpWys=; b=l1Ozh20mYDNVQIONqNGt4xttoL5rtEKVObtwhdhPYIDGWJ2k5dTmKznwR4uOtAi481 9URRfGOyLgOCp2QJWoaUY+m/i+kd3Owb1MTT8eZ67dOWUeaZzStRelf4wEMRMSkwb9bW 3BhH2Q1hbG+Iq3b9q/HehKowNpzvorsNvH/LCWJZ31V6XUL+lD5NyP6ZEQqYLv9Dtmka tR8Dg245S9AnZYFmioz51SZzwUPTbWVvcuMjaRL6rATUiZruqQTqSqe6WWz9PZW1Pu1U on1vlB6a5G520Vhnuins/0mn4/59lIePY/WJ4eLQg6gFqytQKW5WLvzP8DaEzYU2+q6S 3Z/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@goldelico.com header.s=strato-dkim-0002 header.b=O8RdOKrM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q14-20020a17090311ce00b001517d6bd6f8si341519plh.533.2022.03.08.15.43.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 15:43:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@goldelico.com header.s=strato-dkim-0002 header.b=O8RdOKrM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7C11AB7C6B; Tue, 8 Mar 2022 15:25:57 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346637AbiCHMyK (ORCPT + 99 others); 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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; } -- 2.33.0