blob: 5c6b1bb6e722deda5bf715e5435498b2846c7228 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Tony Lindgren7c38cf02005-09-08 23:07:38 +01002 * linux/arch/arm/mach-omap1/leds.c
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 *
4 * OMAP LEDs dispatcher
5 */
6#include <linux/kernel.h>
7#include <linux/init.h>
8
9#include <asm/leds.h>
10#include <asm/mach-types.h>
11
12#include <asm/arch/gpio.h>
13#include <asm/arch/mux.h>
14
15#include "leds.h"
16
17static int __init
18omap_leds_init(void)
19{
20 if (machine_is_omap_innovator())
21 leds_event = innovator_leds_event;
22
Tony Lindgren7c38cf02005-09-08 23:07:38 +010023 else if (machine_is_omap_h2()
24 || machine_is_omap_h3()
25 || machine_is_omap_perseus2())
Linus Torvalds1da177e2005-04-16 15:20:36 -070026 leds_event = h2p2_dbg_leds_event;
27
28 else if (machine_is_omap_osk())
29 leds_event = osk_leds_event;
30
31 else
32 return -1;
33
34 if (machine_is_omap_h2()
Tony Lindgren7c38cf02005-09-08 23:07:38 +010035 || machine_is_omap_h3()
Linus Torvalds1da177e2005-04-16 15:20:36 -070036 || machine_is_omap_perseus2()
Tony Lindgren7c38cf02005-09-08 23:07:38 +010037#ifdef CONFIG_OMAP_OSK_MISTRAL
38 || machine_is_omap_osk()
39#endif
40 ) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
42 /* LED1/LED2 pins can be used as GPIO (as done here), or by
43 * the LPG (works even in deep sleep!), to drive a bicolor
44 * LED on the H2 sample board, and another on the H2/P2
45 * "surfer" expansion board.
46 *
47 * The same pins drive a LED on the OSK Mistral board, but
48 * that's a different kind of LED (just one color at a time).
49 */
50 omap_cfg_reg(P18_1610_GPIO3);
51 if (omap_request_gpio(3) == 0)
52 omap_set_gpio_direction(3, 0);
53 else
54 printk(KERN_WARNING "LED: can't get GPIO3/red?\n");
55
56 omap_cfg_reg(MPUIO4);
57 if (omap_request_gpio(OMAP_MPUIO(4)) == 0)
58 omap_set_gpio_direction(OMAP_MPUIO(4), 0);
59 else
60 printk(KERN_WARNING "LED: can't get MPUIO4/green?\n");
61 }
62
63 leds_event(led_start);
64 return 0;
65}
66
67__initcall(omap_leds_init);