From patchwork Tue Feb 25 12:28:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 216409 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CFB6C35DE1 for ; Tue, 25 Feb 2020 12:28:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 04F8E218AC for ; Tue, 25 Feb 2020 12:28:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b="X3QaB0HG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729929AbgBYM2u (ORCPT ); Tue, 25 Feb 2020 07:28:50 -0500 Received: from nbd.name ([46.4.11.11]:53754 "EHLO nbd.name" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729444AbgBYM2u (ORCPT ); Tue, 25 Feb 2020 07:28:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject :To:From:Sender:Reply-To:Cc:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=APmM0hXCPyAiDiGHqejETCBeGW6vdN2aMw2cyCbrYHk=; b=X3QaB0HG1QtqIhI92Pkay0p6Jt zQNYG/BDOvYunc5P2dVdq+WRQSoDIBrNtrEoim/Zi23HdayKnyjwxofN3GAEPvo3CLNpR8rgtSNHw OTjOST9y0/ks74I/pBD+kvUdaGLPyTi9+PXB7xvgzucqX/tr5Au0TUSs39/X29ApBt7U=; Received: from [80.255.7.116] (helo=maeck.local) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1j6ZKS-0006CL-Vp for linux-wireless@vger.kernel.org; Tue, 25 Feb 2020 13:28:49 +0100 Received: by maeck.local (Postfix, from userid 501) id F01327E3F8B9; Tue, 25 Feb 2020 13:28:47 +0100 (CET) From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH 1/3] mt76: mt7615: fix antenna mask initialization in DBDC mode Date: Tue, 25 Feb 2020 13:28:45 +0100 Message-Id: <20200225122847.40846-1-nbd@nbd.name> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Update wiphy available antenna mask, and fix chainmask setting on 3x3 hardware Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mt7615/init.c | 4 ++++ drivers/net/wireless/mediatek/mt76/mt7615/main.c | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c index 889eb72ad6bd..4c41e4048161 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c @@ -350,6 +350,8 @@ mt7615_cap_dbdc_enable(struct mt7615_dev *dev) else dev->mphy.antenna_mask = dev->chainmask >> 1; dev->phy.chainmask = dev->mphy.antenna_mask; + dev->mphy.hw->wiphy->available_antennas_rx = dev->phy.chainmask; + dev->mphy.hw->wiphy->available_antennas_tx = dev->phy.chainmask; mt76_set_stream_caps(&dev->mt76, true); } @@ -361,6 +363,8 @@ mt7615_cap_dbdc_disable(struct mt7615_dev *dev) IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ; dev->mphy.antenna_mask = dev->chainmask; dev->phy.chainmask = dev->chainmask; + dev->mphy.hw->wiphy->available_antennas_rx = dev->chainmask; + dev->mphy.hw->wiphy->available_antennas_tx = dev->chainmask; mt76_set_stream_caps(&dev->mt76, true); } diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c index 01194ed79869..7edd5e739b2d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c @@ -686,7 +686,13 @@ mt7615_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) mutex_lock(&dev->mt76.mutex); phy->mt76->antenna_mask = tx_ant; - phy->chainmask = ext_phy ? tx_ant << 2 : tx_ant; + if (ext_phy) { + if (dev->chainmask == 0xf) + tx_ant <<= 2; + else + tx_ant <<= 1; + } + phy->chainmask = tx_ant; mt76_set_stream_caps(&dev->mt76, true); From patchwork Tue Feb 25 12:28:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 216408 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C25DCC35DF5 for ; Tue, 25 Feb 2020 12:28:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9587A20CC7 for ; Tue, 25 Feb 2020 12:28:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=nbd.name header.i=@nbd.name header.b="qh5DeLBZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729933AbgBYM2v (ORCPT ); Tue, 25 Feb 2020 07:28:51 -0500 Received: from nbd.name ([46.4.11.11]:53752 "EHLO nbd.name" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729048AbgBYM2u (ORCPT ); Tue, 25 Feb 2020 07:28:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=VKFr7tplQZG+iFv/6D252Xk6cjewOeMSs1sKn25cAxM=; b=qh5DeLBZ4pKA3ls7eAsZK+B4ro ijvc8NjWGgQgA+4GEmlLELDyC3fLjmqHGiUqgYMYNo8RXpQwNVSlhBpadx/wKx0RYOcBb8+ziLuWx FNmIvfN3ux1qgVl6UNUMlscfS6IslsceJXjlJ0YoUU56O3+oLFQsHiP8RcHyyZKY4ohg=; Received: from [80.255.7.116] (helo=maeck.local) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1j6ZKS-0006CK-Vp for linux-wireless@vger.kernel.org; Tue, 25 Feb 2020 13:28:49 +0100 Received: by maeck.local (Postfix, from userid 501) id EFB3A7E3F8B8; Tue, 25 Feb 2020 13:28:47 +0100 (CET) From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH 3/3] mt76: mt7603: make dynamic sensitivity adjustment configurable via debugfs Date: Tue, 25 Feb 2020 13:28:47 +0100 Message-Id: <20200225122847.40846-3-nbd@nbd.name> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200225122847.40846-1-nbd@nbd.name> References: <20200225122847.40846-1-nbd@nbd.name> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org In some cases it may be useful for debugging to disable this feature Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mt7603/debugfs.c | 2 ++ drivers/net/wireless/mediatek/mt76/mt7603/init.c | 1 + drivers/net/wireless/mediatek/mt76/mt7603/mac.c | 3 +++ drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h | 1 + 4 files changed, 7 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7603/debugfs.c index a84e801d4cf0..cc7c788abedd 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7603/debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt7603/debugfs.c @@ -123,4 +123,6 @@ void mt7603_init_debugfs(struct mt7603_dev *dev) mt7603_radio_read); debugfs_create_u8("sensitivity_limit", 0600, dir, &dev->sensitivity_limit); + debugfs_create_bool("dynamic_sensitivity", 0600, dir, + &dev->dynamic_sensitivity); } diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/init.c b/drivers/net/wireless/mediatek/mt76/mt7603/init.c index 97ba5ddc44bb..f641a8b56b39 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7603/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7603/init.c @@ -541,6 +541,7 @@ int mt7603_register_device(struct mt7603_dev *dev) dev->slottime = 9; dev->sensitivity_limit = 28; + dev->dynamic_sensitivity = true; ret = mt7603_init_hardware(dev); if (ret) diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/mac.c b/drivers/net/wireless/mediatek/mt76/mt7603/mac.c index a3daae41f2f4..39b7c5d6e6cd 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7603/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7603/mac.c @@ -1727,6 +1727,9 @@ mt7603_false_cca_check(struct mt7603_dev *dev) int min_signal; u32 val; + if (!dev->dynamic_sensitivity) + return; + val = mt76_rr(dev, MT_PHYCTRL_STAT_PD); pd_cck = FIELD_GET(MT_PHYCTRL_STAT_PD_CCK, val); pd_ofdm = FIELD_GET(MT_PHYCTRL_STAT_PD_OFDM, val); diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h b/drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h index 831a269472b3..7fadf094e9be 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h +++ b/drivers/net/wireless/mediatek/mt76/mt7603/mt7603.h @@ -142,6 +142,7 @@ struct mt7603_dev { u8 ed_strict_mode; u8 ed_strong_signal; + bool dynamic_sensitivity; s8 sensitivity; u8 sensitivity_limit;