>From 1e867963acbc7dd744fb07949928bc493244ee81 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Fri, 16 Jun 2023 23:22:28 +0200 Subject: [PATCH 2/3] wifi: ath10k: start LED with the previous defined cdev brightness In preparation for DT support for LED, change ath10k_leds_start to init the LED to the previous defined cdev brightness. The LED is set to OFF by default since we can't understand the previous state of the LED due to a limitation in the WMI calls exposed by the fw. Signed-off-by: Christian Marangi --- drivers/net/wireless/ath/ath10k/leds.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/leds.c b/drivers/net/wireless/ath/ath10k/leds.c index 6146d4d69013..b3b3025b4a38 100644 --- a/drivers/net/wireless/ath/ath10k/leds.c +++ b/drivers/net/wireless/ath/ath10k/leds.c @@ -48,7 +48,8 @@ int ath10k_leds_start(struct ath10k *ar) */ ath10k_wmi_gpio_config(ar, ar->hw_params.led_pin, 0, WMI_GPIO_PULL_NONE, WMI_GPIO_INTTYPE_DISABLE); - ath10k_wmi_gpio_output(ar, ar->hw_params.led_pin, 1); + ath10k_wmi_gpio_output(ar, ar->hw_params.led_pin, + ar->leds.cdev.brightness ^ ar->leds.wifi_led.active_low); return 0; } @@ -69,6 +70,8 @@ int ath10k_leds_register(struct ath10k *ar) ar->leds.wifi_led.default_state = LEDS_GPIO_DEFSTATE_KEEP; ar->leds.cdev.name = ar->leds.label; + /* By default LED is set OFF */ + ar->leds.cdev.brightness = 0; ar->leds.cdev.brightness_set_blocking = ath10k_leds_set_brightness_blocking; ret = led_classdev_register(wiphy_dev(ar->hw->wiphy), &ar->leds.cdev); -- 2.40.1