OMAP3: RX-51: support sleep indicator LEDs
authorKevin Hilman <khilman@deeprootsystems.com>
Fri, 2 Oct 2009 15:17:56 +0000 (08:17 -0700)
committerKevin Hilman <khilman@deeprootsystems.com>
Tue, 23 Feb 2010 19:05:04 +0000 (11:05 -0800)
The sleep indicator LEDs can be enabled/disabled by toggling GPIO162.
Use the LED GPIO class to export this LED functionality to userspace.

To enable:

  # echo 1 > /sys/class/leds/sleep_ind/brightness

To disable:

  # echo 0 > /sys/class/leds/sleep_ind/brightness

Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
arch/arm/mach-omap2/board-rx51.c

index 6a49f916103da9d0dc23741293334ebfc8a5df76..26b70dab28ccaac4c93a804f60dfb6ebe444a52b 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/gpio.h>
+#include <linux/leds.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
 
 #include "mux.h"
 
+#define RX51_GPIO_SLEEP_IND 162
+
 struct omap_sdrc_params *rx51_get_sdram_timings(void);
 
+static struct gpio_led gpio_leds[] = {
+       {
+               .name   = "sleep_ind",
+               .gpio   = RX51_GPIO_SLEEP_IND,
+       },
+};
+
+static struct gpio_led_platform_data gpio_led_info = {
+       .leds           = gpio_leds,
+       .num_leds       = ARRAY_SIZE(gpio_leds),
+};
+
+static struct platform_device leds_gpio = {
+       .name   = "leds-gpio",
+       .id     = -1,
+       .dev    = {
+               .platform_data  = &gpio_led_info,
+       },
+};
+
 static struct omap_lcd_config rx51_lcd_config = {
        .ctrl_name      = "internal",
 };
@@ -88,6 +111,8 @@ static void __init rx51_init(void)
        /* Ensure SDRC pins are mux'd for self-refresh */
        omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
        omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
+
+       platform_device_register(&leds_gpio);
 }
 
 static void __init rx51_map_io(void)