Commit 21338c5b authored by Chris Chiu's avatar Chris Chiu Committed by Kalle Valo

rtl8xxxu: feed antenna information for cfg80211

Fill up the available TX/RX antenna so the iw commands can show
correct antenna information for different chips.
Signed-off-by: default avatarChris Chiu <chris.chiu@canonical.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220325035735.4745-2-chris.chiu@canonical.com
parent a0ff2a87
...@@ -1607,6 +1607,7 @@ static void rtl8xxxu_print_chipinfo(struct rtl8xxxu_priv *priv) ...@@ -1607,6 +1607,7 @@ static void rtl8xxxu_print_chipinfo(struct rtl8xxxu_priv *priv)
static int rtl8xxxu_identify_chip(struct rtl8xxxu_priv *priv) static int rtl8xxxu_identify_chip(struct rtl8xxxu_priv *priv)
{ {
struct device *dev = &priv->udev->dev; struct device *dev = &priv->udev->dev;
struct ieee80211_hw *hw = priv->hw;
u32 val32, bonding; u32 val32, bonding;
u16 val16; u16 val16;
...@@ -1684,6 +1685,9 @@ static int rtl8xxxu_identify_chip(struct rtl8xxxu_priv *priv) ...@@ -1684,6 +1685,9 @@ static int rtl8xxxu_identify_chip(struct rtl8xxxu_priv *priv)
priv->has_wifi = 1; 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) { switch (priv->rtl_chip) {
case RTL8188E: case RTL8188E:
case RTL8192E: case RTL8192E:
...@@ -4282,6 +4286,17 @@ static void rtl8xxxu_cam_write(struct rtl8xxxu_priv *priv, ...@@ -4282,6 +4286,17 @@ static void rtl8xxxu_cam_write(struct rtl8xxxu_priv *priv,
rtl8xxxu_debug = tmp_debug; 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, static void rtl8xxxu_sw_scan_start(struct ieee80211_hw *hw,
struct ieee80211_vif *vif, const u8 *mac) struct ieee80211_vif *vif, const u8 *mac)
{ {
...@@ -6472,6 +6487,7 @@ static const struct ieee80211_ops rtl8xxxu_ops = { ...@@ -6472,6 +6487,7 @@ static const struct ieee80211_ops rtl8xxxu_ops = {
.set_key = rtl8xxxu_set_key, .set_key = rtl8xxxu_set_key,
.ampdu_action = rtl8xxxu_ampdu_action, .ampdu_action = rtl8xxxu_ampdu_action,
.sta_statistics = rtl8xxxu_sta_statistics, .sta_statistics = rtl8xxxu_sta_statistics,
.get_antenna = rtl8xxxu_get_antenna,
}; };
static int rtl8xxxu_parse_usb(struct rtl8xxxu_priv *priv, static int rtl8xxxu_parse_usb(struct rtl8xxxu_priv *priv,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment