diff options
-rw-r--r-- | README | 8 | ||||
-rw-r--r-- | doc/README.LED | 58 | ||||
-rw-r--r-- | drivers/led/Kconfig | 323 |
3 files changed, 355 insertions, 34 deletions
@@ -2033,7 +2033,7 @@ The following options need to be configured: A byte containing the id of the VLAN. -- Status LED: CONFIG_STATUS_LED +- Status LED: CONFIG_LED_STATUS Several configurations allow to display the current status using a LED. For instance, the LED will blink @@ -2041,15 +2041,15 @@ The following options need to be configured: soon as a reply to a BOOTP request was received, and start blinking slow once the Linux kernel is running (supported by a status LED driver in the Linux - kernel). Defining CONFIG_STATUS_LED enables this + kernel). Defining CONFIG_LED_STATUS enables this feature in U-Boot. Additional options: - CONFIG_GPIO_LED + CONFIG_LED_STATUS_GPIO The status LED can be connected to a GPIO pin. In such cases, the gpio_led driver can be used as a - status LED backend implementation. Define CONFIG_GPIO_LED + status LED backend implementation. Define CONFIG_LED_STATUS_GPIO to include the gpio_led driver in the U-Boot binary. CONFIG_GPIO_LED_INVERTED_TABLE diff --git a/doc/README.LED b/doc/README.LED index c3bcb3ac80..7aa95bddf7 100644 --- a/doc/README.LED +++ b/doc/README.LED @@ -5,48 +5,48 @@ This README describes the status LED API. The API is defined by the include file include/status_led.h -The first step is to define CONFIG_STATUS_LED in the board config file. +The first step is to enable CONFIG_LED_STATUS in menuconfig: +> Device Drivers > LED Support. -If the LED support is only for a single board, define CONFIG_BOARD_SPECIFIC_LED -in the board config file. +If the LED support is only for specific board, enable +CONFIG_LED_STATUS_BOARD_SPECIFIC in the menuconfig. -At a minimum, these macros must be defined at -STATUS_LED_BIT -STATUS_LED_STATE -STATUS_LED_PERIOD +Status LEDS 0 to 5 are enabled by the following configurations at menuconfig: +CONFIG_STATUS_LED0, CONFIG_STATUS_LED1, ... CONFIG_STATUS_LED5 -If there are multiple status LED's define -STATUS_LED_BIT<n> -STATUS_LED_STATE<n> -STATUS_LED_PERIOD<n> +The following should be configured for each of the enabled LEDs: +CONFIG_STATUS_LED_BIT<n> +CONFIG_STATUS_LED_STATE<n> +CONFIG_STATUS_LED_FREQ<n> +Where <n> is an integer 1 through 5 (empty for 0). -Where <n> can a integer 1 through 3. - -STATUS_LED_BIT is passed into the __led_* functions to identify which LED is -being acted on. As such, the value choose must be unique with with respect to -the other STATUS_LED_BIT's. Mapping the value to a physical LED is the +CONFIG_STATUS_LED_BIT is passed into the __led_* functions to identify which LED +is being acted on. As such, the value choose must be unique with with respect to +the other CONFIG_STATUS_LED_BIT's. Mapping the value to a physical LED is the reponsiblity of the __led_* function. -STATUS_LED_STATE is the initial state of the LED. It should be set to one of -these values: STATUS_LED_OFF or STATUS_LED_ON. +CONFIG_STATUS_LED_STATE is the initial state of the LED. It should be set to one +of these values: CONFIG_LED_STATUS_OFF or CONFIG_LED_STATUS_ON. -STATUS_LED_PERIOD is how long is the LED blink period. This usually set to -(CONFIG_SYS_HZ / <N>) where <N> is the frequency of the blink. Typical values -range from 2 to 10. +CONFIG_STATUS_LED_FREQ determines the LED blink frequency. +Values range from 2 to 10. Some other LED macros +--------------------- -STATUS_LED_BOOT is the LED to light when the board is booting. This must be a -valid STATUS_LED_BIT value. +CONFIG_STATUS_LED_BOOT is the LED to light when the board is booting. +This must be a valid LED number (0-5). -STATUS_LED_RED is the red LED. It is used signal errors. This must be a valid -STATUS_LED_BIT value. Other similar color LED's are STATUS_LED_YELLOW and -STATUS_LED_BLUE. +CONFIG_STATUS_LED_RED is the red LED. It is used to signal errors. This must be +a valid LED number (0-5). Other similar color LED's macros are +CONFIG_STATUS_LED_GREEN, CONFIG_STATUS_LED_YELLOW and CONFIG_STATUS_LED_BLUE. -These board must define these functions +General LED functions +--------------------- +The following functions should be defined: -__led_init is called once to initialize the LED to STATUS_LED_STATE. One time -start up code should be placed here. +__led_init is called once to initialize the LED to CONFIG_STATUS_LED_STATE. +One time start up code should be placed here. __led_set is called to change the state of the LED. diff --git a/drivers/led/Kconfig b/drivers/led/Kconfig index fe74403460..609b1fa3fe 100644 --- a/drivers/led/Kconfig +++ b/drivers/led/Kconfig @@ -17,7 +17,6 @@ config SPL_LED If this is acceptable and you have a need to use LEDs in SPL, enable this option. You will need to enable device tree in SPL for this to work. - config LED_GPIO bool "LED support for GPIO-connected LEDs" depends on LED && DM_GPIO @@ -34,4 +33,326 @@ config SPL_LED_GPIO This option is an SPL-variant of the LED_GPIO option. See the help of LED_GPIO for details. +config LED_STATUS + bool "Enable status LED API" + help + Allows common u-boot commands to use a board's leds to + provide status for activities like booting and downloading files. + +if LED_STATUS + +# Hidden constants + +config LED_STATUS_OFF + int + default 0 + +config LED_STATUS_BLINKING + int + default 1 + +config LED_STATUS_ON + int + default 2 + +# Hidden constants end + +config LED_STATUS_GPIO + bool "GPIO status LED implementation" + help + The status LED can be connected to a GPIO pin. In such cases, the + gpio_led driver can be used as a status LED backend implementation. + +config LED_STATUS_BOARD_SPECIFIC + bool "Specific board" + default y + help + LED support is only for a specific board. + +comment "LEDs parameters" + +config LED_STATUS0 + bool "Enable status LED 0" + +if LED_STATUS0 + +config LED_STATUS_BIT + int "identification" + help + CONFIG_LED_STATUS_BIT is passed into the __led_* functions to identify + which LED is being acted on. As such, the chosen value must be unique + with respect to the other CONFIG_LED_STATUS_BIT's. Mapping the value + to a physical LED is the responsibility of the __led_* function. + +config LED_STATUS_STATE + int "initial state" + range LED_STATUS_OFF LED_STATUS_ON + default LED_STATUS_OFF + help + Should be set one of the following: + 0 - off + 1 - blinking + 2 - on + +config LED_STATUS_FREQ + int "blink frequency" + range 2 10 + default 2 + help + The LED blink period calculated from LED_STATUS_FREQ: + LED_STATUS_PERIOD = CONFIG_SYS_HZ/LED_STATUS_FREQ + Values range: 2 - 10 + +endif # LED_STATUS0 + +config LED_STATUS1 + bool "Enable status LED 1" + +if LED_STATUS1 + +config LED_STATUS_BIT1 + int "identification" + help + CONFIG_LED_STATUS_BIT1 is passed into the __led_* functions to + identify which LED is being acted on. As such, the chosen value must + be unique with respect to the other CONFIG_LED_STATUS_BIT's. Mapping + the value to a physical LED is the responsibility of the __led_* + function. + +config LED_STATUS_STATE1 + int "initial state" + range LED_STATUS_OFF LED_STATUS_ON + default LED_STATUS_OFF + help + Should be set one of the following: + 0 - off + 1 - blinking + 2 - on + +config LED_STATUS_FREQ1 + int "blink frequency" + range 2 10 + default 2 + help + The LED blink period calculated from LED_STATUS_FREQ1: + LED_STATUS_PERIOD1 = CONFIG_SYS_HZ/LED_STATUS_FREQ1 + Values range: 2 - 10 + +endif # LED_STATUS1 + +config LED_STATUS2 + bool "Enable status LED 2" + +if LED_STATUS2 + +config LED_STATUS_BIT2 + int "identification" + help + CONFIG_LED_STATUS_BIT2 is passed into the __led_* functions to + identify which LED is being acted on. As such, the chosen value must + be unique with respect to the other CONFIG_LED_STATUS_BIT's. Mapping + the value to a physical LED is the responsibility of the __led_* + function. + +config LED_STATUS_STATE2 + int "initial state" + range LED_STATUS_OFF LED_STATUS_ON + default LED_STATUS_OFF + help + Should be set one of the following: + 0 - off + 1 - blinking + 2 - on + +config LED_STATUS_FREQ2 + int "blink frequency" + range 2 10 + default 2 + help + The LED blink period calculated from LED_STATUS_FREQ2: + LED_STATUS_PERIOD2 = CONFIG_SYS_HZ/LED_STATUS_FREQ2 + Values range: 2 - 10 + +endif # LED_STATUS2 + +config LED_STATUS3 + bool "Enable status LED 3" + +if LED_STATUS3 + +config LED_STATUS_BIT3 + int "identification" + help + CONFIG_LED_STATUS_BIT3 is passed into the __led_* functions to + identify which LED is being acted on. As such, the chosen value must + be unique with respect to the other CONFIG_LED_STATUS_BIT's. Mapping + the value to a physical LED is the responsibility of the __led_* + function. + +config LED_STATUS_STATE3 + int "initial state" + range LED_STATUS_OFF LED_STATUS_ON + default LED_STATUS_OFF + help + Should be set one of the following: + 0 - off + 1 - blinking + 2 - on + +config LED_STATUS_FREQ3 + int "blink frequency" + range 2 10 + default 2 + help + The LED blink period calculated from LED_STATUS_FREQ3: + LED_STATUS_PERIOD3 = CONFIG_SYS_HZ/LED_STATUS_FREQ3 + Values range: 2 - 10 + +endif # LED_STATUS3 + +config LED_STATUS4 + bool "Enable status LED 4" + +if LED_STATUS4 + +config LED_STATUS_BIT4 + int "identification" + help + CONFIG_LED_STATUS_BIT4 is passed into the __led_* functions to + identify which LED is being acted on. As such, the chosen value must + be unique with respect to the other CONFIG_LED_STATUS_BIT's. Mapping + the value to a physical LED is the responsibility of the __led_* + function. + +config LED_STATUS_STATE4 + int "initial state" + range LED_STATUS_OFF LED_STATUS_ON + default LED_STATUS_OFF + help + Should be set one of the following: + 0 - off + 1 - blinking + 2 - on + +config LED_STATUS_FREQ4 + int "blink frequency" + range 2 10 + default 2 + help + The LED blink period calculated from LED_STATUS_FREQ4: + LED_STATUS_PERIOD4 = CONFIG_SYS_HZ/LED_STATUS_FREQ4 + Values range: 2 - 10 + +endif # LED_STATUS4 + +config LED_STATUS5 + bool "Enable status LED 5" + +if LED_STATUS5 + +config LED_STATUS_BIT5 + int "identification" + help + CONFIG_LED_STATUS_BIT5 is passed into the __led_* functions to + identify which LED is being acted on. As such, the chosen value must + be unique with respect to the other CONFIG_LED_STATUS_BIT's. Mapping + the value to a physical LED is the responsibility of the __led_* + function. + +config LED_STATUS_STATE5 + int "initial state" + range LED_STATUS_OFF LED_STATUS_ON + default LED_STATUS_OFF + help + Should be set one of the following: + 0 - off + 1 - blinking + 2 - on + +config LED_STATUS_FREQ5 + int "blink frequency" + range 2 10 + default 2 + help + The LED blink period calculated from LED_STATUS_FREQ5: + LED_STATUS_PERIOD5 = CONFIG_SYS_HZ/LED_STATUS_FREQ5 + Values range: 2 - 10 + +endif # LED_STATUS5 + +config LED_STATUS_BOOT_ENABLE + bool "Enable BOOT LED" + help + Enable to turn an LED on when the board is booting. + +if LED_STATUS_BOOT_ENABLE + +config LED_STATUS_BOOT + int "LED to light when the board is booting" + help + Valid enabled LED device number. + +endif # LED_STATUS_BOOT_ENABLE + +config LED_STATUS_RED_ENABLE + bool "Enable red LED" + help + Enable red status LED. + +if LED_STATUS_RED_ENABLE + +config LED_STATUS_RED + int "Red LED identification" + help + Valid enabled LED device number. + +endif # LED_STATUS_RED_ENABLE + +config LED_STATUS_YELLOW_ENABLE + bool "Enable yellow LED" + help + Enable yellow status LED. + +if LED_STATUS_YELLOW_ENABLE + +config LED_STATUS_YELLOW + int "Yellow LED identification" + help + Valid enabled LED device number. + +endif # LED_STATUS_YELLOW_ENABLE + +config LED_STATUS_BLUE_ENABLE + bool "Enable blue LED" + help + Enable blue status LED. + +if LED_STATUS_BLUE_ENABLE + +config LED_STATUS_BLUE + int "Blue LED identification" + help + Valid enabled LED device number. + +endif # LED_STATUS_BLUE_ENABLE + +config LED_STATUS_GREEN_ENABLE + bool "Enable green LED" + help + Enable green status LED. + +if LED_STATUS_GREEN_ENABLE + +config LED_STATUS_GREEN + int "Green LED identification" + help + Valid enabled LED device number (0-5). + +endif # LED_STATUS_GREEN_ENABLE + +config LED_STATUS_CMD + bool "Enable status LED commands" + +endif # LED_STATUS + endmenu |