From patchwork Sat Aug 14 14:36:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 12436743 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C048C432BE for ; Sat, 14 Aug 2021 14:39:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5EF5960F91 for ; Sat, 14 Aug 2021 14:39:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238644AbhHNOjg (ORCPT ); Sat, 14 Aug 2021 10:39:36 -0400 Received: from mout.gmx.net ([212.227.17.21]:47075 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238512AbhHNOjf (ORCPT ); Sat, 14 Aug 2021 10:39:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1628951931; bh=ctIxWeRrudS37WE0LhW7RLnIxOuhmIbvkDtnypWIIrM=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=hLprq3LNmV4rCJBmEYWWn4hVDSoWRMwSDPd6r0MVfUjlwvhm7Xmr0qrze07f3n5YC smp90LrOJy0ovVFsY/B6EYxVp/JFXdT0+9/joBaRhDK4Glf2SBsAydVmxzJgtuqfO9 Hpo5RFoAGtMd1NXXJ4Q8KsVo69tyOwXqmUb9H12s= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from esprimo-mx.fritz.box ([91.0.96.234]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N3bX1-1nDW2K0FZj-010ZOG; Sat, 14 Aug 2021 16:38:51 +0200 From: W_Armin@gmx.de To: pali@kernel.org Cc: linux@roeck-us.net, jdelvare@suse.com, linux-hwmon@vger.kernel.org Subject: [PATCH 1/4] hwmon: (dell-smm) Mark tables as __initconst Date: Sat, 14 Aug 2021 16:36:34 +0200 Message-Id: <20210814143637.11922-2-W_Armin@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210814143637.11922-1-W_Armin@gmx.de> References: <20210814143637.11922-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:+AP1JaO67EKx6P66rSe9YXsO/3aseF+9kC3FXwYz0kEXGO9ARPE NsHGc5A28VEiCZR5STzE/c0GWqW9qM16hmMn/Ho7HBuDCo25+ShyCPY0Sg8IqqwnLFgcWR/ gA0ChrWBrA/Q9VqK2Lckevc4u0f7VjLVEMcedcNud/2qQC0YbagVWqW0pnM3I5VSmvGkGkD n3+q4PCgiqezfNLnFXaiQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:hpmTxSAonMQ=:EQ0mi3cUY79FACpDm3jwLb fAeycN1iln2ecsiwttiK3W+xZwQxfWlq3v+d4d7kKx26lxRpdEvTPpqpUaQ6/0MNyKYjv+qMP PWQSjQUXWlCE3rUquLuqimKmMqz9nmGWOjos5WOkBXFUsqy2syeWAp/v+7aKm7sMzDBH/R/0Z SAjmOFg4NY4rXQXkOl+F8WeqbFJfSN1bXAtnvB02AB5w09ge6Mp6HLsgwl1Plaa+Fz+f/EZHH 4eXD/uI9E6z2cvt6HZAfSpAEuWhpFKKXwCm9UiRcge63R+z/WYCBgjaKsPK8NpfEuX2aRxU3o owKfzCReHgHolHc5In8yFEyv5OT5Umj7KL+kEImXlZe6StF0pIPAU5lrM54WmeGBzDGaELJg4 7Q9/yYzKdXKdwK/f4Fd1qmIDFw1Vg8+Nlv5X70fIvduAE1rWmFf1vYSK5a2mgQLDK7wBMHnSd R8b66sMJZtStfc8uOc076ppEXHzwh6dpT5jurQcJC8NGIM8sSaHCzgO+B9sqGdgO8mXseLwc4 96ZC9vcbTE4cfRB7FojRzyVEURiS/S2L9R1Why9RV2juZbm9x3B1MsfokFR0lfth5V8u9rPse MAMWVfjZ/58wpifzrMAb6sebqEJgTQDFvTRszatFa8eIg7NGbScRW4zFngkY/IxoxZTkujv76 q6zZVL3qhvO0s54EKir0wtb7m6DonqIB6qTAuISYBvMTVZYMRZI06fhE+JEFZpfRyq3WIFVFE cA/THpVqFdKRWKiiPbA5LNMUavaOcvqHqWlbWeb1gywZGwEZX+qzF7DRkUHRiCPq0cutuU+pV 7PBQeOcny8Q5MXedIIc2khzx8QURTCdlFbr4wTq93x0NI1cT63lPfVY/Mh4dd1s0TbWM7PA92 tNRtsQJ46TvOxR5JNp11qWaeh/1Y+FvnZLHgZHPpioiRMoRY26qq9njaZqEH+SRZrbnghZjgL ElSztv+ZbAgnOc3ILXv+KdFAUVGev+79hUYBrBIWUHjUR3tZCL233RolVgJRmFLGtRtYVbJ79 3fn1mg2pnubKGuw17cJFkSAkarAyPnkZvXDQqrOtC5w1b83Gm5UGbYqh8EEqn/QGiCeh04+eD mWVmswdCKSTBFPaYz+rRsVc/90LfS36KCU9 Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org From: Armin Wolf Both the config and the DMI tables never change and are only used during module init for setting up the device data struct. Mark all of them as const and __initconst for a smaller runtime memory footprint. Signed-off-by: Armin Wolf Reviewed-by: Pali Rohár --- drivers/hwmon/dell-smm-hwmon.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.20.1 diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c index 43da32ad2dce..68af95c1d90c 100644 --- a/drivers/hwmon/dell-smm-hwmon.c +++ b/drivers/hwmon/dell-smm-hwmon.c @@ -957,7 +957,7 @@ enum i8k_configs { DELL_XPS, }; -static const struct i8k_config_data i8k_config_data[] = { +static const struct i8k_config_data i8k_config_data[] __initconst = { [DELL_LATITUDE_D520] = { .fan_mult = 1, .fan_max = I8K_FAN_TURBO, @@ -1115,7 +1115,7 @@ static const struct dmi_system_id i8k_blacklist_fan_type_dmi_table[] __initconst * support for affected blacklisted Dell machines stay disabled. * See bug: https://bugzilla.kernel.org/show_bug.cgi?id=195751 */ -static struct dmi_system_id i8k_blacklist_fan_support_dmi_table[] __initdata = { +static const struct dmi_system_id i8k_blacklist_fan_support_dmi_table[] __initconst = { { .ident = "Dell Inspiron 7720", .matches = { @@ -1156,14 +1156,14 @@ enum i8k_fan_controls { I8K_FAN_34A3_35A3, }; -static const struct i8k_fan_control_data i8k_fan_control_data[] = { +static const struct i8k_fan_control_data i8k_fan_control_data[] __initconst = { [I8K_FAN_34A3_35A3] = { .manual_fan = 0x34a3, .auto_fan = 0x35a3, }, }; -static struct dmi_system_id i8k_whitelist_fan_control[] __initdata = { +static const struct dmi_system_id i8k_whitelist_fan_control[] __initconst = { { .ident = "Dell Latitude 5480", .matches = { From patchwork Sat Aug 14 14:36:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 12436745 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1AB15C4338F for ; Sat, 14 Aug 2021 14:39:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EF73760F91 for ; Sat, 14 Aug 2021 14:39:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238654AbhHNOji (ORCPT ); Sat, 14 Aug 2021 10:39:38 -0400 Received: from mout.gmx.net ([212.227.17.20]:38899 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238512AbhHNOji (ORCPT ); Sat, 14 Aug 2021 10:39:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1628951933; bh=TjpaocP26S65OFtSulAoo6oEg8McxYemd0KVNG9ozJc=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=Bj2eqNuEtmqig4itIGXGorBnC5Kn3rSf9/3sPy9KvrLsmIl/SEBj7t81RfoboFbaW vuEdq0ugZteNePMJQPKb3p3h7ysbpW7aaqeaZo101q8flH5pWqHTEh5DNvsJs+AvDW VtYH/S/jC/dMCD5OQ2bgFjYXYFM7MT633BC0wu/s= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from esprimo-mx.fritz.box ([91.0.96.234]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MVeI8-1meAsz08DU-00RVR6; Sat, 14 Aug 2021 16:38:53 +0200 From: W_Armin@gmx.de To: pali@kernel.org Cc: linux@roeck-us.net, jdelvare@suse.com, linux-hwmon@vger.kernel.org Subject: [PATCH 2/4] hwmon: (dell-smm) Rework SMM function debugging Date: Sat, 14 Aug 2021 16:36:35 +0200 Message-Id: <20210814143637.11922-3-W_Armin@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210814143637.11922-1-W_Armin@gmx.de> References: <20210814143637.11922-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:HWchIONHzewHVS1jG6M+sVv2V0Zlv6i2wDisBksMmO4RlnalddN TpaSYSrCGljnci8WmMdzpdxddVar6sGJkK7rbx72kKF3/s7G10taVF6oTEKYuKHbuXsY3s1 iibRDkXxKrphi6oktEajcjmBlLyU/ZFJmWzyEfYlQvwYKlmVqJtOJYugaTrsg2FUBMEvl4E lOabofOdFXdVjJ6rQfqkg== X-UI-Out-Filterresults: notjunk:1;V03:K0:HEdRQgzVvqU=:NV5n/hC2NKlh3aNlESEE/y cp8lMqitbRX9jiMkZOD5mMnh6Hds8XaGoSPBjAsNIjMj1QySgHN8x0znBE6XT0Z7tmOepLOce OhPB1A8WLhG0vk9pJysxjdRa/tdJp9wVPTs4o0j51vy0DR0BYTqD8bAmiamaV5unBkVe2QDwS JFMC/sQ638N+R8E/0uITFKh4vHZjf2Xmt3GB+nBWuKrlRfxUXhY5uH2V0qm3Eom+N+QL1RdxV 4+ng7bzDe1NDYb3STj2xzJ4HiE4yPWeV/RDxmCzGytXSeA2Zb8zDBT/bn9RBoGqB8nJKXpB7d 4ZbQIy663zrWlCVwpcuFh172hDDZ3Mx//HvrKpOQio5+/TwshcKXQJLgyzMgLkmh/BeKXGOZI xhEurna5+at0Zf1T42sISp79fQCpladjCFTTFnLv4A1zWBsCAwY/9nu9WGL5VZy6mRVbsLLHH 7Kt/9qCYoZ/zqRVKx8Y7rDi9fEPHvpPUlGETUVi8Nv7q5oWTLXHXOs4rFgerr/4/elXhGH7bj FFcbZU92MmY/CaW3gLwBQBowmVkgdt3SAfP0EqPSQ3G5JFyFm5I0f6gompNXTflxDoASJUx7l tFsgN09XJJLflDp9/opQ/My/fZQtsrRHkwhIBd8PvtN9pfKtkQ8sqTpNmPmOCTg9G1gkgW+uq 8xYc5pFQMOWXDWyURW8pGNQxU8FKgZ+FcWCXD07tD4rCIObVef6jQz+cjSMDJDErnlZNW0G7D xym9q7nq3cZh2NlEJkrb4GMRxe3orN0az2D+/fRguXKC1VtqyU1bCMx/YT8MREdI49pkDlAHL DY7wTo8d1s0Kyfdcd/LYEM/U8zLKwwDUZdhrG/oSaltmTli8CYsSgP4RmS8Y6z0C5Mwt7X4Ev me/L1PCeFBRYW3iShyOHqDVsrcRWZK3jaxwdCS15cpLsZ2amnziuBnAzZWwZxbbKj2YH6W9KE VlTR8IJc5ubDMv+XXsa5WDoNZfHM81d5qvMK6yfceJrbCZhUX0aK6HKIrpUNsMhi1zLUvoaIB EOdrqJ02twPg0/WwCsn69/QHkXgTFmaX8UJSIoifX4ICdXEPm9EJuoiJsxMKns9rpnSTQ/FN3 T7ucmk730UwE8VkorTUDhZKzyGZGpW63yjEQ2W4197kEeODpRDrcK4P3Q== Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org From: Armin Wolf Use IS_ENABLED() instead of #ifdef and use ktime_us_delta() for improved precision. Signed-off-by: Armin Wolf --- drivers/hwmon/dell-smm-hwmon.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) -- 2.20.1 diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c index 68af95c1d90c..3aa09c1e4b1d 100644 --- a/drivers/hwmon/dell-smm-hwmon.c +++ b/drivers/hwmon/dell-smm-hwmon.c @@ -158,17 +158,13 @@ static inline const char __init *i8k_get_dmi_data(int field) */ static int i8k_smm_func(void *par) { - int rc; struct smm_regs *regs = par; - int eax = regs->eax; - -#ifdef DEBUG - int ebx = regs->ebx; - unsigned long duration; - ktime_t calltime, delta, rettime; + int rc, eax = regs->eax, __maybe_unused ebx = regs->ebx; + long long __maybe_unused duration; + ktime_t __maybe_unused calltime; - calltime = ktime_get(); -#endif + if (IS_ENABLED(CONFIG_DEBUG)) + calltime = ktime_get(); /* SMM requires CPU 0 */ if (smp_processor_id() != 0) @@ -230,13 +226,11 @@ static int i8k_smm_func(void *par) if (rc != 0 || (regs->eax & 0xffff) == 0xffff || regs->eax == eax) rc = -EINVAL; -#ifdef DEBUG - rettime = ktime_get(); - delta = ktime_sub(rettime, calltime); - duration = ktime_to_ns(delta) >> 10; - pr_debug("smm(0x%.4x 0x%.4x) = 0x%.4x (took %7lu usecs)\n", eax, ebx, - (rc ? 0xffff : regs->eax & 0xffff), duration); -#endif + if (IS_ENABLED(CONFIG_DEBUG)) { + duration = ktime_us_delta(ktime_get(), calltime); + pr_debug("smm(0x%.4x 0x%.4x) = 0x%.4x (took %7lld usecs)\n", eax, ebx, + (rc ? 0xffff : regs->eax & 0xffff), duration); + } return rc; } From patchwork Sat Aug 14 14:36:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 12436747 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C94F0C432BE for ; Sat, 14 Aug 2021 14:39:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AE42C60F91 for ; Sat, 14 Aug 2021 14:39:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238659AbhHNOjk (ORCPT ); Sat, 14 Aug 2021 10:39:40 -0400 Received: from mout.gmx.net ([212.227.17.22]:35535 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238512AbhHNOjk (ORCPT ); Sat, 14 Aug 2021 10:39:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1628951935; bh=1xBScPuxLMpHg8yHzYFitOULwdqh+zZL6/YNV+2QkIE=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=ZteVI1DZ3igS0Ysk3GiQDkiyQG1PJOXFzHFvCtzUR/eqfQLJL4RxZwUiClE7i/7Sz 4iVhybDUYn7fQRcj1kvZ0t+Iz/kVSMeZb16NSWwgeNHJL4Mrzq4DtxeWisItanfoX3 mn9FAVyR7HtfND9qxGc2L2+8exJGziTlqtLSSdaU= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from esprimo-mx.fritz.box ([91.0.96.234]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M3UZG-1mEMqS3HO6-000Yz2; Sat, 14 Aug 2021 16:38:54 +0200 From: W_Armin@gmx.de To: pali@kernel.org Cc: linux@roeck-us.net, jdelvare@suse.com, linux-hwmon@vger.kernel.org Subject: [PATCH 3/4] hwmon: (dell-smm) Enable automatic fan speed control for all channels Date: Sat, 14 Aug 2021 16:36:36 +0200 Message-Id: <20210814143637.11922-4-W_Armin@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210814143637.11922-1-W_Armin@gmx.de> References: <20210814143637.11922-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:HU1B3gE+ruc89jiEWj7mSLLn6/bbXUN+oSkVFKvTC6v9lirAgqi Z3MhfjSaz3oeVBFLEFeA1AGAQrIHiqHpCLmjekUxaSljjiNOMh+FHIWSJABSZ6xtycR+qlb Qz4Z92Ne5TPkReDov7lvjUPjjaeY1+aHQe7kGmkvghE9rmgG2ym93YVRO7F9Yfr5RnDG6R3 4WIJec+Ik6zBRP2jPdHCA== X-UI-Out-Filterresults: notjunk:1;V03:K0:Z1DLl04rj8I=:YNL5+aoL7z7sW8+PWSmxsw pzZQfoHKS0RgC9SU9oUGM5R9yGgv27l5sbjB3phJxOnBUr2gJNweBHLW3/tjzamolb4hEcl2Y EKF8p1K9J/fsh+07uxEYy570zOuJpWf7um/n6gR6830UsXH3U0wtK5lEvJK8lunDNxQEkQOUX 3ui4+hfDap4FuSuxg9nfm/7+yF8Zgyp+rfmKERWHErWLY5YcQp1iFh4ivnKXRgBMYZkyt6cWw i6ZJyNi5GD3MsoAo9kEDSmgXPntaW75SD+m1htZnpWCQZaUhd21hqhVk41SgK4vD0fxaddgCm QusGobRNBrbasp3zuKfEsQqdegj0zdD7+Unf7qiC8Gp0ZOdbJun9aPPWi0T+ShaCR4jesP4HT 71/EguUIwSlzO+p34m7xcqyXLidrZcuC+HHg0+9jDFIxSsaw86ppC1+9LIzTK4CBBUgOvxXmD j5EbGTiAYgkpPp9CAKUJBZHBALF4eGfswTzCIqjrAXG0fHvE8Sj6eKQ96qWYO9JAiKklCuM3r 69qh2OzMWUHJXDJxi2Jh3T0QanSxQAkcLAqXxpWfX6V05VoE0KUC2i1Zn9Ff8FKrtS05PFG8e lnY7X5doxw6724ZjS+Ik0/xtfOkpORyotzocNg4u+0gv6njvg+WHPF00sbq8Pj8YkWAKHqW0A R7ie7w3VxqVHU+y49Pm9Uj810ufA4fFJ52OXTaAF9BG45kgfRImzeC5KCbXHNhgLyH/wE/S8H umfBnQcXk+E5XIfDlg/BBo0wyq6SQcSxFjc/8bKUNNM5cwLEuL7wo1ZRWtuWm+PuxheTUGBpF isGwtPrp8/qrTAqUh00GFEwKjqOrOX5z2kXkeohd9QpOqKAct2AyBTacc2QD2Mle97WkfNPMc t6+dkMRXb/RgND1IZR9HmYMl4FpIxYnpXjxiYhyk9gBIpujPdkvP0yMUQoJSoJw8rlLBZDalM PjRq32hL4unJSIvQyLlzrXT4UjOdYB4ejLlWKuu/+FV0MbNJnlKvG1cQojyz8F1n4UATHWl4v K72bIkC71QcnJzb3qlayz2dtWdcosi2IMl+vUhadx1Y0QwZoUiYAfuIs1g4sLhc3qR3TeWfau WmjP8mFRa2+w6haemFDTH3xd6MvHwR+Jd0p Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org From: Armin Wolf Add automatic fan speed control for the remaining two pwm channels since the pwmX_enable setting affects all pwm channels. Signed-off-by: Armin Wolf --- Documentation/hwmon/dell-smm-hwmon.rst | 14 +++++++------- drivers/hwmon/dell-smm-hwmon.c | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) -- 2.20.1 diff --git a/Documentation/hwmon/dell-smm-hwmon.rst b/Documentation/hwmon/dell-smm-hwmon.rst index 3bf77a5df995..57b30fc9d03a 100644 --- a/Documentation/hwmon/dell-smm-hwmon.rst +++ b/Documentation/hwmon/dell-smm-hwmon.rst @@ -35,7 +35,7 @@ Name Perm Description fan[1-3]_input RO Fan speed in RPM. fan[1-3]_label RO Fan label. pwm[1-3] RW Control the fan PWM duty-cycle. -pwm1_enable WO Enable or disable automatic BIOS fan +pwm[1-3]_enable WO Enable or disable automatic BIOS fan control (not supported on all laptops, see below for details). temp[1-10]_input RO Temperature reading in milli-degrees @@ -52,13 +52,13 @@ overwritten. There is experimental support for disabling automatic BIOS fan control, at least on laptops where the corresponding SMM command is -known, by writing the value ``1`` in the attribute ``pwm1_enable`` -(writing ``2`` enables automatic BIOS control again). Even if you have +known, by writing the value ``1`` in the attribute ``pwm[1-3]_enable`` +(writing ``2`` enables automatic BIOS control again). If you have more than one fan, all of them are set to either enabled or disabled -automatic fan control at the same time and, notwithstanding the name, -``pwm1_enable`` sets automatic control for all fans. +automatic fan control at the same time so ``pwm[1-3]_enable`` +sets automatic fan control for **all** fans. -If ``pwm1_enable`` is not available, then it means that SMM codes for +If ``pwm[1-3]_enable`` is not available, then it means that SMM codes for enabling and disabling automatic BIOS fan control are not whitelisted for your hardware. It is possible that codes that work for other laptops actually work for yours as well, or that you have to discover @@ -67,7 +67,7 @@ new codes. Check the list ``i8k_whitelist_fan_control`` in file ``drivers/hwmon/dell-smm-hwmon.c`` in the kernel tree: as a first attempt you can try to add your machine and use an already-known code -pair. If, after recompiling the kernel, you see that ``pwm1_enable`` +pair. If, after recompiling the kernel, you see that ``pwm[1-3]_enable`` is present and works (i.e., you can manually control the fan speed), then please submit your finding as a kernel patch, so that other users can benefit from it. Please see diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c index 3aa09c1e4b1d..0e229e3dae33 100644 --- a/drivers/hwmon/dell-smm-hwmon.c +++ b/drivers/hwmon/dell-smm-hwmon.c @@ -898,8 +898,8 @@ static const struct hwmon_channel_info *dell_smm_info[] = { ), HWMON_CHANNEL_INFO(pwm, HWMON_PWM_INPUT | HWMON_PWM_ENABLE, - HWMON_PWM_INPUT, - HWMON_PWM_INPUT + HWMON_PWM_INPUT | HWMON_PWM_ENABLE, + HWMON_PWM_INPUT | HWMON_PWM_ENABLE ), NULL }; From patchwork Sat Aug 14 14:36:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 12436749 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B820C4338F for ; Sat, 14 Aug 2021 14:39:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 034F560F9F for ; Sat, 14 Aug 2021 14:39:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238660AbhHNOjr (ORCPT ); Sat, 14 Aug 2021 10:39:47 -0400 Received: from mout.gmx.net ([212.227.17.22]:53931 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234690AbhHNOjr (ORCPT ); Sat, 14 Aug 2021 10:39:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1628951941; bh=cuCSb+tpEK10weKqPO7OXjgau9kK+RABqUj4pTOTMRc=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=eAs9//CZWfsNRPqMVGJVvrRz6q8R5W429GNYeZ/ynfxZu0E4DfmI8NzGecTUmoEW7 HYAKFTj6IieQmT+N6PZ6aljzzO69k5yqUgvpjNQ4KKHhxBw5RB88DiBREcRanamR5+ 1xKfqsZpqOLQ8QAZr3XasShps8oM3o5eoq1i5+r4= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from esprimo-mx.fritz.box ([91.0.96.234]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MUowb-1mf0Hk0eiP-00QgQc; Sat, 14 Aug 2021 16:39:01 +0200 From: W_Armin@gmx.de To: pali@kernel.org Cc: linux@roeck-us.net, jdelvare@suse.com, linux-hwmon@vger.kernel.org Subject: [PATCH 4/4] hwmon: (dell-smm) Mark i8k_get_fan_nominal_speed as __init Date: Sat, 14 Aug 2021 16:36:37 +0200 Message-Id: <20210814143637.11922-5-W_Armin@gmx.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210814143637.11922-1-W_Armin@gmx.de> References: <20210814143637.11922-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:zq8B4jtIWIvgXceuJ10xcEbmViT55qzIzJTUkt5YTw5/oM0mi4R Ms2YyT0safU0gMQxjbHGp88Drrf45LOqonKXGAJUeHF2SmH644zfIOjVNblJ0sSgreZEZKi XvAJnRQcWoxCuIklv+9lRLdurrl2dl134tfXVkPGgwjIY9xN2tym3bxLY/TXlomdVYQcpuG +WvHCZFvc03PNsY2FGyDA== X-UI-Out-Filterresults: notjunk:1;V03:K0:XSIWupGOA7U=:TG22tDmZDkNpoO7jUnB0Jl CR7xReHKm7WoXnEBaSzpA6bonzNa9YQJQzWznrBVRNKIp31TpjXW//SUlYkZ/dcVM4Hpw2yns xYNk/Jz7VrMv0DMkWOfSyNiwhxmwjdV/hzJ0gK9MmNyTzhWFltpFzHgbuWrMVex14A6EZV14p blJhJLtUQUQt610lK42jQ77TqKc5bj3tnR5yJwDAfEqnyxuJFv138XATX+NphvTq2oCio88ea yb14jCIbdBU4ikcydUxj9jYbTrAwJFmL9RGNFQrf9HVTAMAGy7aQwfAIRNwiQCuxUTVkHrkyl z0D938JHalfrn39aPWvZGREBL1YbszBGl/RIW12JkUSXc4NcAOPVd2NywHSuIDzEal/xyg59k vlLEPwx9j01zm5xO+CXyZH9C2zn3BvrAsEfQycKjmyRPg8wVEVlT9NmQu5T920GU4k4sgkipN aIt1CuTj2S62nYYuV5BY96CBcP3fd12GqBGKOINDSaVWhZf9fIsx0eNciLB/oLw7QKN/jR68G XDquQTIzsHwFsz4FtbW+qzcPDo53J61L0CGkt/MCr1doLqw8/CqmCmzevN5WdstvtjiE2Q7pk M5ro23KRQT2SNVBnheRBy4kvBO7fT3e4jW5gnIXTutgkk9Vr1n4aSNYWZisIKcyseGqEnh0MO BRLy7clhECJbbRJuYgkSsTOTUXdLk67sOEvXnelGJBlF3zmhd0/eLvndqfU0ahHVVm1NQ3+rR 0DHMF1JqS9sj9avLt4YuAWHr9hwlNFeCFdBfIkjB2lNCoaaLqnrNB9RqOYn6HYXy9stNDJb+c zEZId97CwrOyIgetDzCnQH8GoFqCG8gcJgck0pyGQ+//miA5MV/n8z2Thj3tgxFQ3BLa4zb5Y 6gYNdg++6y0pI+QcvDTPLa/vrNecPcM6czNnesH38YoWCiO2vwQRvCKDwLaER0V62yK7u9Jk3 60vsL3terRkLmlCLrxWe8d53f0unpYbSjTv9FehC9f3AACQt3yy7S2GLQe+cMW9YxLDH5hPTt tbFNSoqDf+5Ubf+t5SXdBqApxN+3jUjattq6By/2FZDdqtVt8uedomJp3wjxfdXFtPF2V0HKm SIiSE9Zolb8XgwI35i/VcQTHrLoCFWrx6X+ZnmcItIr+I3rC3szxJni9Q== Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org From: Armin Wolf Mark function i8k_get_fan_nominal_speed() as __init since it is only used in code also marked as __init. Signed-off-by: Armin Wolf Reviewed-by: Pali Rohár --- drivers/hwmon/dell-smm-hwmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.1 diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c index 0e229e3dae33..8bbeeda13faf 100644 --- a/drivers/hwmon/dell-smm-hwmon.c +++ b/drivers/hwmon/dell-smm-hwmon.c @@ -303,7 +303,7 @@ static int i8k_get_fan_type(struct dell_smm_data *data, int fan) /* * Read the fan nominal rpm for specific fan speed. */ -static int i8k_get_fan_nominal_speed(const struct dell_smm_data *data, int fan, int speed) +static int __init i8k_get_fan_nominal_speed(const struct dell_smm_data *data, int fan, int speed) { struct smm_regs regs = { .eax = I8K_SMM_GET_NOM_SPEED, };