blob: 11d676492f6ce790f007f95c3c05c34b9de2e7d3 [file] [log] [blame]
developerefb40c12022-12-21 18:05:47 +08001From 5b7b1ad75275431f2a3981445ecb122296e6033c Mon Sep 17 00:00:00 2001
developer6a1998b2022-12-08 18:09:45 +08002From: TomLiu <tomml.liu@mediatek.com>
3Date: Thu, 11 Aug 2022 18:09:45 -0700
developer2aa1e642022-12-19 11:33:22 +08004Subject: [PATCH 1125/1131] mt76: mt7915: Add hemu dump support
developer6a1998b2022-12-08 18:09:45 +08005
6Change-Id: I521214f3feb6f0d528a9f550255050ffd1ec96d2
7---
developer79e690d2022-12-13 17:05:25 +08008 mt7915/vendor.c | 25 +++++++++++++++++++++++++
developer6a1998b2022-12-08 18:09:45 +08009 mt7915/vendor.h | 1 +
developer79e690d2022-12-13 17:05:25 +080010 2 files changed, 26 insertions(+)
developer6a1998b2022-12-08 18:09:45 +080011
12diff --git a/mt7915/vendor.c b/mt7915/vendor.c
developer2aa1e642022-12-19 11:33:22 +080013index 2484e25..f7becce 100644
developer6a1998b2022-12-08 18:09:45 +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
developer79e690d2022-12-13 17:05:25 +080024@@ -1004,6 +1005,29 @@ static int mt7915_vendor_hemu_ctrl(struct wiphy *wiphy,
developer6a1998b2022-12-08 18:09:45 +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;
developer6a1998b2022-12-08 18:09:45 +080037+ int len = 0;
38+
39+ if (*storage == 1)
40+ return -ENOENT;
41+ *storage = 1;
42+
43+ if (nla_put_u8(skb, MTK_VENDOR_ATTR_HEMU_CTRL_DUMP, dev->dbg.muru_onoff))
44+ return -ENOMEM;
45+ len += 1;
46+
47+ return len;
48+}
49+
50+
51 static int
52 mt7915_vendor_phy_capa_ctrl_dump(struct wiphy *wiphy, struct wireless_dev *wdev,
53 struct sk_buff *skb, const void *data, int data_len,
developer79e690d2022-12-13 17:05:25 +080054@@ -1190,6 +1214,7 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = {
developer6a1998b2022-12-08 18:09:45 +080055 .flags = WIPHY_VENDOR_CMD_NEED_NETDEV |
56 WIPHY_VENDOR_CMD_NEED_RUNNING,
57 .doit = mt7915_vendor_hemu_ctrl,
58+ .dumpit = mt7915_vendor_hemu_ctrl_dump,
59 .policy = hemu_ctrl_policy,
60 .maxattr = MTK_VENDOR_ATTR_HEMU_CTRL_MAX,
61 },
62diff --git a/mt7915/vendor.h b/mt7915/vendor.h
developer2aa1e642022-12-19 11:33:22 +080063index 7231971..c19ffe7 100644
developer6a1998b2022-12-08 18:09:45 +080064--- a/mt7915/vendor.h
65+++ b/mt7915/vendor.h
66@@ -72,6 +72,7 @@ enum mtk_vendor_attr_hemu_ctrl {
67 MTK_VENDOR_ATTR_HEMU_CTRL_UNSPEC,
68
69 MTK_VENDOR_ATTR_HEMU_CTRL_ONOFF,
70+ MTK_VENDOR_ATTR_HEMU_CTRL_DUMP,
71
72 /* keep last */
73 NUM_MTK_VENDOR_ATTRS_HEMU_CTRL,
74--
developer2aa1e642022-12-19 11:33:22 +0800752.36.1
developer6a1998b2022-12-08 18:09:45 +080076