]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - arch/arm/mach-omap1/leds-osk.c
da09f4364979808421b2f482b68a32ea84ec898c
2 * linux/arch/arm/mach-omap1/leds-osk.c
4 * LED driver for OSK with optional Mistral QVGA board
6 #include <linux/gpio.h>
7 #include <linux/init.h>
9 #include <mach/hardware.h>
11 #include <asm/system.h>
16 #define LED_STATE_ENABLED (1 << 0)
17 #define LED_STATE_CLAIMED (1 << 1)
20 #define TIMER_LED (1 << 3) /* Mistral board */
21 #define IDLE_LED (1 << 4) /* Mistral board */
22 static u8 hw_led_state
;
25 #ifdef CONFIG_OMAP_OSK_MISTRAL
27 /* For now, all system indicators require the Mistral board, since that
28 * LED can be manipulated without a task context. This LED is either red,
29 * or green, but not both; it can't give the full "disco led" effect.
32 #define GPIO_LED_RED 3
33 #define GPIO_LED_GREEN OMAP_MPUIO(4)
35 static void mistral_setled(void)
40 if (hw_led_state
& TIMER_LED
)
42 else if (hw_led_state
& IDLE_LED
)
44 /* else both sides are disabled */
46 gpio_set_value(GPIO_LED_GREEN
, green
);
47 gpio_set_value(GPIO_LED_RED
, red
);
52 void osk_leds_event(led_event_t evt
)
57 local_irq_save(flags
);
59 if (!(led_state
& LED_STATE_ENABLED
) && evt
!= led_start
)
65 led_state
|= LED_STATE_ENABLED
;
72 led_state
&= ~LED_STATE_ENABLED
;
77 led_state
|= LED_STATE_CLAIMED
;
83 led_state
&= ~LED_STATE_CLAIMED
;
87 #ifdef CONFIG_OMAP_OSK_MISTRAL
90 hw_led_state
^= TIMER_LED
;
94 case led_idle_start
: /* idle == off */
95 hw_led_state
&= ~IDLE_LED
;
100 hw_led_state
|= IDLE_LED
;
104 #endif /* CONFIG_OMAP_OSK_MISTRAL */
110 leds
^= hw_led_state
;
113 local_irq_restore(flags
);