public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4] platform/x86: dell-dw5826e: Add reset driver for DW5826e
@ 2026-04-20  6:00 Jack Wu
  2026-04-20 14:03 ` Mario Limonciello
  2026-04-28 21:16 ` Armin Wolf
  0 siblings, 2 replies; 4+ messages in thread
From: Jack Wu @ 2026-04-20  6:00 UTC (permalink / raw)
  To: Hans de Goede, Ilpo Järvinen; +Cc: platform-driver-x86, linux-kernel

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/wwan_reset

Signed-off-by: Jack Wu <jackbb_wu@compal.com>
---
v4:
  - Fix version of the ABI documentation to 7.2
  - Add include linux/types.h
v3:
  - Rename sysfs attribute from "pldr" to "wwan_reset" for clarity
  - Add ABI documentation for the wwan_reset sysfs interface
  - Validate _DSM method availability in probe using acpi_check_dsm()
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
---
---
 .../testing/sysfs-driver-dell-dw5826e-reset   |  9 ++
 drivers/platform/x86/dell/Kconfig             |  6 ++
 drivers/platform/x86/dell/Makefile            |  2 +
 .../platform/x86/dell/dell-dw5826e-reset.c    | 90 +++++++++++++++++++
 4 files changed, 107 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-dell-dw5826e-reset
 create mode 100644 drivers/platform/x86/dell/dell-dw5826e-reset.c

diff --git a/Documentation/ABI/testing/sysfs-driver-dell-dw5826e-reset b/Documentation/ABI/testing/sysfs-driver-dell-dw5826e-reset
new file mode 100644
index 000000000000..a665e265633f
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-driver-dell-dw5826e-reset
@@ -0,0 +1,9 @@
+What:		/sys/bus/platform/devices/<PALC0001 device>/wwan_reset
+Date:		April 2026
+KernelVersion:	7.2
+Contact:	Jackbb Wu <jackbb.wu@compal.com>
+Description:
+		Writing to this file triggers a Platform Level Device Reset
+		(PLDR) of the Dell DW5826e WWAN module via an ACPI _DSM
+		method. This can be used to recover the modem when it is in
+		a frozen state and unable to respond to USB commands.
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..4e0d64535abb
--- /dev/null
+++ b/drivers/platform/x86/dell/dell-dw5826e-reset.c
@@ -0,0 +1,90 @@
+// 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/acpi.h>
+#include <linux/device.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/types.h>
+#include <linux/uuid.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 wwan_reset_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(wwan_reset);
+
+static struct attribute *palc_attrs[] = {
+	&dev_attr_wwan_reset.attr,
+	NULL
+};
+ATTRIBUTE_GROUPS(palc);
+
+static int palc_probe(struct platform_device *pdev)
+{
+	acpi_handle handle;
+
+	handle = ACPI_HANDLE(&pdev->dev);
+	if (!handle)
+		return -ENODEV;
+
+	if (!acpi_check_dsm(handle, &palc_dsm_guid, 1, BIT(1)))
+		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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v4] platform/x86: dell-dw5826e: Add reset driver for DW5826e
  2026-04-20  6:00 [PATCH v4] platform/x86: dell-dw5826e: Add reset driver for DW5826e Jack Wu
@ 2026-04-20 14:03 ` Mario Limonciello
  2026-04-28 21:16 ` Armin Wolf
  1 sibling, 0 replies; 4+ messages in thread
From: Mario Limonciello @ 2026-04-20 14:03 UTC (permalink / raw)
  To: Jack Wu, Hans de Goede, Ilpo Järvinen
  Cc: platform-driver-x86, linux-kernel



