aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds
diff options
context:
space:
mode:
authorMilo Kim <milo.kim@ti.com>2013-08-08 00:56:01 -0400
committerBryan Wu <cooloney@gmail.com>2013-08-26 20:22:13 -0400
commitb9e1730b295087f5561477a184878783fd3d96d2 (patch)
tree3ef7e524f0cba21ffd76b03f960827e9fe4d581e /drivers/leds
parent1eca0b3ab8d04e2b1749b28cbcafbba6f6e74225 (diff)
leds: lp5523: make separate API for loading engine
lp5523_load_engine() It is called whenever the operation mode is changed to 'load'. It is used for simple operation mode change. It will be used when engine mode and LED selection is updated in later patch. lp5523_load_engine_and_select_page() Change the operation mode to 'load' and select program page number. This is used for programming a LED pattern at a time. So load_engine() is replaced with new API, load_engine_and_select_page() in lp5523_firmware_loaded(). Signed-off-by: Milo Kim <milo.kim@ti.com> Signed-off-by: Bryan Wu <cooloney@gmail.com>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-lp5523.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c
index 72c10e2d4b02..b50948060a02 100644
--- a/drivers/leds/leds-lp5523.c
+++ b/drivers/leds/leds-lp5523.c
@@ -152,15 +152,21 @@ static void lp5523_load_engine(struct lp55xx_chip *chip)
152 [LP55XX_ENGINE_3] = LP5523_LOAD_ENG3, 152 [LP55XX_ENGINE_3] = LP5523_LOAD_ENG3,
153 }; 153 };
154 154
155 lp55xx_update_bits(chip, LP5523_REG_OP_MODE, mask[idx], val[idx]);
156
157 lp5523_wait_opmode_done();
158}
159
160static void lp5523_load_engine_and_select_page(struct lp55xx_chip *chip)
161{
162 enum lp55xx_engine_index idx = chip->engine_idx;
155 u8 page_sel[] = { 163 u8 page_sel[] = {
156 [LP55XX_ENGINE_1] = LP5523_PAGE_ENG1, 164 [LP55XX_ENGINE_1] = LP5523_PAGE_ENG1,
157 [LP55XX_ENGINE_2] = LP5523_PAGE_ENG2, 165 [LP55XX_ENGINE_2] = LP5523_PAGE_ENG2,
158 [LP55XX_ENGINE_3] = LP5523_PAGE_ENG3, 166 [LP55XX_ENGINE_3] = LP5523_PAGE_ENG3,
159 }; 167 };
160 168
161 lp55xx_update_bits(chip, LP5523_REG_OP_MODE, mask[idx], val[idx]); 169 lp5523_load_engine(chip);
162
163 lp5523_wait_opmode_done();
164 170
165 lp55xx_write(chip, LP5523_REG_PROG_PAGE_SEL, page_sel[idx]); 171 lp55xx_write(chip, LP5523_REG_PROG_PAGE_SEL, page_sel[idx]);
166} 172}
@@ -290,7 +296,7 @@ static void lp5523_firmware_loaded(struct lp55xx_chip *chip)
290 * 2) write firmware data into program memory 296 * 2) write firmware data into program memory
291 */ 297 */
292 298
293 lp5523_load_engine(chip); 299 lp5523_load_engine_and_select_page(chip);
294 lp5523_update_program_memory(chip, fw->data, fw->size); 300 lp5523_update_program_memory(chip, fw->data, fw->size);
295} 301}
296 302