diff mbox series

[v3,4/4] hwmon: (asus-ec-sensors) add PRIME X470-PRO board

Message ID 20220427143001.1443605-5-eugene.shalygin@gmail.com (mailing list archive)
State Accepted
Headers show
Series asus-ec-sensors: add support for board families | expand

Commit Message

Eugene Shalygin April 27, 2022, 2:30 p.m. UTC
This board is supposed to be handled by the asus-wmi-sensors driver,
but due to a buggy WMI implementation the driver and the official ASUS
software make the BIOS hang together with fan controls [1, 2].

This driver complements values provided by the SIO chip and does not
freeze the BIOS, as tested by a user [2].

[1] https://github.com/electrified/asus-wmi-sensors/blob/master/README.md
[2] https://github.com/zeule/asus-ec-sensors/issues/12

Signed-off-by: Eugene Shalygin <eugene.shalygin@gmail.com>
---
 drivers/hwmon/asus-ec-sensors.c | 43 +++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

Comments

Eugene Shalygin April 27, 2022, 4:57 p.m. UTC | #1
Günter,

I forgot to add PRIME X470-PRO to the list of supported boards in
Documentation/hwmon/asus_ec_sensors.rst. Could you, please, add that?
It should be the first entry. Commit
8f8db4b5d10cc4a2a801514e677dd5205651b771. Or should I resend this
patch?

Thank you,
Eugene

