From patchwork Mon Jan 31 21:19:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 12731224 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 DBE8FC433FE for ; Mon, 31 Jan 2022 21:19:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380313AbiAaVT4 (ORCPT ); Mon, 31 Jan 2022 16:19:56 -0500 Received: from mout.gmx.net ([212.227.17.20]:56961 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380301AbiAaVTz (ORCPT ); Mon, 31 Jan 2022 16:19:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1643663979; bh=Z7EB/LO5aExgD4RlbbUSXw41BmiPeYS74GXPrPCXZdk=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=QC+wfJU4qjqHRuvDazSwiYgF5APgW9bbG+W8iIC4pySOiBwHIeYGb7dP6nrlkzIqu L/UtNQmUUR2FKLYdmdrAKjJR+8BFDA6yVcQmqXGACqx6K8RUUFWLH4jpT4AO/DF1+r VgZYjuVHKqywfKV3avfbdfCtnyClCXloyynDX/wI= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from esprimo-mx.fritz.box ([91.137.126.34]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N17YY-1mDVdR2egk-012c84; Mon, 31 Jan 2022 22:19:39 +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 v3 1/4] hwmon: (sch56xx) Autoload modules on platform device creation Date: Mon, 31 Jan 2022 22:19:32 +0100 Message-Id: <20220131211935.3656-2-W_Armin@gmx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220131211935.3656-1-W_Armin@gmx.de> References: <20220131211935.3656-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:b5h6cUklFJKhhWZmbqI5nfUVfx+qiMkpOdrR3liD1zytHY/t0Mg /xTxDBja3+rTzKHCwta/5R2NnUncdNXfD5XTRgQzrbgTu9gDRgEMkeOavje/eDf2NunqNh1 3kL5q/0rmBxrMMVaTp93KJ4tSvZrk6JG4haM17Ud9+7UZ7igBCHXagx0DWSPPInRyCpB4Vw A2qQj6BmgMi+3y5l+fyYw== X-UI-Out-Filterresults: notjunk:1;V03:K0:La6NYU4Y3gs=:aOqxFJuWMA02mb9OxaW5bl eENMfOad47anGbzmgmT/ynjq9bBRSfuu1Ke1cQrIQoUxUJUDibEjbEGU7hpum7YfkTizobi8+ EcuOAgqdS6KY76be15D3ooqej1tIZOZeU/9bQ88Q2KpzfpgqYgAZ1SocvCmjHGHWEKPAnl8jx eo4v52KEvIMFzi278LliNKoquG3+P9hJKbD1yFBwY4vu/2tgSxlC60WmxgcqLADgJgu4lLmoH xsBVlI0QQa6WKhWIpTnKZ3sp49w60qz5xptO+3OIEKk7vCa1m0bgRBWdnT8GC0bZeviq9pm19 676Gk2B88rijlcChrVLObLVisAmqH/tUekCq91bHCbFaGpxcPZLH8IZNKqDpDmbyp+Tq3Q4II Ohfmw8ViwBiQ6Ji8vrsDe6jwp/IT4tug7sc7yQItiX353RjTsmwiD9Is+0cOIVyIf10gYWqGc 0IcvAR2YNmLxjp0wfqiUYu36jI+HXBZezTztrGGNWe9FwgxnaCYn5Y+sXlTPuHE89XT+fuejD 8R11FDwxeWigE/6zRSvBDZHAkW+iyKGxshFeaYY/DfahwJ5rn8tOIg0NMWbmMeSTmJoztxnwp sSH7Gf69oxjh8/gImFPQh5v/+miLepe00if1XRuZg6d+c7zV6aKxzH/7A74wQkFVpyAzAw3fc wb3D68WuI1fL/byaHGcmZUrdkttUha2irVJmwX3I7DgXICfaIbT4ZlDVQN2NKIpMTMX9WrcGr QGingY+japmH0QE4TmWAhWYKEl2VTEz26BUJhyNJczLNrK3daDjES9GzZDtGEvf84PnH0278h Oh8fQEWU9t7EPRyxJLB5OFXP5o9upGdH3PQE1jN0Ro1uGCu9zAvi7hf1946vb4hiNjD7wQej1 NwSM2UDv7yEX8URWzUU4YsMmQ1IzYOZjeSFL9ePhtAOKTNWWkL6D7DKE7L4f6GncTTPLbEPSN Jojm3W3GExoBCYGvMb40FU6iuhUFihuX4MpC1AvIByYuxVL0qD7tX1Uv3Ihqbscb0HilDifvZ RL/+Oq2mGTwECGmYYHPIPzZVhWTxmn3Fr4sawAe17FKpikaXV8PqLDe2dVcSmi2cPjtS4JG45 GGFiatwybqn++s= 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 | 10 ++++++++++ drivers/hwmon/sch5636.c | 10 ++++++++++ 2 files changed, 20 insertions(+) -- 2.30.2 diff --git a/drivers/hwmon/sch5627.c b/drivers/hwmon/sch5627.c index 8f1b569c69e7..72c3f6757e34 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,11 +457,20 @@ static int sch5627_probe(struct platform_device *pdev) return 0; } +static const struct platform_device_id sch5627_device_id[] = { + { + .name = "sch5627", + }, + { } +}; +MODULE_DEVICE_TABLE(platform, sch5627_device_id); + static struct platform_driver sch5627_driver = { .driver = { .name = DRVNAME, }, .probe = sch5627_probe, + .id_table = sch5627_device_id, }; module_platform_driver(sch5627_driver); diff --git a/drivers/hwmon/sch5636.c b/drivers/hwmon/sch5636.c index 39ff1c9b1df5..269757bc3a9e 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,12 +502,21 @@ static int sch5636_probe(struct platform_device *pdev) return err; } +static const struct platform_device_id sch5636_device_id[] = { + { + .name = "sch5636", + }, + { } +}; +MODULE_DEVICE_TABLE(platform, sch5636_device_id); + static struct platform_driver sch5636_driver = { .driver = { .name = DRVNAME, }, .probe = sch5636_probe, .remove = sch5636_remove, + .id_table = sch5636_device_id, }; module_platform_driver(sch5636_driver); From patchwork Mon Jan 31 21:19:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 12731225 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 32630C433F5 for ; Mon, 31 Jan 2022 21:20:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380248AbiAaVUA (ORCPT ); Mon, 31 Jan 2022 16:20:00 -0500 Received: from mout.gmx.net ([212.227.17.22]:34189 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380369AbiAaVT6 (ORCPT ); Mon, 31 Jan 2022 16:19:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1643663981; bh=q1ugW5vj4OYyvuTgfzR5w8vCHi9Ca6RP1hz9efhCLfY=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=ik/+xU1+MdpEVMHHCRflF6H7q0mAt6mNPyfkAGbBJuP5RIRhjuU/CoWnSMlxT9K4Y +oO0Uaku7XH+U7MKBEcqSAP+jq/oGTyRvVBHf43cGRN0q8CZhgqeS+e0QWf5AiZ7xI /434A1M1YrYvPV0l0k+vDd4W8LGB4EYeuS2SVRuk= 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 1M2wGi-1nDYga3JzI-003QXG; Mon, 31 Jan 2022 22:19:40 +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 v3 2/4] hwmon: (sch56xx-common) Add automatic module loading on supported devices Date: Mon, 31 Jan 2022 22:19:33 +0100 Message-Id: <20220131211935.3656-3-W_Armin@gmx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220131211935.3656-1-W_Armin@gmx.de> References: <20220131211935.3656-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:82WFjN7VINhCE2s5WpqADCg9uhIkpzAYVYVznlgZ15UE2mHAWu8 QEp08FXJIotP/2dQq9OGgOw62wMTYlHvY9dvRfhSXNtuEZEQRepS63C58YvhuU/kYT9Ee5/ 9febMv5M66sK72iiIsC3cOv2+lc8t427E+Nm5W/dgDeWJMBqowb5FE3bLzjMpWfrjaYao8Z t30m32qrgOMSRoDEuQTcA== X-UI-Out-Filterresults: notjunk:1;V03:K0:9PYPnszt44c=:y8DJg1mU+1kqaq+jrzMdXp ZaEN5g1qk/8tda3GNAv9LIBK0ByM9h09emd5t2jD5UTt7Xnc3+V14mnSM83uW1D3Snku5PNQe Ls+XhWPFQUpAMHrp55ZX0891pgXnpJQvRRZ8f4bJrn6txNHcaUt5f3dlIJqRmo8ron5mRxt9n wEQd6QlrPZI/xDm5nlAE6m9LgUr85d48et4gzZGW5bAKEdvatRMYYGlPhelvj042dIwkyfcbA fDS4XNrKpWlN873SP+2jssRU9PvDx6v23oxjxYmU+qGNauf2eoq5wwRZ4XFKVPY5VlnrA3YX1 4WcSJRZCuvLhWDYQC4lmUMZ2T9lr4zmkMPBS0+ERHVkO6WA1WjKSmsWvEHC+kiXvxEmVJBL8L sbUjFMpes14mCKxVAo+qj7PAgLx6JgaKLghgPc/fczU19ZdBYADNOm3AZKyCri33EKjHNx/iO pAvhJJP+DMefw32ECNUqjPciA1sHsuB/Q0st6RkInyTugvrIGZqAN/vkXeVQbGXAJOHHWTkaA D3NnoJigLLxL06XXfzR66TkvnnAwJ70FR2rbC0q2QBXATTkYoaTk4g9ZZlbzCBY83WbGGGbnu 5IFtWWvS0mM5YpkM0n8rHQaV1HDXDKFPdoQSDiCuzuRagkQyS7xCykAf3xXQDLYAmndD6FJGS ibI+5AY8/RiJuJxk4GWdaDvFA8jv8ndhrPaj+v9SbjZ+rBYOvJ0DHilTzFYMc2hL4yywMltMt ky5imzgdpIN7NkSR+NIbt2xjJae7FGSSTGzHnJAWAJArPC8BhZ5BLATSmf5wGU78M34nqr9vh /e5eNJJhjkLMURdDeguV/+ste9jWh0R++LZUbPgbOzl1FpN5Qz2B54s1ezJR07ihbHLOGSd+r G4bopAxGfcmkr9FVwda+779RghIabl6W4WxPDouKUQebzRrrn2wACFShlzHqSzobyfpRwED6Q pDIRfZNcNvMxuMhr8cpmvyuFGJQIfcL4ADQh97SfTEeDPhkrc3cHMGP/YA6+KpjiCEkF2Tjt7 cTbsXFJGW7cUGhpUAg6ZmqVi39HjiUH92lkJbokaYs6ftTdJ+6mP7g1o9KAbda5MbiC1f4/du TOSAhVL0Bt51Yg= 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 21:19:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 12731227 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 0E338C433FE for ; Mon, 31 Jan 2022 21:20:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380459AbiAaVUB (ORCPT ); Mon, 31 Jan 2022 16:20:01 -0500 Received: from mout.gmx.net ([212.227.17.20]:49223 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380378AbiAaVT7 (ORCPT ); Mon, 31 Jan 2022 16:19:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1643663982; bh=0OoQMhJlkEEiwoOOeHhR3TbqGiB7U4P44mzeiefOj8w=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=SYLlAFSnow7Dc6BEQwLj/tjkeWS2Q5z4fs7B5ngPr45KsLAeSruh4oiA4At1hD1tW z7tDebJ8Gsk/cm1Qa94nREpmRyrqISIaTDBeGKtGJA3bINVDHAc2Fy0d9ygqmTnd1D aqa3UtybSjNTSryDGzgu9eMrYdSor/9CvCByFXRw= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from esprimo-mx.fritz.box ([91.137.126.34]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MPXhK-1mt6nU1D8s-00McQV; Mon, 31 Jan 2022 22:19:42 +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 v3 3/4] hwmon: (sch56xx-common) Replace msleep() with usleep_range() Date: Mon, 31 Jan 2022 22:19:34 +0100 Message-Id: <20220131211935.3656-4-W_Armin@gmx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220131211935.3656-1-W_Armin@gmx.de> References: <20220131211935.3656-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:keGOqHcPU7isTiMdTtCxhgbByl38KArrEoSwhWJtKvUZ4rvOXzF 7eDUR87WbFnj1YiJROkfAkI2KYimdk94J6WkW2D223rKJKWKrJWlnlc9CrFwxkK2LUKcqMA rt3A2ezbRIb4xj0FYYjQioysNd/nY9qBOeMbhNtRe+R9E3fWX5gVSsYtWw0wGJPwDM+1n7a CC5aSFAqlIEU705yLqxAA== X-UI-Out-Filterresults: notjunk:1;V03:K0:6u3HBQKHZp4=:26Xqxjgu3dalALeW3pUFTE IQ0qf9jBxlBmUTAkZYPBJObJuvZAHBLfmG5OfKeuFL62GpnLozCSaakBOPSdIvqZy1t+XnONK WOKVgUOfNcQKJo1vzoDuzkpzuFQ5Q6TA5Ee8jd355pBOJMlJLsTKjJl+cAsQD1Xfq4bM+k7Mr 66HJiUah+Z4sjnfueAKlv9L9Y/d79i22iicMgkfGLC3nDw5iQDrqzH+P1oVce1IfAx6RZnR2o TheBJPSp+ELC4nWjDgz/j2Ad8Z5OqZvRZ8DTuQncxaNtUvyYgZMzRNgRqeFB+129MHf/MGtLX uG8u2PYv4tn9BWWPUjkmzeiE0nqO1CdnZNdWuOgDULjNRWMjxh6qFFUcPkgXSgW543e6Y9ShX zqtQ4oweKgnHy4x1prXxeagpJNYNEl0NL+K2B5lb98kDPNFwbi4Y96SN9qoQhBaeKvRs5Ez8Q C5/95sXPztGLxImZljbA36vqEOe7g65X4pnVdKU+5GI5tjbXQhVi1r4YyY5czDdoTHx/iD5qi VHKY+m8xtJhioSI9RsfutkM4KWlCFOtiV8JK+FXCh2yrAo5HyA0JVl/JOrmwSj4EP0GULBZ5W bYrKTAbP5MUFuMVs5MmcKaClkkk7hNs411ggSUNxDvFUVSQqMFqJMlaKppIQ3UYLkfoSqfcPy fwziqOq7/y6G11SevWkwrFhIQ0gBdABVjzMUi1+/dVMmjqJSeljbJ7nOCWcl9mZiu29AuLIQG qn7UYNdQ9+GmhuIdJDEB6GoP0h7goManmFYnKxAtgpK7RNVHa63lKOiYO8hcX5QHS2n1/Sbgq s4ObTIrQT//4fPju7ohLwcpuYuzU5uA5rMCJ2FlSUI9hXXpXOqogYNYLGH6RWTI5gvISI+wIA x4T6Ln+vupj26gYJeDT8C+XgjGtAGK+jivbUnBe/uv1e0BFERd5rpgVrFjwnJfBaKqGFvOsfW 6zxudnWfAFUaFG0OIP9P21LGdEaRu7m+QQVusgxxctlKA4qqfzTfM/MLSdPyOBDg7D4X0l6IM sbkiKoMBlVR4MXsa7lGjtpko62omR5nPQuVpOSfdJOsMCUweCQgVSoyXy56NKesp0yW838yXD GG8H1UaNwZKQzQ= 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..82602b74c7ed 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(1000, 2000); /* Read Interrupt source Register */ val = inb(addr + 8); /* Write Clear the interrupt source bits */ From patchwork Mon Jan 31 21:19:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 12731226 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 2E48FC4332F for ; Mon, 31 Jan 2022 21:20:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380560AbiAaVUB (ORCPT ); Mon, 31 Jan 2022 16:20:01 -0500 Received: from mout.gmx.net ([212.227.17.20]:42841 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380419AbiAaVUA (ORCPT ); Mon, 31 Jan 2022 16:20:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1643663983; bh=KFKNxulkFsQgbVrro+Hj9vsIrT+XYodV/8shEDASERA=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=CaHSLl+fUeZrrbURLZM/mbFhNzhjg15xgb6ACDWbpMvMPcfzHOOexA4tvvctmTtF9 FCCInpc0Ujk5SLcr7crmfoxtdWGtDUH/QoGHjIBKoz/BnNC71Lz0jtlfF42bQJOQmH s34lD5GxkLmYoBMyjos4WnHXXTF3RzBd+SbmIfpY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from esprimo-mx.fritz.box ([91.137.126.34]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M4b1y-1nGIVl2CSU-001fc2; Mon, 31 Jan 2022 22:19:43 +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 v3 4/4] hwmon: (sch56xx-common) Replace WDOG_ACTIVE with WDOG_HW_RUNNING Date: Mon, 31 Jan 2022 22:19:35 +0100 Message-Id: <20220131211935.3656-5-W_Armin@gmx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220131211935.3656-1-W_Armin@gmx.de> References: <20220131211935.3656-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:t4tk4mQCSQWmqlSfMaZpny3UuhF4SikNlxrTsxlWeo50KS3qfgk VU709XbR4elpVs7J2iFGcFBBBbfOT025ZuV1k+h4oLZG10l6nZMyZmHbdG7J1qtbGGCronO geXsmhKlI/Gy5fEUrlX/H6XeDZfNDrdqIVR/9l7+pjdUyMjrjCEXPmIXc2IgzjzAOCx0PeI Em+7G0Z0NZc2g8sKnhczw== X-UI-Out-Filterresults: notjunk:1;V03:K0:PvxdLDpb9p8=:dA3fqGSf9bIg5nhbPlamM8 35goMEbfqGI/1QGDt+Tu4xyzyB0d8zfS2MhManGqCPFTTVGwbM1x75JZ4JYp6MS0KxeeuWGex NIBpLdKDNE45Zz+QpLxzsP+RFlw4qvEIi4dnCzCS7WXIMdJypr+QQdQY34P/3aD6ZgqL0JOXU Q3XAo3LihLetxOR8Gf4i2wKTnF819HPWa32BCTccZ+tvyYic9xeF1EnkJ7c57Jdp3GcxVDael i4/eRNMsKivIaf6MKHuxN8jnxQn7u6J7e2gjkxMRjryakJXuCyEZoI+g1mRcvXh5EAZGd3crC rbkawmeapyQM3LK9w+2gJ0L3U3dg+ogZ1EQyH6INU6TjW/OrDAtaUZrfAIqsKBVd05/OXh+21 uJgtW6c7CxcEeuGL+aYvaiR7VpncqGonJrcG77TKC+F+9PrFd9Zl//RLkE2qB2eePLOFr/PTu TsGIj5Xi6kcCxoxbpjizCvDfwr0fCBE5iGurk+EaPXJHGEJEWNC5AUrY3jNyWS8O/Qm4LlAcG 9V6zvhjnxshFFSlhpQT4v265RwEGp0UcU5Li0EjbhT5mwKc7job34CzbtUTM5hCKjLJBBr+/6 iMEQTY+jnKNq0pP028jrvHIv4je2x6gh6llDYT/GSCsm2H5iPoqXUZzsJWS4BpQEQ/qfkAsdQ gNpz98l8yhQqVoOof+A73PiqfHkPrKHhYfpdg/vARI9agWwp+8o4bhc/4Hetqa3WEyKCtoZI9 nwef40ekr18KHqhuHbygmfQvuzuicQxpTuI0vVDHZtpF9uOrlGUq0TyPXsH/tZgu7JVpVvXkF sD689BTO16Ehip4NLP4TrmpKYDM0V+ODCFTliagIF0U5KcwSbtF22tSKLCOyRlnHBVtyWNOLI OanEX/RVWgSNypFSRzRVRPi6ZnDhIc0Mtf3dEmBXRdMrsVx9pE0fZ0C8K6kGUmI/xZK9U7A73 kZ+PgZV5nUmgotDOLVB2ldrT/9OCHVDgsKvFBLPBUfRoFUgZ5nj65sdEapuQa+cEKASg5BJAR lMwqasr0G1ma81Z3RTLqQIt2g1ye6cb3EmZFJFNiO+kmVHJLpApjrm/soV0iLaPU6cyNBijvG iaUgp687H//qhU= 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 82602b74c7ed..3ece53adabd6 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) ->