2 * Copyright (c) 2009 Wind River Systems, Inc.
3 * Tom Rix <Tom.Rix@windriver.com>
5 * SPDX-License-Identifier: GPL-2.0+
8 #include <status_led.h>
9 #include <asm/arch/cpu.h>
11 #include <asm/arch/sys_proto.h>
14 static unsigned int saved_state[2] = {STATUS_LED_OFF, STATUS_LED_OFF};
22 #define ZOOM2_LED_RED 173
23 #define ZOOM2_LED_BLUE 154
24 #define ZOOM2_LED_BLUE2 61
26 void red_led_off(void)
29 if (!gpio_request(ZOOM2_LED_RED, "")) {
30 gpio_direction_output(ZOOM2_LED_RED, 0);
31 gpio_set_value(ZOOM2_LED_RED, 0);
33 saved_state[STATUS_LED_RED] = STATUS_LED_OFF;
36 void blue_led_off(void)
39 if (!gpio_request(ZOOM2_LED_BLUE, "")) {
40 gpio_direction_output(ZOOM2_LED_BLUE, 0);
41 gpio_set_value(ZOOM2_LED_BLUE, 0);
45 if (!gpio_request(ZOOM2_LED_BLUE2, "")) {
46 gpio_direction_output(ZOOM2_LED_BLUE2, 0);
47 gpio_set_value(ZOOM2_LED_BLUE2, 0);
49 saved_state[STATUS_LED_BLUE] = STATUS_LED_OFF;
57 if (!gpio_request(ZOOM2_LED_RED, "")) {
58 gpio_direction_output(ZOOM2_LED_RED, 0);
59 gpio_set_value(ZOOM2_LED_RED, 1);
61 saved_state[STATUS_LED_RED] = STATUS_LED_ON;
64 void blue_led_on(void)
69 if (!gpio_request(ZOOM2_LED_BLUE, "")) {
70 gpio_direction_output(ZOOM2_LED_BLUE, 0);
71 gpio_set_value(ZOOM2_LED_BLUE, 1);
75 if (!gpio_request(ZOOM2_LED_BLUE2, "")) {
76 gpio_direction_output(ZOOM2_LED_BLUE2, 0);
77 gpio_set_value(ZOOM2_LED_BLUE2, 1);
80 saved_state[STATUS_LED_BLUE] = STATUS_LED_ON;
83 void __led_init (led_id_t mask, int state)
85 __led_set (mask, state);
88 void __led_toggle (led_id_t mask)
90 if (STATUS_LED_BLUE == mask) {
91 if (STATUS_LED_ON == saved_state[STATUS_LED_BLUE])
95 } else if (STATUS_LED_RED == mask) {
96 if (STATUS_LED_ON == saved_state[STATUS_LED_RED])
103 void __led_set (led_id_t mask, int state)
105 if (STATUS_LED_BLUE == mask) {
106 if (STATUS_LED_ON == state)
110 } else if (STATUS_LED_RED == mask) {
111 if (STATUS_LED_ON == state)