* [PATCH 0/2] sh: mach-x3proto: convert gpio-keys to software nodes
@ 2026-07-05 5:04 Dmitry Torokhov
2026-07-05 5:04 ` [PATCH 1/2] sh: mach-x3proto: add software node for GPIO controller Dmitry Torokhov
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Dmitry Torokhov @ 2026-07-05 5:04 UTC (permalink / raw)
To: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz
Cc: Linus Walleij, Bartosz Golaszewski, Arnd Bergmann, linux-sh,
linux-kernel
This series converts the legacy gpio-keys platform device on the SH-X3
Prototype board to use software nodes and static properties.
This is part of the ongoing effort to remove platform data support
from the gpio-keys driver, allowing it to rely purely on generic
device properties.
The first patch adds the software node to the GPIO controller, and
the second patch performs the conversion for the gpio-keys device.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
Dmitry Torokhov (2):
sh: mach-x3proto: add software node for GPIO controller
sh: mach-x3proto: convert gpio-keys to software nodes
arch/sh/boards/mach-x3proto/gpio.c | 15 ++-
arch/sh/boards/mach-x3proto/setup.c | 165 +++++++++++++--------------
arch/sh/include/mach-x3proto/mach/hardware.h | 2 +
3 files changed, 94 insertions(+), 88 deletions(-)
---
base-commit: 3d5670d672ae08b8c534b7beed6f57c8b44e7b43
change-id: 20260627-sh-x3proto-swnode-3feadf472a92
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH 1/2] sh: mach-x3proto: add software node for GPIO controller 2026-07-05 5:04 [PATCH 0/2] sh: mach-x3proto: convert gpio-keys to software nodes Dmitry Torokhov @ 2026-07-05 5:04 ` Dmitry Torokhov 2026-07-05 5:04 ` [PATCH 2/2] sh: mach-x3proto: convert gpio-keys to software nodes Dmitry Torokhov ` (3 subsequent siblings) 4 siblings, 0 replies; 8+ messages in thread From: Dmitry Torokhov @ 2026-07-05 5:04 UTC (permalink / raw) To: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz Cc: Linus Walleij, Bartosz Golaszewski, Arnd Bergmann, linux-sh, linux-kernel We want to convert the legacy gpio-keys platform device on the SH-X3 Prototype board to use software nodes. To do this properly and allow referencing the GPIO controller by address rather than relying on name-based matching (which is being removed from the gpiolib core), we need to associate the GPIO controller with a software node. Introduce x3proto_gpiochip_node, register it, and associate it with x3proto_gpio_chip. Assisted-by: Antigravity:gemini-3.5-flash Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> --- arch/sh/boards/mach-x3proto/gpio.c | 15 ++++++++++++++- arch/sh/include/mach-x3proto/mach/hardware.h | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/arch/sh/boards/mach-x3proto/gpio.c b/arch/sh/boards/mach-x3proto/gpio.c index c13d51b29702..a09cafc782b4 100644 --- a/arch/sh/boards/mach-x3proto/gpio.c +++ b/arch/sh/boards/mach-x3proto/gpio.c @@ -18,6 +18,7 @@ #include <linux/io.h> #include <mach/ilsel.h> #include <mach/hardware.h> +#include <linux/property.h> #define KEYCTLR 0xb81c0000 #define KEYOUTR 0xb81c0002 @@ -73,6 +74,10 @@ static void x3proto_gpio_irq_handler(struct irq_desc *desc) chip->irq_unmask(data); } +const struct software_node x3proto_gpiochip_node = { + .name = "x3proto-gpio", +}; + struct gpio_chip x3proto_gpio_chip = { .label = "x3proto-gpio", .direction_input = x3proto_gpio_direction_input, @@ -104,9 +109,15 @@ int __init x3proto_gpio_setup(void) if (unlikely(ilsel < 0)) return ilsel; + ret = software_node_register(&x3proto_gpiochip_node); + if (ret) + goto err_gpio; + + x3proto_gpio_chip.fwnode = software_node_fwnode(&x3proto_gpiochip_node); + ret = gpiochip_add_data(&x3proto_gpio_chip, NULL); if (unlikely(ret)) - goto err_gpio; + goto err_swnode; x3proto_irq_domain = irq_domain_create_linear(NULL, NR_BASEBOARD_GPIOS, &x3proto_gpio_irq_ops, NULL); @@ -127,6 +138,8 @@ int __init x3proto_gpio_setup(void) err_irq: gpiochip_remove(&x3proto_gpio_chip); ret = 0; +err_swnode: + software_node_unregister(&x3proto_gpiochip_node); err_gpio: synchronize_irq(ilsel); diff --git a/arch/sh/include/mach-x3proto/mach/hardware.h b/arch/sh/include/mach-x3proto/mach/hardware.h index 57ea4a5cca35..1ee5a404973c 100644 --- a/arch/sh/include/mach-x3proto/mach/hardware.h +++ b/arch/sh/include/mach-x3proto/mach/hardware.h @@ -3,10 +3,12 @@ #define __MACH_X3PROTO_HARDWARE_H struct gpio_chip; +struct software_node; /* arch/sh/boards/mach-x3proto/gpio.c */ int x3proto_gpio_setup(void); extern struct gpio_chip x3proto_gpio_chip; +extern const struct software_node x3proto_gpiochip_node; #define NR_BASEBOARD_GPIOS 16 -- 2.55.0.rc0.799.gd6f94ed593-goog ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/2] sh: mach-x3proto: convert gpio-keys to software nodes 2026-07-05 5:04 [PATCH 0/2] sh: mach-x3proto: convert gpio-keys to software nodes Dmitry Torokhov 2026-07-05 5:04 ` [PATCH 1/2] sh: mach-x3proto: add software node for GPIO controller Dmitry Torokhov @ 2026-07-05 5:04 ` Dmitry Torokhov 2026-07-06 9:47 ` [PATCH 0/2] " Bartosz Golaszewski ` (2 subsequent siblings) 4 siblings, 0 replies; 8+ messages in thread From: Dmitry Torokhov @ 2026-07-05 5:04 UTC (permalink / raw) To: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz Cc: Linus Walleij, Bartosz Golaszewski, Arnd Bergmann, linux-sh, linux-kernel Convert the legacy gpio-keys platform device on the SH-X3 Prototype board to use software nodes/properties. This allows us to describe the GPIO keys and their GPIO bindings using software nodes, so that support for platform data can eventually be removed from the gpio-keys driver. Assisted-by: Antigravity:gemini-3.5-flash Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> --- arch/sh/boards/mach-x3proto/setup.c | 165 +++++++++++++++++------------------- 1 file changed, 78 insertions(+), 87 deletions(-) diff --git a/arch/sh/boards/mach-x3proto/setup.c b/arch/sh/boards/mach-x3proto/setup.c index ca2802d30565..0d9d5982cf0c 100644 --- a/arch/sh/boards/mach-x3proto/setup.c +++ b/arch/sh/boards/mach-x3proto/setup.c @@ -16,8 +16,8 @@ #include <linux/input.h> #include <linux/usb/r8a66597.h> #include <linux/usb/m66592.h> -#include <linux/gpio/driver.h> -#include <linux/gpio_keys.h> +#include <linux/gpio/machine.h> +#include <linux/gpio/property.h> #include <mach/ilsel.h> #include <mach/hardware.h> #include <asm/smp-ops.h> @@ -123,87 +123,74 @@ static struct platform_device m66592_usb_peripheral_device = { .resource = m66592_usb_peripheral_resources, }; -static struct gpio_keys_button baseboard_buttons[NR_BASEBOARD_GPIOS] = { - { - .desc = "key44", - .code = KEY_POWER, - .active_low = 1, - .wakeup = 1, - }, { - .desc = "key43", - .code = KEY_SUSPEND, - .active_low = 1, - .wakeup = 1, - }, { - .desc = "key42", - .code = KEY_KATAKANAHIRAGANA, - .active_low = 1, - }, { - .desc = "key41", - .code = KEY_SWITCHVIDEOMODE, - .active_low = 1, - }, { - .desc = "key34", - .code = KEY_F12, - .active_low = 1, - }, { - .desc = "key33", - .code = KEY_F11, - .active_low = 1, - }, { - .desc = "key32", - .code = KEY_F10, - .active_low = 1, - }, { - .desc = "key31", - .code = KEY_F9, - .active_low = 1, - }, { - .desc = "key24", - .code = KEY_F8, - .active_low = 1, - }, { - .desc = "key23", - .code = KEY_F7, - .active_low = 1, - }, { - .desc = "key22", - .code = KEY_F6, - .active_low = 1, - }, { - .desc = "key21", - .code = KEY_F5, - .active_low = 1, - }, { - .desc = "key14", - .code = KEY_F4, - .active_low = 1, - }, { - .desc = "key13", - .code = KEY_F3, - .active_low = 1, - }, { - .desc = "key12", - .code = KEY_F2, - .active_low = 1, - }, { - .desc = "key11", - .code = KEY_F1, - .active_low = 1, - }, +static const struct software_node x3proto_gpio_keys_node = { + .name = "x3proto-gpio-keys", }; -static struct gpio_keys_platform_data baseboard_buttons_data = { - .buttons = baseboard_buttons, - .nbuttons = ARRAY_SIZE(baseboard_buttons), +#define __X3PROTO_KEY(_id, _code, _gpio, ...) \ +static const struct property_entry x3proto_key##_id##_props[] = { \ + PROPERTY_ENTRY_STRING("label", "key" #_id), \ + PROPERTY_ENTRY_U32("linux,code", _code), \ + PROPERTY_ENTRY_GPIO("gpios", &x3proto_gpiochip_node, \ + _gpio, GPIO_ACTIVE_LOW), \ + __VA_ARGS__ \ + { } \ +}; \ +static const struct software_node x3proto_key##_id##_node = { \ + .parent = &x3proto_gpio_keys_node, \ + .properties = x3proto_key##_id##_props, \ +} + +#define X3PROTO_KEY(_id, _code, _gpio) \ + __X3PROTO_KEY(_id, _code, _gpio) + +#define X3PROTO_KEY_WAKEUP(_id, _code, _gpio) \ + __X3PROTO_KEY(_id, _code, _gpio, \ + PROPERTY_ENTRY_BOOL("wakeup-source"), \ + ) + +X3PROTO_KEY_WAKEUP(44, KEY_POWER, 0); +X3PROTO_KEY_WAKEUP(43, KEY_SUSPEND, 1); +X3PROTO_KEY(42, KEY_KATAKANAHIRAGANA, 2); +X3PROTO_KEY(41, KEY_SWITCHVIDEOMODE, 3); +X3PROTO_KEY(34, KEY_F12, 4); +X3PROTO_KEY(33, KEY_F11, 5); +X3PROTO_KEY(32, KEY_F10, 6); +X3PROTO_KEY(31, KEY_F9, 7); +X3PROTO_KEY(24, KEY_F8, 8); +X3PROTO_KEY(23, KEY_F7, 9); +X3PROTO_KEY(22, KEY_F6, 10); +X3PROTO_KEY(21, KEY_F5, 11); +X3PROTO_KEY(14, KEY_F4, 12); +X3PROTO_KEY(13, KEY_F3, 13); +X3PROTO_KEY(12, KEY_F2, 14); +X3PROTO_KEY(11, KEY_F1, 15); + +static const struct software_node *const x3proto_swnodes[] __initconst = { + &x3proto_gpio_keys_node, + &x3proto_key44_node, + &x3proto_key43_node, + &x3proto_key42_node, + &x3proto_key41_node, + &x3proto_key34_node, + &x3proto_key33_node, + &x3proto_key32_node, + &x3proto_key31_node, + &x3proto_key24_node, + &x3proto_key23_node, + &x3proto_key22_node, + &x3proto_key21_node, + &x3proto_key14_node, + &x3proto_key13_node, + &x3proto_key12_node, + &x3proto_key11_node, + NULL }; -static struct platform_device baseboard_buttons_device = { +static const struct platform_device_info x3proto_gpio_keys_device_info __initconst = { .name = "gpio-keys", - .id = -1, - .dev = { - .platform_data = &baseboard_buttons_data, - }, + .id = PLATFORM_DEVID_NONE, + .swnode = &x3proto_gpio_keys_node, }; static struct platform_device *x3proto_devices[] __initdata = { @@ -211,7 +198,6 @@ static struct platform_device *x3proto_devices[] __initdata = { &smc91x_device, &r8a66597_usb_host_device, &m66592_usb_peripheral_device, - &baseboard_buttons_device, }; static void __init x3proto_init_irq(void) @@ -224,7 +210,8 @@ static void __init x3proto_init_irq(void) static int __init x3proto_devices_setup(void) { - int ret, i; + struct platform_device *pd; + int ret; /* * IRLs are only needed for ILSEL mappings, so flip over the INTC @@ -239,11 +226,11 @@ static int __init x3proto_devices_setup(void) if (unlikely(ret)) return ret; - /* - * Propagate dynamic GPIOs for the baseboard button device. - */ - for (i = 0; i < ARRAY_SIZE(baseboard_buttons); i++) - baseboard_buttons[i].gpio = x3proto_gpio_chip.base + i; + ret = software_node_register_node_group(x3proto_swnodes); + if (ret) { + pr_err("Failed to register software nodes: %d\n", ret); + return ret; + } r8a66597_usb_host_resources[1].start = r8a66597_usb_host_resources[1].end = ilsel_enable(ILSEL_USBH_I); @@ -254,8 +241,12 @@ static int __init x3proto_devices_setup(void) smc91x_resources[1].start = smc91x_resources[1].end = ilsel_enable(ILSEL_LAN); - return platform_add_devices(x3proto_devices, - ARRAY_SIZE(x3proto_devices)); + ret = platform_add_devices(x3proto_devices, ARRAY_SIZE(x3proto_devices)); + if (ret) + return ret; + + pd = platform_device_register_full(&x3proto_gpio_keys_device_info); + return PTR_ERR_OR_ZERO(pd); } device_initcall(x3proto_devices_setup); -- 2.55.0.rc0.799.gd6f94ed593-goog ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/2] sh: mach-x3proto: convert gpio-keys to software nodes 2026-07-05 5:04 [PATCH 0/2] sh: mach-x3proto: convert gpio-keys to software nodes Dmitry Torokhov 2026-07-05 5:04 ` [PATCH 1/2] sh: mach-x3proto: add software node for GPIO controller Dmitry Torokhov 2026-07-05 5:04 ` [PATCH 2/2] sh: mach-x3proto: convert gpio-keys to software nodes Dmitry Torokhov @ 2026-07-06 9:47 ` Bartosz Golaszewski 2026-07-10 18:50 ` Linus Walleij 2026-09-09 17:00 ` Dmitry Torokhov 4 siblings, 0 replies; 8+ messages in thread From: Bartosz Golaszewski @ 2026-07-06 9:47 UTC (permalink / raw) To: Dmitry Torokhov Cc: Linus Walleij, Bartosz Golaszewski, Arnd Bergmann, linux-sh, linux-kernel, Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz On Sun, 5 Jul 2026 07:04:36 +0200, Dmitry Torokhov <dmitry.torokhov@gmail.com> said: > This series converts the legacy gpio-keys platform device on the SH-X3 > Prototype board to use software nodes and static properties. > > This is part of the ongoing effort to remove platform data support > from the gpio-keys driver, allowing it to rely purely on generic > device properties. > > The first patch adds the software node to the GPIO controller, and > the second patch performs the conversion for the gpio-keys device. > > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> > --- > Dmitry Torokhov (2): > sh: mach-x3proto: add software node for GPIO controller > sh: mach-x3proto: convert gpio-keys to software nodes > > arch/sh/boards/mach-x3proto/gpio.c | 15 ++- > arch/sh/boards/mach-x3proto/setup.c | 165 +++++++++++++-------------- > arch/sh/include/mach-x3proto/mach/hardware.h | 2 + > 3 files changed, 94 insertions(+), 88 deletions(-) > --- > base-commit: 3d5670d672ae08b8c534b7beed6f57c8b44e7b43 > change-id: 20260627-sh-x3proto-swnode-3feadf472a92 > > Thanks. > > -- > Dmitry > > Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/2] sh: mach-x3proto: convert gpio-keys to software nodes 2026-07-05 5:04 [PATCH 0/2] sh: mach-x3proto: convert gpio-keys to software nodes Dmitry Torokhov ` (2 preceding siblings ...) 2026-07-06 9:47 ` [PATCH 0/2] " Bartosz Golaszewski @ 2026-07-10 18:50 ` Linus Walleij 2026-09-09 17:00 ` Dmitry Torokhov 4 siblings, 0 replies; 8+ messages in thread From: Linus Walleij @ 2026-07-10 18:50 UTC (permalink / raw) To: Dmitry Torokhov Cc: Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz, Bartosz Golaszewski, Arnd Bergmann, linux-sh, linux-kernel On Sun, Jul 5, 2026 at 7:04 AM Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote: > This series converts the legacy gpio-keys platform device on the SH-X3 > Prototype board to use software nodes and static properties. > > This is part of the ongoing effort to remove platform data support > from the gpio-keys driver, allowing it to rely purely on generic > device properties. > > The first patch adds the software node to the GPIO controller, and > the second patch performs the conversion for the gpio-keys device. > > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Wow putting the AI to good use here! Reviewed-by: Linus Walleij <linusw@kernel.org> Yours, Linus Walleij ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/2] sh: mach-x3proto: convert gpio-keys to software nodes 2026-07-05 5:04 [PATCH 0/2] sh: mach-x3proto: convert gpio-keys to software nodes Dmitry Torokhov ` (3 preceding siblings ...) 2026-07-10 18:50 ` Linus Walleij @ 2026-09-09 17:00 ` Dmitry Torokhov 2026-09-09 18:06 ` John Paul Adrian Glaubitz 4 siblings, 1 reply; 8+ messages in thread From: Dmitry Torokhov @ 2026-09-09 17:00 UTC (permalink / raw) To: John Paul Adrian Glaubitz Cc: Linus Walleij, Bartosz Golaszewski, Arnd Bergmann, linux-sh, linux-kernel, Yoshinori Sato, Rich Felker On Sat, Jul 04, 2026 at 10:04:36PM -0700, Dmitry Torokhov wrote: > This series converts the legacy gpio-keys platform device on the SH-X3 > Prototype board to use software nodes and static properties. > > This is part of the ongoing effort to remove platform data support > from the gpio-keys driver, allowing it to rely purely on generic > device properties. > > The first patch adds the software node to the GPIO controller, and > the second patch performs the conversion for the gpio-keys device. > > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Hi John, Could this be applied please or maybe you want me to make some changes? Thanks. -- Dmitry ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/2] sh: mach-x3proto: convert gpio-keys to software nodes 2026-09-09 17:00 ` Dmitry Torokhov @ 2026-09-09 18:06 ` John Paul Adrian Glaubitz 2026-09-12 11:14 ` John Paul Adrian Glaubitz 0 siblings, 1 reply; 8+ messages in thread From: John Paul Adrian Glaubitz @ 2026-09-09 18:06 UTC (permalink / raw) To: Dmitry Torokhov Cc: Linus Walleij, Bartosz Golaszewski, Arnd Bergmann, linux-sh, linux-kernel, Yoshinori Sato, Rich Felker Hi Dmitry, On Wed, 2026-09-09 at 10:00 -0700, Dmitry Torokhov wrote: > On Sat, Jul 04, 2026 at 10:04:36PM -0700, Dmitry Torokhov wrote: > > This series converts the legacy gpio-keys platform device on the SH-X3 > > Prototype board to use software nodes and static properties. > > > > This is part of the ongoing effort to remove platform data support > > from the gpio-keys driver, allowing it to rely purely on generic > > device properties. > > > > The first patch adds the software node to the GPIO controller, and > > the second patch performs the conversion for the gpio-keys device. > > > > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> > > Hi John, > > Could this be applied please or maybe you want me to make some changes? I have reserved the upcoming Saturday for kernel review now. If I find anything, I'll let you know. Adrian -- .''`. John Paul Adrian Glaubitz : :' : Debian Developer `. `' Physicist `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/2] sh: mach-x3proto: convert gpio-keys to software nodes 2026-09-09 18:06 ` John Paul Adrian Glaubitz @ 2026-09-12 11:14 ` John Paul Adrian Glaubitz 0 siblings, 0 replies; 8+ messages in thread From: John Paul Adrian Glaubitz @ 2026-09-12 11:14 UTC (permalink / raw) To: Dmitry Torokhov Cc: Linus Walleij, Bartosz Golaszewski, Arnd Bergmann, linux-sh, linux-kernel, Yoshinori Sato, Rich Felker On Wed, 2026-09-09 at 20:06 +0200, John Paul Adrian Glaubitz wrote: > Hi Dmitry, > > On Wed, 2026-09-09 at 10:00 -0700, Dmitry Torokhov wrote: > > On Sat, Jul 04, 2026 at 10:04:36PM -0700, Dmitry Torokhov wrote: > > > This series converts the legacy gpio-keys platform device on the SH-X3 > > > Prototype board to use software nodes and static properties. > > > > > > This is part of the ongoing effort to remove platform data support > > > from the gpio-keys driver, allowing it to rely purely on generic > > > device properties. > > > > > > The first patch adds the software node to the GPIO controller, and > > > the second patch performs the conversion for the gpio-keys device. > > > > > > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> > > > > Hi John, > > > > Could this be applied please or maybe you want me to make some changes? > > I have reserved the upcoming Saturday for kernel review now. Correction: I will do that tomorrow (Sunday) as I got an appointment on a short notice. Adrian -- .''`. John Paul Adrian Glaubitz : :' : Debian Developer `. `' Physicist `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913 ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-09-12 11:14 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2026-07-05 5:04 [PATCH 0/2] sh: mach-x3proto: convert gpio-keys to software nodes Dmitry Torokhov 2026-07-05 5:04 ` [PATCH 1/2] sh: mach-x3proto: add software node for GPIO controller Dmitry Torokhov 2026-07-05 5:04 ` [PATCH 2/2] sh: mach-x3proto: convert gpio-keys to software nodes Dmitry Torokhov 2026-07-06 9:47 ` [PATCH 0/2] " Bartosz Golaszewski 2026-07-10 18:50 ` Linus Walleij 2026-09-09 17:00 ` Dmitry Torokhov 2026-09-09 18:06 ` John Paul Adrian Glaubitz 2026-09-12 11:14 ` John Paul Adrian Glaubitz
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®