From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Lee Jones <lee@kernel.org>, Krzysztof Kozlowski <krzk@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>,
Charles Keepax <ckeepax@opensource.cirrus.com>,
Linus Walleij <linusw@kernel.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Arnd Bergmann <arnd@arndb.de>
Cc: mfd@lists.linux.dev, linux-samsung-soc@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
patches@opensource.cirrus.com, linux-kernel@vger.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Subject: [PATCH v4 3/4] ARM: s3c: crag6410: convert basic-mmio-gpio and LEDs to software properties
Date: Sat, 24 Oct 2026 22:03:14 -0700 [thread overview]
Message-ID: <20261024-samsung-kp-v4-3-e21253295e68@gmail.com> (raw)
In-Reply-To: <20261024-samsung-kp-v4-0-e21253295e68@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.
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
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 d0ec7697f366..2855d6d32fa3 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 = {
@@ -835,61 +840,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 struct gpiod_lookup_table crag_spi0_gpiod_table = {
@@ -939,12 +951,11 @@ 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();
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.56.0.257.gf7497c7d27-goog
next prev parent reply other threads:[~2026-10-25 5:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-25 5:03 [PATCH v4 0/4] ARM: s3c: crag6410: Convert to software nodes and properties Dmitry Torokhov
2026-10-25 5:03 ` [PATCH v4 1/4] mfd: wm831x: Support software nodes for DCDC regulators Dmitry Torokhov
2026-10-26 10:15 ` Charles Keepax
2026-10-28 9:38 ` Bartosz Golaszewski
2026-10-25 5:03 ` [PATCH v4 2/4] ARM: s3c: crag6410: convert PMIC DVS GPIO to software properties Dmitry Torokhov
2026-10-28 9:38 ` Bartosz Golaszewski
2026-10-25 5:03 ` Dmitry Torokhov [this message]
2026-10-25 5:03 ` [PATCH v4 4/4] ARM: s3c: crag6410: convert WM1250 and SPI0 GPIO lookup tables to property entries Dmitry Torokhov
2026-10-26 13:51 ` [PATCH v4 0/4] ARM: s3c: crag6410: Convert to software nodes and properties Arnd Bergmann
2026-10-27 1:07 ` Dmitry Torokhov
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=20261024-samsung-kp-v4-3-e21253295e68@gmail.com \
--to=dmitry.torokhov@gmail.com \
--cc=alim.akhtar@samsung.com \
--cc=arnd@arndb.de \
--cc=bartosz.golaszewski@oss.qualcomm.com \
--cc=brgl@bgdev.pl \
--cc=broonie@kernel.org \
--cc=ckeepax@opensource.cirrus.com \
--cc=krzk@kernel.org \
--cc=lee@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mfd@lists.linux.dev \
--cc=patches@opensource.cirrus.com \
--cc=peter.griffin@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.