[PATCH 2/3] wifi: ath10k: start LED with the previous defined cdev brightness

From: Christian Marangi
Date: Fri Jun 16 2023 - 17:22:28 EST


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 <ansuelsmth@xxxxxxxxx>
---
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


--ISiK3ICplRRKwxPi
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="0003-wifi-ath10k-add-DT-support-for-LED-definition.patch"