@@ -1839,6 +1839,9 @@ static s8 mt76_connac_get_ch_power(struct mt76_phy *phy,
1839
1839
case NL80211_BAND_5GHZ :
1840
1840
sband = & phy -> sband_5g .sband ;
1841
1841
break ;
1842
+ case NL80211_BAND_6GHZ :
1843
+ sband = & phy -> sband_6g .sband ;
1844
+ break ;
1842
1845
default :
1843
1846
return target_power ;
1844
1847
}
@@ -1880,6 +1883,24 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy,
1880
1883
142 , 144 , 149 , 151 , 153 , 155 , 157 ,
1881
1884
159 , 161 , 165
1882
1885
};
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
+ };
1883
1904
int i , n_chan , batch_size , idx = 0 , tx_power , last_ch ;
1884
1905
struct mt76_connac_sku_tlv sku_tlbv ;
1885
1906
struct mt76_power_limits limits ;
@@ -1893,6 +1914,9 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy,
1893
1914
if (band == NL80211_BAND_2GHZ ) {
1894
1915
n_chan = ARRAY_SIZE (chan_list_2ghz );
1895
1916
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 ;
1896
1920
} else {
1897
1921
n_chan = ARRAY_SIZE (chan_list_5ghz );
1898
1922
ch_list = chan_list_5ghz ;
@@ -1901,13 +1925,13 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy,
1901
1925
1902
1926
if (!phy -> cap .has_5ghz )
1903
1927
last_ch = chan_list_2ghz [n_chan - 1 ];
1928
+ else if (phy -> cap .has_6ghz )
1929
+ last_ch = chan_list_6ghz [n_chan - 1 ];
1904
1930
else
1905
1931
last_ch = chan_list_5ghz [n_chan - 1 ];
1906
1932
1907
1933
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 = {};
1911
1935
int j , err , msg_len , num_ch ;
1912
1936
struct sk_buff * skb ;
1913
1937
@@ -1923,6 +1947,18 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy,
1923
1947
memcpy (tx_power_tlv .alpha2 , dev -> alpha2 , sizeof (dev -> alpha2 ));
1924
1948
tx_power_tlv .n_chan = num_ch ;
1925
1949
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
+
1926
1962
for (j = 0 ; j < num_ch ; j ++ , idx ++ ) {
1927
1963
struct ieee80211_channel chan = {
1928
1964
.hw_value = ch_list [idx ],
@@ -1973,6 +2009,12 @@ int mt76_connac_mcu_set_rate_txpower(struct mt76_phy *phy)
1973
2009
if (err < 0 )
1974
2010
return err ;
1975
2011
}
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
+ }
1976
2018
1977
2019
return 0 ;
1978
2020
}
0 commit comments