Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp352314rwj; Fri, 23 Dec 2022 02:17:55 -0800 (PST) X-Google-Smtp-Source: AMrXdXsFBONsSV5C74vmveoBwlEFix2wPp/IgObfliCyG0Zcy9mucmxY32C98qlapgqkSuPZkQfJ X-Received: by 2002:a17:906:9616:b0:78d:f457:108f with SMTP id s22-20020a170906961600b0078df457108fmr6919101ejx.76.1671790675391; Fri, 23 Dec 2022 02:17:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671790675; cv=none; d=google.com; s=arc-20160816; b=mrk/lYlkW+yGbi1FbGxEgFNR2L8dPO0wBUssQcsHYTHnipynwn2YtQKEI5S1/r4X4D IO7Hwz7U/eBPeoam8Ub78wCs5+7tqFBFP7ZKa4rMejYfg/vbKAYxccvZWev0+zJ0pzRT 0p4D3EjrZDaQ0wWyW2b+4hjo/FIxbgMvSN6bMlhH+Wei3B2kh+vbYVemZwPSFEnyxhLW ImX70e4HlnUJTZpFBFBVrga/Hk19hcJgdzd0Sw8T3PsQ1Q+spfvU36jdiUlELnIZUdKi 6m35jbYd9zlSas1Vy0/bOOrRrdNgTvzT9fSaNJ2mHC6RjT70vRAjV0ZG3upOZ2futJ36 NAAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=Q7vP9AmIc7exdMlaPxDaWmhgtLnhX7HZ3tBM0yG+NGk=; b=Ww54lqR+by/w8wO5Y30jPQpTRe1ojnQGo4URJAhcVJe/yHW6oM28NiR87pcClNGe+/ 5dV4hAdOZwobuvAcYFrAi2Qq6RIPdoA8WlTO48ROVQYe+IKUHeXbrNkQetocLurtxYQ6 n8GHt/LT4hAT2IsI1RA0iHnt8THSe409FS6ztH1ywo2cgZSc5YGFdu7pQ7wJd3P5i7WD BUK9bZrQl+uNOVTHDHvySMCPQMRIaEMDsnLhyaHxdgCrYbFJPCfpNOmbFlfDd1cIsqZJ pmAJtz88lUQn/vi3SmLmXc8fueuHfxc8t1YaNhjlNCEipFj65yB0p3qnrg28//2hGVM6 I2aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="X9NGpQ//"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xb10-20020a170907070a00b007c1052c9243si2596532ejb.15.2022.12.23.02.17.39; Fri, 23 Dec 2022 02:17:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="X9NGpQ//"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230158AbiLWKQr (ORCPT + 66 others); Fri, 23 Dec 2022 05:16:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229680AbiLWKQk (ORCPT ); Fri, 23 Dec 2022 05:16:40 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D38522618 for ; Fri, 23 Dec 2022 02:16:38 -0800 (PST) X-UUID: 4a0a8ac310d848569adfd0caa6ba86b4-20221223 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=Q7vP9AmIc7exdMlaPxDaWmhgtLnhX7HZ3tBM0yG+NGk=; b=X9NGpQ//oOxgsDHeTSDVcIDCKU1JQ4jCtNBPZEUZ/iM83dDhKRf3Roo1kSV81xdSxR5/FGy5B5e+AShpokqdBBvzGxhK1M0uAXvTC3SZ/mh2LD0tPAT3sm0EWYVjgPY5aU6/JcRyTkHJXaR8tWEsNH8V6qB4mufc73k0XpNZVKU=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.14,REQID:23256c67-05a2-4920-b19a-facec5c448a1,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:95 X-CID-INFO: VERSION:1.1.14,REQID:23256c67-05a2-4920-b19a-facec5c448a1,IP:0,URL :0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTION :quarantine,TS:95 X-CID-META: VersionHash:dcaaed0,CLOUDID:21f5388a-8530-4eff-9f77-222cf6e2895b,B ulkID:221223181634WQ5NJQX3,BulkQuantity:0,Recheck:0,SF:28|17|19|48,TC:nil, Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: 4a0a8ac310d848569adfd0caa6ba86b4-20221223 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 569510095; Fri, 23 Dec 2022 18:16:31 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Fri, 23 Dec 2022 18:16:30 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Fri, 23 Dec 2022 18:16:30 +0800 From: Shayne Chen To: Felix Fietkau CC: linux-wireless , Lorenzo Bianconi , Ryder Lee , Evelyn Tsai , Bo Jiao , linux-mediatek , Shayne Chen Subject: [PATCH 1/4] wifi: mt76: mt7996: fix chainmask calculation in mt7996_set_antenna() Date: Fri, 23 Dec 2022 18:13:45 +0800 Message-ID: <20221223101348.11504-1-shayne.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Fix per-band chainmask when restoring from the dev chainmask. Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices") Signed-off-by: Shayne Chen --- drivers/net/wireless/mediatek/mt76/mt7996/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c index 4421cd54311b..c423b052e4f4 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c @@ -880,7 +880,10 @@ mt7996_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) phy->mt76->antenna_mask = tx_ant; /* restore to the origin chainmask which might have auxiliary path */ - if (hweight8(tx_ant) == max_nss) + if (hweight8(tx_ant) == max_nss && band_idx < MT_BAND2) + phy->mt76->chainmask = ((dev->chainmask >> shift) & + (BIT(dev->chainshift[band_idx + 1] - shift) - 1)) << shift; + else if (hweight8(tx_ant) == max_nss) phy->mt76->chainmask = (dev->chainmask >> shift) << shift; else phy->mt76->chainmask = tx_ant << shift; -- 2.25.1