MIPS: TXX9: rbtx4927: Use GPIO lookup table for TXx9 LEDs

Convert TXx9 LED description from legacy GPIO numbers to GPIO
descriptors using a GPIO lookup table.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
This commit is contained in:
Geert Uytterhoeven
2026-07-01 12:11:39 +02:00
committed by Thomas Bogendoerfer
parent 0caeacb116
commit 7b3b8146d3

View File

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