Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 295183
b: refs/heads/master
c: 5ae4e8a
h: refs/heads/master
i:
  295181: 106f622
  295179: b67d2fe
  295175: 631ada5
  295167: d89f356
v: v3
  • Loading branch information
Kim, Milo authored and Linus Torvalds committed Mar 23, 2012
1 parent 38d2f41 commit db5d1c2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c5bd2a712a0c7299b61b0e02404b1376f794d251
refs/heads/master: 5ae4e8a77dc82afcfe8460168ec0b94f4b79a54a
6 changes: 6 additions & 0 deletions trunk/Documentation/leds/leds-lp5521.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,23 @@ Format: 10x mA i.e 10 means 1.0 mA
example platform data:

Note: chan_nr can have values between 0 and 2.
The name of each channel can be configurable.
If the name field is not defined, the default name will be set to 'xxxx:channelN'
(XXXX : pdata->label or i2c client name, N : channel number)

static struct lp5521_led_config lp5521_led_config[] = {
{
.name = "red",
.chan_nr = 0,
.led_current = 50,
.max_current = 130,
}, {
.name = "green",
.chan_nr = 1,
.led_current = 0,
.max_current = 130,
}, {
.name = "blue",
.chan_nr = 2,
.led_current = 0,
.max_current = 130,
Expand Down
11 changes: 8 additions & 3 deletions trunk/drivers/leds/leds-lp5521.c
Original file line number Diff line number Diff line change
Expand Up @@ -620,10 +620,15 @@ static int __devinit lp5521_init_led(struct lp5521_led *led,
return -EINVAL;
}

snprintf(name, sizeof(name), "%s:channel%d",
pdata->label ?: client->name, chan);
led->cdev.brightness_set = lp5521_set_brightness;
led->cdev.name = name;
if (pdata->led_config[chan].name) {
led->cdev.name = pdata->led_config[chan].name;
} else {
snprintf(name, sizeof(name), "%s:channel%d",
pdata->label ?: client->name, chan);
led->cdev.name = name;
}

res = led_classdev_register(dev, &led->cdev);
if (res < 0) {
dev_err(dev, "couldn't register led on channel %d\n", chan);
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/leds-lp5521.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
/* See Documentation/leds/leds-lp5521.txt */

struct lp5521_led_config {
char *name;
u8 chan_nr;
u8 led_current; /* mA x10, 0 if led is not connected */
u8 max_current;
Expand Down

0 comments on commit db5d1c2

Please sign in to comment.