blob: 7b1a3833165de05a7de5929cf2b96ad58c7c8e93 [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>
Tony Lindgren4b254082012-08-30 15:37:24 -07009#include <linux/platform_data/gpio-omap.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070010
11#include <asm/leds.h>
12#include <asm/mach-types.h>
13
Tony Lindgrence491cf2009-10-20 09:40:47 -070014#include <plat/mux.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070015
16#include "leds.h"
17
18static int __init
19omap_leds_init(void)
20{
Tony Lindgren7f9187c2010-12-10 09:46:24 -080021 if (!cpu_class_is_omap1())
22 return -ENODEV;
23
Linus Torvalds1da177e2005-04-16 15:20:36 -070024 if (machine_is_omap_innovator())
25 leds_event = innovator_leds_event;
26
Tony Lindgren7c38cf02005-09-08 23:07:38 +010027 else if (machine_is_omap_h2()
28 || machine_is_omap_h3()
29 || machine_is_omap_perseus2())
Linus Torvalds1da177e2005-04-16 15:20:36 -070030 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()
Tony Lindgren7c38cf02005-09-08 23:07:38 +010039 || machine_is_omap_h3()
Tony Lindgren7c38cf02005-09-08 23:07:38 +010040#ifdef CONFIG_OMAP_OSK_MISTRAL
41 || machine_is_omap_osk()
42#endif
43 ) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070044
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);
Jarkko Nikulaf2d18fe2008-12-10 17:35:30 -080054 if (gpio_request(3, "LED red") == 0)
David Brownelle918edf2008-12-10 17:35:26 -080055 gpio_direction_output(3, 1);
Linus Torvalds1da177e2005-04-16 15:20:36 -070056 else
57 printk(KERN_WARNING "LED: can't get GPIO3/red?\n");
58
59 omap_cfg_reg(MPUIO4);
Jarkko Nikulaf2d18fe2008-12-10 17:35:30 -080060 if (gpio_request(OMAP_MPUIO(4), "LED green") == 0)
David Brownelle918edf2008-12-10 17:35:26 -080061 gpio_direction_output(OMAP_MPUIO(4), 1);
Linus Torvalds1da177e2005-04-16 15:20:36 -070062 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);