platform/x86: alienware-wmi-wmax: Extend support to many devices
Subsystems (2)
Kurt Borja
maintainerv2 cover platform/x86: alienware-wmi-wmax: Extend support to many devices
Hi all,
After a few months of searching for acpidumps of elegible laptops, I came to the conclusion that if I continue this way, many devices will never get support for this interface. This is due to very few users uploading acpidumps of their machines or contacting me of that matter.
With this patchset, hopefully all (or almost all) elegible devices will get support.
I'm submitting this as an RFC because I'm extending the WMI API and also extending support to many unknown laptops models.
This depends on
platform/x86: alienware-wmi-wmax: HWMON support + DebugFS + Improvements
series, because I made a few generalizations there that work even for Alienware desktops.
I sent a v2 right away because I made some silly mistakes. Sorry for the noise.
---
Changes in v2:
[1/2]
- Add kernel-doc to wmidev_get_acpi_device_uid()
[2/2]
- Reworked logic a bit to include a check for !uid before calling strncmp()
Link to v1: https://lore.kernel.org/r/[email protected]
---
Kurt Borja (2):
platform/x86: wmi: Add wmidev_get_acpi_device_uid() platform/x86: alienware-wmi-wmax: Check for AWCC support using _UID
drivers/platform/x86/dell/alienware-wmi-wmax.c | 15 +++++++++------ drivers/platform/x86/wmi.c | 20 +++++++++++++++++--- include/linux/wmi.h | 2 ++ 3 files changed, 28 insertions(+), 9 deletions(-)
---
base-commit: e57eabe2fb044950e6ffdfe01803895043dec0b7
change-id: 20250308-awcc-uid-6ec06bb2572d
prerequisite-change-id: 20250305-hwm-f7bd91902b57:v4
prerequisite-patch-id: 06ff44ce0c6f9bce77eb61a08f358240f1485914
prerequisite-patch-id: d270ae9f1f681a6b6b9685cc13802e8baba0105f
prerequisite-patch-id: 5f744ce03af74a23560118b761ac6529a7c9b172
prerequisite-patch-id: 22c6c5256aee2c17bcd710ec1493b1abccd414cf
prerequisite-patch-id: 75191e2094746de3c12fdd885885d18b2239af89
prerequisite-patch-id: 9f26a3b64824b4f175bbea47c8c9a59fd67f3316
prerequisite-patch-id: 4ff2263e236230e1f96703265d135f0b90390ebd
prerequisite-patch-id: b8844283f8bb46c05ba2e9d7b901bdedfd941731
prerequisite-patch-id: c5122bcce8e7330cdbb18c5d43e321ce69116272
prerequisite-patch-id: ed78dcf947e19652f175d124ade13c08eb3950cc
prerequisite-patch-id: d46a626481e1c49bdd91f6add36f4d6b89edde3e
prerequisite-patch-id: e68a77ec73be34006d5dd754592285e44ffc7f68
Best regards,
Signature · 1 line
~ Kurt
Kurt Borja
maintainerRFC PATCH v2 1/2 platform/x86: wmi: Add wmidev_get_acpi_device_uid()
Add a non-deprecated version of wmi_get_acpi_device_uid().
--- drivers/platform/x86/wmi.c | 20 +++++++++++++++++--- include/linux/wmi.h | 2 ++ 2 files changed, 19 insertions(+), 3 deletions(-)
drivers/platform/x86/wmi.c +17 -3
@@ -636,7 +636,6 @@ EXPORT_SYMBOL_GPL(wmi_has_guid);*/ char *wmi_get_acpi_device_uid (const char *guid_string) { -struct wmi_block *wblock;struct wmi_device *wdev;char *uid;
@@ -644,8 +643,7 @@ char *wmi_get_acpi_device_uid(const char *guid_string)if (IS_ERR (wdev))return NULL ; - wblock = container_of(wdev, struct wmi_block, dev); - uid =acpi_device_uid (wblock->acpi_device); + uid =wmidev_get_acpi_device_uid (wdev);wmi_device_put (wdev);
@@ -653,6 +651,22 @@ char *wmi_get_acpi_device_uid(const char *guid_string) }EXPORT_SYMBOL_GPL (wmi_get_acpi_device_uid); +/** +* wmidev_get_acpi_device_uid() - Get _UID name of a WMI device +* @wdev: A wmi bus device from a driver +* +* Find the _UID of the ACPI device associated with this WMI device. +* +* Return: The ACPI _UID field or NULL if there is no _UID +*/ +char *wmidev_get_acpi_device_uid (struct wmi_device *wdev) +{ + struct wmi_block *wblock = container_of(wdev, struct wmi_block, dev); + +return acpi_device_uid (wblock->acpi_device); +} +EXPORT_SYMBOL_GPL (wmidev_get_acpi_device_uid); +/* * sysfs interface */
include/linux/wmi.h +2 -0
@@ -46,6 +46,8 @@ extern union acpi_object *wmidev_block_query(struct wmi_device *wdev,acpi_status wmidev_block_set (struct wmi_device *wdev,u8 instance,const struct acpi_buffer *in); +char *wmidev_get_acpi_device_uid (struct wmi_device *wdev); +u8 wmidev_instance_count (struct wmi_device *wdev);/**
Signature · 1 line
2.48.1
Re: [PATCH RFC v2 1/2] platform/x86: wmi: Add wmidev_get_acpi_device_uid()
Am 09.03.25 um 06:13 schrieb Kurt Borja:
Quoted 1 line
Add a non-deprecated version of
wmi_get_acpi_device_uid().
Hi,
i can understand you motivation behind this patch, but this is IMHO the wrong approach. Nothing guarantees us that a given ACPI _UID value will reliably signal the presence of WMI methods now or in the future. Because of this i am against this patch.
The correct way would be to use the BMOF data to check for missing WMI methods. I did some work on that which i will announce soon.
Thanks,
Armin Wolf
Quoted 65 lines
Signed-off-by Kurt Borja <[email protected]>--- drivers/platform/x86/wmi.c | 20 +++++++++++++++++--- include/linux/wmi.h | 2 ++ 2 files changed, 19 insertions(+), 3 deletions(-)drivers/platform/x86/wmi.c +17
-3@@ -636,7 +636,6 @@ EXPORT_SYMBOL_GPL(wmi_has_guid);*/ char *wmi_get_acpi_device_uid (const char *guid_string) { -struct wmi_block *wblock;struct wmi_device *wdev;char *uid;@@ -644,8 +643,7 @@ char *wmi_get_acpi_device_uid(const char *guid_string)if (IS_ERR (wdev))return NULL ; - wblock = container_of(wdev, struct wmi_block, dev); - uid =acpi_device_uid (wblock->acpi_device); + uid =wmidev_get_acpi_device_uid (wdev);wmi_device_put (wdev);@@ -653,6 +651,22 @@ char *wmi_get_acpi_device_uid(const char *guid_string) }EXPORT_SYMBOL_GPL (wmi_get_acpi_device_uid); +/** +* wmidev_get_acpi_device_uid() - Get _UID name of a WMI device +* @wdev: A wmi bus device from a driver +* +* Find the _UID of the ACPI device associated with this WMI device. +* +* Return: The ACPI _UID field or NULL if there is no _UID +*/ +char *wmidev_get_acpi_device_uid (struct wmi_device *wdev) +{ + struct wmi_block *wblock = container_of(wdev, struct wmi_block, dev); + +return acpi_device_uid (wblock->acpi_device); +} +EXPORT_SYMBOL_GPL (wmidev_get_acpi_device_uid); +/* * sysfs interface */ include/linux/wmi.h +2
-0@@ -46,6 +46,8 @@ extern union acpi_object *wmidev_block_query(struct wmi_device *wdev,acpi_status wmidev_block_set (struct wmi_device *wdev,u8 instance,const struct acpi_buffer *in); +char *wmidev_get_acpi_device_uid (struct wmi_device *wdev); +u8 wmidev_instance_count (struct wmi_device *wdev);/**
Kurt Borja
maintainerRe: [PATCH RFC v2 1/2] platform/x86: wmi: Add wmidev_get_acpi_device_uid()
Quoted 9 lines · Armin Wolf
Am 09.03.25 um 06:13 schrieb Kurt Borja:
Quoted 1 line
Add a non-deprecated version of
wmi_get_acpi_device_uid().Hi,
i can understand you motivation behind this patch, but this is IMHO the wrong approach. Nothing guarantees us that a given ACPI
_UIDvalue will reliably signal the presence of WMI methods now or in the future. Because of this i am against this patch.
Yes, in the end it is a leap of faith.
I think that it's not very risky as AFAIK AWCC didn't even exist when devices used the legacy RGB interface. Also as Mario mentioned, only a handful of devices supported the legacy interface, compared to the large amount of systems with the AWCC one.
But of course, there is always a possibility of regressions for some unknown edge case.
Quoted 3 lines
The correct way would be to use the BMOF data to check for missing WMI methods. I did some work on that which i will announce soon.
Anyways, this is very cool and indeed the correct approach. Hopefully I'll be able to help a bit, as I spent some time studying Pali's decoder.
Signature · 1 line
~ Kurt
Kurt Borja
maintainerRFC PATCH v2 2/2 platform/x86: alienware-wmi-wmax: Check for AWCC support using _UID
In reply to Kurt BorjaThe WMAX _UID of all devices that support the AWCC interface is "AWCC". This includes the following devices which were manually verified by reading their ACPI tables:
- Dell G16 7630
- Dell G5 5505 SE
- Alienware m16 R1
- Alienware m17 R5 AMD
- Alienware x15 R2
- Alienware 17 R5
- Alienware Aurora R12
- Alienware Aurora Ryzen Edition
And possibly many more, if not all devices with this interface.
Add a check for "AWCC" _UID in wmax_wmi_probe() as a last resort test for support.
--- drivers/platform/x86/dell/alienware-wmi-wmax.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/platform/x86/dell/alienware-wmi-wmax.c +9 -6
@@ -1420,14 +1420,17 @@ static int wmax_wmi_probe(struct wmi_device *wdev, const void *context) .upd_brightness = wmax_wmi_update_brightness, }, }; -int ret; +char *uid; -if (awcc) - ret =alienware_awcc_setup (wdev); -else - ret =alienware_alienfx_setup (&pdata); +if (!awcc) { + uid =wmidev_get_acpi_device_uid (wdev); +if (!uid ||strncmp (uid,"AWCC" ,4 )) +return alienware_alienfx_setup (&pdata); -return ret; + awcc = &generic_quirks; + } + +return alienware_awcc_setup (wdev); }static int wmax_wmi_suspend (struct device *dev)
Signature · 1 line
2.48.1