aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilo(Woogyom) Kim <milo.kim@ti.com>2013-02-05 06:22:48 -0500
committerBryan Wu <cooloney@gmail.com>2013-02-06 18:59:30 -0500
commitc0285f8ca8b8a4a1830b6071d6680bde447ff51c (patch)
treea8636f2402639f03701e043870ef0492a8005400
parent109b833071b44a4a6f5dc56385025543ed15a500 (diff)
Documentation: leds: update LP55xx family devices
Update changed platform data information. Add leds-lp55xx.txt which includes the firmware interface description. Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com> Signed-off-by: Bryan Wu <cooloney@gmail.com>
-rw-r--r--Documentation/leds/00-INDEX2
-rw-r--r--Documentation/leds/leds-lp5521.txt63
-rw-r--r--Documentation/leds/leds-lp5523.txt27
-rw-r--r--Documentation/leds/leds-lp55xx.txt118
4 files changed, 132 insertions, 78 deletions
diff --git a/Documentation/leds/00-INDEX b/Documentation/leds/00-INDEX
index 5fefe374892f..5246090ef15c 100644
--- a/Documentation/leds/00-INDEX
+++ b/Documentation/leds/00-INDEX
@@ -6,5 +6,7 @@ leds-lp5521.txt
6 - notes on how to use the leds-lp5521 driver. 6 - notes on how to use the leds-lp5521 driver.
7leds-lp5523.txt 7leds-lp5523.txt
8 - notes on how to use the leds-lp5523 driver. 8 - notes on how to use the leds-lp5523 driver.
9leds-lp55xx.txt
10 - description about lp55xx common driver.
9leds-lm3556.txt 11leds-lm3556.txt
10 - notes on how to use the leds-lm3556 driver. 12 - notes on how to use the leds-lm3556 driver.
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
diff --git a/Documentation/leds/leds-lp5523.txt b/Documentation/leds/leds-lp5523.txt
index c2743f59f9ac..899fdad509fe 100644
--- a/Documentation/leds/leds-lp5523.txt
+++ b/Documentation/leds/leds-lp5523.txt
@@ -27,25 +27,8 @@ c) Default
27If both fields are NULL, 'lp5523' is used by default. 27If both fields are NULL, 'lp5523' is used by default.
28/sys/class/leds/lp5523:channelN (N: 0 ~ 8) 28/sys/class/leds/lp5523:channelN (N: 0 ~ 8)
29 29
30The chip provides 3 engines. Each engine can control channels without 30LP5523 has the internal program memory for running various LED patterns.
31interaction from the main CPU. Details of the micro engine code can be found 31For the details, please refer to 'firmware' section in leds-lp55xx.txt
32from the public data sheet. Leds can be muxed to different channels.
33
34Control interface for the engines:
35x is 1 .. 3
36enginex_mode : disabled, load, run
37enginex_load : microcode load (visible only in load mode)
38enginex_leds : led mux control (visible only in load mode)
39
40cd /sys/class/leds/lp5523:channel2/device
41echo "load" > engine3_mode
42echo "9d80400004ff05ff437f0000" > engine3_load
43echo "111111111" > engine3_leds
44echo "run" > engine3_mode
45
46sysfs contains a selftest entry. It measures each channel
47voltage level and checks if it looks reasonable. If the level is too high,
48the led is missing; if the level is too low, there is a short circuit.
49 32
50Selftest uses always the current from the platform data. 33Selftest uses always the current from the platform data.
51 34
@@ -58,7 +41,7 @@ Example platform data:
58 41
59Note - chan_nr can have values between 0 and 8. 42Note - chan_nr can have values between 0 and 8.
60 43
61static struct lp5523_led_config lp5523_led_config[] = { 44static struct lp55xx_led_config lp5523_led_config[] = {
62 { 45 {
63 .name = "D1", 46 .name = "D1",
64 .chan_nr = 0, 47 .chan_nr = 0,
@@ -88,10 +71,10 @@ static void lp5523_enable(bool state)
88 /* Control chip enable signal */ 71 /* Control chip enable signal */
89} 72}
90 73
91static struct lp5523_platform_data lp5523_platform_data = { 74static struct lp55xx_platform_data lp5523_platform_data = {
92 .led_config = lp5523_led_config, 75 .led_config = lp5523_led_config,
93 .num_channels = ARRAY_SIZE(lp5523_led_config), 76 .num_channels = ARRAY_SIZE(lp5523_led_config),
94 .clock_mode = LP5523_CLOCK_EXT, 77 .clock_mode = LP55XX_CLOCK_EXT,
95 .setup_resources = lp5523_setup, 78 .setup_resources = lp5523_setup,
96 .release_resources = lp5523_release, 79 .release_resources = lp5523_release,
97 .enable = lp5523_enable, 80 .enable = lp5523_enable,
diff --git a/Documentation/leds/leds-lp55xx.txt b/Documentation/leds/leds-lp55xx.txt
new file mode 100644
index 000000000000..ced41868d2d1
--- /dev/null
+++ b/Documentation/leds/leds-lp55xx.txt
@@ -0,0 +1,118 @@
1LP5521/LP5523/LP55231 Common Driver
2===================================
3
4Authors: Milo(Woogyom) Kim <milo.kim@ti.com>
5
6Description
7-----------
8LP5521, LP5523/55231 have common features as below.
9
10 Register access via the I2C
11 Device initialization/deinitialization
12 Create LED class devices for multiple output channels
13 Device attributes for user-space interface
14 Program memory for running LED patterns
15
16The LP55xx common driver provides these features using exported functions.
17 lp55xx_init_device() / lp55xx_deinit_device()
18 lp55xx_register_leds() / lp55xx_unregister_leds()
19 lp55xx_regsister_sysfs() / lp55xx_unregister_sysfs()
20
21( Driver Structure Data )
22
23In lp55xx common driver, two different data structure is used.
24
25o lp55xx_led
26 control multi output LED channels such as led current, channel index.
27o lp55xx_chip
28 general chip control such like the I2C and platform data.
29
30For example, LP5521 has maximum 3 LED channels.
31LP5523/55231 has 9 output channels.
32
33lp55xx_chip for LP5521 ... lp55xx_led #1
34 lp55xx_led #2
35 lp55xx_led #3
36
37lp55xx_chip for LP5523 ... lp55xx_led #1
38 lp55xx_led #2
39 .
40 .
41 lp55xx_led #9
42
43( Chip Dependent Code )
44
45To support device specific configurations, special structure
46'lpxx_device_config' is used.
47
48 Maximum number of channels
49 Reset command, chip enable command
50 Chip specific initialization
51 Brightness control register access
52 Setting LED output current
53 Program memory address access for running patterns
54 Additional device specific attributes
55
56( Firmware Interface )
57
58LP55xx family devices have the internal program memory for running
59various LED patterns.
60This pattern data is saved as a file in the user-land or
61hex byte string is written into the memory through the I2C.
62LP55xx common driver supports the firmware interface.
63
64LP55xx chips have three program engines.
65To load and run the pattern, the programming sequence is following.
66 (1) Select an engine number (1/2/3)
67 (2) Mode change to load
68 (3) Write pattern data into selected area
69 (4) Mode change to run
70
71The LP55xx common driver provides simple interfaces as below.
72select_engine : Select which engine is used for running program
73run_engine : Start program which is loaded via the firmware interface
74firmware : Load program data
75
76For example, run blinking pattern in engine #1 of LP5521
77echo 1 > /sys/bus/i2c/devices/xxxx/select_engine
78echo 1 > /sys/class/firmware/lp5521/loading
79echo "4000600040FF6000" > /sys/class/firmware/lp5521/data
80echo 0 > /sys/class/firmware/lp5521/loading
81echo 1 > /sys/bus/i2c/devices/xxxx/run_engine
82
83For example, run blinking pattern in engine #3 of LP55231
84echo 3 > /sys/bus/i2c/devices/xxxx/select_engine
85echo 1 > /sys/class/firmware/lp55231/loading
86echo "9d0740ff7e0040007e00a0010000" > /sys/class/firmware/lp55231/data
87echo 0 > /sys/class/firmware/lp55231/loading
88echo 1 > /sys/bus/i2c/devices/xxxx/run_engine
89
90To start blinking patterns in engine #2 and #3 simultaneously,
91for idx in 2 3
92do
93 echo $idx > /sys/class/leds/red/device/select_engine
94 sleep 0.1
95 echo 1 > /sys/class/firmware/lp5521/loading
96 echo "4000600040FF6000" > /sys/class/firmware/lp5521/data
97 echo 0 > /sys/class/firmware/lp5521/loading
98done
99echo 1 > /sys/class/leds/red/device/run_engine
100
101Here is another example for LP5523.
102echo 2 > /sys/bus/i2c/devices/xxxx/select_engine
103echo 1 > /sys/class/firmware/lp5523/loading
104echo "9d80400004ff05ff437f0000" > /sys/class/firmware/lp5523/data
105echo 0 > /sys/class/firmware/lp5523/loading
106echo 1 > /sys/bus/i2c/devices/xxxx/run_engine
107
108As soon as 'loading' is set to 0, registered callback is called.
109Inside the callback, the selected engine is loaded and memory is updated.
110To run programmed pattern, 'run_engine' attribute should be enabled.
111
112( 'run_engine' and 'firmware_cb' )
113The sequence of running the program data is common.
114But each device has own specific register addresses for commands.
115To support this, 'run_engine' and 'firmware_cb' are configurable in each driver.
116run_engine : Control the selected engine
117firmware_cb : The callback function after loading the firmware is done.
118 Chip specific commands for loading and updating program memory.