Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3589232rwb; Sun, 20 Nov 2022 17:40:59 -0800 (PST) X-Google-Smtp-Source: AA0mqf71hO8a8UArf6NzkeNW+G6FOkedkNZD/4qJexCNEKY+P9K2Z4nul+CoajTWYBbro5IYMMAb X-Received: by 2002:aa7:d904:0:b0:460:41e2:b84f with SMTP id a4-20020aa7d904000000b0046041e2b84fmr14481547edr.188.1668994859738; Sun, 20 Nov 2022 17:40:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668994859; cv=none; d=google.com; s=arc-20160816; b=iitYLGDxzPt+XrORPYL8MPvZKKqzAhfin16YpO61CakhDOLqC4s/2fOgmui+JLfORg OA/P98S6CGMpvPEkpxedkMlS5BTdnGtnN+2pdeJ/rI0BPSlaXvVlk9prYFwZ/XfWT5od +tW75sLFAW9KliOmn8Jrth1fHoB3ckprA+MoQO3pApSp8Ky4mXkb0pnllis1FPj4sx7g Vizw6kRiDtZSo0UrShRYZVttz1Xb6U9VKi/3Vu5ydzvniD8k0h3G7FddvlDfBvLutoaC OwEKrWFe7+N0hSD+ePUs8mhKUgGloN+Xcuc29yR8fmGgYVVVvo+wdAxHICycj/29T9gh fffg== 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=PeqfZxLKUnLk1pziaV+m7BIw04gGZPPXIPIo9XSuRwo=; b=BlwU4+SULph3BfVLltKEuMJXm9TCixJZqsngEIrQpLwDvrBFJJPc0MN8EiMIep+P8e ttonAtegX8D+0WoJ/WxAAY/9HY4n4ACLfmJzq6c4KOe1Pf3hOZrDJYtdMzOEN7IPfLDB XSSEt+2gjBKdX9UnYwkFRixaNU53qQlsWOP3TbNsemO6pHOIL+Kmh0dAmwOUjq4jVGiS 7czkRa1nO6F5Z4CgOZ5Qs664nhI2z7z/R3vaUwOwaAZArulJAYH3AaIidOGt2tux+CC/ o7jsfopdD5mHqUPdX0E4X1OS9/v3GrGPEWfqNTYl62O90+yTNA8HYZLv7EFslY8ezqpo UnOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b="j/61jGu9"; 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 l11-20020a056402254b00b0046462065e1dsi8949685edb.291.2022.11.20.17.40.36; Sun, 20 Nov 2022 17:40:59 -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="j/61jGu9"; 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 S229877AbiKUBPA (ORCPT + 68 others); Sun, 20 Nov 2022 20:15:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229491AbiKUBPA (ORCPT ); Sun, 20 Nov 2022 20:15:00 -0500 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19FFC2AC76 for ; Sun, 20 Nov 2022 17:14:58 -0800 (PST) X-UUID: 46651e80d60b45588b32667e783c2396-20221121 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=PeqfZxLKUnLk1pziaV+m7BIw04gGZPPXIPIo9XSuRwo=; b=j/61jGu9HbrpVtVJI9mkbDGcnpLPDq4FVmgkz6Yh8iSck3DAt9/WzZron+FJxic3bg8rlFlG0LhJYa1fcgsGnucKAvPHsUiObeWPwdwuzZ8COTtME6Cqr36LynpEHaKfbdTshDEfWPAIUOZN++7grKv5mWSV/VBFfo8kVY3Ti88=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.12,REQID:c80c14db-f5f3-4c22-8080-67a8eb581ca3,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:62cd327,CLOUDID:d72ecaf8-3a34-4838-abcf-dfedf9dd068e,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: 46651e80d60b45588b32667e783c2396-20221121 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 941686995; Mon, 21 Nov 2022 09:14:53 +0800 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by mtkmbs11n2.mediatek.inc (172.21.101.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Mon, 21 Nov 2022 09:14:52 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Mon, 21 Nov 2022 09:14:52 +0800 From: Ryder Lee To: Felix Fietkau , CC: Lorenzo Bianconi , Shayne Chen , Evelyn Tsai , , Ryder Lee Subject: [PATCH v2 1/3] wifi: mt76: mt7915: add basedband Txpower info into debugfs Date: Mon, 21 Nov 2022 09:14:49 +0800 Message-ID: <939ea87376523dbce05384f412cbbda4bbcb1998.1668992110.git.ryder.lee@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 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 | 18 +++++++++++++++--- .../net/wireless/mediatek/mt76/mt7915/regs.h | 4 ++++ 2 files changed, 19 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..de06bb6b971b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c @@ -967,11 +967,17 @@ 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; + + 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 +988,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); + /* Txpower propagation path: TMAC -> TXV -> BBP */ + 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