2022-01-24 15:08:20

by Eugene Shalygin

[permalink] [raw]
Subject: [ASUS EC Sensors v8 0/3]

This patchset replaces the HWMON asus_wmi_ec_sensors driver with
an implementation that does not use WMI but queries the embedded
controller directly.

That provides two enhancements: sensor reading became quicker (on some
systems or kernel configuration it took almost a full second to read
all the sensors, that transfers less than 15 bytes of data), the driver
became more fexible. The driver now relies on ACPI mutex to lock access
to the EC, in the same way as the WMI DSDT code does.

Changes in v8:
- Fixed formatting (removed doc comments, removed redundant new line).
- Changed hwmon device name (asus_ec_sensors -> asusec) removing
unnecessary "sensors" word.

Changes in v7:
- Add suport for the ROG STRIX X570-F GAMING board.
- Add the __init attribute to two more functions.

Changes in v6:
- Fixed hwmon device name replacing dashes with underscores.
- Removed module verion.
- Fixed condition for asus_wmi_ec_Sensors in KBuild.

Changes in v5:
- Place the sensors bitset directly into the driver_data field of the
dmi_system_id struct.
- Replace doc comments with regular ones.

Changes in v4:
- Deprecate the wmi driver rather than removing it.

Changes in v3:
- Remove BIOS version checks and BIOS version dependent mutex path.

Changes in v2:
- Replace sensor flags enum with bitset
- Replace module init/probe functions with module_platform_driver_probe
and ask the platform drivers framework to load the driver when ACPI
EC is found (ACPI ID "PNP0C09").
- Extend board data with BIOS version attribute for the mutex path to be
BIOS version dependent.
- Add module parameter to override the mutex path.

Eugene Shalygin (3):
hwmon: (asus-ec-sensors) add driver for ASUS EC
hwmon: (asus-ec-sensors) update documentation
hwmon: deprecate asis_wmi_ec_sensors driver

Documentation/hwmon/asus_ec_sensors.rst | 52 ++
Documentation/hwmon/asus_wmi_ec_sensors.rst | 38 --
MAINTAINERS | 6 +
drivers/hwmon/Kconfig | 16 +-
drivers/hwmon/Makefile | 1 +
drivers/hwmon/asus-ec-sensors.c | 694 ++++++++++++++++++++
6 files changed, 768 insertions(+), 39 deletions(-)
create mode 100644 Documentation/hwmon/asus_ec_sensors.rst
delete mode 100644 Documentation/hwmon/asus_wmi_ec_sensors.rst
create mode 100644 drivers/hwmon/asus-ec-sensors.c

--
2.34.1


2022-01-24 15:08:56

by Eugene Shalygin

[permalink] [raw]
Subject: [ASUS EC Sensors v8 2/3] hwmon: (asus-ec-sensors) update documentation

Signed-off-by: Eugene Shalygin <[email protected]>
---
Documentation/hwmon/asus_ec_sensors.rst | 52 +++++++++++++++++++++
Documentation/hwmon/asus_wmi_ec_sensors.rst | 38 ---------------
2 files changed, 52 insertions(+), 38 deletions(-)
create mode 100644 Documentation/hwmon/asus_ec_sensors.rst
delete mode 100644 Documentation/hwmon/asus_wmi_ec_sensors.rst

