aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath6kl/cfg80211.c
diff options
context:
space:
mode:
authorKalle Valo <kvalo@qca.qualcomm.com>2012-07-19 09:00:56 -0400
committerKalle Valo <kvalo@qca.qualcomm.com>2012-10-24 04:49:37 -0400
commit84841ba29b1f55fb09703408477f097c7f8952f8 (patch)
tree9bcf8de2def815dd2a4d3a0a534e76b9ccb7fdd2 /drivers/net/wireless/ath/ath6kl/cfg80211.c
parent11f0bfcf73f4a90c8c0e0b244a272379b376adb1 (diff)
ath6kl: add support for changing contry code
To make it possible to change the country code from user space via nl80211 add handler for reg_notifier. The feature is only enabled when built time option CONFIG_ATH6KL_REGDOMAIN is enabled, which again depends on CFG80211_CERTIFICATION_ONUS for certication purposes. Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath6kl/cfg80211.c')
-rw-r--r--drivers/net/wireless/ath/ath6kl/cfg80211.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index 4f538f0027f2..f620af5e0dbb 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -3458,6 +3458,49 @@ void ath6kl_cfg80211_stop_all(struct ath6kl *ar)
3458 ath6kl_cfg80211_stop(vif); 3458 ath6kl_cfg80211_stop(vif);
3459} 3459}
3460 3460
3461static int ath6kl_cfg80211_reg_notify(struct wiphy *wiphy,
3462 struct regulatory_request *request)
3463{
3464 struct ath6kl *ar = wiphy_priv(wiphy);
3465 u32 rates[IEEE80211_NUM_BANDS];
3466 int ret, i;
3467
3468 ath6kl_dbg(ATH6KL_DBG_WLAN_CFG,
3469 "cfg reg_notify %c%c%s%s initiator %d\n",
3470 request->alpha2[0], request->alpha2[1],
3471 request->intersect ? " intersect" : "",
3472 request->processed ? " processed" : "",
3473 request->initiator);
3474
3475 ret = ath6kl_wmi_set_regdomain_cmd(ar->wmi, request->alpha2);
3476 if (ret) {
3477 ath6kl_err("failed to set regdomain: %d\n", ret);
3478 return ret;
3479 }
3480
3481 /*
3482 * Firmware will apply the regdomain change only after a scan is
3483 * issued and it will send a WMI_REGDOMAIN_EVENTID when it has been
3484 * changed.
3485 */
3486
3487 for (i = 0; i < IEEE80211_NUM_BANDS; i++)
3488 if (wiphy->bands[i])
3489 rates[i] = (1 << wiphy->bands[i]->n_bitrates) - 1;
3490
3491
3492 ret = ath6kl_wmi_beginscan_cmd(ar->wmi, 0, WMI_LONG_SCAN, false,
3493 false, 0, ATH6KL_FG_SCAN_INTERVAL,
3494 0, NULL, false, rates);
3495 if (ret) {
3496 ath6kl_err("failed to start scan for a regdomain change: %d\n",
3497 ret);
3498 return ret;
3499 }
3500
3501 return 0;
3502}
3503
3461static int ath6kl_cfg80211_vif_init(struct ath6kl_vif *vif) 3504static int ath6kl_cfg80211_vif_init(struct ath6kl_vif *vif)
3462{ 3505{
3463 vif->aggr_cntxt = aggr_init(vif); 3506 vif->aggr_cntxt = aggr_init(vif);
@@ -3590,6 +3633,10 @@ int ath6kl_cfg80211_init(struct ath6kl *ar)
3590 BIT(NL80211_IFTYPE_P2P_CLIENT); 3633 BIT(NL80211_IFTYPE_P2P_CLIENT);
3591 } 3634 }
3592 3635
3636 if (config_enabled(CONFIG_ATH6KL_REGDOMAIN) &&
3637 test_bit(ATH6KL_FW_CAPABILITY_REGDOMAIN, ar->fw_capabilities))
3638 wiphy->reg_notifier = ath6kl_cfg80211_reg_notify;
3639
3593 /* max num of ssids that can be probed during scanning */ 3640 /* max num of ssids that can be probed during scanning */
3594 wiphy->max_scan_ssids = MAX_PROBED_SSIDS; 3641 wiphy->max_scan_ssids = MAX_PROBED_SSIDS;
3595 3642