[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <198a578f-99d6-4d98-8186-eab141a2550d@gmx.de>
Date: Sun, 16 Feb 2025 22:29:29 +0100
From: Armin Wolf <W_Armin@....de>
To: Kurt Borja <kuurtb@...il.com>,
Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
Cc: platform-driver-x86@...r.kernel.org, Hans de Goede <hdegoede@...hat.com>,
Dell.Client.Kernel@...l.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 10/10] platform/x86: alienware-wmi: Improve and update
documentation
Am 16.02.25 um 21:51 schrieb Kurt Borja:
> On Sun Feb 16, 2025 at 1:22 AM -05, Armin Wolf wrote:
>> Am 08.02.25 um 06:16 schrieb Kurt Borja:
>>
>>> Use tables to describe method operations instead of using pseudo-code.
>>> Drop unknown method descriptions to avoid redundancy. Drop GPIO section
>>> as it is currently irrelevant to this driver. Update Thermal_Information
>>> method documentation. Add one more helpful developer to the kudos section.
>>>
>>> Signed-off-by: Kurt Borja <kuurtb@...il.com>
>>> ---
>>> Documentation/wmi/devices/alienware-wmi.rst | 390 ++++++--------------
>>> 1 file changed, 122 insertions(+), 268 deletions(-)
>>>
>>> diff --git a/Documentation/wmi/devices/alienware-wmi.rst b/Documentation/wmi/devices/alienware-wmi.rst
>>> index ddc5e561960e..2bb3abfd9cd7 100644
>>> --- a/Documentation/wmi/devices/alienware-wmi.rst
>>> +++ b/Documentation/wmi/devices/alienware-wmi.rst
>>> @@ -11,7 +11,7 @@ The WMI device WMAX has been implemented for many Alienware and Dell's G-Series
>>> models. Throughout these models, two implementations have been identified. The
>>> first one, used by older systems, deals with HDMI, brightness, RGB, amplifier
>>> and deep sleep control. The second one used by newer systems deals primarily
>>> -with thermal, overclocking, and GPIO control.
>>> +with thermal control and overclocking.
>>>
>>> It is suspected that the latter is used by Alienware Command Center (AWCC) to
>>> manage manufacturer predefined thermal profiles. The alienware-wmi driver
>>> @@ -69,9 +69,6 @@ data using the `bmfdec <https://github.com/pali/bmfdec>`_ utility:
>>> [WmiMethodId(164), Implemented, read, write, Description("Tobii Camera Power Off.")] void TobiiCameraPowerOff([out] uint32 argr);
>>> };
>>>
>>> -Some of these methods get quite intricate so we will describe them using
>>> -pseudo-code that vaguely resembles the original ASL code.
>>> -
>>> Methods not described in the following document have unknown behavior.
>>>
>>> Argument Structure
>>> @@ -87,175 +84,136 @@ ID 0xA0, the argument you would pass to the method is 0xA001.
>>> Thermal Methods
>>> ===============
>>>
>>> -WMI method Thermal_Information([in] uint32 arg2, [out] uint32 argr)
>>> --------------------------------------------------------------------
>>> -
>>> -::
>>> -
>>> - if BYTE_0(arg2) == 0x01:
>>> - argr = 1
>>> -
>>> - if BYTE_0(arg2) == 0x02:
>>> - argr = SYSTEM_DESCRIPTION
>>> -
>>> - if BYTE_0(arg2) == 0x03:
>>> - if BYTE_1(arg2) == 0x00:
>>> - argr = FAN_ID_0
>>> -
>>> - if BYTE_1(arg2) == 0x01:
>>> - argr = FAN_ID_1
>>> -
>>> - if BYTE_1(arg2) == 0x02:
>>> - argr = FAN_ID_2
>>> -
>>> - if BYTE_1(arg2) == 0x03:
>>> - argr = FAN_ID_3
>>> -
>>> - if BYTE_1(arg2) == 0x04:
>>> - argr = SENSOR_ID_CPU | 0x0100
>>> -
>>> - if BYTE_1(arg2) == 0x05:
>>> - argr = SENSOR_ID_GPU | 0x0100
>>> -
>>> - if BYTE_1(arg2) == 0x06:
>>> - argr = THERMAL_MODE_QUIET_ID
>>> -
>>> - if BYTE_1(arg2) == 0x07:
>>> - argr = THERMAL_MODE_BALANCED_ID
>>> -
>>> - if BYTE_1(arg2) == 0x08:
>>> - argr = THERMAL_MODE_BALANCED_PERFORMANCE_ID
>>> -
>>> - if BYTE_1(arg2) == 0x09:
>>> - argr = THERMAL_MODE_PERFORMANCE_ID
>>> -
>>> - if BYTE_1(arg2) == 0x0A:
>>> - argr = THERMAL_MODE_LOW_POWER_ID
>>> -
>>> - if BYTE_1(arg2) == 0x0B:
>>> - argr = THERMAL_MODE_GMODE_ID
>>> -
>>> - else:
>>> - argr = 0xFFFFFFFF
>>> -
>>> - if BYTE_0(arg2) == 0x04:
>>> - if is_valid_sensor(BYTE_1(arg2)):
>>> - argr = SENSOR_TEMP_C
>>> - else:
>>> - argr = 0xFFFFFFFF
>>> -
>>> - if BYTE_0(arg2) == 0x05:
>>> - if is_valid_fan(BYTE_1(arg2)):
>>> - argr = FAN_RPM()
>>> -
>>> - if BYTE_0(arg2) == 0x06:
>>> - skip
>>> -
>>> - if BYTE_0(arg2) == 0x07:
>>> - argr = 0
>>> -
>>> - If BYTE_0(arg2) == 0x08:
>>> - if is_valid_fan(BYTE_1(arg2)):
>>> - argr = 0
>>> - else:
>>> - argr = 0xFFFFFFFF
>>> -
>>> - if BYTE_0(arg2) == 0x09:
>>> - if is_valid_fan(BYTE_1(arg2)):
>>> - argr = FAN_UNKNOWN_STAT_0()
>>> -
>>> - else:
>>> - argr = 0xFFFFFFFF
>>> -
>>> - if BYTE_0(arg2) == 0x0A:
>>> - argr = THERMAL_MODE_BALANCED_ID
>>> -
>>> - if BYTE_0(arg2) == 0x0B:
>>> - argr = CURRENT_THERMAL_MODE()
>>> -
>>> - if BYTE_0(arg2) == 0x0C:
>>> - if is_valid_fan(BYTE_1(arg2)):
>>> - argr = FAN_UNKNOWN_STAT_1()
>>> - else:
>>> - argr = 0xFFFFFFFF
>>> -
>>> -Operation 0x02 returns a *system description* buffer with the following
>>> -structure:
>>> -
>>> -::
>>> -
>>> - out[0] -> Number of fans
>>> - out[1] -> Number of sensors
>>> - out[2] -> 0x00
>>> - out[3] -> Number of thermal modes
>>> +WMI method GetFanSensors([in] uint32 arg2, [out] uint32 argr)
>>> +-------------------------------------------------------------
>>>
>>> -Operation 0x03 list all available fan IDs, sensor IDs and thermal profile
>>> -codes in order, but different models may have different number of fans and
>>> -thermal profiles. These are the known ranges:
>>> ++--------------------+------------------------------------+--------------------+
>>> +| Operation (Byte 0) | Description | Arguments |
>>> ++====================+====================================+====================+
>>> +| 0x01 | Get the number of fans for a given | - Byte 1: Fan ID |
>>> +| | fan ID. | |
>>> ++--------------------+------------------------------------+--------------------+
>>> +| 0x02 | Get the temperature sensor ID | - Byte 1: Fan ID |
>>> +| | related to a fan sensor ID | |
>>> ++--------------------+------------------------------------+--------------------+
>> After looking at a acpidump from a alienware machine i discovered that operation 0x02
>> takes a second argument which acts like an index.
>>
>> Could it be that operation 0x01 actually returns the number of temperature sensors
>> associated with a given fan which can then be queried using operation 0x02?
> After reading a couple of acpidumps, I think you might be right.
>
> It's hard to know because in all laptops I've seen, operation 0x01
> returns 1 for all fans. The only exception is the Alienware Aurora
> series, where it seems your hypothesis holds true. However even in this
> model, op 0x02 list all sensors for almost all fans so I don't know how
> to interpret that.
>
> Anyway, I'm going with your hypothesis because 0x01 does give the
> correct upper bound for op 0x02 index. I'll think how to reconcile this
> with my approach for fan labels.
>
> Btw, what is the model of the acpidump you mentioned? Can you please
> send it to me? I keep a private stash of acpidumps for alienware
> devices.
>
Maybe you can use the "pwmX_auto_channels_temp" attribute to expose this information
to userspace?
Anyway i attached the acpidump you requested. Sadly i cannot remember from which device
i got it from.
Thanks,
Armin Wolf
>>> -* Fan IDs: from 2 up to 4
>>> -* Sensor IDs: 2
>>> -* Thermal profile codes: from 1 up to 7
>>> +WMI method Thermal_Information([in] uint32 arg2, [out] uint32 argr)
>>> +-------------------------------------------------------------------
>>>
>>> -In total BYTE_1(ARG2) may range from 0x5 up to 0xD depending on the model.
>>> ++--------------------+------------------------------------+--------------------+
>>> +| Operation (Byte 0) | Description | Arguments |
>>> ++====================+====================================+====================+
>>> +| 0x01 | Unknown. | - None |
>>> ++--------------------+------------------------------------+--------------------+
>>> +| 0x02 | Get system description number with | - None |
>>> +| | the following structure: | |
>>> +| | | |
>>> +| | - Byte 0: Number of fans | |
>>> +| | - Byte 1: Number of temperature | |
>>> +| | sensors | |
>>> +| | - Byte 2: Unknown | |
>>> +| | - Byte 3: Number of thermal | |
>>> +| | profiles | |
>>> ++--------------------+------------------------------------+--------------------+
>>> +| 0x03 | List an ID or resource at a given | - Byte 1: Index |
>>> +| | index. Fan IDs, temperature IDs, | |
>>> +| | unknown IDs and thermal profile | |
>>> +| | IDs are listed in that exact | |
>>> +| | order. | |
>>> +| | | |
>>> +| | Operation 0x02 is used to know | |
>>> +| | which indexes map to which | |
>>> +| | resources. | |
>>> +| | | |
>>> +| | **Returns:** ID at a given index | |
>>> ++--------------------+------------------------------------+--------------------+
>>> +| 0x04 | Get the current temperature for a | - Byte 1: Sensor |
>>> +| | given temperature sensor. | ID |
>>> ++--------------------+------------------------------------+--------------------+
>>> +| 0x05 | Get the current RPM for a given | - Byte 1: Fan ID |
>>> +| | fan. | |
>>> ++--------------------+------------------------------------+--------------------+
>>> +| 0x06 | Get fan speed percentage. (not | - Byte 1: Fan ID |
>>> +| | implemented in every model) | |
>>> ++--------------------+------------------------------------+--------------------+
>>> +| 0x07 | Unknown. | - Unknown |
>>> ++--------------------+------------------------------------+--------------------+
>>> +| 0x08 | Get minimum RPM for a given FAN | - Byte 1: Fan ID |
>>> +| | ID. | |
>>> ++--------------------+------------------------------------+--------------------+
>>> +| 0x09 | Get maximum RPM for a given FAN | - Byte 1: Fan ID |
>>> +| | ID. | |
>>> ++--------------------+------------------------------------+--------------------+
>>> +| 0x09 | Get maximum RPM for a given FAN | - Byte 1: Fan ID |
>>> +| | ID. | |
>>> ++--------------------+------------------------------------+--------------------+
>> Duplicated entry here.
> Thanks!
>
>> Other than that the new documentation looks quite good.
> The old one was quite ugly so I'm happy with this too :p
>
View attachment "acpidump.log" of type "text/x-log" (3413057 bytes)
Powered by blists - more mailing lists