Commit | Line | Data |
---|---|---|
5991e154 SO |
1 | Kernel driver for lp5523 |
2 | ======================== | |
3 | ||
4 | * National Semiconductor LP5523 led driver chip | |
5 | * Datasheet: http://www.national.com/pf/LP/LP5523.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 | LP5523 can drive up to 9 channels. Leds can be controlled directly via | |
94b43b67 KM |
13 | the led class control interface. |
14 | The name of each channel is configurable in the platform data - name and label. | |
15 | There are three options to make the channel name. | |
16 | ||
17 | a) Define the 'name' in the platform data | |
18 | To make specific channel name, then use 'name' platform data. | |
19 | /sys/class/leds/R1 (name: 'R1') | |
20 | /sys/class/leds/B1 (name: 'B1') | |
21 | ||
22 | b) Use the 'label' with no 'name' field | |
23 | For one device name with channel number, then use 'label'. | |
24 | /sys/class/leds/RGB:channelN (label: 'RGB', N: 0 ~ 8) | |
25 | ||
26 | c) Default | |
27 | If both fields are NULL, 'lp5523' is used by default. | |
28 | /sys/class/leds/lp5523:channelN (N: 0 ~ 8) | |
5991e154 | 29 | |
c0285f8c MWK |
30 | LP5523 has the internal program memory for running various LED patterns. |
31 | For the details, please refer to 'firmware' section in leds-lp55xx.txt | |
5991e154 SO |
32 | |
33 | Selftest uses always the current from the platform data. | |
34 | ||
35 | Each channel contains led current settings. | |
36 | /sys/class/leds/lp5523:channel2/led_current - RW | |
37 | /sys/class/leds/lp5523:channel2/max_current - RO | |
38 | Format: 10x mA i.e 10 means 1.0 mA | |
39 | ||
40 | Example platform data: | |
41 | ||
42 | Note - chan_nr can have values between 0 and 8. | |
43 | ||
c0285f8c | 44 | static struct lp55xx_led_config lp5523_led_config[] = { |
5991e154 | 45 | { |
94b43b67 | 46 | .name = "D1", |
5991e154 SO |
47 | .chan_nr = 0, |
48 | .led_current = 50, | |
49 | .max_current = 130, | |
50 | }, | |
51 | ... | |
94b43b67 | 52 | { |
5991e154 SO |
53 | .chan_nr = 8, |
54 | .led_current = 50, | |
55 | .max_current = 130, | |
56 | } | |
57 | }; | |
58 | ||
59 | static int lp5523_setup(void) | |
60 | { | |
61 | /* Setup HW resources */ | |
62 | } | |
63 | ||
64 | static void lp5523_release(void) | |
65 | { | |
66 | /* Release HW resources */ | |
67 | } | |
68 | ||
69 | static void lp5523_enable(bool state) | |
70 | { | |
71 | /* Control chip enable signal */ | |
72 | } | |
73 | ||
c0285f8c | 74 | static struct lp55xx_platform_data lp5523_platform_data = { |
5991e154 SO |
75 | .led_config = lp5523_led_config, |
76 | .num_channels = ARRAY_SIZE(lp5523_led_config), | |
c0285f8c | 77 | .clock_mode = LP55XX_CLOCK_EXT, |
5991e154 SO |
78 | .setup_resources = lp5523_setup, |
79 | .release_resources = lp5523_release, | |
80 | .enable = lp5523_enable, | |
81 | }; |