All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: OMAP1: Move h2 LEDs to GPIO lookup table
@ 2022-08-30 21:08 Linus Walleij
  0 siblings, 0 replies; only message in thread
From: Linus Walleij @ 2022-08-30 21:08 UTC (permalink / raw)
  To: Aaro Koskinen, Janusz Krzysztofik, Tony Lindgren
  Cc: linux-omap, Linus Walleij, Maciej Falkowski

This converts the the H2 GPIO LEDs to use a machine lookup
table.

Cc: Tony Lindgren <tony@atomide.com>
Cc: Maciej Falkowski <maciej.falkowski9@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 arch/arm/mach-omap1/board-h2.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index f28a4c3ea501..9301a5fca44e 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -47,6 +47,7 @@
 
 /* The first 16 SoC GPIO lines are on this GPIO chip */
 #define OMAP_GPIO_LABEL			"gpio-0-15"
+#define OMAP_MPUIO_LABEL		"mpuio"
 
 /* At OMAP1610 Innovator the Ethernet is directly connected to CS1 */
 #define OMAP1610_ETHR_START		0x04000300
@@ -276,12 +277,10 @@ static const struct gpio_led h2_gpio_led_pins[] = {
 	{
 		.name		= "h2:red",
 		.default_trigger = "heartbeat",
-		.gpio		= 3,
 	},
 	{
 		.name		= "h2:green",
 		.default_trigger = "cpu0",
-		.gpio		= OMAP_MPUIO(4),
 	},
 };
 
@@ -290,6 +289,14 @@ static struct gpio_led_platform_data h2_gpio_led_data = {
 	.num_leds	= ARRAY_SIZE(h2_gpio_led_pins),
 };
 
+static struct gpiod_lookup_table h2_leds_gpio_table = {
+	.table = {
+		GPIO_LOOKUP_IDX(OMAP_GPIO_LABEL, 3, NULL, 0, 0),
+		GPIO_LOOKUP_IDX(OMAP_MPUIO_LABEL, 4, NULL, 1, 0),
+		{ },
+	},
+};
+
 static struct platform_device h2_gpio_leds = {
 	.name	= "leds-gpio",
 	.id	= -1,
@@ -417,6 +424,7 @@ static void __init h2_init(void)
 	/* GPIO based LEDs */
 	omap_cfg_reg(P18_1610_GPIO3);
 	omap_cfg_reg(MPUIO4);
+	gpiod_add_lookup_table(&h2_leds_gpio_table);
 
 	h2_smc91x_resources[1].start = gpio_to_irq(0);
 	h2_smc91x_resources[1].end = gpio_to_irq(0);
-- 
2.37.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-30 21:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-30 21:08 [PATCH] ARM: OMAP1: Move h2 LEDs to GPIO lookup table Linus Walleij

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.