xref: /openbmc/u-boot/doc/README.LED (revision 5b8e76c35ec312a3f73126bd1a2d2c0965b98a9f)
165fd21c8STom RixStatus LED
265fd21c8STom Rix========================================
365fd21c8STom Rix
465fd21c8STom RixThis README describes the status LED API.
565fd21c8STom Rix
665fd21c8STom RixThe API is defined by the include file include/status_led.h
765fd21c8STom Rix
8*79267eddSUri MashiachThe first step is to enable CONFIG_LED_STATUS in menuconfig:
9*79267eddSUri Mashiach> Device Drivers > LED Support.
1065fd21c8STom Rix
11*79267eddSUri MashiachIf the LED support is only for specific board, enable
12*79267eddSUri MashiachCONFIG_LED_STATUS_BOARD_SPECIFIC in the menuconfig.
1365fd21c8STom Rix
14*79267eddSUri MashiachStatus LEDS 0 to 5 are enabled by the following configurations at menuconfig:
15*79267eddSUri MashiachCONFIG_STATUS_LED0, CONFIG_STATUS_LED1, ... CONFIG_STATUS_LED5
1665fd21c8STom Rix
17*79267eddSUri MashiachThe following should be configured for each of the enabled LEDs:
18*79267eddSUri MashiachCONFIG_STATUS_LED_BIT<n>
19*79267eddSUri MashiachCONFIG_STATUS_LED_STATE<n>
20*79267eddSUri MashiachCONFIG_STATUS_LED_FREQ<n>
21*79267eddSUri MashiachWhere <n> is an integer 1 through 5 (empty for 0).
2265fd21c8STom Rix
23*79267eddSUri MashiachCONFIG_STATUS_LED_BIT is passed into the __led_* functions to identify which LED
24*79267eddSUri Mashiachis being acted on. As such, the value choose must be unique with with respect to
25*79267eddSUri Mashiachthe other CONFIG_STATUS_LED_BIT's. Mapping the value to a physical LED is the
2665fd21c8STom Rixreponsiblity of the __led_* function.
2765fd21c8STom Rix
28*79267eddSUri MashiachCONFIG_STATUS_LED_STATE is the initial state of the LED. It should be set to one
29*79267eddSUri Mashiachof these values: CONFIG_LED_STATUS_OFF or CONFIG_LED_STATUS_ON.
3065fd21c8STom Rix
31*79267eddSUri MashiachCONFIG_STATUS_LED_FREQ determines the LED blink frequency.
32*79267eddSUri MashiachValues range from 2 to 10.
3365fd21c8STom Rix
3465fd21c8STom RixSome other LED macros
35*79267eddSUri Mashiach---------------------
3665fd21c8STom Rix
37*79267eddSUri MashiachCONFIG_STATUS_LED_BOOT is the LED to light when the board is booting.
38*79267eddSUri MashiachThis must be a valid LED number (0-5).
3965fd21c8STom Rix
40*79267eddSUri MashiachCONFIG_STATUS_LED_RED is the red LED. It is used to signal errors. This must be
41*79267eddSUri Mashiacha valid LED number (0-5). Other similar color LED's macros are
42*79267eddSUri MashiachCONFIG_STATUS_LED_GREEN, CONFIG_STATUS_LED_YELLOW and CONFIG_STATUS_LED_BLUE.
4365fd21c8STom Rix
44*79267eddSUri MashiachGeneral LED functions
45*79267eddSUri Mashiach---------------------
46*79267eddSUri MashiachThe following functions should be defined:
4765fd21c8STom Rix
48*79267eddSUri Mashiach__led_init is called once to initialize the LED to CONFIG_STATUS_LED_STATE.
49*79267eddSUri MashiachOne time start up code should be placed here.
5065fd21c8STom Rix
5165fd21c8STom Rix__led_set is called to change the state of the LED.
5265fd21c8STom Rix
5365fd21c8STom Rix__led_toggle is called to toggle the current state of the LED.
5465fd21c8STom Rix
5565fd21c8STom RixColour LED
5665fd21c8STom Rix========================================
5765fd21c8STom Rix
5865fd21c8STom RixColour LED's are at present only used by ARM.
5965fd21c8STom Rix
6065fd21c8STom RixThe functions names explain their purpose.
6165fd21c8STom Rix
6265fd21c8STom Rixcoloured_LED_init
6365fd21c8STom Rixred_LED_on
6465fd21c8STom Rixred_LED_off
6565fd21c8STom Rixgreen_LED_on
6665fd21c8STom Rixgreen_LED_off
6765fd21c8STom Rixyellow_LED_on
6865fd21c8STom Rixyellow_LED_off
6965fd21c8STom Rixblue_LED_on
7065fd21c8STom Rixblue_LED_off
7165fd21c8STom Rix
72ea0364f1SPeter TyserThese are weakly defined in arch/arm/lib/board.c to noops. Where applicable, define
7365fd21c8STom Rixthese functions in the board specific source.
7465fd21c8STom Rix
7565fd21c8STom RixTBD : Describe older board dependent macros similar to what is done for
7665fd21c8STom Rix
7765fd21c8STom RixTBD : Describe general support via asm/status_led.h
78