Commit 79f46f68 authored by Linus Walleij's avatar Linus Walleij Committed by Gregory CLEMENT

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: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarGregory CLEMENT <gregory.clement@bootlin.com>
parent 4cece764
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/leds.h> #include <linux/leds.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/gpio/machine.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/pci.h> #include <asm/mach/pci.h>
...@@ -55,12 +56,9 @@ static struct gpio_led d2net_leds[] = { ...@@ -55,12 +56,9 @@ static struct gpio_led d2net_leds[] = {
{ {
.name = "d2net:blue:sata", .name = "d2net:blue:sata",
.default_trigger = "default-on", .default_trigger = "default-on",
.gpio = D2NET_GPIO_BLUE_LED_OFF,
.active_low = 1,
}, },
{ {
.name = "d2net:red:fail", .name = "d2net:red:fail",
.gpio = D2NET_GPIO_RED_LED,
}, },
}; };
...@@ -77,6 +75,17 @@ static struct platform_device d2net_gpio_leds = { ...@@ -77,6 +75,17 @@ static struct platform_device d2net_gpio_leds = {
}, },
}; };
static struct gpiod_lookup_table d2net_leds_gpio_table = {
.dev_id = "leds-gpio",
.table = {
GPIO_LOOKUP_IDX("orion_gpio0", D2NET_GPIO_BLUE_LED_OFF, NULL,
0, GPIO_ACTIVE_LOW),
GPIO_LOOKUP_IDX("orion_gpio0", D2NET_GPIO_RED_LED, NULL,
1, GPIO_ACTIVE_HIGH),
{ },
},
};
static void __init d2net_gpio_leds_init(void) static void __init d2net_gpio_leds_init(void)
{ {
int err; int err;
...@@ -91,6 +100,7 @@ static void __init d2net_gpio_leds_init(void) ...@@ -91,6 +100,7 @@ static void __init d2net_gpio_leds_init(void)
if (err) if (err)
pr_err("d2net: failed to configure blue LED blink GPIO\n"); pr_err("d2net: failed to configure blue LED blink GPIO\n");
gpiod_add_lookup_table(&d2net_leds_gpio_table);
platform_device_register(&d2net_gpio_leds); platform_device_register(&d2net_gpio_leds);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment