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

Commit b6862eff authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau
Browse files

mt76: move mt76_rate_power in mt76_dev



Move mt76_rate_power data structure from mt76x2_dev to mt76_dev in order
to share it with mt76x0 driver. Moreover move txpower_conf and
txpower_cur in mt76_dev

Signed-off-by: default avatarLorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 2cf5ac31
Loading
Loading
Loading
Loading
+17 −13
Original line number Diff line number Diff line
@@ -275,6 +275,19 @@ struct mt76_sband {
	struct mt76_channel_state *chan;
};

struct mt76_rate_power {
	union {
		struct {
			s8 cck[4];
			s8 ofdm[8];
			s8 stbc[10];
			s8 ht[16];
			s8 vht[10];
		};
		s8 all[48];
	};
};

/* addr req mask */
#define MT_VEND_TYPE_EEPROM	BIT(31)
#define MT_VEND_TYPE_CFG	BIT(30)
@@ -395,6 +408,10 @@ struct mt76_dev {
	struct debugfs_blob_wrapper otp;
	struct mt76_hw_cap cap;

	struct mt76_rate_power rate_power;
	int txpower_conf;
	int txpower_cur;

	u32 debugfs_reg;

	struct led_classdev led_cdev;
@@ -418,19 +435,6 @@ enum mt76_phy_type {
	MT_PHY_TYPE_VHT,
};

struct mt76_rate_power {
	union {
		struct {
			s8 cck[4];
			s8 ofdm[8];
			s8 stbc[10];
			s8 ht[16];
			s8 vht[10];
		};
		s8 all[48];
	};
};

struct mt76_rx_status {
	struct mt76_wcid *wcid;

+0 −3
Original line number Diff line number Diff line
@@ -82,8 +82,6 @@ struct mt76x2_dev {
	struct mutex mutex;

	const u16 *beacon_offsets;
	int txpower_conf;
	int txpower_cur;

	u8 txdone_seq;
	DECLARE_KFIFO_PTR(txstatus_fifo, struct mt76x02_tx_status);
@@ -113,7 +111,6 @@ struct mt76x2_dev {

	s8 target_power;
	s8 target_power_delta[2];
	struct mt76_rate_power rate_power;
	bool enable_tpc;

	u8 coverage_class;
+10 −10
Original line number Diff line number Diff line
@@ -55,16 +55,16 @@ static int read_txpower(struct seq_file *file, void *data)

	mt76_seq_puts_array(file, "Delta", dev->target_power_delta,
			    ARRAY_SIZE(dev->target_power_delta));
	mt76_seq_puts_array(file, "CCK", dev->rate_power.cck,
			    ARRAY_SIZE(dev->rate_power.cck));
	mt76_seq_puts_array(file, "OFDM", dev->rate_power.ofdm,
			    ARRAY_SIZE(dev->rate_power.ofdm));
	mt76_seq_puts_array(file, "STBC", dev->rate_power.stbc,
			    ARRAY_SIZE(dev->rate_power.stbc));
	mt76_seq_puts_array(file, "HT", dev->rate_power.ht,
			    ARRAY_SIZE(dev->rate_power.ht));
	mt76_seq_puts_array(file, "VHT", dev->rate_power.vht,
			    ARRAY_SIZE(dev->rate_power.vht));
	mt76_seq_puts_array(file, "CCK", dev->mt76.rate_power.cck,
			    ARRAY_SIZE(dev->mt76.rate_power.cck));
	mt76_seq_puts_array(file, "OFDM", dev->mt76.rate_power.ofdm,
			    ARRAY_SIZE(dev->mt76.rate_power.ofdm));
	mt76_seq_puts_array(file, "STBC", dev->mt76.rate_power.stbc,
			    ARRAY_SIZE(dev->mt76.rate_power.stbc));
	mt76_seq_puts_array(file, "HT", dev->mt76.rate_power.ht,
			    ARRAY_SIZE(dev->mt76.rate_power.ht));
	mt76_seq_puts_array(file, "VHT", dev->mt76.rate_power.vht,
			    ARRAY_SIZE(dev->mt76.rate_power.vht));
	return 0;
}

+1 −1
Original line number Diff line number Diff line
@@ -100,7 +100,7 @@ void mt76x2_mac_write_txwi(struct mt76x2_dev *dev, struct mt76x02_txwi *txwi,
	}
	spin_unlock_bh(&dev->mt76.lock);

	txpwr_adj = mt76x2_tx_get_txpwr_adj(dev, dev->txpower_conf,
	txpwr_adj = mt76x2_tx_get_txpwr_adj(dev, dev->mt76.txpower_conf,
					    max_txpwr_adj);
	txwi->ctl2 = FIELD_PREP(MT_TX_PWR_ADJ, txpwr_adj);

+4 −4
Original line number Diff line number Diff line
@@ -106,14 +106,14 @@ mt76x2_config(struct ieee80211_hw *hw, u32 changed)
	}

	if (changed & IEEE80211_CONF_CHANGE_POWER) {
		dev->txpower_conf = hw->conf.power_level * 2;
		dev->mt76.txpower_conf = hw->conf.power_level * 2;

		/* convert to per-chain power for 2x2 devices */
		dev->txpower_conf -= 6;
		dev->mt76.txpower_conf -= 6;

		if (test_bit(MT76_STATE_RUNNING, &dev->mt76.state)) {
			mt76x2_phy_set_txpower(dev);
			mt76x2_tx_set_txpwr_auto(dev, dev->txpower_conf);
			mt76x2_tx_set_txpwr_auto(dev, dev->mt76.txpower_conf);
		}
	}

@@ -206,7 +206,7 @@ mt76x2_get_txpower(struct ieee80211_hw *hw, struct ieee80211_vif *vif, int *dbm)
{
	struct mt76x2_dev *dev = hw->priv;

	*dbm = dev->txpower_cur / 2;
	*dbm = dev->mt76.txpower_cur / 2;

	/* convert from per-chain power to combined output on 2x2 devices */
	*dbm += 3;
Loading