All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: nbd@nbd.name
Cc: lorenzo.bianconi@redhat.com, linux-wireless@vger.kernel.org,
	ryder.lee@mediatek.com, evelyn.tsai@mediatek.com,
	owen.peng@mediatek.com, devicetree@vger.kernel.org,
	robh@kernel.org
Subject: [PATCH v2 3/6] mt76: mt7915: introduce rdd_monitor debugfs node
Date: Wed, 12 Jan 2022 18:53:52 +0100	[thread overview]
Message-ID: <099d4f11a2c34db2e3312283adc3781cc0108e3a.1642009736.git.lorenzo@kernel.org> (raw)
In-Reply-To: <cover.1642009736.git.lorenzo@kernel.org>

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


  parent reply	other threads:[~2022-01-12 17:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=099d4f11a2c34db2e3312283adc3781cc0108e3a.1642009736.git.lorenzo@kernel.org \
    --to=lorenzo@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=evelyn.tsai@mediatek.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=nbd@nbd.name \
    --cc=owen.peng@mediatek.com \
    --cc=robh@kernel.org \
    --cc=ryder.lee@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.