e1000: Add device IDs of blade version of the 82571 quad port
[pv_ops_mirror.git] / arch / arm / mach-pxa / leds-trizeps4.c
blob2271d20ffedaf7dc1abc1dc64ba747aa91e8c762
1 /*
2 * linux/arch/arm/mach-pxa/leds-trizeps4.c
4 * Author: Jürgen Schindele
5 * Created: 20 02, 2006
6 * Copyright: Jürgen Schindele
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include <linux/init.h>
15 #include <asm/hardware.h>
16 #include <asm/system.h>
17 #include <asm/types.h>
18 #include <asm/leds.h>
20 #include <asm/arch/pxa-regs.h>
21 #include <asm/arch/trizeps4.h>
23 #include "leds.h"
25 #define LED_STATE_ENABLED 1
26 #define LED_STATE_CLAIMED 2
28 #define SYS_BUSY 0x01
29 #define HEARTBEAT 0x02
30 #define BLINK 0x04
32 static unsigned int led_state;
33 static unsigned int hw_led_state;
35 void trizeps4_leds_event(led_event_t evt)
37 unsigned long flags;
39 local_irq_save(flags);
41 switch (evt) {
42 case led_start:
43 hw_led_state = 0;
44 pxa_gpio_mode( GPIO_SYS_BUSY_LED | GPIO_OUT); /* LED1 */
45 pxa_gpio_mode( GPIO_HEARTBEAT_LED | GPIO_OUT); /* LED2 */
46 led_state = LED_STATE_ENABLED;
47 break;
49 case led_stop:
50 led_state &= ~LED_STATE_ENABLED;
51 break;
53 case led_claim:
54 led_state |= LED_STATE_CLAIMED;
55 hw_led_state = 0;
56 break;
58 case led_release:
59 led_state &= ~LED_STATE_CLAIMED;
60 hw_led_state = 0;
61 break;
63 #ifdef CONFIG_LEDS_TIMER
64 case led_timer:
65 hw_led_state ^= HEARTBEAT;
66 break;
67 #endif
69 #ifdef CONFIG_LEDS_CPU
70 case led_idle_start:
71 hw_led_state &= ~SYS_BUSY;
72 break;
74 case led_idle_end:
75 hw_led_state |= SYS_BUSY;
76 break;
77 #endif
79 case led_halted:
80 break;
82 case led_green_on:
83 hw_led_state |= BLINK;
84 break;
86 case led_green_off:
87 hw_led_state &= ~BLINK;
88 break;
90 case led_amber_on:
91 break;
93 case led_amber_off:
94 break;
96 case led_red_on:
97 break;
99 case led_red_off:
100 break;
102 default:
103 break;
106 if (led_state & LED_STATE_ENABLED) {
107 switch (hw_led_state) {
108 case 0:
109 GPSR(GPIO_SYS_BUSY_LED) |= GPIO_bit(GPIO_SYS_BUSY_LED);
110 GPSR(GPIO_HEARTBEAT_LED) |= GPIO_bit(GPIO_HEARTBEAT_LED);
111 break;
112 case 1:
113 GPCR(GPIO_SYS_BUSY_LED) |= GPIO_bit(GPIO_SYS_BUSY_LED);
114 GPSR(GPIO_HEARTBEAT_LED) |= GPIO_bit(GPIO_HEARTBEAT_LED);
115 break;
116 case 2:
117 GPSR(GPIO_SYS_BUSY_LED) |= GPIO_bit(GPIO_SYS_BUSY_LED);
118 GPCR(GPIO_HEARTBEAT_LED) |= GPIO_bit(GPIO_HEARTBEAT_LED);
119 break;
120 case 3:
121 GPCR(GPIO_SYS_BUSY_LED) |= GPIO_bit(GPIO_SYS_BUSY_LED);
122 GPCR(GPIO_HEARTBEAT_LED) |= GPIO_bit(GPIO_HEARTBEAT_LED);
123 break;
126 else {
127 /* turn all off */
128 GPSR(GPIO_SYS_BUSY_LED) |= GPIO_bit(GPIO_SYS_BUSY_LED);
129 GPSR(GPIO_HEARTBEAT_LED) |= GPIO_bit(GPIO_HEARTBEAT_LED);
132 local_irq_restore(flags);