From: Martin Michlmayr Date: Mon, 7 Jul 2008 18:23:09 +0000 (+0300) Subject: [ARM] Orion: LED support for HP mv2120 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=2e1117d307dba8185a72bac94e57f057e70590ca;p=mv-sheeva.git [ARM] Orion: LED support for HP mv2120 The HP mv2120 has several LEDs that are controlled through gpio. Export the health LED, the red SATA LEDs as well as two gpios that control the brightness of _all_ LEDs to userland. The Ethernet and power LEDs can't be controlled through gpio and the blue SATA LEDs are handled via the SATA driver. Signed-off-by: Martin Michlmayr Signed-off-by: Nicolas Pitre --- diff --git a/arch/arm/configs/orion5x_defconfig b/arch/arm/configs/orion5x_defconfig index 8a7cabfae57..9578b5d9f9c 100644 --- a/arch/arm/configs/orion5x_defconfig +++ b/arch/arm/configs/orion5x_defconfig @@ -1077,7 +1077,7 @@ CONFIG_LEDS_CLASS=y # # LED drivers # -# CONFIG_LEDS_GPIO is not set +CONFIG_LEDS_GPIO=y # # LED Triggers @@ -1085,7 +1085,7 @@ CONFIG_LEDS_CLASS=y CONFIG_LEDS_TRIGGERS=y CONFIG_LEDS_TRIGGER_TIMER=y CONFIG_LEDS_TRIGGER_HEARTBEAT=y -# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set +CONFIG_LEDS_TRIGGER_DEFAULT_ON=y CONFIG_RTC_LIB=y CONFIG_RTC_CLASS=y CONFIG_RTC_HCTOSYS=y diff --git a/arch/arm/mach-orion5x/mv2120-setup.c b/arch/arm/mach-orion5x/mv2120-setup.c index f1dcad36b13..55f3b0fdef8 100644 --- a/arch/arm/mach-orion5x/mv2120-setup.c +++ b/arch/arm/mach-orion5x/mv2120-setup.c @@ -137,6 +137,50 @@ static struct i2c_board_info __initdata mv2120_i2c_rtc = { .irq = 0, }; +static struct gpio_led mv2120_led_pins[] = { + { + .name = "mv2120:blue:health", + .gpio = 0, + }, + { + .name = "mv2120:red:health", + .gpio = 1, + }, + { + .name = "mv2120:led:bright", + .gpio = 4, + .default_trigger = "default-on", + }, + { + .name = "mv2120:led:dimmed", + .gpio = 5, + }, + { + .name = "mv2120:red:sata0", + .gpio = 8, + .active_low = 1, + }, + { + .name = "mv2120:red:sata1", + .gpio = 9, + .active_low = 1, + }, + +}; + +static struct gpio_led_platform_data mv2120_led_data = { + .leds = mv2120_led_pins, + .num_leds = ARRAY_SIZE(mv2120_led_pins), +}; + +static struct platform_device mv2120_leds = { + .name = "leds-gpio", + .id = -1, + .dev = { + .platform_data = &mv2120_led_data, + } +}; + static void mv2120_power_off(void) { pr_info("%s: triggering power-off...\n", __func__); @@ -172,6 +216,7 @@ static void __init mv2120_init(void) gpio_free(MV2120_GPIO_RTC_IRQ); } i2c_register_board_info(0, &mv2120_i2c_rtc, 1); + platform_device_register(&mv2120_leds); /* register mv2120 specific power-off method */ if (gpio_request(MV2120_GPIO_POWER_OFF, "POWEROFF") != 0 ||