| 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> | 
|  | 13 | #include <mach/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 | { | 
|  | 20 | if (machine_is_omap_innovator()) | 
|  | 21 | leds_event = innovator_leds_event; | 
|  | 22 |  | 
| Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 23 | else if (machine_is_omap_h2() | 
|  | 24 | || machine_is_omap_h3() | 
|  | 25 | || machine_is_omap_perseus2()) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | 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 Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 35 | || machine_is_omap_h3() | 
| Tony Lindgren | 7c38cf0 | 2005-09-08 23:07:38 +0100 | [diff] [blame] | 36 | #ifdef	CONFIG_OMAP_OSK_MISTRAL | 
|  | 37 | || machine_is_omap_osk() | 
|  | 38 | #endif | 
|  | 39 | ) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 |  | 
|  | 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 Nikula | f2d18fe | 2008-12-10 17:35:30 -0800 | [diff] [blame] | 50 | if (gpio_request(3, "LED red") == 0) | 
| David Brownell | e918edf | 2008-12-10 17:35:26 -0800 | [diff] [blame] | 51 | gpio_direction_output(3, 1); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | else | 
|  | 53 | printk(KERN_WARNING "LED: can't get GPIO3/red?\n"); | 
|  | 54 |  | 
|  | 55 | omap_cfg_reg(MPUIO4); | 
| Jarkko Nikula | f2d18fe | 2008-12-10 17:35:30 -0800 | [diff] [blame] | 56 | if (gpio_request(OMAP_MPUIO(4), "LED green") == 0) | 
| David Brownell | e918edf | 2008-12-10 17:35:26 -0800 | [diff] [blame] | 57 | gpio_direction_output(OMAP_MPUIO(4), 1); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | 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); |