wifi: mt76: mt7996: rework background radar check for mt7990

The MT7990 comes in 2T2R and 3T3R variants, with only the 2T2R supporting
background radar.

Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Link: https://patch.msgid.link/20250409140750.724437-10-shayne.chen@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
StanleyYP Wang 2025-04-09 22:07:49 +08:00 committed by Felix Fietkau
parent b7ddeb9cc4
commit 14d3990eb7
3 changed files with 29 additions and 20 deletions

View File

@ -376,3 +376,30 @@ s8 mt7996_eeprom_get_power_delta(struct mt7996_dev *dev, int band)
return val & MT_EE_RATE_DELTA_SIGN ? delta : -delta;
}
bool mt7996_eeprom_has_background_radar(struct mt7996_dev *dev)
{
switch (mt76_chip(&dev->mt76)) {
case MT7996_DEVICE_ID:
if (dev->var.type == MT7996_VAR_TYPE_233)
return false;
break;
case MT7992_DEVICE_ID:
if (dev->var.type == MT7992_VAR_TYPE_23)
return false;
break;
case MT7990_DEVICE_ID: {
u8 path, rx_path, nss, *eeprom = dev->mt76.eeprom.data;
mt7996_eeprom_parse_stream(eeprom, MT_BAND1, &path, &rx_path, &nss);
/* Disable background radar capability in 3T3R */
if (path == 3 || rx_path == 3)
return false;
break;
}
default:
return false;
}
return true;
}

View File

@ -475,7 +475,7 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed)
wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_CAN_REPLACE_PTK0);
wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_MU_MIMO_AIR_SNIFFER);
if (mt7996_has_background_radar(dev) &&
if (mt7996_eeprom_has_background_radar(dev) &&
(!mdev->dev->of_node ||
!of_property_read_bool(mdev->dev->of_node,
"mediatek,disable-radar-background")))

View File

@ -488,25 +488,6 @@ mt7996_band_valid(struct mt7996_dev *dev, u8 band)
return band <= MT_BAND2;
}
static inline bool
mt7996_has_background_radar(struct mt7996_dev *dev)
{
switch (mt76_chip(&dev->mt76)) {
case MT7996_DEVICE_ID:
if (dev->var.type == MT7996_VAR_TYPE_233)
return false;
break;
case MT7992_DEVICE_ID:
if (dev->var.type == MT7992_VAR_TYPE_23)
return false;
break;
default:
return false;
}
return true;
}
static inline struct mt7996_phy *
mt7996_band_phy(struct mt7996_dev *dev, enum nl80211_band band)
{
@ -570,6 +551,7 @@ int mt7996_eeprom_parse_hw_cap(struct mt7996_dev *dev, struct mt7996_phy *phy);
int mt7996_eeprom_get_target_power(struct mt7996_dev *dev,
struct ieee80211_channel *chan);
s8 mt7996_eeprom_get_power_delta(struct mt7996_dev *dev, int band);
bool mt7996_eeprom_has_background_radar(struct mt7996_dev *dev);
int mt7996_dma_init(struct mt7996_dev *dev);
void mt7996_dma_reset(struct mt7996_dev *dev, bool force);
void mt7996_dma_prefetch(struct mt7996_dev *dev);