blob: b0a287bbf22ab1215e5cf8ab5feccb046fee2102 [file] [log] [blame]
From 37b9de2d5d24fbdb33192977ce5d33d0ad7f2c0a Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Thu, 27 Apr 2023 15:37:33 +0800
Subject: [PATCH 1027/1051] wifi: mt76: mt7915: add muru user number debug
command
---
mt7915/mt7915.h | 1 +
mt7915/vendor.c | 15 ++++++++++++++-
mt7915/vendor.h | 2 ++
3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
index 498674d..24dc022 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -647,6 +647,7 @@ int mt7915_mcu_set_pulse_th(struct mt7915_dev *dev,
int mt7915_mcu_set_radar_th(struct mt7915_dev *dev, int index,
const struct mt7915_dfs_pattern *pattern);
int mt7915_mcu_set_muru_ctrl(struct mt7915_dev *dev, u32 cmd, u32 val);
+int mt7915_set_muru_cfg(struct mt7915_phy *phy, u8 mode, u8 val);
int mt7915_mcu_apply_group_cal(struct mt7915_dev *dev);
int mt7915_mcu_apply_tx_dpd(struct mt7915_phy *phy);
int mt7915_mcu_get_chan_mib_info(struct mt7915_phy *phy, bool chan_switch);
diff --git a/mt7915/vendor.c b/mt7915/vendor.c
index 9a26f7f..432d750 100644
--- a/mt7915/vendor.c
+++ b/mt7915/vendor.c
@@ -46,6 +46,8 @@ static const struct nla_policy
mu_ctrl_policy[NUM_MTK_VENDOR_ATTRS_MU_CTRL] = {
[MTK_VENDOR_ATTR_MU_CTRL_ONOFF] = {.type = NLA_U8 },
[MTK_VENDOR_ATTR_MU_CTRL_DUMP] = {.type = NLA_U8 },
+ [MTK_VENDOR_ATTR_MU_CTRL_OFDMA_MODE] = { .type = NLA_U8 },
+ [MTK_VENDOR_ATTR_MU_CTRL_OFDMA_VAL] { .type = NLA_U8 },
};
static const struct nla_policy
@@ -1053,9 +1055,10 @@ static int mt7915_vendor_mu_ctrl(struct wiphy *wiphy,
int data_len)
{
struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
+ struct mt7915_phy *phy = mt7915_hw_phy(hw);
struct nlattr *tb[NUM_MTK_VENDOR_ATTRS_MU_CTRL];
int err;
- u8 val8;
+ u8 val8, mode;
u32 val32 = 0;
err = nla_parse(tb, MTK_VENDOR_ATTR_MU_CTRL_MAX, data, data_len,
@@ -1069,6 +1072,16 @@ static int mt7915_vendor_mu_ctrl(struct wiphy *wiphy,
FIELD_PREP(RATE_CFG_VAL, val8);
ieee80211_iterate_active_interfaces_atomic(hw, IEEE80211_IFACE_ITER_RESUME_ALL,
mt7915_set_wireless_vif, &val32);
+ } else if (tb[MTK_VENDOR_ATTR_MU_CTRL_OFDMA_MODE]) {
+ mode = nla_get_u8(tb[MTK_VENDOR_ATTR_MU_CTRL_OFDMA_MODE]);
+
+ if (!tb[MTK_VENDOR_ATTR_MU_CTRL_OFDMA_VAL])
+ return -EINVAL;
+
+ val8 = nla_get_u8(tb[MTK_VENDOR_ATTR_MU_CTRL_OFDMA_VAL]);
+ err = mt7915_set_muru_cfg(phy, mode, val8);
+ if (err)
+ return err;
}
return 0;
diff --git a/mt7915/vendor.h b/mt7915/vendor.h
index bd1c617..03d1660 100644
--- a/mt7915/vendor.h
+++ b/mt7915/vendor.h
@@ -103,6 +103,8 @@ enum mtk_vendor_attr_mu_ctrl {
MTK_VENDOR_ATTR_MU_CTRL_ONOFF,
MTK_VENDOR_ATTR_MU_CTRL_DUMP,
+ MTK_VENDOR_ATTR_MU_CTRL_OFDMA_MODE,
+ MTK_VENDOR_ATTR_MU_CTRL_OFDMA_VAL,
/* keep last */
NUM_MTK_VENDOR_ATTRS_MU_CTRL,
--
2.18.0