From a84d39adcf93864aa24deada92305d0f407e42b4 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Wed, 1 Jul 2026 12:11:41 +0200 Subject: [PATCH] MIPS: TXX9: Use GPIO lookup table for iocled LEDs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Convert iocled LED description from legacy GPIO numbers to GPIO descriptors using a GPIO lookup table. For now, just ignore the "lowactive" parameter, and force GPIO_ACTIVE_LOW, as that is what the sole caller wants. 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/generic/setup.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c index 611ccbe429cf..32246f5f78f5 100644 --- a/arch/mips/txx9/generic/setup.c +++ b/arch/mips/txx9/generic/setup.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -615,6 +616,15 @@ static int txx9_iocled_dir_out(struct gpio_chip *chip, unsigned int offset, return 0; } +static struct gpiod_lookup_table txx9_iocled_table = { + .table = { + GPIO_LOOKUP_IDX("iocled", 0, NULL, 0, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("iocled", 1, NULL, 1, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("iocled", 2, NULL, 2, GPIO_ACTIVE_LOW), + { }, + }, +}; + void __init txx9_iocled_init(unsigned long baseaddr, int basenum, unsigned int num, int lowactive, const char *color, char **deftriggers) @@ -659,14 +669,14 @@ void __init txx9_iocled_init(unsigned long baseaddr, snprintf(iocled->names[i], sizeof(iocled->names[i]), "iocled:%s:%u", color, i); led->name = iocled->names[i]; - led->gpio = basenum + i; - led->active_low = lowactive; if (deftriggers && *deftriggers) led->default_trigger = *deftriggers++; } pdev->dev.platform_data = &iocled->pdata; if (platform_device_add(pdev)) goto out_pdev; + txx9_iocled_table.dev_id = dev_name(&pdev->dev); + gpiod_add_lookup_table(&txx9_iocled_table); return; out_pdev: