Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Turning off an LED fails to clear the chip mode bits, causing power drain and breaking flash strobe teardown.
--
--- Patch [2]: [RFC PATCH 2/2] leds: flash: Add support for the TI LM3643 dual LED flash driver ---
commit bdf1945ab184ca005c2f401ecd5408571ece1de3
Author: Rillian Grant <[email protected]>
leds: flash: Add support for the TI LM3643 dual LED flash driver
The LM3643 is an I2C dual LED flash driver. Its two high-side current
sources share a synchronous boost converter and each supports torch and
flash modes with programmable current and flash timeout alongside fault
reporting.
> diff --git a/drivers/leds/flash/leds-lm3643.c b/drivers/leds/flash/leds-lm3643.c
> new file mode 100644
> --- /dev/null
> +++ b/drivers/leds/flash/leds-lm3643.c
[ ... ]
> +static int lm3643_torch_set_brightness(struct led_classdev *led_cdev,
> + enum led_brightness brightness)
> +{
[ ... ]
> + if (brightness == 0)
> + return regmap_update_bits(led->regmap, LM3643_REG_ENABLE,
> + chan->enable_bit, 0);
[Severity: High]
When brightness is 0, this only clears the channel's enable bit but leaves
the LM3643_MODE_MASK bits intact. If no other LEDs are active, does this
leave the chip in an active power state (Torch or Flash mode) instead of
transitioning to LM3643_MODE_STANDBY, potentially causing continuous battery
drain?
[ ... ]
> +static int lm3643_flash_strobe_set(struct led_classdev_flash *fled_cdev, bool state)
> +{
[ ... ]
> + if (!state) {
> + if (mode != LM3643_MODE_FLASH || !(enable_reg & chan->enable_bit))
> + return 0;
> +
> + return regmap_update_bits(led->regmap, LM3643_REG_ENABLE,
> + LM3643_MODE_MASK, LM3643_MODE_STANDBY);
> + }
[Severity: High]
If the torch brightness was set to 0 during a flash, the channel's enable
bit will have been cleared. During the subsequent teardown call to
lm3643_flash_strobe_set() with state = false, does this early return trigger
because the enable bit is no longer set?
This would fail to restore the mode to LM3643_MODE_STANDBY, permanently
stranding the driver's state machine in Flash mode.
--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.