linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE: [PATCH 1/4] leds-lp5521: add 'name' in the lp5521_led_config
@ 2012-01-27  2:21 Kim, Milo
  0 siblings, 0 replies; 3+ messages in thread
From: Kim, Milo @ 2012-01-27  2:21 UTC (permalink / raw)
  To: linux-kernel
  Cc: Arun MURTHY, srinidhi kasagar, Linus Walleij, Andrew Morton, rpurdie

Add Arun, Srinidhi, Linus and Andrew on CC

> -----Original Message-----
> From: Kim, Milo
> Sent: Sunday, January 22, 2012 3:09 AM
> To: 'linux-kernel@vger.kernel.org'; 'rpurdie@rpsys.net'
> Subject: [PATCH 1/4] leds-lp5521: add 'name' in the lp5521_led_config
> 
> The name of each led channel can be configurable.
> For the compatibility, the name is set to default value(xx:channelN)
> when 'name' is not defined.
> 
> * kernel patch based on 3.0.1
> 
> Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
> ---
>  Documentation/leds/leds-lp5521.txt |    6 ++++++
>  drivers/leds/leds-lp5521.c         |   11 ++++++++---
>  include/linux/leds-lp5521.h        |    1 +
>  3 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/leds/leds-lp5521.txt
> b/Documentation/leds/leds-lp5521.txt
> index c4d8d15..f48ab75 100644
> --- a/Documentation/leds/leds-lp5521.txt
> +++ b/Documentation/leds/leds-lp5521.txt
> @@ -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,
> diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c
> index cc1dc48..c0e7c10 100644
> --- a/drivers/leds/leds-lp5521.c
> +++ b/drivers/leds/leds-lp5521.c
> @@ -617,10 +617,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);
> diff --git a/include/linux/leds-lp5521.h b/include/linux/leds-lp5521.h
> index fd548d2..e675b8d 100644
> --- a/include/linux/leds-lp5521.h
> +++ b/include/linux/leds-lp5521.h
> @@ -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;
> --
> 1.7.4.1
> 
> Best Regards,
> Milo (Woogyom) Kim
> Texas Instruments Incorporated


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/4] leds-lp5521: add 'name' in the lp5521_led_config
  2012-01-21 18:09 ` Kim, Milo
@ 2012-01-27 14:03   ` Linus Walleij
  0 siblings, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2012-01-27 14:03 UTC (permalink / raw)
  To: Kim, Milo; +Cc: linux-kernel, rpurdie

On Sat, Jan 21, 2012 at 7:09 PM, Kim, Milo <Milo.Kim@ti.com> wrote:

> The name of each led channel can be configurable.
> For the compatibility, the name is set to default value(xx:channelN)
> when 'name' is not defined.
>
> * kernel patch based on 3.0.1
>
> Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/4] leds-lp5521: add 'name' in the lp5521_led_config
@ 2012-01-21 18:09 ` Kim, Milo
  2012-01-27 14:03   ` Linus Walleij
  0 siblings, 1 reply; 3+ messages in thread
From: Kim, Milo @ 2012-01-21 18:09 UTC (permalink / raw)
  To: linux-kernel, rpurdie

The name of each led channel can be configurable.
For the compatibility, the name is set to default value(xx:channelN)
when 'name' is not defined.

* kernel patch based on 3.0.1

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
---
 Documentation/leds/leds-lp5521.txt |    6 ++++++
 drivers/leds/leds-lp5521.c         |   11 ++++++++---
 include/linux/leds-lp5521.h        |    1 +
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/Documentation/leds/leds-lp5521.txt b/Documentation/leds/leds-lp5521.txt
index c4d8d15..f48ab75 100644
--- a/Documentation/leds/leds-lp5521.txt
+++ b/Documentation/leds/leds-lp5521.txt
@@ -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,
diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c
index cc1dc48..c0e7c10 100644
--- a/drivers/leds/leds-lp5521.c
+++ b/drivers/leds/leds-lp5521.c
@@ -617,10 +617,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);
diff --git a/include/linux/leds-lp5521.h b/include/linux/leds-lp5521.h
index fd548d2..e675b8d 100644
--- a/include/linux/leds-lp5521.h
+++ b/include/linux/leds-lp5521.h
@@ -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;
-- 
1.7.4.1

Best Regards,
Milo (Woogyom) Kim
Texas Instruments Incorporated


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-01-27 14:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-27  2:21 [PATCH 1/4] leds-lp5521: add 'name' in the lp5521_led_config Kim, Milo
     [not found] <AczYZ8yVBSJYBleRQuSZif3IIM5wFA==>
2012-01-21 18:09 ` Kim, Milo
2012-01-27 14:03   ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).