Skip to content

Commit 9b2ea8e

Browse files
LorenzoBianconinbd168
authored andcommitted
mt76: connac: set 6G phymode in single-sku support
Configure tx rate power for 6GHz channels. This is a preliminary patch to enable 6GHz band for mt7921 devices. Tested-by: Deren Wu <[email protected]> Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
1 parent cee3fd2 commit 9b2ea8e

File tree

3 files changed

+49
-4
lines changed

3 files changed

+49
-4
lines changed

drivers/net/wireless/mediatek/mt76/eeprom.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,9 @@ s8 mt76_get_rate_power_limits(struct mt76_phy *phy,
285285
case NL80211_BAND_5GHZ:
286286
band = '5';
287287
break;
288+
case NL80211_BAND_6GHZ:
289+
band = '6';
290+
break;
288291
default:
289292
return target_power;
290293
}

drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1839,6 +1839,9 @@ static s8 mt76_connac_get_ch_power(struct mt76_phy *phy,
18391839
case NL80211_BAND_5GHZ:
18401840
sband = &phy->sband_5g.sband;
18411841
break;
1842+
case NL80211_BAND_6GHZ:
1843+
sband = &phy->sband_6g.sband;
1844+
break;
18421845
default:
18431846
return target_power;
18441847
}
@@ -1880,6 +1883,24 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy,
18801883
142, 144, 149, 151, 153, 155, 157,
18811884
159, 161, 165
18821885
};
1886+
static const u8 chan_list_6ghz[] = {
1887+
1, 3, 5, 7, 9, 11, 13,
1888+
15, 17, 19, 21, 23, 25, 27,
1889+
29, 33, 35, 37, 39, 41, 43,
1890+
45, 47, 49, 51, 53, 55, 57,
1891+
59, 61, 65, 67, 69, 71, 73,
1892+
75, 77, 79, 81, 83, 85, 87,
1893+
89, 91, 93, 97, 99, 101, 103,
1894+
105, 107, 109, 111, 113, 115, 117,
1895+
119, 121, 123, 125, 129, 131, 133,
1896+
135, 137, 139, 141, 143, 145, 147,
1897+
149, 151, 153, 155, 157, 161, 163,
1898+
165, 167, 169, 171, 173, 175, 177,
1899+
179, 181, 183, 185, 187, 189, 193,
1900+
195, 197, 199, 201, 203, 205, 207,
1901+
209, 211, 213, 215, 217, 219, 221,
1902+
225, 227, 229, 233
1903+
};
18831904
int i, n_chan, batch_size, idx = 0, tx_power, last_ch;
18841905
struct mt76_connac_sku_tlv sku_tlbv;
18851906
struct mt76_power_limits limits;
@@ -1893,6 +1914,9 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy,
18931914
if (band == NL80211_BAND_2GHZ) {
18941915
n_chan = ARRAY_SIZE(chan_list_2ghz);
18951916
ch_list = chan_list_2ghz;
1917+
} else if (band == NL80211_BAND_6GHZ) {
1918+
n_chan = ARRAY_SIZE(chan_list_6ghz);
1919+
ch_list = chan_list_6ghz;
18961920
} else {
18971921
n_chan = ARRAY_SIZE(chan_list_5ghz);
18981922
ch_list = chan_list_5ghz;
@@ -1901,13 +1925,13 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy,
19011925

19021926
if (!phy->cap.has_5ghz)
19031927
last_ch = chan_list_2ghz[n_chan - 1];
1928+
else if (phy->cap.has_6ghz)
1929+
last_ch = chan_list_6ghz[n_chan - 1];
19041930
else
19051931
last_ch = chan_list_5ghz[n_chan - 1];
19061932

19071933
for (i = 0; i < batch_size; i++) {
1908-
struct mt76_connac_tx_power_limit_tlv tx_power_tlv = {
1909-
.band = band == NL80211_BAND_2GHZ ? 1 : 2,
1910-
};
1934+
struct mt76_connac_tx_power_limit_tlv tx_power_tlv = {};
19111935
int j, err, msg_len, num_ch;
19121936
struct sk_buff *skb;
19131937

@@ -1923,6 +1947,18 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy,
19231947
memcpy(tx_power_tlv.alpha2, dev->alpha2, sizeof(dev->alpha2));
19241948
tx_power_tlv.n_chan = num_ch;
19251949

1950+
switch (band) {
1951+
case NL80211_BAND_2GHZ:
1952+
tx_power_tlv.band = 1;
1953+
break;
1954+
case NL80211_BAND_6GHZ:
1955+
tx_power_tlv.band = 3;
1956+
break;
1957+
default:
1958+
tx_power_tlv.band = 2;
1959+
break;
1960+
}
1961+
19261962
for (j = 0; j < num_ch; j++, idx++) {
19271963
struct ieee80211_channel chan = {
19281964
.hw_value = ch_list[idx],
@@ -1973,6 +2009,12 @@ int mt76_connac_mcu_set_rate_txpower(struct mt76_phy *phy)
19732009
if (err < 0)
19742010
return err;
19752011
}
2012+
if (phy->cap.has_6ghz) {
2013+
err = mt76_connac_mcu_rate_txpower_band(phy,
2014+
NL80211_BAND_6GHZ);
2015+
if (err < 0)
2016+
return err;
2017+
}
19762018

19772019
return 0;
19782020
}

drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,7 @@ struct mt76_connac_tx_power_limit_tlv {
964964
__le16 len;
965965
/* DW1 - cmd hint */
966966
u8 n_chan; /* # channel */
967-
u8 band; /* 2.4GHz - 5GHz */
967+
u8 band; /* 2.4GHz - 5GHz - 6GHz */
968968
u8 last_msg;
969969
u8 pad1;
970970
/* DW3 */

0 commit comments

Comments
 (0)