Commit ea0c0a85 authored by Hans de Goede's avatar Hans de Goede Committed by Lee Jones

leds: cht-wcove: Use breathing when LED_INIT_DEFAULT_TRIGGER is set

The desired default behavior of LED1 / the charge LED is breathing
while charging and on/solid when full. Since triggers cannot select
breathing, blink_set() gets called when charging. Use breathing
when the default "charging-blink-full-solid" trigger is used to
achieve the desired default behavior.
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230430195952.862527-6-hdegoede@redhat.comSigned-off-by: default avatarLee Jones <lee@kernel.org>
parent ca3167f2
...@@ -270,7 +270,21 @@ static int cht_wc_leds_blink_set(struct led_classdev *cdev, ...@@ -270,7 +270,21 @@ static int cht_wc_leds_blink_set(struct led_classdev *cdev,
unsigned long *delay_on, unsigned long *delay_on,
unsigned long *delay_off) unsigned long *delay_off)
{ {
return cht_wc_leds_set_effect(cdev, delay_on, delay_off, CHT_WC_LED_EFF_BLINKING); u8 effect = CHT_WC_LED_EFF_BLINKING;
/*
* The desired default behavior of LED1 / the charge LED is breathing
* while charging and on/solid when full. Since triggers cannot select
* breathing, blink_set() gets called when charging. Use slow breathing
* when the default "charging-blink-full-solid" trigger is used to
* achieve the desired default behavior.
*/
if (cdev->flags & LED_INIT_DEFAULT_TRIGGER) {
*delay_on = *delay_off = 1000;
effect = CHT_WC_LED_EFF_BREATHING;
}
return cht_wc_leds_set_effect(cdev, delay_on, delay_off, effect);
} }
static int cht_wc_leds_pattern_set(struct led_classdev *cdev, static int cht_wc_leds_pattern_set(struct led_classdev *cdev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment