summaryrefslogtreecommitdiff
path: root/drivers/leds/leds-lp5521.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-01-28 18:53:01 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-28 18:53:01 -0800
commit268943fb7529a15254a5247372119ba4bd735e94 (patch)
tree790d42cfade2a35b0eec5e1b7e0ac3795d399bcc /drivers/leds/leds-lp5521.c
parent2ad48ee810335bdd99de96e1a0796ba34c0e8301 (diff)
parent3cb6f44aedf519dce4a9106dec675b94d675c539 (diff)
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds
Pull LED subsystem update from Bryan Wu: "Basically this cycle is mostly cleanup for LED subsystem" * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds: leds: s3c24xx: Remove hardware.h inclusion leds: replace list_for_each with list_for_each_entry leds: kirkwood: Cleanup in header files leds: pwm: Remove a warning on non-DT platforms leds: leds-pwm: fix duty time overflow. leds: leds-mc13783: Remove unneeded mc13xxx_{un}lock leds: leds-mc13783: Remove duplicate field in platform data drivers: leds: leds-tca6507: check CONFIG_GPIOLIB whether defined for 'gpio_base' leds: lp5523: Support LED MUX configuration on running a pattern leds: lp5521/5523: Fix multiple engine usage bug LEDS: tca6507 - fix up some comments. LEDS: tca6507: add device-tree support for GPIO configuration. LEDS: tca6507 - fix bugs in parsing of device-tree configuration.
Diffstat (limited to 'drivers/leds/leds-lp5521.c')
-rw-r--r--drivers/leds/leds-lp5521.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c
index a97263e902ff..2ec34cfcedce 100644
--- a/drivers/leds/leds-lp5521.c
+++ b/drivers/leds/leds-lp5521.c
@@ -152,12 +152,26 @@ static void lp5521_load_engine(struct lp55xx_chip *chip)
lp5521_wait_opmode_done();
}
-static void lp5521_stop_engine(struct lp55xx_chip *chip)
+static void lp5521_stop_all_engines(struct lp55xx_chip *chip)
{
lp55xx_write(chip, LP5521_REG_OP_MODE, 0);
lp5521_wait_opmode_done();
}
+static void lp5521_stop_engine(struct lp55xx_chip *chip)
+{
+ enum lp55xx_engine_index idx = chip->engine_idx;
+ u8 mask[] = {
+ [LP55XX_ENGINE_1] = LP5521_MODE_R_M,
+ [LP55XX_ENGINE_2] = LP5521_MODE_G_M,
+ [LP55XX_ENGINE_3] = LP5521_MODE_B_M,
+ };
+
+ lp55xx_update_bits(chip, LP5521_REG_OP_MODE, mask[idx], 0);
+
+ lp5521_wait_opmode_done();
+}
+
static void lp5521_run_engine(struct lp55xx_chip *chip, bool start)
{
int ret;
@@ -564,7 +578,7 @@ static int lp5521_remove(struct i2c_client *client)
struct lp55xx_led *led = i2c_get_clientdata(client);
struct lp55xx_chip *chip = led->chip;
- lp5521_stop_engine(chip);
+ lp5521_stop_all_engines(chip);
lp55xx_unregister_sysfs(chip);
lp55xx_unregister_leds(led, chip);
lp55xx_deinit_device(chip);