developer | e8c82b2 | 2022-08-09 14:58:55 +0800 | [diff] [blame^] | 1 | From 0fb081d0cbaeaf0c2ff537d44680818185942590 Mon Sep 17 00:00:00 2001 |
| 2 | From: Shayne Chen <shayne.chen@mediatek.com> |
| 3 | Date: Tue, 26 Jul 2022 16:04:53 +0800 |
| 4 | Subject: [PATCH] mt76: mt7915: set the first antenna to detect radar for |
| 5 | MT7915 |
| 6 | |
| 7 | The default value of listening antenna set by FW might be different in |
| 8 | MT7915. As most of our cooperated labs use the first antenna to verify |
| 9 | the radar detection function, manually set the value by a mcu command. |
| 10 | |
| 11 | Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> |
| 12 | --- |
| 13 | drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 15 +++++++++++++++ |
| 14 | .../net/wireless/mediatek/mt76/mt7915/mt7915.h | 1 + |
| 15 | 2 files changed, 16 insertions(+) |
| 16 | |
| 17 | diff --git a/mt7915/mac.c b/mt7915/mac.c |
| 18 | index 1f8e1230..a31ac2df 100644 |
| 19 | --- a/mt7915/mac.c |
| 20 | +++ b/mt7915/mac.c |
| 21 | @@ -2149,6 +2149,13 @@ static int mt7915_dfs_start_rdd(struct mt7915_dev *dev, int chain) |
| 22 | if (err < 0) |
| 23 | return err; |
| 24 | |
| 25 | + if (is_mt7915(&dev->mt76)) { |
| 26 | + err = mt76_connac_mcu_rdd_cmd(&dev->mt76, RDD_SET_WF_ANT, chain, |
| 27 | + 0, dev->dbdc_support ? 2 : 0); |
| 28 | + if (err < 0) |
| 29 | + return err; |
| 30 | + } |
| 31 | + |
| 32 | return mt76_connac_mcu_rdd_cmd(&dev->mt76, RDD_DET_MODE, chain, |
| 33 | MT_RX_SEL0, 1); |
| 34 | } |
| 35 | @@ -2269,6 +2276,14 @@ stop: |
| 36 | if (err < 0) |
| 37 | return err; |
| 38 | |
| 39 | + if (is_mt7915(&dev->mt76)) { |
| 40 | + err = mt76_connac_mcu_rdd_cmd(&dev->mt76, RDD_SET_WF_ANT, |
| 41 | + phy->band_idx, 0, |
| 42 | + dev->dbdc_support ? 2 : 0); |
| 43 | + if (err < 0) |
| 44 | + return err; |
| 45 | + } |
| 46 | + |
| 47 | mt7915_dfs_stop_radar_detector(phy); |
| 48 | phy->mt76->dfs_state = MT_DFS_STATE_DISABLED; |
| 49 | |
| 50 | diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h |
| 51 | index 22399cc7..2eaada50 100644 |
| 52 | --- a/mt7915/mt7915.h |
| 53 | +++ b/mt7915/mt7915.h |
| 54 | @@ -468,6 +468,7 @@ enum mt7915_rdd_cmd { |
| 55 | RDD_DET_MODE, |
| 56 | RDD_RADAR_EMULATE, |
| 57 | RDD_START_TXQ = 20, |
| 58 | + RDD_SET_WF_ANT = 30, |
| 59 | RDD_CAC_START = 50, |
| 60 | RDD_CAC_END, |
| 61 | RDD_NORMAL_START, |
| 62 | -- |
| 63 | 2.25.1 |
| 64 | |