Skip to content

Commit bfcda5c

Browse files
kuu-rtij-intel
authored andcommitted
alienware-wmi: create_thermal_profile() no longer brute-forces IDs
WMAX_METHOD_THERMAL_INFORMATION has a *system description* operation that outputs a buffer with the following structure: out[0] -> Number of fans out[1] -> Number of sensors out[2] -> 0x00 out[3] -> Number of thermal modes This is now used by create_thermal_profile() to retrieve available thermal codes instead of brute-forcing every ID. Tested on an Alienware x15 R1. Verified by checking ACPI tables of supported models. Signed-off-by: Kurt Borja <kuurtb@gmail.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20241111183623.14691-1-kuurtb@gmail.com Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
1 parent 01bd181 commit bfcda5c

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

drivers/platform/x86/dell/alienware-wmi.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ enum WMAX_CONTROL_STATES {
6868
};
6969

7070
enum WMAX_THERMAL_INFORMATION_OPERATIONS {
71+
WMAX_OPERATION_SYS_DESCRIPTION = 0x02,
7172
WMAX_OPERATION_LIST_IDS = 0x03,
7273
WMAX_OPERATION_CURRENT_PROFILE = 0x0B,
7374
};
@@ -1110,13 +1111,22 @@ static int thermal_profile_set(struct platform_profile_handler *pprof,
11101111
static int create_thermal_profile(void)
11111112
{
11121113
u32 out_data;
1114+
u8 sys_desc[4];
1115+
u32 first_mode;
11131116
enum wmax_thermal_mode mode;
11141117
enum platform_profile_option profile;
11151118
int ret;
11161119

1117-
for (u8 i = 0x2; i <= 0xD; i++) {
1120+
ret = wmax_thermal_information(WMAX_OPERATION_SYS_DESCRIPTION,
1121+
0, (u32 *) &sys_desc);
1122+
if (ret < 0)
1123+
return ret;
1124+
1125+
first_mode = sys_desc[0] + sys_desc[1];
1126+
1127+
for (u32 i = 0; i < sys_desc[3]; i++) {
11181128
ret = wmax_thermal_information(WMAX_OPERATION_LIST_IDS,
1119-
i, &out_data);
1129+
i + first_mode, &out_data);
11201130

11211131
if (ret == -EIO)
11221132
return ret;

0 commit comments

Comments
 (0)