|
30 | 30 | * 0x40 engine 2 muxing info |
31 | 31 | * 0x50 engine 3 muxing info |
32 | 32 | */ |
| 33 | +#define LP5523_PAGES_PER_ENGINE 1 |
33 | 34 | #define LP5523_MAX_LEDS 9 |
34 | 35 |
|
35 | 36 | /* Registers */ |
@@ -159,20 +160,6 @@ static int lp5523_post_init_device(struct lp55xx_chip *chip) |
159 | 160 | return lp5523_init_program_engine(chip); |
160 | 161 | } |
161 | 162 |
|
162 | | -static void lp5523_load_engine_and_select_page(struct lp55xx_chip *chip) |
163 | | -{ |
164 | | - enum lp55xx_engine_index idx = chip->engine_idx; |
165 | | - static const u8 page_sel[] = { |
166 | | - [LP55XX_ENGINE_1] = LP5523_PAGE_ENG1, |
167 | | - [LP55XX_ENGINE_2] = LP5523_PAGE_ENG2, |
168 | | - [LP55XX_ENGINE_3] = LP5523_PAGE_ENG3, |
169 | | - }; |
170 | | - |
171 | | - lp55xx_load_engine(chip); |
172 | | - |
173 | | - lp55xx_write(chip, LP5523_REG_PROG_PAGE_SEL, page_sel[idx]); |
174 | | -} |
175 | | - |
176 | 163 | static void lp5523_stop_engine(struct lp55xx_chip *chip) |
177 | 164 | { |
178 | 165 | enum lp55xx_engine_index idx = chip->engine_idx; |
@@ -272,7 +259,7 @@ static int lp5523_init_program_engine(struct lp55xx_chip *chip) |
272 | 259 | /* write LED MUX address space for each engine */ |
273 | 260 | for (i = LP55XX_ENGINE_1; i <= LP55XX_ENGINE_3; i++) { |
274 | 261 | chip->engine_idx = i; |
275 | | - lp5523_load_engine_and_select_page(chip); |
| 262 | + lp55xx_load_engine(chip); |
276 | 263 |
|
277 | 264 | for (j = 0; j < LP5523_PROGRAM_LENGTH; j++) { |
278 | 265 | ret = lp55xx_write(chip, LP5523_REG_PROG_MEM + j, |
@@ -362,7 +349,7 @@ static void lp5523_firmware_loaded(struct lp55xx_chip *chip) |
362 | 349 | * 2) write firmware data into program memory |
363 | 350 | */ |
364 | 351 |
|
365 | | - lp5523_load_engine_and_select_page(chip); |
| 352 | + lp55xx_load_engine(chip); |
366 | 353 | lp5523_update_program_memory(chip, fw->data, fw->size); |
367 | 354 | } |
368 | 355 |
|
@@ -544,7 +531,7 @@ static ssize_t store_engine_load(struct device *dev, |
544 | 531 | mutex_lock(&chip->lock); |
545 | 532 |
|
546 | 533 | chip->engine_idx = nr; |
547 | | - lp5523_load_engine_and_select_page(chip); |
| 534 | + lp55xx_load_engine(chip); |
548 | 535 | ret = lp5523_update_program_memory(chip, buf, len); |
549 | 536 |
|
550 | 537 | mutex_unlock(&chip->lock); |
@@ -865,6 +852,7 @@ static struct lp55xx_device_config lp5523_cfg = { |
865 | 852 | .addr = LP5523_REG_ENABLE, |
866 | 853 | .val = LP5523_ENABLE, |
867 | 854 | }, |
| 855 | + .pages_per_engine = LP5523_PAGES_PER_ENGINE, |
868 | 856 | .max_channel = LP5523_MAX_LEDS, |
869 | 857 | .post_init_device = lp5523_post_init_device, |
870 | 858 | .brightness_fn = lp5523_led_brightness, |
|
0 commit comments