From patchwork Mon Jan 31 09:33:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 12730489 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 480F9C433FE for ; Mon, 31 Jan 2022 09:34:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234461AbiAaJeh (ORCPT ); Mon, 31 Jan 2022 04:34:37 -0500 Received: from mout.gmx.net ([212.227.17.20]:35521 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231674AbiAaJeg (ORCPT ); Mon, 31 Jan 2022 04:34:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1643621659; bh=JpB5EeGsjEKA7C7A6LOk7832eX0tDl/y70K+UIb+d8I=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=KjWRrrz1sczRuvggC8OOTPGY2jrtcydXdkOZDHau+YRwo1Z2YvF/KK79zH3/x+QKl T8zmKESeU+TkymzbbuzIvHmSfHEMRVVDcHfoWJ/JOh53beMc8oV+OncCDKFiHI8UVc 7rgE4hE6k5qY2zzLZ72nd1+6O20OFMMvVtxyIRSA= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from esprimo-mx.fritz.box ([91.137.126.34]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M7sDq-1n9XOD0fcw-0053u8; Mon, 31 Jan 2022 10:34:19 +0100 From: Armin Wolf To: hdegoede@redhat.com Cc: jdelvare@suse.com, linux@roeck-us.net, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] hwmon: (sch56xx) Autoload modules on platform device creation Date: Mon, 31 Jan 2022 10:33:52 +0100 Message-Id: <20220131093355.4151-2-W_Armin@gmx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220131093355.4151-1-W_Armin@gmx.de> References: <20220131093355.4151-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:YBqp8P0wkVbVB7v6/1o8rlRTjltXrwcyC5K9gGgphwLXgRFYSKj g3ujGfuFTo2wQo0xNBfSTMMI6KUkrEbwrd4QExH1uO8vdk9bWcSUbZ5fnApjolZyDzto9J5 TxNAPVAtcECuGbZ7MpMJLJkZgY2KBIXBXW/wz/AjLZVVwV1i+Y0pVnoSC0ZEMHniDt7hQT1 q4z9gxNAXt5rxn5SHQB6w== X-UI-Out-Filterresults: notjunk:1;V03:K0:IIQKrkXR5Hw=:Rt15BVE14eKtMQtqeSXIoP pmNcwMFC0ymvGtHM1bp38TlmyPK77/qkTMkL4Yf+4GQE+vtqVmficRUv3fhfNHSkSuzbsnMMc dRdb3fOyi/HnoheWEyVuUyETrXjalzJLw6ghrQPKnEVCqbng3SO4dnOS5erK25yjwND4qVYAm y7amLjqC5TmdhZIeD8KQDNhJ7hJkWa9PzEqODopCvZ6O/IVVqpQDlixASIhnDoeg0fiufT9YG NqaGn7ZNISTLCG2pvUPirNRU4VFX1Y8nXTH66gK7aaGT/qHLqNwDvA2s2pl2qd22fFn5Ep6vu LvOjTTxk4SHJ6ysKM3jA1UmQpmmmu1GenGlvKM7toy08rzEMTVHaT86WUglNQhx8Y194n80eD rh5HLKTAG48Er00eUqVjDDFnfyRyhmJW4KsNCWNsmXvRODRhtYqPIPHG2pz7fZHa4JkAkhCeH 9Kpw+d34OZodAgaX4R7fSVYemhj4j2mcRKQ7aTbUOwx5oJzdElibGP9D98CbBL+8blXTZGME6 ez1wFZ2Jc0FOwz5GfQN2AOVRn/vLvYjS3OLRu/4H81g7MZmouqDBOXH69H6HHzBUwRdd+Qqrw cyBpq147VvsktUSVUQYH2OXlGTiXYqX0SV9C8Jt/kr9zLQbqAyg1nCgisCLfcyVNmH3i21UTf yBx8YNuNifqBcRBzhx6hWRdYQ2TcccAF6kTy3b58h85SJlJG77yAuNKyEu1w9qFUnyeyB+sVj f4vcGIBDBwTTS2sNEg/5FE0caxvy1KFmGFR5uWIBnKwrpiKmipOhoo/I2/AAEW5Laso5+Cjdy 8A9sqIZZwEg0q/4BerSJnD1dWMUUsfpNDo/u2MvrulM9JdfPnzMZkWWay2YRjDaTqdTLLDAVG lITvN024efiBbNaOEfNHi+WAnKDMcHE5uTWXVllDYmDEV1e6Ar4RfCbQTTNn1QabrzEFTT+hH QYYrQtBv4VwSNNv3XgMaFm6UZplMuuGn/5P+8UYK4MXFBjjUthWj+lWKUTMkGfQt7Raf90t0C uYbNI42HfG0tcR1T2QCphw5akTvODVtJkbCNDiGzbke7M+daju0Q5DamjjX1EgeZ7vQ/S9oaR RSdHDb6cY+6m3Q= Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org Right now, when sch56xx-common has detected a SCH5627/SCH5636 superio chip, the corresponding module is not automatically loaded. Fix that by adding the necessary device tables to both modules. Tested on a Fujitsu Esprimo P720. Signed-off-by: Armin Wolf --- drivers/hwmon/sch5627.c | 9 +++++++++ drivers/hwmon/sch5636.c | 9 +++++++++ 2 files changed, 18 insertions(+) -- 2.30.2 diff --git a/drivers/hwmon/sch5627.c b/drivers/hwmon/sch5627.c index 8f1b569c69e7..bfff27d6c736 100644 --- a/drivers/hwmon/sch5627.c +++ b/drivers/hwmon/sch5627.c @@ -7,6 +7,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include +#include #include #include #include @@ -456,6 +457,14 @@ static int sch5627_probe(struct platform_device *pdev) return 0; } +static const struct platform_device_id sch5627_device_ids[] __initconst = { + { + .name = "sch5627", + }, + { } +}; +MODULE_DEVICE_TABLE(platform, sch5627_device_ids); + static struct platform_driver sch5627_driver = { .driver = { .name = DRVNAME, diff --git a/drivers/hwmon/sch5636.c b/drivers/hwmon/sch5636.c index 39ff1c9b1df5..9ef43cbfc830 100644 --- a/drivers/hwmon/sch5636.c +++ b/drivers/hwmon/sch5636.c @@ -7,6 +7,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include +#include #include #include #include @@ -501,6 +502,14 @@ static int sch5636_probe(struct platform_device *pdev) return err; } +static const struct platform_device_id sch5636_device_ids[] __initconst = { + { + .name = "sch5636", + }, + { } +}; +MODULE_DEVICE_TABLE(platform, sch5636_device_ids); + static struct platform_driver sch5636_driver = { .driver = { .name = DRVNAME, From patchwork Mon Jan 31 09:33:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 12730490 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 32B9CC433EF for ; Mon, 31 Jan 2022 09:34:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231674AbiAaJel (ORCPT ); Mon, 31 Jan 2022 04:34:41 -0500 Received: from mout.gmx.net ([212.227.17.21]:47037 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237158AbiAaJel (ORCPT ); Mon, 31 Jan 2022 04:34:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1643621664; bh=q1ugW5vj4OYyvuTgfzR5w8vCHi9Ca6RP1hz9efhCLfY=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=Qq2XyU5quH2Q0nKeLaO+Qod9bI8o/nER4mLHe1l3wxMhtre6rtV7tSKzNNhrS/uyx TtsRtjp5ysx9AKlwaUaa1N+/p4bW3w5LnRrXgrUL/8J/U6pXPPlWATuiqXaKzNwuEy 5dgVNb1PGlGtyS4m8djB9fjyG1S+JGBHls5uINzQ= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from esprimo-mx.fritz.box ([91.137.126.34]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MKsnF-1mxkVG3Ffx-00LEO5; Mon, 31 Jan 2022 10:34:23 +0100 From: Armin Wolf To: hdegoede@redhat.com Cc: jdelvare@suse.com, linux@roeck-us.net, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] hwmon: sch56xx-common: Add automatic module loading on supported devices Date: Mon, 31 Jan 2022 10:33:53 +0100 Message-Id: <20220131093355.4151-3-W_Armin@gmx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220131093355.4151-1-W_Armin@gmx.de> References: <20220131093355.4151-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:mVazlSPVK2m4wLCRleXR3nyUTO4qisCiTeNqCAr5x1fpRN+US9a QoQJlN7xyWdHhj0DTsIU5VbF3LPeSNR0QdfiX5hjyXlWBcvPrEaZiLU96FIzBiZ9L8Su3Z0 YTm67LA3fn0mzC59zq5/RSJ1k0v9XYv2gDrPA585n7SfgyxwuAJBleNByHohQ/2pxbSlMBL tpvdEfkPG+0Qjp0OMpTWw== X-UI-Out-Filterresults: notjunk:1;V03:K0:BCE2fFlhSCU=:KGsXIcdheotSwPr2Cb4pw3 A3GCVjCEiMDstEY3meXjUkQt7LGPL1qxQvTQ7dlLzUxygc8e2dWd4CKjI8Tfbk/f0sEx3LDE0 U+CrqBt8CFmbgeMmxwBTeWCKBEyDRHe+/nNfk/rGu9tdbLgQO/TIHMKCt/b17BIuibGqLci6A v5//KuOmXHFZ4POj7L+/APYVEyF5rEvjj0oFsns7izv8PLvkmwpaTypsoQAGpm/pg+Y9nRu9P kd+pyzksmkNel48LYsrKIQZtMsFUM0XEEC+hlT//x03wg3Qr7S/DuXb/45txtlT0tP32VXZEA UxnW3Ntszr+wDp8t7YLS4wKoRUrRyWLK4FLMRxayxuYa5OH9EGrhKfDYLnoXyBSSKFaKHp3R5 ATsZKceRYJIKowi8WdZYnD0rTbRKnO7s6LWD81+Oqa0kaKNVGu7Yxrv7O4zl+RXY23lz+nScJ 88Az58svlrrVNgtqZAeAe7hnmOd+djegSEqzV4hBYJ4eyVKWMizI1spz2y5OOKiACQBrkYZrY Fo+GAKfSIW96uPe+R4QEyf2vmhl01jEWjFv+gl3NEBAXROoN0MOrPSTpZWmJVrG05wFXh/yIN wiBfpclup54Pbod1W2YvDSLd7Ym8xuo2nvOmxW0U28RWWKF7SzjFF6N/FmUjvO3YlsOjIzDY9 H6CdGs7RxOt+XeO/NrUw41pI3i6lDw1vs8AyiJ1cAyEU3V/Uyu1O+S0zTuBsUkgW9U4/8k1WO TKiZ5d0WCcRcgeS5x7PeyfamCP05+h7ENQTNu0IYKT6CB9U4Hw24KFJlgQP8iXnejsP7YB0+k fy60wlVBEcHDEcjL69pKNJHuaxOusok0D+JMJNuWbg9ga/0da3SOdMDn8kIqUQB/rbBuqztHs y1W/dzRBXD3QC13ZgxMyhYSuLZQhS8Mv9gpB3Ti877DdRhPEaD6UbUd/BSaUej2r3U6yhlRHZ seM+WfTEvr4tw59o+2Jss3oguXH7n6Nofqx2ZvZi5swW4THYItnqMC582RcQML/j+6KVwSFZ6 r3bBzepKAOZ+0vFRPmHyFK0c7FSd+FkaG/5defQJdF8rd22oDqHmtW2Q1I2CDunUkKcnuzGIq 6Ci7owVopW6rDg= Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org This patch enables the sch56xx-common module to get automatically loaded on supported machines. If a machine supports Fujitsu's SCH56XX-based hardware monitoring solutions, it contains a "Antiope"/" Antiope" dmi onboard device in case of the sch5627 or a "Theseus"/" Theseus" dmi onboard device in case of the sch5636. Since some machines like the Esprimo C700 have a seemingly faulty DMI table containing both onboard devices, the driver still needs to probe for the individual superio chip, which in presence of at least one DMI onboard device however can be considered safe. Also add a module parameter allowing for bypassing the DMI check. Tested on a Fujitsu Esprimo P720. Signed-off-by: Armin Wolf --- drivers/hwmon/sch56xx-common.c | 40 ++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) -- 2.30.2 diff --git a/drivers/hwmon/sch56xx-common.c b/drivers/hwmon/sch56xx-common.c index 40cdadad35e5..0172aa16dc0c 100644 --- a/drivers/hwmon/sch56xx-common.c +++ b/drivers/hwmon/sch56xx-common.c @@ -7,8 +7,10 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include +#include #include #include +#include #include #include #include @@ -19,7 +21,10 @@ #include #include "sch56xx-common.h" -/* Insmod parameters */ +static bool ignore_dmi; +module_param(ignore_dmi, bool, 0); +MODULE_PARM_DESC(ignore_dmi, "Omit DMI check for supported devices (default=0)"); + static bool nowayout = WATCHDOG_NOWAYOUT; module_param(nowayout, bool, 0); MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" @@ -518,11 +523,42 @@ static int __init sch56xx_device_add(int address, const char *name) return PTR_ERR_OR_ZERO(sch56xx_pdev); } +/* For autoloading only */ +static const struct dmi_system_id sch56xx_dmi_table[] __initconst = { + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), + }, + }, + { } +}; +MODULE_DEVICE_TABLE(dmi, sch56xx_dmi_table); + static int __init sch56xx_init(void) { - int address; const char *name = NULL; + int address; + if (!ignore_dmi) { + if (!dmi_check_system(sch56xx_dmi_table)) + return -ENODEV; + + /* + * Some machines like the Esprimo P720 and Esprimo C700 have + * onboard devices named " Antiope"/" Theseus" instead of + * "Antiope"/"Theseus", so we need to check for both. + */ + if (!dmi_find_device(DMI_DEV_TYPE_OTHER, "Antiope", NULL) && + !dmi_find_device(DMI_DEV_TYPE_OTHER, " Antiope", NULL) && + !dmi_find_device(DMI_DEV_TYPE_OTHER, "Theseus", NULL) && + !dmi_find_device(DMI_DEV_TYPE_OTHER, " Theseus", NULL)) + return -ENODEV; + } + + /* + * Some devices like the Esprimo C700 have both onboard devices, + * so we still have to check manually + */ address = sch56xx_find(0x4e, &name); if (address < 0) address = sch56xx_find(0x2e, &name); From patchwork Mon Jan 31 09:33:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 12730491 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 8CEBCC433EF for ; Mon, 31 Jan 2022 09:34:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237474AbiAaJep (ORCPT ); Mon, 31 Jan 2022 04:34:45 -0500 Received: from mout.gmx.net ([212.227.17.21]:37759 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237213AbiAaJen (ORCPT ); Mon, 31 Jan 2022 04:34:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1643621667; bh=mJxsPYb64pkiiR8ddTh3vIBADHaclB5tW+tmgCYuZ4E=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=lYQxqt9bQ6Cop3NuANiaRG+yian7UOUkXziN2OVmUKywYC6SXBEeDc6UEJ1sv9Rmk rsN3yOft2uh0QMZXt06lG6jbMSassMyfYfMWd2UIBHqm4T24iTcoKOG/AtYPXCQ86T +P09HjjYLMPuM3QzEr2Mob49p83fHpUEib7AUxI0= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from esprimo-mx.fritz.box ([91.137.126.34]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MhD2Y-1maCeH1RHG-00eOtj; Mon, 31 Jan 2022 10:34:27 +0100 From: Armin Wolf To: hdegoede@redhat.com Cc: jdelvare@suse.com, linux@roeck-us.net, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] hwmon: sch56xx-common: Replace msleep() with usleep_range() Date: Mon, 31 Jan 2022 10:33:54 +0100 Message-Id: <20220131093355.4151-4-W_Armin@gmx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220131093355.4151-1-W_Armin@gmx.de> References: <20220131093355.4151-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:tA6BvuD4UvBVFdOvitVnF1aeASTSfEN/LrkIoxpwrpsrY01xZ8Z p2JojdpHEyOY15D5jYlaHy4B4gHzPinD1KfLLqVCGbOSUqbFBaHDavq/8T0vwjZV1d6UAlC 116Pn0EHQKT8nNmWdZS2mLk8ZiiAGq6am1epBdUSDguLwBBXGhxOiyGFvVdOWRNoaJ5puuh l5t3M9DpRuBEX2h2gJzWQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:h+RcR6NF9xE=:9zOJKpdegMOmhWOwsv5kEi eAIJwMtPlyGRPi7bHGVl1mg3MOLeTYpBQzVt7GjIaJ9vBdlFg/qEX1clF20/mPnlHcDgtYyaq sNyINp8TrT/8FiWjcwe85VcVEPzOm1gg6GiAyS+nSVvwDSFJ32r/i95LImqW6wQUBuMM3jQW2 uWYNtRwVYVmzz0zXlJBMI8zUy1L1qsLY6h7qn6R7Y00steQoTrz2r5oFiPjt/EIy7A1t93ZT4 2w9sSVWOd9pbwUKIzbcvmX1ttvfPETtCy3gGCmrX/neBpXZ2iD3+4Kh/HW9zfCPQChAVSSZkv a1GuL+hS+LTNp6gKtWyJwvqYbhGa+SUO8JOqcs+LMInDWD1L8a84moceW6M07WXpMtk7TsgP9 jhuVDIT2qmKAUBVL+BCs/aaA41X+34va8r/xG8T8Dl+iDhjV3qxY70G5c75Rixgks30AIQS4p JEOVzT+bJWFjFHv+irJQKKJO11YYRjLZI8t8dTUrI7uC0u1h9KP/11u2tN9VPzC07NEVMu/zk gUCjwzi06rL+OvjgZ8VL8dWlelT/0R0Dg/fEO5MtZftgCpd4/sXGo55gCm919ZbHc9QDaxaMo TADKSAQ9k7Nvf8+mIrrfvky4f0k6qcUiTXh+vhgJqqmzKWl2p9hM1PGESZMVnbIjEMPJeRiyX jmZoDdziWkVWjuXVMLvq0rEPUgomMH+hBNg3u8K/tmgpLyL7U3ztebdFwV89rQmtlY5Utlzss DRIKqBhWRFt0v0gJVbrSHcxL0TSPwBBItV39Jp5XJe+v3JZhMzVZrjOGw1uAbOTELEsLXhRdL sj4eS58HvZ8diGwt6tKKEkiOsfipZI5Sfak/+iM+2CTQJjf/TP+92beHnSVa2cxtTT+t0JjpX HOB4brbORmq/suFNDQFgQSdVWIhK0M8tomhyZP44kMGIh1OIxhlYN4PHd/sILDUUU6Bzmh0x9 ypkT1Kgqs69eWoFHoGW7TxRmTNMwYHRqW5pDLJcXECggY0PuFMkIRqVkwszjnyJ5wo9/oBOdo 2OZFk7sayAHQhzC34/3XkGAbmn+Fmweo38i5K0B9OBIZ8x8yEI22OjDIU7xkdIfUPHjISUQ4r qrkmd8MffvWfbw= Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org msleep(1) will often sleep more than 20ms, slowing down sensor and watchdog reads/writes. Use usleep_range() as recommended in timers-howto.rst to fix that. Tested on a Fujitsu Esprimo P720. Signed-off-by: Armin Wolf --- drivers/hwmon/sch56xx-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.30.2 diff --git a/drivers/hwmon/sch56xx-common.c b/drivers/hwmon/sch56xx-common.c index 0172aa16dc0c..f66e1ed4b1aa 100644 --- a/drivers/hwmon/sch56xx-common.c +++ b/drivers/hwmon/sch56xx-common.c @@ -139,7 +139,7 @@ static int sch56xx_send_cmd(u16 addr, u8 cmd, u16 reg, u8 v) /* EM Interface Polling "Algorithm" */ for (i = 0; i < max_busy_polls + max_lazy_polls; i++) { if (i >= max_busy_polls) - msleep(1); + usleep_range(1, 2); /* Read Interrupt source Register */ val = inb(addr + 8); /* Write Clear the interrupt source bits */ From patchwork Mon Jan 31 09:33:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 12730492 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 B2C13C433FE for ; Mon, 31 Jan 2022 09:34:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237465AbiAaJes (ORCPT ); Mon, 31 Jan 2022 04:34:48 -0500 Received: from mout.gmx.net ([212.227.17.22]:46683 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238306AbiAaJer (ORCPT ); Mon, 31 Jan 2022 04:34:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1643621671; bh=M8VxZrM69T8fzVT7HtYVnghJWaulQqQeYn5dd1DXrAA=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=lEPzbHz/o6n9tqfgBJgHAdn74JEvwX7zqbLGl5KFxWcK9GZKo+Aa1x11WW2W4k1cJ 8y347rda+r0xigkXYDFfKpmR4WA4s71fJeXYho7nHd2XtELDYSWgNYNB2yl5wLpp0P C0AynlwZHOB3r/hodTHLW67056SVrfcV7/31A8ug= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from esprimo-mx.fritz.box ([91.137.126.34]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M1Ygt-1nFprJ3Ab5-0039OH; Mon, 31 Jan 2022 10:34:30 +0100 From: Armin Wolf To: hdegoede@redhat.com Cc: jdelvare@suse.com, linux@roeck-us.net, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] hwmon: sch56xx-common: Replace WDOG_ACTIVE with WDOG_HW_RUNNING Date: Mon, 31 Jan 2022 10:33:55 +0100 Message-Id: <20220131093355.4151-5-W_Armin@gmx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220131093355.4151-1-W_Armin@gmx.de> References: <20220131093355.4151-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:+wxF5tjDBrr6qZXjNNdOEl1gozLgystT2l6LjfZz6OaXZZIYQYi U9mzwcLVs3B0qKhBNm6zCg88jL4hyY6bYU/KpNW0xk1RyrFQbLb4XfViR9O7gNyPrm3yem1 a8bDe0Z4HFz2jWcYGDhQXWhuf0A/UnGF6m9Mmz0x4WEtwZ6shHd9NZAD0x6APsDVf7zl+Es de8yE2CZaDa5qMm29m4VQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:o8A+Fx8g6Qc=:EJvih/3LwWOK+A8e+rtd3q ePGpG54K5mm/f4QqWco6oMoTmCorFG7G/LSep6kc1WQXBQektuHBPHyw7FfrR6s3BGn91HD4D B5n59ik0z6nuUg0O5ZxEpiYjVdB5FDEjKxv554lTvji+1Xb/hZYXadBK/dFxQQSHr41XjMvXg B1y3i4E2VHahlRtelK70POGPaGwzmfkgu+IOlQPhkEHeGAL63yeSSlMjuqKEfuH+n/WXNRMnM dcPCCKvD/Gso+2nI9jXz0hI3ACRQf9mVd7wm4/boh8FgiKQ9SQkYjyzSAghadWcn2f+QO9aaC xg1p6R9vL5C4UvbsgW46JNiIgdLkfxnhpPbGahsAR5IM9xAgVKEA/cLOgkTcdUQxcLbhc8FU0 a9454CN90ULrMvHZ8O+ZXtYQR3DcVOB022TQMHfPicmqQGtujP4BWsKLmdmHVnqN4O5q51Yuz aV/xnrQkCOJANi31PFZ0pLLWxRF6aOC9XFl4lkN2G955ZaBKHhCC/sAFYPFbwSn5l210j3zMS iz475P0Zz0YEygDYeAnqMXfRWZI/nqhb97BYJLxsgH/eaqaJlLBSQB823gq1Pu9KO31dDxvFc F7uVw0K1liPktTxmFLhWejNtoWrGcoGU5cHq5Imj4Y3O3esjHAYXHEwpr8YDStnMHNW2WlBV2 AZ5od7WClKBYpnthe6cX5T1kgC7GbqGedAIVfdWJ8ZzFV80kT1GMASR42F7MEFg2L6cR61B9P ACfGc9QUR76rzW0y8T0gKSib+KsQMcjgrkDYXltn1RlM7gE4DRzAYhMvKgnp9mbhIwljMnLJv QLA1z7sy5r8lJLOMixTy3XOonOqMEYMS70apwrDbpVqvmSaQ9SuRXCcIxzlPoIeSReCsy5Prt rtBs6pIJBTUE+OdTTzYy6v+GXX4H9c9/Q/k5EdtfjEQzTybU9d06+4wfNz1jrL/IT2zud1hi9 147vbnJy8QN7jkg/KUg5rAHbOeX0WkrWUW0bZluO39xqV5cdfQ5XFHYxSkcGOtN9o+Sp+K8ps esHZm02Kw46Fdk5n25/SZHDTNO4pWQuEIwfPd/4zyFJZblqlZkNhWRhCYyxpvMiSFsu2yEu22 dnF7FG5eEeNDEg= Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org If the watchdog was already enabled by the BIOS after booting, the watchdog infrastructure needs to regularly send keepalives to prevent a unexpected reset. WDOG_ACTIVE only serves as an status indicator for userspace, we want to use WDOG_HW_RUNNING instead. Since my Fujitsu Esprimo P720 does not support the watchdog, this change is compile-tested only. Suggested-by: Guenter Roeck Fixes: fb551405c0f8 (watchdog: sch56xx: Use watchdog core) Signed-off-by: Armin Wolf --- drivers/hwmon/sch56xx-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.30.2 diff --git a/drivers/hwmon/sch56xx-common.c b/drivers/hwmon/sch56xx-common.c index f66e1ed4b1aa..2cd146fd0562 100644 --- a/drivers/hwmon/sch56xx-common.c +++ b/drivers/hwmon/sch56xx-common.c @@ -427,7 +427,7 @@ void sch56xx_watchdog_register(struct device *parent, u16 addr, u32 revision, data->wddev.max_timeout = 255 * 60; watchdog_set_nowayout(&data->wddev, nowayout); if (output_enable & SCH56XX_WDOG_OUTPUT_ENABLE) - set_bit(WDOG_ACTIVE, &data->wddev.status); + set_bit(WDOG_HW_RUNNING, &data->wddev.status); /* Since the watchdog uses a downcounter there is no register to read the BIOS set timeout from (if any was set at all) ->