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