mirror of
				git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
				synced 2025-09-04 20:19:47 +08:00 
			
		
		
		
	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 <deren.wu@mediatek.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
		
							parent
							
								
									cee3fd2979
								
							
						
					
					
						commit
						9b2ea8eee4
					
				| @ -285,6 +285,9 @@ s8 mt76_get_rate_power_limits(struct mt76_phy *phy, | |||||||
| 	case NL80211_BAND_5GHZ: | 	case NL80211_BAND_5GHZ: | ||||||
| 		band = '5'; | 		band = '5'; | ||||||
| 		break; | 		break; | ||||||
|  | 	case NL80211_BAND_6GHZ: | ||||||
|  | 		band = '6'; | ||||||
|  | 		break; | ||||||
| 	default: | 	default: | ||||||
| 		return target_power; | 		return target_power; | ||||||
| 	} | 	} | ||||||
|  | |||||||
| @ -1839,6 +1839,9 @@ static s8 mt76_connac_get_ch_power(struct mt76_phy *phy, | |||||||
| 	case NL80211_BAND_5GHZ: | 	case NL80211_BAND_5GHZ: | ||||||
| 		sband = &phy->sband_5g.sband; | 		sband = &phy->sband_5g.sband; | ||||||
| 		break; | 		break; | ||||||
|  | 	case NL80211_BAND_6GHZ: | ||||||
|  | 		sband = &phy->sband_6g.sband; | ||||||
|  | 		break; | ||||||
| 	default: | 	default: | ||||||
| 		return target_power; | 		return target_power; | ||||||
| 	} | 	} | ||||||
| @ -1880,6 +1883,24 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy, | |||||||
| 		142, 144, 149, 151, 153, 155, 157, | 		142, 144, 149, 151, 153, 155, 157, | ||||||
| 		159, 161, 165 | 		159, 161, 165 | ||||||
| 	}; | 	}; | ||||||
|  | 	static const u8 chan_list_6ghz[] = { | ||||||
|  | 		  1,   3,   5,   7,   9,  11,  13, | ||||||
|  | 		 15,  17,  19,  21,  23,  25,  27, | ||||||
|  | 		 29,  33,  35,  37,  39,  41,  43, | ||||||
|  | 		 45,  47,  49,  51,  53,  55,  57, | ||||||
|  | 		 59,  61,  65,  67,  69,  71,  73, | ||||||
|  | 		 75,  77,  79,  81,  83,  85,  87, | ||||||
|  | 		 89,  91,  93,  97,  99, 101, 103, | ||||||
|  | 		105, 107, 109, 111, 113, 115, 117, | ||||||
|  | 		119, 121, 123, 125, 129, 131, 133, | ||||||
|  | 		135, 137, 139, 141, 143, 145, 147, | ||||||
|  | 		149, 151, 153, 155, 157, 161, 163, | ||||||
|  | 		165, 167, 169, 171, 173, 175, 177, | ||||||
|  | 		179, 181, 183, 185, 187, 189, 193, | ||||||
|  | 		195, 197, 199, 201, 203, 205, 207, | ||||||
|  | 		209, 211, 213, 215, 217, 219, 221, | ||||||
|  | 		225, 227, 229, 233 | ||||||
|  | 	}; | ||||||
| 	int i, n_chan, batch_size, idx = 0, tx_power, last_ch; | 	int i, n_chan, batch_size, idx = 0, tx_power, last_ch; | ||||||
| 	struct mt76_connac_sku_tlv sku_tlbv; | 	struct mt76_connac_sku_tlv sku_tlbv; | ||||||
| 	struct mt76_power_limits limits; | 	struct mt76_power_limits limits; | ||||||
| @ -1893,6 +1914,9 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy, | |||||||
| 	if (band == NL80211_BAND_2GHZ) { | 	if (band == NL80211_BAND_2GHZ) { | ||||||
| 		n_chan = ARRAY_SIZE(chan_list_2ghz); | 		n_chan = ARRAY_SIZE(chan_list_2ghz); | ||||||
| 		ch_list = chan_list_2ghz; | 		ch_list = chan_list_2ghz; | ||||||
|  | 	} else if (band == NL80211_BAND_6GHZ) { | ||||||
|  | 		n_chan = ARRAY_SIZE(chan_list_6ghz); | ||||||
|  | 		ch_list = chan_list_6ghz; | ||||||
| 	} else { | 	} else { | ||||||
| 		n_chan = ARRAY_SIZE(chan_list_5ghz); | 		n_chan = ARRAY_SIZE(chan_list_5ghz); | ||||||
| 		ch_list = chan_list_5ghz; | 		ch_list = chan_list_5ghz; | ||||||
| @ -1901,13 +1925,13 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy, | |||||||
| 
 | 
 | ||||||
| 	if (!phy->cap.has_5ghz) | 	if (!phy->cap.has_5ghz) | ||||||
| 		last_ch = chan_list_2ghz[n_chan - 1]; | 		last_ch = chan_list_2ghz[n_chan - 1]; | ||||||
|  | 	else if (phy->cap.has_6ghz) | ||||||
|  | 		last_ch = chan_list_6ghz[n_chan - 1]; | ||||||
| 	else | 	else | ||||||
| 		last_ch = chan_list_5ghz[n_chan - 1]; | 		last_ch = chan_list_5ghz[n_chan - 1]; | ||||||
| 
 | 
 | ||||||
| 	for (i = 0; i < batch_size; i++) { | 	for (i = 0; i < batch_size; i++) { | ||||||
| 		struct mt76_connac_tx_power_limit_tlv tx_power_tlv = { | 		struct mt76_connac_tx_power_limit_tlv tx_power_tlv = {}; | ||||||
| 			.band = band == NL80211_BAND_2GHZ ? 1 : 2, |  | ||||||
| 		}; |  | ||||||
| 		int j, err, msg_len, num_ch; | 		int j, err, msg_len, num_ch; | ||||||
| 		struct sk_buff *skb; | 		struct sk_buff *skb; | ||||||
| 
 | 
 | ||||||
| @ -1923,6 +1947,18 @@ mt76_connac_mcu_rate_txpower_band(struct mt76_phy *phy, | |||||||
| 		memcpy(tx_power_tlv.alpha2, dev->alpha2, sizeof(dev->alpha2)); | 		memcpy(tx_power_tlv.alpha2, dev->alpha2, sizeof(dev->alpha2)); | ||||||
| 		tx_power_tlv.n_chan = num_ch; | 		tx_power_tlv.n_chan = num_ch; | ||||||
| 
 | 
 | ||||||
|  | 		switch (band) { | ||||||
|  | 		case NL80211_BAND_2GHZ: | ||||||
|  | 			tx_power_tlv.band = 1; | ||||||
|  | 			break; | ||||||
|  | 		case NL80211_BAND_6GHZ: | ||||||
|  | 			tx_power_tlv.band = 3; | ||||||
|  | 			break; | ||||||
|  | 		default: | ||||||
|  | 			tx_power_tlv.band = 2; | ||||||
|  | 			break; | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
| 		for (j = 0; j < num_ch; j++, idx++) { | 		for (j = 0; j < num_ch; j++, idx++) { | ||||||
| 			struct ieee80211_channel chan = { | 			struct ieee80211_channel chan = { | ||||||
| 				.hw_value = ch_list[idx], | 				.hw_value = ch_list[idx], | ||||||
| @ -1973,6 +2009,12 @@ int mt76_connac_mcu_set_rate_txpower(struct mt76_phy *phy) | |||||||
| 		if (err < 0) | 		if (err < 0) | ||||||
| 			return err; | 			return err; | ||||||
| 	} | 	} | ||||||
|  | 	if (phy->cap.has_6ghz) { | ||||||
|  | 		err = mt76_connac_mcu_rate_txpower_band(phy, | ||||||
|  | 							NL80211_BAND_6GHZ); | ||||||
|  | 		if (err < 0) | ||||||
|  | 			return err; | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  | |||||||
| @ -964,7 +964,7 @@ struct mt76_connac_tx_power_limit_tlv { | |||||||
| 	__le16 len; | 	__le16 len; | ||||||
| 	/* DW1 - cmd hint */ | 	/* DW1 - cmd hint */ | ||||||
| 	u8 n_chan; /* # channel */ | 	u8 n_chan; /* # channel */ | ||||||
| 	u8 band; /* 2.4GHz - 5GHz */ | 	u8 band; /* 2.4GHz - 5GHz - 6GHz */ | ||||||
| 	u8 last_msg; | 	u8 last_msg; | ||||||
| 	u8 pad1; | 	u8 pad1; | ||||||
| 	/* DW3 */ | 	/* DW3 */ | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Lorenzo Bianconi
						Lorenzo Bianconi