summaryrefslogtreecommitdiff
path: root/drivers/leds/leds-cht-wcove.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2023-04-30 22:59:52 +0300
committerLee Jones <lee@kernel.org>2023-05-25 14:16:18 +0300
commitea0c0a85363380e7e80405d47cf63ce84cbc7b65 (patch)
tree0f96c992aa8b90b4155fb2bd38287c1b017bb5ec /drivers/leds/leds-cht-wcove.c
parentca3167f238f347b39567ba46af6ac4f0d732aacf (diff)
downloadlinux-ea0c0a85363380e7e80405d47cf63ce84cbc7b65.tar.xz
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>
Diffstat (limited to 'drivers/leds/leds-cht-wcove.c')
-rw-r--r--drivers/leds/leds-cht-wcove.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/leds/leds-cht-wcove.c b/drivers/leds/leds-cht-wcove.c
index ee9fb4bee018..0cfebee98910 100644
--- a/drivers/leds/leds-cht-wcove.c
+++ b/drivers/leds/leds-cht-wcove.c
@@ -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,