blob: 277f356d4cd09a217f25fdd481494333d177317a [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
Russell Kinga09e64f2008-08-05 16:14:15 +010012#include <mach/gpio.h>
Tony Lindgrence491cf2009-10-20 09:40:47 -070013#include <plat/mux.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070014
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()
Tony Lindgren7c38cf02005-09-08 23:07:38 +010036#ifdef CONFIG_OMAP_OSK_MISTRAL
37 || machine_is_omap_osk()
38#endif
39 ) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070040
41 /* LED1/LED2 pins can be used as GPIO (as done here), or by
42 * the LPG (works even in deep sleep!), to drive a bicolor
43 * LED on the H2 sample board, and another on the H2/P2
44 * "surfer" expansion board.
45 *
46 * The same pins drive a LED on the OSK Mistral board, but
47 * that's a different kind of LED (just one color at a time).
48 */
49 omap_cfg_reg(P18_1610_GPIO3);
Jarkko Nikulaf2d18fe2008-12-10 17:35:30 -080050 if (gpio_request(3, "LED red") == 0)
David Brownelle918edf2008-12-10 17:35:26 -080051 gpio_direction_output(3, 1);
Linus Torvalds1da177e2005-04-16 15:20:36 -070052 else
53 printk(KERN_WARNING "LED: can't get GPIO3/red?\n");
54
55 omap_cfg_reg(MPUIO4);
Jarkko Nikulaf2d18fe2008-12-10 17:35:30 -080056 if (gpio_request(OMAP_MPUIO(4), "LED green") == 0)
David Brownelle918edf2008-12-10 17:35:26 -080057 gpio_direction_output(OMAP_MPUIO(4), 1);
Linus Torvalds1da177e2005-04-16 15:20:36 -070058 else
59 printk(KERN_WARNING "LED: can't get MPUIO4/green?\n");
60 }
61
62 leds_event(led_start);
63 return 0;
64}
65
66__initcall(omap_leds_init);