diff mbox series

ARM: OMAP1: Move h2 LEDs to GPIO lookup table

Message ID 20220830210820.396517-1-linus.walleij@linaro.org (mailing list archive)
State New, archived
Headers show
Series ARM: OMAP1: Move h2 LEDs to GPIO lookup table | expand

Commit Message

Linus Walleij Aug. 30, 2022, 9:08 p.m. UTC
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 mbox series

Patch

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);