Skip to content

Commit 73acd2e

Browse files
linuswgclement
authored andcommitted
ARM: orion5x: Convert Net2big board to GPIO descriptors for LEDs
This makes the LEDs on the Net2big Orion5x board use GPIO descriptors instead of hardcoded GPIOs from the global numberspace. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
1 parent 948d1a9 commit 73acd2e

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

arch/arm/mach-orion5x/net2big-setup.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/i2c.h>
1919
#include <linux/ata_platform.h>
2020
#include <linux/gpio.h>
21+
#include <linux/gpio/machine.h>
2122
#include <linux/delay.h>
2223
#include <asm/mach-types.h>
2324
#include <asm/mach/arch.h>
@@ -214,19 +215,30 @@ static void __init net2big_sata_power_init(void)
214215
static struct gpio_led net2big_leds[] = {
215216
{
216217
.name = "net2big:red:power",
217-
.gpio = NET2BIG_GPIO_PWR_RED_LED,
218218
},
219219
{
220220
.name = "net2big:blue:power",
221-
.gpio = NET2BIG_GPIO_PWR_BLUE_LED,
222221
},
223222
{
224223
.name = "net2big:red:sata0",
225-
.gpio = NET2BIG_GPIO_SATA0_RED_LED,
226224
},
227225
{
228226
.name = "net2big:red:sata1",
229-
.gpio = NET2BIG_GPIO_SATA1_RED_LED,
227+
},
228+
};
229+
230+
static struct gpiod_lookup_table net2big_leds_gpio_table = {
231+
.dev_id = "leds-gpio",
232+
.table = {
233+
GPIO_LOOKUP_IDX("orion_gpio0", NET2BIG_GPIO_PWR_RED_LED, NULL,
234+
0, GPIO_ACTIVE_HIGH),
235+
GPIO_LOOKUP_IDX("orion_gpio0", NET2BIG_GPIO_PWR_BLUE_LED, NULL,
236+
1, GPIO_ACTIVE_HIGH),
237+
GPIO_LOOKUP_IDX("orion_gpio0", NET2BIG_GPIO_SATA0_RED_LED, NULL,
238+
2, GPIO_ACTIVE_HIGH),
239+
GPIO_LOOKUP_IDX("orion_gpio0", NET2BIG_GPIO_SATA1_RED_LED, NULL,
240+
3, GPIO_ACTIVE_HIGH),
241+
{ },
230242
},
231243
};
232244

@@ -282,6 +294,7 @@ static void __init net2big_gpio_leds_init(void)
282294
if (err)
283295
pr_err("net2big: failed to setup SATA1 blue LED GPIO\n");
284296

297+
gpiod_add_lookup_table(&net2big_leds_gpio_table);
285298
platform_device_register(&net2big_gpio_leds);
286299
}
287300

0 commit comments

Comments
 (0)