[PATCH] platform/x86: dell-dw5826e: Add reset driver for DW5826e

Jack Wu posted 1 patch 2 months, 1 week ago
There is a newer version of this series
drivers/platform/x86/dell/Kconfig             |   6 +
drivers/platform/x86/dell/Makefile            |   2 +
.../platform/x86/dell/dell-dw5826e-reset.c    | 120 ++++++++++++++++++
3 files changed, 128 insertions(+)
create mode 100644 drivers/platform/x86/dell/dell-dw5826e-reset.c
[PATCH] platform/x86: dell-dw5826e: Add reset driver for DW5826e
Posted by Jack Wu 2 months, 1 week ago
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.

Signed-off-by: Jack Wu <jackbb_wu@compal.com>
---
 drivers/platform/x86/dell/Kconfig             |   6 +
 drivers/platform/x86/dell/Makefile            |   2 +
 .../platform/x86/dell/dell-dw5826e-reset.c    | 120 ++++++++++++++++++
 3 files changed, 128 insertions(+)
 create mode 100644 drivers/platform/x86/dell/dell-dw5826e-reset.c

diff --git a/drivers/platform/x86/dell/Kconfig b/drivers/platform/x86/dell/Kconfig
index 738c108c2163..c4540c837a88 100644
--- a/drivers/platform/x86/dell/Kconfig
+++ b/drivers/platform/x86/dell/Kconfig
@@ -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
diff --git a/drivers/platform/x86/dell/Makefile b/drivers/platform/x86/dell/Makefile
index c7501c25e627..8150283cfd1d 100644
--- a/drivers/platform/x86/dell/Makefile
+++ b/drivers/platform/x86/dell/Makefile
@@ -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
+
diff --git a/drivers/platform/x86/dell/dell-dw5826e-reset.c b/drivers/platform/x86/dell/dell-dw5826e-reset.c
new file mode 100644
index 000000000000..28865a123c63
--- /dev/null
+++ b/drivers/platform/x86/dell/dell-dw5826e-reset.c
@@ -0,0 +1,120 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ *  dell-dw5826e-reset.c - Dell DW5826e reset driver
+ *
+ *  Copyright (C) 2026 Jackbb Wu <jackbb.wu@compal.com>
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/acpi.h>
+#include <linux/miscdevice.h>
+#include <linux/fs.h>
+#include <linux/uaccess.h>
+
+static guid_t palc_dsm_guid =
+	GUID_INIT(0x5a1a4bba, 0x8006, 0x487e, 0xbe, 0x0a, 0xac, 0xf5, 0xd8, 0xfd, 0xfe, 0x59);
+
+struct palc_dev {
+	struct device *dev;
+	acpi_handle handle;
+	struct miscdevice miscdev;
+};
+
+static int trigger_palc_pldr(struct palc_dev *palc)
+{
+	union acpi_object *obj;
+
+	dev_info(palc->dev, "Triggering PLDR via ACPI _DSM Function 1...\n");
+
+	obj = acpi_evaluate_dsm(palc->handle, &palc_dsm_guid, 1, 1, NULL);
+
+	if (!obj) {
+		dev_err(palc->dev, "Failed to evaluate _DSM\n");
+		return -EIO;
+	}
+
+	if (obj->type == ACPI_TYPE_BUFFER)
+		dev_info(palc->dev, "PLDR _DSM executed successfully\n");
+
+	ACPI_FREE(obj);
+	return 0;
+}
+
+static ssize_t palc_write(struct file *filp, const char __user *buf, size_t count, loff_t *ppos)
+{
+	struct palc_dev *palc = filp->private_data;
+
+	trigger_palc_pldr(palc);
+
+	return count;
+}
+
+static int palc_open(struct inode *inode, struct file *filp)
+{
+	struct palc_dev *palc = container_of(filp->private_data, struct palc_dev, miscdev);
+
+	filp->private_data = palc;
+	return 0;
+}
+
+static const struct file_operations palc_fops = {
+	.owner  = THIS_MODULE,
+	.open   = palc_open,
+	.write  = palc_write,
+};
+
+static int palc_acpi_probe(struct acpi_device *adev)
+{
+	struct palc_dev *palc;
+
+	palc = devm_kzalloc(&adev->dev, sizeof(*palc), GFP_KERNEL);
+	if (!palc)
+		return -ENOMEM;
+
+	palc->dev    = &adev->dev;
+	palc->handle = adev->handle;
+
+	palc->miscdev.minor  = MISC_DYNAMIC_MINOR;
+	palc->miscdev.name   = "reset_palc";
+	palc->miscdev.fops   = &palc_fops;
+	palc->miscdev.parent = &adev->dev;
+
+	if (misc_register(&palc->miscdev))
+		return -EINVAL;
+
+	dev_set_drvdata(&adev->dev, palc);
+
+	dev_info(&adev->dev, "DW5826e Reset Device (PALC0001) Driver Loaded\n");
+	return 0;
+}
+
+static void palc_acpi_remove(struct acpi_device *adev)
+{
+	struct palc_dev *palc = dev_get_drvdata(&adev->dev);
+
+	if (palc)
+		misc_deregister(&palc->miscdev);
+}
+
+static const struct acpi_device_id palc_acpi_ids[] = {
+	{ "PALC0001", 0 },
+	{ "", 0 }
+};
+
+static struct acpi_driver palc_acpi_driver = {
+	.name  = "palc_reset",
+	.ids   = palc_acpi_ids,
+	.ops = {
+		.add    = palc_acpi_probe,
+		.remove = palc_acpi_remove,
+	},
+};
+
+MODULE_DEVICE_TABLE(acpi, palc_acpi_ids);
+module_acpi_driver(palc_acpi_driver);
+
+MODULE_DESCRIPTION("Dell DW5826e reset driver");
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("JackBB Wu");
-- 
2.34.1
Re: [PATCH] platform/x86: dell-dw5826e: Add reset driver for DW5826e
Posted by Mario Limonciello 2 months, 1 week ago

