Skip to content

Commit 2a498d6

Browse files
Ansuellag-linaro
authored andcommitted
leds: leds-lp5569: Better handle enabling clock internal setting
Better handle enabling clock internal setting. In further testing it was notice that internal clock config MUST be set before clock output config or the LED CHIP might stop working. This wasn't documented and was actually found on devices that have 2 chip chained where one chip provide clock for the other. Signed-off-by: Christian Marangi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lee Jones <[email protected]>
1 parent 9c5fd27 commit 2a498d6

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

drivers/leds/leds-lp5569.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,20 +180,25 @@ static int lp5569_post_init_device(struct lp55xx_chip *chip)
180180

181181
val = LP5569_DEFAULT_CONFIG;
182182
val |= FIELD_PREP(LP5569_CP_MODE_MASK, chip->pdata->charge_pump_mode);
183+
ret = lp55xx_write(chip, LP5569_REG_MISC, val);
184+
if (ret)
185+
return ret;
183186

184187
if (chip->pdata->clock_mode == LP55XX_CLOCK_INT) {
188+
/* Internal clock MUST be configured before CLK output */
189+
ret = lp55xx_update_bits(chip, LP5569_REG_MISC,
190+
LP5569_INTERNAL_CLK,
191+
LP5569_INTERNAL_CLK);
192+
if (ret)
193+
return ret;
194+
185195
ret = lp55xx_update_bits(chip, LP5569_REG_IO_CONTROL,
186196
LP5569_CLK_OUTPUT,
187197
LP5569_CLK_OUTPUT);
188198
if (ret)
189199
return ret;
190-
191-
val |= LP5569_INTERNAL_CLK;
192200
}
193201

194-
ret = lp55xx_write(chip, LP5569_REG_MISC, val);
195-
if (ret)
196-
return ret;
197202

198203
return lp5569_init_program_engine(chip);
199204
}

0 commit comments

Comments
 (0)