From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Peter Griffin <peter.griffin@linaro.org>,
Alim Akhtar <alim.akhtar@samsung.com>,
Russell King <linux@armlinux.org.uk>,
Mark Brown <broonie@kernel.org>,
Linus Walleij <linusw@kernel.org>,
Charles Keepax <ckeepax@opensource.cirrus.com>,
Sam Protsenko <semen.protsenko@linaro.org>,
Arnd Bergmann <arnd@arndb.de>,
Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Krzysztof Kozlowski <krzk@kernel.org>,
linux-input@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org,
patches@opensource.cirrus.com
Subject: [PATCH v2 11/11] ARM: s3c: crag6410: convert basic-mmio-gpio and LEDs to software properties
Date: Wed, 08 Jul 2026 21:53:09 -0700 [thread overview]
Message-ID: <20260708-samsung-kp-v2-11-3c6ed4c9b3b6@gmail.com> (raw)
In-Reply-To: <20260708-samsung-kp-v2-0-3c6ed4c9b3b6@gmail.com>
Convert the basic-mmio-gpio device and the GPIO-controlled LEDs on the
Cragganmore 6410 board to use software nodes/properties. This allows
removing the crag_leds_table GPIO lookup table.
Assisted-by: Antigravity:gemini-3.5-flash
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
arch/arm/mach-s3c/mach-crag6410.c | 117 +++++++++++++++++++++-----------------
1 file changed, 64 insertions(+), 53 deletions(-)
diff --git a/arch/arm/mach-s3c/mach-crag6410.c b/arch/arm/mach-s3c/mach-crag6410.c
index 03a97a20e38c..b48980920aee 100644
--- a/arch/arm/mach-s3c/mach-crag6410.c
+++ b/arch/arm/mach-s3c/mach-crag6410.c
@@ -319,12 +319,17 @@ static const struct property_entry crag6410_mmgpio_props[] = {
{ }
};
+static const struct software_node crag6410_mmgpio_node = {
+ .name = "basic-mmio-gpio",
+ .properties = crag6410_mmgpio_props,
+};
+
static struct platform_device_info crag6410_mmgpio_devinfo = {
.name = "basic-mmio-gpio",
.id = -1,
.res = crag6410_mmgpio_resource,
.num_res = ARRAY_SIZE(crag6410_mmgpio_resource),
- .properties = crag6410_mmgpio_props,
+ .swnode = &crag6410_mmgpio_node,
};
static struct platform_device speyside_device = {
@@ -839,61 +844,68 @@ static struct s3c_sdhci_platdata crag6410_hsmmc0_pdata = {
.host_caps = MMC_CAP_POWER_OFF_CARD,
};
-static const struct gpio_led gpio_leds[] = {
- {
- .name = "d13:green:",
- .default_state = LEDS_GPIO_DEFSTATE_ON,
- },
- {
- .name = "d14:green:",
- .default_state = LEDS_GPIO_DEFSTATE_ON,
- },
- {
- .name = "d15:green:",
- .default_state = LEDS_GPIO_DEFSTATE_ON,
- },
- {
- .name = "d16:green:",
- .default_state = LEDS_GPIO_DEFSTATE_ON,
- },
- {
- .name = "d17:green:",
- .default_state = LEDS_GPIO_DEFSTATE_ON,
- },
- {
- .name = "d18:green:",
- .default_state = LEDS_GPIO_DEFSTATE_ON,
- },
- {
- .name = "d19:green:",
- .default_state = LEDS_GPIO_DEFSTATE_ON,
- },
- {
- .name = "d20:green:",
- .default_state = LEDS_GPIO_DEFSTATE_ON,
- },
+static const struct software_node crag6410_leds_node = {
+ .name = "leds-gpio",
};
-static struct gpiod_lookup_table crag_leds_table = {
- .dev_id = "leds-gpio",
- .table = {
- GPIO_LOOKUP_IDX("basic-mmio-gpio", 0, "cs", 0, GPIO_ACTIVE_LOW),
- GPIO_LOOKUP_IDX("basic-mmio-gpio", 1, "cs", 1, GPIO_ACTIVE_LOW),
- GPIO_LOOKUP_IDX("basic-mmio-gpio", 2, "cs", 2, GPIO_ACTIVE_LOW),
- GPIO_LOOKUP_IDX("basic-mmio-gpio", 3, "cs", 3, GPIO_ACTIVE_LOW),
- GPIO_LOOKUP_IDX("basic-mmio-gpio", 4, "cs", 4, GPIO_ACTIVE_LOW),
- GPIO_LOOKUP_IDX("basic-mmio-gpio", 5, "cs", 5, GPIO_ACTIVE_LOW),
- GPIO_LOOKUP_IDX("basic-mmio-gpio", 6, "cs", 6, GPIO_ACTIVE_LOW),
- GPIO_LOOKUP_IDX("basic-mmio-gpio", 7, "cs", 7, GPIO_ACTIVE_LOW),
- { },
- },
-};
+#define CRAG6410_LED_NODE(_idx, _name) \
+static const struct property_entry crag6410_led##_idx##_props[] = { \
+ PROPERTY_ENTRY_STRING("label", _name), \
+ PROPERTY_ENTRY_GPIO("gpios", &crag6410_mmgpio_node, \
+ _idx, GPIO_ACTIVE_LOW), \
+ PROPERTY_ENTRY_STRING("default-state", "on"), \
+ { } \
+}; \
+static const struct software_node crag6410_led##_idx##_node = { \
+ .parent = &crag6410_leds_node, \
+ .properties = crag6410_led##_idx##_props, \
+}
-static const struct gpio_led_platform_data gpio_leds_pdata = {
- .leds = gpio_leds,
- .num_leds = ARRAY_SIZE(gpio_leds),
+CRAG6410_LED_NODE(0, "d13:green:");
+CRAG6410_LED_NODE(1, "d14:green:");
+CRAG6410_LED_NODE(2, "d15:green:");
+CRAG6410_LED_NODE(3, "d16:green:");
+CRAG6410_LED_NODE(4, "d17:green:");
+CRAG6410_LED_NODE(5, "d18:green:");
+CRAG6410_LED_NODE(6, "d19:green:");
+CRAG6410_LED_NODE(7, "d20:green:");
+
+static const struct software_node *crag6410_leds_swnodes[] = {
+ &crag6410_leds_node,
+ &crag6410_led0_node,
+ &crag6410_led1_node,
+ &crag6410_led2_node,
+ &crag6410_led3_node,
+ &crag6410_led4_node,
+ &crag6410_led5_node,
+ &crag6410_led6_node,
+ &crag6410_led7_node,
+ NULL
};
+static void __init crag6410_setup_leds(void)
+{
+ struct platform_device_info leds_info = {
+ .name = "leds-gpio",
+ .id = PLATFORM_DEVID_NONE,
+ };
+ struct platform_device *pd;
+ int err;
+
+ err = software_node_register_node_group(crag6410_leds_swnodes);
+ if (err) {
+ pr_err("failed to register leds software nodes: %d\n", err);
+ return;
+ }
+
+ leds_info.fwnode = software_node_fwnode(&crag6410_leds_node);
+
+ pd = platform_device_register_full(&leds_info);
+ err = PTR_ERR_OR_ZERO(pd);
+ if (err)
+ pr_err("failed to create leds-gpio device: %d\n", err);
+}
+
static struct dwc2_hsotg_plat crag6410_hsotg_pdata;
static const struct software_node_ref_args crag6410_spi0_gpio_refs[] = {
@@ -972,13 +984,12 @@ static void __init crag6410_machine_init(void)
platform_add_devices(crag6410_devs0, ARRAY_SIZE(crag6410_devs0));
platform_device_register_full(&crag6410_mmgpio_devinfo);
- gpiod_add_lookup_table(&crag_leds_table);
crag6410_setup_keypad();
crag6410_setup_gpio_keys();
crag6410_setup_spi0();
platform_add_devices(crag6410_devs1, ARRAY_SIZE(crag6410_devs1));
- gpio_led_register_device(-1, &gpio_leds_pdata);
+ crag6410_setup_leds();
regulator_has_full_constraints();
--
2.55.0.795.g602f6c329a-goog
next prev parent reply other threads:[~2026-07-09 4:53 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 4:52 [PATCH v2 00/11] Remove support for platform data from samsung keypad Dmitry Torokhov
2026-07-09 4:52 ` [PATCH v2 01/11] dt-bindings: input: samsung,s3c6410-keypad: introduce compact binding Dmitry Torokhov
2026-07-09 17:56 ` Conor Dooley
2026-07-09 4:53 ` [PATCH v2 02/11] Input: samsung-keypad - handle " Dmitry Torokhov
2026-07-09 4:53 ` [PATCH v2 03/11] ARM: s3c: register and attach software nodes for Samsung gpio_chips Dmitry Torokhov
2026-07-09 4:53 ` [PATCH v2 04/11] ARM: s3c: crag6410: switch keypad device to software properties Dmitry Torokhov
2026-07-09 4:53 ` [PATCH v2 05/11] Input: samsung-keypad - remove support for platform data Dmitry Torokhov
2026-07-09 4:53 ` [PATCH v2 06/11] ARM: s3c: crag6410: use software nodes/properties to set up GPIO keys Dmitry Torokhov
2026-07-09 4:53 ` [PATCH v2 07/11] regulator: wm831x: support software node in platform data Dmitry Torokhov
2026-07-09 4:53 ` [PATCH v2 08/11] ARM: s3c: crag6410: convert PMIC to software properties Dmitry Torokhov
2026-07-09 4:53 ` [PATCH v2 09/11] regulator: wm831x: remove legacy DVS platform data Dmitry Torokhov
2026-07-09 4:53 ` [PATCH v2 10/11] ARM: s3c: crag6410: convert remaining GPIO lookup tables to property entries Dmitry Torokhov
2026-07-09 4:53 ` Dmitry Torokhov [this message]
2026-07-09 8:10 ` [PATCH v2 00/11] Remove support for platform data from samsung keypad Bartosz Golaszewski
2026-07-10 19:41 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260708-samsung-kp-v2-11-3c6ed4c9b3b6@gmail.com \
--to=dmitry.torokhov@gmail.com \
--cc=alim.akhtar@samsung.com \
--cc=arnd@arndb.de \
--cc=brgl@bgdev.pl \
--cc=broonie@kernel.org \
--cc=ckeepax@opensource.cirrus.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=krzk@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=patches@opensource.cirrus.com \
--cc=peter.griffin@linaro.org \
--cc=robh@kernel.org \
--cc=semen.protsenko@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox