All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/6] introduce background radar support for mt7915 driver
@ 2022-01-12 17:53 Lorenzo Bianconi
  2022-01-12 17:53 ` [PATCH v2 1/6] mt76: mt7915: introduce mt7915_set_radar_background routine Lorenzo Bianconi
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Lorenzo Bianconi @ 2022-01-12 17:53 UTC (permalink / raw)
  To: nbd
  Cc: lorenzo.bianconi, linux-wireless, ryder.lee, evelyn.tsai,
	owen.peng, devicetree, robh

Introduce radar/CAC background detection support for mt7915 driver
Background radar/CAC detection allows to avoid the CAC downtime
switching on a different channel during CAC detection on the selected
radar channel.

Changes since v1:
- repost adding devicetree ml in cc

Lorenzo Bianconi (6):
  mt76: mt7915: introduce mt7915_set_radar_background routine
  mt76: mt7915: enable radar trigger on rdd2
  mt76: mt7915: introduce rdd_monitor debugfs node
  mt76: mt7915: report radar pattern if detected by rdd2
  mt76: mt7915: enable radar background detection
  dt-bindings:net:wireless:mediatek,mt76: add disable-radar-offchan

 .../bindings/net/wireless/mediatek,mt76.yaml  |   9 ++
 .../wireless/mediatek/mt76/mt76_connac_mcu.h  |   1 +
 .../wireless/mediatek/mt76/mt7915/debugfs.c   |  55 +++++++++-
 .../net/wireless/mediatek/mt76/mt7915/init.c  |  10 ++
 .../net/wireless/mediatek/mt76/mt7915/main.c  |  50 +++++++++
 .../net/wireless/mediatek/mt76/mt7915/mcu.c   | 100 +++++++++++++++++-
 .../net/wireless/mediatek/mt76/mt7915/mcu.h   |  23 ++++
 .../wireless/mediatek/mt76/mt7915/mt7915.h    |   7 ++
 8 files changed, 253 insertions(+), 2 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2 1/6] mt76: mt7915: introduce mt7915_set_radar_background routine
  2022-01-12 17:53 [PATCH v2 0/6] introduce background radar support for mt7915 driver Lorenzo Bianconi
@ 2022-01-12 17:53 ` Lorenzo Bianconi
  2022-01-12 17:53 ` [PATCH v2 2/6] mt76: mt7915: enable radar trigger on rdd2 Lorenzo Bianconi
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Lorenzo Bianconi @ 2022-01-12 17:53 UTC (permalink / raw)
  To: nbd
  Cc: lorenzo.bianconi, linux-wireless, ryder.lee, evelyn.tsai,
	owen.peng, devicetree, robh

Introduce mt7915_mcu_rdd_background_enable and
mt7915_mcu_background_chain_ctrl routines to configure rx dfs dedicated chain.
This is a preliminary patch to add zero-wait dfs support performing CAC
detection on rdd2.

Tested-by: Owen Peng <owen.peng@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 .../wireless/mediatek/mt76/mt76_connac_mcu.h  |  1 +
 .../net/wireless/mediatek/mt76/mt7915/init.c  |  3 +
 .../net/wireless/mediatek/mt76/mt7915/main.c  | 50 ++++++++++
 .../net/wireless/mediatek/mt76/mt7915/mcu.c   | 93 +++++++++++++++++++
 .../net/wireless/mediatek/mt76/mt7915/mcu.h   | 23 +++++
 .../wireless/mediatek/mt76/mt7915/mt7915.h    |  7 ++
 6 files changed, 177 insertions(+)

diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
index 1ebe02f55267..7b9d82dd3f9d 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
@@ -977,6 +977,7 @@ enum {
 	MCU_EXT_CMD_SCS_CTRL = 0x82,
 	MCU_EXT_CMD_TWT_AGRT_UPDATE = 0x94,
 	MCU_EXT_CMD_FW_DBG_CTRL = 0x95,
+	MCU_EXT_CMD_OFFCH_SCAN_CTRL = 0x9a,
 	MCU_EXT_CMD_SET_RDD_TH = 0x9d,
 	MCU_EXT_CMD_MURU_CTRL = 0x9f,
 	MCU_EXT_CMD_SET_SPR = 0xa8,
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
index 9613192b66c4..5c1643963506 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
@@ -293,6 +293,9 @@ mt7915_regd_notifier(struct wiphy *wiphy,
 	memcpy(dev->mt76.alpha2, request->alpha2, sizeof(dev->mt76.alpha2));
 	dev->mt76.region = request->dfs_region;
 
+	if (dev->mt76.region == NL80211_DFS_UNSET)
+		mt7915_mcu_rdd_background_enable(phy, NULL);
+
 	mt7915_init_txpower(dev, &mphy->sband_2g.sband);
 	mt7915_init_txpower(dev, &mphy->sband_5g.sband);
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/main.c b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
index b45b75f98c4d..3620aa873417 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
@@ -1353,6 +1353,55 @@ mt7915_twt_teardown_request(struct ieee80211_hw *hw,
 	mutex_unlock(&dev->mt76.mutex);
 }
 
+static int
+mt7915_set_radar_background(struct ieee80211_hw *hw,
+			    struct cfg80211_chan_def *chandef)
+{
+	struct mt7915_phy *phy = mt7915_hw_phy(hw);
+	struct mt7915_dev *dev = phy->dev;
+	int ret = -EINVAL;
+	bool running;
+
+	mutex_lock(&dev->mt76.mutex);
+
+	if (dev->mt76.region == NL80211_DFS_UNSET)
+		goto out;
+
+	if (dev->rdd2_phy && dev->rdd2_phy != phy) {
+		/* rdd2 is already locked */
+		ret = -EBUSY;
+		goto out;
+	}
+
+	/* rdd2 already configured on a radar channel */
+	running = dev->rdd2_phy &&
+		  cfg80211_chandef_valid(&dev->rdd2_chandef) &&
+		  !!(dev->rdd2_chandef.chan->flags & IEEE80211_CHAN_RADAR);
+
+	if (!chandef || running ||
+	    !(chandef->chan->flags & IEEE80211_CHAN_RADAR)) {
+		ret = mt7915_mcu_rdd_background_enable(phy, NULL);
+		if (ret)
+			goto out;
+
+		if (!running)
+			goto update_phy;
+	}
+
+	ret = mt7915_mcu_rdd_background_enable(phy, chandef);
+	if (ret)
+		goto out;
+
+update_phy:
+	dev->rdd2_phy = chandef ? phy : NULL;
+	if (chandef)
+		dev->rdd2_chandef = *chandef;
+out:
+	mutex_unlock(&dev->mt76.mutex);
+
+	return ret;
+}
+
 const struct ieee80211_ops mt7915_ops = {
 	.tx = mt7915_tx,
 	.start = mt7915_start,
@@ -1399,4 +1448,5 @@ const struct ieee80211_ops mt7915_ops = {
 #ifdef CONFIG_MAC80211_DEBUGFS
 	.sta_add_debugfs = mt7915_sta_add_debugfs,
 #endif
+	.set_radar_background = mt7915_set_radar_background,
 };
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
index 66f8daf3168c..dddefeebc7dd 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
@@ -2629,6 +2629,99 @@ int mt7915_mcu_set_radar_th(struct mt7915_dev *dev, int index,
 				 sizeof(req), true);
 }
 
+static int
+mt7915_mcu_background_chain_ctrl(struct mt7915_phy *phy,
+				 struct cfg80211_chan_def *chandef,
+				 int cmd)
+{
+	struct mt7915_dev *dev = phy->dev;
+	struct mt76_phy *mphy = phy->mt76;
+	struct ieee80211_channel *chan = mphy->chandef.chan;
+	int freq = mphy->chandef.center_freq1;
+	struct mt7915_mcu_background_chain_ctrl req = {
+		.monitor_scan_type = 2, /* simple rx */
+	};
+
+	if (!chandef && cmd != CH_SWITCH_BACKGROUND_SCAN_STOP)
+		return -EINVAL;
+
+	if (!cfg80211_chandef_valid(&mphy->chandef))
+		return -EINVAL;
+
+	switch (cmd) {
+	case CH_SWITCH_BACKGROUND_SCAN_START: {
+		req.chan = chan->hw_value;
+		req.central_chan = ieee80211_frequency_to_channel(freq);
+		req.bw = mt76_connac_chan_bw(&mphy->chandef);
+		req.monitor_chan = chandef->chan->hw_value;
+		req.monitor_central_chan =
+			ieee80211_frequency_to_channel(chandef->center_freq1);
+		req.monitor_bw = mt76_connac_chan_bw(chandef);
+		req.band_idx = phy != &dev->phy;
+		req.scan_mode = 1;
+		break;
+	}
+	case CH_SWITCH_BACKGROUND_SCAN_RUNNING:
+		req.monitor_chan = chandef->chan->hw_value;
+		req.monitor_central_chan =
+			ieee80211_frequency_to_channel(chandef->center_freq1);
+		req.band_idx = phy != &dev->phy;
+		req.scan_mode = 2;
+		break;
+	case CH_SWITCH_BACKGROUND_SCAN_STOP:
+		req.chan = chan->hw_value;
+		req.central_chan = ieee80211_frequency_to_channel(freq);
+		req.bw = mt76_connac_chan_bw(&mphy->chandef);
+		req.tx_stream = hweight8(mphy->antenna_mask);
+		req.rx_stream = mphy->antenna_mask;
+		break;
+	default:
+		return -EINVAL;
+	}
+	req.band = chandef ? chandef->chan->band == NL80211_BAND_5GHZ : 1;
+
+	return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(OFFCH_SCAN_CTRL),
+				 &req, sizeof(req), false);
+}
+
+int mt7915_mcu_rdd_background_enable(struct mt7915_phy *phy,
+				     struct cfg80211_chan_def *chandef)
+{
+	struct mt7915_dev *dev = phy->dev;
+	int err, region;
+
+	if (!chandef) { /* disable offchain */
+		err = mt76_connac_mcu_rdd_cmd(&dev->mt76, RDD_STOP, MT_RX_SEL2,
+					      0, 0);
+		if (err)
+			return err;
+
+		return mt7915_mcu_background_chain_ctrl(phy, NULL,
+				CH_SWITCH_BACKGROUND_SCAN_STOP);
+	}
+
+	err = mt7915_mcu_background_chain_ctrl(phy, chandef,
+					       CH_SWITCH_BACKGROUND_SCAN_START);
+	if (err)
+		return err;
+
+	switch (dev->mt76.region) {
+	case NL80211_DFS_ETSI:
+		region = 0;
+		break;
+	case NL80211_DFS_JP:
+		region = 2;
+		break;
+	case NL80211_DFS_FCC:
+	default:
+		region = 1;
+		break;
+	}
+
+	return mt76_connac_mcu_rdd_cmd(&dev->mt76, RDD_START, MT_RX_SEL2,
+				       0, region);
+}
+
 int mt7915_mcu_set_chan_info(struct mt7915_phy *phy, int cmd)
 {
 	struct mt7915_dev *dev = phy->dev;
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h
index aa05c6ceebb9..9417f7bc807a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h
@@ -131,6 +131,29 @@ struct mt7915_mcu_rdd_report {
 	} hw_pulse[32];
 } __packed;
 
+struct mt7915_mcu_background_chain_ctrl {
+	u8 chan;		/* primary channel */
+	u8 central_chan;	/* central channel */
+	u8 bw;
+	u8 tx_stream;
+	u8 rx_stream;
+
+	u8 monitor_chan;	/* monitor channel */
+	u8 monitor_central_chan;/* monitor central channel */
+	u8 monitor_bw;
+	u8 monitor_tx_stream;
+	u8 monitor_rx_stream;
+
+	u8 scan_mode;		/* 0: ScanStop
+				 * 1: ScanStart
+				 * 2: ScanRunning
+				 */
+	u8 band_idx;		/* DBDC */
+	u8 monitor_scan_type;
+	u8 band;		/* 0: 2.4GHz, 1: 5GHz */
+	u8 rsv[2];
+} __packed;
+
 struct mt7915_mcu_eeprom {
 	u8 buffer_mode;
 	u8 format;
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h b/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h
index cd7ee716f147..f5c22b86e1a9 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h
@@ -269,6 +269,10 @@ struct mt7915_dev {
 	struct tasklet_struct irq_tasklet;
 	struct mt7915_phy phy;
 
+	/* monitor rx chain configured channel */
+	struct cfg80211_chan_def rdd2_chandef;
+	struct mt7915_phy *rdd2_phy;
+
 	u16 chainmask;
 	u32 hif_idx;
 
@@ -328,6 +332,7 @@ enum {
 enum {
 	MT_RX_SEL0,
 	MT_RX_SEL1,
+	MT_RX_SEL2, /* monitor chain */
 };
 
 enum mt7915_rdd_cmd {
@@ -461,6 +466,8 @@ int mt7915_mcu_get_temperature(struct mt7915_phy *phy);
 int mt7915_mcu_set_thermal_throttling(struct mt7915_phy *phy, u8 state);
 int mt7915_mcu_get_rx_rate(struct mt7915_phy *phy, struct ieee80211_vif *vif,
 			   struct ieee80211_sta *sta, struct rate_info *rate);
+int mt7915_mcu_rdd_background_enable(struct mt7915_phy *phy,
+				     struct cfg80211_chan_def *chandef);
 int mt7915_mcu_wa_cmd(struct mt7915_dev *dev, int cmd, u32 a1, u32 a2, u32 a3);
 int mt7915_mcu_fw_log_2_host(struct mt7915_dev *dev, u8 type, u8 ctrl);
 int mt7915_mcu_fw_dbg_ctrl(struct mt7915_dev *dev, u32 module, u8 level);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 2/6] mt76: mt7915: enable radar trigger on rdd2
  2022-01-12 17:53 [PATCH v2 0/6] introduce background radar support for mt7915 driver Lorenzo Bianconi
  2022-01-12 17:53 ` [PATCH v2 1/6] mt76: mt7915: introduce mt7915_set_radar_background routine Lorenzo Bianconi
@ 2022-01-12 17:53 ` Lorenzo Bianconi
  2022-01-12 17:53 ` [PATCH v2 3/6] mt76: mt7915: introduce rdd_monitor debugfs node Lorenzo Bianconi
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Lorenzo Bianconi @ 2022-01-12 17:53 UTC (permalink / raw)
  To: nbd
  Cc: lorenzo.bianconi, linux-wireless, ryder.lee, evelyn.tsai,
	owen.peng, devicetree, robh

Enable radar trigger for rdd2 in mt7915_radar_trigger.

Tested-by: Evelyn Tsai <evelyn.tsai@mediatek.com>
Tested-by: Owen Peng <owen.peng@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
index 464d2b42f0df..e140336a4fe1 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
@@ -79,7 +79,11 @@ mt7915_radar_trigger(void *data, u64 val)
 {
 	struct mt7915_dev *dev = data;
 
-	return mt76_connac_mcu_rdd_cmd(&dev->mt76, RDD_RADAR_EMULATE, 1, 0, 0);
+	if (val > MT_RX_SEL2)
+		return -EINVAL;
+
+	return mt76_connac_mcu_rdd_cmd(&dev->mt76, RDD_RADAR_EMULATE,
+				       val, 0, 0);
 }
 
 DEFINE_DEBUGFS_ATTRIBUTE(fops_radar_trigger, NULL,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 3/6] mt76: mt7915: introduce rdd_monitor debugfs node
  2022-01-12 17:53 [PATCH v2 0/6] introduce background radar support for mt7915 driver Lorenzo Bianconi
  2022-01-12 17:53 ` [PATCH v2 1/6] mt76: mt7915: introduce mt7915_set_radar_background routine Lorenzo Bianconi
  2022-01-12 17:53 ` [PATCH v2 2/6] mt76: mt7915: enable radar trigger on rdd2 Lorenzo Bianconi
@ 2022-01-12 17:53 ` Lorenzo Bianconi
  2022-01-12 17:53 ` [PATCH v2 4/6] mt76: mt7915: report radar pattern if detected by rdd2 Lorenzo Bianconi
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Lorenzo Bianconi @ 2022-01-12 17:53 UTC (permalink / raw)
  To: nbd
  Cc: lorenzo.bianconi, linux-wireless, ryder.lee, evelyn.tsai,
	owen.peng, devicetree, robh

Introduce rdd_monitor debugfs node in order to dump rdd2 configuration.

Tested-by: Owen Peng <owen.peng@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 .../wireless/mediatek/mt76/mt7915/debugfs.c   | 49 +++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
index e140336a4fe1..280823fc9f92 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
@@ -308,6 +308,53 @@ static int mt7915_muru_stats_show(struct seq_file *file, void *data)
 }
 DEFINE_SHOW_ATTRIBUTE(mt7915_muru_stats);
 
+static int
+mt7915_rdd_monitor(struct seq_file *s, void *data)
+{
+	struct mt7915_dev *dev = dev_get_drvdata(s->private);
+	struct cfg80211_chan_def *chandef = &dev->rdd2_chandef;
+	const char *bw;
+	int ret = 0;
+
+	mutex_lock(&dev->mt76.mutex);
+
+	if (!cfg80211_chandef_valid(chandef)) {
+		ret = -EINVAL;
+		goto out;
+	}
+
+	if (!dev->rdd2_phy) {
+		seq_puts(s, "not running\n");
+		goto out;
+	}
+
+	switch (chandef->width) {
+	case NL80211_CHAN_WIDTH_40:
+		bw = "40";
+		break;
+	case NL80211_CHAN_WIDTH_80:
+		bw = "80";
+		break;
+	case NL80211_CHAN_WIDTH_160:
+		bw = "160";
+		break;
+	case NL80211_CHAN_WIDTH_80P80:
+		bw = "80P80";
+		break;
+	default:
+		bw = "20";
+		break;
+	}
+
+	seq_printf(s, "channel %d (%d MHz) width %s MHz center1: %d MHz\n",
+		   chandef->chan->hw_value, chandef->chan->center_freq,
+		   bw, chandef->center_freq1);
+out:
+	mutex_unlock(&dev->mt76.mutex);
+
+	return ret;
+}
+
 static int
 mt7915_fw_debug_wm_set(void *data, u64 val)
 {
@@ -856,6 +903,8 @@ int mt7915_init_debugfs(struct mt7915_phy *phy)
 				   &dev->hw_pattern);
 		debugfs_create_file("radar_trigger", 0200, dir, dev,
 				    &fops_radar_trigger);
