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/init.h>
17 #include <mach/hardware.h>
19 #include <asm/system.h>
21 #include <mach/pxa25x.h>
26 #define LED_STATE_ENABLED 1
27 #define LED_STATE_CLAIMED 2
29 static unsigned int led_state
;
30 static unsigned int hw_led_state
;
32 void idp_leds_event(led_event_t evt
)
36 local_irq_save(flags
);
40 hw_led_state
= IDP_HB_LED
| IDP_BUSY_LED
;
41 led_state
= LED_STATE_ENABLED
;
45 led_state
&= ~LED_STATE_ENABLED
;
49 led_state
|= LED_STATE_CLAIMED
;
50 hw_led_state
= IDP_HB_LED
| IDP_BUSY_LED
;
54 led_state
&= ~LED_STATE_CLAIMED
;
55 hw_led_state
= IDP_HB_LED
| IDP_BUSY_LED
;
58 #ifdef CONFIG_LEDS_TIMER
60 if (!(led_state
& LED_STATE_CLAIMED
))
61 hw_led_state
^= IDP_HB_LED
;
65 #ifdef CONFIG_LEDS_CPU
67 if (!(led_state
& LED_STATE_CLAIMED
))
68 hw_led_state
&= ~IDP_BUSY_LED
;
72 if (!(led_state
& LED_STATE_CLAIMED
))
73 hw_led_state
|= IDP_BUSY_LED
;
81 if (led_state
& LED_STATE_CLAIMED
)
82 hw_led_state
|= IDP_HB_LED
;
86 if (led_state
& LED_STATE_CLAIMED
)
87 hw_led_state
&= ~IDP_HB_LED
;
97 if (led_state
& LED_STATE_CLAIMED
)
98 hw_led_state
|= IDP_BUSY_LED
;
102 if (led_state
& LED_STATE_CLAIMED
)
103 hw_led_state
&= ~IDP_BUSY_LED
;
110 if (led_state
& LED_STATE_ENABLED
)
111 IDP_CPLD_LED_CONTROL
= ( (IDP_CPLD_LED_CONTROL
| IDP_LEDS_MASK
) & ~hw_led_state
);
113 IDP_CPLD_LED_CONTROL
|= IDP_LEDS_MASK
;
115 local_irq_restore(flags
);