power: supply: leds: Fix blink to LED on transition
PATCH 1/1 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.
--- drivers/power/supply/power_supply_leds.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/power/supply/power_supply_leds.c +3 -2
@@ -33,8 +33,9 @@ static void power_supply_update_bat_leds(struct power_supply *psy)led_trigger_event (psy->charging_full_trig,LED_FULL );led_trigger_event (psy->charging_trig,LED_OFF );led_trigger_event (psy->full_trig,LED_FULL ); -led_trigger_event (psy->charging_blink_full_solid_trig, -LED_FULL ); +/* Going from blink to LED on requires a LED_OFF event to stop blink */ +led_trigger_event (psy->charging_blink_full_solid_trig,LED_OFF ); +led_trigger_event (psy->charging_blink_full_solid_trig,LED_FULL );break ;case POWER_SUPPLY_STATUS_CHARGING :led_trigger_event (psy->charging_full_trig,LED_FULL );
Signature · 1 line
2.39.1
Quoted 13 lines · Hans de Goede
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.hto deactivate blinking / to make the LED solid aLED_OFFmust be send:"""
* Deactivate blinking again when the brightness is set toLED_OFF
* via thebrightness_set()callback.
"""
Quoted 8 lines
led_set_brighness()calls with a brightness value other then 0 /LED_OFFmerely change the brightness of the LED in its on state while it is blinking.So
power_supply_update_bat_leds()must first send aLED_OFFevent before theLED_FULLto disable blinking.Fixes 6501f728c56f ("power_supply: Add new LED trigger charging-blink-solid-full")
Wow, it's a commit from 2011 :)
Quoted 2 lines
Cc Vasily Khoruzhick <[email protected]>Signed-off-by Hans de Goede <[email protected]>
Quoted 23 lines
--- drivers/power/supply/power_supply_leds.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/power/supply/power_supply_leds.c +3
-3@@ -33,8 +33,9 @@ static void power_supply_update_bat_leds(struct power_supply *psy)led_trigger_event (psy->charging_full_trig,LED_FULL );led_trigger_event (psy->charging_trig,LED_OFF );led_trigger_event (psy->full_trig,LED_FULL ); -led_trigger_event (psy->charging_blink_full_solid_trig, -LED_FULL ); +/* Going from blink to LED on requires a LED_OFF event to stop blink */ +led_trigger_event (psy->charging_blink_full_solid_trig,LED_OFF ); +led_trigger_event (psy->charging_blink_full_solid_trig,LED_FULL );break ;case POWER_SUPPLY_STATUS_CHARGING :led_trigger_event (psy->charging_full_trig,LED_FULL ); --2.39.1
Hi,
Quoted 21 lines · Vasily Khoruzhick
Quoted 20 lines · Hans de Goede
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.hto deactivate blinking / to make the LED solid aLED_OFFmust be send:"""
* Deactivate blinking again when the brightness is set toLED_OFF
* via thebrightness_set()callback.
"""
led_set_brighness()calls with a brightness value other then 0 /LED_OFFmerely change the brightness of the LED in its on state while it is blinking.So
power_supply_update_bat_leds()must first send aLED_OFFevent before theLED_FULLto disable blinking.
Quoted 8 lines
Quoted 1 line
Fixes 6501f728c56f ("power_supply: Add new LED trigger charging-blink-solid-full")Wow, it's a commit from 2011 :)
Quoted 2 lines
Cc Vasily Khoruzhick <[email protected]>Signed-off-by Hans de Goede <[email protected]>Reviewed-by Vasily Khoruzhick <[email protected]>
Thanks, queued to my fixes branch.
-- Sebastian
Quoted 23 lines
Quoted 23 lines
--- drivers/power/supply/power_supply_leds.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/power/supply/power_supply_leds.c +3
-3@@ -33,8 +33,9 @@ static void power_supply_update_bat_leds(struct power_supply *psy)led_trigger_event (psy->charging_full_trig,LED_FULL );led_trigger_event (psy->charging_trig,LED_OFF );led_trigger_event (psy->full_trig,LED_FULL ); -led_trigger_event (psy->charging_blink_full_solid_trig, -LED_FULL ); +/* Going from blink to LED on requires a LED_OFF event to stop blink */ +led_trigger_event (psy->charging_blink_full_solid_trig,LED_OFF ); +led_trigger_event (psy->charging_blink_full_solid_trig,LED_FULL );break ;case POWER_SUPPLY_STATUS_CHARGING :led_trigger_event (psy->charging_full_trig,LED_FULL ); --2.39.1