blob: 92cd0a7a03da76daf57479fb32235ea827e39429 [file] [log] [blame]
developer3609d782022-11-29 18:07:22 +08001From cf6ba9d0fb09e2c7975b15ede8a5389b700e1f1a Mon Sep 17 00:00:00 2001
developerf2548b02022-08-16 15:37:38 +08002From: TomLiu <tomml.liu@mediatek.com>
3Date: Thu, 11 Aug 2022 18:09:45 -0700
developer3609d782022-11-29 18:07:22 +08004Subject: [PATCH 1123/1127] mt76: HEMU: Add dump support
developerf2548b02022-08-16 15:37:38 +08005
6Change-Id: I521214f3feb6f0d528a9f550255050ffd1ec96d2
7---
8 mt7915/vendor.c | 26 ++++++++++++++++++++++++++
9 mt7915/vendor.h | 1 +
10 2 files changed, 27 insertions(+)
11
12diff --git a/mt7915/vendor.c b/mt7915/vendor.c
developer3609d782022-11-29 18:07:22 +080013index cd5c3b83..5e34b852 100644
developerf2548b02022-08-16 15:37:38 +080014--- a/mt7915/vendor.c
15+++ b/mt7915/vendor.c
16@@ -37,6 +37,7 @@ wireless_ctrl_policy[NUM_MTK_VENDOR_ATTRS_WIRELESS_CTRL] = {
17 static const struct nla_policy
18 hemu_ctrl_policy[NUM_MTK_VENDOR_ATTRS_HEMU_CTRL] = {
19 [MTK_VENDOR_ATTR_HEMU_CTRL_ONOFF] = {.type = NLA_U8 },
20+ [MTK_VENDOR_ATTR_HEMU_CTRL_DUMP] = {.type = NLA_U8 },
21 };
22
23 static const struct nla_policy
developer3609d782022-11-29 18:07:22 +080024@@ -1004,6 +1005,30 @@ static int mt7915_vendor_hemu_ctrl(struct wiphy *wiphy,
developerf2548b02022-08-16 15:37:38 +080025 return 0;
26 }
27
28+
29+static int
30+mt7915_vendor_hemu_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
31+ struct sk_buff *skb, const void *data, int data_len,
32+ unsigned long *storage)
33+{
34+ struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
35+ struct mt7915_phy *phy = mt7915_hw_phy(hw);
36+ struct mt7915_dev *dev = phy->dev;
37+ void *a;
38+ int len = 0;
39+
40+ if (*storage == 1)
41+ return -ENOENT;
42+ *storage = 1;
43+
44+ if (nla_put_u8(skb, MTK_VENDOR_ATTR_HEMU_CTRL_DUMP, dev->dbg.muru_onoff))
45+ return -ENOMEM;
46+ len += 1;
47+
48+ return len;
49+}
50+
51+
52 static int
53 mt7915_vendor_phy_capa_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
54 struct sk_buff *skb, const void *data, int data_len,
developer3609d782022-11-29 18:07:22 +080055@@ -1192,6 +1217,7 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
developerf2548b02022-08-16 15:37:38 +080056 .flags = WIPHY_VENDOR_CMD_NEED_NETDEV |
57 WIPHY_VENDOR_CMD_NEED_RUNNING,
58 .doit = mt7915_vendor_hemu_ctrl,
59+ .dumpit = mt7915_vendor_hemu_ctrl_dump,
60 .policy = hemu_ctrl_policy,
61 .maxattr = MTK_VENDOR_ATTR_HEMU_CTRL_MAX,
62 },
63diff --git a/mt7915/vendor.h b/mt7915/vendor.h
developer3609d782022-11-29 18:07:22 +080064index 72319717..c19ffe72 100644
developerf2548b02022-08-16 15:37:38 +080065--- a/mt7915/vendor.h
66+++ b/mt7915/vendor.h
developer3609d782022-11-29 18:07:22 +080067@@ -72,6 +72,7 @@ enum mtk_vendor_attr_hemu_ctrl {
developerf2548b02022-08-16 15:37:38 +080068 MTK_VENDOR_ATTR_HEMU_CTRL_UNSPEC,
69
70 MTK_VENDOR_ATTR_HEMU_CTRL_ONOFF,
71+ MTK_VENDOR_ATTR_HEMU_CTRL_DUMP,
72
73 /* keep last */
74 NUM_MTK_VENDOR_ATTRS_HEMU_CTRL,
75--
developerb403ad02022-11-08 10:16:29 +0800762.18.0
developerf2548b02022-08-16 15:37:38 +080077