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/pxa2xx-gpio.h>
22 #include <asm/arch/trizeps4.h>
26 #define LED_STATE_ENABLED 1
27 #define LED_STATE_CLAIMED 2
30 #define HEARTBEAT 0x02
33 static unsigned int led_state;
34 static unsigned int hw_led_state;
36 void trizeps4_leds_event(led_event_t evt)
40 local_irq_save(flags);
45 pxa_gpio_mode( GPIO_SYS_BUSY_LED | GPIO_OUT); /* LED1 */
46 pxa_gpio_mode( GPIO_HEARTBEAT_LED | GPIO_OUT); /* LED2 */
47 led_state = LED_STATE_ENABLED;
51 led_state &= ~LED_STATE_ENABLED;
55 led_state |= LED_STATE_CLAIMED;
60 led_state &= ~LED_STATE_CLAIMED;
64 #ifdef CONFIG_LEDS_TIMER
66 hw_led_state ^= HEARTBEAT;
70 #ifdef CONFIG_LEDS_CPU
72 hw_led_state &= ~SYS_BUSY;
76 hw_led_state |= SYS_BUSY;
84 hw_led_state |= BLINK;
88 hw_led_state &= ~BLINK;
107 if (led_state & LED_STATE_ENABLED) {
108 switch (hw_led_state) {
110 GPSR(GPIO_SYS_BUSY_LED) |= GPIO_bit(GPIO_SYS_BUSY_LED);
111 GPSR(GPIO_HEARTBEAT_LED) |= GPIO_bit(GPIO_HEARTBEAT_LED);
114 GPCR(GPIO_SYS_BUSY_LED) |= GPIO_bit(GPIO_SYS_BUSY_LED);
115 GPSR(GPIO_HEARTBEAT_LED) |= GPIO_bit(GPIO_HEARTBEAT_LED);
118 GPSR(GPIO_SYS_BUSY_LED) |= GPIO_bit(GPIO_SYS_BUSY_LED);
119 GPCR(GPIO_HEARTBEAT_LED) |= GPIO_bit(GPIO_HEARTBEAT_LED);
122 GPCR(GPIO_SYS_BUSY_LED) |= GPIO_bit(GPIO_SYS_BUSY_LED);
123 GPCR(GPIO_HEARTBEAT_LED) |= GPIO_bit(GPIO_HEARTBEAT_LED);
129 GPSR(GPIO_SYS_BUSY_LED) |= GPIO_bit(GPIO_SYS_BUSY_LED);
130 GPSR(GPIO_HEARTBEAT_LED) |= GPIO_bit(GPIO_HEARTBEAT_LED);
133 local_irq_restore(flags);