From patchwork Sun Mar 12 04:31:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Crawford X-Patchwork-Id: 13171126 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 B3575C6FD19 for ; Sun, 12 Mar 2023 04:37:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229621AbjCLEhO (ORCPT ); Sat, 11 Mar 2023 23:37:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbjCLEhN (ORCPT ); Sat, 11 Mar 2023 23:37:13 -0500 Received: from ipmail06.adl3.internode.on.net (ipmail06.adl3.internode.on.net [150.101.137.16]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 11C5D59E62 for ; Sat, 11 Mar 2023 20:37:11 -0800 (PST) IronPort-SDR: 640d55c2_Bec6gPmH2KrnnduYGSammt0anZz1Amiv29RG8Ubo1g38c6x zmq8m1mVOy6jDCKOMNawpEeoX7cxc24OEYNUy5Q== X-SMTP-MATCH: 0 X-IPAS-Result: A2BTAgAwVA1kjPQc8jxaHgEBCxIMSYE7C4Iugk+zUIF+DwEPAQFEBAEBhQUChTMmNAkOAQIEAQEBAQMCAwEBAQEBAQMBAQYBAQEBAQEGBBQBAQEBQEWFaA2GVgIBAycLAQ0BATcBDxk4VwYBEoJ+gl2wRjOBAYIIAQEGgmKaaIFeCYFAi22BFoM2ekI/gU6BFYJ6boQ3hkyYPgqBNHWBIA5Kc4EGAgkCEWuBEghogX5BAg1lCw50gWACgQkDCQMHBUlAAwsYDRY6Eyw1FCFebC4SEgUDCxUqRwQIOQYbNBECCA8SDyxEDkI3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3rdUQo/qOREAp5YUD9Gh6o0RbxSfNklufOpE/pIWLVrDeTq35yeCG3qxduxJOfbO102yU O5qGe5iSDW803yogg0AJKtRPYJxouEl1OACdpzvO2QClbmV9RhtkZDI8xnBlH0ZeMpvnek9O 7HuWWq7SELIvkRtmkjJsMVgEUi7a4NdZATDgcaEwN9QHJcH6OxRYUU+14WvhEqsMSxlwUOwn BjCbKro3eBd2dxSv4/zIJ5iWSSwC/3ODdqtzi7iku5zfevuMNjPvTw7slPIHRpbFppPVsVVl Yaiis/W3kTEjbMyC2vIxpuKEocS18DjTdh8b8b9HERHlBS7Rf7c3hon0EK7IKxvj9lyyJSGR Qy5Sc3obv8TeY5X60N0YhhkMSQ2KvrIfIL/gxiivtKOIBQ5+i7WHuONrHPGQzlSSX4VBsfYF ATxhceL2vlZi4Z9XDk/GPBsBs5DEm/JAKcJWYX4imiFMzOOnFiHh7rFkCgg4xHtDl2vMp7zw bDBdyjEWCWCgoP65/AHjNUqpTwSNmh3vscodEFE+9JWtSGzPFRbEcsja6c5GrNmuQ2s8qGha D/0OT5oTW23WDlfahzz7ejyRgrVVKREJt79ISdv5E+OLTu/AISbGrZ66yN8+DFMdyD+yP28Y 8QrkpEq0sNdHrkyLQrL2sGGvA== IronPort-HdrOrdr: A9a23:8iEumag5amtCP1D7krYhlPxucXBQXgAji2hC6mlwRA09TyX5ra qTdTogtCMc7wxhIU3J+7i7VZVoJEmxyXcb2/hzAV7PZmbbUS6TXeVfBOjZslvd8lPFh4xgPM 5bGsAUNDSzNykcsS+Q2mmF+rgbruVuf82T9J/jJg9WPGRXgrlbnntE4xigYzBLrdZ9dOEE/E v13Ls8mwad X-IronPort-Anti-Spam-Filtered: true Received: from 60-242-28-244.static.tpgi.com.au (HELO bits.crawford.emu.id.au) ([60.242.28.244]) by ipmail06.adl3.internode.on.net with ESMTP; 12 Mar 2023 15:02:01 +1030 Received: from agc.crawford.emu.id.au (agc.crawford.emu.id.au [IPv6:fdd2:7aad:d478:1:0:0:cb10:cc07]) (authenticated bits=0) by bits.crawford.emu.id.au (8.17.1/8.17.1) with ESMTPSA id 32C4VeSK3479492 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sun, 12 Mar 2023 15:31:57 +1100 Authentication-Results: bits.crawford.emu.id.au; arc=none smtp.remote-ip=fdd2:7aad:d478:1::cb10:cc07 DKIM-Filter: OpenDKIM Filter v2.11.0 bits.crawford.emu.id.au 32C4VeSK3479492 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crawford.emu.id.au; s=s1; t=1678595518; bh=csh4yILaXByk+BmlKyVMAylrDHSNbNk98uAL9wEBXYY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rt7uRzQqkngDBMklk/4oPaDtcfuXCF6ATnZqqCPX2iCQxMfYRL5vvpgoRhCTCjvtV +hNQvLc3d7OfyuZ95h+qpQoaeF+w54ooikQ79suE+dfFJPX2T06PtCrycaprfC3Z8f dcgN16wVKTamwGA+vqkSMnWUo1Ed2kdGIe21520DxSWmoJTVSv9RQqP603MY50PWMv yvWa6ZJVtOESLoIpd3Mro7lXONs5XGYNrOx+ptukQcxnde7wUNPBVguzOIp32HRL2u AGrgjG/VXUPciXXwYP+IKtKQ1BFherXvFMW8ixXi/Mr7qn8gOXUOfsE/j8vfRJEFlC pSyiiEB0TXdZw== From: Frank Crawford To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, Frank Crawford Subject: [PATCH v1 2/3] hwmon (it87): Add scaling macro for recent ADC voltages Date: Sun, 12 Mar 2023 15:31:36 +1100 Message-Id: <20230312043137.1744885-3-frank@crawford.emu.id.au> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230312043137.1744885-1-frank@crawford.emu.id.au> References: <20230312043137.1744885-1-frank@crawford.emu.id.au> MIME-Version: 1.0 X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.4 (bits.crawford.emu.id.au [IPv6:fdd2:7aad:d478:1:0:0:cb10:cc01]); Sun, 12 Mar 2023 15:31:58 +1100 (AEDT) X-Virus-Scanned: clamav-milter 0.103.8 at bits.crawford.emu.id.au X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Generalise scaling to include all recent ADC values and match the labels for internal voltage sensor to match. This includes correction of an existing error for voltage scaling for chips that have 10.9mV ADCs, where scaling was not performed. Signed-off-by: Frank Crawford --- drivers/hwmon/it87.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index fe1291d5be4b..ca4b79839d98 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c @@ -517,6 +517,9 @@ static const struct it87_devices it87_devices[] = { #define has_vin3_5v(data) ((data)->features & FEAT_VIN3_5V) #define has_conf_noexit(data) ((data)->features & FEAT_CONF_NOEXIT) #define has_11mv_adc(data) ((data)->features & FEAT_11MV_ADC) +#define has_scaling(data) ((data)->features & (FEAT_12MV_ADC | \ + FEAT_10_9MV_ADC | \ + FEAT_11MV_ADC)) struct it87_sio_data { int sioaddr; @@ -2006,8 +2009,7 @@ static ssize_t show_label(struct device *dev, struct device_attribute *attr, if (has_vin3_5v(data) && nr == 0) label = labels[0]; - else if (has_12mv_adc(data) || has_10_9mv_adc(data) || - has_11mv_adc(data)) + else if (has_scaling(data)) label = labels_it8721[nr]; else label = labels[nr]; @@ -3139,7 +3141,7 @@ static int it87_probe(struct platform_device *pdev) "Detected broken BIOS defaults, disabling PWM interface\n"); /* Starting with IT8721F, we handle scaling of internal voltages */ - if (has_12mv_adc(data)) { + if (has_scaling(data)) { if (sio_data->internal & BIT(0)) data->in_scaled |= BIT(3); /* in3 is AVCC */ if (sio_data->internal & BIT(1))