int brcms_c_stf_txchain_set(struct brcms_c_info *wlc, s32 int_val, bool force) { u8 txchain = (u8) int_val; u8 txstreams; uint i; if (wlc->stf->txchain == txchain) return 0; if ((txchain & ~wlc->stf->hw_txchain) || !(txchain & wlc->stf->hw_txchain)) return -EINVAL; /* * if nrate override is configured to be non-SISO STF mode, reject * reducing txchain to 1 */ txstreams = (u8) hweight8(txchain); if (txstreams > MAX_STREAMS_SUPPORTED) return -EINVAL; wlc->stf->txchain = txchain; wlc->stf->txstreams = txstreams; brcms_c_stf_stbc_tx_set(wlc, wlc->band->band_stf_stbc_tx); brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_2G_INDEX]); brcms_c_stf_ss_update(wlc, wlc->bandstate[BAND_5G_INDEX]); wlc->stf->txant = (wlc->stf->txstreams == 1) ? ANT_TX_FORCE_0 : ANT_TX_DEF; _brcms_c_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++) brcms_c_stf_txcore_set(wlc, (u8) i, txcore_default[i]); 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; }