mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Armin Wolf <W_Armin@gmx.de>
To: "Kurt Borja" <kuurtb@gmail.com>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Hans de Goede" <hdegoede@redhat.com>
Cc: platform-driver-x86@vger.kernel.org, Dell.Client.Kernel@dell.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] platform/x86: alienware-wmi-wmax: Add appropriate labels to fans
Date: Fri, 30 May 2025 23:54:09 +0200	[thread overview]
Message-ID: <6d9c9069-b672-4e06-917a-a1928d9fd993@gmx.de> (raw)
In-Reply-To: <20250528-awcc-labels-v1-1-6aa39d8e4c3d@gmail.com>

Am 28.05.25 um 12:47 schrieb Kurt Borja:

> Add known fan type IDs and match them to an appropriate label in
> awcc_hwmon_read_string().
>
> Additionally, add the AWCC_TEMP_SENSOR_FRONT type, which was inferred
> from it's related fan type in supported systems.

Reviewed-by: Armin Wolf <W_Armin@gmx.de>

> Signed-off-by: Kurt Borja <kuurtb@gmail.com>
> ---
>   drivers/platform/x86/dell/alienware-wmi-wmax.c | 100 ++++++++++++++++---------
>   1 file changed, 63 insertions(+), 37 deletions(-)
>
> diff --git a/drivers/platform/x86/dell/alienware-wmi-wmax.c b/drivers/platform/x86/dell/alienware-wmi-wmax.c
> index c42f9228b0b255fe962b735ac96486824e83945f..b25eb3225d8e5385384880a9cb480aaf3cb4d0a8 100644
> --- a/drivers/platform/x86/dell/alienware-wmi-wmax.c
> +++ b/drivers/platform/x86/dell/alienware-wmi-wmax.c
> @@ -273,9 +273,29 @@ enum AWCC_SPECIAL_THERMAL_CODES {
>   
>   enum AWCC_TEMP_SENSOR_TYPES {
>   	AWCC_TEMP_SENSOR_CPU			= 0x01,
> +	AWCC_TEMP_SENSOR_FRONT			= 0x03,
>   	AWCC_TEMP_SENSOR_GPU			= 0x06,
>   };
>   
> +enum AWCC_FAN_TYPES {
> +	AWCC_FAN_CPU_1				= 0x32,
> +	AWCC_FAN_GPU_1				= 0x33,
> +	AWCC_FAN_PCI				= 0x34,
> +	AWCC_FAN_MID				= 0x35,
> +	AWCC_FAN_TOP_1				= 0x36,
> +	AWCC_FAN_SIDE				= 0x37,
> +	AWCC_FAN_U2_1				= 0x38,
> +	AWCC_FAN_U2_2				= 0x39,
> +	AWCC_FAN_FRONT_1			= 0x3A,
> +	AWCC_FAN_CPU_2				= 0x3B,
> +	AWCC_FAN_GPU_2				= 0x3C,
> +	AWCC_FAN_TOP_2				= 0x3D,
> +	AWCC_FAN_TOP_3				= 0x3E,
> +	AWCC_FAN_FRONT_2			= 0x3F,
> +	AWCC_FAN_BOTTOM_1			= 0x40,
> +	AWCC_FAN_BOTTOM_2			= 0x41,
> +};
> +
>   enum awcc_thermal_profile {
>   	AWCC_PROFILE_USTT_BALANCED,
>   	AWCC_PROFILE_USTT_BALANCED_PERFORMANCE,
> @@ -314,7 +334,6 @@ struct wmax_u32_args {
>   
>   struct awcc_fan_data {
>   	unsigned long auto_channels_temp;
> -	const char *label;
>   	u32 min_rpm;
>   	u32 max_rpm;
>   	u8 suspend_cache;
> @@ -896,6 +915,9 @@ static int awcc_hwmon_read_string(struct device *dev, enum hwmon_sensor_types ty
>   		case AWCC_TEMP_SENSOR_CPU:
>   			*str = "CPU";
>   			break;
> +		case AWCC_TEMP_SENSOR_FRONT:
> +			*str = "Front";
> +			break;
>   		case AWCC_TEMP_SENSOR_GPU:
>   			*str = "GPU";
>   			break;
> @@ -906,7 +928,46 @@ static int awcc_hwmon_read_string(struct device *dev, enum hwmon_sensor_types ty
>   
>   		break;
>   	case hwmon_fan:
> -		*str = priv->fan_data[channel]->label;
> +		switch (priv->fan_data[channel]->id) {
> +		case AWCC_FAN_CPU_1:
> +		case AWCC_FAN_CPU_2:
> +			*str = "CPU Fan";
> +			break;
> +		case AWCC_FAN_GPU_1:
> +		case AWCC_FAN_GPU_2:
> +			*str = "GPU Fan";
> +			break;
> +		case AWCC_FAN_PCI:
> +			*str = "PCI Fan";
> +			break;
> +		case AWCC_FAN_MID:
> +			*str = "Mid Fan";
> +			break;
> +		case AWCC_FAN_TOP_1:
> +		case AWCC_FAN_TOP_2:
> +		case AWCC_FAN_TOP_3:
> +			*str = "Top Fan";
> +			break;
> +		case AWCC_FAN_SIDE:
> +			*str = "Side Fan";
> +			break;
> +		case AWCC_FAN_U2_1:
> +		case AWCC_FAN_U2_2:
> +			*str = "U.2 Fan";
> +			break;
> +		case AWCC_FAN_FRONT_1:
> +		case AWCC_FAN_FRONT_2:
> +			*str = "Front Fan";
> +			break;
> +		case AWCC_FAN_BOTTOM_1:
> +		case AWCC_FAN_BOTTOM_2:
> +			*str = "Bottom Fan";
> +			break;
> +		default:
> +			*str = "Unknown Fan";
> +			break;
> +		}
> +
>   		break;
>   	default:
>   		return -EOPNOTSUPP;
> @@ -1051,40 +1112,6 @@ static int awcc_hwmon_temps_init(struct wmi_device *wdev)
>   	return 0;
>   }
>   
> -static char *awcc_get_fan_label(unsigned long *fan_temps)
> -{
> -	unsigned int temp_count = bitmap_weight(fan_temps, AWCC_ID_BITMAP_SIZE);
> -	char *label;
> -	u8 temp_id;
> -
> -	switch (temp_count) {
> -	case 0:
> -		label = "Independent Fan";
> -		break;
> -	case 1:
> -		temp_id = find_first_bit(fan_temps, AWCC_ID_BITMAP_SIZE);
> -
> -		switch (temp_id) {
> -		case AWCC_TEMP_SENSOR_CPU:
> -			label = "Processor Fan";
> -			break;
> -		case AWCC_TEMP_SENSOR_GPU:
> -			label = "Video Fan";
> -			break;
> -		default:
> -			label = "Unknown Fan";
> -			break;
> -		}
> -
> -		break;
> -	default:
> -		label = "Shared Fan";
> -		break;
> -	}
> -
> -	return label;
> -}
> -
>   static int awcc_hwmon_fans_init(struct wmi_device *wdev)
>   {
>   	struct awcc_priv *priv = dev_get_drvdata(&wdev->dev);
> @@ -1138,7 +1165,6 @@ static int awcc_hwmon_fans_init(struct wmi_device *wdev)
>   		fan_data->id = id;
>   		fan_data->min_rpm = min_rpm;
>   		fan_data->max_rpm = max_rpm;
> -		fan_data->label = awcc_get_fan_label(fan_temps);
>   		bitmap_gather(gather, fan_temps, priv->temp_sensors, AWCC_ID_BITMAP_SIZE);
>   		bitmap_copy(&fan_data->auto_channels_temp, gather, BITS_PER_LONG);
>   		priv->fan_data[i] = fan_data;
>
> ---
> base-commit: 9c96808f10d84156b5e98e16176b725ec5a1386f
> change-id: 20250528-awcc-labels-372162572ad7

  reply	other threads:[~2025-05-30 21:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-28 10:47 Kurt Borja
2025-05-30 21:54 ` Armin Wolf [this message]
2025-06-09 10:04 ` Ilpo Järvinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6d9c9069-b672-4e06-917a-a1928d9fd993@gmx.de \
    --to=w_armin@gmx.de \
    --cc=Dell.Client.Kernel@dell.com \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=kuurtb@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®