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