On 4/20/26 01:00, 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.
> 
> E.g: echo 1 > /sys/bus/platform/devices/PALC0001\:00/wwan_reset
> 
> Signed-off-by: Jack Wu <jackbb_wu@compal.com>
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
> ---
> v4:
>    - Fix version of the ABI documentation to 7.2
>    - Add include linux/types.h
> v3:
>    - Rename sysfs attribute from "pldr" to "wwan_reset" for clarity
>    - Add ABI documentation for the wwan_reset sysfs interface
>    - Validate _DSM method availability in probe using acpi_check_dsm()
> 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
> ---
> ---
>   .../testing/sysfs-driver-dell-dw5826e-reset   |  9 ++
>   drivers/platform/x86/dell/Kconfig             |  6 ++
>   drivers/platform/x86/dell/Makefile            |  2 +
>   .../platform/x86/dell/dell-dw5826e-reset.c    | 90 +++++++++++++++++++
>   4 files changed, 107 insertions(+)
>   create mode 100644 Documentation/ABI/testing/sysfs-driver-dell-dw5826e-reset
>   create mode 100644 drivers/platform/x86/dell/dell-dw5826e-reset.c
> 
> diff --git a/Documentation/ABI/testing/sysfs-driver-dell-dw5826e-reset b/Documentation/ABI/testing/sysfs-driver-dell-dw5826e-reset
> new file mode 100644
> index 000000000000..a665e265633f
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-driver-dell-dw5826e-reset
> @@ -0,0 +1,9 @@
> +What:		/sys/bus/platform/devices/<PALC0001 device>/wwan_reset
> +Date:		April 2026
> +KernelVersion:	7.2
> +Contact:	Jackbb Wu <jackbb.wu@compal.com>
> +Description:
> +		Writing to this file triggers a Platform Level Device Reset
> +		(PLDR) of the Dell DW5826e WWAN module via an ACPI _DSM
> +		method. This can be used to recover the modem when it is in
> +		a frozen state and unable to respond to USB commands.
> 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..4e0d64535abb
> --- /dev/null
> +++ b/drivers/platform/x86/dell/dell-dw5826e-reset.c
> @@ -0,0 +1,90 @@
> +// 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/acpi.h>
> +#include <linux/device.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/types.h>
> +#include <linux/uuid.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 wwan_reset_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(wwan_reset);
> +
> +static struct attribute *palc_attrs[] = {
> +	&dev_attr_wwan_reset.attr,
> +	NULL
> +};
> +ATTRIBUTE_GROUPS(palc);
> +
> +static int palc_probe(struct platform_device *pdev)
> +{
> +	acpi_handle handle;
> +
> +	handle = ACPI_HANDLE(&pdev->dev);
> +	if (!handle)
> +		return -ENODEV;
> +
> +	if (!acpi_check_dsm(handle, &palc_dsm_guid, 1, BIT(1)))
> +		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");


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v4] platform/x86: dell-dw5826e: Add reset driver for DW5826e
  2026-04-20  6:00 [PATCH v4] platform/x86: dell-dw5826e: Add reset driver for DW5826e Jack Wu
  2026-04-20 14:03 ` Mario Limonciello
@ 2026-04-28 21:16 ` Armin Wolf
  2026-04-29  6:08   ` 吳逼逼
  1 sibling, 1 reply; 4+ messages in thread
From: Armin Wolf @ 2026-04-28 21:16 UTC (permalink / raw)
  To: Jack Wu, Hans de Goede, Ilpo Järvinen
  Cc: platform-driver-x86, linux-kernel

Am 20.04.26 um 08:00 schrieb Jack Wu:

> 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/wwan_reset
>
> Signed-off-by: Jack Wu <jackbb_wu@compal.com>
> ---
> v4:
>    - Fix version of the ABI documentation to 7.2
>    - Add include linux/types.h
> v3:
>    - Rename sysfs attribute from "pldr" to "wwan_reset" for clarity
>    - Add ABI documentation for the wwan_reset sysfs interface
>    - Validate _DSM method availability in probe using acpi_check_dsm()
> 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
> ---
> ---
>   .../testing/sysfs-driver-dell-dw5826e-reset   |  9 ++
>   drivers/platform/x86/dell/Kconfig             |  6 ++
>   drivers/platform/x86/dell/Makefile            |  2 +
>   .../platform/x86/dell/dell-dw5826e-reset.c    | 90 +++++++++++++++++++
>   4 files changed, 107 insertions(+)
>   create mode 100644 Documentation/ABI/testing/sysfs-driver-dell-dw5826e-reset
>   create mode 100644 drivers/platform/x86/dell/dell-dw5826e-reset.c
>
> diff --git a/Documentation/ABI/testing/sysfs-driver-dell-dw5826e-reset b/Documentation/ABI/testing/sysfs-driver-dell-dw5826e-reset
> new file mode 100644
> index 000000000000..a665e265633f
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-driver-dell-dw5826e-reset
> @@ -0,0 +1,9 @@
> +What:		/sys/bus/platform/devices/<PALC0001 device>/wwan_reset
> +Date:		April 2026
> +KernelVersion:	7.2
> +Contact:	Jackbb Wu <jackbb.wu@compal.com>
> +Description:
> +		Writing to this file triggers a Platform Level Device Reset
> +		(PLDR) of the Dell DW5826e WWAN module via an ACPI _DSM
> +		method. This can be used to recover the modem when it is in
> +		a frozen state and unable to respond to USB commands.
> 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..4e0d64535abb
> --- /dev/null
> +++ b/drivers/platform/x86/dell/dell-dw5826e-reset.c
> @@ -0,0 +1,90 @@
> +// 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/acpi.h>
> +#include <linux/device.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/types.h>
> +#include <linux/uuid.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);

Please use BIT() for the DSM method here. Also consider using a define for the
DSM method index.

With that being fixed:

Reviewed-by: Armin Wolf <W_Armin@gmx.de>

> +	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 wwan_reset_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(wwan_reset);
> +
> +static struct attribute *palc_attrs[] = {
> +	&dev_attr_wwan_reset.attr,
> +	NULL
> +};
> +ATTRIBUTE_GROUPS(palc);
> +
> +static int palc_probe(struct platform_device *pdev)
> +{
> +	acpi_handle handle;
> +
> +	handle = ACPI_HANDLE(&pdev->dev);
> +	if (!handle)
> +		return -ENODEV;
> +
> +	if (!acpi_check_dsm(handle, &palc_dsm_guid, 1, BIT(1)))
> +		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");

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v4] platform/x86: dell-dw5826e: Add reset driver for DW5826e
  2026-04-28 21:16 ` Armin Wolf
