From fc3a6c6e7710acceb0bc3b54ef186f8bbe7ee5ed Mon Sep 17 00:00:00 2001 From: "Kim, Milo" Date: Wed, 22 Aug 2012 15:32:29 +0800 Subject: [PATCH] --- yaml --- r: 333069 b: refs/heads/master c: 94b43b677104e50b9f8dd75aacb3c69e16089a68 h: refs/heads/master i: 333067: 378d199e49ea1d7cb03c6f680bb764bc8f4aa38d v: v3 --- [refs] | 2 +- trunk/Documentation/leds/leds-lp5523.txt | 21 ++++++++++++++++++--- trunk/drivers/leds/leds-lp5523.c | 10 +++++++--- trunk/include/linux/leds-lp5523.h | 1 + 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index a6e23c2cf36e..5600e3501917 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 127aedc8ecae2628511533ddeb239e99e4bed5e8 +refs/heads/master: 94b43b677104e50b9f8dd75aacb3c69e16089a68 diff --git a/trunk/Documentation/leds/leds-lp5523.txt b/trunk/Documentation/leds/leds-lp5523.txt index fad2feb8b7ce..c2743f59f9ac 100644 --- a/trunk/Documentation/leds/leds-lp5523.txt +++ b/trunk/Documentation/leds/leds-lp5523.txt @@ -10,8 +10,22 @@ Contact: Samu Onkalo (samu.p.onkalo-at-nokia.com) Description ----------- LP5523 can drive up to 9 channels. Leds can be controlled directly via -the led class control interface. Channels have generic names: -lp5523:channelx where x is 0...8 +the led class control interface. +The name of each channel is configurable in the platform data - name and label. +There are three options to make the channel name. + +a) Define the 'name' in the platform data +To make specific channel name, then use 'name' platform data. +/sys/class/leds/R1 (name: 'R1') +/sys/class/leds/B1 (name: 'B1') + +b) Use the 'label' with no 'name' field +For one device name with channel number, then use 'label'. +/sys/class/leds/RGB:channelN (label: 'RGB', N: 0 ~ 8) + +c) Default +If both fields are NULL, 'lp5523' is used by default. +/sys/class/leds/lp5523:channelN (N: 0 ~ 8) The chip provides 3 engines. Each engine can control channels without 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. static struct lp5523_led_config lp5523_led_config[] = { { + .name = "D1", .chan_nr = 0, .led_current = 50, .max_current = 130, }, ... - }, { + { .chan_nr = 8, .led_current = 50, .max_current = 130, diff --git a/trunk/drivers/leds/leds-lp5523.c b/trunk/drivers/leds/leds-lp5523.c index fbc12acada95..9fd9a92ed916 100644 --- a/trunk/drivers/leds/leds-lp5523.c +++ b/trunk/drivers/leds/leds-lp5523.c @@ -846,10 +846,14 @@ static int __devinit lp5523_init_led(struct lp5523_led *led, struct device *dev, return -EINVAL; } - snprintf(name, sizeof(name), "%s:channel%d", - pdata->label ?: "lp5523", chan); + if (pdata->led_config[chan].name) { + led->cdev.name = pdata->led_config[chan].name; + } else { + snprintf(name, sizeof(name), "%s:channel%d", + pdata->label ?: "lp5523", chan); + led->cdev.name = name; + } - led->cdev.name = name; led->cdev.brightness_set = lp5523_set_brightness; res = led_classdev_register(dev, &led->cdev); if (res < 0) { diff --git a/trunk/include/linux/leds-lp5523.h b/trunk/include/linux/leds-lp5523.h index 2694289babd0..727877fb406d 100644 --- a/trunk/include/linux/leds-lp5523.h +++ b/trunk/include/linux/leds-lp5523.h @@ -26,6 +26,7 @@ /* See Documentation/leds/leds-lp5523.txt */ struct lp5523_led_config { + const char *name; u8 chan_nr; u8 led_current; /* mA x10, 0 if led is not connected */ u8 max_current;