On 4/8/26 06:17, Jack Wu wrote:
> [You don't often get email from wojackbb@gmail.com. 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.
> 
> Signed-off-by: Jack Wu <jackbb_wu@compal.com>
> ---
>   drivers/platform/x86/dell/Kconfig             |   6 +
>   drivers/platform/x86/dell/Makefile            |   2 +
>   .../platform/x86/dell/dell-dw5826e-reset.c    | 120 ++++++++++++++++++
>   3 files changed, 128 insertions(+)
>   create mode 100644 drivers/platform/x86/dell/dell-dw5826e-reset.c
> 
> diff --git a/drivers/platform/x86/dell/Kconfig b/drivers/platform/x86/dell/Kconfig
> index 738c108c2163..c4540c837a88 100644
> --- a/drivers/platform/x86/dell/Kconfig
> +++ b/drivers/platform/x86/dell/Kconfig
> @@ -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
> diff --git a/drivers/platform/x86/dell/Makefile b/drivers/platform/x86/dell/Makefile
> index c7501c25e627..8150283cfd1d 100644
> --- a/drivers/platform/x86/dell/Makefile
> +++ b/drivers/platform/x86/dell/Makefile
> @@ -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
> +
> diff --git a/drivers/platform/x86/dell/dell-dw5826e-reset.c b/drivers/platform/x86/dell/dell-dw5826e-reset.c
> new file mode 100644
> index 000000000000..28865a123c63
> --- /dev/null
> +++ b/drivers/platform/x86/dell/dell-dw5826e-reset.c
> @@ -0,0 +1,120 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + *  dell-dw5826e-reset.c - Dell DW5826e reset driver
> + *
> + *  Copyright (C) 2026 Jackbb Wu <jackbb.wu@compal.com>
> + *
> + */
> +
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/acpi.h>
> +#include <linux/miscdevice.h>
> +#include <linux/fs.h>
> +#include <linux/uaccess.h>
> +
> +static guid_t palc_dsm_guid =
> +       GUID_INIT(0x5a1a4bba, 0x8006, 0x487e, 0xbe, 0x0a, 0xac, 0xf5, 0xd8, 0xfd, 0xfe, 0x59);
> +
> +struct palc_dev {
> +       struct device *dev;
> +       acpi_handle handle;
> +       struct miscdevice miscdev;
> +};
> +
> +static int trigger_palc_pldr(struct palc_dev *palc)
> +{
> +       union acpi_object *obj;
> +
> +       dev_info(palc->dev, "Triggering PLDR via ACPI _DSM Function 1...\n");

Besides Ilpo's comments - this is pretty noisy.  Do you really need to 
output to the logs every time it's triggered?

> +
> +       obj = acpi_evaluate_dsm(palc->handle, &palc_dsm_guid, 1, 1, NULL);
> +
> +       if (!obj) {
> +               dev_err(palc->dev, "Failed to evaluate _DSM\n");
> +               return -EIO;
> +       }
> +
> +       if (obj->type == ACPI_TYPE_BUFFER)
> +               dev_info(palc->dev, "PLDR _DSM executed successfully\n");

Doesn't this mean it be a failure of obj->type != ACPI_TYPE_BUFFER? 
Presumably you need to set a different return code in this case so the 
caller knows.

> +
> +       ACPI_FREE(obj);
> +       return 0;
> +}
> +
> +static ssize_t palc_write(struct file *filp, const char __user *buf, size_t count, loff_t *ppos)
> +{
> +       struct palc_dev *palc = filp->private_data;
> +
> +       trigger_palc_pldr(palc);

You're ignoring the return code.

> +
> +       return count;
> +}
> +
> +static int palc_open(struct inode *inode, struct file *filp)
> +{
> +       struct palc_dev *palc = container_of(filp->private_data, struct palc_dev, miscdev);
> +
> +       filp->private_data = palc;
> +       return 0;
> +}
> +
> +static const struct file_operations palc_fops = {
> +       .owner  = THIS_MODULE,
> +       .open   = palc_open,
> +       .write  = palc_write,
> +};

Given this is really just triggering an ACPI method and totally ignoring 
user data, maybe a more trivial sysfs file using the various macros is 
useful here instead of all this boilerplate.

> +
> +static int palc_acpi_probe(struct acpi_device *adev)
> +{
> +       struct palc_dev *palc;
> +
> +       palc = devm_kzalloc(&adev->dev, sizeof(*palc), GFP_KERNEL);
> +       if (!palc)
> +               return -ENOMEM;
> +
> +       palc->dev    = &adev->dev;
> +       palc->handle = adev->handle;
> +
> +       palc->miscdev.minor  = MISC_DYNAMIC_MINOR;
> +       palc->miscdev.name   = "reset_palc";
> +       palc->miscdev.fops   = &palc_fops;
> +       palc->miscdev.parent = &adev->dev;
> +
> +       if (misc_register(&palc->miscdev))
> +               return -EINVAL;
> +
> +       dev_set_drvdata(&adev->dev, palc);
> +
> +       dev_info(&adev->dev, "DW5826e Reset Device (PALC0001) Driver Loaded\n");
> +       return 0;
> +}
> +
> +static void palc_acpi_remove(struct acpi_device *adev)
> +{
> +       struct palc_dev *palc = dev_get_drvdata(&adev->dev);
> +
> +       if (palc)
> +               misc_deregister(&palc->miscdev);
> +}
> +
> +static const struct acpi_device_id palc_acpi_ids[] = {
> +       { "PALC0001", 0 },
> +       { "", 0 }
> +};
> +
> +static struct acpi_driver palc_acpi_driver = {
> +       .name  = "palc_reset",
> +       .ids   = palc_acpi_ids,
> +       .ops = {
> +               .add    = palc_acpi_probe,
> +               .remove = palc_acpi_remove,
> +       },
> +};
> +
> +MODULE_DEVICE_TABLE(acpi, palc_acpi_ids);
> +module_acpi_driver(palc_acpi_driver);
> +
> +MODULE_DESCRIPTION("Dell DW5826e reset driver");
> +MODULE_LICENSE("GPL");
> +MODULE_AUTHOR("JackBB Wu");
> --
> 2.34.1
> 
>
Re: [PATCH] platform/x86: dell-dw5826e: Add reset driver for DW5826e
Posted by Ilpo Järvinen 2 months, 1 week ago
On Wed, 8 Apr 2026, Jack Wu wrote:

> 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.
> 
> Signed-off-by: Jack Wu <jackbb_wu@compal.com>
> ---
>  drivers/platform/x86/dell/Kconfig             |   6 +
>  drivers/platform/x86/dell/Makefile            |   2 +
>  .../platform/x86/dell/dell-dw5826e-reset.c    | 120 ++++++++++++++++++
>  3 files changed, 128 insertions(+)
>  create mode 100644 drivers/platform/x86/dell/dell-dw5826e-reset.c
> 
> diff --git a/drivers/platform/x86/dell/Kconfig b/drivers/platform/x86/dell/Kconfig
> index 738c108c2163..c4540c837a88 100644
> --- a/drivers/platform/x86/dell/Kconfig
> +++ b/drivers/platform/x86/dell/Kconfig
> @@ -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
> diff --git a/drivers/platform/x86/dell/Makefile b/drivers/platform/x86/dell/Makefile
> index c7501c25e627..8150283cfd1d 100644
> --- a/drivers/platform/x86/dell/Makefile
> +++ b/drivers/platform/x86/dell/Makefile
> @@ -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

Another thing,

I wonder if this is good place for this, as kernel also has drivers/reset/.

-- 
 i.

> +
> diff --git a/drivers/platform/x86/dell/dell-dw5826e-reset.c b/drivers/platform/x86/dell/dell-dw5826e-reset.c
> new file mode 100644
> index 000000000000..28865a123c63
> --- /dev/null
> +++ b/drivers/platform/x86/dell/dell-dw5826e-reset.c
> @@ -0,0 +1,120 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + *  dell-dw5826e-reset.c - Dell DW5826e reset driver
> + *
> + *  Copyright (C) 2026 Jackbb Wu <jackbb.wu@compal.com>
> + *
> + */
> +
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/acpi.h>
> +#include <linux/miscdevice.h>
> +#include <linux/fs.h>
> +#include <linux/uaccess.h>
> +
> +static guid_t palc_dsm_guid =
> +	GUID_INIT(0x5a1a4bba, 0x8006, 0x487e, 0xbe, 0x0a, 0xac, 0xf5, 0xd8, 0xfd, 0xfe, 0x59);
> +
> +struct palc_dev {
> +	struct device *dev;
> +	acpi_handle handle;
> +	struct miscdevice miscdev;
> +};
> +
> +static int trigger_palc_pldr(struct palc_dev *palc)
> +{
> +	union acpi_object *obj;
> +
> +	dev_info(palc->dev, "Triggering PLDR via ACPI _DSM Function 1...\n");
> +
> +	obj = acpi_evaluate_dsm(palc->handle, &palc_dsm_guid, 1, 1, NULL);
> +
> +	if (!obj) {
> +		dev_err(palc->dev, "Failed to evaluate _DSM\n");
> +		return -EIO;
> +	}
> +
> +	if (obj->type == ACPI_TYPE_BUFFER)
> +		dev_info(palc->dev, "PLDR _DSM executed successfully\n");
> +
> +	ACPI_FREE(obj);
> +	return 0;
> +}
> +
> +static ssize_t palc_write(struct file *filp, const char __user *buf, size_t count, loff_t *ppos)
> +{
> +	struct palc_dev *palc = filp->private_data;
> +
> +	trigger_palc_pldr(palc);
> +
> +	return count;
> +}
> +
> +static int palc_open(struct inode *inode, struct file *filp)
> +{
> +	struct palc_dev *palc = container_of(filp->private_data, struct palc_dev, miscdev);
> +
> +	filp->private_data = palc;
> +	return 0;
> +}
> +
> +static const struct file_operations palc_fops = {
> +	.owner  = THIS_MODULE,
> +	.open   = palc_open,
> +	.write  = palc_write,
> +};
> +
> +static int palc_acpi_probe(struct acpi_device *adev)
> +{
> +	struct palc_dev *palc;
> +
> +	palc = devm_kzalloc(&adev->dev, sizeof(*palc), GFP_KERNEL);
> +	if (!palc)
> +		return -ENOMEM;
> +
> +	palc->dev    = &adev->dev;
> +	palc->handle = adev->handle;
> +
> +	palc->miscdev.minor  = MISC_DYNAMIC_MINOR;
> +	palc->miscdev.name   = "reset_palc";
> +	palc->miscdev.fops   = &palc_fops;
> +	palc->miscdev.parent = &adev->dev;
> +
> +	if (misc_register(&palc->miscdev))
> +		return -EINVAL;
> +
> +	dev_set_drvdata(&adev->dev, palc);
> +
> +	dev_info(&adev->dev, "DW5826e Reset Device (PALC0001) Driver Loaded\n");
> +	return 0;
> +}
> +
> +static void palc_acpi_remove(struct acpi_device *adev)
> +{
> +	struct palc_dev *palc = dev_get_drvdata(&adev->dev);
> +
> +	if (palc)
> +		misc_deregister(&palc->miscdev);
> +}
> +
> +static const struct acpi_device_id palc_acpi_ids[] = {
> +	{ "PALC0001", 0 },
> +	{ "", 0 }
> +};
> +
> +static struct acpi_driver palc_acpi_driver = {
> +	.name  = "palc_reset",
> +	.ids   = palc_acpi_ids,
> +	.ops = {
> +		.add    = palc_acpi_probe,
> +		.remove = palc_acpi_remove,
> +	},
> +};
> +
> +MODULE_DEVICE_TABLE(acpi, palc_acpi_ids);
> +module_acpi_driver(palc_acpi_driver);
> +
> +MODULE_DESCRIPTION("Dell DW5826e reset driver");
> +MODULE_LICENSE("GPL");
> +MODULE_AUTHOR("JackBB Wu");
>
Re: [PATCH] platform/x86: dell-dw5826e: Add reset driver for DW5826e
Posted by 吳逼逼 2 months, 1 week ago
About good place:

drivers/reset/ is for the reset controller subsystem
(reset_controller_dev), which provides reset signals consumed by other
subsystem drivers.

This driver doesn't fit that model — it exposes a Dell
platform-specific ACPI _DSM method (PALC0001) to userspace for
triggering a PLDR reset on the DW5826e WWAN module. Since this is a
Dell-specific ACPI interface that only exists on Dell laptops,
drivers/platform/x86/dell/ is the appropriate location, consistent
with other Dell platform drivers

About other issue:
I fixed them in v2 and upload It

Thanks.

Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> 於 2026年4月8日週三 下午9:46寫道:
>
> On Wed, 8 Apr 2026, Jack Wu wrote:
>
> > 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.
> >
> > Signed-off-by: Jack Wu <jackbb_wu@compal.com>
> > ---
> >  drivers/platform/x86/dell/Kconfig             |   6 +
> >  drivers/platform/x86/dell/Makefile            |   2 +
> >  .../platform/x86/dell/dell-dw5826e-reset.c    | 120 ++++++++++++++++++
> >  3 files changed, 128 insertions(+)
> >  create mode 100644 drivers/platform/x86/dell/dell-dw5826e-reset.c
> >
> > diff --git a/drivers/platform/x86/dell/Kconfig b/drivers/platform/x86/dell/Kconfig
> > index 738c108c2163..c4540c837a88 100644
> > --- a/drivers/platform/x86/dell/Kconfig
> > +++ b/drivers/platform/x86/dell/Kconfig
> > @@ -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
> > diff --git a/drivers/platform/x86/dell/Makefile b/drivers/platform/x86/dell/Makefile
> > index c7501c25e627..8150283cfd1d 100644
> > --- a/drivers/platform/x86/dell/Makefile
> > +++ b/drivers/platform/x86/dell/Makefile
> > @@ -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
>
> Another thing,
>
> I wonder if this is good place for this, as kernel also has drivers/reset/.
>
> --
>  i.
>
> > +
> > diff --git a/drivers/platform/x86/dell/dell-dw5826e-reset.c b/drivers/platform/x86/dell/dell-dw5826e-reset.c
> > new file mode 100644
> > index 000000000000..28865a123c63
> > --- /dev/null
> > +++ b/drivers/platform/x86/dell/dell-dw5826e-reset.c
> > @@ -0,0 +1,120 @@
> > +// SPDX-License-Identifier: GPL-2.0-or-later
> > +/*
> > + *  dell-dw5826e-reset.c - Dell DW5826e reset driver
> > + *
> > + *  Copyright (C) 2026 Jackbb Wu <jackbb.wu@compal.com>
> > + *
> > + */
> > +
> > +#include <linux/module.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/acpi.h>
> > +#include <linux/miscdevice.h>
> > +#include <linux/fs.h>
> > +#include <linux/uaccess.h>
> > +
> > +static guid_t palc_dsm_guid =
> > +     GUID_INIT(0x5a1a4bba, 0x8006, 0x487e, 0xbe, 0x0a, 0xac, 0xf5, 0xd8, 0xfd, 0xfe, 0x59);
> > +
> > +struct palc_dev {
> > +     struct device *dev;
> > +     acpi_handle handle;
> > +     struct miscdevice miscdev;
> > +};
> > +
> > +static int trigger_palc_pldr(struct palc_dev *palc)
> > +{
> > +     union acpi_object *obj;
> > +
> > +     dev_info(palc->dev, "Triggering PLDR via ACPI _DSM Function 1...\n");
> > +
> > +     obj = acpi_evaluate_dsm(palc->handle, &palc_dsm_guid, 1, 1, NULL);
> > +
> > +     if (!obj) {
> > +             dev_err(palc->dev, "Failed to evaluate _DSM\n");
> > +             return -EIO;
> > +     }
> > +
> > +     if (obj->type == ACPI_TYPE_BUFFER)
> > +             dev_info(palc->dev, "PLDR _DSM executed successfully\n");
> > +
> > +     ACPI_FREE(obj);
> > +     return 0;
> > +}
> > +
> > +static ssize_t palc_write(struct file *filp, const char __user *buf, size_t count, loff_t *ppos)
> > +{
> > +     struct palc_dev *palc = filp->private_data;
> > +
> > +     trigger_palc_pldr(palc);
> > +
> > +     return count;
> > +}
> > +
> > +static int palc_open(struct inode *inode, struct file *filp)
> > +{
> > +     struct palc_dev *palc = container_of(filp->private_data, struct palc_dev, miscdev);
> > +
> > +     filp->private_data = palc;
> > +     return 0;
> > +}
> > +
> > +static const struct file_operations palc_fops = {
> > +     .owner  = THIS_MODULE,
> > +     .open   = palc_open,
> > +     .write  = palc_write,
> > +};
> > +
> > +static int palc_acpi_probe(struct acpi_device *adev)
> > +{
> > +     struct palc_dev *palc;
> > +
> > +     palc = devm_kzalloc(&adev->dev, sizeof(*palc), GFP_KERNEL);
> > +     if (!palc)
> > +             return -ENOMEM;
> > +
> > +     palc->dev    = &adev->dev;
> > +     palc->handle = adev->handle;
> > +
> > +     palc->miscdev.minor  = MISC_DYNAMIC_MINOR;
> > +     palc->miscdev.name   = "reset_palc";
> > +     palc->miscdev.fops   = &palc_fops;
> > +     palc->miscdev.parent = &adev->dev;
> > +
> > +     if (misc_register(&palc->miscdev))
> > +             return -EINVAL;
> > +
> > +     dev_set_drvdata(&adev->dev, palc);
> > +
> > +     dev_info(&adev->dev, "DW5826e Reset Device (PALC0001) Driver Loaded\n");
> > +     return 0;
> > +}
> > +
> > +static void palc_acpi_remove(struct acpi_device *adev)
> > +{
> > +     struct palc_dev *palc = dev_get_drvdata(&adev->dev);
> > +
> > +     if (palc)
> > +             misc_deregister(&palc->miscdev);
> > +}
> > +
> > +static const struct acpi_device_id palc_acpi_ids[] = {
> > +     { "PALC0001", 0 },
> > +     { "", 0 }
> > +};
> > +
> > +static struct acpi_driver palc_acpi_driver = {
> > +     .name  = "palc_reset",
> > +     .ids   = palc_acpi_ids,
> > +     .ops = {
> > +             .add    = palc_acpi_probe,
> > +             .remove = palc_acpi_remove,
> > +     },
> > +};
> > +
> > +MODULE_DEVICE_TABLE(acpi, palc_acpi_ids);
> > +module_acpi_driver(palc_acpi_driver);
> > +
> > +MODULE_DESCRIPTION("Dell DW5826e reset driver");
> > +MODULE_LICENSE("GPL");
> > +MODULE_AUTHOR("JackBB Wu");
> >
>
Re: [PATCH] platform/x86: dell-dw5826e: Add reset driver for DW5826e
Posted by Ilpo Järvinen 2 months, 1 week ago
On Wed, 8 Apr 2026, Jack Wu wrote:

> 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.
> 
> Signed-off-by: Jack Wu <jackbb_wu@compal.com>
> ---
>  drivers/platform/x86/dell/Kconfig             |   6 +
>  drivers/platform/x86/dell/Makefile            |   2 +
>  .../platform/x86/dell/dell-dw5826e-reset.c    | 120 ++++++++++++++++++
>  3 files changed, 128 insertions(+)
>  create mode 100644 drivers/platform/x86/dell/dell-dw5826e-reset.c
> 
> diff --git a/drivers/platform/x86/dell/Kconfig b/drivers/platform/x86/dell/Kconfig
> index 738c108c2163..c4540c837a88 100644
> --- a/drivers/platform/x86/dell/Kconfig
> +++ b/drivers/platform/x86/dell/Kconfig
> @@ -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
> diff --git a/drivers/platform/x86/dell/Makefile b/drivers/platform/x86/dell/Makefile
> index c7501c25e627..8150283cfd1d 100644
> --- a/drivers/platform/x86/dell/Makefile
> +++ b/drivers/platform/x86/dell/Makefile
> @@ -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
> +
> diff --git a/drivers/platform/x86/dell/dell-dw5826e-reset.c b/drivers/platform/x86/dell/dell-dw5826e-reset.c
> new file mode 100644
> index 000000000000..28865a123c63
> --- /dev/null
> +++ b/drivers/platform/x86/dell/dell-dw5826e-reset.c
> @@ -0,0 +1,120 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + *  dell-dw5826e-reset.c - Dell DW5826e reset driver
> + *
> + *  Copyright (C) 2026 Jackbb Wu <jackbb.wu@compal.com>
> + *

Remove extra empty lines.

> + */
> +
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/acpi.h>
> +#include <linux/miscdevice.h>
> +#include <linux/fs.h>
> +#include <linux/uaccess.h>

Please order alphabetically.

> +
> +static guid_t palc_dsm_guid =
> +	GUID_INIT(0x5a1a4bba, 0x8006, 0x487e, 0xbe, 0x0a, 0xac, 0xf5, 0xd8, 0xfd, 0xfe, 0x59);

Add include.

> +
> +struct palc_dev {
> +	struct device *dev;
> +	acpi_handle handle;
> +	struct miscdevice miscdev;
> +};
> +
> +static int trigger_palc_pldr(struct palc_dev *palc)
> +{
> +	union acpi_object *obj;
> +
> +	dev_info(palc->dev, "Triggering PLDR via ACPI _DSM Function 1...\n");

Add include.

> +
> +	obj = acpi_evaluate_dsm(palc->handle, &palc_dsm_guid, 1, 1, NULL);
> +
> +	if (!obj) {

Don't leave empty lines in between call and it's error handling.

> +		dev_err(palc->dev, "Failed to evaluate _DSM\n");
> +		return -EIO;
> +	}
> +
> +	if (obj->type == ACPI_TYPE_BUFFER)
> +		dev_info(palc->dev, "PLDR _DSM executed successfully\n");
> +
> +	ACPI_FREE(obj);
> +	return 0;
> +}
> +
> +static ssize_t palc_write(struct file *filp, const char __user *buf, size_t count, loff_t *ppos)
> +{
> +	struct palc_dev *palc = filp->private_data;
> +
> +	trigger_palc_pldr(palc);
> +
> +	return count;
> +}
> +
> +static int palc_open(struct inode *inode, struct file *filp)
> +{
> +	struct palc_dev *palc = container_of(filp->private_data, struct palc_dev, miscdev);
> +
> +	filp->private_data = palc;
> +	return 0;
> +}
> +
> +static const struct file_operations palc_fops = {
> +	.owner  = THIS_MODULE,
> +	.open   = palc_open,
> +	.write  = palc_write,
> +};
> +
> +static int palc_acpi_probe(struct acpi_device *adev)
> +{
> +	struct palc_dev *palc;
> +
> +	palc = devm_kzalloc(&adev->dev, sizeof(*palc), GFP_KERNEL);
> +	if (!palc)
> +		return -ENOMEM;
> +
> +	palc->dev    = &adev->dev;
> +	palc->handle = adev->handle;
> +
> +	palc->miscdev.minor  = MISC_DYNAMIC_MINOR;
> +	palc->miscdev.name   = "reset_palc";
> +	palc->miscdev.fops   = &palc_fops;
> +	palc->miscdev.parent = &adev->dev;
> +
> +	if (misc_register(&palc->miscdev))
> +		return -EINVAL;
> +
> +	dev_set_drvdata(&adev->dev, palc);
> +
> +	dev_info(&adev->dev, "DW5826e Reset Device (PALC0001) Driver Loaded\n");

Don't print anything on success path please.

> +	return 0;
> +}
> +
> +static void palc_acpi_remove(struct acpi_device *adev)
> +{
> +	struct palc_dev *palc = dev_get_drvdata(&adev->dev);
> +
> +	if (palc)
> +		misc_deregister(&palc->miscdev);
> +}
> +
> +static const struct acpi_device_id palc_acpi_ids[] = {
> +	{ "PALC0001", 0 },
> +	{ "", 0 }
> +};
> +
> +static struct acpi_driver palc_acpi_driver = {
> +	.name  = "palc_reset",
> +	.ids   = palc_acpi_ids,
> +	.ops = {
> +		.add    = palc_acpi_probe,
> +		.remove = palc_acpi_remove,
> +	},
> +};

Rafael has been trying to get rid of all acpi_drivers, please don't add 
more.

> +
> +MODULE_DEVICE_TABLE(acpi, palc_acpi_ids);
> +module_acpi_driver(palc_acpi_driver);
> +
> +MODULE_DESCRIPTION("Dell DW5826e reset driver");
> +MODULE_LICENSE("GPL");
> +MODULE_AUTHOR("JackBB Wu");
> 

-- 
 i.