1 /* 2 * linux/arch/arm/mach-omap1/leds-innovator.c 3 */ 4 #include <linux/init.h> 5 6 #include <mach/hardware.h> 7 #include <asm/leds.h> 8 9 #include "leds.h" 10 11 12 #define LED_STATE_ENABLED 1 13 #define LED_STATE_CLAIMED 2 14 15 static unsigned int led_state; 16 static unsigned int hw_led_state; 17 innovator_leds_event(led_event_t evt)18void innovator_leds_event(led_event_t evt) 19 { 20 unsigned long flags; 21 22 local_irq_save(flags); 23 24 switch (evt) { 25 case led_start: 26 hw_led_state = 0; 27 led_state = LED_STATE_ENABLED; 28 break; 29 30 case led_stop: 31 led_state &= ~LED_STATE_ENABLED; 32 hw_led_state = 0; 33 break; 34 35 case led_claim: 36 led_state |= LED_STATE_CLAIMED; 37 hw_led_state = 0; 38 break; 39 40 case led_release: 41 led_state &= ~LED_STATE_CLAIMED; 42 hw_led_state = 0; 43 break; 44 45 #ifdef CONFIG_LEDS_TIMER 46 case led_timer: 47 if (!(led_state & LED_STATE_CLAIMED)) 48 hw_led_state ^= 0; 49 break; 50 #endif 51 52 #ifdef CONFIG_LEDS_CPU 53 case led_idle_start: 54 if (!(led_state & LED_STATE_CLAIMED)) 55 hw_led_state |= 0; 56 break; 57 58 case led_idle_end: 59 if (!(led_state & LED_STATE_CLAIMED)) 60 hw_led_state &= ~0; 61 break; 62 #endif 63 64 case led_halted: 65 break; 66 67 case led_green_on: 68 if (led_state & LED_STATE_CLAIMED) 69 hw_led_state &= ~0; 70 break; 71 72 case led_green_off: 73 if (led_state & LED_STATE_CLAIMED) 74 hw_led_state |= 0; 75 break; 76 77 case led_amber_on: 78 break; 79 80 case led_amber_off: 81 break; 82 83 case led_red_on: 84 if (led_state & LED_STATE_CLAIMED) 85 hw_led_state &= ~0; 86 break; 87 88 case led_red_off: 89 if (led_state & LED_STATE_CLAIMED) 90 hw_led_state |= 0; 91 break; 92 93 default: 94 break; 95 } 96 97 local_irq_restore(flags); 98 } 99