+		debugfs_create_devm_seqfile(dev->mt76.dev, "rdd_monitor", dir,
+					    mt7915_rdd_monitor);
 	}
 
 	if (!ext_phy)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 4/6] mt76: mt7915: report radar pattern if detected by rdd2
  2022-01-12 17:53 [PATCH v2 0/6] introduce background radar support for mt7915 driver Lorenzo Bianconi
                   ` (2 preceding siblings ...)
  2022-01-12 17:53 ` [PATCH v2 3/6] mt76: mt7915: introduce rdd_monitor debugfs node Lorenzo Bianconi
@ 2022-01-12 17:53 ` Lorenzo Bianconi
  2022-01-12 17:53 ` [PATCH v2 5/6] mt76: mt7915: enable radar background detection Lorenzo Bianconi
  2022-01-12 17:53 ` [PATCH v2 6/6] dt-bindings:net:wireless:mediatek,mt76: add disable-radar-offchan Lorenzo Bianconi
  5 siblings, 0 replies; 10+ messages in thread
From: Lorenzo Bianconi @ 2022-01-12 17:53 UTC (permalink / raw)
  To: nbd
  Cc: lorenzo.bianconi, linux-wireless, ryder.lee, evelyn.tsai,
	owen.peng, devicetree, robh

Report radar pattern to mac80211 if detected by the
offchannel chain.

Tested-by: Evelyn Tsai <evelyn.tsai@mediatek.com>
Tested-by: Owen Peng <owen.peng@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
index dddefeebc7dd..e42900b2545f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
@@ -358,7 +358,12 @@ mt7915_mcu_rx_radar_detected(struct mt7915_dev *dev, struct sk_buff *skb)
 	if (r->band_idx && dev->mt76.phy2)
 		mphy = dev->mt76.phy2;
 
-	ieee80211_radar_detected(mphy->hw);
+	if (r->band_idx == MT_RX_SEL2)
+		cfg80211_background_radar_event(mphy->hw->wiphy,
+						&dev->rdd2_chandef,
+						GFP_ATOMIC);
+	else
+		ieee80211_radar_detected(mphy->hw);
 	dev->hw_pattern++;
 }
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 5/6] mt76: mt7915: enable radar background detection
  2022-01-12 17:53 [PATCH v2 0/6] introduce background radar support for mt7915 driver Lorenzo Bianconi
                   ` (3 preceding siblings ...)
  2022-01-12 17:53 ` [PATCH v2 4/6] mt76: mt7915: report radar pattern if detected by rdd2 Lorenzo Bianconi
@ 2022-01-12 17:53 ` Lorenzo Bianconi
  2022-01-12 17:53 ` [PATCH v2 6/6] dt-bindings:net:wireless:mediatek,mt76: add disable-radar-offchan Lorenzo Bianconi
  5 siblings, 0 replies; 10+ messages in thread
From: Lorenzo Bianconi @ 2022-01-12 17:53 UTC (permalink / raw)
  To: nbd
  Cc: lorenzo.bianconi, linux-wireless, ryder.lee, evelyn.tsai,
	owen.peng, devicetree, robh

Notify userland the hw supports background radar/CAC detection.

Tested-by: Owen Peng <owen.peng@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/mt7915/init.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
index 5c1643963506..91c7ce60f296 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
@@ -309,6 +309,7 @@ static void
 mt7915_init_wiphy(struct ieee80211_hw *hw)
 {
 	struct mt7915_phy *phy = mt7915_hw_phy(hw);
+	struct mt76_dev *mdev = &phy->dev->mt76;
 	struct wiphy *wiphy = hw->wiphy;
 	struct mt7915_dev *dev = phy->dev;
 
@@ -337,6 +338,12 @@ mt7915_init_wiphy(struct ieee80211_hw *hw)
 	wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_BEACON_RATE_VHT);
 	wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_BEACON_RATE_HE);
 
+	if (!mdev->dev->of_node ||
+	    !of_property_read_bool(mdev->dev->of_node,
+				   "mediatek,disable-radar-background"))
+		wiphy_ext_feature_set(wiphy,
+				      NL80211_EXT_FEATURE_RADAR_BACKGROUND);
+
 	ieee80211_hw_set(hw, HAS_RATE_CONTROL);
 	ieee80211_hw_set(hw, SUPPORTS_TX_ENCAP_OFFLOAD);
 	ieee80211_hw_set(hw, SUPPORTS_RX_DECAP_OFFLOAD);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v2 6/6] dt-bindings:net:wireless:mediatek,mt76: add disable-radar-offchan
  2022-01-12 17:53 [PATCH v2 0/6] introduce background radar support for mt7915 driver Lorenzo Bianconi
                   ` (4 preceding siblings ...)
  2022-01-12 17:53 ` [PATCH v2 5/6] mt76: mt7915: enable radar background detection Lorenzo Bianconi
@ 2022-01-12 17:53 ` Lorenzo Bianconi
  2022-01-20 13:02   ` Kalle Valo
  2022-01-22  1:07   ` Rob Herring
  5 siblings, 2 replies; 10+ messages in thread
From: Lorenzo Bianconi @ 2022-01-12 17:53 UTC (permalink / raw)
  To: nbd
  Cc: lorenzo.bianconi, linux-wireless, ryder.lee, evelyn.tsai,
	owen.peng, devicetree, robh

Add the capability to disable/enable radar/CAC detection running on
a dedicated offchannel chain available on some hw.
Offchannel radar/CAC detection allows to avoid CAC downtime switching
on a different channel during CAC detection on the selected radar
channel.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 .../devicetree/bindings/net/wireless/mediatek,mt76.yaml  | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/wireless/mediatek,mt76.yaml b/Documentation/devicetree/bindings/net/wireless/mediatek,mt76.yaml
index 1489d3c1cd6e..4a564bb59552 100644
--- a/Documentation/devicetree/bindings/net/wireless/mediatek,mt76.yaml
+++ b/Documentation/devicetree/bindings/net/wireless/mediatek,mt76.yaml
@@ -69,6 +69,15 @@ properties:
       calibration data is generic and specific calibration data should be
       pulled from the OTP ROM
 
+  mediatek,disable-radar-background:
+    type: boolean
+    description:
+      Disable/enable radar/CAC detection running on a dedicated offchannel
+      chain available on some hw.
+      Background radar/CAC detection allows to avoid the CAC downtime
+      switching on a different channel during CAC detection on the selected
+      radar channel.
+
   led:
     type: object
     $ref: /schemas/leds/common.yaml#
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 6/6] dt-bindings:net:wireless:mediatek,mt76: add disable-radar-offchan
  2022-01-12 17:53 ` [PATCH v2 6/6] dt-bindings:net:wireless:mediatek,mt76: add disable-radar-offchan Lorenzo Bianconi
@ 2022-01-20 13:02   ` Kalle Valo
  2022-01-20 13:18     ` Lorenzo Bianconi
  2022-01-22  1:07   ` Rob Herring
  1 sibling, 1 reply; 10+ messages in thread
From: Kalle Valo @ 2022-01-20 13:02 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: nbd, lorenzo.bianconi, linux-wireless, ryder.lee, evelyn.tsai,
	owen.peng, devicetree, robh

Lorenzo Bianconi <lorenzo@kernel.org> writes:

> Add the capability to disable/enable radar/CAC detection running on
> a dedicated offchannel chain available on some hw.
> Offchannel radar/CAC detection allows to avoid CAC downtime switching
> on a different channel during CAC detection on the selected radar
> channel.
>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
>  .../devicetree/bindings/net/wireless/mediatek,mt76.yaml  | 9 +++++++++
>  1 file changed, 9 insertions(+)

Was the recommendation so that devicetree binding patches should be
first in the patchset?

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 6/6] dt-bindings:net:wireless:mediatek,mt76: add disable-radar-offchan
  2022-01-20 13:02   ` Kalle Valo
@ 2022-01-20 13:18     ` Lorenzo Bianconi
  0 siblings, 0 replies; 10+ messages in thread
From: Lorenzo Bianconi @ 2022-01-20 13:18 UTC (permalink / raw)
  To: Kalle Valo
  Cc: nbd, lorenzo.bianconi, linux-wireless, ryder.lee, evelyn.tsai,
	owen.peng, devicetree, robh

