xref: /OK3568_Linux_fs/u-boot/doc/README.LED (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunStatus LED
2*4882a593Smuzhiyun========================================
3*4882a593Smuzhiyun
4*4882a593SmuzhiyunThis README describes the status LED API.
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunThe API is defined by the include file include/status_led.h
7*4882a593Smuzhiyun
8*4882a593SmuzhiyunThe first step is to enable CONFIG_LED_STATUS in menuconfig:
9*4882a593Smuzhiyun> Device Drivers > LED Support.
10*4882a593Smuzhiyun
11*4882a593SmuzhiyunIf the LED support is only for specific board, enable
12*4882a593SmuzhiyunCONFIG_LED_STATUS_BOARD_SPECIFIC in the menuconfig.
13*4882a593Smuzhiyun
14*4882a593SmuzhiyunStatus LEDS 0 to 5 are enabled by the following configurations at menuconfig:
15*4882a593SmuzhiyunCONFIG_STATUS_LED0, CONFIG_STATUS_LED1, ... CONFIG_STATUS_LED5
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunThe following should be configured for each of the enabled LEDs:
18*4882a593SmuzhiyunCONFIG_STATUS_LED_BIT<n>
19*4882a593SmuzhiyunCONFIG_STATUS_LED_STATE<n>
20*4882a593SmuzhiyunCONFIG_STATUS_LED_FREQ<n>
21*4882a593SmuzhiyunWhere <n> is an integer 1 through 5 (empty for 0).
22*4882a593Smuzhiyun
23*4882a593SmuzhiyunCONFIG_STATUS_LED_BIT is passed into the __led_* functions to identify which LED
24*4882a593Smuzhiyunis being acted on. As such, the value choose must be unique with with respect to
25*4882a593Smuzhiyunthe other CONFIG_STATUS_LED_BIT's. Mapping the value to a physical LED is the
26*4882a593Smuzhiyunreponsiblity of the __led_* function.
27*4882a593Smuzhiyun
28*4882a593SmuzhiyunCONFIG_STATUS_LED_STATE is the initial state of the LED. It should be set to one
29*4882a593Smuzhiyunof these values: CONFIG_LED_STATUS_OFF or CONFIG_LED_STATUS_ON.
30*4882a593Smuzhiyun
31*4882a593SmuzhiyunCONFIG_STATUS_LED_FREQ determines the LED blink frequency.
32*4882a593SmuzhiyunValues range from 2 to 10.
33*4882a593Smuzhiyun
34*4882a593SmuzhiyunSome other LED macros
35*4882a593Smuzhiyun---------------------
36*4882a593Smuzhiyun
37*4882a593SmuzhiyunCONFIG_STATUS_LED_BOOT is the LED to light when the board is booting.
38*4882a593SmuzhiyunThis must be a valid LED number (0-5).
39*4882a593Smuzhiyun
40*4882a593SmuzhiyunCONFIG_STATUS_LED_RED is the red LED. It is used to signal errors. This must be
41*4882a593Smuzhiyuna valid LED number (0-5). Other similar color LED's macros are
42*4882a593SmuzhiyunCONFIG_STATUS_LED_GREEN, CONFIG_STATUS_LED_YELLOW and CONFIG_STATUS_LED_BLUE.
43*4882a593Smuzhiyun
44*4882a593SmuzhiyunGeneral LED functions
45*4882a593Smuzhiyun---------------------
46*4882a593SmuzhiyunThe following functions should be defined:
47*4882a593Smuzhiyun
48*4882a593Smuzhiyun__led_init is called once to initialize the LED to CONFIG_STATUS_LED_STATE.
49*4882a593SmuzhiyunOne time start up code should be placed here.
50*4882a593Smuzhiyun
51*4882a593Smuzhiyun__led_set is called to change the state of the LED.
52*4882a593Smuzhiyun
53*4882a593Smuzhiyun__led_toggle is called to toggle the current state of the LED.
54*4882a593Smuzhiyun
55*4882a593SmuzhiyunColour LED
56*4882a593Smuzhiyun========================================
57*4882a593Smuzhiyun
58*4882a593SmuzhiyunColour LED's are at present only used by ARM.
59*4882a593Smuzhiyun
60*4882a593SmuzhiyunThe functions names explain their purpose.
61*4882a593Smuzhiyun
62*4882a593Smuzhiyuncoloured_LED_init
63*4882a593Smuzhiyunred_LED_on
64*4882a593Smuzhiyunred_LED_off
65*4882a593Smuzhiyungreen_LED_on
66*4882a593Smuzhiyungreen_LED_off
67*4882a593Smuzhiyunyellow_LED_on
68*4882a593Smuzhiyunyellow_LED_off
69*4882a593Smuzhiyunblue_LED_on
70*4882a593Smuzhiyunblue_LED_off
71*4882a593Smuzhiyun
72*4882a593SmuzhiyunThese are weakly defined in arch/arm/lib/board.c to noops. Where applicable, define
73*4882a593Smuzhiyunthese functions in the board specific source.
74*4882a593Smuzhiyun
75*4882a593SmuzhiyunTBD : Describe older board dependent macros similar to what is done for
76*4882a593Smuzhiyun
77*4882a593SmuzhiyunTBD : Describe general support via asm/status_led.h
78