aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/leds/leds-lp5521.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/leds/leds-lp5521.txt')
-rw-r--r--Documentation/leds/leds-lp5521.txt63
1 files changed, 63 insertions, 0 deletions
diff --git a/Documentation/leds/leds-lp5521.txt b/Documentation/leds/leds-lp5521.txt
index c4d8d151e0fe..0e542ab3d4a0 100644
--- a/Documentation/leds/leds-lp5521.txt
+++ b/Documentation/leds/leds-lp5521.txt
@@ -43,17 +43,23 @@ Format: 10x mA i.e 10 means 1.0 mA
43example platform data: 43example platform data:
44 44
45Note: chan_nr can have values between 0 and 2. 45Note: chan_nr can have values between 0 and 2.
46The name of each channel can be configurable.
47If the name field is not defined, the default name will be set to 'xxxx:channelN'
48(XXXX : pdata->label or i2c client name, N : channel number)
46 49
47static struct lp5521_led_config lp5521_led_config[] = { 50static struct lp5521_led_config lp5521_led_config[] = {
48 { 51 {
52 .name = "red",
49 .chan_nr = 0, 53 .chan_nr = 0,
50 .led_current = 50, 54 .led_current = 50,
51 .max_current = 130, 55 .max_current = 130,
52 }, { 56 }, {
57 .name = "green",
53 .chan_nr = 1, 58 .chan_nr = 1,
54 .led_current = 0, 59 .led_current = 0,
55 .max_current = 130, 60 .max_current = 130,
56 }, { 61 }, {
62 .name = "blue",
57 .chan_nr = 2, 63 .chan_nr = 2,
58 .led_current = 0, 64 .led_current = 0,
59 .max_current = 130, 65 .max_current = 130,
@@ -86,3 +92,60 @@ static struct lp5521_platform_data lp5521_platform_data = {
86 92
87If the current is set to 0 in the platform data, that channel is 93If the current is set to 0 in the platform data, that channel is
88disabled and it is not visible in the sysfs. 94disabled and it is not visible in the sysfs.
95
96The 'update_config' : CONFIG register (ADDR 08h)
97This value is platform-specific data.
98If update_config is not defined, the CONFIG register is set with
99'LP5521_PWRSAVE_EN | LP5521_CP_MODE_AUTO | LP5521_R_TO_BATT'.
100(Enable auto-powersave, set charge pump to auto, red to battery)
101
102example of update_config :
103
104#define LP5521_CONFIGS (LP5521_PWM_HF | LP5521_PWRSAVE_EN | \
105 LP5521_CP_MODE_AUTO | LP5521_R_TO_BATT | \
106 LP5521_CLK_INT)
107
108static struct lp5521_platform_data lp5521_pdata = {
109 .led_config = lp5521_led_config,
110 .num_channels = ARRAY_SIZE(lp5521_led_config),
111 .clock_mode = LP5521_CLOCK_INT,
112 .update_config = LP5521_CONFIGS,
113};
114
115LED patterns : LP5521 has autonomous operation without external control.
116Pattern data can be defined in the platform data.
117
118example of led pattern data :
119
120/* RGB(50,5,0) 500ms on, 500ms off, infinite loop */
121static u8 pattern_red[] = {
122 0x40, 0x32, 0x60, 0x00, 0x40, 0x00, 0x60, 0x00,
123 };
124
125static u8 pattern_green[] = {
126 0x40, 0x05, 0x60, 0x00, 0x40, 0x00, 0x60, 0x00,
127 };
128
129static struct lp5521_led_pattern board_led_patterns[] = {
130 {
131 .r = pattern_red,
132 .g = pattern_green,
133 .size_r = ARRAY_SIZE(pattern_red),
134 .size_g = ARRAY_SIZE(pattern_green),
135 },
136};
137
138static struct lp5521_platform_data lp5521_platform_data = {
139 .led_config = lp5521_led_config,
140 .num_channels = ARRAY_SIZE(lp5521_led_config),
141 .clock_mode = LP5521_CLOCK_EXT,
142 .patterns = board_led_patterns,
143 .num_patterns = ARRAY_SIZE(board_led_patterns),
144};
145
146Then predefined led pattern(s) can be executed via the sysfs.
147To start the pattern #1,
148# echo 1 > /sys/bus/i2c/devices/xxxx/led_pattern
149(xxxx : i2c bus & slave address)
150To end the pattern,
151# echo 0 > /sys/bus/i2c/devices/xxxx/led_pattern