From patchwork Tue Apr 26 20:03:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 12827892 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 45F0CC4332F for ; Tue, 26 Apr 2022 20:04:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354377AbiDZUHD (ORCPT ); Tue, 26 Apr 2022 16:07:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354354AbiDZUHA (ORCPT ); Tue, 26 Apr 2022 16:07:00 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFFD0D0839; Tue, 26 Apr 2022 13:03:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1651003411; bh=NKFKAKCLTOL1m3NDU/BmygYePpH8tCNAz8bh93sKgz0=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=YImytSqdZZYWqI7qUYjSTr1dzwfu/h12OjbVsHkF1GmMJnw0vu4IM6kvRQ9GtFNAj QmEmaysmPTnFntKKElSnLRIUuXXv2Xtu/NByxtI1eLGIj3xGoJa2xu8Pmbgo1yITHF zaPXcM22EJ60gLcR8Phka2hyXRmXKDN8pIieGny8= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from esprimo-mx.users.agdsn.de ([141.30.226.129]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MZTmO-1nP30n2sRa-00WT5q; Tue, 26 Apr 2022 22:03:31 +0200 From: Armin Wolf To: pali@kernel.org Cc: jdelvare@suse.com, linux@roeck-us.net, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] hwmon: (dell-smm) Avoid unnecessary SMM calls during init Date: Tue, 26 Apr 2022 22:03:18 +0200 Message-Id: <20220426200320.399435-2-W_Armin@gmx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220426200320.399435-1-W_Armin@gmx.de> References: <20220426200320.399435-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:UG/oD1uM2BullOcRsnmVOG3PY/YNnwg9B5vCwC3rJDRzma6B3Tx dr3n/HWsJcnPFJi8xLGQa+gtijPCLNH6MPoLg+E7lrTJgJXnBl9d5xYGTFnaAusO3SpLag5 Nsy91DTELO41qATWJitLdFYNZgTwtbdGJyq3XDuoP1y4Nio+L87Zu86G8Q9eJW9QMu9ws2c vOZn4xfIFOCdE1PSZdQ9A== X-UI-Out-Filterresults: notjunk:1;V03:K0:CBOL7YLXtuc=:ZV9mNoNgcftUV1FPHE1ruO yOCs0StT1CH/pfogY7Z4Yu7JDllcsprZJH/iGCuyBHzYruHSi75mcf0S0okXQhTqjnrD6uXT9 xpZYsGI4PY/wB9N8twkXaSBWEy8WNISI5LqQPH9IHEIyNHBaMcsovWk6Q7H21hfnrA70X+ijq RkZlXrk9dpAB33Ohl2rQn1Pe/DUvqYkX+0ON7yLMGuvhX6e8aqrwMxMa71h04pzrRD37chl2i 4qa9YuPq4IZ0M0n+dxqxZMGW27zenwhG39qnqYsSmja8PFb42p4VYflWkQ0Ec2WfDluaHc5uP DE0+wTjfG/I/8FFNQ//5m6UDsbiLFiuZq236Uqg16JnAGJpc+33Ql5nxfliddmJOhZA/pE+E3 psyWTTnYFvgzYgQiKmPVHmZZn8V3ftyRm3ZrDN6bE5ze1YwFeVDz1vQFeAH7riYIBtJhjRRk7 sYukrZXVqIOzIejBNYSHx61y3sd9gCvQbknsZ6mHDTl1tF23NbFSbmK/PigO9wTcPczmn1A2Y iFbbWDclfIYzJMasEotxtInOVp1Zj52OmxjJnFz2wSfdu/oRRNQzREPC7mnSS8rNYht96TH62 lzyApTSL7bgSS4MoxZ96JE1jHhBdiARnKHs8j69jGY9AnOED0P73buCHqneNKoZaJQw9nBWsG 4KANLCYemL5XK+M3nzClmSF6Y3NqW5gujuTr0QhPZ7jzNJwczCDoui9MDhlmnzOxY/D+SZfex B1oe2KO1zWRZO0MxUtOvTAAxM3Pq7gmOcDbDREjg68S7w8spqEwfpcjyIPAthPZbuiRat1eDW TpxKyRrd4XwqgoQw7BQlLESbVRW9Uok/MHnUMCtpzxBN+MKG68Dr/Y/yrzsvPppHqumfn41Tx bBjUqYl3/RpbJp97STFGuzjP7/sIEbA+JYBwv0wKrPdR8iM+uhHmvTw3gpWCdOqmUPex0c87N QxYqpioUrI6k85qSAnXH4t5vRO/awH7ID/UbSfkw3v2QEDtd9E4U62lSEabp3TXR4Uia776Ua bV28tcgdaESvT3LenvAYosDVoSykXnBf8WeOMVWs6SAkuvN1bxKorGh/Ty1Sj4VpkpdmKZhHD YWrWeOYwhGS+8A= Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org When the driver tries to detect the fan multiplier during module initialisation, it issues one SMM call for each fan. Those SMM calls are however redundant and also try to query fans which may not be present. Fix that by detecting the fan multiplier during hwmon initialisation when no extra SMM calls are needed. Also dont assume the last nominal speed entry to be the biggest and instead check all entries. Signed-off-by: Armin Wolf --- drivers/hwmon/dell-smm-hwmon.c | 37 +++++++++++++--------------------- 1 file changed, 14 insertions(+), 23 deletions(-) -- 2.30.2 diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c index 30b6f0c28093..202ee884de9e 100644 --- a/drivers/hwmon/dell-smm-hwmon.c +++ b/drivers/hwmon/dell-smm-hwmon.c @@ -50,7 +50,7 @@ #define I8K_SMM_GET_DELL_SIG2 0xffa3 #define I8K_FAN_MULT 30 -#define I8K_FAN_MAX_RPM 30000 +#define I8K_FAN_RPM_THRESHOLD 1000 #define I8K_MAX_TEMP 127 #define I8K_FN_NONE 0x00 @@ -326,7 +326,7 @@ static int __init i8k_get_fan_nominal_speed(const struct dell_smm_data *data, u8 if (data->disallow_fan_support) return -EINVAL; - return i8k_smm(®s) ? : (regs.eax & 0xffff) * data->i8k_fan_mult; + return i8k_smm(®s) ? : (regs.eax & 0xffff); } /* @@ -776,6 +776,7 @@ static int dell_smm_read(struct device *dev, enum hwmon_sensor_types type, u32 a long *val) { struct dell_smm_data *data = dev_get_drvdata(dev); + int mult = data->i8k_fan_mult; int ret; switch (type) { @@ -804,11 +805,11 @@ static int dell_smm_read(struct device *dev, enum hwmon_sensor_types type, u32 a return 0; case hwmon_fan_min: - *val = data->fan_nominal_speed[channel][0]; + *val = data->fan_nominal_speed[channel][0] * mult; return 0; case hwmon_fan_max: - *val = data->fan_nominal_speed[channel][data->i8k_fan_max]; + *val = data->fan_nominal_speed[channel][data->i8k_fan_max] * mult; return 0; case hwmon_fan_target: @@ -819,7 +820,7 @@ static int dell_smm_read(struct device *dev, enum hwmon_sensor_types type, u32 a if (ret > data->i8k_fan_max) ret = data->i8k_fan_max; - *val = data->fan_nominal_speed[channel][ret]; + *val = data->fan_nominal_speed[channel][ret] * mult; return 0; default: @@ -1071,6 +1072,13 @@ static int __init dell_smm_init_hwmon(struct device *dev) break; } data->fan_nominal_speed[i][state] = err; + /* + * Autodetect fan multiplier based on nominal rpm if multiplier + * was not specified as module param or in DMI. If fan reports + * rpm value too high then set multiplier to 1. + */ + if (!fan_mult && err > I8K_FAN_RPM_THRESHOLD) + data->i8k_fan_mult = 1; } } @@ -1359,7 +1367,6 @@ static int __init dell_smm_probe(struct platform_device *pdev) struct dell_smm_data *data; const struct dmi_system_id *id, *fan_control; int ret; - u8 fan; data = devm_kzalloc(&pdev->dev, sizeof(struct dell_smm_data), GFP_KERNEL); if (!data) @@ -1414,24 +1421,8 @@ static int __init dell_smm_probe(struct platform_device *pdev) dev_info(&pdev->dev, "enabling support for setting automatic/manual fan control\n"); } - if (!fan_mult) { - /* - * Autodetect fan multiplier based on nominal rpm - * If fan reports rpm value too high then set multiplier to 1 - */ - for (fan = 0; fan < DELL_SMM_NO_FANS; ++fan) { - ret = i8k_get_fan_nominal_speed(data, fan, data->i8k_fan_max); - if (ret < 0) - continue; - - if (ret > I8K_FAN_MAX_RPM) - data->i8k_fan_mult = 1; - break; - } - } else { - /* Fan multiplier was specified in module param or in dmi */ + if (fan_mult) data->i8k_fan_mult = fan_mult; - } ret = dell_smm_init_hwmon(&pdev->dev); if (ret) From patchwork Tue Apr 26 20:03:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 12827890 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 B081AC433EF for ; Tue, 26 Apr 2022 20:03:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354373AbiDZUHC (ORCPT ); Tue, 26 Apr 2022 16:07:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354360AbiDZUHA (ORCPT ); Tue, 26 Apr 2022 16:07:00 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF2A2D0A84; Tue, 26 Apr 2022 13:03:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1651003413; bh=4y7a+bBwn4/79Epm4BmNa0CGyOh0yDIBQXKqeowWuy0=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=TwYIhOsb2Y/j2NgniRB/kad1ApCnPPxJ2P+gFbRY39Q7CmvklJs7XkmwxIJQNIhOh yQpJLFF4Zc9aO0zEEaJnFgrqvR5AP2MDP08rDsxrnf+k8SiZkTvHOS6b9R/GeqXJ9k f+etfW/fPRVy4LZJEWYjwptQ4KJoYRfY+MAws8Ec= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from esprimo-mx.users.agdsn.de ([141.30.226.129]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MacSe-1oH8bG432Y-00cAoJ; Tue, 26 Apr 2022 22:03:33 +0200 From: Armin Wolf To: pali@kernel.org Cc: jdelvare@suse.com, linux@roeck-us.net, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] hwmon: (dell-smm) Cleanup init code Date: Tue, 26 Apr 2022 22:03:19 +0200 Message-Id: <20220426200320.399435-3-W_Armin@gmx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220426200320.399435-1-W_Armin@gmx.de> References: <20220426200320.399435-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:OrM8TIIArC8cx/RIVY+mTjYUJR1mkdJJxuMTfFUCG657uKIXT3K jKTGrkq/jfOAQy6Jm9VhUioM/zFk5piwO1ipISdwHAHCxVWvkW6bzL+UF8L+AmREqXzQU0w fnbTMNJpJPRWXytlqXpCpP6R4XolwkEr4H1oOv3mUQP3yKNd+4lW5ME3iDlt+OCwW2w7jwm OYyEU/7XltrRXiQAjHNqQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:R5xHMep9C80=:8XZmPFdG+vtlId2Jh55crI HHul3s4dc7z7vA07i61nwZ8Eq5eWPp6TaudxY2yAtwE2Bp+0CLA/OP+pLgPyXJu/FFkmTDGZX F+h7wjsSxDdZaw6l6GqWkUo8Osxc+/k0TaVjPlmMmC5cO7HgMdcyuRqvxPuFxVt3v1isONGCa 5dqmzmVU5G93MEzI32WTTtsKrxEMjhYcTmTXX6umOkK/sZTcHjm4Kh2gO1O9w+dv8yRiPaVj9 pjhzMKXx85BSWiVrUiZVVG062vRX0YtJpOVzuf9y+IvNpEEwVJnRmAgAbdAkuOMIBhdTry4kE ZYZtwGT6Mvk25FCiLW4A7aBLPuJvArxIV/0wUA97tWePPhEL2fr8i7UQtaEkh2x5MIB6DznAs qNIx882M5gYLH5A4HkRkmfYw0L2JfAsyKp1qbxo2RkooIwv6PKHV905VukrtRiQCsGKBZiuWp UQvlCJ0w52VBbPhJGA6th+b0PyNZSHy+hatzBBFgRr3mH96bx7kf3QnUWrW93Q5zLPtNBX1xa aEygBgvLgZERUijdLRb5jcaWKxb1L7Y4AtxJeI1ahbFdXWk1EwTZq0nnPfylGzuuapZyiO/tE uvdqYyx1jbm/Bl5SX8L1AiBJ8aUGk2o+bRexK/8YjGYL12BdoraJxXaqWyey+Xvu51lqN6J7G wPBlkLJgqM1cy4a1tLsDU08ACPRYyg78KoYys5LEHYxgRo/PIzgIII4SGUWTkJV19i+tc77gX mzHNcDQge1VHWlt2osvJx+1JRSkNefKqa5LIk1itHhV7m4bBpvf0KCAxFZ5CIEUHK8GW849Wu LzQ+W0L3xuym6M8/2xnvizH4ztC3vTbS2LFKns3vNRg+yKKZ4GVpFPKXDWDjSOebdty10ZlKf H9rJ1OxVvnvJ+/dB13HSWqHbC1GTCvrOIHi/BxCkXbcbl0gXJlS6DQ778xzk2wOS/s3qc94mw NJ3mXgjmZAciEvvQuO2JJz2LHYtj6FLzZmv30iFGarzmoufm8dcwmOpjn1CWYmB6ImPlbFvQ0 5KxwxncrXVlGSu97qsSnCBTowgWa4hA4CIVUqSF471hGD2Or/GnCVtArpqVKIjp9Wtwc0iaoQ CpeAad187Euv7A= Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org The default values for i8k_fan_mult and i8k_fan_max should be assigend only if the values specified as module params or in DMI are invalid/missing. Signed-off-by: Armin Wolf --- drivers/hwmon/dell-smm-hwmon.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) -- 2.30.2 diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c index 202ee884de9e..f13902414615 100644 --- a/drivers/hwmon/dell-smm-hwmon.c +++ b/drivers/hwmon/dell-smm-hwmon.c @@ -1373,8 +1373,6 @@ static int __init dell_smm_probe(struct platform_device *pdev) return -ENOMEM; mutex_init(&data->i8k_mutex); - data->i8k_fan_mult = I8K_FAN_MULT; - data->i8k_fan_max = I8K_FAN_HIGH; platform_set_drvdata(pdev, data); if (dmi_check_system(i8k_blacklist_fan_support_dmi_table)) { @@ -1409,7 +1407,9 @@ static int __init dell_smm_probe(struct platform_device *pdev) fan_max = conf->fan_max; } - data->i8k_fan_max = fan_max ? : I8K_FAN_HIGH; /* Must not be 0 */ + /* All options must not be 0 */ + data->i8k_fan_mult = fan_mult ? : I8K_FAN_MULT; + data->i8k_fan_max = fan_max ? : I8K_FAN_HIGH; data->i8k_pwm_mult = DIV_ROUND_UP(255, data->i8k_fan_max); fan_control = dmi_first_match(i8k_whitelist_fan_control); @@ -1421,9 +1421,6 @@ static int __init dell_smm_probe(struct platform_device *pdev) dev_info(&pdev->dev, "enabling support for setting automatic/manual fan control\n"); } - if (fan_mult) - data->i8k_fan_mult = fan_mult; - ret = dell_smm_init_hwmon(&pdev->dev); if (ret) return ret; From patchwork Tue Apr 26 20:03:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 12827891 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 0BBDFC433FE for ; Tue, 26 Apr 2022 20:04:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242279AbiDZUHG (ORCPT ); Tue, 26 Apr 2022 16:07:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354376AbiDZUHD (ORCPT ); Tue, 26 Apr 2022 16:07:03 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 792D4D39BD; Tue, 26 Apr 2022 13:03:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1651003414; bh=dwQ/oJsstgp3sXzO0lD5phczdkjblax81CWSGX1LRCQ=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=AMGjgK0tWjsAIT8JpKvCwz5HvtSjgvG5a8yflowv3eSJ/gLBPZxVhwSXjupcUlkgw VM+ShuoHvaQnI7cMjgEAlj5iUhKeEm4WPQFpBu8KjqyKtJp12BCyuusQZ7u4ovLKQ6 5GrWWtqupvITnVSYMvdzSk3BWHfAiyt8emV1h0Iw= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from esprimo-mx.users.agdsn.de ([141.30.226.129]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1N0oFz-1o6s8h2c9V-00wlCY; Tue, 26 Apr 2022 22:03:34 +0200 From: Armin Wolf To: pali@kernel.org Cc: jdelvare@suse.com, linux@roeck-us.net, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] hwmon: (dell-smm) Warn if SMM call took a very long time to execute Date: Tue, 26 Apr 2022 22:03:20 +0200 Message-Id: <20220426200320.399435-4-W_Armin@gmx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220426200320.399435-1-W_Armin@gmx.de> References: <20220426200320.399435-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:dFp0ZNEGgx7+jRlwf66xvqbIMjDqxrW0ksKrB4Pw0HFSg0DKlg0 iFKOn6yK3E9CNnQdfjeILpF0ZSa1l2iylFkza5Bl1c+yi+NhvAwcxIGklADKfY2FqQc9rIv rsxtTj3xh+RLdKVp9radulvOIDcurd0/SdqUM27w8QNrnb3fRdY2zUOiZXNSCkza0l7toYF Co8wuc0HclKeG0YBVh7Ug== X-UI-Out-Filterresults: notjunk:1;V03:K0:ddcqQL6Aifk=:cCulL3BZDhwyQyjUChxMFJ 9thc0V0qIR/ktzBS3Sg3jIx1okrQWRr3B23D3p6zbP/oVy5EgFYb58KY+iTCW/MmbbyIdg9zn /E2czd1woN9wfTS0PpB3s2cPHLaaLJVdrY1ioA+XFNvvTk0DnVe0hBeXrIAnfRBTv/Sfx/7VX j+x8EBmheMb5ilVulH7GQ+TRjOpMNgEv+gni3FvrawDuFTHFKH95Qr7rN0PazDWSoxvMvXJGy LT2EuGhBf3wH5GTK5KqZma6uuCw8kg3L8VSw1wrKnRI7T4suT+Gyk1xFBdwfFMxPwsLWCbEf+ CNBtmq8m1g1aAncGZq3+LVkAP6cCL96m9NztICiNGwpybYekE21s1awpQGpHP6KRjWMM1DmCg bAqW//odPvzE6FJjwrdulD+rcqn4xhbF+lsjWOoj1AKJyV+YoNJr93Eq+0L1YwaF7ttTem5xQ 56X10sTHxtw5xaLfyGk0YtcQxcnSan4KmDm4BjMVXavv0NKaek8cbFWBaZTl7xjkty3WB6vTw uXVb1xRv7YkwIWL67eo/9AV6E3srzWJZeHjF6Ts6w2zDj4Q/34ffjf9SHnyFGEoDxaF2msq2r 9a17uQtiKGzmIuTto0A/Z4gwAOPyljsVYkyBYswNEyt3LIlJKi/Pv9XAQeJ7UhqadKEvJr0iE Z+XcqeqAwVqIx7aOAhneQiJzWU+vCYGcZ9esCtay0oeqIUt8hDM5lKKmLz1Zgok1s28VHik1x vqyS6+IVT7KlnpWAtKs5pX7OpdoovvbwufMkW3A4VXW4ojsg8Ps6WtqhlTbF1owE+vwuep5oW TkozPtvwliL9M9QFmAaBomiwefU835VYmim2eZvY5UKmjUnBirH56Dch3YUndxb4kFIoZa6xQ jrEYSNEyndw8VzGUn7IcspN6gJsnNgCgrEgs6jnjideQs50gjJ49o5Zd1GdnWaRvCnag39lcr iXIyXtZrkOlGN19G63+ffU8+HOZbjdXw7aLA3B3hnL3kkEsOhsWKP4C5CwYciuG9Z7CUjvU5o 81G0/1QYvTUy/13q2bZILDHOwMNPT3FPtLZjAGuh9gQ4Jqt/Iffb7r8eRQd4tMyFW3qH5poYn 1AyTZWByp+nEtY= Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org If a particular SMM call takes a very long time to execute, the user might experience audio problems. Print a warning if a particular SMM call took over 0.250 seconds to execute, so the user can check whether or not possible audio problems are caused by this driver. Signed-off-by: Armin Wolf --- drivers/hwmon/dell-smm-hwmon.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.30.2 diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c index f13902414615..b960330eaded 100644 --- a/drivers/hwmon/dell-smm-hwmon.c +++ b/drivers/hwmon/dell-smm-hwmon.c @@ -49,6 +49,9 @@ #define I8K_SMM_GET_DELL_SIG1 0xfea3 #define I8K_SMM_GET_DELL_SIG2 0xffa3 +/* in usecs */ +#define DELL_SMM_MAX_DURATION 250000 + #define I8K_FAN_MULT 30 #define I8K_FAN_RPM_THRESHOLD 1000 #define I8K_MAX_TEMP 127 @@ -239,6 +242,9 @@ static int i8k_smm_func(void *par) pr_debug("smm(0x%.4x 0x%.4x) = 0x%.4x (took %7lld usecs)\n", eax, ebx, (rc ? 0xffff : regs->eax & 0xffff), duration); + if (duration > DELL_SMM_MAX_DURATION) + pr_warn("SMM call took %lld usecs!\n", duration); + return rc; }