Search Linux Wireless

[PATCH] ath9k: Keep LED on in idle state after association

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Vasanthakumar Thiagarajan <vasanth@xxxxxxxxxxx>
---
 drivers/net/wireless/ath9k/main.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index 8db75f6..b14c4d9 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -940,18 +940,25 @@ static void ath_led_blink_work(struct work_struct *work)
 
 	if (!(sc->sc_flags & SC_OP_LED_ASSOCIATED))
 		return;
-	ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN,
-			  (sc->sc_flags & SC_OP_LED_ON) ? 1 : 0);
+
+	if ((sc->led_on_duration == ATH_LED_ON_DURATION_IDLE) ||
+	    (sc->led_off_duration == ATH_LED_OFF_DURATION_IDLE))
+		ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 0);
+	else
+		ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN,
+				  (sc->sc_flags & SC_OP_LED_ON) ? 1 : 0);
 
 	queue_delayed_work(sc->hw->workqueue, &sc->ath_led_blink_work,
 			   (sc->sc_flags & SC_OP_LED_ON) ?
 			   msecs_to_jiffies(sc->led_off_duration) :
 			   msecs_to_jiffies(sc->led_on_duration));
 
-	sc->led_on_duration =
-			max((ATH_LED_ON_DURATION_IDLE - sc->led_on_cnt), 25);
-	sc->led_off_duration =
-			max((ATH_LED_OFF_DURATION_IDLE - sc->led_off_cnt), 10);
+	sc->led_on_duration = sc->led_on_cnt ?
+			max((ATH_LED_ON_DURATION_IDLE - sc->led_on_cnt), 25) :
+			ATH_LED_ON_DURATION_IDLE;
+	sc->led_off_duration = sc->led_off_cnt ?
+			max((ATH_LED_OFF_DURATION_IDLE - sc->led_off_cnt), 10) :
+			ATH_LED_OFF_DURATION_IDLE;
 	sc->led_on_cnt = sc->led_off_cnt = 0;
 	if (sc->sc_flags & SC_OP_LED_ON)
 		sc->sc_flags &= ~SC_OP_LED_ON;
-- 
1.5.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux