diff mbox series

leds: lm3601x: reset led controller during init

Message ID 20240729204054.2269031-1-zenghuchen@google.com
State New
Headers show
Series leds: lm3601x: reset led controller during init | expand

Commit Message

Jack Chen July 29, 2024, 8:40 p.m. UTC
LED controller should be reset during initialization to avoid abnormal
behaviors. For example, when power to SoC is recycled but power to LED
controller is not, LED controller should not presume to be in original
state.

Signed-off-by: Jack Chen <zenghuchen@google.com>
---
 drivers/leds/flash/leds-lm3601x.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/drivers/leds/flash/leds-lm3601x.c b/drivers/leds/flash/leds-lm3601x.c
index 7e93c447fec5..978256310540 100644
--- a/drivers/leds/flash/leds-lm3601x.c
+++ b/drivers/leds/flash/leds-lm3601x.c
@@ -434,6 +434,10 @@  static int lm3601x_probe(struct i2c_client *client)
 		return ret;
 	}
 
+	ret = regmap_write(led->regmap, LM3601X_DEV_ID_REG, LM3601X_SW_RESET);
+	if (ret)
+		dev_warn(&client->dev, "led controller is failed to reset\n");
+
 	mutex_init(&led->lock);
 
 	return lm3601x_register_leds(led, fwnode);