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, 7 insertions, 56 deletions
diff --git a/Documentation/leds/leds-lp5521.txt b/Documentation/leds/leds-lp5521.txt
index 0e542ab3d4a0..270f57196339 100644
--- a/Documentation/leds/leds-lp5521.txt
+++ b/Documentation/leds/leds-lp5521.txt
@@ -17,19 +17,8 @@ lp5521:channelx, where x is 0 .. 2
17All three channels can be also controlled using the engine micro programs. 17All three channels can be also controlled using the engine micro programs.
18More details of the instructions can be found from the public data sheet. 18More details of the instructions can be found from the public data sheet.
19 19
20Control interface for the engines: 20LP5521 has the internal program memory for running various LED patterns.
21x is 1 .. 3 21For the details, please refer to 'firmware' section in leds-lp55xx.txt
22enginex_mode : disabled, load, run
23enginex_load : store program (visible only in engine load mode)
24
25Example (start to blink the channel 2 led):
26cd /sys/class/leds/lp5521:channel2/device
27echo "load" > engine3_mode
28echo "037f4d0003ff6000" > engine3_load
29echo "run" > engine3_mode
30
31stop the engine:
32echo "disabled" > engine3_mode
33 22
34sysfs contains a selftest entry. 23sysfs contains a selftest entry.
35The test communicates with the chip and checks that 24The test communicates with the chip and checks that
@@ -47,7 +36,7 @@ The name of each channel can be configurable.
47If the name field is not defined, the default name will be set to 'xxxx:channelN' 36If 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) 37(XXXX : pdata->label or i2c client name, N : channel number)
49 38
50static struct lp5521_led_config lp5521_led_config[] = { 39static struct lp55xx_led_config lp5521_led_config[] = {
51 { 40 {
52 .name = "red", 41 .name = "red",
53 .chan_nr = 0, 42 .chan_nr = 0,
@@ -81,10 +70,10 @@ static void lp5521_enable(bool state)
81 /* Control of chip enable signal */ 70 /* Control of chip enable signal */
82} 71}
83 72
84static struct lp5521_platform_data lp5521_platform_data = { 73static struct lp55xx_platform_data lp5521_platform_data = {
85 .led_config = lp5521_led_config, 74 .led_config = lp5521_led_config,
86 .num_channels = ARRAY_SIZE(lp5521_led_config), 75 .num_channels = ARRAY_SIZE(lp5521_led_config),
87 .clock_mode = LP5521_CLOCK_EXT, 76 .clock_mode = LP55XX_CLOCK_EXT,
88 .setup_resources = lp5521_setup, 77 .setup_resources = lp5521_setup,
89 .release_resources = lp5521_release, 78 .release_resources = lp5521_release,
90 .enable = lp5521_enable, 79 .enable = lp5521_enable,
@@ -105,47 +94,9 @@ example of update_config :
105 LP5521_CP_MODE_AUTO | LP5521_R_TO_BATT | \ 94 LP5521_CP_MODE_AUTO | LP5521_R_TO_BATT | \
106 LP5521_CLK_INT) 95 LP5521_CLK_INT)
107 96
108static struct lp5521_platform_data lp5521_pdata = { 97static struct lp55xx_platform_data lp5521_pdata = {
109 .led_config = lp5521_led_config, 98 .led_config = lp5521_led_config,
110 .num_channels = ARRAY_SIZE(lp5521_led_config), 99 .num_channels = ARRAY_SIZE(lp5521_led_config),
111 .clock_mode = LP5521_CLOCK_INT, 100 .clock_mode = LP55XX_CLOCK_INT,
112 .update_config = LP5521_CONFIGS, 101 .update_config = LP5521_CONFIGS,
113}; 102};
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