From patchwork Tue Sep 19 04:48:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiji Yang X-Patchwork-Id: 13390745 X-Patchwork-Delegate: nbd@nbd.name Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8E32CD3437 for ; Tue, 19 Sep 2023 04:48:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231421AbjISEso (ORCPT ); Tue, 19 Sep 2023 00:48:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229534AbjISEsn (ORCPT ); Tue, 19 Sep 2023 00:48:43 -0400 Received: from JPN01-OS0-obe.outbound.protection.outlook.com (mail-os0jpn01olkn2028.outbound.protection.outlook.com [40.92.98.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E1BCFD for ; Mon, 18 Sep 2023 21:48:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xw8iZouDxSx6GeO96UEegyG6wzE0JlMxJcCORNkhEVL5V7tyvFTKIMwXQqWrIE8bRf5iEHqbefhzOY//6F0ZmOAHL/Gy9SOLdn97Ad5J8EVUFMqeCSByuvexuQlHCV+snwDNYhJqvTu//HtML3fkCBtxIdRbUnvF9RoQ6l3Q2clwZRmhtwlE3hL6khkciBiPEuIJPY70iGKi1GvrL5UbZUYqr8JZ8yO8IR7yBvqe5hkGTxWc+6839BSlnq2PBqsdWty2Qas+SUcl2+IWwkeBlZAGu3qPH+g6uQANM8YTyTBE29C9ckOITMPPg+n3tx2Ff8VnGPQrfIwthWzBdtGfQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=R10sg/GWR0oK16657nDi1NKbHb3bKvPsWhCwc6LcFig=; b=Lf4lh9blJMsW2BUzRKCwupv5hX+cN65uK2XCd8GtoJGK3y8o7SH8CNDB8149ayTMD8PM+mystOt2CYg8QUQgm+MydYQaJn9AP6+VGwX/5/951Rt4TGKYVhz376aTCMuB3e0uug0qx43FIg/Tf/avwnHjYAp+gmUOyACz+n33tB1L+Q9mfHnwyV/bevtvMmfl8wrLPGcY9wdDyvPDmzlgvfXctz2gY3XLBl0/duVFbiqsPSYW8GXfMPyv4qE/5a4/Kq2aGkFSorxMDVXzaG8vHyJBEX/6GfMsXUFW9mC+N0npbuw839LFnKGrvESP4QIIKifTbca7uGPovIbeGYmsjw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R10sg/GWR0oK16657nDi1NKbHb3bKvPsWhCwc6LcFig=; b=JieK7yEZp4flSjrzNIxDQV/lHKYmjW/dPjkS9/Hjg00qW5Rt9CejZZ6xo9sVcVAY5dyehZuH4gByFZ4YhabaJCgesbwSMQRtSRj1aZ+JwJnjS1oAo2G8ChDJE05ePq0SOnGsGGXaDX5Cv9ioiVP/Xf5gWSoGZBg6UNam8qRBoGV/zsKpCFf/MmD3HQjcFlZ93Iw+bIS0aoNMqHm7tQgWaJI1SHWlFxVtvTm00GuDDFH6rZTxHFXbV9bi0xugJjhlBbYq0H6mgJXASVRLlPYZI8uFJ/Xbft0GUPsuM5i3UQUybTl2ovxo8ubSPdIK/NUgpnnZlTlWapIJM1C30XpZQQ== Received: from TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM (2603:1096:404:8041::8) by TY3P286MB2658.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:255::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.15; Tue, 19 Sep 2023 04:48:32 +0000 Received: from TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM ([fe80::b03c:5b9d:f7a4:9470]) by TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM ([fe80::b03c:5b9d:f7a4:9470%6]) with mapi id 15.20.6813.014; Tue, 19 Sep 2023 04:48:32 +0000 From: Shiji Yang To: linux-wireless@vger.kernel.org Cc: Kalle Valo , Felix Fietkau , Lorenzo Bianconi , Ryder Lee , Shayne Chen , Sean Wang , Shiji Yang Subject: [PATCH] wifi: mt76: mt76x02: correct external LNA gain Date: Tue, 19 Sep 2023 12:48:02 +0800 Message-ID: X-Mailer: git-send-email 2.39.2 X-TMN: [Ku7Lj3NqN7RmWVOQTUqUJ+TcB8o+bC1U] X-ClientProxiedBy: TYAPR03CA0021.apcprd03.prod.outlook.com (2603:1096:404:14::33) To TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM (2603:1096:404:8041::8) X-Microsoft-Original-Message-ID: <20230919044802.2425-1-yangshiji66@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYAP286MB0315:EE_|TY3P286MB2658:EE_ X-MS-Office365-Filtering-Correlation-Id: df0a3d46-cd39-473e-e077-08dbb8cbac42 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VD/oeVMyNEDRMvVOl+K9M0pTGeqyJ8PEU8v1lBoNukfhEgCXR37je10VDWQc+yZypcoqUJiDzmL7r29TUYdHb6BGdVZ4WmdQhRUzHHsS/5iTWAewS1di17VsROORbTKcYx3Df2vh2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/5BEzNmuILnT6rDWe8gVcLseo/J6ZzCfdGGDt4DUAHwvY0wQ7r/2GRR58k1xuXoV9dQbtu3Ju18cEoTMaMHS00AjGHsoYuP04KOLNs63f2wxKIEh9Hv3kDRKFv/G7h5V/UIBXVoUJqju8t8vjn5fETbMk9lh2oGI+RjzdZotc7qSheH2qNRtygZmbP+ACKggxejbDHNAGvP6qBh30qgKAezUurNroPVvwj4LGbPFhRr2SfH6xnn5M1kPd1QrBvpMqZE/XVkBLzrwdkgwsYyKXnrMOYTXToHnZrZYaVB8mAxdoWp7Lu2ya8Bh19PHd8jmqNr7pl/cMsHe+XD0EK/18xCFdIuBY4nCgFHStfUXFlz2H47lqOrMcuJTGn6I1y/IfOhQg+uLU5Un27688YCGRHRbmTlHwYhslFQ863/4yxHECJAyw6uE7yjj0XZ8uUMR7RplntK5+VA/2C6mxri/DES8hLmOS4x+MJMfBBPOzm2lMthqib7z+hsmhQX5cACbua7hcCwwBInJ/AK1T+qYiLPzGTxGV5kUDsyi80vQbbnq2Vb0CQwJRzsjdwfy3FoFGUZ9IWcBzhd+pgQ4b0wko8kmWpSh6+lf7MWeXFVaiqHyOORvX88n86NMwybTw6JPY1ii6INd7Cemuq0sd0ebEu541Hn/VBl6KyBrZ/4az5xZkpBQ9/ijK312wgW+DT54YaE97oHjTMd5k2I= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: df0a3d46-cd39-473e-e077-08dbb8cbac42 X-MS-Exchange-CrossTenant-AuthSource: TYAP286MB0315.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2023 04:48:32.0493 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY3P286MB2658 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Referring to the MT761{0,2} EEPROM content, setting the corresponding EEPROM control bit means enabling external LNA. In this case, we should use the EEMROM LNA gain instead of 0. Signed-off-by: Shiji Yang --- drivers/net/wireless/mediatek/mt76/mt76x02_eeprom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_eeprom.c b/drivers/net/wireless/mediatek/mt76/mt76x02_eeprom.c index 0acabba2d..a0b95509a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_eeprom.c @@ -135,9 +135,9 @@ u8 mt76x02_get_lna_gain(struct mt76x02_dev *dev, u8 lna; val = mt76x02_eeprom_get(dev, MT_EE_NIC_CONF_1); - if (val & MT_EE_NIC_CONF_1_LNA_EXT_2G) + if (!(val & MT_EE_NIC_CONF_1_LNA_EXT_2G)) *lna_2g = 0; - if (val & MT_EE_NIC_CONF_1_LNA_EXT_5G) + if (!(val & MT_EE_NIC_CONF_1_LNA_EXT_5G)) memset(lna_5g, 0, sizeof(s8) * 3); if (chan->band == NL80211_BAND_2GHZ)