status_led: Kconfig migration
[platform/kernel/u-boot.git] / drivers / misc / status_led.c
index 4ba3e18..3773c85 100644 (file)
@@ -2,23 +2,7 @@
  * (C) Copyright 2000-2003
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -43,31 +27,45 @@ typedef struct {
 } led_dev_t;
 
 led_dev_t led_dev[] = {
-    {  STATUS_LED_BIT,
-       STATUS_LED_STATE,
-       STATUS_LED_PERIOD,
-       0,
-    },
-#if defined(STATUS_LED_BIT1)
-    {  STATUS_LED_BIT1,
-       STATUS_LED_STATE1,
-       STATUS_LED_PERIOD1,
-       0,
-    },
+       {       CONFIG_LED_STATUS_BIT,
+               CONFIG_LED_STATUS_STATE,
+               LED_STATUS_PERIOD,
+               0,
+       },
+#if defined(CONFIG_LED_STATUS1)
+       {       CONFIG_LED_STATUS_BIT1,
+               CONFIG_LED_STATUS_STATE1,
+               LED_STATUS_PERIOD1,
+               0,
+       },
+#endif
+#if defined(CONFIG_LED_STATUS2)
+       {       CONFIG_LED_STATUS_BIT2,
+               CONFIG_LED_STATUS_STATE2,
+               LED_STATUS_PERIOD2,
+               0,
+       },
+#endif
+#if defined(CONFIG_LED_STATUS3)
+       {       CONFIG_LED_STATUS_BIT3,
+               CONFIG_LED_STATUS_STATE3,
+               LED_STATUS_PERIOD3,
+               0,
+       },
 #endif
-#if defined(STATUS_LED_BIT2)
-    {  STATUS_LED_BIT2,
-       STATUS_LED_STATE2,
-       STATUS_LED_PERIOD2,
-       0,
-    },
+#if defined(CONFIG_LED_STATUS4)
+       {       CONFIG_LED_STATUS_BIT4,
+               CONFIG_LED_STATUS_STATE4,
+               LED_STATUS_PERIOD4,
+               0,
+       },
 #endif
-#if defined(STATUS_LED_BIT3)
-    {  STATUS_LED_BIT3,
-       STATUS_LED_STATE3,
-       STATUS_LED_PERIOD3,
-       0,
-    },
+#if defined(CONFIG_LED_STATUS5)
+       {       CONFIG_LED_STATUS_BIT5,
+               CONFIG_LED_STATUS_STATE5,
+               LED_STATUS_PERIOD5,
+               0,
+       },
 #endif
 };
 
@@ -75,7 +73,7 @@ led_dev_t led_dev[] = {
 
 static int status_led_init_done = 0;
 
-static void status_led_init (void)
+void status_led_init(void)
 {
        led_dev_t *ld;
        int i;
@@ -95,7 +93,7 @@ void status_led_tick (ulong timestamp)
 
        for (i = 0, ld = led_dev; i < MAX_LED_DEV; i++, ld++) {
 
-               if (ld->state != STATUS_LED_BLINKING)
+               if (ld->state != CONFIG_LED_STATUS_BLINKING)
                        continue;
 
                if (++ld->cnt >= ld->period) {
@@ -119,9 +117,9 @@ void status_led_set (int led, int state)
        ld = &led_dev[led];
 
        ld->state = state;
-       if (state == STATUS_LED_BLINKING) {
+       if (state == CONFIG_LED_STATUS_BLINKING) {
                ld->cnt = 0;            /* always start with full period    */
-               state = STATUS_LED_ON;  /* always start with LED _ON_       */
+               state = CONFIG_LED_STATUS_ON;   /* always start with LED _ON_ */
        }
        __led_set (ld->mask, state);
 }