Skip to content

Commit e448464

Browse files
jwrdegoedesre
authored andcommitted
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: 6501f72 ("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>
1 parent 4d5c129 commit e448464

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/power/supply/power_supply_leds.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ static void power_supply_update_bat_leds(struct power_supply *psy)
3535
led_trigger_event(psy->charging_full_trig, LED_FULL);
3636
led_trigger_event(psy->charging_trig, LED_OFF);
3737
led_trigger_event(psy->full_trig, LED_FULL);
38-
led_trigger_event(psy->charging_blink_full_solid_trig,
39-
LED_FULL);
38+
/* Going from blink to LED on requires a LED_OFF event to stop blink */
39+
led_trigger_event(psy->charging_blink_full_solid_trig, LED_OFF);
40+
led_trigger_event(psy->charging_blink_full_solid_trig, LED_FULL);
4041
break;
4142
case POWER_SUPPLY_STATUS_CHARGING:
4243
led_trigger_event(psy->charging_full_trig, LED_FULL);

0 commit comments

Comments
 (0)