diff options
author | Milo(Woogyom) Kim <milo.kim@ti.com> | 2013-02-05 14:08:40 +0400 |
---|---|---|
committer | Bryan Wu <cooloney@gmail.com> | 2013-02-07 03:59:28 +0400 |
commit | a6e4679a09a0a2bcfa63074272fc9fb2a40f11ad (patch) | |
tree | 53405497f05e27c0c69e008f9dfcce05b9e48b25 /drivers/leds/leds-lp55xx-common.c | |
parent | 0e2023463a3c9412728cb2c36c79aca0bb731cc8 (diff) | |
download | linux-a6e4679a09a0a2bcfa63074272fc9fb2a40f11ad.tar.xz |
leds-lp55xx: use lp55xx_set_brightness()
lp5521_set_brightness() and lp5523_set_brightness() are replaced with
common function, lp55xx_set_brightness().
This function is invoked when the brightness of each LED channel is updated.
LP5521 and LP5523 have different register address for the brightness control,
so this work is done by chip specific brightness_work_fn().
lp5521/5523_led_brightness_work():
use lp55xx_led and lp55xx_chip data structure.
use lp55xx write function.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
Diffstat (limited to 'drivers/leds/leds-lp55xx-common.c')
-rw-r--r-- | drivers/leds/leds-lp55xx-common.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/leds/leds-lp55xx-common.c b/drivers/leds/leds-lp55xx-common.c index 75ab1c3c03ed..8244d78447f4 100644 --- a/drivers/leds/leds-lp55xx-common.c +++ b/drivers/leds/leds-lp55xx-common.c @@ -20,6 +20,11 @@ #include "leds-lp55xx-common.h" +static struct lp55xx_led *cdev_to_lp55xx_led(struct led_classdev *cdev) +{ + return container_of(cdev, struct lp55xx_led, cdev); +} + static void lp55xx_reset_device(struct lp55xx_chip *chip) { struct lp55xx_device_config *cfg = chip->cfg; @@ -74,6 +79,10 @@ static struct attribute_group lp55xx_led_attr_group = { static void lp55xx_set_brightness(struct led_classdev *cdev, enum led_brightness brightness) { + struct lp55xx_led *led = cdev_to_lp55xx_led(cdev); + + led->brightness = (u8)brightness; + schedule_work(&led->brightness_work); } static int lp55xx_init_led(struct lp55xx_led *led, |