platform/x86: dell-dw5826e: Add reset driver for DW5826e
PATCH v2 1/1 platform/x86: dell-dw5826e: Add reset driver for DW5826e
If the DW5826e is in a frozen state and unable to receive USB commands, this driver provides a method for the user to reset the DW5826e via ACPI.
E.g: echo 1 > /sys/bus/platform/devices/PALC0001\:00/pldr
---
v2:
- Remove extra empty line
- Add missing includes and Remove unnecessary includes, sort includes alphabetically
- Remove noisy dev_info()
- Handle obj->type != ACPI_TYPE_BUFFER as error with proper return code
- Replace miscdevice/file_operations with sysfs attribute (DEVICE_ATTR_WO) to reduce boilerplate
- Propagate trigger_palc_pldr() return code to userspace
- Convert from acpi_driver to platform_driver
---
--- drivers/platform/x86/dell/Kconfig | 6 ++ drivers/platform/x86/dell/Makefile | 2 + .../platform/x86/dell/dell-dw5826e-reset.c | 83 +++++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 drivers/platform/x86/dell/dell-dw5826e-reset.c
drivers/platform/x86/dell/Kconfig +6 -0
@@ -276,4 +276,10 @@ config DELL_WMI_SYSMAN To compile this driver as a module, choose M here: the module will be called dell-wmi-sysman. +config DELL_DW5826E_RESET + tristate "Dell DW5826e PLDR reset support" + default m + depends on ACPI + help + This adds support for the Dell DW5826e PLDR reset via ACPI endif # X86_PLATFORM_DRIVERS_DELL
drivers/platform/x86/dell/Makefile +2 -0
@@ -28,3 +28,5 @@ obj-$(CONFIG_DELL_WMI_DESCRIPTOR) += dell-wmi-descriptor.o obj-$(CONFIG_DELL_WMI_DDV) += dell-wmi-ddv.o obj-$(CONFIG_DELL_WMI_LED) += dell-wmi-led.o obj-$(CONFIG_DELL_WMI_SYSMAN) += dell-wmi-sysman/ +obj-$(CONFIG_DELL_DW5826E_RESET) += dell-dw5826e-reset.o +
drivers/platform/x86/dell/dell-dw5826e-reset.c new file +83 -0
83 lines not on this page · raw message
Signature · 1 line
2.34.1
Quoted 8 lines · Jack Wu
[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
If the DW5826e is in a frozen state and unable to receive USB commands, this driver provides a method for the user to reset the DW5826e via ACPI.
E.g: echo 1 > /sys/bus/platform/devices/PALC0001\:00/pldr
Signed-off-by Jack Wu <[email protected]>
Quoted 10 lines
---
v2:
- Remove extra empty line
- Add missing includes and Remove unnecessary includes, sort includes alphabetically
- Remove noisydev_info()
- Handleobj->type!=ACPI_TYPE_BUFFERas error with proper return code
- Replace miscdevice/file_operations with sysfs attribute (DEVICE_ATTR_WO) to reduce boilerplate
- Propagatetrigger_palc_pldr()return code to userspace
- Convert fromacpi_drivertoplatform_driver
---
Generally speaking this looks much better. The only thing missing to me is documentation to go with it since it won't be obvious to a user what the "pldr" sysfs file represents.
Also in that sense - if the ACPI PALC0001 device will always represent WWAN reset, then maybe the sysfs file should also be called wwan_reset instead of pldr (platform device reset).
Quoted 125 lines
--- drivers/platform/x86/dell/Kconfig | 6 ++ drivers/platform/x86/dell/Makefile | 2 + .../platform/x86/dell/dell-dw5826e-reset.c | 83 +++++++++++++++++++ 3 files changed, 91 insertions(+)create mode 100644
drivers/platform/x86/dell/dell-dw5826e-reset.cdrivers/platform/x86/dell/Kconfig +6
-0@@ -276,4 +276,10 @@ config DELL_WMI_SYSMAN To compile this driver as a module, choose M here: the module will be called dell-wmi-sysman. +config DELL_DW5826E_RESET + tristate "Dell DW5826e PLDR reset support" + default m + depends on ACPI + help + This adds support for the Dell DW5826e PLDR reset via ACPI endif # X86_PLATFORM_DRIVERS_DELLdrivers/platform/x86/dell/Makefile +2
-0@@ -28,3 +28,5 @@ obj-$(CONFIG_DELL_WMI_DESCRIPTOR) += dell-wmi-descriptor.o obj-$(CONFIG_DELL_WMI_DDV) += dell-wmi-ddv.o obj-$(CONFIG_DELL_WMI_LED) += dell-wmi-led.o obj-$(CONFIG_DELL_WMI_SYSMAN) += dell-wmi-sysman/ +obj-$(CONFIG_DELL_DW5826E_RESET) += dell-dw5826e-reset.o +drivers/platform/x86/dell/dell-dw5826e-reset.c new file +83
-1@@ -0,0 +1,83 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* dell-dw5826e-reset.c - Dell DW5826e reset driver +* +* Copyright (C) 2026 Jackbb Wu <[email protected]> +*/ + +#include <linux/acpi.h> +#include <linux/device.h> +#include <linux/uuid.h> +#include <linux/module.h> +#include <linux/platform_device.h> + +static guid_t palc_dsm_guid = +GUID_INIT (0x5a1a4bba ,0x8006 ,0x487e ,0xbe ,0x0a ,0xac ,0xf5 ,0xd8 ,0xfd ,0xfe ,0x59 ); + +static int trigger_palc_pldr (struct device *dev,acpi_handle handle) +{ +union acpi_object *obj; +int ret =0 ; + + obj =acpi_evaluate_dsm (handle, &palc_dsm_guid,1 ,1 ,NULL ); +if (!obj) { +dev_err (dev,"Failed to evaluate _DSM\n" ); +return -EIO ; + } + +if (obj->type !=ACPI_TYPE_BUFFER ) { +dev_err (dev,"Unexpected _DSM return type: %d\n" , obj->type); + ret = -EINVAL ; + } + +ACPI_FREE (obj); +return ret; +} + +static ssize_t pldr_store (struct device *dev,struct device_attribute *attr, +const char *buf,size_t count) +{ +acpi_handle handle =ACPI_HANDLE (dev); +int ret; + + ret =trigger_palc_pldr (dev, handle); +if (ret) +return ret; + +return count; +} +static DEVICE_ATTR_WO (pldr); + +static struct attribute *palc_attrs[] = { + &dev_attr_pldr.attr, +NULL +}; +ATTRIBUTE_GROUPS (palc); + +static int palc_probe (struct platform_device *pdev) +{ +if (!ACPI_HANDLE (&pdev->dev)) +return -ENODEV ; + +return 0 ; +} + +static const struct acpi_device_id palc_acpi_ids[] = { + {"PALC0001" ,0 }, + { } +}; +MODULE_DEVICE_TABLE (acpi, palc_acpi_ids); + +static struct platform_driver palc_driver = { + .driver = { + .name ="dell-dw5826e-reset" , + .acpi_match_table = palc_acpi_ids, + .dev_groups = palc_groups, + }, + .probe = palc_probe, +}; +module_platform_driver (palc_driver); + +MODULE_DESCRIPTION ("Dell DW5826e reset driver" ); +MODULE_LICENSE ("GPL" ); +MODULE_AUTHOR ("JackBB Wu" ); --2.34.1
Am 10.04.26 um 11:37 schrieb Jack Wu:
Quoted 105 lines
If the DW5826e is in a frozen state and unable to receive USB commands, this driver provides a method for the user to reset the DW5826e via ACPI.
E.g: echo 1 > /sys/bus/platform/devices/PALC0001\:00/pldr
Signed-off-by Jack Wu <[email protected]>---
v2:
- Remove extra empty line
- Add missing includes and Remove unnecessary includes, sort includes alphabetically
- Remove noisydev_info()
- Handleobj->type!=ACPI_TYPE_BUFFERas error with proper return code
- Replace miscdevice/file_operations with sysfs attribute (DEVICE_ATTR_WO) to reduce boilerplate
- Propagatetrigger_palc_pldr()return code to userspace
- Convert fromacpi_drivertoplatform_driver
------ drivers/platform/x86/dell/Kconfig | 6 ++ drivers/platform/x86/dell/Makefile | 2 + .../platform/x86/dell/dell-dw5826e-reset.c | 83 +++++++++++++++++++ 3 files changed, 91 insertions(+)create mode 100644
drivers/platform/x86/dell/dell-dw5826e-reset.cdrivers/platform/x86/dell/Kconfig +6
-0@@ -276,4 +276,10 @@ config DELL_WMI_SYSMAN To compile this driver as a module, choose M here: the module will be called dell-wmi-sysman. +config DELL_DW5826E_RESET + tristate "Dell DW5826e PLDR reset support" + default m + depends on ACPI + help + This adds support for the Dell DW5826e PLDR reset via ACPI endif # X86_PLATFORM_DRIVERS_DELLdrivers/platform/x86/dell/Makefile +2
-0@@ -28,3 +28,5 @@ obj-$(CONFIG_DELL_WMI_DESCRIPTOR) += dell-wmi-descriptor.o obj-$(CONFIG_DELL_WMI_DDV) += dell-wmi-ddv.o obj-$(CONFIG_DELL_WMI_LED) += dell-wmi-led.o obj-$(CONFIG_DELL_WMI_SYSMAN) += dell-wmi-sysman/ +obj-$(CONFIG_DELL_DW5826E_RESET) += dell-dw5826e-reset.o +drivers/platform/x86/dell/dell-dw5826e-reset.c new file +51
-0@@ -0,0 +1,83 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* dell-dw5826e-reset.c - Dell DW5826e reset driver +* +* Copyright (C) 2026 Jackbb Wu <[email protected]> +*/ + +#include <linux/acpi.h> +#include <linux/device.h> +#include <linux/uuid.h> +#include <linux/module.h> +#include <linux/platform_device.h> + +static guid_t palc_dsm_guid = +GUID_INIT (0x5a1a4bba ,0x8006 ,0x487e ,0xbe ,0x0a ,0xac ,0xf5 ,0xd8 ,0xfd ,0xfe ,0x59 ); + +static int trigger_palc_pldr (struct device *dev,acpi_handle handle) +{ +union acpi_object *obj; +int ret =0 ; + + obj =acpi_evaluate_dsm (handle, &palc_dsm_guid,1 ,1 ,NULL ); +if (!obj) { +dev_err (dev,"Failed to evaluate _DSM\n" ); +return -EIO ; + } + +if (obj->type !=ACPI_TYPE_BUFFER ) { +dev_err (dev,"Unexpected _DSM return type: %d\n" , obj->type); + ret = -EINVAL ; + } + +ACPI_FREE (obj); +return ret; +} + +static ssize_t pldr_store (struct device *dev,struct device_attribute *attr, +const char *buf,size_t count) +{ +acpi_handle handle =ACPI_HANDLE (dev); +int ret; + + ret =trigger_palc_pldr (dev, handle); +if (ret) +return ret; + +return count; +} +static DEVICE_ATTR_WO (pldr); + +static struct attribute *palc_attrs[] = {
drivers/platform/x86/dell/dell-dw5826e-reset.c line 61
Quoted 10 lines
drivers/platform/x86/dell/dell-dw5826e-reset.c new file +10
-0+ &dev_attr_pldr.attr, + NULL +}; +ATTRIBUTE_GROUPS (palc); + +static int palc_probe (struct platform_device *pdev) +{ +if (!ACPI_HANDLE (&pdev->dev)) +return -ENODEV ; +
Hi, please check here if the _DSM method exists using acpi_check_dsm().
Thanks,
Armin Wolf
Quoted 22 lines
drivers/platform/x86/dell/dell-dw5826e-reset.c new file +22
-0+return 0 ; +} + +static const struct acpi_device_id palc_acpi_ids[] = { + {"PALC0001" ,0 }, + { } +}; +MODULE_DEVICE_TABLE (acpi, palc_acpi_ids); + +static struct platform_driver palc_driver = { + .driver = { + .name ="dell-dw5826e-reset" , + .acpi_match_table = palc_acpi_ids, + .dev_groups = palc_groups, + }, + .probe = palc_probe, +}; +module_platform_driver (palc_driver); + +MODULE_DESCRIPTION ("Dell DW5826e reset driver" ); +MODULE_LICENSE ("GPL" ); +MODULE_AUTHOR ("JackBB Wu" );
Thanks for the feedback. I add the sysfs ABI documentation in Documentation/ABI/testing/ and fix other issue. they include it in the v3 version of the patch.
Armin Wolf <[email protected]> 於 2026年4月13日週一 下午2:21寫道:
Quoted 146 lines
Am 10.04.26 um 11:37 schrieb Jack Wu:
Quoted 105 lines
If the DW5826e is in a frozen state and unable to receive USB commands, this driver provides a method for the user to reset the DW5826e via ACPI.
E.g: echo 1 > /sys/bus/platform/devices/PALC0001\:00/pldr
Signed-off-by Jack Wu <[email protected]>---
v2:
- Remove extra empty line
- Add missing includes and Remove unnecessary includes, sort includes alphabetically
- Remove noisydev_info()
- Handleobj->type!=ACPI_TYPE_BUFFERas error with proper return code
- Replace miscdevice/file_operations with sysfs attribute (DEVICE_ATTR_WO) to reduce boilerplate
- Propagatetrigger_palc_pldr()return code to userspace
- Convert fromacpi_drivertoplatform_driver
------ drivers/platform/x86/dell/Kconfig | 6 ++ drivers/platform/x86/dell/Makefile | 2 + .../platform/x86/dell/dell-dw5826e-reset.c | 83 +++++++++++++++++++ 3 files changed, 91 insertions(+)create mode 100644
drivers/platform/x86/dell/dell-dw5826e-reset.cdrivers/platform/x86/dell/Kconfig +6
-0@@ -276,4 +276,10 @@ config DELL_WMI_SYSMAN To compile this driver as a module, choose M here: the module will be called dell-wmi-sysman. +config DELL_DW5826E_RESET + tristate "Dell DW5826e PLDR reset support" + default m + depends on ACPI + help + This adds support for the Dell DW5826e PLDR reset via ACPI endif # X86_PLATFORM_DRIVERS_DELLdrivers/platform/x86/dell/Makefile +2
-0@@ -28,3 +28,5 @@ obj-$(CONFIG_DELL_WMI_DESCRIPTOR) += dell-wmi-descriptor.o obj-$(CONFIG_DELL_WMI_DDV) += dell-wmi-ddv.o obj-$(CONFIG_DELL_WMI_LED) += dell-wmi-led.o obj-$(CONFIG_DELL_WMI_SYSMAN) += dell-wmi-sysman/ +obj-$(CONFIG_DELL_DW5826E_RESET) += dell-dw5826e-reset.o +drivers/platform/x86/dell/dell-dw5826e-reset.c new file +51
-0@@ -0,0 +1,83 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* dell-dw5826e-reset.c - Dell DW5826e reset driver +* +* Copyright (C) 2026 Jackbb Wu <[email protected]> +*/ + +#include <linux/acpi.h> +#include <linux/device.h> +#include <linux/uuid.h> +#include <linux/module.h> +#include <linux/platform_device.h> + +static guid_t palc_dsm_guid = +GUID_INIT (0x5a1a4bba ,0x8006 ,0x487e ,0xbe ,0x0a ,0xac ,0xf5 ,0xd8 ,0xfd ,0xfe ,0x59 ); + +static int trigger_palc_pldr (struct device *dev,acpi_handle handle) +{ +union acpi_object *obj; +int ret =0 ; + + obj =acpi_evaluate_dsm (handle, &palc_dsm_guid,1 ,1 ,NULL ); +if (!obj) { +dev_err (dev,"Failed to evaluate _DSM\n" ); +return -EIO ; + } + +if (obj->type !=ACPI_TYPE_BUFFER ) { +dev_err (dev,"Unexpected _DSM return type: %d\n" , obj->type); + ret = -EINVAL ; + } + +ACPI_FREE (obj); +return ret; +} + +static ssize_t pldr_store (struct device *dev,struct device_attribute *attr, +const char *buf,size_t count) +{ +acpi_handle handle =ACPI_HANDLE (dev); +int ret; + + ret =trigger_palc_pldr (dev, handle); +if (ret) +return ret; + +return count; +} +static DEVICE_ATTR_WO (pldr); + +static struct attribute *palc_attrs[] = {drivers/platform/x86/dell/dell-dw5826e-reset.c line 61
Quoted 10 lines
drivers/platform/x86/dell/dell-dw5826e-reset.c new file +10
-0+ &dev_attr_pldr.attr, + NULL +}; +ATTRIBUTE_GROUPS (palc); + +static int palc_probe (struct platform_device *pdev) +{ +if (!ACPI_HANDLE (&pdev->dev)) +return -ENODEV ; +Hi, please check here if the
_DSMmethod exists usingacpi_check_dsm().Thanks,
Armin WolfQuoted 22 lines
drivers/platform/x86/dell/dell-dw5826e-reset.c new file +22
-0+return 0 ; +} + +static const struct acpi_device_id palc_acpi_ids[] = { + {"PALC0001" ,0 }, + { } +}; +MODULE_DEVICE_TABLE (acpi, palc_acpi_ids); + +static struct platform_driver palc_driver = { + .driver = { + .name ="dell-dw5826e-reset" , + .acpi_match_table = palc_acpi_ids, + .dev_groups = palc_groups, + }, + .probe = palc_probe, +}; +module_platform_driver (palc_driver); + +MODULE_DESCRIPTION ("Dell DW5826e reset driver" ); +MODULE_LICENSE ("GPL" ); +MODULE_AUTHOR ("JackBB Wu" );