Skip to content

Commit

Permalink
wifi: mt76: mt7915: add basedband Txpower info into debugfs
Browse files Browse the repository at this point in the history
This helps user to debug Txpower propagation path easily.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
  • Loading branch information
Ryder Lee authored and Felix Fietkau committed Dec 1, 2022
1 parent 3dc00ec commit bd2404d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
19 changes: 16 additions & 3 deletions drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand All @@ -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;
}

Expand Down
4 changes: 4 additions & 0 deletions drivers/net/wireless/mediatek/mt76/mt7915/regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,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)
Expand Down

0 comments on commit bd2404d

Please sign in to comment.