@ 2026-04-29  6:08   ` 吳逼逼
  0 siblings, 0 replies; 4+ messages in thread
From: 吳逼逼 @ 2026-04-29  6:08 UTC (permalink / raw)
  To: Armin Wolf
  Cc: Hans de Goede, Ilpo Järvinen, platform-driver-x86,
	linux-kernel

I have corrected it in version 5.

Thank you.

Armin Wolf <W_Armin@gmx.de> 於 2026年4月29日週三 上午5:16寫道:
>
> Am 20.04.26 um 08:00 schrieb Jack Wu:
>
> > 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/wwan_reset
> >
> > Signed-off-by: Jack Wu <jackbb_wu@compal.com>
> > ---
> > v4:
> >    - Fix version of the ABI documentation to 7.2
> >    - Add include linux/types.h
> > v3:
> >    - Rename sysfs attribute from "pldr" to "wwan_reset" for clarity
> >    - Add ABI documentation for the wwan_reset sysfs interface
> >    - Validate _DSM method availability in probe using acpi_check_dsm()
> > 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
> > ---
> > ---
> >   .../testing/sysfs-driver-dell-dw5826e-reset   |  9 ++
> >   drivers/platform/x86/dell/Kconfig             |  6 ++
> >   drivers/platform/x86/dell/Makefile            |  2 +
> >   .../platform/x86/dell/dell-dw5826e-reset.c    | 90 +++++++++++++++++++
> >   4 files changed, 107 insertions(+)
> >   create mode 100644 Documentation/ABI/testing/sysfs-driver-dell-dw5826e-reset
> >   create mode 100644 drivers/platform/x86/dell/dell-dw5826e-reset.c
> >
> > diff --git a/Documentation/ABI/testing/sysfs-driver-dell-dw5826e-reset b/Documentation/ABI/testing/sysfs-driver-dell-dw5826e-reset
> > new file mode 100644
> > index 000000000000..a665e265633f
> > --- /dev/null
> > +++ b/Documentation/ABI/testing/sysfs-driver-dell-dw5826e-reset
> > @@ -0,0 +1,9 @@
> > +What:                /sys/bus/platform/devices/<PALC0001 device>/wwan_reset
> > +Date:                April 2026
> > +KernelVersion:       7.2
> > +Contact:     Jackbb Wu <jackbb.wu@compal.com>
> > +Description:
> > +             Writing to this file triggers a Platform Level Device Reset
> > +             (PLDR) of the Dell DW5826e WWAN module via an ACPI _DSM
> > +             method. This can be used to recover the modem when it is in
> > +             a frozen state and unable to respond to USB commands.
> > 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..4e0d64535abb
> > --- /dev/null
> > +++ b/drivers/platform/x86/dell/dell-dw5826e-reset.c
> > @@ -0,0 +1,90 @@
> > +// 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/acpi.h>
> > +#include <linux/device.h>
> > +#include <linux/module.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/types.h>
> > +#include <linux/uuid.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);
>
> Please use BIT() for the DSM method here. Also consider using a define for the
> DSM method index.
>
> With that being fixed:
>
> Reviewed-by: Armin Wolf <W_Armin@gmx.de>
>
> > +     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 wwan_reset_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(wwan_reset);
> > +
> > +static struct attribute *palc_attrs[] = {
> > +     &dev_attr_wwan_reset.attr,
> > +     NULL
> > +};
> > +ATTRIBUTE_GROUPS(palc);
> > +
> > +static int palc_probe(struct platform_device *pdev)
> > +{
> > +     acpi_handle handle;
> > +
> > +     handle = ACPI_HANDLE(&pdev->dev);
> > +     if (!handle)
> > +             return -ENODEV;
> > +
> > +     if (!acpi_check_dsm(handle, &palc_dsm_guid, 1, BIT(1)))
> > +             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");

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-04-29  6:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-20  6:00 [PATCH v4] platform/x86: dell-dw5826e: Add reset driver for DW5826e Jack Wu
2026-04-20 14:03 ` Mario Limonciello
2026-04-28 21:16 ` Armin Wolf
2026-04-29  6:08   ` 吳逼逼

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox