2 * linux/arch/arm/mach-pxa/leds-idp.c
4 * Copyright (C) 2000 John Dorsey <john+@cs.cmu.edu>
6 * Copyright (c) 2001 Jeff Sutherland <jeffs@accelent.com>
8 * Original (leds-footbridge.c) by Russell King
10 * Macros for actual LED manipulation should be in machine specific
11 * files in this 'mach' directory.
15 #include <linux/config.h>
16 #include <linux/init.h>
18 #include <asm/hardware.h>
20 #include <asm/system.h>
22 #include <asm/arch/pxa-regs.h>
23 #include <asm/arch/idp.h>
27 #define LED_STATE_ENABLED 1
28 #define LED_STATE_CLAIMED 2
30 static unsigned int led_state;
31 static unsigned int hw_led_state;
33 void idp_leds_event(led_event_t evt)
37 local_irq_save(flags);
41 hw_led_state = IDP_HB_LED | IDP_BUSY_LED;
42 led_state = LED_STATE_ENABLED;
46 led_state &= ~LED_STATE_ENABLED;
50 led_state |= LED_STATE_CLAIMED;
51 hw_led_state = IDP_HB_LED | IDP_BUSY_LED;
55 led_state &= ~LED_STATE_CLAIMED;
56 hw_led_state = IDP_HB_LED | IDP_BUSY_LED;
59 #ifdef CONFIG_LEDS_TIMER
61 if (!(led_state & LED_STATE_CLAIMED))
62 hw_led_state ^= IDP_HB_LED;
66 #ifdef CONFIG_LEDS_CPU
68 if (!(led_state & LED_STATE_CLAIMED))
69 hw_led_state &= ~IDP_BUSY_LED;
73 if (!(led_state & LED_STATE_CLAIMED))
74 hw_led_state |= IDP_BUSY_LED;
82 if (led_state & LED_STATE_CLAIMED)
83 hw_led_state |= IDP_HB_LED;
87 if (led_state & LED_STATE_CLAIMED)
88 hw_led_state &= ~IDP_HB_LED;
98 if (led_state & LED_STATE_CLAIMED)
99 hw_led_state |= IDP_BUSY_LED;
103 if (led_state & LED_STATE_CLAIMED)
104 hw_led_state &= ~IDP_BUSY_LED;
111 if (led_state & LED_STATE_ENABLED)
112 IDP_CPLD_LED_CONTROL = ( (IDP_CPLD_LED_CONTROL | IDP_LEDS_MASK) & ~hw_led_state);
114 IDP_CPLD_LED_CONTROL |= IDP_LEDS_MASK;
116 local_irq_restore(flags);