aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/leds/leds-lp5523.txt21
-rw-r--r--drivers/leds/leds-lp5523.c10
-rw-r--r--include/linux/leds-lp5523.h1
3 files changed, 26 insertions, 6 deletions
diff --git a/Documentation/leds/leds-lp5523.txt b/Documentation/leds/leds-lp5523.txt
index fad2feb8b7ce..c2743f59f9ac 100644
--- a/Documentation/leds/leds-lp5523.txt
+++ b/Documentation/leds/leds-lp5523.txt
@@ -10,8 +10,22 @@ Contact: Samu Onkalo (samu.p.onkalo-at-nokia.com)
10Description 10Description
11----------- 11-----------
12LP5523 can drive up to 9 channels. Leds can be controlled directly via 12LP5523 can drive up to 9 channels. Leds can be controlled directly via
13the led class control interface. Channels have generic names: 13the led class control interface.
14lp5523:channelx where x is 0...8 14The name of each channel is configurable in the platform data - name and label.
15There are three options to make the channel name.
16
17a) Define the 'name' in the platform data
18To make specific channel name, then use 'name' platform data.
19/sys/class/leds/R1 (name: 'R1')
20/sys/class/leds/B1 (name: 'B1')
21
22b) Use the 'label' with no 'name' field
23For one device name with channel number, then use 'label'.
24/sys/class/leds/RGB:channelN (label: 'RGB', N: 0 ~ 8)
25
26c) Default
27If both fields are NULL, 'lp5523' is used by default.
28/sys/class/leds/lp5523:channelN (N: 0 ~ 8)
15 29
16The chip provides 3 engines. Each engine can control channels without 30The chip provides 3 engines. Each engine can control channels without
17interaction from the main CPU. Details of the micro engine code can be found 31interaction from the main CPU. Details of the micro engine code can be found
@@ -46,12 +60,13 @@ Note - chan_nr can have values between 0 and 8.
46 60
47static struct lp5523_led_config lp5523_led_config[] = { 61static struct lp5523_led_config lp5523_led_config[] = {
48 { 62 {
63 .name = "D1",
49 .chan_nr = 0, 64 .chan_nr = 0,
50 .led_current = 50, 65 .led_current = 50,
51 .max_current = 130, 66 .max_current = 130,
52 }, 67 },
53... 68...
54 }, { 69 {
55 .chan_nr = 8, 70 .chan_nr = 8,
56 .led_current = 50, 71 .led_current = 50,
57 .max_current = 130, 72 .max_current = 130,
diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c
index fbc12acada95..9fd9a92ed916 100644
--- a/drivers/leds/leds-lp5523.c
+++ b/drivers/leds/leds-lp5523.c
@@ -846,10 +846,14 @@ static int __devinit lp5523_init_led(struct lp5523_led *led, struct device *dev,
846 return -EINVAL; 846 return -EINVAL;
847 } 847 }
848 848
849 snprintf(name, sizeof(name), "%s:channel%d", 849 if (pdata->led_config[chan].name) {
850 pdata->label ?: "lp5523", chan); 850 led->cdev.name = pdata->led_config[chan].name;
851 } else {
852 snprintf(name, sizeof(name), "%s:channel%d",
853 pdata->label ?: "lp5523", chan);
854 led->cdev.name = name;
855 }
851 856
852 led->cdev.name = name;
853 led->cdev.brightness_set = lp5523_set_brightness; 857 led->cdev.brightness_set = lp5523_set_brightness;
854 res = led_classdev_register(dev, &led->cdev); 858 res = led_classdev_register(dev, &led->cdev);
855 if (res < 0) { 859 if (res < 0) {
diff --git a/include/linux/leds-lp5523.h b/include/linux/leds-lp5523.h
index 2694289babd0..727877fb406d 100644
--- a/include/linux/leds-lp5523.h
+++ b/include/linux/leds-lp5523.h
@@ -26,6 +26,7 @@
26/* See Documentation/leds/leds-lp5523.txt */ 26/* See Documentation/leds/leds-lp5523.txt */
27 27
28struct lp5523_led_config { 28struct lp5523_led_config {
29 const char *name;
29 u8 chan_nr; 30 u8 chan_nr;
30 u8 led_current; /* mA x10, 0 if led is not connected */ 31 u8 led_current; /* mA x10, 0 if led is not connected */
31 u8 max_current; 32 u8 max_current;