Skip to content

Commit 00253ec

Browse files
Dan Murphypavelmachek
authored andcommitted
leds: lp5521: Add multicolor framework multicolor brightness support
Add the multicolor brightness call back to support the multicolor framework. This function allows setting the brightness across grouped LED channels in a single call. Acked-by: Pavel Machek <pavel@ucw.cz> Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Signed-off-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Pavel Machek <pavel@ucw.cz>
1 parent 4047313 commit 00253ec

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

drivers/leds/leds-lp5521.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,25 @@ static int lp5521_run_selftest(struct lp55xx_chip *chip, char *buf)
349349
return 0;
350350
}
351351

352+
static int lp5521_multicolor_brightness(struct lp55xx_led *led)
353+
{
354+
struct lp55xx_chip *chip = led->chip;
355+
int ret;
356+
int i;
357+
358+
mutex_lock(&chip->lock);
359+
for (i = 0; i < led->mc_cdev.num_colors; i++) {
360+
ret = lp55xx_write(chip,
361+
LP5521_REG_LED_PWM_BASE +
362+
led->mc_cdev.subled_info[i].channel,
363+
led->mc_cdev.subled_info[i].brightness);
364+
if (ret)
365+
break;
366+
}
367+
mutex_unlock(&chip->lock);
368+
return ret;
369+
}
370+
352371
static int lp5521_led_brightness(struct lp55xx_led *led)
353372
{
354373
struct lp55xx_chip *chip = led->chip;
@@ -490,6 +509,7 @@ static struct lp55xx_device_config lp5521_cfg = {
490509
.max_channel = LP5521_MAX_LEDS,
491510
.post_init_device = lp5521_post_init_device,
492511
.brightness_fn = lp5521_led_brightness,
512+
.multicolor_brightness_fn = lp5521_multicolor_brightness,
493513
.set_led_current = lp5521_set_led_current,
494514
.firmware_cb = lp5521_firmware_loaded,
495515
.run_engine = lp5521_run_engine,

0 commit comments

Comments
 (0)