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: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230430195952.862527-6-hdegoede@redhat.com
Signed-off-by: Lee Jones <lee@kernel.org>
pull/877/head
Hans de Goede 2023-04-30 21:59:52 +02:00 committed by Lee Jones
parent ca3167f238
commit ea0c0a8536
1 changed files with 15 additions and 1 deletions

View File

@ -270,7 +270,21 @@ static int cht_wc_leds_blink_set(struct led_classdev *cdev,
unsigned long *delay_on,
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,