diff options
-rw-r--r-- | Documentation/leds/leds-lp5523.txt | 21 | ||||
-rw-r--r-- | drivers/leds/leds-lp5523.c | 10 | ||||
-rw-r--r-- | include/linux/leds-lp5523.h | 1 |
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) | |||
10 | Description | 10 | Description |
11 | ----------- | 11 | ----------- |
12 | LP5523 can drive up to 9 channels. Leds can be controlled directly via | 12 | LP5523 can drive up to 9 channels. Leds can be controlled directly via |
13 | the led class control interface. Channels have generic names: | 13 | the led class control interface. |
14 | lp5523:channelx where x is 0...8 | 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) | ||
15 | 29 | ||
16 | The chip provides 3 engines. Each engine can control channels without | 30 | The chip provides 3 engines. Each engine can control channels without |
17 | interaction from the main CPU. Details of the micro engine code can be found | 31 | interaction 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 | ||
47 | static struct lp5523_led_config lp5523_led_config[] = { | 61 | static 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 | ||
28 | struct lp5523_led_config { | 28 | struct 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; |