Skip to content

Commit 3153eb8

Browse files
Linus Walleijgclement
authored andcommitted
ARM: orion5x: Convert TS409 board to GPIO descriptors for LEDs
This makes the LEDs on the TS409 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 73acd2e commit 3153eb8

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

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

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* Copyright (C) 2008 Martin Michlmayr <[email protected]>
99
*/
1010
#include <linux/gpio.h>
11+
#include <linux/gpio/machine.h>
1112
#include <linux/kernel.h>
1213
#include <linux/init.h>
1314
#include <linux/platform_device.h>
@@ -168,20 +169,27 @@ static struct i2c_board_info __initdata qnap_ts409_i2c_rtc = {
168169
static struct gpio_led ts409_led_pins[] = {
169170
{
170171
.name = "ts409:red:sata1",
171-
.gpio = 4,
172-
.active_low = 1,
173172
}, {
174173
.name = "ts409:red:sata2",
175-
.gpio = 5,
176-
.active_low = 1,
177174
}, {
178175
.name = "ts409:red:sata3",
179-
.gpio = 6,
180-
.active_low = 1,
181176
}, {
182177
.name = "ts409:red:sata4",
183-
.gpio = 7,
184-
.active_low = 1,
178+
},
179+
};
180+
181+
static struct gpiod_lookup_table ts409_leds_gpio_table = {
182+
.dev_id = "leds-gpio",
183+
.table = {
184+
GPIO_LOOKUP_IDX("orion_gpio0", 4, NULL,
185+
0, GPIO_ACTIVE_LOW),
186+
GPIO_LOOKUP_IDX("orion_gpio0", 5, NULL,
187+
1, GPIO_ACTIVE_LOW),
188+
GPIO_LOOKUP_IDX("orion_gpio0", 6, NULL,
189+
2, GPIO_ACTIVE_LOW),
190+
GPIO_LOOKUP_IDX("orion_gpio0", 7, NULL,
191+
3, GPIO_ACTIVE_LOW),
192+
{ },
185193
},
186194
};
187195

@@ -300,6 +308,7 @@ static void __init qnap_ts409_init(void)
300308
if (qnap_ts409_i2c_rtc.irq == 0)
301309
pr_warn("qnap_ts409_init: failed to get RTC IRQ\n");
302310
i2c_register_board_info(0, &qnap_ts409_i2c_rtc, 1);
311+
gpiod_add_lookup_table(&ts409_leds_gpio_table);
303312
platform_device_register(&ts409_leds);
304313

305314
/* register tsx09 specific power-off method */

0 commit comments

Comments
 (0)