/* set the driver's current country and regulatory information using a country code * as the source. Look up built in country information found with the country code. */ static void wlc_set_country_common(wlc_cm_info_t *wlc_cm, const char *country_abbrev, const char *ccode, uint regrev, const country_info_t *country) { const locale_mimo_info_t *li_mimo; const locale_info_t *locale; struct wlc_info *wlc = wlc_cm->wlc; char prev_country_abbrev[WLC_CNTRY_BUF_SZ]; ASSERT(country != NULL); /* save current country state */ wlc_cm->country = country; memset(&prev_country_abbrev, 0, WLC_CNTRY_BUF_SZ); strncpy(prev_country_abbrev, wlc_cm->country_abbrev, WLC_CNTRY_BUF_SZ - 1); strncpy(wlc_cm->country_abbrev, country_abbrev, WLC_CNTRY_BUF_SZ - 1); strncpy(wlc_cm->ccode, ccode, WLC_CNTRY_BUF_SZ - 1); wlc_cm->regrev = regrev; /* disable/restore nmode based on country regulations */ li_mimo = wlc_get_mimo_2g(country->locale_mimo_2G); if (li_mimo && (li_mimo->flags & WLC_NO_MIMO)) { wlc_set_nmode(wlc, OFF); wlc->stf->no_cddstbc = true; } else { wlc->stf->no_cddstbc = false; if (N_ENAB(wlc->pub) != wlc->protection->nmode_user) wlc_set_nmode(wlc, wlc->protection->nmode_user); } wlc_stf_ss_update(wlc, wlc->bandstate[BAND_2G_INDEX]); wlc_stf_ss_update(wlc, wlc->bandstate[BAND_5G_INDEX]); /* set or restore gmode as required by regulatory */ locale = wlc_get_locale_2g(country->locale_2G); if (locale && (locale->flags & WLC_NO_OFDM)) { wlc_set_gmode(wlc, GMODE_LEGACY_B, false); } else { wlc_set_gmode(wlc, wlc->protection->gmode_user, false); } wlc_channels_init(wlc_cm, country); return; }
int wlc_stf_attach(struct wlc_info *wlc) { wlc->bandstate[BAND_2G_INDEX]->band_stf_ss_mode = PHY_TXC1_MODE_SISO; wlc->bandstate[BAND_5G_INDEX]->band_stf_ss_mode = PHY_TXC1_MODE_CDD; if (WLCISNPHY(wlc->band) && (wlc_phy_txpower_hw_ctrl_get(wlc->band->pi) != PHY_TPC_HW_ON)) wlc->bandstate[BAND_2G_INDEX]->band_stf_ss_mode = PHY_TXC1_MODE_CDD; wlc_stf_ss_update(wlc, wlc->bandstate[BAND_2G_INDEX]); wlc_stf_ss_update(wlc, wlc->bandstate[BAND_5G_INDEX]); wlc_stf_stbc_rx_ht_update(wlc, HT_CAP_RX_STBC_NO); wlc->bandstate[BAND_2G_INDEX]->band_stf_stbc_tx = OFF; wlc->bandstate[BAND_5G_INDEX]->band_stf_stbc_tx = OFF; if (WLC_STBC_CAP_PHY(wlc)) { wlc->stf->ss_algosel_auto = true; wlc->stf->ss_algo_channel = (u16) -1; /* Init the default value */ } return 0; }
int wlc_stf_txchain_set(struct wlc_info *wlc, s32 int_val, bool force) { u8 txchain = (u8) int_val; u8 txstreams; uint i; if (wlc->stf->txchain == txchain) return BCME_OK; if ((txchain & ~wlc->stf->hw_txchain) || !(txchain & wlc->stf->hw_txchain)) return BCME_RANGE; /* if nrate override is configured to be non-SISO STF mode, reject reducing txchain to 1 */ txstreams = (u8) WLC_BITSCNT(txchain); if (txstreams > MAX_STREAMS_SUPPORTED) return BCME_RANGE; if (txstreams == 1) { for (i = 0; i < NBANDS(wlc); i++) if ((RSPEC_STF(wlc->bandstate[i]->rspec_override) != PHY_TXC1_MODE_SISO) || (RSPEC_STF(wlc->bandstate[i]->mrspec_override) != PHY_TXC1_MODE_SISO)) { if (!force) return BCME_ERROR; /* over-write the override rspec */ if (RSPEC_STF(wlc->bandstate[i]->rspec_override) != PHY_TXC1_MODE_SISO) { wlc->bandstate[i]->rspec_override = 0; WL_ERROR("%s(): temp sense override non-SISO rspec_override\n", __func__); } if (RSPEC_STF (wlc->bandstate[i]->mrspec_override) != PHY_TXC1_MODE_SISO) { wlc->bandstate[i]->mrspec_override = 0; WL_ERROR("%s(): temp sense override non-SISO mrspec_override\n", __func__); } } } wlc->stf->txchain = txchain; wlc->stf->txstreams = txstreams; wlc_stf_stbc_tx_set(wlc, wlc->band->band_stf_stbc_tx); wlc_stf_ss_update(wlc, wlc->bandstate[BAND_2G_INDEX]); wlc_stf_ss_update(wlc, wlc->bandstate[BAND_5G_INDEX]); wlc->stf->txant = (wlc->stf->txstreams == 1) ? ANT_TX_FORCE_0 : ANT_TX_DEF; _wlc_stf_phy_txant_upd(wlc); wlc_phy_stf_chain_set(wlc->band->pi, wlc->stf->txchain, wlc->stf->rxchain); for (i = 1; i <= MAX_STREAMS_SUPPORTED; i++) wlc_stf_txcore_set(wlc, (u8) i, txcore_default[i]); return BCME_OK; }