Merge tag 'fixes-for-v3.9-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi...
[deliverable/linux.git] / Documentation / leds / leds-lp5521.txt
CommitLineData
5991e154
SO
1Kernel driver for lp5521
2========================
3
4* National Semiconductor LP5521 led driver chip
5* Datasheet: http://www.national.com/pf/LP/LP5521.html
6
7Authors: Mathias Nyman, Yuri Zaporozhets, Samu Onkalo
8Contact: Samu Onkalo (samu.p.onkalo-at-nokia.com)
9
10Description
11-----------
12
13LP5521 can drive up to 3 channels. Leds can be controlled directly via
14the led class control interface. Channels have generic names:
15lp5521:channelx, where x is 0 .. 2
16
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.
19
c0285f8c
MWK
20LP5521 has the internal program memory for running various LED patterns.
21For the details, please refer to 'firmware' section in leds-lp55xx.txt
5991e154
SO
22
23sysfs contains a selftest entry.
24The test communicates with the chip and checks that
25the clock mode is automatically set to the requested one.
26
27Each channel has its own led current settings.
28/sys/class/leds/lp5521:channel0/led_current - RW
29/sys/class/leds/lp5521:channel0/max_current - RO
30Format: 10x mA i.e 10 means 1.0 mA
31
32example platform data:
33
34Note: chan_nr can have values between 0 and 2.
5ae4e8a7
KM
35The name of each channel can be configurable.
36If the name field is not defined, the default name will be set to 'xxxx:channelN'
37(XXXX : pdata->label or i2c client name, N : channel number)
5991e154 38
c0285f8c 39static struct lp55xx_led_config lp5521_led_config[] = {
5991e154 40 {
5ae4e8a7 41 .name = "red",
5991e154
SO
42 .chan_nr = 0,
43 .led_current = 50,
44 .max_current = 130,
45 }, {
5ae4e8a7 46 .name = "green",
5991e154
SO
47 .chan_nr = 1,
48 .led_current = 0,
49 .max_current = 130,
50 }, {
5ae4e8a7 51 .name = "blue",
5991e154
SO
52 .chan_nr = 2,
53 .led_current = 0,
54 .max_current = 130,
55 }
56};
57
58static int lp5521_setup(void)
59{
60 /* setup HW resources */
61}
62
63static void lp5521_release(void)
64{
65 /* Release HW resources */
66}
67
68static void lp5521_enable(bool state)
69{
70 /* Control of chip enable signal */
71}
72
c0285f8c 73static struct lp55xx_platform_data lp5521_platform_data = {
5991e154
SO
74 .led_config = lp5521_led_config,
75 .num_channels = ARRAY_SIZE(lp5521_led_config),
c0285f8c 76 .clock_mode = LP55XX_CLOCK_EXT,
5991e154
SO
77 .setup_resources = lp5521_setup,
78 .release_resources = lp5521_release,
79 .enable = lp5521_enable,
80};
81
82If the current is set to 0 in the platform data, that channel is
83disabled and it is not visible in the sysfs.
3b49aacd
KM
84
85The 'update_config' : CONFIG register (ADDR 08h)
86This value is platform-specific data.
87If update_config is not defined, the CONFIG register is set with
88'LP5521_PWRSAVE_EN | LP5521_CP_MODE_AUTO | LP5521_R_TO_BATT'.
89(Enable auto-powersave, set charge pump to auto, red to battery)
90
91example of update_config :
92
93#define LP5521_CONFIGS (LP5521_PWM_HF | LP5521_PWRSAVE_EN | \
94 LP5521_CP_MODE_AUTO | LP5521_R_TO_BATT | \
95 LP5521_CLK_INT)
96
c0285f8c 97static struct lp55xx_platform_data lp5521_pdata = {
3b49aacd
KM
98 .led_config = lp5521_led_config,
99 .num_channels = ARRAY_SIZE(lp5521_led_config),
c0285f8c 100 .clock_mode = LP55XX_CLOCK_INT,
3b49aacd
KM
101 .update_config = LP5521_CONFIGS,
102};
This page took 0.216192 seconds and 5 git commands to generate.