Merge remote branch 'tip/x86/tsc' into fortglx/2.6.38/tip/x86/tsc
[pandora-kernel.git] / Documentation / leds / leds-lp5521.txt
1 Kernel driver for lp5521
2 ========================
3
4 * National Semiconductor LP5521 led driver chip
5 * Datasheet: http://www.national.com/pf/LP/LP5521.html
6
7 Authors: Mathias Nyman, Yuri Zaporozhets, Samu Onkalo
8 Contact: Samu Onkalo (samu.p.onkalo-at-nokia.com)
9
10 Description
11 -----------
12
13 LP5521 can drive up to 3 channels. Leds can be controlled directly via
14 the led class control interface. Channels have generic names:
15 lp5521:channelx, where x is 0 .. 2
16
17 All three channels can be also controlled using the engine micro programs.
18 More details of the instructions can be found from the public data sheet.
19
20 Control interface for the engines:
21 x is 1 .. 3
22 enginex_mode : disabled, load, run
23 enginex_load : store program (visible only in engine load mode)
24
25 Example (start to blink the channel 2 led):
26 cd   /sys/class/leds/lp5521:channel2/device
27 echo "load" > engine3_mode
28 echo "037f4d0003ff6000" > engine3_load
29 echo "run" > engine3_mode
30
31 stop the engine:
32 echo "disabled" > engine3_mode
33
34 sysfs contains a selftest entry.
35 The test communicates with the chip and checks that
36 the clock mode is automatically set to the requested one.
37
38 Each channel has its own led current settings.
39 /sys/class/leds/lp5521:channel0/led_current - RW
40 /sys/class/leds/lp5521:channel0/max_current - RO
41 Format: 10x mA i.e 10 means 1.0 mA
42
43 example platform data:
44
45 Note: chan_nr can have values between 0 and 2.
46
47 static struct lp5521_led_config lp5521_led_config[] = {
48         {
49                 .chan_nr        = 0,
50                 .led_current    = 50,
51                 .max_current    = 130,
52         }, {
53                 .chan_nr        = 1,
54                 .led_current    = 0,
55                 .max_current    = 130,
56         }, {
57                 .chan_nr        = 2,
58                 .led_current    = 0,
59                 .max_current    = 130,
60         }
61 };
62
63 static int lp5521_setup(void)
64 {
65         /* setup HW resources */
66 }
67
68 static void lp5521_release(void)
69 {
70         /* Release HW resources */
71 }
72
73 static void lp5521_enable(bool state)
74 {
75         /* Control of chip enable signal */
76 }
77
78 static struct lp5521_platform_data lp5521_platform_data = {
79         .led_config     = lp5521_led_config,
80         .num_channels   = ARRAY_SIZE(lp5521_led_config),
81         .clock_mode     = LP5521_CLOCK_EXT,
82         .setup_resources   = lp5521_setup,
83         .release_resources = lp5521_release,
84         .enable            = lp5521_enable,
85 };
86
87 If the current is set to 0 in the platform data, that channel is
88 disabled and it is not visible in the sysfs.