blob: 3a066ee8d02c39201d0b20913944018cdf33ec83 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Tony Lindgren7c38cf02005-09-08 23:07:38 +01002 * linux/arch/arm/mach-omap1/leds-innovator.c
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07004#include <linux/init.h>
5
Russell Kinga09e64f2008-08-05 16:14:15 +01006#include <mach/hardware.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07007#include <asm/leds.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07008
9#include "leds.h"
10
11
12#define LED_STATE_ENABLED 1
13#define LED_STATE_CLAIMED 2
14
15static unsigned int led_state;
16static unsigned int hw_led_state;
17
18void innovator_leds_event(led_event_t evt)
19{
20 unsigned long flags;
21
22 local_irq_save(flags);
23
24 switch (evt) {
25 case led_start:
26 hw_led_state = 0;
27 led_state = LED_STATE_ENABLED;
28 break;
29
30 case led_stop:
31 led_state &= ~LED_STATE_ENABLED;
32 hw_led_state = 0;
33 break;
34
35 case led_claim:
36 led_state |= LED_STATE_CLAIMED;
37 hw_led_state = 0;
38 break;
39
40 case led_release:
41 led_state &= ~LED_STATE_CLAIMED;
42 hw_led_state = 0;
43 break;
44
45#ifdef CONFIG_LEDS_TIMER
46 case led_timer:
47 if (!(led_state & LED_STATE_CLAIMED))
48 hw_led_state ^= 0;
49 break;
50#endif
51
52#ifdef CONFIG_LEDS_CPU
53 case led_idle_start:
54 if (!(led_state & LED_STATE_CLAIMED))
55 hw_led_state |= 0;
56 break;
57
58 case led_idle_end:
59 if (!(led_state & LED_STATE_CLAIMED))
60 hw_led_state &= ~0;
61 break;
62#endif
63
64 case led_halted:
65 break;
66
67 case led_green_on:
68 if (led_state & LED_STATE_CLAIMED)
69 hw_led_state &= ~0;
70 break;
71
72 case led_green_off:
73 if (led_state & LED_STATE_CLAIMED)
74 hw_led_state |= 0;
75 break;
76
77 case led_amber_on:
78 break;
79
80 case led_amber_off:
81 break;
82
83 case led_red_on:
84 if (led_state & LED_STATE_CLAIMED)
85 hw_led_state &= ~0;
86 break;
87
88 case led_red_off:
89 if (led_state & LED_STATE_CLAIMED)
90 hw_led_state |= 0;
91 break;
92
93 default:
94 break;
95 }
96
Linus Torvalds1da177e2005-04-16 15:20:36 -070097 local_irq_restore(flags);
98}