diff --git a/Documentation/hwmon/asus_ec_sensors.rst b/Documentation/hwmon/asus_ec_sensors.rst
new file mode 100644
index 000000000000..b12ac7ebeb1a
--- /dev/null
+++ b/Documentation/hwmon/asus_ec_sensors.rst
@@ -0,0 +1,52 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+Kernel driver asus_ec_sensors
+=================================
+
+Supported boards:
+ * PRIME X570-PRO,
+ * Pro WS X570-ACE,
+ * ROG CROSSHAIR VIII DARK HERO,
+ * ROG CROSSHAIR VIII FORMULA,
+ * ROG CROSSHAIR VIII HERO,
+ * ROG CROSSHAIR VIII IMPACT,
+ * ROG STRIX B550-E GAMING,
+ * ROG STRIX B550-I GAMING,
+ * ROG STRIX X570-E GAMING,
+ * ROG STRIX X570-F GAMING,
+ * ROG STRIX X570-I GAMING
+
+Authors:
+ - Eugene Shalygin <[email protected]>
+
+Description:
+------------
+ASUS mainboards publish hardware monitoring information via Super I/O
+chip and the ACPI embedded controller (EC) registers. Some of the sensors
+are only available via the EC.
+
+The driver is aware of and reads the following sensors:
+
+1. Chipset (PCH) temperature
+2. CPU package temperature
+3. Motherboard temperature
+4. Readings from the T_Sensor header
+5. VRM temperature
+6. CPU_Opt fan RPM
+7. VRM heatsink fan RPM
+8. Chipset fan RPM
+9. Readings from the "Water flow meter" header (RPM)
+10. Readings from the "Water In" and "Water Out" temperature headers
+11. CPU current
+
+Sensor values are read from EC registers, and to avoid race with the board
+firmware the driver acquires ACPI mutex, the one used by the WMI when its
+methods access the EC.
+
+Module Parameters
+-----------------
+ * mutex_path: string
+ The driver holds path to the ACPI mutex for each board (actually,
+ the path is mostly identical for them). If ASUS changes this path
+ in a future BIOS update, this parameter can be used to override
+ the stored in the driver value until it gets updated.
diff --git a/Documentation/hwmon/asus_wmi_ec_sensors.rst b/Documentation/hwmon/asus_wmi_ec_sensors.rst
deleted file mode 100644
index 1b287f229e86..000000000000
--- a/Documentation/hwmon/asus_wmi_ec_sensors.rst
+++ /dev/null
@@ -1,38 +0,0 @@
-.. SPDX-License-Identifier: GPL-2.0-or-later
-
-Kernel driver asus_wmi_ec_sensors
-=================================
-
-Supported boards:
- * PRIME X570-PRO,
- * Pro WS X570-ACE,
- * ROG CROSSHAIR VIII DARK HERO,
- * ROG CROSSHAIR VIII FORMULA,
- * ROG CROSSHAIR VIII HERO,
- * ROG STRIX B550-E GAMING,
- * ROG STRIX B550-I GAMING,
- * ROG STRIX X570-E GAMING.
-
-Authors:
- - Eugene Shalygin <[email protected]>
-
-Description:
-------------
-ASUS mainboards publish hardware monitoring information via Super I/O
-chip and the ACPI embedded controller (EC) registers. Some of the sensors
-are only available via the EC.
-
-ASUS WMI interface provides a method (BREC) to read data from EC registers,
-which is utilized by this driver to publish those sensor readings to the
-HWMON system. The driver is aware of and reads the following sensors:
-
-1. Chipset (PCH) temperature
-2. CPU package temperature
-3. Motherboard temperature
-4. Readings from the T_Sensor header
-5. VRM temperature
-6. CPU_Opt fan RPM
-7. Chipset fan RPM
-8. Readings from the "Water flow meter" header (RPM)
-9. Readings from the "Water In" and "Water Out" temperature headers
-10. CPU current
--
2.34.1

2022-01-24 15:32:39

by Eugene Shalygin

[permalink] [raw]
Subject: [ASUS EC Sensors v8 3/3] hwmon: deprecate asis_wmi_ec_sensors driver

Deprecate the asus_wmi_ec_sensors driver in favor of the asus_ec_sensors

Signed-off-by: Eugene Shalygin <[email protected]>
---
drivers/hwmon/Kconfig | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 2c16b19d2c03..38094c702e4d 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -2243,13 +2243,16 @@ config SENSORS_ASUS_WMI

config SENSORS_ASUS_WMI_EC
tristate "ASUS WMI B550/X570"
- depends on ACPI_WMI
+ depends on ACPI_WMI && SENSORS_ASUS_EC=n
help
If you say yes here you get support for the ACPI embedded controller
hardware monitoring interface found in B550/X570 ASUS motherboards.
This driver will provide readings of fans, voltages and temperatures
through the system firmware.

