Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 2 | * linux/arch/arm/mach-omap1/leds.c |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * |
| 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 King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 12 | #include <mach/gpio.h> |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 13 | #include <plat/mux.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | |
| 15 | #include "leds.h" |
| 16 | |
| 17 | static int __init |
| 18 | omap_leds_init(void) |
| 19 | { |
Tony Lindgren | 7f9187c | 2010-12-10 09:46:24 -0800 | [diff] [blame] | 20 | if (!cpu_class_is_omap1()) |
| 21 | return -ENODEV; |
| 22 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | if (machine_is_omap_innovator()) |
| 24 | leds_event = innovator_leds_event; |
| 25 | |
Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 26 | else if (machine_is_omap_h2() |
| 27 | || machine_is_omap_h3() |
| 28 | || machine_is_omap_perseus2()) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | 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 Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 38 | || machine_is_omap_h3() |
Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 39 | #ifdef CONFIG_OMAP_OSK_MISTRAL |
| 40 | || machine_is_omap_osk() |
| 41 | #endif |
| 42 | ) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | |
| 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 Nikula | f2d18fe | 2008-12-10 17:35:30 -0800 | [diff] [blame] | 53 | if (gpio_request(3, "LED red") == 0) |
David Brownell | e918edf | 2008-12-10 17:35:26 -0800 | [diff] [blame] | 54 | gpio_direction_output(3, 1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | else |
| 56 | printk(KERN_WARNING "LED: can't get GPIO3/red?\n"); |
| 57 | |
| 58 | omap_cfg_reg(MPUIO4); |
Jarkko Nikula | f2d18fe | 2008-12-10 17:35:30 -0800 | [diff] [blame] | 59 | if (gpio_request(OMAP_MPUIO(4), "LED green") == 0) |
David Brownell | e918edf | 2008-12-10 17:35:26 -0800 | [diff] [blame] | 60 | gpio_direction_output(OMAP_MPUIO(4), 1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | 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); |