Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -1006,14 +1006,16 @@ int mt76x0_phy_set_channel(struct mt76x02_dev *dev,

	/* enable vco */
	mt76x0_rf_set(dev, MT_RF(0, 4), BIT(7));
	if (scan)
	if (scan) {
		mt76x02_edcca_init(dev, false);
		return 0;
	}

	mt76x02_init_agc_gain(dev);
	mt76x0_phy_calibrate(dev, false);
	mt76x0_phy_set_txpower(dev);

	mt76x02_edcca_init(dev);
	mt76x02_edcca_init(dev, true);

	ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work,
				     MT_CALIBRATE_INTERVAL);
+1 −1
Original line number Diff line number Diff line
@@ -886,7 +886,7 @@ mt76x02_dfs_set_domain(struct mt76x02_dev *dev,
		tasklet_disable(&dfs_pd->dfs_tasklet);

		dev->ed_monitor = region == NL80211_DFS_ETSI;
		mt76x02_edcca_init(dev);
		mt76x02_edcca_init(dev, true);

		dfs_pd->region = region;
		mt76x02_dfs_init_params(dev);
+2 −2
Original line number Diff line number Diff line
@@ -891,12 +891,12 @@ mt76x02_edcca_tx_enable(struct mt76x02_dev *dev, bool 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_silent = 0;

	if (dev->ed_monitor) {
	if (dev->ed_monitor && enable) {
		struct ieee80211_channel *chan = dev->mt76.chandef.chan;
		u8 ed_th = chan->band == NL80211_BAND_5GHZ ? 0x0e : 0x20;

+1 −1
Original line number Diff line number Diff line
@@ -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,
				   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
+4 −2
Original line number Diff line number Diff line
@@ -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_TXOP_CTRL_CFG, 0x04101B3F);

	if (scan)
	if (scan) {
		mt76x02_edcca_init(dev, false);
		return 0;
	}

	mt76x2_phy_channel_calibrate(dev, true);
	mt76x02_init_agc_gain(dev);
@@ -254,7 +256,7 @@ int mt76x2_phy_set_channel(struct mt76x02_dev *dev,
			       0x38);
	}

	mt76x02_edcca_init(dev);
	mt76x02_edcca_init(dev, true);

	ieee80211_queue_delayed_work(mt76_hw(dev), &dev->cal_work,
				     MT_CALIBRATE_INTERVAL);