[-- Attachment #1: Type: text/plain, Size: 847 bytes --]

> Lorenzo Bianconi <lorenzo@kernel.org> writes:
> 
> > Add the capability to disable/enable radar/CAC detection running on
> > a dedicated offchannel chain available on some hw.
> > Offchannel radar/CAC detection allows to avoid CAC downtime switching
> > on a different channel during CAC detection on the selected radar
> > channel.
> >
> > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> > ---
> >  .../devicetree/bindings/net/wireless/mediatek,mt76.yaml  | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> 
> Was the recommendation so that devicetree binding patches should be
> first in the patchset?

ah, ok..I was not aware of it :)

Regards,
Lorenzo

> 
> -- 
> https://patchwork.kernel.org/project/linux-wireless/list/
> 
> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2 6/6] dt-bindings:net:wireless:mediatek,mt76: add disable-radar-offchan
  2022-01-12 17:53 ` [PATCH v2 6/6] dt-bindings:net:wireless:mediatek,mt76: add disable-radar-offchan Lorenzo Bianconi
  2022-01-20 13:02   ` Kalle Valo
@ 2022-01-22  1:07   ` Rob Herring
  1 sibling, 0 replies; 10+ messages in thread
From: Rob Herring @ 2022-01-22  1:07 UTC (permalink / raw)
  To: Lorenzo Bianconi
  Cc: lorenzo.bianconi, owen.peng, evelyn.tsai, nbd, ryder.lee,
	devicetree, linux-wireless

On Wed, 12 Jan 2022 18:53:55 +0100, Lorenzo Bianconi wrote:
> Add the capability to disable/enable radar/CAC detection running on
> a dedicated offchannel chain available on some hw.
> Offchannel radar/CAC detection allows to avoid CAC downtime switching
> on a different channel during CAC detection on the selected radar
> channel.
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
>  .../devicetree/bindings/net/wireless/mediatek,mt76.yaml  | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-01-22  1:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-12 17:53 [PATCH v2 0/6] introduce background radar support for mt7915 driver Lorenzo Bianconi
2022-01-12 17:53 ` [PATCH v2 1/6] mt76: mt7915: introduce mt7915_set_radar_background routine Lorenzo Bianconi
2022-01-12 17:53 ` [PATCH v2 2/6] mt76: mt7915: enable radar trigger on rdd2 Lorenzo Bianconi
2022-01-12 17:53 ` [PATCH v2 3/6] mt76: mt7915: introduce rdd_monitor debugfs node Lorenzo Bianconi
2022-01-12 17:53 ` [PATCH v2 4/6] mt76: mt7915: report radar pattern if detected by rdd2 Lorenzo Bianconi
2022-01-12 17:53 ` [PATCH v2 5/6] mt76: mt7915: enable radar background detection Lorenzo Bianconi
2022-01-12 17:53 ` [PATCH v2 6/6] dt-bindings:net:wireless:mediatek,mt76: add disable-radar-offchan Lorenzo Bianconi
2022-01-20 13:02   ` Kalle Valo
2022-01-20 13:18     ` Lorenzo Bianconi
2022-01-22  1:07   ` Rob Herring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.