+ This driver is deprecated in favor of the ASUS EC Sensors driver
+ which provides fully compatible output.
+
This driver can also be built as a module. If so, the module
will be called asus_wmi_sensors_ec.

--
2.34.1

2022-01-25 09:35:56

by Oleksandr Natalenko

[permalink] [raw]
Subject: Re: [ASUS EC Sensors v8 3/3] hwmon: deprecate asis_wmi_ec_sensors driver

On pondělí 24. ledna 2022 2:56:45 CET Eugene Shalygin wrote:
> Deprecate the asus_wmi_ec_sensors driver in favor of the asus_ec_sensors
>
> Signed-off-by: Eugene Shalygin <[email protected]>
> ---
> drivers/hwmon/Kconfig | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
> index 2c16b19d2c03..38094c702e4d 100644
> --- a/drivers/hwmon/Kconfig
> +++ b/drivers/hwmon/Kconfig
> @@ -2243,13 +2243,16 @@ config SENSORS_ASUS_WMI
>
> config SENSORS_ASUS_WMI_EC
> tristate "ASUS WMI B550/X570"
> - depends on ACPI_WMI
> + depends on ACPI_WMI && SENSORS_ASUS_EC=n
> help
> If you say yes here you get support for the ACPI embedded controller
> hardware monitoring interface found in B550/X570 ASUS motherboards.
> This driver will provide readings of fans, voltages and temperatures
> through the system firmware.
>
> + This driver is deprecated in favor of the ASUS EC Sensors driver
> + which provides fully compatible output.
> +
> This driver can also be built as a module. If so, the module
> will be called asus_wmi_sensors_ec.
>
>

Reviewed-by: Oleksandr Natalenko <[email protected]>

--
Oleksandr Natalenko (post-factum)


2022-01-25 13:31:38

by Oleksandr Natalenko

[permalink] [raw]
Subject: Re: [ASUS EC Sensors v8 2/3] hwmon: (asus-ec-sensors) update documentation

On pondělí 24. ledna 2022 2:56:44 CET Eugene Shalygin wrote:
> Signed-off-by: Eugene Shalygin <[email protected]>

I believe some commit message is desired here.