On Wed, 27 Apr 2022 at 16:30, Eugene Shalygin <eugene.shalygin@gmail.com> wrote:
>
> This board is supposed to be handled by the asus-wmi-sensors driver,
> but due to a buggy WMI implementation the driver and the official ASUS
> software make the BIOS hang together with fan controls [1, 2].
>
> This driver complements values provided by the SIO chip and does not
> freeze the BIOS, as tested by a user [2].
>
> [1] https://github.com/electrified/asus-wmi-sensors/blob/master/README.md
> [2] https://github.com/zeule/asus-ec-sensors/issues/12
>
> Signed-off-by: Eugene Shalygin <eugene.shalygin@gmail.com>
> ---
>  drivers/hwmon/asus-ec-sensors.c | 43 +++++++++++++++++++++++++++++++++
>  1 file changed, 43 insertions(+)
>
> diff --git a/drivers/hwmon/asus-ec-sensors.c b/drivers/hwmon/asus-ec-sensors.c
> index 109c3920d77c..998d49d6b799 100644
> --- a/drivers/hwmon/asus-ec-sensors.c
> +++ b/drivers/hwmon/asus-ec-sensors.c
> @@ -137,10 +137,41 @@ enum ec_sensors {
>
>  enum board_family {
>         family_unknown,
> +       family_amd_400_series,
>         family_amd_500_series,
>  };
>
>  /* All the known sensors for ASUS EC controllers */
> +static const struct ec_sensor_info sensors_family_amd_400[] = {
> +       [ec_sensor_temp_chipset] =
> +               EC_SENSOR("Chipset", hwmon_temp, 1, 0x00, 0x3a),
> +       [ec_sensor_temp_cpu] =
> +               EC_SENSOR("CPU", hwmon_temp, 1, 0x00, 0x3b),
> +       [ec_sensor_temp_mb] =
> +               EC_SENSOR("Motherboard", hwmon_temp, 1, 0x00, 0x3c),
> +       [ec_sensor_temp_t_sensor] =
> +               EC_SENSOR("T_Sensor", hwmon_temp, 1, 0x00, 0x3d),
> +       [ec_sensor_temp_vrm] =
> +               EC_SENSOR("VRM", hwmon_temp, 1, 0x00, 0x3e),
> +       [ec_sensor_in_cpu_core] =
> +               EC_SENSOR("CPU Core", hwmon_in, 2, 0x00, 0xa2),
> +       [ec_sensor_fan_cpu_opt] =
> +               EC_SENSOR("CPU_Opt", hwmon_fan, 2, 0x00, 0xbc),
> +       [ec_sensor_fan_vrm_hs] =
> +               EC_SENSOR("VRM HS", hwmon_fan, 2, 0x00, 0xb2),
> +       [ec_sensor_fan_chipset] =
> +               /* no chipset fans in this generation */
> +               EC_SENSOR("Chipset", hwmon_fan, 0, 0x00, 0x00),
> +       [ec_sensor_fan_water_flow] =
> +               EC_SENSOR("Water_Flow", hwmon_fan, 2, 0x00, 0xb4),
> +       [ec_sensor_curr_cpu] =
> +               EC_SENSOR("CPU", hwmon_curr, 1, 0x00, 0xf4),
> +       [ec_sensor_temp_water_in] =
> +               EC_SENSOR("Water_In", hwmon_temp, 1, 0x01, 0x0d),
> +       [ec_sensor_temp_water_out] =
> +               EC_SENSOR("Water_Out", hwmon_temp, 1, 0x01, 0x0b),
> +};
> +
>  static const struct ec_sensor_info sensors_family_amd_500[] = {
>         [ec_sensor_temp_chipset] =
>                 EC_SENSOR("Chipset", hwmon_temp, 1, 0x00, 0x3a),
> @@ -186,6 +217,15 @@ struct ec_board_info {
>  };
>
>  static const struct ec_board_info board_info[] = {
> +       {
> +               .board_names = {"PRIME X470-PRO"},
> +               .sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB |
> +                       SENSOR_TEMP_T_SENSOR | SENSOR_TEMP_VRM |
> +                       SENSOR_FAN_CPU_OPT |
> +                       SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE,
> +               .mutex_path = ACPI_GLOBAL_LOCK_PSEUDO_PATH,
> +               .family = family_amd_400_series,
> +       },
>         {
>                 .board_names = {"PRIME X570-PRO"},
>                 .sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | SENSOR_TEMP_VRM |
> @@ -753,6 +793,9 @@ static int __init asus_ec_probe(struct platform_device *pdev)
>         ec_data->board_info = pboard_info;
>
>         switch (ec_data->board_info->family) {
> +       case family_amd_400_series:
> +               ec_data->sensors_info = sensors_family_amd_400;
> +               break;
>         case family_amd_500_series:
>                 ec_data->sensors_info = sensors_family_amd_500;
>                 break;
> --
> 2.35.1
>
Guenter Roeck April 27, 2022, 5:56 p.m. UTC | #2
On 4/27/22 09:57, Eugene Shalygin wrote:
> Günter,
> 
> I forgot to add PRIME X470-PRO to the list of supported boards in
> Documentation/hwmon/asus_ec_sensors.rst. Could you, please, add that?
> It should be the first entry. Commit
> 8f8db4b5d10cc4a2a801514e677dd5205651b771. Or should I resend this
> patch?
> 

Just send a follow-up patch.

Guenter
Guenter Roeck April 27, 2022, 6 p.m. UTC | #3
On 4/27/22 09:57, Eugene Shalygin wrote:
> Günter,
> 
> I forgot to add PRIME X470-PRO to the list of supported boards in
> Documentation/hwmon/asus_ec_sensors.rst. Could you, please, add that?
> It should be the first entry. Commit
> 8f8db4b5d10cc4a2a801514e677dd5205651b771. Or should I resend this
> patch?
> 

In this context: Your e-mails always include the following header:

To:     unlisted-recipients:; (no To-header on input)

If I forget to remove it in a reply, this causes a rejection of
the reply by the mailing list and may trigger anti-spam filters.
Please fix your e-mail system/configuration to avoid that.

Thanks,
Guenter
diff mbox series

Patch

diff --git a/drivers/hwmon/asus-ec-sensors.c b/drivers/hwmon/asus-ec-sensors.c
index 109c3920d77c..998d49d6b799 100644
--- a/drivers/hwmon/asus-ec-sensors.c
+++ b/drivers/hwmon/asus-ec-sensors.c
@@ -137,10 +137,41 @@  enum ec_sensors {
 
 enum board_family {
 	family_unknown,
+	family_amd_400_series,
 	family_amd_500_series,
 };
 
 /* All the known sensors for ASUS EC controllers */
+static const struct ec_sensor_info sensors_family_amd_400[] = {
+	[ec_sensor_temp_chipset] =
+		EC_SENSOR("Chipset", hwmon_temp, 1, 0x00, 0x3a),
+	[ec_sensor_temp_cpu] =
+		EC_SENSOR("CPU", hwmon_temp, 1, 0x00, 0x3b),
+	[ec_sensor_temp_mb] =
+		EC_SENSOR("Motherboard", hwmon_temp, 1, 0x00, 0x3c),
+	[ec_sensor_temp_t_sensor] =
+		EC_SENSOR("T_Sensor", hwmon_temp, 1, 0x00, 0x3d),
+	[ec_sensor_temp_vrm] =
+		EC_SENSOR("VRM", hwmon_temp, 1, 0x00, 0x3e),
+	[ec_sensor_in_cpu_core] =
+		EC_SENSOR("CPU Core", hwmon_in, 2, 0x00, 0xa2),
+	[ec_sensor_fan_cpu_opt] =
+		EC_SENSOR("CPU_Opt", hwmon_fan, 2, 0x00, 0xbc),
+	[ec_sensor_fan_vrm_hs] =
+		EC_SENSOR("VRM HS", hwmon_fan, 2, 0x00, 0xb2),
+	[ec_sensor_fan_chipset] =
+		/* no chipset fans in this generation */
+		EC_SENSOR("Chipset", hwmon_fan, 0, 0x00, 0x00),
+	[ec_sensor_fan_water_flow] =
+		EC_SENSOR("Water_Flow", hwmon_fan, 2, 0x00, 0xb4),
+	[ec_sensor_curr_cpu] =
+		EC_SENSOR("CPU", hwmon_curr, 1, 0x00, 0xf4),
+	[ec_sensor_temp_water_in] =
+		EC_SENSOR("Water_In", hwmon_temp, 1, 0x01, 0x0d),
+	[ec_sensor_temp_water_out] =
+		EC_SENSOR("Water_Out", hwmon_temp, 1, 0x01, 0x0b),
+};
+
 static const struct ec_sensor_info sensors_family_amd_500[] = {
 	[ec_sensor_temp_chipset] =
 		EC_SENSOR("Chipset", hwmon_temp, 1, 0x00, 0x3a),
@@ -186,6 +217,15 @@  struct ec_board_info {
 };
 
 static const struct ec_board_info board_info[] = {
+	{
+		.board_names = {"PRIME X470-PRO"},
+		.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB |
+			SENSOR_TEMP_T_SENSOR | SENSOR_TEMP_VRM |
+			SENSOR_FAN_CPU_OPT |
+			SENSOR_CURR_CPU | SENSOR_IN_CPU_CORE,
+		.mutex_path = ACPI_GLOBAL_LOCK_PSEUDO_PATH,
+		.family = family_amd_400_series,
+	},
 	{
 		.board_names = {"PRIME X570-PRO"},
 		.sensors = SENSOR_SET_TEMP_CHIPSET_CPU_MB | SENSOR_TEMP_VRM |
@@ -753,6 +793,9 @@  static int __init asus_ec_probe(struct platform_device *pdev)
 	ec_data->board_info = pboard_info;
 
 	switch (ec_data->board_info->family) {
+	case family_amd_400_series:
+		ec_data->sensors_info = sensors_family_amd_400;
+		break;
 	case family_amd_500_series:
 		ec_data->sensors_info = sensors_family_amd_500;
 		break;