From: Ryder Lee Date: Wed, 2 Jun 2021 03:04:03 +0000 (+0800) Subject: mt76: mt7615: update radar parameters X-Git-Tag: accepted/tizen/unified/20230118.172025~6942^2~30^2~25^2~36 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e3343d0fef6a368cf5b5b34e99e4a4768ee51242;p=platform%2Fkernel%2Flinux-rpi.git mt76: mt7615: update radar parameters Patch radar parameters to match the SDK to avoid possible false alarms. Signed-off-by: Ryder Lee Signed-off-by: Felix Fietkau --- diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c index 4daa054..f540b61 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c @@ -20,7 +20,7 @@ #define to_rssi(field, rxv) ((FIELD_GET(field, rxv) - 220) / 2) static const struct mt7615_dfs_radar_spec etsi_radar_specs = { - .pulse_th = { 40, -10, -80, 800, 3360, 128, 5200 }, + .pulse_th = { 110, -10, -80, 40, 5200, 128, 5200 }, .radar_pattern = { [5] = { 1, 0, 6, 32, 28, 0, 17, 990, 5010, 1, 1 }, [6] = { 1, 0, 9, 32, 28, 0, 27, 615, 5010, 1, 1 }, @@ -34,7 +34,7 @@ static const struct mt7615_dfs_radar_spec etsi_radar_specs = { }; static const struct mt7615_dfs_radar_spec fcc_radar_specs = { - .pulse_th = { 40, -10, -80, 800, 3360, 128, 5200 }, + .pulse_th = { 110, -10, -80, 40, 5200, 128, 5200 }, .radar_pattern = { [0] = { 1, 0, 9, 32, 28, 0, 13, 508, 3076, 1, 1 }, [1] = { 1, 0, 12, 32, 28, 0, 17, 140, 240, 1, 1 }, @@ -45,7 +45,7 @@ static const struct mt7615_dfs_radar_spec fcc_radar_specs = { }; static const struct mt7615_dfs_radar_spec jp_radar_specs = { - .pulse_th = { 40, -10, -80, 800, 3360, 128, 5200 }, + .pulse_th = { 110, -10, -80, 40, 5200, 128, 5200 }, .radar_pattern = { [0] = { 1, 0, 8, 32, 28, 0, 13, 508, 3076, 1, 1 }, [1] = { 1, 0, 12, 32, 28, 0, 17, 140, 240, 1, 1 }, @@ -2047,14 +2047,12 @@ mt7615_dfs_init_radar_specs(struct mt7615_phy *phy) { const struct mt7615_dfs_radar_spec *radar_specs; struct mt7615_dev *dev = phy->dev; - int err, i; + int err, i, lpn = 500; switch (dev->mt76.region) { case NL80211_DFS_FCC: radar_specs = &fcc_radar_specs; - err = mt7615_mcu_set_fcc5_lpn(dev, 8); - if (err < 0) - return err; + lpn = 8; break; case NL80211_DFS_ETSI: radar_specs = &etsi_radar_specs; @@ -2066,6 +2064,11 @@ mt7615_dfs_init_radar_specs(struct mt7615_phy *phy) return -EINVAL; } + /* avoid FCC radar detection in non-FCC region */ + err = mt7615_mcu_set_fcc5_lpn(dev, lpn); + if (err < 0) + return err; + for (i = 0; i < ARRAY_SIZE(radar_specs->radar_pattern); i++) { err = mt7615_mcu_set_radar_th(dev, i, &radar_specs->radar_pattern[i]); diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c index fc9cd8d..cf4a4f2 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c @@ -430,6 +430,10 @@ mt7615_mcu_rx_radar_detected(struct mt7615_dev *dev, struct sk_buff *skb) r = (struct mt7615_mcu_rdd_report *)skb->data; + if (!dev->radar_pattern.n_pulses && !r->long_detected && + !r->constant_prf_detected && !r->staggered_prf_detected) + return; + if (r->band_idx && dev->mt76.phy2) mphy = dev->mt76.phy2;