> ---
> Documentation/hwmon/asus_ec_sensors.rst | 52 +++++++++++++++++++++
> Documentation/hwmon/asus_wmi_ec_sensors.rst | 38 ---------------
> 2 files changed, 52 insertions(+), 38 deletions(-)
> create mode 100644 Documentation/hwmon/asus_ec_sensors.rst
> delete mode 100644 Documentation/hwmon/asus_wmi_ec_sensors.rst
>
> diff --git a/Documentation/hwmon/asus_ec_sensors.rst b/Documentation/hwmon/asus_ec_sensors.rst
> new file mode 100644
> index 000000000000..b12ac7ebeb1a
> --- /dev/null
> +++ b/Documentation/hwmon/asus_ec_sensors.rst
> @@ -0,0 +1,52 @@
> +.. SPDX-License-Identifier: GPL-2.0-or-later
> +
> +Kernel driver asus_ec_sensors
> +=================================
> +
> +Supported boards:
> + * PRIME X570-PRO,
> + * Pro WS X570-ACE,
> + * ROG CROSSHAIR VIII DARK HERO,
> + * ROG CROSSHAIR VIII FORMULA,
> + * ROG CROSSHAIR VIII HERO,
> + * ROG CROSSHAIR VIII IMPACT,
> + * ROG STRIX B550-E GAMING,
> + * ROG STRIX B550-I GAMING,
> + * ROG STRIX X570-E GAMING,
> + * ROG STRIX X570-F GAMING,
> + * ROG STRIX X570-I GAMING
> +
> +Authors:
> + - Eugene Shalygin <[email protected]>
> +
> +Description:
> +------------
> +ASUS mainboards publish hardware monitoring information via Super I/O
> +chip and the ACPI embedded controller (EC) registers. Some of the sensors
> +are only available via the EC.
> +
> +The driver is aware of and reads the following sensors:
> +
> +1. Chipset (PCH) temperature
> +2. CPU package temperature
> +3. Motherboard temperature
> +4. Readings from the T_Sensor header
> +5. VRM temperature
> +6. CPU_Opt fan RPM
> +7. VRM heatsink fan RPM
> +8. Chipset fan RPM
> +9. Readings from the "Water flow meter" header (RPM)
> +10. Readings from the "Water In" and "Water Out" temperature headers
> +11. CPU current
> +
> +Sensor values are read from EC registers, and to avoid race with the board
> +firmware the driver acquires ACPI mutex, the one used by the WMI when its
> +methods access the EC.
> +
> +Module Parameters
> +-----------------
> + * mutex_path: string
> + The driver holds path to the ACPI mutex for each board (actually,
> + the path is mostly identical for them). If ASUS changes this path
> + in a future BIOS update, this parameter can be used to override
> + the stored in the driver value until it gets updated.
> diff --git a/Documentation/hwmon/asus_wmi_ec_sensors.rst b/Documentation/hwmon/asus_wmi_ec_sensors.rst
> deleted file mode 100644
> index 1b287f229e86..000000000000
> --- a/Documentation/hwmon/asus_wmi_ec_sensors.rst
> +++ /dev/null
> @@ -1,38 +0,0 @@
> -.. SPDX-License-Identifier: GPL-2.0-or-later
> -
> -Kernel driver asus_wmi_ec_sensors
> -=================================
> -
> -Supported boards:
> - * PRIME X570-PRO,
> - * Pro WS X570-ACE,
> - * ROG CROSSHAIR VIII DARK HERO,
> - * ROG CROSSHAIR VIII FORMULA,
> - * ROG CROSSHAIR VIII HERO,
> - * ROG STRIX B550-E GAMING,
> - * ROG STRIX B550-I GAMING,
> - * ROG STRIX X570-E GAMING.
> -
> -Authors:
> - - Eugene Shalygin <[email protected]>
> -
> -Description:
> -------------
> -ASUS mainboards publish hardware monitoring information via Super I/O
> -chip and the ACPI embedded controller (EC) registers. Some of the sensors
> -are only available via the EC.
> -
> -ASUS WMI interface provides a method (BREC) to read data from EC registers,
> -which is utilized by this driver to publish those sensor readings to the
> -HWMON system. The driver is aware of and reads the following sensors:
> -
> -1. Chipset (PCH) temperature
> -2. CPU package temperature
> -3. Motherboard temperature
> -4. Readings from the T_Sensor header
> -5. VRM temperature
> -6. CPU_Opt fan RPM
> -7. Chipset fan RPM
> -8. Readings from the "Water flow meter" header (RPM)
> -9. Readings from the "Water In" and "Water Out" temperature headers
> -10. CPU current
>


--
Oleksandr Natalenko (post-factum)


2022-02-03 06:45:46

by Eugene Shalygin

[permalink] [raw]
Subject: Re: [ASUS EC Sensors v8 0/3]

> > Oleksandr sent an informal one already.
> >
>
> He wrote:
>
> "Given minor changes against v7, I think my "Tested-by:" should have been preserved."
>
> which doesn't mean he tested again, only that in his opinion
> the tags should have been preserved.

Oleksandre, could you, please, let us know did you actually test the
v8 code and if so provide us with the Tested-by: tag?

> That means that I am left with either accepting the series without any
> Tested-by: and/or Reviewed-by: tags, or I have to wait for some. I guess
> you are telling me that I won't get any additional tags, so I'll have to
> go in myself and have a closer look. I'll try to do that in the next week
> or two.

Thank you, I understand now. If Oleksandr does not reply in a few days
I will send the update with another board
(fully duplicating information for its base variant), tested by a
Libre Hardware Monitor user.

Best regards,
Eugene

2022-02-03 07:26:19

by Eugene Shalygin

[permalink] [raw]
Subject: Re: [ASUS EC Sensors v8 0/3]

> I was waiting for someone to send me a Tested-by: for the series,

Oleksandr sent an informal one already.

> since you dropped the previous feedback.

Does it mean it is possible to update patches while keeping it?

Eugene

2022-02-03 19:09:19

by Guenter Roeck

[permalink] [raw]
Subject: Re: [ASUS EC Sensors v8 0/3]

On 2/2/22 15:58, Eugene Shalygin wrote:
> On Mon, 24 Jan 2022 at 02:57, Eugene Shalygin <[email protected]> wrote:
>>
>> This patchset replaces the HWMON asus_wmi_ec_sensors driver with
>> an implementation that does not use WMI but queries the embedded
>> controller directly.
>
> Günter, I would like to add support for one more board model. What
> should I do? Another version update or could you, please, merge this
> patchset already?
>
> Thank you,
> Eugene

I was waiting for someone to send me a Tested-by: for the series,
since you dropped the previous feedback. Presumably that means that
the changes from previous versions warrants another round of testing
and/or review.

Guenter

2022-02-03 20:36:41

by Eugene Shalygin

[permalink] [raw]
Subject: Re: [ASUS EC Sensors v8 0/3]

On Mon, 24 Jan 2022 at 02:57, Eugene Shalygin <[email protected]> wrote:
>
> This patchset replaces the HWMON asus_wmi_ec_sensors driver with
> an implementation that does not use WMI but queries the embedded
> controller directly.

Günter, I would like to add support for one more board model. What
should I do? Another version update or could you, please, merge this
patchset already?

Thank you,
Eugene

2022-02-03 21:40:58

by Oleksandr Natalenko

[permalink] [raw]
Subject: Re: [ASUS EC Sensors v8 0/3]

Hello.

On čtvrtek 3. února 2022 4:48:53 CET Eugene Shalygin wrote:
> > > Oleksandr sent an informal one already.
> > >
> >
> > He wrote:
> >
> > "Given minor changes against v7, I think my "Tested-by:" should have been preserved."
> >
> > which doesn't mean he tested again, only that in his opinion
> > the tags should have been preserved.

This is not what I meant, but my wording could be better, yes.

BTW, the changes were not of that kind to drop Tested-by: tag, really.

> Oleksandre, could you, please, let us know did you actually test the
> v8 code and if so provide us with the Tested-by: tag?

Yes, I do run this version now, and it works fine for me.

Tested-by: Oleksandr Natalenko <[email protected]>

> > That means that I am left with either accepting the series without any
> > Tested-by: and/or Reviewed-by: tags, or I have to wait for some. I guess
> > you are telling me that I won't get any additional tags, so I'll have to
> > go in myself and have a closer look. I'll try to do that in the next week
> > or two.
>
> Thank you, I understand now. If Oleksandr does not reply in a few days
> I will send the update with another board
> (fully duplicating information for its base variant), tested by a
> Libre Hardware Monitor user.

Thanks.

> Best regards,
> Eugene
>

--
Oleksandr Natalenko (post-factum)


2022-02-04 05:36:48

by Denis Pauk

[permalink] [raw]
Subject: Re: [ASUS EC Sensors v8 0/3]

On Thu, 3 Feb 2022 21:01:32 +0100
Eugene Shalygin <[email protected]> wrote:

> > >> Oleksandre, could you, please, let us know did you actually test
> > >> the v8 code and if so provide us with the Tested-by: tag?
> > >
> > > Yes, I do run this version now, and it works fine for me.
> > >
> > > Tested-by: Oleksandr Natalenko <[email protected]>
> > >
> >
> > Ok, based on that I'll apply the series on top of hwmon-next with
> > your Tested-by:.
> >
>
> Great! Thank you both!
>
> Eugene

I have also retested code, it works for my case.

Tested-by: Denis Pauk <[email protected]>

What about other B550/X570 boards?

We have such candidates with same WMI methods in nct6775:
"ROG STRIX B550-A GAMING",
"ROG STRIX B550-E GAMING",
"ROG STRIX B550-F GAMING",
"ROG STRIX B550-F GAMING (WI-FI)",
"ROG STRIX B550-I GAMING",

B550-A does not support asus-wmi-ec-interface("ERROR: Can't get value
of subfeature fan1_input: I/O error"), but what about others?

Best regards,
Denis.

2022-02-04 09:22:28

by Eugene Shalygin

[permalink] [raw]
Subject: Re: [ASUS EC Sensors v8 0/3]

> I have also retested code, it works for my case.
>
> Tested-by: Denis Pauk <[email protected]>

Thanks!

> What about other B550/X570 boards?
>
> We have such candidates with same WMI methods in nct6775:
> "ROG STRIX B550-A GAMING",
> "ROG STRIX B550-E GAMING",
> "ROG STRIX B550-F GAMING",
> "ROG STRIX B550-F GAMING (WI-FI)",
> "ROG STRIX B550-I GAMING",
>
> B550-A does not support asus-wmi-ec-interface("ERROR: Can't get value
> of subfeature fan1_input: I/O error"), but what about others?

I don't have DSDT for these boards, but most of them have the
T_Sensor, according to the specs at the ASUS web-site, so, probably,
their EC should report something, because most of their boards report
T_Sensor reading via the EC.

Best regards,
Eugene

2022-02-07 13:17:20

by Guenter Roeck

[permalink] [raw]
Subject: Re: [ASUS EC Sensors v8 0/3]

On 2/2/22 23:09, Oleksandr Natalenko wrote:
> Hello.
>
> On čtvrtek 3. února 2022 4:48:53 CET Eugene Shalygin wrote:
>>>> Oleksandr sent an informal one already.
>>>>
>>>
>>> He wrote:
>>>
>>> "Given minor changes against v7, I think my "Tested-by:" should have been preserved."
>>>
>>> which doesn't mean he tested again, only that in his opinion
>>> the tags should have been preserved.
>
> This is not what I meant, but my wording could be better, yes.
>
> BTW, the changes were not of that kind to drop Tested-by: tag, really.
>
>> Oleksandre, could you, please, let us know did you actually test the
>> v8 code and if so provide us with the Tested-by: tag?
>
> Yes, I do run this version now, and it works fine for me.
>
> Tested-by: Oleksandr Natalenko <[email protected]>
>

Ok, based on that I'll apply the series on top of hwmon-next with your
Tested-by:.

Guenter

>>> That means that I am left with either accepting the series without any
>>> Tested-by: and/or Reviewed-by: tags, or I have to wait for some. I guess
>>> you are telling me that I won't get any additional tags, so I'll have to
>>> go in myself and have a closer look. I'll try to do that in the next week
>>> or two.
>>
>> Thank you, I understand now. If Oleksandr does not reply in a few days
>> I will send the update with another board
>> (fully duplicating information for its base variant), tested by a
>> Libre Hardware Monitor user.
>
> Thanks.
>
>> Best regards,
>> Eugene
>>
>


2022-02-08 13:56:41

by Eugene Shalygin

[permalink] [raw]
Subject: Re: [ASUS EC Sensors v8 0/3]

> >> Oleksandre, could you, please, let us know did you actually test the
> >> v8 code and if so provide us with the Tested-by: tag?
> >
> > Yes, I do run this version now, and it works fine for me.
> >
> > Tested-by: Oleksandr Natalenko <[email protected]>
> >
>
> Ok, based on that I'll apply the series on top of hwmon-next with your
> Tested-by:.
>

Great! Thank you both!

Eugene

2022-02-09 02:46:34

by Guenter Roeck

[permalink] [raw]
Subject: Re: [ASUS EC Sensors v8 0/3]

On 2/2/22 17:16, Eugene Shalygin wrote:
>> I was waiting for someone to send me a Tested-by: for the series,
>
> Oleksandr sent an informal one already.
>

He wrote:

"Given minor changes against v7, I think my "Tested-by:" should have been preserved."

which doesn't mean he tested again, only that in his opinion
the tags should have been preserved.

>> since you dropped the previous feedback.
>
> Does it mean it is possible to update patches while keeping it?
>

See above. You are the one to make the call, and you made the call that
the series should be re-tested.

That means that I am left with either accepting the series without any
Tested-by: and/or Reviewed-by: tags, or I have to wait for some. I guess
you are telling me that I won't get any additional tags, so I'll have to
go in myself and have a closer look. I'll try to do that in the next week
or two.

Guenter