From patchwork Sat Apr 29 11:52:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Crawford X-Patchwork-Id: 13227001 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 E0607C77B7F for ; Sat, 29 Apr 2023 11:52:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229458AbjD2Lwj (ORCPT ); Sat, 29 Apr 2023 07:52:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229610AbjD2Lwh (ORCPT ); Sat, 29 Apr 2023 07:52:37 -0400 Received: from ipmail03.adl6.internode.on.net (ipmail03.adl6.internode.on.net [150.101.137.143]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C20B21BFE for ; Sat, 29 Apr 2023 04:52:35 -0700 (PDT) IronPort-SDR: 644d04fc_o0lfV1zJOpiWGh59bvyvKWLwB6F2qzzH6PYUHi41ZHG3t91 Re4/m99W2hYtEsE40ze8PKWI7kRnrVUrIYugX+g== X-SMTP-MATCH: 0 X-IPAS-Result: A2AYAgBQBE1kjPQc8jxaHAEBAQEBAQcBARIBAQQEAQFJgUaCLoJPlgefXg8BDwEBRAQBAYUGAoVAJjgTAQIEAQEBAQMCAwEBAQEBAQMBAQYBAQEBAQEGBBQBAQEBQEWFaA2GBAIBAycLAQ0BATcBDxk4VwYBEoJ+gl2xODOBAYIIAQEGgmSaaoFeCYFBjA6BFoM3ekI/gU6ED2+LBpc0gTN0gSc/b4EEAgkCEWuBEAhogXNAAg1kCwttgUSBRIFQBAIUQgwUXQJrGwYIFQEYAwcHAgFpAwkDBwVJQAMLGA0WOhEsNRQfS4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ATaRKcLklQaKhF0IJTOE+EYxC0+zyFC37pS/N3P/aQrHOJU Z1/FPxARzGV9XiorAlCIYUuPrUtvvoixORaS4PRPWRc7oeu9Gt4gqnxqBr7qnQgGeh1sMAHL YjUSTKOP0qQiVZQmE7PtMN0AXW5U/ZVeDzD2P2Jz8tRG6IhqO1MdWQA4omwtViRMypl+Euah xOcRqn0y+c5959gsbGxGYp+BiK1C+jJasK2zC6Jve5zMOz/afX1i1tNq33MHRhnAr8KatEmy ZWPqIHW2W3GjpYXUkfYuZuKEocS18DjTdh8b8b9HERHlBS7Rf7c3hon0EK7IKxvj9lyyJSGR Qy5Sc3obv8TeY5X60N0YhhkMSQ2KvrIfIL/gxiivtKOIBQ5+i7WHuONrHPGQzlSSX4VBsfYF ATxhceL2vlZi4Z9XDk/GPBsBs5DEm/JAKcJWYX4imiFMzOOnFiHh7rFkCgg4xHtDl2vMp7zw bDBdyjEWCWCgoP65/AHjNUqpTwSNmh3vscodEFE+9JWtSGzPFRbEcsja6c5GrNmuQ2s8qGha D/0OT5oTW23WDlfahzz7ejyRgrVVKREJt79ISdv5E+OLTu/AISbGrZ66yN8+DFMdyD+yP28Y 8QrkpEq0sNdHrkyLQrL2sGGvA== IronPort-HdrOrdr: A9a23:YEqTMa9u2+behhOH/Dduk+ACI+orL9Y04lQ7vn2ZKSY+TiVXra GTdZMgpGbJYFR4YhwdcLW7VJVoLkmslqKdjbN/AV7mZniDhILKFvAF0WKd+UyDJ8SWzIc0vp uIMZIOb+EYZmIbsS+V2meF+1lM+qj+zEnRv5a68550d3AXV0h/1XYFNu9FKDwMeOGWbaBJbq ah2g== X-Talos-CUID: 9a23:cfO4oWyqTS/nLVVIiI0YBgUrFM44MX6Cw0yLYBWnOXpIQaWweHOprfY= X-Talos-MUID: 9a23:sX2YaQiIlhuJ+x1yUa6bfcMpDONwoPuQOW02zL4Jqe3HaTRgIW2tpWHi 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 ipmail03.adl6.internode.on.net with ESMTP; 29 Apr 2023 21:22:29 +0930 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 33TBq71G3093879 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 29 Apr 2023 21:52:22 +1000 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 33TBq71G3093879 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crawford.emu.id.au; s=s1; t=1682769143; bh=ld54a3dnRE0d4ymq1ttpoiuT3UQaVnk8L6QFCH9fTHo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XGHQlfugCZJBbxCMfNkenn3+5p4opBEuRdlE2Lz8uGo5L3A4rLh8M4fRFsZm4bnmh 080lB32Sb8A/Irkj1znrrw4GeKKJMyj16zQ4VAZODTCneTJ0CX49CChaRVDpDDa4HA Z/Bg/v9U0b6av3ZbI926V7WB2DR7+C3pZzcPHaZ4dfXhWzrIOFhXJtESgf50pP2Wa1 jVIuUwe6M/N47gpuBroMcHDqE45zFk3w3umJtM0CWjvW5jkKvTTraru3RlcMzTjCFf LA83BkRaDZefUpbS6jGuVt8tPhvl/+UdzP972ArquvNkxP4QSvTsdmYBYmTY0OgMKq u7mwsa6oCFiHA== From: Frank Crawford To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, Frank Crawford Subject: [PATCH v1 1/3] hwmon: (it87) Add controls for chips with only 4 fans Date: Sat, 29 Apr 2023 21:52:03 +1000 Message-Id: <20230429115205.1547251-2-frank@crawford.emu.id.au> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230429115205.1547251-1-frank@crawford.emu.id.au> References: <20230429115205.1547251-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]); Sat, 29 Apr 2023 21:52:23 +1000 (AEST) 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 Add feature and support for chips with only 4 fans. Reorder macro definitions to bring all fan definitions together. Signed-off-by: Frank Crawford --- drivers/hwmon/it87.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index eb38f54ebeb6..bd9a24942e70 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c @@ -317,6 +317,7 @@ struct it87_devices { * chips to avoid the problem. */ #define FEAT_CONF_NOEXIT BIT(19) /* Chip should not exit conf mode */ +#define FEAT_FOUR_FANS BIT(20) /* Supports four fans */ static const struct it87_devices it87_devices[] = { [it87] = { @@ -508,11 +509,14 @@ static const struct it87_devices it87_devices[] = { (((data)->features & FEAT_TEMP_OLD_PECI) && \ ((data)->old_peci_mask & BIT(nr))) #define has_fan16_config(data) ((data)->features & FEAT_FAN16_CONFIG) +#define has_four_fans(data) ((data)->features & (FEAT_FOUR_FANS | \ + FEAT_FIVE_FANS | \ + FEAT_SIX_FANS)) #define has_five_fans(data) ((data)->features & (FEAT_FIVE_FANS | \ FEAT_SIX_FANS)) +#define has_six_fans(data) ((data)->features & FEAT_SIX_FANS) #define has_vid(data) ((data)->features & FEAT_VID) #define has_in7_internal(data) ((data)->features & FEAT_IN7_INTERNAL) -#define has_six_fans(data) ((data)->features & FEAT_SIX_FANS) #define has_avcc3(data) ((data)->features & FEAT_AVCC3) #define has_five_pwm(data) ((data)->features & (FEAT_FIVE_PWM \ | FEAT_SIX_PWM)) @@ -3169,16 +3173,14 @@ static void it87_init_device(struct platform_device *pdev) it87_check_tachometers_16bit_mode(pdev); /* Check for additional fans */ - if (has_five_fans(data)) { - tmp = it87_read_value(data, IT87_REG_FAN_16BIT); - - if (tmp & BIT(4)) - data->has_fan |= BIT(3); /* fan4 enabled */ - if (tmp & BIT(5)) - data->has_fan |= BIT(4); /* fan5 enabled */ - if (has_six_fans(data) && (tmp & BIT(2))) - data->has_fan |= BIT(5); /* fan6 enabled */ - } + tmp = it87_read_value(data, IT87_REG_FAN_16BIT); + + if (has_four_fans(data) && (tmp & BIT(4))) + data->has_fan |= BIT(3); /* fan4 enabled */ + if (has_five_fans(data) && (tmp & BIT(5))) + data->has_fan |= BIT(4); /* fan5 enabled */ + if (has_six_fans(data) && (tmp & BIT(2))) + data->has_fan |= BIT(5); /* fan6 enabled */ /* Fan input pins may be used for alternative functions */ data->has_fan &= ~sio_data->skip_fan; From patchwork Sat Apr 29 11:52:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Crawford X-Patchwork-Id: 13226999 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 4C431C77B60 for ; Sat, 29 Apr 2023 11:52:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229658AbjD2Lwj (ORCPT ); Sat, 29 Apr 2023 07:52:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbjD2Lwh (ORCPT ); Sat, 29 Apr 2023 07:52:37 -0400 Received: from ipmail03.adl6.internode.on.net (ipmail03.adl6.internode.on.net [150.101.137.143]) by lindbergh.monkeyblade.net (Postfix) with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aWY5EizyUAhVaRi2spypQg6bAfdIIdvjYCAg+0SPcSqtGYecG/1b+zx952ttMC7WpA19x QryJlWrVvRp/qxUeA== IronPort-HdrOrdr: A9a23:CzjfyaDyLM5DucvlHel255DYdb4zR+YMi2TDt3oadfWaSK2lfq eV7Y0mPX2dslsssRQb9exoV5PwIk80maQb3WBVB8bHYOCEghrPEGgd1/qB/9SIIUSXndK1l5 0QFJSWY+eRMbEVt6jHCIbUKadZ/DD+ytHMuQ7H9QYQceh1UdAc0+6nMHfhLqWmLDM2f6YEKA == X-Talos-CUID: 9a23:Q+G0WmOl0ShBz+5DBAg592BTC58ZSlLmnUXaOXWyGUhWV+jA X-Talos-MUID: 9a23:4iMZPAQnOg/I6USpRXTcliE7Bv1v2p2VJ1JOmooWkfinGAlJbmI= 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 ipmail03.adl6.internode.on.net with ESMTP; 29 Apr 2023 21:22:31 +0930 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 33TBq71H3093879 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 29 Apr 2023 21:52:27 +1000 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 33TBq71H3093879 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crawford.emu.id.au; s=s1; t=1682769147; bh=bSojTUSDDl0fjBG1iY8i0/SwL7mKh3cuXl3AY8oloXQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EAMeuFKc1Gn/R1qVgkkjW4LLdG+0/RRx4SQaa2Cz+3Uz60aSv7wjj7RLeCyBmbFaC xJ4hZ4N/UDgX6uKIkiWkedx1ekQe8hCI8w+7a7UIXDwX3hByPe2iPp1YcfMiQq4mxd 5xpemTtTIAK+T1mWipjE1ApdU/rDJCpKxEw2urp+NWZoEKlxKb94tpk4tn+8IXQgx9 mgfcpVbt9rzy1rl+TSPJ5OfNexcKjUJsCA89ywXgPWqWXMJB2O0y+/GlDbo8D5LZcK KptYCc1L/tnsx8MI6SdQvRkOO5RJ4gGHO4RnbGqxsab6FDOFfBC4ptUh11lmHI4pAv xVM09wuRAbnrQ== From: Frank Crawford To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, Frank Crawford Subject: [PATCH v1 2/3] hwmon: (it87) Add controls for chips with only 4 PWMs Date: Sat, 29 Apr 2023 21:52:04 +1000 Message-Id: <20230429115205.1547251-3-frank@crawford.emu.id.au> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230429115205.1547251-1-frank@crawford.emu.id.au> References: <20230429115205.1547251-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]); Sat, 29 Apr 2023 21:52:27 +1000 (AEST) 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 Add feature and support for chips with only 4 PWMs. Signed-off-by: Frank Crawford --- drivers/hwmon/it87.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index bd9a24942e70..d5482c6ed18f 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c @@ -318,6 +318,7 @@ struct it87_devices { */ #define FEAT_CONF_NOEXIT BIT(19) /* Chip should not exit conf mode */ #define FEAT_FOUR_FANS BIT(20) /* Supports four fans */ +#define FEAT_FOUR_PWM BIT(21) /* Supports four fan controls */ static const struct it87_devices it87_devices[] = { [it87] = { @@ -518,8 +519,11 @@ static const struct it87_devices it87_devices[] = { #define has_vid(data) ((data)->features & FEAT_VID) #define has_in7_internal(data) ((data)->features & FEAT_IN7_INTERNAL) #define has_avcc3(data) ((data)->features & FEAT_AVCC3) -#define has_five_pwm(data) ((data)->features & (FEAT_FIVE_PWM \ - | FEAT_SIX_PWM)) +#define has_four_pwm(data) ((data)->features & (FEAT_FOUR_PWM | \ + FEAT_FIVE_PWM | \ + FEAT_SIX_PWM)) +#define has_five_pwm(data) ((data)->features & (FEAT_FIVE_PWM | \ + FEAT_SIX_PWM)) #define has_six_pwm(data) ((data)->features & FEAT_SIX_PWM) #define has_pwm_freq2(data) ((data)->features & FEAT_PWM_FREQ2) #define has_six_temp(data) ((data)->features & FEAT_SIX_TEMP) @@ -2734,8 +2738,10 @@ static int __init it87_find(int sioaddr, unsigned short *address, else sio_data->skip_in |= BIT(9); - if (!has_five_pwm(config)) + if (!has_four_pwm(config)) sio_data->skip_pwm |= BIT(3) | BIT(4) | BIT(5); + else if (!has_five_pwm(config)) + sio_data->skip_pwm |= BIT(4) | BIT(5); else if (!has_six_pwm(config)) sio_data->skip_pwm |= BIT(5); From patchwork Sat Apr 29 11:52:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Crawford X-Patchwork-Id: 13227000 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 F3F3DC7EE24 for ; Sat, 29 Apr 2023 11:52:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229610AbjD2Lwk (ORCPT ); Sat, 29 Apr 2023 07:52:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229709AbjD2Lwj (ORCPT ); Sat, 29 Apr 2023 07:52:39 -0400 Received: from ipmail03.adl6.internode.on.net (ipmail03.adl6.internode.on.net [150.101.137.143]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 976F11BF0 for ; Sat, 29 Apr 2023 04:52:37 -0700 (PDT) IronPort-SDR: 644d0502_YQeac/yOTJCvtMhaQIVI2i1IRqAdhdIIHMZIgBfSoTje0fb ZGq1ckHNw2CvGQkuLykBi4jR6saZ/ek2+nAFOgA== X-SMTP-MATCH: 0 X-IPAS-Result: A2AYAgBQBE1kjPQc8jxaHAEBAQEBAQcBARIBAQQEAQFJgUaCLoJPtWUPAQ8BAUQEAQGFBgKFQCY4EwECBAEBAQEDAgMBAQEBAQEDAQEGAQEBAQEBBgQUAQEBAUBFhWgNhgQCAQMnCwENAQE3AQ8ZOFcGARKCfoJdsTgzgQGCCAEBBoJkmmqBXgmBQYwOZy+DN3pCP4FOgRWCem+BBYMGhnuXNIEzdIEnP2+BBAIJAhFrgRAIaHp5QAINZAsLbYFEgxQEAhRCDBRdAmsbBggVARgDBwcCAWkDCQMHBUlAAwsYDRY6ESw1FB9LgQsYYwSCAgYBJSSYOnIBgQ2CacQMhAiBWZ8TTYFGgjelRpd7IIIuoH6ELQIKBxaBeoF+TR8ZgyJPAxkPjiAXAoITkVFjPQIHCwEBAwmIbIJZAQE IronPort-PHdr: A9a23:WFaHHxBTPt/wz6Xsf4clUyQVWBdPi9zP1kY94Js7kPRFaK288ZP4M ArS4OgrjVOPVJiIo/tegL/QtKbtEXcF/Y7Hqn0Hd4BBEh4d3Msak1ZyX8eMBR/3cKG6PXVoT s9IDQc39HrjbiBo IronPort-Data: A9a23:FnsjzaPqZIAuWnTvrR2xk8FynXyQoLVcMsEvi/4bfWQNrUp01jdWm DFMWWGCPqncZzChfdt+aNzg/UtSsMfWn4U2QFRtqytjRS8aoJPMD97BIBe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Q4FILMcbbGpwmxi9+uGyot+1XLA/3//EC4cFwBUDEDPqPPL zPdutGs14h+l5tNDhpVPMNWKcZ0D3G7UJR3auCrkyeTC1SppVawurHCsx4EwhOTA1mmFPfK2 770diLcRj+T5p6RlMp4trZstCI5FHx+2Ok8XnwM8u5M1gyVMjQ0EvQ/A74nVLdkyyD87cStL nWFJm4vEj70Ujl4YA3xqoarFBuWAusVfMz1PHo19keTcD27H56EHKAnzCp7/nNqYXH2+YlL8 z3FFqHYZXBdGq1UeNs= IronPort-HdrOrdr: A9a23:lE8KhaDZW3A08FrlHel255DYdb4zR+YMi2TDt3oadfWaSK2lfq eV7Y0mPX2dslsssRQb9exoV5PwIk80maQb3WBVB8bHYOCEghrPEGgd1/qB/9SIIUSXndK1l5 0QFJSWY+eRMbEVt6jHCIbUKadZ/DD+ytHMuQ7H9QYQceh1UdAc0+6nMHfhLqWmLDM2f6YEKA == X-Talos-CUID: 9a23:ELnrXGFMub7+4qYeqmJm02okKvo0KUaM72rxOgycL092Q5eKHAo= X-Talos-MUID: 9a23:fGflYQ0GePgBvdUuTKa3ZdKD4TUjs66+DGZWiIQ/hdS+HgpTBiy+sBSPXdpy 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 ipmail03.adl6.internode.on.net with ESMTP; 29 Apr 2023 21:22:35 +0930 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 33TBq71I3093879 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 29 Apr 2023 21:52:30 +1000 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 33TBq71I3093879 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crawford.emu.id.au; s=s1; t=1682769151; bh=lh7htZDRdQRdVj2OwYmBtbcAVqi5YPAll5Lv5O9bkNQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GCgVu7t6PjsxaOD5M80Qi8PvQdxqwwwaNXKLeKTLjHyX4sN8US2cC8eUA+Q2Q7S32 4T49EvsVCwitVBUxyZ+Emiwja+AlfUyg02F/SF9lxykfk89PvbG76yEPNrVU1WOUDQ /AH2DodlqOB9oq8JG/im0JAYCcJP/iDxNyuNii4UXb1j+p7Es+uE28/PMxCAnGxjOc VNUR4LXXwyd7nA7Wx4SWiMOKU84zRorUoN0SyFHhoxAm06+00mozY/hbaCsXwWoVkh h/rx1e+8pXXASqlvheXhSZeAJC88rvzhghBnr0o5zJd7VkL9cmaEiXrS5A+Qqs95eE kDQ8umFGpM4kA== From: Frank Crawford To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, Frank Crawford Subject: [PATCH v1 3/3] hwmon: (it87) Update IT8732F chip for 4 fans and PWMs Date: Sat, 29 Apr 2023 21:52:05 +1000 Message-Id: <20230429115205.1547251-4-frank@crawford.emu.id.au> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230429115205.1547251-1-frank@crawford.emu.id.au> References: <20230429115205.1547251-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]); Sat, 29 Apr 2023 21:52:31 +1000 (AEST) 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 Add support for 4 fans and 4 PWMs to chipset IT8732F. Signed-off-by: Frank Crawford --- drivers/hwmon/it87.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index d5482c6ed18f..96c17660ff0f 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c @@ -377,7 +377,8 @@ static const struct it87_devices it87_devices[] = { .model = "IT8732F", .features = FEAT_NEWER_AUTOPWM | FEAT_16BIT_FANS | FEAT_TEMP_OFFSET | FEAT_TEMP_OLD_PECI | FEAT_TEMP_PECI - | FEAT_10_9MV_ADC | FEAT_IN7_INTERNAL, + | FEAT_10_9MV_ADC | FEAT_IN7_INTERNAL | FEAT_FOUR_FANS + | FEAT_FOUR_PWM, .peci_mask = 0x07, .old_peci_mask = 0x02, /* Actually reports PCH */ }, @@ -2932,6 +2933,34 @@ static int __init it87_find(int sioaddr, unsigned short *address, if (!(reg & BIT(0))) sio_data->skip_in |= BIT(9); + sio_data->beep_pin = superio_inb(sioaddr, + IT87_SIO_BEEP_PIN_REG) & 0x3f; + } else if (sio_data->type == it8732) { + int reg; + + superio_select(sioaddr, GPIO); + + /* Check for pwm2, fan2 */ + reg = superio_inb(sioaddr, IT87_SIO_GPIO5_REG); + if (reg & BIT(1)) + sio_data->skip_pwm |= BIT(1); + if (reg & BIT(2)) + sio_data->skip_fan |= BIT(1); + + /* Check for pwm3, fan3, fan4 */ + reg = superio_inb(sioaddr, IT87_SIO_GPIO3_REG); + if (reg & BIT(6)) + sio_data->skip_pwm |= BIT(2); + if (reg & BIT(7)) + sio_data->skip_fan |= BIT(2); + if (reg & BIT(5)) + sio_data->skip_fan |= BIT(3); + + /* Check if AVCC is on VIN3 */ + reg = superio_inb(sioaddr, IT87_SIO_PINX2_REG); + if (reg & BIT(0)) + sio_data->internal |= BIT(0); + sio_data->beep_pin = superio_inb(sioaddr, IT87_SIO_BEEP_PIN_REG) & 0x3f; } else {