/* Update the radio state (enable/disable) and tx power targets * based on a new set of channel/regulatory information */ static void brcms_c_channels_commit(struct brcms_cm_info *wlc_cm) { struct brcms_c_info *wlc = wlc_cm->wlc; uint chan; struct txpwr_limits txpwr; /* search for the existence of any valid channel */ for (chan = 0; chan < MAXCHANNEL; chan++) { if (brcms_c_valid_channel20_db(wlc->cmi, chan)) break; } if (chan == MAXCHANNEL) chan = INVCHANNEL; /* * based on the channel search above, set or * clear WL_RADIO_COUNTRY_DISABLE. */ if (chan == INVCHANNEL) { /* * country/locale with no valid channels, set * the radio disable bit */ mboolset(wlc->pub->radio_disabled, WL_RADIO_COUNTRY_DISABLE); wiphy_err(wlc->wiphy, "wl%d: %s: no valid channel for \"%s\" " "nbands %d bandlocked %d\n", wlc->pub->unit, __func__, wlc_cm->country_abbrev, wlc->pub->_nbands, wlc->bandlocked); } else if (mboolisset(wlc->pub->radio_disabled, WL_RADIO_COUNTRY_DISABLE)) { /* * country/locale with valid channel, clear * the radio disable bit */ mboolclr(wlc->pub->radio_disabled, WL_RADIO_COUNTRY_DISABLE); } /* * Now that the country abbreviation is set, if the radio supports 2G, * then set channel 14 restrictions based on the new locale. */ if (wlc->pub->_nbands > 1 || wlc->band->bandtype == BRCM_BAND_2G) wlc_phy_chanspec_ch14_widefilter_set(wlc->band->pi, brcms_c_japan(wlc) ? true : false); if (wlc->pub->up && chan != INVCHANNEL) { brcms_c_channel_reg_limits(wlc_cm, wlc->chanspec, &txpwr); brcms_c_channel_min_txpower_limits_with_local_constraint(wlc_cm, &txpwr, BRCMS_TXPWR_MAX); wlc_phy_txpower_limit_set(wlc->band->pi, &txpwr, wlc->chanspec); } }
int wlc_channel_set_txpower_limit(wlc_cm_info_t *wlc_cm, u8 local_constraint_qdbm) { struct wlc_info *wlc = wlc_cm->wlc; struct txpwr_limits txpwr; wlc_channel_reg_limits(wlc_cm, wlc->chanspec, &txpwr); wlc_channel_min_txpower_limits_with_local_constraint(wlc_cm, &txpwr, local_constraint_qdbm); wlc_phy_txpower_limit_set(wlc->band->pi, &txpwr, wlc->chanspec); return 0; }
/* Update the radio state (enable/disable) and tx power targets * based on a new set of channel/regulatory information */ static void wlc_channels_commit(wlc_cm_info_t *wlc_cm) { struct wlc_info *wlc = wlc_cm->wlc; uint chan; struct txpwr_limits txpwr; /* search for the existence of any valid channel */ for (chan = 0; chan < MAXCHANNEL; chan++) { if (VALID_CHANNEL20_DB(wlc, chan)) { break; } } if (chan == MAXCHANNEL) chan = INVCHANNEL; /* based on the channel search above, set or clear WL_RADIO_COUNTRY_DISABLE */ if (chan == INVCHANNEL) { /* country/locale with no valid channels, set the radio disable bit */ mboolset(wlc->pub->radio_disabled, WL_RADIO_COUNTRY_DISABLE); WL_ERROR("wl%d: %s: no valid channel for \"%s\" nbands %d bandlocked %d\n", wlc->pub->unit, __func__, wlc_cm->country_abbrev, NBANDS(wlc), wlc->bandlocked); } else if (mboolisset(wlc->pub->radio_disabled, WL_RADIO_COUNTRY_DISABLE)) { /* country/locale with valid channel, clear the radio disable bit */ mboolclr(wlc->pub->radio_disabled, WL_RADIO_COUNTRY_DISABLE); } /* Now that the country abbreviation is set, if the radio supports 2G, then * set channel 14 restrictions based on the new locale. */ if (NBANDS(wlc) > 1 || BAND_2G(wlc->band->bandtype)) { wlc_phy_chanspec_ch14_widefilter_set(wlc->band->pi, wlc_japan(wlc) ? true : false); } if (wlc->pub->up && chan != INVCHANNEL) { wlc_channel_reg_limits(wlc_cm, wlc->chanspec, &txpwr); wlc_channel_min_txpower_limits_with_local_constraint(wlc_cm, &txpwr, WLC_TXPWR_MAX); wlc_phy_txpower_limit_set(wlc->band->pi, &txpwr, wlc->chanspec); } }