• Hans de Goede's avatar
    power: supply: leds: Fix blink to LED on transition · e4484643
    Hans de Goede authored
    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: 6501f728 ("power_supply: Add new LED trigger charging-blink-solid-full")
    Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    Reviewed-by: default avatarVasily Khoruzhick <anarsoul@gmail.com>
    Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
    e4484643
power_supply_leds.c 4.9 KB