aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/cfg.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/libertas/cfg.c')
-rw-r--r--drivers/net/wireless/libertas/cfg.c103
1 files changed, 5 insertions, 98 deletions
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c
index e90c56030e39..25f902760980 100644
--- a/drivers/net/wireless/libertas/cfg.c
+++ b/drivers/net/wireless/libertas/cfg.c
@@ -1979,113 +1979,20 @@ int lbs_cfg_register(struct lbs_private *priv)
1979 return ret; 1979 return ret;
1980} 1980}
1981 1981
1982/**
1983 * @brief This function sets DOMAIN INFO to FW
1984 * @param priv pointer to struct lbs_private
1985 * @return 0; -1
1986*/
1987static int lbs_11d_set_domain_info(struct lbs_private *priv)
1988{
1989 int ret;
1990
1991 ret = lbs_prepare_and_send_command(priv, CMD_802_11D_DOMAIN_INFO,
1992 CMD_ACT_SET,
1993 CMD_OPTION_WAITFORRSP, 0, NULL);
1994 if (ret)
1995 lbs_deb_11d("fail to dnld domain info\n");
1996
1997 return ret;
1998}
1999
2000static void lbs_send_domain_info_cmd_fw(struct wiphy *wiphy,
2001 struct regulatory_request *request)
2002{
2003 u8 no_of_triplet = 0;
2004 u8 no_of_parsed_chan = 0;
2005 u8 first_channel = 0, next_chan = 0, max_pwr = 0;
2006 u8 i, flag = 0;
2007 enum ieee80211_band band;
2008 struct ieee80211_supported_band *sband;
2009 struct ieee80211_channel *ch;
2010 struct lbs_private *priv = wiphy_priv(wiphy);
2011 struct lbs_802_11d_domain_reg *domain_info = &priv->domain_reg;
2012 int ret = 0;
2013
2014 lbs_deb_enter(LBS_DEB_CFG80211);
2015
2016 /* Set country code */
2017 domain_info->country_code[0] = request->alpha2[0];
2018 domain_info->country_code[1] = request->alpha2[1];
2019 domain_info->country_code[2] = ' ';
2020
2021 for (band = 0; band < IEEE80211_NUM_BANDS ; band++) {
2022
2023 if (!wiphy->bands[band])
2024 continue;
2025
2026 sband = wiphy->bands[band];
2027
2028 for (i = 0; i < sband->n_channels ; i++) {
2029 ch = &sband->channels[i];
2030 if (ch->flags & IEEE80211_CHAN_DISABLED)
2031 continue;
2032
2033 if (!flag) {
2034 flag = 1;
2035 next_chan = first_channel = (u32) ch->hw_value;
2036 max_pwr = ch->max_power;
2037 no_of_parsed_chan = 1;
2038 continue;
2039 }
2040
2041 if (ch->hw_value == next_chan + 1 &&
2042 ch->max_power == max_pwr) {
2043 next_chan++;
2044 no_of_parsed_chan++;
2045 } else {
2046 domain_info->triplet[no_of_triplet]
2047 .chans.first_channel = first_channel;
2048 domain_info->triplet[no_of_triplet]
2049 .chans.num_channels = no_of_parsed_chan;
2050 domain_info->triplet[no_of_triplet]
2051 .chans.max_power = max_pwr;
2052 no_of_triplet++;
2053 flag = 0;
2054 }
2055 }
2056 if (flag) {
2057 domain_info->triplet[no_of_triplet]
2058 .chans.first_channel = first_channel;
2059 domain_info->triplet[no_of_triplet]
2060 .chans.num_channels = no_of_parsed_chan;
2061 domain_info->triplet[no_of_triplet]
2062 .chans.max_power = max_pwr;
2063 no_of_triplet++;
2064 }
2065 }
2066
2067 domain_info->no_triplet = no_of_triplet;
2068
2069 /* Set domain info */
2070 ret = lbs_11d_set_domain_info(priv);
2071 if (ret)
2072 lbs_pr_err("11D: error setting domain info in FW\n");
2073
2074 lbs_deb_leave(LBS_DEB_CFG80211);
2075}
2076
2077int lbs_reg_notifier(struct wiphy *wiphy, 1982int lbs_reg_notifier(struct wiphy *wiphy,
2078 struct regulatory_request *request) 1983 struct regulatory_request *request)
2079{ 1984{
1985 struct lbs_private *priv = wiphy_priv(wiphy);
1986 int ret;
1987
2080 lbs_deb_enter_args(LBS_DEB_CFG80211, "cfg80211 regulatory domain " 1988 lbs_deb_enter_args(LBS_DEB_CFG80211, "cfg80211 regulatory domain "
2081 "callback for domain %c%c\n", request->alpha2[0], 1989 "callback for domain %c%c\n", request->alpha2[0],
2082 request->alpha2[1]); 1990 request->alpha2[1]);
2083 1991
2084 lbs_send_domain_info_cmd_fw(wiphy, request); 1992 ret = lbs_set_11d_domain_info(priv, request, wiphy->bands);
2085 1993
2086 lbs_deb_leave(LBS_DEB_CFG80211); 1994 lbs_deb_leave(LBS_DEB_CFG80211);
2087 1995 return ret;
2088 return 0;
2089} 1996}
2090 1997
2091void lbs_scan_deinit(struct lbs_private *priv) 1998void lbs_scan_deinit(struct lbs_private *priv)