diff options
author | Juuso Oikarinen <juuso.oikarinen@nokia.com> | 2010-07-26 20:30:09 -0400 |
---|---|---|
committer | Luciano Coelho <luciano.coelho@nokia.com> | 2010-09-28 05:15:04 -0400 |
commit | c2c192ac6c16e2e8f5cc8cf54e02bb1d4e0e761d (patch) | |
tree | 4a073339954bedb25666dbecc1089b144cdd1046 /drivers/net/wireless/wl12xx | |
parent | be86cbea1e9c3a4dd8faedcfa327495d09fe3531 (diff) |
wl1271: Add trigger to net_device oper_state to change BT coex priority
Add a trigger to net_device changes to monitor for oper_state changes in order
to be able to inform the firmware when association is fully complete (including
the EAP negotiation.)
Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Reviewed-by: Teemu Paasikivi <ext-teemu.3.paasikivi@nokia.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx')
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_main.c | 69 |
2 files changed, 70 insertions, 0 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h index 4134f4495b95..1098d1689b0e 100644 --- a/drivers/net/wireless/wl12xx/wl1271.h +++ b/drivers/net/wireless/wl12xx/wl1271.h | |||
@@ -350,6 +350,7 @@ struct wl1271 { | |||
350 | #define WL1271_FLAG_IDLE (10) | 350 | #define WL1271_FLAG_IDLE (10) |
351 | #define WL1271_FLAG_IDLE_REQUESTED (11) | 351 | #define WL1271_FLAG_IDLE_REQUESTED (11) |
352 | #define WL1271_FLAG_PSPOLL_FAILURE (12) | 352 | #define WL1271_FLAG_PSPOLL_FAILURE (12) |
353 | #define WL1271_FLAG_STA_STATE_SENT (13) | ||
353 | unsigned long flags; | 354 | unsigned long flags; |
354 | 355 | ||
355 | struct wl1271_partition_set part; | 356 | struct wl1271_partition_set part; |
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c index 776cd7c41148..45d4ce36343c 100644 --- a/drivers/net/wireless/wl12xx/wl1271_main.c +++ b/drivers/net/wireless/wl12xx/wl1271_main.c | |||
@@ -277,6 +277,67 @@ static struct platform_device wl1271_device = { | |||
277 | 277 | ||
278 | static LIST_HEAD(wl_list); | 278 | static LIST_HEAD(wl_list); |
279 | 279 | ||
280 | static int wl1271_dev_notify(struct notifier_block *me, unsigned long what, | ||
281 | void *arg) | ||
282 | { | ||
283 | struct net_device *dev = arg; | ||
284 | struct wireless_dev *wdev; | ||
285 | struct wiphy *wiphy; | ||
286 | struct ieee80211_hw *hw; | ||
287 | struct wl1271 *wl; | ||
288 | struct wl1271 *wl_temp; | ||
289 | int ret = 0; | ||
290 | |||
291 | /* Check that this notification is for us. */ | ||
292 | if (what != NETDEV_CHANGE) | ||
293 | return NOTIFY_DONE; | ||
294 | |||
295 | wdev = dev->ieee80211_ptr; | ||
296 | if (wdev == NULL) | ||
297 | return NOTIFY_DONE; | ||
298 | |||
299 | wiphy = wdev->wiphy; | ||
300 | if (wiphy == NULL) | ||
301 | return NOTIFY_DONE; | ||
302 | |||
303 | hw = wiphy_priv(wiphy); | ||
304 | if (hw == NULL) | ||
305 | return NOTIFY_DONE; | ||
306 | |||
307 | wl_temp = hw->priv; | ||
308 | list_for_each_entry(wl, &wl_list, list) { | ||
309 | if (wl == wl_temp) | ||
310 | break; | ||
311 | } | ||
312 | if (wl != wl_temp) | ||
313 | return NOTIFY_DONE; | ||
314 | |||
315 | mutex_lock(&wl->mutex); | ||
316 | |||
317 | if (wl->state == WL1271_STATE_OFF) | ||
318 | goto out; | ||
319 | |||
320 | if (!test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) | ||
321 | goto out; | ||
322 | |||
323 | ret = wl1271_ps_elp_wakeup(wl, false); | ||
324 | if (ret < 0) | ||
325 | goto out; | ||
326 | |||
327 | if ((dev->operstate == IF_OPER_UP) && | ||
328 | !test_and_set_bit(WL1271_FLAG_STA_STATE_SENT, &wl->flags)) { | ||
329 | wl1271_cmd_set_sta_state(wl); | ||
330 | wl1271_info("Association completed."); | ||
331 | } | ||
332 | |||
333 | wl1271_ps_elp_sleep(wl); | ||
334 | |||
335 | out: | ||
336 | mutex_unlock(&wl->mutex); | ||
337 | |||
338 | return NOTIFY_OK; | ||
339 | } | ||
340 | |||
280 | static void wl1271_conf_init(struct wl1271 *wl) | 341 | static void wl1271_conf_init(struct wl1271 *wl) |
281 | { | 342 | { |
282 | 343 | ||
@@ -814,6 +875,10 @@ static int wl1271_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
814 | return NETDEV_TX_OK; | 875 | return NETDEV_TX_OK; |
815 | } | 876 | } |
816 | 877 | ||
878 | static struct notifier_block wl1271_dev_notifier = { | ||
879 | .notifier_call = wl1271_dev_notify, | ||
880 | }; | ||
881 | |||
817 | static int wl1271_op_start(struct ieee80211_hw *hw) | 882 | static int wl1271_op_start(struct ieee80211_hw *hw) |
818 | { | 883 | { |
819 | wl1271_debug(DEBUG_MAC80211, "mac80211 start"); | 884 | wl1271_debug(DEBUG_MAC80211, "mac80211 start"); |
@@ -1783,6 +1848,7 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw, | |||
1783 | } | 1848 | } |
1784 | } else { | 1849 | } else { |
1785 | /* use defaults when not associated */ | 1850 | /* use defaults when not associated */ |
1851 | clear_bit(WL1271_FLAG_STA_STATE_SENT, &wl->flags); | ||
1786 | clear_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags); | 1852 | clear_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags); |
1787 | wl->aid = 0; | 1853 | wl->aid = 0; |
1788 | 1854 | ||
@@ -2307,6 +2373,8 @@ int wl1271_register_hw(struct wl1271 *wl) | |||
2307 | 2373 | ||
2308 | wl->mac80211_registered = true; | 2374 | wl->mac80211_registered = true; |
2309 | 2375 | ||
2376 | register_netdevice_notifier(&wl1271_dev_notifier); | ||
2377 | |||
2310 | wl1271_notice("loaded"); | 2378 | wl1271_notice("loaded"); |
2311 | 2379 | ||
2312 | return 0; | 2380 | return 0; |
@@ -2315,6 +2383,7 @@ EXPORT_SYMBOL_GPL(wl1271_register_hw); | |||
2315 | 2383 | ||
2316 | void wl1271_unregister_hw(struct wl1271 *wl) | 2384 | void wl1271_unregister_hw(struct wl1271 *wl) |
2317 | { | 2385 | { |
2386 | unregister_netdevice_notifier(&wl1271_dev_notifier); | ||
2318 | ieee80211_unregister_hw(wl->hw); | 2387 | ieee80211_unregister_hw(wl->hw); |
2319 | wl->mac80211_registered = false; | 2388 | wl->mac80211_registered = false; |
2320 | 2389 | ||