public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] platform/x86: x86-android-tablets: use real firmware node references with intel drivers
@ 2026-03-19 16:10 Bartosz Golaszewski
  2026-03-19 16:10 ` [PATCH 1/4] software node: support automatic secondary fwnode assignment Bartosz Golaszewski
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Bartosz Golaszewski @ 2026-03-19 16:10 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
  Cc: linux-acpi, driver-core, linux-kernel, linux-gpio,
	platform-driver-x86, Bartosz Golaszewski

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.

x86-android-tablets driver is one of the abusers in that it creates
dummy software nodes for baytrail and cherryview GPIO controllers but
they don't really reference these devices. Before we can reapply
e5d527be7e69 and support matching by fwnode address exclusively, we need
to convert all the users to using actual fwnode references.

It's possible for drivers to reference real firmware nodes from software
nodes via PROPERTY_ENTRY_REF() in general or PROPERTY_ENTRY_GPIO()
specifically but for platform devices binding to real firmware nodes (DT
or ACPI) it's cumbersome as they would need to dynamically look for the
right nodes and create references dynamically with no way of using
static const software nodes.

This series proposes a solution in the form of automatic secondary
software node assignment (I'm open to better naming ideas). We extend
the swnode API with functions allowing to set up a behind-the-scenes bus
notifier for a group of named software nodes. It will wait for bus
events and when a device is added, it will check its name against the
software node's name and - on match - assign the software node as the
secondary firmware node of the device's *real* firmware node.

For now it only supports name matching but I suppose we could extend it
with additional mechanisms if needed. I didn't plan to introduce a
generic API for this initially but the code in cherryview and baytrail
drivers ended up being exactly the same so I decided to factor it out
into common library code.

First patch provides the new interfaces. Next two patches set up
automatic secondary fwnodes for intel baytrail and cherryview drivers.
Finally patch 4/4 replaces the dummy software nodes with ones that will
end up actually being attached to the relevant devices.

GPIOLIB is now able to match a GPIO controller by both its primary as
well as secondary firmware node. While I don't have the relevant
hardware, I tested the series and the new behavior on x86 qemu with
a dummy ACPI table and modified gpio-sim. I assume it will work in real
life but testing is welcome.

Merging strategy: This touches three trees and there are build-time
dependencies. I think it should go through the x86 platform tree with
Ilpo providing an immutable branch for the driver core and pinctrl
trees.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
Bartosz Golaszewski (4):
      software node: support automatic secondary fwnode assignment
      pinctrl: intel: expose software nodes for baytrail GPIO devices
      pinctrl: intel: expose software nodes for cherryiew GPIO devices
      platform/x86: x86-android-tablets: enable fwnode matching of GPIO chips

 drivers/base/swnode.c                              | 105 +++++++++++++++++++++
 drivers/pinctrl/intel/pinctrl-baytrail.c           |  40 +++++++-
 drivers/pinctrl/intel/pinctrl-cherryview.c         |  47 ++++++++-
 drivers/platform/x86/x86-android-tablets/Kconfig   |   1 +
 drivers/platform/x86/x86-android-tablets/acer.c    |  11 ++-
 drivers/platform/x86/x86-android-tablets/asus.c    |   9 +-
 drivers/platform/x86/x86-android-tablets/core.c    |  47 +--------
 drivers/platform/x86/x86-android-tablets/lenovo.c  |  31 +++---
 drivers/platform/x86/x86-android-tablets/other.c   |  23 ++---
 .../x86/x86-android-tablets/shared-psy-info.c      |   7 +-
 .../x86/x86-android-tablets/x86-android-tablets.h  |   4 -
 include/linux/pinctrl/intel.h                      |  17 ++++
 include/linux/property.h                           |  18 ++++
 13 files changed, 270 insertions(+), 90 deletions(-)
---
base-commit: f50e991d263338028b296f4398c669feca8f0c3b
change-id: 20260319-baytrail-real-swnode-7de7a3870f78

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>


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

end of thread, other threads:[~2026-03-23 22:01 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-19 16:10 [PATCH 0/4] platform/x86: x86-android-tablets: use real firmware node references with intel drivers Bartosz Golaszewski
2026-03-19 16:10 ` [PATCH 1/4] software node: support automatic secondary fwnode assignment Bartosz Golaszewski
2026-03-20  7:36   ` Andy Shevchenko
2026-03-23 15:23     ` Bartosz Golaszewski
2026-03-19 16:10 ` [PATCH 2/4] pinctrl: intel: expose software nodes for baytrail GPIO devices Bartosz Golaszewski
2026-03-20 10:38   ` Andy Shevchenko
2026-03-20 10:39     ` Andy Shevchenko
2026-03-23 15:28     ` Bartosz Golaszewski
2026-03-23 17:05       ` Andy Shevchenko
2026-03-19 16:10 ` [PATCH 3/4] pinctrl: intel: expose software nodes for cherryiew " Bartosz Golaszewski
2026-03-19 16:10 ` [PATCH 4/4] platform/x86: x86-android-tablets: enable fwnode matching of GPIO chips Bartosz Golaszewski
2026-03-20  1:49 ` [PATCH 0/4] platform/x86: x86-android-tablets: use real firmware node references with intel drivers Dmitry Torokhov
2026-03-20 20:33   ` Bartosz Golaszewski
2026-03-21  7:01     ` Dmitry Torokhov
2026-03-23 11:40       ` Bartosz Golaszewski
2026-03-23 22:01         ` Dmitry Torokhov

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