Skip to contentSkip to conversation

ath9k: Fix LED blink pattern

PATCH New Vasanthakumar Thiagarajan 3 participants 4 messages Jan 29, 2009 – Jan 31, 2009 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ath9k: Fix LED blink pattern

---
 drivers/net/wireless/ath9k/core.h |   10 +++++++
 drivers/net/wireless/ath9k/main.c |   52 ++++++++++++++++++++++++++++++++----
 2 files changed, 56 insertions(+), 6 deletions(-)
drivers/net/wireless/ath9k/core.h +10 -0
index 29251f8..9a7bb1b 100644
@@ -600,6 +600,8 @@ struct ath_ani {
 /********************/
 
 #define ATH_LED_PIN	1
+#define ATH_LED_ON_DURATION_IDLE	350	/* in msecs */
+#define ATH_LED_OFF_DURATION_IDLE	250	/* in msecs */
 
 enum ath_led_type {
 	ATH_LED_RADIO,
@@ -677,6 +679,7 @@ enum PROT_MODE {
 #define SC_OP_RFKILL_SW_BLOCKED	BIT(12)
 #define SC_OP_RFKILL_HW_BLOCKED	BIT(13)
 #define SC_OP_WAIT_FOR_BEACON	BIT(14)
+#define SC_OP_LED_ON		BIT(15)
 
 struct ath_bus_ops {
 	void		(*read_cachesize)(struct ath_softc *sc, int *csz);
@@ -725,10 +728,17 @@ struct ath_softc {
 	struct ath_rate_table *hw_rate_table[ATH9K_MODE_MAX];
 	struct ath_rate_table *cur_rate_table;
 	struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
+
 	struct ath_led radio_led;
 	struct ath_led assoc_led;
 	struct ath_led tx_led;
 	struct ath_led rx_led;
+	struct delayed_work ath_led_blink_work;
+	int led_on_duration;
+	int led_off_duration;
+	int led_on_cnt;
+	int led_off_cnt;
+
 	struct ath_rfkill rf_kill;
 	struct ath_ani sc_ani;
 	struct ath9k_node_stats sc_halstats;
drivers/net/wireless/ath9k/main.c +46 -6

80 lines not on this page · raw message

Signature · 1 line
1.5.5.1
#1 lore raw

PATCH 1/1 ath9k: Fix LED blink pattern

Quoted 31 lines · Vasanthakumar Thiagarajan
---
 drivers/net/wireless/ath9k/core.h |   10 +++++++
 drivers/net/wireless/ath9k/main.c |   52 ++++++++++++++++++++++++++++++++----
 2 files changed, 56 insertions(+), 6 deletions(-)
drivers/net/wireless/ath9k/core.h +3 -0
index 29251f8..9a7bb1b 100644
@@ -600,6 +600,8 @@ struct ath_ani {
 /********************/
 
 #define ATH_LED_PIN    1
+#define ATH_LED_ON_DURATION_IDLE       350     /* in msecs */
+#define ATH_LED_OFF_DURATION_IDLE      250     /* in msecs */
 
 enum ath_led_type {
       ATH_LED_RADIO,
@@ -677,6 +679,7 @@ enum PROT_MODE {
 #define SC_OP_RFKILL_SW_BLOCKED        BIT(12)
 #define SC_OP_RFKILL_HW_BLOCKED        BIT(13)
 #define SC_OP_WAIT_FOR_BEACON  BIT(14)
+#define SC_OP_LED_ON           BIT(15)
 
 struct ath_bus_ops {
       void            (*read_cachesize)(struct ath_softc *sc, int *csz);
@@ -725,10 +728,17 @@ struct ath_softc {
       struct ath_rate_table *hw_rate_table[ATH9K_MODE_MAX];
       struct ath_rate_table *cur_rate_table;
       struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];

drivers/net/wireless/ath9k/core.h struct ath_softc { · line 740

Quoted 10 lines
drivers/net/wireless/ath9k/core.h +6 -0
+
       struct ath_led radio_led;
       struct ath_led assoc_led;
       struct ath_led tx_led;
       struct ath_led rx_led;
+       struct delayed_work ath_led_blink_work;
+       int led_on_duration;
+       int led_off_duration;
+       int led_on_cnt;
+       int led_off_cnt;

This is something that has come up from time to time from users for ath5k as well. Half of the drivers now have their own timers for turning leds on or off.

Can we just add a decent blink algorithm to mac80211? Right now for rx it just toggles every other packet. For tx, it's slightly smarter but not overly so. It seems like this is one of those things everyone wants to do and we could easily make it a standard service.

Signature · 1 line
Bob Copeland %% www.bobcopeland.com
maintainer
#2 lore raw
Quoted 8 lines · Bob Copeland

This is something that has come up from time to time from users for ath5k as well. Half of the drivers now have their own timers for turning leds on or off.

Can we just add a decent blink algorithm to mac80211? Right now for rx it just toggles every other packet. For tx, it's slightly smarter but not overly so. It seems like this is one of those things everyone wants to do and we could easily make it a standard service.

Define "decent blink algorithm"? But anyway, yes, please do, then we have a central way of disabling all these timers too. Might need to make some LED framework changes to figure out whether anything is attached to an LED to avoid blinking it when nothing is attached?

johannes

#3 lore raw

PATCH 1/1 ath9k: Fix LED blink pattern

In reply to Bob Copeland
Quoted 6 lines · Bob Copeland

drivers/net/wireless/ath9k/core.h struct ath_softc { · line 740

Quoted 5 lines
drivers/net/wireless/ath9k/core.h +5 -0
+       struct delayed_work ath_led_blink_work;
+       int led_on_duration;
+       int led_off_duration;
+       int led_on_cnt;
+       int led_off_cnt;
Quoted 8 lines

This is something that has come up from time to time from users for ath5k as well. Half of the drivers now have their own timers for turning leds on or off.

Can we just add a decent blink algorithm to mac80211? Right now for rx it just toggles every other packet. For tx, it's slightly smarter but not overly so. It seems like this is one of those things everyone wants to do and we could easily make it a standard service.

ath9k maps all four led functionality (radio, assoc, rx and tx) into a single LED, I think ath5k is also doing in the similar way. But other drivers can map their led functionality differently in their h/w where the pattern will differ. mac80211 is already signalling appropriate leds, imho it is up to the driver to define the pattern based on the number of leds available/configured.

Quoted 3 lines

--
Bob Copeland %% www.bobcopeland.com