Lines Matching refs:dev

11 mt76x2u_phy_channel_calibrate(struct mt76x02_dev *dev, bool mac_stopped)  in mt76x2u_phy_channel_calibrate()  argument
13 struct ieee80211_channel *chan = dev->mphy.chandef.chan; in mt76x2u_phy_channel_calibrate()
16 if (dev->cal.channel_cal_done) in mt76x2u_phy_channel_calibrate()
19 if (mt76x2_channel_silent(dev)) in mt76x2u_phy_channel_calibrate()
23 mt76x2u_mac_stop(dev); in mt76x2u_phy_channel_calibrate()
26 mt76x02_mcu_calibrate(dev, MCU_CAL_LC, 0); in mt76x2u_phy_channel_calibrate()
28 mt76x02_mcu_calibrate(dev, MCU_CAL_TX_LOFT, is_5ghz); in mt76x2u_phy_channel_calibrate()
29 mt76x02_mcu_calibrate(dev, MCU_CAL_TXIQ, is_5ghz); in mt76x2u_phy_channel_calibrate()
30 mt76x02_mcu_calibrate(dev, MCU_CAL_RXIQC_FI, is_5ghz); in mt76x2u_phy_channel_calibrate()
31 mt76x02_mcu_calibrate(dev, MCU_CAL_TEMP_SENSOR, 0); in mt76x2u_phy_channel_calibrate()
32 mt76x02_mcu_calibrate(dev, MCU_CAL_TX_SHAPING, 0); in mt76x2u_phy_channel_calibrate()
35 mt76x2_mac_resume(dev); in mt76x2u_phy_channel_calibrate()
36 mt76x2_apply_gain_adj(dev); in mt76x2u_phy_channel_calibrate()
37 mt76x02_edcca_init(dev); in mt76x2u_phy_channel_calibrate()
39 dev->cal.channel_cal_done = true; in mt76x2u_phy_channel_calibrate()
44 struct mt76x02_dev *dev; in mt76x2u_phy_calibrate() local
46 dev = container_of(work, struct mt76x02_dev, cal_work.work); in mt76x2u_phy_calibrate()
48 mutex_lock(&dev->mt76.mutex); in mt76x2u_phy_calibrate()
50 mt76x2u_phy_channel_calibrate(dev, false); in mt76x2u_phy_calibrate()
51 mt76x2_phy_tssi_compensate(dev); in mt76x2u_phy_calibrate()
52 mt76x2_phy_update_channel_gain(dev); in mt76x2u_phy_calibrate()
54 mutex_unlock(&dev->mt76.mutex); in mt76x2u_phy_calibrate()
56 ieee80211_queue_delayed_work(mt76_hw(dev), &dev->cal_work, in mt76x2u_phy_calibrate()
60 int mt76x2u_phy_set_channel(struct mt76x02_dev *dev, in mt76x2u_phy_set_channel() argument
85 bool scan = test_bit(MT76_SCANNING, &dev->mphy.state); in mt76x2u_phy_set_channel()
90 dev->cal.channel_cal_done = false; in mt76x2u_phy_set_channel()
121 mt76x2_read_rx_gain(dev); in mt76x2u_phy_set_channel()
122 mt76x2_phy_set_txpower_regs(dev, chan->band); in mt76x2u_phy_set_channel()
123 mt76x2_configure_tx_delay(dev, chan->band, bw); in mt76x2u_phy_set_channel()
124 mt76x2_phy_set_txpower(dev); in mt76x2u_phy_set_channel()
126 mt76x02_phy_set_band(dev, chan->band, ch_group_index & 1); in mt76x2u_phy_set_channel()
127 mt76x02_phy_set_bw(dev, chandef->width, ch_group_index); in mt76x2u_phy_set_channel()
129 mt76_rmw(dev, MT_EXT_CCA_CFG, in mt76x2u_phy_set_channel()
137 ret = mt76x2_mcu_set_channel(dev, channel, bw, bw_index, scan); in mt76x2u_phy_set_channel()
141 mt76x2_mcu_init_gain(dev, channel, dev->cal.rx.mcu_gain, true); in mt76x2u_phy_set_channel()
144 if (mt76xx_rev(dev) >= MT76XX_REV_E3) in mt76x2u_phy_set_channel()
145 mt76_set(dev, MT_BBP(RXO, 13), BIT(10)); in mt76x2u_phy_set_channel()
147 if (!dev->cal.init_cal_done) { in mt76x2u_phy_set_channel()
148 u8 val = mt76x02_eeprom_get(dev, MT_EE_BT_RCAL_RESULT); in mt76x2u_phy_set_channel()
151 mt76x02_mcu_calibrate(dev, MCU_CAL_R, 0); in mt76x2u_phy_set_channel()
154 mt76x02_mcu_calibrate(dev, MCU_CAL_RXDCOC, channel); in mt76x2u_phy_set_channel()
157 if (!dev->cal.init_cal_done) in mt76x2u_phy_set_channel()
158 mt76x02_mcu_calibrate(dev, MCU_CAL_RC, 0); in mt76x2u_phy_set_channel()
159 dev->cal.init_cal_done = true; in mt76x2u_phy_set_channel()
161 mt76_wr(dev, MT_BBP(AGC, 61), 0xff64a4e2); in mt76x2u_phy_set_channel()
162 mt76_wr(dev, MT_BBP(AGC, 7), 0x08081010); in mt76x2u_phy_set_channel()
163 mt76_wr(dev, MT_BBP(AGC, 11), 0x00000404); in mt76x2u_phy_set_channel()
164 mt76_wr(dev, MT_BBP(AGC, 2), 0x00007070); in mt76x2u_phy_set_channel()
165 mt76_wr(dev, MT_TXOP_CTRL_CFG, 0X04101b3f); in mt76x2u_phy_set_channel()
167 mt76_set(dev, MT_BBP(TXO, 4), BIT(25)); in mt76x2u_phy_set_channel()
168 mt76_set(dev, MT_BBP(RXO, 13), BIT(8)); in mt76x2u_phy_set_channel()
173 mt76x2u_phy_channel_calibrate(dev, true); in mt76x2u_phy_set_channel()
174 mt76x02_init_agc_gain(dev); in mt76x2u_phy_set_channel()
176 if (mt76x2_tssi_enabled(dev)) { in mt76x2u_phy_set_channel()
178 mt76_rmw_field(dev, MT_TX_ALC_CFG_1, MT_TX_ALC_CFG_1_TEMP_COMP, in mt76x2u_phy_set_channel()
180 mt76_rmw_field(dev, MT_TX_ALC_CFG_2, MT_TX_ALC_CFG_2_TEMP_COMP, in mt76x2u_phy_set_channel()
184 if (!mt76x2_channel_silent(dev)) { in mt76x2u_phy_set_channel()
188 chan = dev->mphy.chandef.chan; in mt76x2u_phy_set_channel()
191 if (mt76x02_ext_pa_enabled(dev, chan->band)) in mt76x2u_phy_set_channel()
193 mt76x02_mcu_calibrate(dev, MCU_CAL_TSSI, flag); in mt76x2u_phy_set_channel()
194 dev->cal.tssi_cal_done = true; in mt76x2u_phy_set_channel()
198 ieee80211_queue_delayed_work(mt76_hw(dev), &dev->cal_work, in mt76x2u_phy_set_channel()