blob: ae6dd93b8ddce87e755e954695092555c4514083 [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 */
Russell King2f8163b2011-07-26 10:53:52 +01006#include <linux/gpio.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07007#include <linux/kernel.h>
8#include <linux/init.h>
9
10#include <asm/leds.h>
11#include <asm/mach-types.h>
12
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{
Tony Lindgren7f9187c2010-12-10 09:46:24 -080020 if (!cpu_class_is_omap1())
21 return -ENODEV;
22
Linus Torvalds1da177e2005-04-16 15:20:36 -070023 if (machine_is_omap_innovator())
24 leds_event = innovator_leds_event;
25
Tony Lindgren7c38cf02005-09-08 23:07:38 +010026 else if (machine_is_omap_h2()
27 || machine_is_omap_h3()
28 || machine_is_omap_perseus2())
Linus Torvalds1da177e2005-04-16 15:20:36 -070029 leds_event = h2p2_dbg_leds_event;
30
31 else if (machine_is_omap_osk())
32 leds_event = osk_leds_event;
33
34 else
35 return -1;
36
37 if (machine_is_omap_h2()
Tony Lindgren7c38cf02005-09-08 23:07:38 +010038 || machine_is_omap_h3()
Tony Lindgren7c38cf02005-09-08 23:07:38 +010039#ifdef CONFIG_OMAP_OSK_MISTRAL
40 || machine_is_omap_osk()
41#endif
42 ) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070043
44 /* LED1/LED2 pins can be used as GPIO (as done here), or by
45 * the LPG (works even in deep sleep!), to drive a bicolor
46 * LED on the H2 sample board, and another on the H2/P2
47 * "surfer" expansion board.
48 *
49 * The same pins drive a LED on the OSK Mistral board, but
50 * that's a different kind of LED (just one color at a time).
51 */
52 omap_cfg_reg(P18_1610_GPIO3);
Jarkko Nikulaf2d18fe2008-12-10 17:35:30 -080053 if (gpio_request(3, "LED red") == 0)
David Brownelle918edf2008-12-10 17:35:26 -080054 gpio_direction_output(3, 1);
Linus Torvalds1da177e2005-04-16 15:20:36 -070055 else
56 printk(KERN_WARNING "LED: can't get GPIO3/red?\n");
57
58 omap_cfg_reg(MPUIO4);
Jarkko Nikulaf2d18fe2008-12-10 17:35:30 -080059 if (gpio_request(OMAP_MPUIO(4), "LED green") == 0)
David Brownelle918edf2008-12-10 17:35:26 -080060 gpio_direction_output(OMAP_MPUIO(4), 1);
Linus Torvalds1da177e2005-04-16 15:20:36 -070061 else
62 printk(KERN_WARNING "LED: can't get MPUIO4/green?\n");
63 }
64
65 leds_event(led_start);
66 return 0;
67}
68
69__initcall(omap_leds_init);