Skip to content

Commit 948d1a9

Browse files
Linus Walleijgclement
authored andcommitted
ARM: orion5x: Convert MV2120 board to GPIO descriptors for LEDs
This makes the LEDs on the MV2120 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 ef48d08 commit 948d1a9

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

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

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* License, or (at your option) any later version.
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>
@@ -139,34 +140,45 @@ static struct i2c_board_info __initdata mv2120_i2c_rtc = {
139140
static struct gpio_led mv2120_led_pins[] = {
140141
{
141142
.name = "mv2120:blue:health",
142-
.gpio = 0,
143143
},
144144
{
145145
.name = "mv2120:red:health",
146-
.gpio = 1,
147146
},
148147
{
149148
.name = "mv2120:led:bright",
150-
.gpio = 4,
151149
.default_trigger = "default-on",
152150
},
153151
{
154152
.name = "mv2120:led:dimmed",
155-
.gpio = 5,
156153
},
157154
{
158155
.name = "mv2120:red:sata0",
159-
.gpio = 8,
160-
.active_low = 1,
161156
},
162157
{
163158
.name = "mv2120:red:sata1",
164-
.gpio = 9,
165-
.active_low = 1,
166159
},
167160

168161
};
169162

163+
static struct gpiod_lookup_table mv2120_leds_gpio_table = {
164+
.dev_id = "leds-gpio",
165+
.table = {
166+
GPIO_LOOKUP_IDX("orion_gpio0", 0, NULL,
167+
0, GPIO_ACTIVE_HIGH),
168+
GPIO_LOOKUP_IDX("orion_gpio0", 1, NULL,
169+
1, GPIO_ACTIVE_HIGH),
170+
GPIO_LOOKUP_IDX("orion_gpio0", 4, NULL,
171+
2, GPIO_ACTIVE_HIGH),
172+
GPIO_LOOKUP_IDX("orion_gpio0", 5, NULL,
173+
3, GPIO_ACTIVE_HIGH),
174+
GPIO_LOOKUP_IDX("orion_gpio0", 8, NULL,
175+
4, GPIO_ACTIVE_LOW),
176+
GPIO_LOOKUP_IDX("orion_gpio0", 9, NULL,
177+
5, GPIO_ACTIVE_LOW),
178+
{ },
179+
},
180+
};
181+
170182
static struct gpio_led_platform_data mv2120_led_data = {
171183
.leds = mv2120_led_pins,
172184
.num_leds = ARRAY_SIZE(mv2120_led_pins),
@@ -219,6 +231,7 @@ static void __init mv2120_init(void)
219231
gpio_free(MV2120_GPIO_RTC_IRQ);
220232
}
221233
i2c_register_board_info(0, &mv2120_i2c_rtc, 1);
234+
gpiod_add_lookup_table(&mv2120_leds_gpio_table);
222235
platform_device_register(&mv2120_leds);
223236

224237
/* register mv2120 specific power-off method */

0 commit comments

Comments
 (0)