Skip to content

Commit 79f46f6

Browse files
Linus Walleijgclement
authored andcommitted
ARM: orion5x: Convert D2Net board to GPIO descriptors for LEDs
This makes the LEDs on the D2Net Orion5x board use GPIO descriptors instead of hardcoded GPIOs from the global numberspace. Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Gregory CLEMENT <[email protected]>
1 parent 4cece76 commit 79f46f6

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

arch/arm/mach-orion5x/board-d2net.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/irq.h>
1515
#include <linux/leds.h>
1616
#include <linux/gpio.h>
17+
#include <linux/gpio/machine.h>
1718
#include <asm/mach-types.h>
1819
#include <asm/mach/arch.h>
1920
#include <asm/mach/pci.h>
@@ -55,12 +56,9 @@ static struct gpio_led d2net_leds[] = {
5556
{
5657
.name = "d2net:blue:sata",
5758
.default_trigger = "default-on",
58-
.gpio = D2NET_GPIO_BLUE_LED_OFF,
59-
.active_low = 1,
6059
},
6160
{
6261
.name = "d2net:red:fail",
63-
.gpio = D2NET_GPIO_RED_LED,
6462
},
6563
};
6664

@@ -77,6 +75,17 @@ static struct platform_device d2net_gpio_leds = {
7775
},
7876
};
7977

78+
static struct gpiod_lookup_table d2net_leds_gpio_table = {
79+
.dev_id = "leds-gpio",
80+
.table = {
81+
GPIO_LOOKUP_IDX("orion_gpio0", D2NET_GPIO_BLUE_LED_OFF, NULL,
82+
0, GPIO_ACTIVE_LOW),
83+
GPIO_LOOKUP_IDX("orion_gpio0", D2NET_GPIO_RED_LED, NULL,
84+
1, GPIO_ACTIVE_HIGH),
85+
{ },
86+
},
87+
};
88+
8089
static void __init d2net_gpio_leds_init(void)
8190
{
8291
int err;
@@ -91,6 +100,7 @@ static void __init d2net_gpio_leds_init(void)
91100
if (err)
92101
pr_err("d2net: failed to configure blue LED blink GPIO\n");
93102

103+
gpiod_add_lookup_table(&d2net_leds_gpio_table);
94104
platform_device_register(&d2net_gpio_leds);
95105
}
96106

0 commit comments

Comments
 (0)