Commit 20c06572 authored by Felix Fietkau's avatar Felix Fietkau

mt76: explicitly disable energy detect cca during scan

Avoid reusing the previous channel's tx blocking state
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 1564fa92
...@@ -1006,14 +1006,16 @@ int mt76x0_phy_set_channel(struct mt76x02_dev *dev, ...@@ -1006,14 +1006,16 @@ int mt76x0_phy_set_channel(struct mt76x02_dev *dev,
/* enable vco */ /* enable vco */
mt76x0_rf_set(dev, MT_RF(0, 4), BIT(7)); mt76x0_rf_set(dev, MT_RF(0, 4), BIT(7));
if (scan) if (scan) {
mt76x02_edcca_init(dev, false);
return 0; return 0;
}
mt76x02_init_agc_gain(dev); mt76x02_init_agc_gain(dev);
mt76x0_phy_calibrate(dev, false); mt76x0_phy_calibrate(dev, false);
mt76x0_phy_set_txpower(dev); mt76x0_phy_set_txpower(dev);
mt76x02_edcca_init(dev); mt76x02_edcca_init(dev, true);
ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work, ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work,
MT_CALIBRATE_INTERVAL); MT_CALIBRATE_INTERVAL);
......
...@@ -886,7 +886,7 @@ mt76x02_dfs_set_domain(struct mt76x02_dev *dev, ...@@ -886,7 +886,7 @@ mt76x02_dfs_set_domain(struct mt76x02_dev *dev,
tasklet_disable(&dfs_pd->dfs_tasklet); tasklet_disable(&dfs_pd->dfs_tasklet);
dev->ed_monitor = region == NL80211_DFS_ETSI; dev->ed_monitor = region == NL80211_DFS_ETSI;
mt76x02_edcca_init(dev); mt76x02_edcca_init(dev, true);
dfs_pd->region = region; dfs_pd->region = region;
mt76x02_dfs_init_params(dev); mt76x02_dfs_init_params(dev);
......
...@@ -891,12 +891,12 @@ mt76x02_edcca_tx_enable(struct mt76x02_dev *dev, bool enable) ...@@ -891,12 +891,12 @@ mt76x02_edcca_tx_enable(struct mt76x02_dev *dev, bool enable)
dev->ed_tx_blocked = !enable; dev->ed_tx_blocked = !enable;
} }
void mt76x02_edcca_init(struct mt76x02_dev *dev) void mt76x02_edcca_init(struct mt76x02_dev *dev, bool enable)
{ {
dev->ed_trigger = 0; dev->ed_trigger = 0;
dev->ed_silent = 0; dev->ed_silent = 0;
if (dev->ed_monitor) { if (dev->ed_monitor && enable) {
struct ieee80211_channel *chan = dev->mt76.chandef.chan; struct ieee80211_channel *chan = dev->mt76.chandef.chan;
u8 ed_th = chan->band == NL80211_BAND_5GHZ ? 0x0e : 0x20; u8 ed_th = chan->band == NL80211_BAND_5GHZ ? 0x0e : 0x20;
......
...@@ -207,5 +207,5 @@ int mt76x02_mac_set_beacon(struct mt76x02_dev *dev, u8 vif_idx, ...@@ -207,5 +207,5 @@ int mt76x02_mac_set_beacon(struct mt76x02_dev *dev, u8 vif_idx,
void mt76x02_mac_set_beacon_enable(struct mt76x02_dev *dev, void mt76x02_mac_set_beacon_enable(struct mt76x02_dev *dev,
struct ieee80211_vif *vif, bool val); struct ieee80211_vif *vif, bool val);
void mt76x02_edcca_init(struct mt76x02_dev *dev); void mt76x02_edcca_init(struct mt76x02_dev *dev, bool enable);
#endif #endif
...@@ -240,8 +240,10 @@ int mt76x2_phy_set_channel(struct mt76x02_dev *dev, ...@@ -240,8 +240,10 @@ int mt76x2_phy_set_channel(struct mt76x02_dev *dev,
mt76_wr(dev, MT_BBP(AGC, 2), 0x00007070); mt76_wr(dev, MT_BBP(AGC, 2), 0x00007070);
mt76_wr(dev, MT_TXOP_CTRL_CFG, 0x04101B3F); mt76_wr(dev, MT_TXOP_CTRL_CFG, 0x04101B3F);
if (scan) if (scan) {
mt76x02_edcca_init(dev, false);
return 0; return 0;
}
mt76x2_phy_channel_calibrate(dev, true); mt76x2_phy_channel_calibrate(dev, true);
mt76x02_init_agc_gain(dev); mt76x02_init_agc_gain(dev);
...@@ -254,7 +256,7 @@ int mt76x2_phy_set_channel(struct mt76x02_dev *dev, ...@@ -254,7 +256,7 @@ int mt76x2_phy_set_channel(struct mt76x02_dev *dev,
0x38); 0x38);
} }
mt76x02_edcca_init(dev); mt76x02_edcca_init(dev, true);
ieee80211_queue_delayed_work(mt76_hw(dev), &dev->cal_work, ieee80211_queue_delayed_work(mt76_hw(dev), &dev->cal_work,
MT_CALIBRATE_INTERVAL); MT_CALIBRATE_INTERVAL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment