2 * linux/arch/arm/mach-pxa/leds-trizeps4.c
4 * Author: Jürgen Schindele
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>
20 #include <asm/arch/pxa-regs.h>
21 #include <asm/arch/trizeps4.h>
25 #define LED_STATE_ENABLED 1
26 #define LED_STATE_CLAIMED 2
29 #define HEARTBEAT 0x02
32 static unsigned int led_state
;
33 static unsigned int hw_led_state
;
35 void trizeps4_leds_event(led_event_t evt
)
39 local_irq_save(flags
);
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
;
50 led_state
&= ~LED_STATE_ENABLED
;
54 led_state
|= LED_STATE_CLAIMED
;
59 led_state
&= ~LED_STATE_CLAIMED
;
63 #ifdef CONFIG_LEDS_TIMER
65 hw_led_state
^= HEARTBEAT
;
69 #ifdef CONFIG_LEDS_CPU
71 hw_led_state
&= ~SYS_BUSY
;
75 hw_led_state
|= SYS_BUSY
;
83 hw_led_state
|= BLINK
;
87 hw_led_state
&= ~BLINK
;
106 if (led_state
& LED_STATE_ENABLED
) {
107 switch (hw_led_state
) {
109 GPSR(GPIO_SYS_BUSY_LED
) |= GPIO_bit(GPIO_SYS_BUSY_LED
);
110 GPSR(GPIO_HEARTBEAT_LED
) |= GPIO_bit(GPIO_HEARTBEAT_LED
);
113 GPCR(GPIO_SYS_BUSY_LED
) |= GPIO_bit(GPIO_SYS_BUSY_LED
);
114 GPSR(GPIO_HEARTBEAT_LED
) |= GPIO_bit(GPIO_HEARTBEAT_LED
);
117 GPSR(GPIO_SYS_BUSY_LED
) |= GPIO_bit(GPIO_SYS_BUSY_LED
);
118 GPCR(GPIO_HEARTBEAT_LED
) |= GPIO_bit(GPIO_HEARTBEAT_LED
);
121 GPCR(GPIO_SYS_BUSY_LED
) |= GPIO_bit(GPIO_SYS_BUSY_LED
);
122 GPCR(GPIO_HEARTBEAT_LED
) |= GPIO_bit(GPIO_HEARTBEAT_LED
);
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
);