Commit 25628b1d authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by sanglipeng
Browse files

mt76: move band capabilities in mt76_phy

stable inclusion
from stable-v5.10.190
commit b85c7882fd3cc226a2fe26957a7a9fe27b75f753
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I928UI

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=b85c7882fd3cc226a2fe26957a7a9fe27b75f753



--------------------------------

[ Upstream commit 48dbce5c ]

This is a preliminary patch to move properly support mt7915 dbdc

Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
Stable-dep-of: 421033de ("wifi: mt76: mt7615: do not advertise 5 GHz on first phy of MT7615D (DBDC)")
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent 81ab9cda
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -160,9 +160,9 @@ static void mt76_init_stream_cap(struct mt76_phy *phy,

void mt76_set_stream_caps(struct mt76_phy *phy, bool vht)
{
	if (phy->dev->cap.has_2ghz)
	if (phy->cap.has_2ghz)
		mt76_init_stream_cap(phy, &phy->sband_2g.sband, false);
	if (phy->dev->cap.has_5ghz)
	if (phy->cap.has_5ghz)
		mt76_init_stream_cap(phy, &phy->sband_5g.sband, vht);
}
EXPORT_SYMBOL_GPL(mt76_set_stream_caps);
@@ -463,13 +463,13 @@ int mt76_register_device(struct mt76_dev *dev, bool vht,
	dev_set_drvdata(dev->dev, dev);
	mt76_phy_init(dev, hw);

	if (dev->cap.has_2ghz) {
	if (phy->cap.has_2ghz) {
		ret = mt76_init_sband_2g(dev, rates, n_rates);
		if (ret)
			return ret;
	}

	if (dev->cap.has_5ghz) {
	if (phy->cap.has_5ghz) {
		ret = mt76_init_sband_5g(dev, rates + 4, n_rates - 4, vht);
		if (ret)
			return ret;
+1 −1
Original line number Diff line number Diff line
@@ -561,6 +561,7 @@ struct mt76_phy {
	struct mt76_channel_state *chan_state;
	ktime_t survey_time;

	struct mt76_hw_cap cap;
	struct mt76_sband sband_2g;
	struct mt76_sband sband_5g;

@@ -630,7 +631,6 @@ struct mt76_dev {

	struct debugfs_blob_wrapper eeprom;
	struct debugfs_blob_wrapper otp;
	struct mt76_hw_cap cap;

	struct mt76_rate_power rate_power;

+1 −1
Original line number Diff line number Diff line
@@ -170,7 +170,7 @@ int mt7603_eeprom_init(struct mt7603_dev *dev)
	}

	eeprom = (u8 *)dev->mt76.eeprom.data;
	dev->mt76.cap.has_2ghz = true;
	dev->mphy.cap.has_2ghz = true;
	memcpy(dev->mt76.macaddr, eeprom + MT_EE_MAC_ADDR, ETH_ALEN);

	/* Check for 1SS devices */
+1 −1
Original line number Diff line number Diff line
@@ -202,7 +202,7 @@ int mt7615_dma_init(struct mt7615_dev *dev)
	int ret;

	/* Increase buffer size to receive large VHT MPDUs */
	if (dev->mt76.cap.has_5ghz)
	if (dev->mphy.cap.has_5ghz)
		rx_buf_size *= 2;

	mt76_dma_attach(&dev->mt76);
+8 −8
Original line number Diff line number Diff line
@@ -100,20 +100,20 @@ mt7615_eeprom_parse_hw_band_cap(struct mt7615_dev *dev)

	if (is_mt7663(&dev->mt76)) {
		/* dual band */
		dev->mt76.cap.has_2ghz = true;
		dev->mt76.cap.has_5ghz = true;
		dev->mphy.cap.has_2ghz = true;
		dev->mphy.cap.has_5ghz = true;
		return;
	}

	if (is_mt7622(&dev->mt76)) {
		/* 2GHz only */
		dev->mt76.cap.has_2ghz = true;
		dev->mphy.cap.has_2ghz = true;
		return;
	}

	if (is_mt7611(&dev->mt76)) {
		/* 5GHz only */
		dev->mt76.cap.has_5ghz = true;
		dev->mphy.cap.has_5ghz = true;
		return;
	}

@@ -121,17 +121,17 @@ mt7615_eeprom_parse_hw_band_cap(struct mt7615_dev *dev)
			eeprom[MT_EE_WIFI_CONF]);
	switch (val) {
	case MT_EE_5GHZ:
		dev->mt76.cap.has_5ghz = true;
		dev->mphy.cap.has_5ghz = true;
		break;
	case MT_EE_2GHZ:
		dev->mt76.cap.has_2ghz = true;
		dev->mphy.cap.has_2ghz = true;
		break;
	case MT_EE_DBDC:
		dev->dbdc_support = true;
		/* fall through */
	default:
		dev->mt76.cap.has_2ghz = true;
		dev->mt76.cap.has_5ghz = true;
		dev->mphy.cap.has_2ghz = true;
		dev->mphy.cap.has_5ghz = true;
		break;
	}
}
Loading