]> git.itanic.dy.fi Git - linux-stable/commit
power: supply: leds: Fix blink to LED on transition
authorHans de Goede <hdegoede@redhat.com>
Thu, 13 Apr 2023 10:09:41 +0000 (12:09 +0200)
committerSebastian Reichel <sre@kernel.org>
Mon, 8 May 2023 13:13:19 +0000 (15:13 +0200)
commite4484643991e0f6b89060092563f0dbab9450cbb
tree4615e7958188b8be8a0ff80bd447715c683dcec0
parent4d5c129d6c8993fe96e9ae712141eedcb9ca68c2
power: supply: leds: Fix blink to LED on transition

When a battery's status changes from charging to full then
the charging-blink-full-solid trigger tries to change
the LED from blinking to solid/on.

As is documented in include/linux/leds.h to deactivate blinking /
to make the LED solid a LED_OFF must be send:

"""
         * Deactivate blinking again when the brightness is set to LED_OFF
         * via the brightness_set() callback.
"""

led_set_brighness() calls with a brightness value other then 0 / LED_OFF
merely change the brightness of the LED in its on state while it is
blinking.

So power_supply_update_bat_leds() must first send a LED_OFF event
before the LED_FULL to disable blinking.

Fixes: 6501f728c56f ("power_supply: Add new LED trigger charging-blink-solid-full")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/power_supply_leds.c