diff mbox series

[2/4] wifi: mt76: mt7915: Fix chainmask calculation on mt7915 DBDC

Message ID 20221110153953.22562-3-nicolas.cavallari@green-communications.fr
State New
Headers show
Series [1/4] wifi: mt76: mt7915: fix antenna selection with bad eeprom. | expand

Commit Message

Nicolas Cavallari Nov. 10, 2022, 3:39 p.m. UTC
mt7915 does not have a per-band number of chains unlike the other chips,
it only has a total number of chains.  Yet the current code would
consider the total number as a per-band number.

For example, it would report that a 2x2 + 2x2 DBDC card have 4 chains on
each band and set chainmask to 0b1111 for the first interface and
0b11110000 for the second.

Fixes: 99ad32a4ca3a ("mt76: mt7915: add support for MT7986")
Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
---
 drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Nicolas Cavallari Nov. 14, 2022, 10:02 a.m. UTC | #1
On 12/11/2022 19:17, Felix Fietkau wrote:
> On 10.11.22 16:39, Nicolas Cavallari wrote:
>> mt7915 does not have a per-band number of chains unlike the other chips,
>> it only has a total number of chains.  Yet the current code would
>> consider the total number as a per-band number.
>>
>> For example, it would report that a 2x2 + 2x2 DBDC card have 4 chains on
>> each band and set chainmask to 0b1111 for the first interface and
>> 0b11110000 for the second.
>>
>> Fixes: 99ad32a4ca3a ("mt76: mt7915: add support for MT7986")
>> Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
>> ---
>>    drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c | 1 +
>>    1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c
>> index 83bced0c0785..8bb971018a1e 100644
>> --- a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c
>> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c
>> @@ -194,6 +194,7 @@ void mt7915_eeprom_parse_hw_cap(struct mt7915_dev *dev,
>>    	nss = path;
>>    	if (dev->dbdc_support) {
>>    		if (is_mt7915(&dev->mt76)) {
>> +			path = path / 2;
>>    			nss = FIELD_GET(MT_EE_WIFI_CONF3_TX_PATH_B0,
>>    					eeprom[MT_EE_WIFI_CONF + 3]);
>>    			if (phy->band_idx)
> This was causing a regression on properly calibrated DBDC cards, where
> the 'path' variable contains the per-band path, not the total path.
> I've folded in the following change to fix your commit:
> 
> [...]

Maybe the commit message need to be changed too, because it contains my wrong 
interpretation of the eeprom field...
diff mbox series

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c
index 83bced0c0785..8bb971018a1e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c
@@ -194,6 +194,7 @@  void mt7915_eeprom_parse_hw_cap(struct mt7915_dev *dev,
 	nss = path;
 	if (dev->dbdc_support) {
 		if (is_mt7915(&dev->mt76)) {
+			path = path / 2;
 			nss = FIELD_GET(MT_EE_WIFI_CONF3_TX_PATH_B0,
 					eeprom[MT_EE_WIFI_CONF + 3]);
 			if (phy->band_idx)