diff options
author | Vivek Natarajan <nataraja@qca.qualcomm.com> | 2011-09-06 03:31:36 -0400 |
---|---|---|
committer | Kalle Valo <kvalo@qca.qualcomm.com> | 2011-09-06 03:58:53 -0400 |
commit | 060337604577e55c5bf3246bcaf161929c603d54 (patch) | |
tree | 6d62df3cd7b7bafa207ce82f1738e2d85e6f3bae /drivers/net/wireless/ath/ath6kl/wmi.c | |
parent | 6e4604c8b91743c5a797fc2674544618854ed0f2 (diff) |
ath6kl: Process regulatory requests from firmware.
Process the regulatory code from eeprom and pass the
country information to cfg80211.
kvalo: add space between struct name and *
Signed-off-by: Vivek Natarajan <nataraja@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath6kl/wmi.c')
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/wmi.c | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c index b56830f6d474..dbddb91389d0 100644 --- a/drivers/net/wireless/ath/ath6kl/wmi.c +++ b/drivers/net/wireless/ath/ath6kl/wmi.c | |||
@@ -18,6 +18,8 @@ | |||
18 | #include "core.h" | 18 | #include "core.h" |
19 | #include "debug.h" | 19 | #include "debug.h" |
20 | #include "testmode.h" | 20 | #include "testmode.h" |
21 | #include "../regd.h" | ||
22 | #include "../regd_common.h" | ||
21 | 23 | ||
22 | static int ath6kl_wmi_sync_point(struct wmi *wmi); | 24 | static int ath6kl_wmi_sync_point(struct wmi *wmi); |
23 | 25 | ||
@@ -779,6 +781,81 @@ static int ath6kl_wmi_connect_event_rx(struct wmi *wmi, u8 *datap, int len) | |||
779 | return 0; | 781 | return 0; |
780 | } | 782 | } |
781 | 783 | ||
784 | static struct country_code_to_enum_rd * | ||
785 | ath6kl_regd_find_country(u16 countryCode) | ||
786 | { | ||
787 | int i; | ||
788 | |||
789 | for (i = 0; i < ARRAY_SIZE(allCountries); i++) { | ||
790 | if (allCountries[i].countryCode == countryCode) | ||
791 | return &allCountries[i]; | ||
792 | } | ||
793 | |||
794 | return NULL; | ||
795 | } | ||
796 | |||
797 | static struct reg_dmn_pair_mapping * | ||
798 | ath6kl_get_regpair(u16 regdmn) | ||
799 | { | ||
800 | int i; | ||
801 | |||
802 | if (regdmn == NO_ENUMRD) | ||
803 | return NULL; | ||
804 | |||
805 | for (i = 0; i < ARRAY_SIZE(regDomainPairs); i++) { | ||
806 | if (regDomainPairs[i].regDmnEnum == regdmn) | ||
807 | return ®DomainPairs[i]; | ||
808 | } | ||
809 | |||
810 | return NULL; | ||
811 | } | ||
812 | |||
813 | static struct country_code_to_enum_rd * | ||
814 | ath6kl_regd_find_country_by_rd(u16 regdmn) | ||
815 | { | ||
816 | int i; | ||
817 | |||
818 | for (i = 0; i < ARRAY_SIZE(allCountries); i++) { | ||
819 | if (allCountries[i].regDmnEnum == regdmn) | ||
820 | return &allCountries[i]; | ||
821 | } | ||
822 | |||
823 | return NULL; | ||
824 | } | ||
825 | |||
826 | static void ath6kl_wmi_regdomain_event(struct wmi *wmi, u8 *datap, int len) | ||
827 | { | ||
828 | |||
829 | struct ath6kl_wmi_regdomain *ev; | ||
830 | struct country_code_to_enum_rd *country = NULL; | ||
831 | struct reg_dmn_pair_mapping *regpair = NULL; | ||
832 | char alpha2[2]; | ||
833 | u32 reg_code; | ||
834 | |||
835 | ev = (struct ath6kl_wmi_regdomain *) datap; | ||
836 | reg_code = le32_to_cpu(ev->reg_code); | ||
837 | |||
838 | if ((reg_code >> ATH6KL_COUNTRY_RD_SHIFT) & COUNTRY_ERD_FLAG) | ||
839 | country = ath6kl_regd_find_country((u16) reg_code); | ||
840 | else if (!(((u16) reg_code & WORLD_SKU_MASK) == WORLD_SKU_PREFIX)) { | ||
841 | |||
842 | regpair = ath6kl_get_regpair((u16) reg_code); | ||
843 | country = ath6kl_regd_find_country_by_rd((u16) reg_code); | ||
844 | ath6kl_dbg(ATH6KL_DBG_WMI, "ath6kl: Regpair used: 0x%0x\n", | ||
845 | regpair->regDmnEnum); | ||
846 | } | ||
847 | |||
848 | if (country) { | ||
849 | alpha2[0] = country->isoName[0]; | ||
850 | alpha2[1] = country->isoName[1]; | ||
851 | |||
852 | regulatory_hint(wmi->parent_dev->wdev->wiphy, alpha2); | ||
853 | |||
854 | ath6kl_dbg(ATH6KL_DBG_WMI, "ath6kl: Country alpha2 being used: %c%c\n", | ||
855 | alpha2[0], alpha2[1]); | ||
856 | } | ||
857 | } | ||
858 | |||
782 | static int ath6kl_wmi_disconnect_event_rx(struct wmi *wmi, u8 *datap, int len) | 859 | static int ath6kl_wmi_disconnect_event_rx(struct wmi *wmi, u8 *datap, int len) |
783 | { | 860 | { |
784 | struct wmi_disconnect_event *ev; | 861 | struct wmi_disconnect_event *ev; |
@@ -3068,6 +3145,7 @@ int ath6kl_wmi_control_rx(struct wmi *wmi, struct sk_buff *skb) | |||
3068 | break; | 3145 | break; |
3069 | case WMI_REGDOMAIN_EVENTID: | 3146 | case WMI_REGDOMAIN_EVENTID: |
3070 | ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_REGDOMAIN_EVENTID\n"); | 3147 | ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_REGDOMAIN_EVENTID\n"); |
3148 | ath6kl_wmi_regdomain_event(wmi, datap, len); | ||
3071 | break; | 3149 | break; |
3072 | case WMI_PSTREAM_TIMEOUT_EVENTID: | 3150 | case WMI_PSTREAM_TIMEOUT_EVENTID: |
3073 | ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_PSTREAM_TIMEOUT_EVENTID\n"); | 3151 | ath6kl_dbg(ATH6KL_DBG_WMI, "WMI_PSTREAM_TIMEOUT_EVENTID\n"); |