wifi: mt76: mt7925: add coex_info debugfs for WiFi/BT coex
Subsystems (2)
PATCH 1/1 wifi: mt76: mt7925: add coex_info debugfs for WiFi/BT coex
From: Vick Cheng <[email protected]>
This is FW MCU CMD API.
Add mt7925_mcu_chip_config_query() which sends the ASCII command as a UNI query, walks the reply TLVs and copies the payload of the UNI_CHIP_CONFIG_CHIP_CFG entry back to the caller along with its response type. Expose it through a read-only 'coex_info' debugfs entry that queries the firmware on every read, printing the reply as text or as a hexdump depending on the reported type.
MCU_UNI_QUERY(CHIP_CONFIG) also needs the MCU_CMD_ACK option cleared in mt7925_mcu_fill_message(), same as the set variant.
This gives a way to read the live WiFi/BT coex state on an upstream kernel without a vendor tool. The entry is read-only and only issues the command when read, so it costs nothing when unused, and the mt7925_mcu_fill_message() change only matches the new query opcode, so no existing command path changes behaviour.
--- .../wireless/mediatek/mt76/mt7925/debugfs.c | 30 +++++++ .../net/wireless/mediatek/mt76/mt7925/mcu.c | 78 ++++++++++++++++++- .../net/wireless/mediatek/mt76/mt7925/mcu.h | 9 +++ .../wireless/mediatek/mt76/mt7925/mt7925.h | 2 + 4 files changed, 118 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7925/debugfs.c +30 -0
@@ -286,6 +286,34 @@ static int mt7925_chip_reset(void *data, u64 val)DEFINE_DEBUGFS_ATTRIBUTE (fops_reset,NULL , mt7925_chip_reset,"%lld\n" ); +static int +mt7925_coex_info (struct seq_file *s,void *data) +{ +#define MT7925_CHIP_CONFIG_RESP_SIZE 320 +struct mt792x_dev *dev =dev_get_drvdata (s->private); +u8 resp[MT7925_CHIP_CONFIG_RESP_SIZE ], resp_type; +int i, ret; + +mt792x_mutex_acquire (dev); + ret =mt7925_mcu_chip_config_query (dev,"coexBwcGetModeInfo 0" , + &resp_type, resp,sizeof (resp)); +mt792x_mutex_release (dev); + +if (ret <0 ) +return ret; + +if (!ret) +seq_puts (s,"no reply\n" ); +else if (resp_type ==CHIP_CONFIG_TYPE_ASCII ) +seq_printf (s,"%.*s\n" , ret, resp); +else +for (i =0 ; i < ret; i +=16 ) +seq_printf (s,"%04x: %*ph\n" , i, +min_t (int,16 , ret - i), resp + i); + +return 0 ; +} +int mt7925_init_debugfs (struct mt792x_dev *dev) {struct dentry *dir;
@@ -309,6 +337,8 @@ int mt7925_init_debugfs(struct mt792x_dev *dev)debugfs_create_file ("idle-timeout" ,0600 , dir, dev, &fops_pm_idle_timeout);debugfs_create_file ("chip_reset" ,0600 , dir, dev, &fops_reset); +debugfs_create_devm_seqfile (dev->mt76.dev,"coex_info" , dir, + mt7925_coex_info);debugfs_create_devm_seqfile (dev->mt76.dev,"runtime_pm_stats" , dir, mt792x_pm_stats);debugfs_create_file ("deep-sleep" ,0600 , dir, dev, &fops_ds);
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +77 -1
90 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt7925/mcu.h +9 -0
@@ -119,6 +119,15 @@ enum { UNI_CHIP_CONFIG_NIC_CAPA = 0x3, }; +/* type/resp_type of struct mt76_connac_config */ +enum { +CHIP_CONFIG_TYPE_WO_RESPONSE , +CHIP_CONFIG_TYPE_MEM8 , +CHIP_CONFIG_TYPE_MEM32 , +CHIP_CONFIG_TYPE_ASCII , +CHIP_CONFIG_TYPE_BINARY , +}; +enum {UNI_BAND_CONFIG_RADIO_ENABLE ,UNI_BAND_CONFIG_RTS_THRESHOLD =0x08 ,
drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h +2 -0
@@ -295,6 +295,8 @@ int mt7925_mcu_get_rx_rate(struct mt792x_phy *phy, struct ieee80211_vif *vif,int mt7925_mcu_fw_log_2_host (struct mt792x_dev *dev,u8 ctrl);void mt7925_mcu_rx_event (struct mt792x_dev *dev,struct sk_buff *skb);int mt7925_mcu_chip_config (struct mt792x_dev *dev,const char *cmd); +int mt7925_mcu_chip_config_query (struct mt792x_dev *dev,const char *cmd, +u8 *resp_type,void *resp,u16 resp_size);int mt7925_mcu_set_rxfilter (struct mt792x_dev *dev,u32 fif,u8 bit_op,u32 bit_map);
Signature · 1 line
2.45.2