]>
Commit | Line | Data |
---|---|---|
5991e154 SO |
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 | ||
c0285f8c MWK |
20 | LP5521 has the internal program memory for running various LED patterns. |
21 | For the details, please refer to 'firmware' section in leds-lp55xx.txt | |
5991e154 SO |
22 | |
23 | sysfs contains a selftest entry. | |
24 | The test communicates with the chip and checks that | |
25 | the clock mode is automatically set to the requested one. | |
26 | ||
27 | Each 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 | |
30 | Format: 10x mA i.e 10 means 1.0 mA | |
31 | ||
32 | example platform data: | |
33 | ||
34 | Note: chan_nr can have values between 0 and 2. | |
5ae4e8a7 KM |
35 | The name of each channel can be configurable. |
36 | If 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 | 39 | static 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 | ||
58 | static int lp5521_setup(void) | |
59 | { | |
60 | /* setup HW resources */ | |
61 | } | |
62 | ||
63 | static void lp5521_release(void) | |
64 | { | |
65 | /* Release HW resources */ | |
66 | } | |
67 | ||
68 | static void lp5521_enable(bool state) | |
69 | { | |
70 | /* Control of chip enable signal */ | |
71 | } | |
72 | ||
c0285f8c | 73 | static 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 | ||
82 | If the current is set to 0 in the platform data, that channel is | |
83 | disabled and it is not visible in the sysfs. |