aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/mac80211.h29
-rw-r--r--net/mac80211/ieee80211.c3
-rw-r--r--net/mac80211/ieee80211_i.h5
-rw-r--r--net/mac80211/ieee80211_ioctl.c2
-rw-r--r--net/mac80211/ieee80211_led.c35
-rw-r--r--net/mac80211/ieee80211_led.h6
6 files changed, 78 insertions, 2 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 3784a61a8489..be2a383b4776 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1143,6 +1143,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw);
1143extern char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw); 1143extern char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw);
1144extern char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw); 1144extern char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw);
1145extern char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw); 1145extern char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw);
1146extern char *__ieee80211_get_radio_led_name(struct ieee80211_hw *hw);
1146#endif 1147#endif
1147/** 1148/**
1148 * ieee80211_get_tx_led_name - get name of TX LED 1149 * ieee80211_get_tx_led_name - get name of TX LED
@@ -1182,6 +1183,16 @@ static inline char *ieee80211_get_rx_led_name(struct ieee80211_hw *hw)
1182#endif 1183#endif
1183} 1184}
1184 1185
1186/**
1187 * ieee80211_get_assoc_led_name - get name of association LED
1188 *
1189 * mac80211 creates a association LED trigger for each wireless hardware
1190 * that can be used to drive LEDs if your driver registers a LED device.
1191 * This function returns the name (or %NULL if not configured for LEDs)
1192 * of the trigger so you can automatically link the LED device.
1193 *
1194 * @hw: the hardware to get the LED trigger name for
1195 */
1185static inline char *ieee80211_get_assoc_led_name(struct ieee80211_hw *hw) 1196static inline char *ieee80211_get_assoc_led_name(struct ieee80211_hw *hw)
1186{ 1197{
1187#ifdef CONFIG_MAC80211_LEDS 1198#ifdef CONFIG_MAC80211_LEDS
@@ -1191,6 +1202,24 @@ static inline char *ieee80211_get_assoc_led_name(struct ieee80211_hw *hw)
1191#endif 1202#endif
1192} 1203}
1193 1204
1205/**
1206 * ieee80211_get_radio_led_name - get name of radio LED
1207 *
1208 * mac80211 creates a radio change LED trigger for each wireless hardware
1209 * that can be used to drive LEDs if your driver registers a LED device.
1210 * This function returns the name (or %NULL if not configured for LEDs)
1211 * of the trigger so you can automatically link the LED device.
1212 *
1213 * @hw: the hardware to get the LED trigger name for
1214 */
1215static inline char *ieee80211_get_radio_led_name(struct ieee80211_hw *hw)
1216{
1217#ifdef CONFIG_MAC80211_LEDS
1218 return __ieee80211_get_radio_led_name(hw);
1219#else
1220 return NULL;
1221#endif
1222}
1194 1223
1195/* Register a new hardware PHYMODE capability to the stack. */ 1224/* Register a new hardware PHYMODE capability to the stack. */
1196int ieee80211_register_hwmode(struct ieee80211_hw *hw, 1225int ieee80211_register_hwmode(struct ieee80211_hw *hw,
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index 8ba69ae676ca..4807e5215a79 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -219,6 +219,7 @@ static int ieee80211_open(struct net_device *dev)
219 if (res) 219 if (res)
220 return res; 220 return res;
221 ieee80211_hw_config(local); 221 ieee80211_hw_config(local);
222 ieee80211_led_radio(local, local->hw.conf.radio_enabled);
222 } 223 }
223 224
224 switch (sdata->type) { 225 switch (sdata->type) {
@@ -392,6 +393,8 @@ static int ieee80211_stop(struct net_device *dev)
392 if (local->ops->stop) 393 if (local->ops->stop)
393 local->ops->stop(local_to_hw(local)); 394 local->ops->stop(local_to_hw(local));
394 395
396 ieee80211_led_radio(local, 0);
397
395 tasklet_disable(&local->tx_pending_tasklet); 398 tasklet_disable(&local->tx_pending_tasklet);
396 tasklet_disable(&local->tasklet); 399 tasklet_disable(&local->tasklet);
397 } 400 }
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 662e69ef7eed..b898b316bda1 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -500,8 +500,9 @@ struct ieee80211_local {
500 500
501#ifdef CONFIG_MAC80211_LEDS 501#ifdef CONFIG_MAC80211_LEDS
502 int tx_led_counter, rx_led_counter; 502 int tx_led_counter, rx_led_counter;
503 struct led_trigger *tx_led, *rx_led, *assoc_led; 503 struct led_trigger *tx_led, *rx_led, *assoc_led, *radio_led;
504 char tx_led_name[32], rx_led_name[32], assoc_led_name[32]; 504 char tx_led_name[32], rx_led_name[32],
505 assoc_led_name[32], radio_led_name[32];
505#endif 506#endif
506 507
507 u32 channel_use; 508 u32 channel_use;
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c
index 04ddce76135b..2604e21c05a8 100644
--- a/net/mac80211/ieee80211_ioctl.c
+++ b/net/mac80211/ieee80211_ioctl.c
@@ -21,6 +21,7 @@
21 21
22#include <net/mac80211.h> 22#include <net/mac80211.h>
23#include "ieee80211_i.h" 23#include "ieee80211_i.h"
24#include "ieee80211_led.h"
24#include "ieee80211_rate.h" 25#include "ieee80211_rate.h"
25#include "wpa.h" 26#include "wpa.h"
26#include "aes_ccm.h" 27#include "aes_ccm.h"
@@ -652,6 +653,7 @@ static int ieee80211_ioctl_siwtxpower(struct net_device *dev,
652 if (local->hw.conf.radio_enabled != !(data->txpower.disabled)) { 653 if (local->hw.conf.radio_enabled != !(data->txpower.disabled)) {
653 local->hw.conf.radio_enabled = !(data->txpower.disabled); 654 local->hw.conf.radio_enabled = !(data->txpower.disabled);
654 need_reconfig = 1; 655 need_reconfig = 1;
656 ieee80211_led_radio(local, local->hw.conf.radio_enabled);
655 } 657 }
656 658
657 if (need_reconfig) { 659 if (need_reconfig) {
diff --git a/net/mac80211/ieee80211_led.c b/net/mac80211/ieee80211_led.c
index 4cf89af9d100..f401484ab6d7 100644
--- a/net/mac80211/ieee80211_led.c
+++ b/net/mac80211/ieee80211_led.c
@@ -43,6 +43,16 @@ void ieee80211_led_assoc(struct ieee80211_local *local, bool associated)
43 led_trigger_event(local->assoc_led, LED_OFF); 43 led_trigger_event(local->assoc_led, LED_OFF);
44} 44}
45 45
46void ieee80211_led_radio(struct ieee80211_local *local, bool enabled)
47{
48 if (unlikely(!local->radio_led))
49 return;
50 if (enabled)
51 led_trigger_event(local->radio_led, LED_FULL);
52 else
53 led_trigger_event(local->radio_led, LED_OFF);
54}
55
46void ieee80211_led_init(struct ieee80211_local *local) 56void ieee80211_led_init(struct ieee80211_local *local)
47{ 57{
48 local->rx_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL); 58 local->rx_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL);
@@ -77,10 +87,25 @@ void ieee80211_led_init(struct ieee80211_local *local)
77 local->assoc_led = NULL; 87 local->assoc_led = NULL;
78 } 88 }
79 } 89 }
90
91 local->radio_led = kzalloc(sizeof(struct led_trigger), GFP_KERNEL);
92 if (local->radio_led) {
93 snprintf(local->radio_led_name, sizeof(local->radio_led_name),
94 "%sradio", wiphy_name(local->hw.wiphy));
95 local->radio_led->name = local->radio_led_name;
96 if (led_trigger_register(local->radio_led)) {
97 kfree(local->radio_led);
98 local->radio_led = NULL;
99 }
100 }
80} 101}
81 102
82void ieee80211_led_exit(struct ieee80211_local *local) 103void ieee80211_led_exit(struct ieee80211_local *local)
83{ 104{
105 if (local->radio_led) {
106 led_trigger_unregister(local->radio_led);
107 kfree(local->radio_led);
108 }
84 if (local->assoc_led) { 109 if (local->assoc_led) {
85 led_trigger_unregister(local->assoc_led); 110 led_trigger_unregister(local->assoc_led);
86 kfree(local->assoc_led); 111 kfree(local->assoc_led);
@@ -95,6 +120,16 @@ void ieee80211_led_exit(struct ieee80211_local *local)
95 } 120 }
96} 121}
97 122
123char *__ieee80211_get_radio_led_name(struct ieee80211_hw *hw)
124{
125 struct ieee80211_local *local = hw_to_local(hw);
126
127 if (local->radio_led)
128 return local->radio_led_name;
129 return NULL;
130}
131EXPORT_SYMBOL(__ieee80211_get_radio_led_name);
132
98char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw) 133char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw)
99{ 134{
100 struct ieee80211_local *local = hw_to_local(hw); 135 struct ieee80211_local *local = hw_to_local(hw);
diff --git a/net/mac80211/ieee80211_led.h b/net/mac80211/ieee80211_led.h
index 0feb22619835..77b1e1ba6039 100644
--- a/net/mac80211/ieee80211_led.h
+++ b/net/mac80211/ieee80211_led.h
@@ -16,6 +16,8 @@ extern void ieee80211_led_rx(struct ieee80211_local *local);
16extern void ieee80211_led_tx(struct ieee80211_local *local, int q); 16extern void ieee80211_led_tx(struct ieee80211_local *local, int q);
17extern void ieee80211_led_assoc(struct ieee80211_local *local, 17extern void ieee80211_led_assoc(struct ieee80211_local *local,
18 bool associated); 18 bool associated);
19extern void ieee80211_led_radio(struct ieee80211_local *local,
20 bool enabled);
19extern void ieee80211_led_init(struct ieee80211_local *local); 21extern void ieee80211_led_init(struct ieee80211_local *local);
20extern void ieee80211_led_exit(struct ieee80211_local *local); 22extern void ieee80211_led_exit(struct ieee80211_local *local);
21#else 23#else
@@ -29,6 +31,10 @@ static inline void ieee80211_led_assoc(struct ieee80211_local *local,
29 bool associated) 31 bool associated)
30{ 32{
31} 33}
34static inline void ieee80211_led_radio(struct ieee80211_local *local,
35 bool enabled)
36{
37}
32static inline void ieee80211_led_init(struct ieee80211_local *local) 38static inline void ieee80211_led_init(struct ieee80211_local *local)
33{ 39{
34} 40}