Lines Matching +full:power +full:-

3 /*-
69 return (-1); in r92c_get_power_group()
72 KASSERT(0, ("wrong channel band (flags %08X)\n", c->ic_flags)); in r92c_get_power_group()
73 return (-1); in r92c_get_power_group()
82 struct ieee80211_channel *c, uint8_t power[RTWN_RIDX_COUNT]) in r92c_get_txpower()
84 struct r92c_softc *rs = sc->sc_priv; in r92c_get_txpower()
85 struct rtwn_r92c_txpwr *rt = rs->rs_txpwr; in r92c_get_txpower()
86 const struct rtwn_r92c_txagc *base = rs->rs_txagc; in r92c_get_txpower()
92 if (group == -1) { /* shouldn't happen */ in r92c_get_txpower()
93 device_printf(sc->sc_dev, "%s: incorrect channel\n", __func__); in r92c_get_txpower()
99 max_mcs = RTWN_RIDX_HT_MCS(sc->ntxchains * 8 - 1); in r92c_get_txpower()
102 if (rs->regulatory == 0) { in r92c_get_txpower()
104 power[ridx] = base[chain].pwr[0][ridx]; in r92c_get_txpower()
107 if (rs->regulatory == 3) { in r92c_get_txpower()
108 power[ridx] = base[chain].pwr[0][ridx]; in r92c_get_txpower()
111 max = rt->ht40_max_pwr[chain][group]; in r92c_get_txpower()
113 max = rt->ht20_max_pwr[chain][group]; in r92c_get_txpower()
114 if (power[ridx] > max) in r92c_get_txpower()
115 power[ridx] = max; in r92c_get_txpower()
116 } else if (rs->regulatory == 1) { in r92c_get_txpower()
118 power[ridx] = base[chain].pwr[group][ridx]; in r92c_get_txpower()
119 } else if (rs->regulatory != 2) in r92c_get_txpower()
120 power[ridx] = base[chain].pwr[0][ridx]; in r92c_get_txpower()
123 /* Compute per-CCK rate Tx power. */ in r92c_get_txpower()
125 power[ridx] += rt->cck_tx_pwr[chain][group]; in r92c_get_txpower()
127 htpow = rt->ht40_1s_tx_pwr[chain][group]; in r92c_get_txpower()
128 if (sc->ntxchains > 1) { in r92c_get_txpower()
130 diff = rt->ht40_2s_tx_pwr_diff[chain][group]; in r92c_get_txpower()
131 htpow = (htpow > diff) ? htpow - diff : 0; in r92c_get_txpower()
134 /* Compute per-OFDM rate Tx power. */ in r92c_get_txpower()
135 diff = rt->ofdm_tx_pwr_diff[chain][group]; in r92c_get_txpower()
136 ofdmpow = htpow + diff; /* HT->OFDM correction. */ in r92c_get_txpower()
138 power[ridx] += ofdmpow; in r92c_get_txpower()
140 /* Compute per-MCS Tx power. */ in r92c_get_txpower()
142 diff = rt->ht20_tx_pwr_diff[chain][group]; in r92c_get_txpower()
143 htpow += diff; /* HT40->HT20 correction. */ in r92c_get_txpower()
146 power[ridx] += htpow; in r92c_get_txpower()
150 if (power[ridx] > R92C_MAX_TX_PWR) in r92c_get_txpower()
151 power[ridx] = R92C_MAX_TX_PWR; in r92c_get_txpower()
157 uint8_t power[RTWN_RIDX_COUNT]) in r92c_write_txpower()
161 /* Write per-CCK rate Tx power. */ in r92c_write_txpower()
164 reg = RW(reg, R92C_TXAGC_A_CCK1, power[RTWN_RIDX_CCK1]); in r92c_write_txpower()
167 reg = RW(reg, R92C_TXAGC_A_CCK2, power[RTWN_RIDX_CCK2]); in r92c_write_txpower()
168 reg = RW(reg, R92C_TXAGC_A_CCK55, power[RTWN_RIDX_CCK55]); in r92c_write_txpower()
169 reg = RW(reg, R92C_TXAGC_A_CCK11, power[RTWN_RIDX_CCK11]); in r92c_write_txpower()
173 reg = RW(reg, R92C_TXAGC_B_CCK1, power[RTWN_RIDX_CCK1]); in r92c_write_txpower()
174 reg = RW(reg, R92C_TXAGC_B_CCK2, power[RTWN_RIDX_CCK2]); in r92c_write_txpower()
175 reg = RW(reg, R92C_TXAGC_B_CCK55, power[RTWN_RIDX_CCK55]); in r92c_write_txpower()
178 reg = RW(reg, R92C_TXAGC_B_CCK11, power[RTWN_RIDX_CCK11]); in r92c_write_txpower()
181 /* Write per-OFDM rate Tx power. */ in r92c_write_txpower()
183 SM(R92C_TXAGC_RATE06, power[RTWN_RIDX_OFDM6]) | in r92c_write_txpower()
184 SM(R92C_TXAGC_RATE09, power[RTWN_RIDX_OFDM9]) | in r92c_write_txpower()
185 SM(R92C_TXAGC_RATE12, power[RTWN_RIDX_OFDM12]) | in r92c_write_txpower()
186 SM(R92C_TXAGC_RATE18, power[RTWN_RIDX_OFDM18])); in r92c_write_txpower()
188 SM(R92C_TXAGC_RATE24, power[RTWN_RIDX_OFDM24]) | in r92c_write_txpower()
189 SM(R92C_TXAGC_RATE36, power[RTWN_RIDX_OFDM36]) | in r92c_write_txpower()
190 SM(R92C_TXAGC_RATE48, power[RTWN_RIDX_OFDM48]) | in r92c_write_txpower()
191 SM(R92C_TXAGC_RATE54, power[RTWN_RIDX_OFDM54])); in r92c_write_txpower()
192 /* Write per-MCS Tx power. */ in r92c_write_txpower()
194 SM(R92C_TXAGC_MCS00, power[RTWN_RIDX_HT_MCS(0)]) | in r92c_write_txpower()
195 SM(R92C_TXAGC_MCS01, power[RTWN_RIDX_HT_MCS(1)]) | in r92c_write_txpower()
196 SM(R92C_TXAGC_MCS02, power[RTWN_RIDX_HT_MCS(2)]) | in r92c_write_txpower()
197 SM(R92C_TXAGC_MCS03, power[RTWN_RIDX_HT_MCS(3)])); in r92c_write_txpower()
199 SM(R92C_TXAGC_MCS04, power[RTWN_RIDX_HT_MCS(4)]) | in r92c_write_txpower()
200 SM(R92C_TXAGC_MCS05, power[RTWN_RIDX_HT_MCS(5)]) | in r92c_write_txpower()
201 SM(R92C_TXAGC_MCS06, power[RTWN_RIDX_HT_MCS(6)]) | in r92c_write_txpower()
202 SM(R92C_TXAGC_MCS07, power[RTWN_RIDX_HT_MCS(7)])); in r92c_write_txpower()
203 if (sc->ntxchains >= 2) { in r92c_write_txpower()
205 SM(R92C_TXAGC_MCS08, power[RTWN_RIDX_HT_MCS(8)]) | in r92c_write_txpower()
206 SM(R92C_TXAGC_MCS09, power[RTWN_RIDX_HT_MCS(9)]) | in r92c_write_txpower()
207 SM(R92C_TXAGC_MCS10, power[RTWN_RIDX_HT_MCS(10)]) | in r92c_write_txpower()
208 SM(R92C_TXAGC_MCS11, power[RTWN_RIDX_HT_MCS(11)])); in r92c_write_txpower()
210 SM(R92C_TXAGC_MCS12, power[RTWN_RIDX_HT_MCS(12)]) | in r92c_write_txpower()
211 SM(R92C_TXAGC_MCS13, power[RTWN_RIDX_HT_MCS(13)]) | in r92c_write_txpower()
212 SM(R92C_TXAGC_MCS14, power[RTWN_RIDX_HT_MCS(14)]) | in r92c_write_txpower()
213 SM(R92C_TXAGC_MCS15, power[RTWN_RIDX_HT_MCS(15)])); in r92c_write_txpower()
220 uint8_t power[RTWN_RIDX_COUNT]; in r92c_set_txpower() local
223 for (i = 0; i < sc->ntxchains; i++) { in r92c_set_txpower()
224 memset(power, 0, sizeof(power)); in r92c_set_txpower()
225 /* Compute per-rate Tx power values. */ in r92c_set_txpower()
226 rtwn_r92c_get_txpower(sc, i, c, power); in r92c_set_txpower()
228 if (sc->sc_debug & RTWN_DEBUG_TXPWR) { in r92c_set_txpower()
231 max_mcs = RTWN_RIDX_HT_MCS(sc->ntxchains * 8 - 1); in r92c_set_txpower()
233 /* Dump per-rate Tx power values. */ in r92c_set_txpower()
234 printf("Tx power for chain %d:\n", i); in r92c_set_txpower()
236 printf("Rate %d = %u\n", ridx, power[ridx]); in r92c_set_txpower()
239 /* Write per-rate Tx power values to hardware. */ in r92c_set_txpower()
240 r92c_write_txpower(sc, i, power); in r92c_set_txpower()
247 struct r92c_softc *rs = sc->sc_priv; in r92c_set_bw40()
270 (rs->rf_chnlbw[0] & ~0xfff) | chan); in r92c_set_bw40()
276 struct r92c_softc *rs = sc->sc_priv; in r92c_set_bw20()
288 (rs->rf_chnlbw[0] & ~0xfff) | chan | R92C_RF_CHNLBW_BW20); in r92c_set_bw20()
294 struct r92c_softc *rs = sc->sc_priv; in r92c_set_chan()
300 /* Set Tx power for this new channel. */ in r92c_set_chan()
303 for (i = 0; i < sc->nrxchains; i++) { in r92c_set_chan()
305 RW(rs->rf_chnlbw[i], R92C_RF_CHNLBW_CHNL, chan)); in r92c_set_chan()
326 struct rtwn_softc *sc = ic->ic_softc; in r92c_scan_start()
327 struct r92c_softc *rs = sc->sc_priv; in r92c_scan_start()
334 rs->rs_scan_start(ic); in r92c_scan_start()
340 struct rtwn_softc *sc = ic->ic_softc; in r92c_scan_end()
341 struct r92c_softc *rs = sc->sc_priv; in r92c_scan_end()
348 rs->rs_scan_end(ic); in r92c_scan_end()