developer | efb40c1 | 2022-12-21 18:05:47 +0800 | [diff] [blame^] | 1 | From 5b7b1ad75275431f2a3981445ecb122296e6033c Mon Sep 17 00:00:00 2001 |
developer | 6a1998b | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 2 | From: TomLiu <tomml.liu@mediatek.com> |
| 3 | Date: Thu, 11 Aug 2022 18:09:45 -0700 |
developer | 2aa1e64 | 2022-12-19 11:33:22 +0800 | [diff] [blame] | 4 | Subject: [PATCH 1125/1131] mt76: mt7915: Add hemu dump support |
developer | 6a1998b | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 5 | |
| 6 | Change-Id: I521214f3feb6f0d528a9f550255050ffd1ec96d2 |
| 7 | --- |
developer | 79e690d | 2022-12-13 17:05:25 +0800 | [diff] [blame] | 8 | mt7915/vendor.c | 25 +++++++++++++++++++++++++ |
developer | 6a1998b | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 9 | mt7915/vendor.h | 1 + |
developer | 79e690d | 2022-12-13 17:05:25 +0800 | [diff] [blame] | 10 | 2 files changed, 26 insertions(+) |
developer | 6a1998b | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 11 | |
| 12 | diff --git a/mt7915/vendor.c b/mt7915/vendor.c |
developer | 2aa1e64 | 2022-12-19 11:33:22 +0800 | [diff] [blame] | 13 | index 2484e25..f7becce 100644 |
developer | 6a1998b | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 14 | --- 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 |
developer | 79e690d | 2022-12-13 17:05:25 +0800 | [diff] [blame] | 24 | @@ -1004,6 +1005,29 @@ static int mt7915_vendor_hemu_ctrl(struct wiphy *wiphy, |
developer | 6a1998b | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 25 | 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; |
developer | 6a1998b | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 37 | + 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, |
developer | 79e690d | 2022-12-13 17:05:25 +0800 | [diff] [blame] | 54 | @@ -1190,6 +1214,7 @@ static const struct wiphy_vendor_command mt7915_vendor_commands[] = { |
developer | 6a1998b | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 55 | .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 | }, |
| 62 | diff --git a/mt7915/vendor.h b/mt7915/vendor.h |
developer | 2aa1e64 | 2022-12-19 11:33:22 +0800 | [diff] [blame] | 63 | index 7231971..c19ffe7 100644 |
developer | 6a1998b | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 64 | --- 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 | -- |
developer | 2aa1e64 | 2022-12-19 11:33:22 +0800 | [diff] [blame] | 75 | 2.36.1 |
developer | 6a1998b | 2022-12-08 18:09:45 +0800 | [diff] [blame] | 76 | |