aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-lp5523.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-01-28 21:53:01 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-28 21:53:01 -0500
commit268943fb7529a15254a5247372119ba4bd735e94 (patch)
tree790d42cfade2a35b0eec5e1b7e0ac3795d399bcc /drivers/leds/leds-lp5523.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-lp5523.c')
-rw-r--r--drivers/leds/leds-lp5523.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c
index 3a0bc886a87a..4ade66a2d9d4 100644
--- a/drivers/leds/leds-lp5523.c
+++ b/drivers/leds/leds-lp5523.c
@@ -195,12 +195,26 @@ static void lp5523_load_engine_and_select_page(struct lp55xx_chip *chip)
195 lp55xx_write(chip, LP5523_REG_PROG_PAGE_SEL, page_sel[idx]); 195 lp55xx_write(chip, LP5523_REG_PROG_PAGE_SEL, page_sel[idx]);
196} 196}
197 197
198static void lp5523_stop_engine(struct lp55xx_chip *chip) 198static void lp5523_stop_all_engines(struct lp55xx_chip *chip)
199{ 199{
200 lp55xx_write(chip, LP5523_REG_OP_MODE, 0); 200 lp55xx_write(chip, LP5523_REG_OP_MODE, 0);
201 lp5523_wait_opmode_done(); 201 lp5523_wait_opmode_done();
202} 202}
203 203
204static void lp5523_stop_engine(struct lp55xx_chip *chip)
205{
206 enum lp55xx_engine_index idx = chip->engine_idx;
207 u8 mask[] = {
208 [LP55XX_ENGINE_1] = LP5523_MODE_ENG1_M,
209 [LP55XX_ENGINE_2] = LP5523_MODE_ENG2_M,
210 [LP55XX_ENGINE_3] = LP5523_MODE_ENG3_M,
211 };
212
213 lp55xx_update_bits(chip, LP5523_REG_OP_MODE, mask[idx], 0);
214
215 lp5523_wait_opmode_done();
216}
217
204static void lp5523_turn_off_channels(struct lp55xx_chip *chip) 218static void lp5523_turn_off_channels(struct lp55xx_chip *chip)
205{ 219{
206 int i; 220 int i;
@@ -311,7 +325,7 @@ static int lp5523_init_program_engine(struct lp55xx_chip *chip)
311 } 325 }
312 326
313out: 327out:
314 lp5523_stop_engine(chip); 328 lp5523_stop_all_engines(chip);
315 return ret; 329 return ret;
316} 330}
317 331
@@ -782,7 +796,7 @@ static int lp5523_remove(struct i2c_client *client)
782 struct lp55xx_led *led = i2c_get_clientdata(client); 796 struct lp55xx_led *led = i2c_get_clientdata(client);
783 struct lp55xx_chip *chip = led->chip; 797 struct lp55xx_chip *chip = led->chip;
784 798
785 lp5523_stop_engine(chip); 799 lp5523_stop_all_engines(chip);
786 lp55xx_unregister_sysfs(chip); 800 lp55xx_unregister_sysfs(chip);
787 lp55xx_unregister_leds(led, chip); 801 lp55xx_unregister_leds(led, chip);
788 lp55xx_deinit_device(chip); 802 lp55xx_deinit_device(chip);