From: Chris Chiu <chris.chiu@canonical.com>
To: kvalo@kernel.org, Jes.Sorensen@gmail.com, davem@davemloft.net,
kuba@kernel.org
Cc: code@reto-schneider.ch, linux-wireless@vger.kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Chris Chiu <chris.chiu@canonical.com>
Subject: [PATCH v3 1/2] rtl8xxxu: feed antenna information for cfg80211
Date: Fri, 25 Mar 2022 11:57:34 +0800 [thread overview]
Message-ID: <20220325035735.4745-2-chris.chiu@canonical.com> (raw)
In-Reply-To: <20220325035735.4745-1-chris.chiu@canonical.com>
Fill up the available TX/RX antenna so the iw commands can show
correct antenna information for different chips.
Signed-off-by: Chris Chiu <chris.chiu@canonical.com>
---
.../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index 06d59ffb7444..d225a1257530 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -1607,6 +1607,7 @@ static void rtl8xxxu_print_chipinfo(struct rtl8xxxu_priv *priv)
static int rtl8xxxu_identify_chip(struct rtl8xxxu_priv *priv)
{
struct device *dev = &priv->udev->dev;
+ struct ieee80211_hw *hw = priv->hw;
u32 val32, bonding;
u16 val16;
@@ -1684,6 +1685,9 @@ static int rtl8xxxu_identify_chip(struct rtl8xxxu_priv *priv)
priv->has_wifi = 1;
}
+ hw->wiphy->available_antennas_tx = BIT(priv->tx_paths) - 1;
+ hw->wiphy->available_antennas_rx = BIT(priv->rx_paths) - 1;
+
switch (priv->rtl_chip) {
case RTL8188E:
case RTL8192E:
@@ -4282,6 +4286,17 @@ static void rtl8xxxu_cam_write(struct rtl8xxxu_priv *priv,
rtl8xxxu_debug = tmp_debug;
}
+static
+int rtl8xxxu_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant)
+{
+ struct rtl8xxxu_priv *priv = hw->priv;
+
+ *tx_ant = BIT(priv->tx_paths) - 1;
+ *rx_ant = BIT(priv->rx_paths) - 1;
+
+ return 0;
+}
+
static void rtl8xxxu_sw_scan_start(struct ieee80211_hw *hw,
struct ieee80211_vif *vif, const u8 *mac)
{
@@ -6472,6 +6487,7 @@ static const struct ieee80211_ops rtl8xxxu_ops = {
.set_key = rtl8xxxu_set_key,
.ampdu_action = rtl8xxxu_ampdu_action,
.sta_statistics = rtl8xxxu_sta_statistics,
+ .get_antenna = rtl8xxxu_get_antenna,
};
static int rtl8xxxu_parse_usb(struct rtl8xxxu_priv *priv,
--
2.25.1
next prev parent reply other threads:[~2022-03-25 3:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-25 3:57 [PATCH v3 0/2] rtl8xxxu: Fill up more TX information Chris Chiu
2022-03-25 3:57 ` Chris Chiu [this message]
2022-04-06 12:12 ` [PATCH v3 1/2] rtl8xxxu: feed antenna information for cfg80211 Kalle Valo
2022-03-25 3:57 ` [PATCH v3 2/2] rtl8xxxu: fill up txrate info for gen1 chips Chris Chiu
2022-04-06 11:28 ` [v3,2/2] " Kalle Valo
2022-04-06 4:41 ` [PATCH v3 0/2] rtl8xxxu: Fill up more TX information Chris Chiu
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=20220325035735.4745-2-chris.chiu@canonical.com \
--to=chris.chiu@canonical.com \
--cc=Jes.Sorensen@gmail.com \
--cc=code@reto-schneider.ch \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).