aboutsummaryrefslogtreecommitdiff
path: root/drivers/leds/leds-lp5521.c
diff options
context:
space:
mode:
authorMilo(Woogyom) Kim <milo.kim@ti.com>2013-02-05 19:08:40 +0900
committerBryan Wu <cooloney@gmail.com>2013-02-06 15:59:28 -0800
commita6e4679a09a0a2bcfa63074272fc9fb2a40f11ad (patch)
tree53405497f05e27c0c69e008f9dfcce05b9e48b25 /drivers/leds/leds-lp5521.c
parent0e2023463a3c9412728cb2c36c79aca0bb731cc8 (diff)
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-lp5521.c')
-rw-r--r--drivers/leds/leds-lp5521.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c
index bda03049fb3..6efbb7ec0e2 100644
--- a/drivers/leds/leds-lp5521.c
+++ b/drivers/leds/leds-lp5521.c
@@ -151,8 +151,6 @@ static inline struct lp5521_chip *led_to_lp5521(struct lp5521_led *led)
leds[led->id]);
}
-static void lp5521_led_brightness_work(struct work_struct *work);
-
static inline int lp5521_write(struct i2c_client *client, u8 reg, u8 value)
{
return i2c_smbus_write_byte_data(client, reg, value);
@@ -303,24 +301,14 @@ static int lp5521_run_selftest(struct lp5521_chip *chip, char *buf)
return 0;
}
-static void lp5521_set_brightness(struct led_classdev *cdev,
- enum led_brightness brightness)
-{
- struct lp5521_led *led = cdev_to_led(cdev);
- led->brightness = (u8)brightness;
- schedule_work(&led->brightness_work);
-}
-
static void lp5521_led_brightness_work(struct work_struct *work)
{
- struct lp5521_led *led = container_of(work,
- struct lp5521_led,
+ struct lp55xx_led *led = container_of(work, struct lp55xx_led,
brightness_work);
- struct lp5521_chip *chip = led_to_lp5521(led);
- struct i2c_client *client = chip->client;
+ struct lp55xx_chip *chip = led->chip;
mutex_lock(&chip->lock);
- lp5521_write(client, LP5521_REG_LED_PWM_BASE + led->chan_nr,
+ lp55xx_write(chip, LP5521_REG_LED_PWM_BASE + led->chan_nr,
led->brightness);
mutex_unlock(&chip->lock);
}
@@ -711,6 +699,7 @@ static struct lp55xx_device_config lp5521_cfg = {
},
.max_channel = LP5521_MAX_LEDS,
.post_init_device = lp5521_post_init_device,
+ .brightness_work_fn = lp5521_led_brightness_work,
};
static int lp5521_probe(struct i2c_client *client,