All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 08/28] leds-lp5521/5523: cleanup setting LED current
@ 2012-10-05  8:14 Kim, Milo
  0 siblings, 0 replies; only message in thread
From: Kim, Milo @ 2012-10-05  8:14 UTC (permalink / raw)
  To: Bryan Wu; +Cc: Richard Purdie, linux-leds, linux-kernel

 The LP55xx common driver has general LED attributes.
 (led_current and max_current)
 To set this current, specific register should be updated.
 Therefore, actual operation is handled in each driver.

 This call is invoked on initializing LEDs and
 setting current by an user-space.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
---
 drivers/leds/leds-lp5521.c |    9 +++++----
 drivers/leds/leds-lp5523.c |    8 ++++++++
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c
index e029598..1791655 100644
--- a/drivers/leds/leds-lp5521.c
+++ b/drivers/leds/leds-lp5521.c
@@ -229,11 +229,11 @@ static int lp5521_load_program(struct lp5521_engine *eng, const u8 *pattern)
 	return lp5521_write(client, LP5521_REG_OP_MODE, mode);
 }
 
-static int lp5521_set_led_current(struct lp5521_chip *chip, int led, u8 curr)
+static void lp5521_set_led_current(struct lp55xx_led *led, u8 led_current)
 {
-	return lp5521_write(chip->client,
-		    LP5521_REG_LED_CURRENT_BASE + chip->leds[led].chan_nr,
-		    curr);
+	led->led_current = led_current;
+	lp55xx_write(led->chip, LP5521_REG_LED_CURRENT_BASE + led->chan_nr,
+		led_current);
 }
 
 static int lp5521_post_init_device(struct lp55xx_chip *chip)
@@ -616,6 +616,7 @@ static struct lp55xx_device_config lp5521_cfg = {
 	},
 	.post_init_device   = lp5521_post_init_device,
 	.brightness_work_fn = lp5521_led_brightness_work,
+	.set_led_current    = lp5521_set_led_current,
 };
 
 static int __devinit lp5521_probe(struct i2c_client *client,
diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c
index fbde823..5d383b2 100644
--- a/drivers/leds/leds-lp5523.c
+++ b/drivers/leds/leds-lp5523.c
@@ -467,6 +467,13 @@ static void lp5523_led_brightness_work(struct work_struct *work)
 	mutex_unlock(&chip->lock);
 }
 
+static void lp5523_set_led_current(struct lp55xx_led *led, u8 led_current)
+{
+	led->led_current = led_current;
+	lp55xx_write(led->chip, LP5523_REG_LED_CURRENT_BASE + led->chan_nr,
+		led_current);
+}
+
 static int lp5523_do_store_load(struct lp5523_engine *engine,
 				const char *buf, size_t len)
 {
@@ -689,6 +696,7 @@ static struct lp55xx_device_config lp5523_cfg = {
 	},
 	.post_init_device   = lp5523_post_init_device,
 	.brightness_work_fn = lp5523_led_brightness_work,
+	.set_led_current    = lp5523_set_led_current,
 };
 
 static int __devinit lp5523_probe(struct i2c_client *client,
-- 
1.7.9.5


Best Regards,
Milo



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-10-05  8:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-05  8:14 [PATCH 08/28] leds-lp5521/5523: cleanup setting LED current Kim, Milo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.