2 * Copyright (c) 2009 Wind River Systems, Inc.
3 * Tom Rix <Tom.Rix@windriver.com>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of
8 * the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 #include <status_led.h>
22 #include <asm/arch/cpu.h>
24 #include <asm/arch/sys_proto.h>
25 #include <asm/arch/gpio.h>
27 static unsigned int saved_state[2] = {STATUS_LED_OFF, STATUS_LED_OFF};
35 #define ZOOM2_LED_RED 173
36 #define ZOOM2_LED_BLUE 154
37 #define ZOOM2_LED_BLUE2 61
39 void red_LED_off (void)
42 if (!omap_request_gpio(ZOOM2_LED_RED)) {
43 omap_set_gpio_direction(ZOOM2_LED_RED, 0);
44 omap_set_gpio_dataout(ZOOM2_LED_RED, 0);
46 saved_state[STATUS_LED_RED] = STATUS_LED_OFF;
49 void blue_LED_off (void)
52 if (!omap_request_gpio(ZOOM2_LED_BLUE)) {
53 omap_set_gpio_direction(ZOOM2_LED_BLUE, 0);
54 omap_set_gpio_dataout(ZOOM2_LED_BLUE, 0);
58 if (!omap_request_gpio(ZOOM2_LED_BLUE2)) {
59 omap_set_gpio_direction(ZOOM2_LED_BLUE2, 0);
60 omap_set_gpio_dataout(ZOOM2_LED_BLUE2, 0);
62 saved_state[STATUS_LED_BLUE] = STATUS_LED_OFF;
65 void red_LED_on (void)
70 if (!omap_request_gpio(ZOOM2_LED_RED)) {
71 omap_set_gpio_direction(ZOOM2_LED_RED, 0);
72 omap_set_gpio_dataout(ZOOM2_LED_RED, 1);
74 saved_state[STATUS_LED_RED] = STATUS_LED_ON;
77 void blue_LED_on (void)
82 if (!omap_request_gpio(ZOOM2_LED_BLUE)) {
83 omap_set_gpio_direction(ZOOM2_LED_BLUE, 0);
84 omap_set_gpio_dataout(ZOOM2_LED_BLUE, 1);
88 if (!omap_request_gpio(ZOOM2_LED_BLUE2)) {
89 omap_set_gpio_direction(ZOOM2_LED_BLUE2, 0);
90 omap_set_gpio_dataout(ZOOM2_LED_BLUE2, 1);
93 saved_state[STATUS_LED_BLUE] = STATUS_LED_ON;
96 void __led_init (led_id_t mask, int state)
98 __led_set (mask, state);
101 void __led_toggle (led_id_t mask)
103 if (STATUS_LED_BLUE == mask) {
104 if (STATUS_LED_ON == saved_state[STATUS_LED_BLUE])
108 } else if (STATUS_LED_RED == mask) {
109 if (STATUS_LED_ON == saved_state[STATUS_LED_RED])
116 void __led_set (led_id_t mask, int state)
118 if (STATUS_LED_BLUE == mask) {
119 if (STATUS_LED_ON == state)
123 } else if (STATUS_LED_RED == mask) {
124 if (STATUS_LED_ON == state)