Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5481181rwb; Tue, 22 Nov 2022 00:05:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf56/ViQEeXlPZsNjSOt+Km/o4BM9vwJ6fuSXwnSSgq6CstHUyyySMTCvoPWkoU7lOslYwM6 X-Received: by 2002:a63:2745:0:b0:475:2f42:7638 with SMTP id n66-20020a632745000000b004752f427638mr3077097pgn.439.1669104320954; Tue, 22 Nov 2022 00:05:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669104320; cv=none; d=google.com; s=arc-20160816; b=AJtTKQLf6dATwT2Y+nRgd5kMz8QwJxagBW1BuX1EKvk6kBJIS7zOWKjqY76+VRZ5gr CSXnHg5rw/n6ZUKufzbagsrgldb6yEW97a2w/3yz/Ls5TN7jTaGgQSfsVPwgZzXEFW9J MisrPmVXSHI4z3Usp+mpyjAJCZEIq1WqWVFmrNKvgbkR9/m3MDrs2jxcWP8T95F8QlhV fJXf/WTIEOKqDs2Q72Wq0pw7OAT4FjyqYe24ky+vZK/8gKzA4RNkCL8z9RrTroRcwj5H U1W7VHRkSwmyQN1or/fe+iK/nyUdZX87HJ95kJ9b4pEQsJ0ncHYgafRWRQfuTWJmDCP0 a44w== 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=VV4GF9zrWU8gBAwS33wonuL3SQpN8NvUflDSStA3bDU=; b=ggn7vMPj7h+K49+tpNJiR2OX/NKMpqeUafnQNU9NUCnk73YXoMxGxiez6PD+LNQOAW zko6UX7fo64O6rJ3lAdEV6A4oQiN9+WoocugrqP7sVBNugF56j4mI+fcuYRkHy2z8k3D rgWNRDp6tjKmIAKSF0delGApyd8aDvJmPiykgANlWIXehL43AQhQ60aE32FchCDOXbNx ceA+k5rCt9T5u5e3D/NOQX4Sctgvz4xZ5Pc5CU5PY4mf8nbdJkWSI+C4ycNXdTQu+In+ TJIPMtvrSKncMTy3xfNo4DU7bWPTwZWK/Y5BZ1r8eeHeKoSydbpszjZkT9fhdiHJSOXO 2yEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=gvpZmsuB; 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 d139-20020a621d91000000b00540d5753591si12321572pfd.299.2022.11.22.00.05.05; Tue, 22 Nov 2022 00:05:20 -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=gvpZmsuB; 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 S232384AbiKVHxc (ORCPT + 68 others); Tue, 22 Nov 2022 02:53:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232373AbiKVHx0 (ORCPT ); Tue, 22 Nov 2022 02:53:26 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E08E732070 for ; Mon, 21 Nov 2022 23:53:20 -0800 (PST) X-UUID: 786aaf0c486344c2aa7b7d0b26eb7433-20221122 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=VV4GF9zrWU8gBAwS33wonuL3SQpN8NvUflDSStA3bDU=; b=gvpZmsuBdWALj0gzCn2v/9QPl0sQDcPtM3F6P2Sh2x5GVm6qWs50fjhlsF60Z/2dcBjzQyPCQ8hYvuqUFKaOoUX5IpGo4+1/PiKeHlF5ZTsF2zSd9j0M/NEb4GrJae6mWzz1ApG8+/Fvt5wVEe31pPx2+MpNqd6OyWDS7mgk/CU=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.12,REQID:b158a5de-7d01-4a2e-8bee-c772e5491f36,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.12,REQID:b158a5de-7d01-4a2e-8bee-c772e5491f36,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:62cd327,CLOUDID:5875f5f8-3a34-4838-abcf-dfedf9dd068e,B ulkID:22112215531567KEGJX9,BulkQuantity:0,Recheck:0,SF:38|28|17|19|48,TC:n il,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: 786aaf0c486344c2aa7b7d0b26eb7433-20221122 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 463397897; Tue, 22 Nov 2022 15:53:14 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.3; Tue, 22 Nov 2022 15:53:13 +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; Tue, 22 Nov 2022 15:53:13 +0800 From: Ryder Lee To: Felix Fietkau , CC: Lorenzo Bianconi , Shayne Chen , Evelyn Tsai , , Ryder Lee Subject: [PATCH v3 1/3] wifi: mt76: mt7915: add basedband Txpower info into debugfs Date: Tue, 22 Nov 2022 15:53:10 +0800 Message-ID: X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,UNPARSEABLE_RELAY autolearn=no 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 This helps user to debug Txpower propagation path easily. Signed-off-by: Ryder Lee --- change since v2: fix phy1 offset --- .../wireless/mediatek/mt76/mt7915/debugfs.c | 19 ++++++++++++++++--- .../net/wireless/mediatek/mt76/mt7915/regs.h | 4 ++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c index 096cb8a4db3d..c322fcc19d67 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c @@ -967,11 +967,18 @@ mt7915_rate_txpower_show(struct seq_file *file, void *data) "RU484/SU40", "RU996/SU80", "RU2x996/SU160" }; struct mt7915_phy *phy = file->private; + struct mt7915_dev *dev = phy->dev; s8 txpower[MT7915_SKU_RATE_NUM], *buf; - int i; + u32 reg; + int i, ret; + + ret = mt7915_mcu_get_txpower_sku(phy, txpower, sizeof(txpower)); + if (ret) + return ret; + + /* Txpower propagation path: TMAC -> TXV -> BBP */ + seq_printf(file, "\nPhy %d\n", phy != &dev->phy); - seq_printf(file, "\nBand %d\n", phy != &phy->dev->phy); - mt7915_mcu_get_txpower_sku(phy, txpower, sizeof(txpower)); for (i = 0, buf = txpower; i < ARRAY_SIZE(mt7915_sku_group_len); i++) { u8 mcs_num = mt7915_sku_group_len[i]; @@ -982,6 +989,12 @@ mt7915_rate_txpower_show(struct seq_file *file, void *data) buf += mt7915_sku_group_len[i]; } + reg = is_mt7915(&dev->mt76) ? MT_WF_PHY_TPC_CTRL_STAT(phy->band_idx) : + MT_WF_PHY_TPC_CTRL_STAT_MT7916(phy->band_idx); + + seq_printf(file, "\nBaseband transmit power %ld\n", + mt76_get_field(dev, reg, MT_WF_PHY_TPC_POWER)); + return 0; } diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/regs.h b/drivers/net/wireless/mediatek/mt76/mt7915/regs.h index 0c61f1256f3b..5f8e728f048b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/regs.h +++ b/drivers/net/wireless/mediatek/mt76/mt7915/regs.h @@ -1179,6 +1179,10 @@ enum offs_rev { #define MT_WF_PHY_RXTD12_IRPI_SW_CLR_ONLY BIT(18) #define MT_WF_PHY_RXTD12_IRPI_SW_CLR BIT(29) +#define MT_WF_PHY_TPC_CTRL_STAT(_phy) MT_WF_PHY(0xe7a0 + ((_phy) << 16)) +#define MT_WF_PHY_TPC_CTRL_STAT_MT7916(_phy) MT_WF_PHY(0xe7a0 + ((_phy) << 20)) +#define MT_WF_PHY_TPC_POWER GENMASK(15, 8) + #define MT_MCU_WM_CIRQ_BASE 0x89010000 #define MT_MCU_WM_CIRQ(ofs) (MT_MCU_WM_CIRQ_BASE + (ofs)) #define MT_MCU_WM_CIRQ_IRQ_MASK_CLR_ADDR MT_MCU_WM_CIRQ(0x80) -- 2.36.1