Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp19883pxj; Thu, 13 May 2021 19:35:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3/V4IbcpLfA3JbWqWUAmF6P4nbelxZ5XuaORrYhLKF3UuMa1njCCvVlZ+AbWIX902PePo X-Received: by 2002:a17:906:3bc4:: with SMTP id v4mr11700657ejf.12.1620959757854; Thu, 13 May 2021 19:35:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620959757; cv=none; d=google.com; s=arc-20160816; b=A7I0BQIKFwITTQZpVapVIFCUw3nwhtZxNjKs1nT+0+zFzqe0Vsz76YRyhq+AJJIf1x HcX+mB8bCH8X3nOMA4iIEVA8Bj3rMb6nDx/fD3G7n5FIlRd8XUzVWbeEV2QC7bDa47OT 04TgPQ898yFHHZQYTF1QyiIN3G6Xlk7Za4Ro6VztAakR8NNHZODJoGsinfPblAwn/bmF dhWkpCmH3hXGMCkflqh2Cwrqk0i40wAk5CwWv82mxsVburMfFgXtfcmAKPk39yEFtaOG CMtbd1dCrfzOzH1Slbq1t+QSgZql6+XMJjz3+kLHMhOLG08zyhbngaUBaBkC3w1Ak5GG gSRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ZxlKFKfJxOCodmj+n0D748ytdIUV27X4rZLKZe7rmUU=; b=mO1it3XU0Pa+nYeGBFtJUGKLoohFEr7MOznxGF2DMn312qvU7JeNkiOMQ78moMvIiX nY8wUCDNSJBRvl3LK/wukIrRpEd8RVu0u/aGe3z+bOQXDjqIYMFwfIXPT07R6VkEa9pV YN5JRsjSjdE0M7zfXj9hUGrB7t9Yb/4Np2HhuvB39shTazlTYNuS4kRwR4etOJO7bZLW serFBGIscFVxUbj1lob63xs5MuUN9l8xMdmBN4b98HLppzvUQk9OlQS9jhzxyjMZUSpb lLO0QEq6qAYT5m6NHgw/r6dh5TKnztKhP29Nd3efmldmBwhlPX+juhsIX1itlwHz7LsM gWhw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f18si719348ejk.304.2021.05.13.19.35.34; Thu, 13 May 2021 19:35:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230505AbhENCGV (ORCPT + 99 others); Thu, 13 May 2021 22:06:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230184AbhENCGU (ORCPT ); Thu, 13 May 2021 22:06:20 -0400 Received: from mxout012.mail.hostpoint.ch (mxout012.mail.hostpoint.ch [IPv6:2a00:d70:0:e::312]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C12A2C06175F for ; Thu, 13 May 2021 19:05:08 -0700 (PDT) Received: from [10.0.2.45] (helo=asmtp012.mail.hostpoint.ch) by mxout012.mail.hostpoint.ch with esmtp (Exim 4.94.2 (FreeBSD)) (envelope-from ) id 1lhNCK-000H3z-7W; Fri, 14 May 2021 04:05:04 +0200 Received: from [2a02:168:6182:1:4ea5:a8cc:a141:509c] (helo=ryzen2700.home.reto-schneider.ch) by asmtp012.mail.hostpoint.ch with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2 (FreeBSD)) (envelope-from ) id 1lhNCK-000L6T-2x; Fri, 14 May 2021 04:05:04 +0200 X-Authenticated-Sender-Id: reto-schneider@reto-schneider.ch From: Reto Schneider To: Jes.Sorensen@gmail.com, linux-wireless@vger.kernel.org, pkshih@realtek.com Cc: yhchuang@realtek.com, Larry.Finger@lwfinger.net, tehuang@realtek.com, reto.schneider@husqvarnagroup.com, ccchiu77@gmail.com, kvalo@codeaurora.org, davem@davemloft.net, kuba@kernel.org, Chris Chiu , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH 4/7] rtl8xxxu: feed antenna information for mac80211 Date: Fri, 14 May 2021 04:04:39 +0200 Message-Id: <20210514020442.946-5-code@reto-schneider.ch> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210514020442.946-1-code@reto-schneider.ch> References: <20210514020442.946-1-code@reto-schneider.ch> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Chris Chiu (cherry picked from commit 557e87b5db655394a16c9b54a07a2fc11f1ea618) Signed-off-by: Reto Schneider --- .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index d5c53d6dec33..0a04ce00b1fe 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -1688,6 +1688,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; @@ -1764,6 +1765,8 @@ static int rtl8xxxu_identify_chip(struct rtl8xxxu_priv *priv) priv->usb_interrupts = 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) { case RTL8188E: @@ -4363,6 +4366,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) { @@ -6609,6 +6623,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, .get_txpower = rtl8xxxu_get_txpower, }; -- 2.29.2