]> rtime.felk.cvut.cz Git - can-eth-gw-linux.git/blob - arch/arm/mach-omap1/leds.c
7b1a3833165de05a7de5929cf2b96ad58c7c8e93
[can-eth-gw-linux.git] / arch / arm / mach-omap1 / leds.c
1 /*
2  * linux/arch/arm/mach-omap1/leds.c
3  *
4  * OMAP LEDs dispatcher
5  */
6 #include <linux/gpio.h>
7 #include <linux/kernel.h>
8 #include <linux/init.h>
9 #include <linux/platform_data/gpio-omap.h>
10
11 #include <asm/leds.h>
12 #include <asm/mach-types.h>
13
14 #include <plat/mux.h>
15
16 #include "leds.h"
17
18 static int __init
19 omap_leds_init(void)
20 {
21         if (!cpu_class_is_omap1())
22                 return -ENODEV;
23
24         if (machine_is_omap_innovator())
25                 leds_event = innovator_leds_event;
26
27         else if (machine_is_omap_h2()
28                         || machine_is_omap_h3()
29                         || machine_is_omap_perseus2())
30                 leds_event = h2p2_dbg_leds_event;
31
32         else if (machine_is_omap_osk())
33                 leds_event = osk_leds_event;
34
35         else
36                 return -1;
37
38         if (machine_is_omap_h2()
39                         || machine_is_omap_h3()
40 #ifdef  CONFIG_OMAP_OSK_MISTRAL
41                         || machine_is_omap_osk()
42 #endif
43                         ) {
44
45                 /* LED1/LED2 pins can be used as GPIO (as done here), or by
46                  * the LPG (works even in deep sleep!), to drive a bicolor
47                  * LED on the H2 sample board, and another on the H2/P2
48                  * "surfer" expansion board.
49                  *
50                  * The same pins drive a LED on the OSK Mistral board, but
51                  * that's a different kind of LED (just one color at a time).
52                  */
53                 omap_cfg_reg(P18_1610_GPIO3);
54                 if (gpio_request(3, "LED red") == 0)
55                         gpio_direction_output(3, 1);
56                 else
57                         printk(KERN_WARNING "LED: can't get GPIO3/red?\n");
58
59                 omap_cfg_reg(MPUIO4);
60                 if (gpio_request(OMAP_MPUIO(4), "LED green") == 0)
61                         gpio_direction_output(OMAP_MPUIO(4), 1);
62                 else
63                         printk(KERN_WARNING "LED: can't get MPUIO4/green?\n");
64         }
65
66         leds_event(led_start);
67         return 0;
68 }
69
70 __initcall(omap_leds_init);