* [PATCH v5 1/2] ACPI: provide acpi_bus_find_device_by_name()
2026-05-04 10:58 [PATCH v5 0/2] platform/x86: x86-android-tablets: use real firmware node references with intel drivers Bartosz Golaszewski
@ 2026-05-04 10:58 ` Bartosz Golaszewski
2026-05-04 11:00 ` Bartosz Golaszewski
2026-05-04 11:03 ` Andy Shevchenko
2026-05-04 10:58 ` [PATCH v5 2/2] platform/x86: x86-android-tablets: enable fwnode matching of GPIO chips Bartosz Golaszewski
2026-05-08 18:15 ` [PATCH v5 0/2] platform/x86: x86-android-tablets: use real firmware node references with intel drivers Ilpo Järvinen
2 siblings, 2 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2026-05-04 10:58 UTC (permalink / raw)
To: Andy Shevchenko, Daniel Scally, Heikki Krogerus, Sakari Ailus,
Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
Mika Westerberg, Andy Shevchenko, Linus Walleij, Hans de Goede,
Ilpo Järvinen, Dmitry Torokhov, Len Brown
Cc: linux-acpi, driver-core, linux-kernel, linux-gpio,
platform-driver-x86, brgl, Bartosz Golaszewski
Provide a helper allowing to locate an ACPI device by its name.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/acpi/bus.c | 15 +++++++++++++++
include/linux/acpi.h | 7 +++++++
2 files changed, 22 insertions(+)
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 2ec095e2009e40b0645f654fb051429e5679dc7c..357b39db345d596314e8956d7789ef0cc51ad1c1 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -1181,6 +1181,21 @@ int acpi_bus_for_each_dev(int (*fn)(struct device *, void *), void *data)
}
EXPORT_SYMBOL_GPL(acpi_bus_for_each_dev);
+/**
+ * acpi_bus_find_device_by_name() - Locate an ACPI device by its name
+ * @name: Name of the device to match
+ *
+ * The caller is responsible for calling put_device() on the returned object.
+ *
+ * Returns:
+ * New reference to the matched device or NULL if the device can't be found.
+ */
+struct device *acpi_bus_find_device_by_name(const char *name)
+{
+ return bus_find_device_by_name(&acpi_bus_type, NULL, name);
+}
+EXPORT_SYMBOL_GPL(acpi_bus_find_device_by_name);
+
struct acpi_dev_walk_context {
int (*fn)(struct acpi_device *, void *);
void *data;
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 67effb91fa98373d7bf19be5ae3d8baa9328d6e1..10d6c6c11bdffcad14100601e104520366dfc30b 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -798,6 +798,8 @@ int acpi_get_local_u64_address(acpi_handle handle, u64 *addr);
int acpi_get_local_address(acpi_handle handle, u32 *addr);
const char *acpi_get_subsystem_id(acpi_handle handle);
+struct device *acpi_bus_find_device_by_name(const char *name);
+
#ifdef CONFIG_ACPI_MRRM
int acpi_mrrm_max_mem_region(void);
#endif
@@ -1106,6 +1108,11 @@ static inline const char *acpi_get_subsystem_id(acpi_handle handle)
return ERR_PTR(-ENODEV);
}
+static inline struct device *acpi_bus_find_device_by_name(const char *name)
+{
+ return NULL;
+}
+
static inline int acpi_register_wakeup_handler(int wake_irq,
bool (*wakeup)(void *context), void *context)
{
--
2.47.3
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH v5 1/2] ACPI: provide acpi_bus_find_device_by_name()
2026-05-04 10:58 ` [PATCH v5 1/2] ACPI: provide acpi_bus_find_device_by_name() Bartosz Golaszewski
@ 2026-05-04 11:00 ` Bartosz Golaszewski
2026-05-04 11:03 ` Andy Shevchenko
1 sibling, 0 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2026-05-04 11:00 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Andy Shevchenko, Daniel Scally, Heikki Krogerus, Sakari Ailus,
Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
Mika Westerberg, Andy Shevchenko, Linus Walleij, Hans de Goede,
Ilpo Järvinen, Dmitry Torokhov, Len Brown, linux-acpi,
driver-core, linux-kernel, linux-gpio, platform-driver-x86
On Mon, May 4, 2026 at 12:59 PM Bartosz Golaszewski
<bartosz.golaszewski@oss.qualcomm.com> wrote:
>
> Provide a helper allowing to locate an ACPI device by its name.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> ---
Acked-by: Rafael J. Wysocki (Intel) <rafael@kernel.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v5 1/2] ACPI: provide acpi_bus_find_device_by_name()
2026-05-04 10:58 ` [PATCH v5 1/2] ACPI: provide acpi_bus_find_device_by_name() Bartosz Golaszewski
2026-05-04 11:00 ` Bartosz Golaszewski
@ 2026-05-04 11:03 ` Andy Shevchenko
1 sibling, 0 replies; 9+ messages in thread
From: Andy Shevchenko @ 2026-05-04 11:03 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Daniel Scally, Heikki Krogerus, Sakari Ailus, Greg Kroah-Hartman,
Rafael J. Wysocki, Danilo Krummrich, Mika Westerberg,
Andy Shevchenko, Linus Walleij, Hans de Goede, Ilpo Järvinen,
Dmitry Torokhov, Len Brown, linux-acpi, driver-core, linux-kernel,
linux-gpio, platform-driver-x86, brgl
On Mon, May 04, 2026 at 12:58:56PM +0200, Bartosz Golaszewski wrote:
> Provide a helper allowing to locate an ACPI device by its name.
Hmm... I thought Rafael gave you his Ack, but I may be mistaken.
FWIW,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v5 2/2] platform/x86: x86-android-tablets: enable fwnode matching of GPIO chips
2026-05-04 10:58 [PATCH v5 0/2] platform/x86: x86-android-tablets: use real firmware node references with intel drivers Bartosz Golaszewski
2026-05-04 10:58 ` [PATCH v5 1/2] ACPI: provide acpi_bus_find_device_by_name() Bartosz Golaszewski
@ 2026-05-04 10:58 ` Bartosz Golaszewski
2026-05-04 11:01 ` Bartosz Golaszewski
` (2 more replies)
2026-05-08 18:15 ` [PATCH v5 0/2] platform/x86: x86-android-tablets: use real firmware node references with intel drivers Ilpo Järvinen
2 siblings, 3 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2026-05-04 10:58 UTC (permalink / raw)
To: Andy Shevchenko, Daniel Scally, Heikki Krogerus, Sakari Ailus,
Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
Mika Westerberg, Andy Shevchenko, Linus Walleij, Hans de Goede,
Ilpo Järvinen, Dmitry Torokhov, Len Brown
Cc: linux-acpi, driver-core, linux-kernel, linux-gpio,
platform-driver-x86, brgl, Bartosz Golaszewski
In order to allow GPIOLIB to match cherryview and baytrail GPIO
controllers by their firmware nodes instead of their names, we need to
attach the - currently "dangling" - existing software nodes to their
target devices dynamically.
The driver uses platform_create_bundle() and expects all required
providers to be present before it itself is probed. We know the name of
the device we're waiting for so look them up and assign the appropriate
software node as the secondary firmware node of the underlying ACPI node.
Scheduling fine-grained devres actions allows for proper teardown and
unsetting of the secondary firmware nodes.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/platform/x86/x86-android-tablets/core.c | 63 +++++++++++++++++++++++--
1 file changed, 60 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/x86/x86-android-tablets/core.c b/drivers/platform/x86/x86-android-tablets/core.c
index 021009e9085bec3db9c4daa1f6235600210a6099..4126b49e7d07b64ab9cdb876326c315f9a73b16c 100644
--- a/drivers/platform/x86/x86-android-tablets/core.c
+++ b/drivers/platform/x86/x86-android-tablets/core.c
@@ -13,6 +13,7 @@
#include <linux/acpi.h>
#include <linux/device.h>
#include <linux/dmi.h>
+#include <linux/fwnode.h>
#include <linux/gpio/consumer.h>
#include <linux/gpio/machine.h>
#include <linux/irq.h>
@@ -360,6 +361,61 @@ static const struct software_node *cherryview_gpiochip_node_group[] = {
NULL
};
+static void gpio_secondary_unset(void *data)
+{
+ struct device *dev = data;
+
+ set_secondary_fwnode(dev, NULL);
+}
+
+static void gpio_secondary_unregister_node_group(void *data)
+{
+ const struct software_node **nodes = data;
+
+ software_node_unregister_node_group(nodes);
+}
+
+static int gpio_secondary_fwnode_init(struct device *parent)
+{
+ const struct software_node *const *swnode;
+ struct fwnode_handle *fwnode;
+ int ret;
+
+ if (!gpiochip_node_group)
+ return 0;
+
+ ret = software_node_register_node_group(gpiochip_node_group);
+ if (ret)
+ return ret;
+
+ ret = devm_add_action_or_reset(parent,
+ gpio_secondary_unregister_node_group,
+ gpiochip_node_group);
+ if (ret)
+ return ret;
+
+ for (swnode = gpiochip_node_group; *swnode; swnode++) {
+ struct device *dev __free(put_device) =
+ acpi_bus_find_device_by_name((*swnode)->name);
+ if (!dev)
+ return dev_err_probe(parent,
+ -ENODEV, "Failed to find the required GPIO controller: %s\n",
+ (*swnode)->name);
+
+ fwnode = software_node_fwnode(*swnode);
+ if (WARN_ON(!fwnode))
+ return -ENOENT;
+
+ set_secondary_fwnode(dev, fwnode);
+
+ ret = devm_add_action_or_reset(parent, gpio_secondary_unset, dev);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
+}
+
static void x86_android_tablet_remove(struct platform_device *pdev)
{
int i;
@@ -391,7 +447,6 @@ static void x86_android_tablet_remove(struct platform_device *pdev)
software_node_unregister_node_group(gpio_button_swnodes);
software_node_unregister_node_group(swnode_group);
- software_node_unregister_node_group(gpiochip_node_group);
}
static __init int x86_android_tablet_probe(struct platform_device *pdev)
@@ -427,9 +482,11 @@ static __init int x86_android_tablet_probe(struct platform_device *pdev)
break;
}
- ret = software_node_register_node_group(gpiochip_node_group);
- if (ret)
+ ret = gpio_secondary_fwnode_init(&pdev->dev);
+ if (ret) {
+ x86_android_tablet_remove(pdev);
return ret;
+ }
ret = software_node_register_node_group(dev_info->swnode_group);
if (ret) {
--
2.47.3
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH v5 2/2] platform/x86: x86-android-tablets: enable fwnode matching of GPIO chips
2026-05-04 10:58 ` [PATCH v5 2/2] platform/x86: x86-android-tablets: enable fwnode matching of GPIO chips Bartosz Golaszewski
@ 2026-05-04 11:01 ` Bartosz Golaszewski
2026-05-04 11:05 ` Andy Shevchenko
2026-05-05 12:37 ` Linus Walleij
2 siblings, 0 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2026-05-04 11:01 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Andy Shevchenko, Daniel Scally, Heikki Krogerus, Sakari Ailus,
Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
Mika Westerberg, Andy Shevchenko, Linus Walleij, Hans de Goede,
Ilpo Järvinen, Dmitry Torokhov, Len Brown, linux-acpi,
driver-core, linux-kernel, linux-gpio, platform-driver-x86
On Mon, May 4, 2026 at 12:59 PM Bartosz Golaszewski
<bartosz.golaszewski@oss.qualcomm.com> wrote:
>
> In order to allow GPIOLIB to match cherryview and baytrail GPIO
> controllers by their firmware nodes instead of their names, we need to
> attach the - currently "dangling" - existing software nodes to their
> target devices dynamically.
>
> The driver uses platform_create_bundle() and expects all required
> providers to be present before it itself is probed. We know the name of
> the device we're waiting for so look them up and assign the appropriate
> software node as the secondary firmware node of the underlying ACPI node.
>
> Scheduling fine-grained devres actions allows for proper teardown and
> unsetting of the secondary firmware nodes.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> ---
Reviewed-by: Rafael J. Wysocki (Intel) <rafael@kernel.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v5 2/2] platform/x86: x86-android-tablets: enable fwnode matching of GPIO chips
2026-05-04 10:58 ` [PATCH v5 2/2] platform/x86: x86-android-tablets: enable fwnode matching of GPIO chips Bartosz Golaszewski
2026-05-04 11:01 ` Bartosz Golaszewski
@ 2026-05-04 11:05 ` Andy Shevchenko
2026-05-05 12:37 ` Linus Walleij
2 siblings, 0 replies; 9+ messages in thread
From: Andy Shevchenko @ 2026-05-04 11:05 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Daniel Scally, Heikki Krogerus, Sakari Ailus, Greg Kroah-Hartman,
Rafael J. Wysocki, Danilo Krummrich, Mika Westerberg,
Andy Shevchenko, Linus Walleij, Hans de Goede, Ilpo Järvinen,
Dmitry Torokhov, Len Brown, linux-acpi, driver-core, linux-kernel,
linux-gpio, platform-driver-x86, brgl
On Mon, May 04, 2026 at 12:58:57PM +0200, Bartosz Golaszewski wrote:
> In order to allow GPIOLIB to match cherryview and baytrail GPIO
> controllers by their firmware nodes instead of their names, we need to
> attach the - currently "dangling" - existing software nodes to their
> target devices dynamically.
>
> The driver uses platform_create_bundle() and expects all required
> providers to be present before it itself is probed. We know the name of
> the device we're waiting for so look them up and assign the appropriate
> software node as the secondary firmware node of the underlying ACPI node.
>
> Scheduling fine-grained devres actions allows for proper teardown and
> unsetting of the secondary firmware nodes.
This version is much better than previous variants (and simpler), so, FWIW
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v5 2/2] platform/x86: x86-android-tablets: enable fwnode matching of GPIO chips
2026-05-04 10:58 ` [PATCH v5 2/2] platform/x86: x86-android-tablets: enable fwnode matching of GPIO chips Bartosz Golaszewski
2026-05-04 11:01 ` Bartosz Golaszewski
2026-05-04 11:05 ` Andy Shevchenko
@ 2026-05-05 12:37 ` Linus Walleij
2 siblings, 0 replies; 9+ messages in thread
From: Linus Walleij @ 2026-05-05 12:37 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Andy Shevchenko, Daniel Scally, Heikki Krogerus, Sakari Ailus,
Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
Mika Westerberg, Andy Shevchenko, Hans de Goede,
Ilpo Järvinen, Dmitry Torokhov, Len Brown, linux-acpi,
driver-core, linux-kernel, linux-gpio, platform-driver-x86, brgl
On Mon, May 4, 2026 at 12:59 PM Bartosz Golaszewski
<bartosz.golaszewski@oss.qualcomm.com> wrote:
> In order to allow GPIOLIB to match cherryview and baytrail GPIO
> controllers by their firmware nodes instead of their names, we need to
> attach the - currently "dangling" - existing software nodes to their
> target devices dynamically.
>
> The driver uses platform_create_bundle() and expects all required
> providers to be present before it itself is probed. We know the name of
> the device we're waiting for so look them up and assign the appropriate
> software node as the secondary firmware node of the underlying ACPI node.
>
> Scheduling fine-grained devres actions allows for proper teardown and
> unsetting of the secondary firmware nodes.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Nice work here Bartosz!
Reviewed-by: Linus Walleij <linusw@kernel.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v5 0/2] platform/x86: x86-android-tablets: use real firmware node references with intel drivers
2026-05-04 10:58 [PATCH v5 0/2] platform/x86: x86-android-tablets: use real firmware node references with intel drivers Bartosz Golaszewski
2026-05-04 10:58 ` [PATCH v5 1/2] ACPI: provide acpi_bus_find_device_by_name() Bartosz Golaszewski
2026-05-04 10:58 ` [PATCH v5 2/2] platform/x86: x86-android-tablets: enable fwnode matching of GPIO chips Bartosz Golaszewski
@ 2026-05-08 18:15 ` Ilpo Järvinen
2 siblings, 0 replies; 9+ messages in thread
From: Ilpo Järvinen @ 2026-05-08 18:15 UTC (permalink / raw)
To: Andy Shevchenko, Daniel Scally, Heikki Krogerus, Sakari Ailus,
Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
Mika Westerberg, Andy Shevchenko, Linus Walleij, Hans de Goede,
Dmitry Torokhov, Len Brown, Bartosz Golaszewski
Cc: linux-acpi, driver-core, linux-kernel, linux-gpio,
platform-driver-x86, brgl
On Mon, 04 May 2026 12:58:55 +0200, Bartosz Golaszewski wrote:
> First let me repeat the problem statement:
>
> ==
>
> GPIO software node lookup should rely exclusively on matching the
> addresses of the referenced firmware nodes. I tried to enforce it with
> commit e5d527be7e69 ("gpio: swnode: don't use the swnode's name as the
> key for GPIO lookup") but it broke existing users who abuse the software
> node mechanism by creating "dummy" software nodes named after the device
> they want to get GPIOs from but never attaching them to the actual GPIO
> devices. They rely on the current behavior of GPIOLIB where it will match
> the label of the GPIO controller against the name of the software node
> and does not require a true link.
>
> [...]
Thank you for your contribution, it has been applied to my local
review-ilpo-next branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-next branch only once I've pushed my
local branch there, which might take a while.
The list of commits applied:
[1/2] ACPI: provide acpi_bus_find_device_by_name()
commit: 083a59e05db9203c346e87d822c0c12a0f7a7c85
[2/2] platform/x86: x86-android-tablets: enable fwnode matching of GPIO chips
commit: 1448c2d2ca5cc7f4ea6694e6bc809946de0a751c
--
i.
^ permalink raw reply [flat|nested] 9+ messages in thread