[ASUS EC Sensors v7 0/3]
Subsystems (3)
Eugene Shalygin
maintainerv7 cover [ASUS EC Sensors v7 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 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
Signature · 1 line
2.34.1
Eugene Shalygin
maintainerPATCH v7 1/3 hwmon: (asus-ec-sensors) add driver for ASUS EC
This driver provides the same data as the asus_wmi_ec_sensors driver (and gets it from the same source) but does not use WMI, polling the ACPI EC 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 flexible. The driver now relies on ACPI mutex to lock access to the EC in the same way as the WMI code does.
--- MAINTAINERS | 6 + drivers/hwmon/Kconfig | 11 + drivers/hwmon/Makefile | 1 + drivers/hwmon/asus-ec-sensors.c | 694 ++++++++++++++++++++++++++++++++ 4 files changed, 712 insertions(+) create mode 100644 drivers/hwmon/asus-ec-sensors.c
MAINTAINERS +6 -0
@@ -3012,6 +3012,12 @@ L: [email protected] S: Maintained F: drivers/hwmon/asus_wmi_ec_sensors.c +ASUS EC HARDWARE MONITOR DRIVER +M: Eugene Shalygin <[email protected]> +L: [email protected] +S: Maintained +F: drivers/hwmon/asus-ec-sensors.c + ASUS WIRELESS RADIO CONTROL DRIVER M: João Paulo Rechi Vita <[email protected]> L: [email protected]
drivers/hwmon/Kconfig +11 -0
@@ -2253,6 +2253,17 @@ config SENSORS_ASUS_WMI_EC This driver can also be built as a module. If so, the module will be called asus_wmi_sensors_ec. +config SENSORS_ASUS_EC + tristate "ASUS EC Sensors" + help + If you say yes here you get support for the ACPI embedded controller + hardware monitoring interface found in ASUS motherboards. The driver + currently supports B550/X570 boards, although other ASUS boards might + provide this monitoring interface as well. + + This driver can also be built as a module. If so, the module + will be called asus_ec_sensors. + endif # ACPI endif # HWMON
drivers/hwmon/Makefile +1 -0
@@ -9,6 +9,7 @@ obj-$(CONFIG_HWMON_VID) += hwmon-vid.o # APCI drivers obj-$(CONFIG_SENSORS_ACPI_POWER) += acpi_power_meter.o obj-$(CONFIG_SENSORS_ATK0110) += asus_atk0110.o +obj-$(CONFIG_SENSORS_ASUS_EC) += asus-ec-sensors.o obj-$(CONFIG_SENSORS_ASUS_WMI) += asus_wmi_sensors.o obj-$(CONFIG_SENSORS_ASUS_WMI_EC) += asus_wmi_ec_sensors.o
drivers/hwmon/asus-ec-sensors.c new file +694 -0
694 lines not on this page · raw message
Signature · 1 line
2.34.1
Eugene Shalygin
maintainerRe: [ASUS EC Sensors v7 1/3] hwmon: (asus-ec-sensors) add driver for ASUS EC
I did not read carefully what I committed and now two small corrections are required (see inline). Should I resend again?
drivers/hwmon/asus-ec-sensors.c line 209
Quoted 3 lines · Eugene Shalygin
drivers/hwmon/asus-ec-sensors.c new file +3
-0+DMI_EXACT_MATCH_BOARD (VENDOR_ASUS_UPPER_CASE ,"ROG STRIX X570-F GAMING" , +SENSOR_SET_TEMP_CHIPSET_CPU_MB | + SENSOR_TEMP_T_SENSOR | SENSOR_FAN_CHIPSET
Redundant line break.
Quoted 14 lines
drivers/hwmon/asus-ec-sensors.c new file +12
-0+ ), + DMI_EXACT_MATCH_BOARD(VENDOR_ASUS_UPPER_CASE, "ROG STRIX X570-I GAMING", + SENSOR_TEMP_T_SENSOR | SENSOR_FAN_VRM_HS | + SENSOR_FAN_CHIPSET | SENSOR_CURR_CPU), +struct ec_sensors_data { +unsigned long board_sensors; +struct ec_sensor *sensors; +/** EC registers to read from */ +u16 *registers; +u8 *read_buffer; +/** sorted list of unique register banks */ +u8 banks[ASUS_EC_MAX_BANK +1 ];
drivers/hwmon/asus-ec-sensors.c line 239
Quoted 10 lines
drivers/hwmon/asus-ec-sensors.c new file +10
-0+/** in jiffies */ +unsigned long last_updated; +acpi_handle aml_mutex; +/** number of board EC sensors */ +u8 nr_sensors; +/** number of EC registers to read (sensor might span more than 1 register) */ +u8 nr_registers; +/** number of unique register banks */ +u8 nr_banks; +};
Forgot to remove doc-comments.
Thanks,
Eugene
Guenter Roeck
maintainerRe: [ASUS EC Sensors v7 1/3] hwmon: (asus-ec-sensors) add driver for ASUS EC
Quoted 3 lines · Eugene Shalygin
I did not read carefully what I committed and now two small corrections are required (see inline). Should I resend again?
Wait for a couple of days in case there is test coverage or other feedback.
Guenter
Quoted 34 lines · Eugene Shalygin
drivers/hwmon/asus-ec-sensors.c line 209
Quoted 3 lines
drivers/hwmon/asus-ec-sensors.c new file +3
-0+DMI_EXACT_MATCH_BOARD (VENDOR_ASUS_UPPER_CASE ,"ROG STRIX X570-F GAMING" , +SENSOR_SET_TEMP_CHIPSET_CPU_MB | + SENSOR_TEMP_T_SENSOR | SENSOR_FAN_CHIPSETRedundant line break.
Quoted 14 lines
drivers/hwmon/asus-ec-sensors.c new file +12
-0+ ), + DMI_EXACT_MATCH_BOARD(VENDOR_ASUS_UPPER_CASE, "ROG STRIX X570-I GAMING", + SENSOR_TEMP_T_SENSOR | SENSOR_FAN_VRM_HS | + SENSOR_FAN_CHIPSET | SENSOR_CURR_CPU), +struct ec_sensors_data { +unsigned long board_sensors; +struct ec_sensor *sensors; +/** EC registers to read from */ +u16 *registers; +u8 *read_buffer; +/** sorted list of unique register banks */ +u8 banks[ASUS_EC_MAX_BANK +1 ];drivers/hwmon/asus-ec-sensors.c line 239
Quoted 10 lines
drivers/hwmon/asus-ec-sensors.c new file +10
-0+/** in jiffies */ +unsigned long last_updated; +acpi_handle aml_mutex; +/** number of board EC sensors */ +u8 nr_sensors; +/** number of EC registers to read (sensor might span more than 1 register) */ +u8 nr_registers; +/** number of unique register banks */ +u8 nr_banks; +};Forgot to remove doc-comments.
Thanks,
Eugene
Oleksandr Natalenko
Tested-byRe: [ASUS EC Sensors v7 1/3] hwmon: (asus-ec-sensors) add driver for ASUS EC
Hello.
Quoted 7 lines · On čtvrtek 20. ledna 2022 1:45:40 CET Guenter Roeck wrote:
Quoted 3 lines · Eugene Shalygin
I did not read carefully what I committed and now two small corrections are required (see inline). Should I resend again?
Wait for a couple of days in case there is test coverage or other feedback.
along with line break/comments fixes.
I'd also appreciate Cc'ing me on this submission.
Thanks.
Quoted 39 lines
Guenter
Quoted 34 lines · Eugene Shalygin
drivers/hwmon/asus-ec-sensors.c line 209
Quoted 3 lines
drivers/hwmon/asus-ec-sensors.c new file +3
-0+DMI_EXACT_MATCH_BOARD (VENDOR_ASUS_UPPER_CASE ,"ROG STRIX X570-F GAMING" , +SENSOR_SET_TEMP_CHIPSET_CPU_MB | + SENSOR_TEMP_T_SENSOR | SENSOR_FAN_CHIPSETRedundant line break.
Quoted 14 lines
drivers/hwmon/asus-ec-sensors.c new file +12
-0+ ), + DMI_EXACT_MATCH_BOARD(VENDOR_ASUS_UPPER_CASE, "ROG STRIX X570-I GAMING", + SENSOR_TEMP_T_SENSOR | SENSOR_FAN_VRM_HS | + SENSOR_FAN_CHIPSET | SENSOR_CURR_CPU), +struct ec_sensors_data { +unsigned long board_sensors; +struct ec_sensor *sensors; +/** EC registers to read from */ +u16 *registers; +u8 *read_buffer; +/** sorted list of unique register banks */ +u8 banks[ASUS_EC_MAX_BANK +1 ];drivers/hwmon/asus-ec-sensors.c line 239
Quoted 10 lines
drivers/hwmon/asus-ec-sensors.c new file +10
-0+/** in jiffies */ +unsigned long last_updated; +acpi_handle aml_mutex; +/** number of board EC sensors */ +u8 nr_sensors; +/** number of EC registers to read (sensor might span more than 1 register) */ +u8 nr_registers; +/** number of unique register banks */ +u8 nr_banks; +};Forgot to remove doc-comments.
Thanks,
Eugene
Signature · 1 line
Oleksandr Natalenko (post-factum)
Eugene Shalygin
maintainerPATCH v7 2/3 hwmon: (asus-ec-sensors) update documentation
In reply to Eugene Shalygin--- 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
Documentation/hwmon/asus_ec_sensors.rst new file +52 -0
@@ -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.
Documentation/hwmon/asus_wmi_ec_sensors.rst deleted +0 -38
@@ -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
Signature · 1 line
2.34.1
Eugene Shalygin
maintainerPATCH v7 3/3 hwmon: deprecate asis_wmi_ec_sensors driver
In reply to Eugene ShalyginDeprecate the asus_wmi_ec_sensors driver in favor of the asus_ec_sensors
--- drivers/hwmon/Kconfig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/hwmon/Kconfig +4 -1
@@ -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.
Signature · 1 line
2.34.1