From 7b3b8146d3fcd4f324f3a688e95038e47f24f84c Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Wed, 1 Jul 2026 12:11:39 +0200 Subject: [PATCH] MIPS: TXX9: rbtx4927: Use GPIO lookup table for TXx9 LEDs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Convert TXx9 LED description from legacy GPIO numbers to GPIO descriptors using a GPIO lookup table. Signed-off-by: Geert Uytterhoeven Reviewed-by: Bartosz Golaszewski Reviewed-by: Linus Walleij Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Thomas Bogendoerfer --- arch/mips/txx9/rbtx4927/setup.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/arch/mips/txx9/rbtx4927/setup.c b/arch/mips/txx9/rbtx4927/setup.c index e57c409c318c..75674b4cc91d 100644 --- a/arch/mips/txx9/rbtx4927/setup.c +++ b/arch/mips/txx9/rbtx4927/setup.c @@ -327,11 +327,19 @@ static void __init rbtx4927_mtd_init(void) tx4927_mtd_init(i); } +static struct gpiod_lookup_table rbtx4927_gpioled_table = { + .table = { + GPIO_LOOKUP_IDX("TXx9", 0, NULL, 0, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("TXx9", 1, NULL, 1, GPIO_ACTIVE_LOW), + { }, + }, +}; + static void __init rbtx4927_gpioled_init(void) { static const struct gpio_led leds[] = { - { .name = "gpioled:green:0", .gpio = 0, .active_low = 1, }, - { .name = "gpioled:green:1", .gpio = 1, .active_low = 1, }, + { .name = "gpioled:green:0", }, + { .name = "gpioled:green:1", }, }; static struct gpio_led_platform_data pdata = { .num_leds = ARRAY_SIZE(leds), @@ -342,8 +350,13 @@ static void __init rbtx4927_gpioled_init(void) if (!pdev) return; pdev->dev.platform_data = &pdata; - if (platform_device_add(pdev)) + if (platform_device_add(pdev)) { platform_device_put(pdev); + return; + } + + rbtx4927_gpioled_table.dev_id = dev_name(&pdev->dev); + gpiod_add_lookup_table(&rbtx4927_gpioled_table); } static void __init rbtx4927_device_init(void)