Commit bce84458 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau
Browse files

mt76: mt7921: introduce testmode support



We add the testmode support to access the testmode feature provided
by the MT7921 firmware.

Tested-by: default avatarSean Wang <sean.wang@mediatek.com>
Co-developed-by: default avatarSean Wang <sean.wang@mediatek.com>
Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 05909e46
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -548,6 +548,7 @@ enum {

/* offload mcu commands */
enum {
	MCU_CMD_TEST_CTRL = MCU_CE_PREFIX | 0x01,
	MCU_CMD_START_HW_SCAN = MCU_CE_PREFIX | 0x03,
	MCU_CMD_SET_PS_PROFILE = MCU_CE_PREFIX | 0x05,
	MCU_CMD_SET_CHAN_DOMAIN = MCU_CE_PREFIX | 0x0f,
+1 −0
Original line number Diff line number Diff line
@@ -5,3 +5,4 @@ obj-$(CONFIG_MT7921E) += mt7921e.o
CFLAGS_trace.o := -I$(src)

mt7921e-y := pci.o mac.o mcu.o dma.o eeprom.o main.o init.o debugfs.o trace.o
mt7921e-$(CONFIG_NL80211_TESTMODE) += testmode.o
+2 −0
Original line number Diff line number Diff line
@@ -141,6 +141,8 @@ int mt7921_mac_init(struct mt7921_dev *dev)
	for (i = 0; i < 2; i++)
		mt7921_mac_init_band(dev, i);

	dev->mt76.rxfilter = mt76_rr(dev, MT_WF_RFCR(0));

	return mt76_connac_mcu_set_rts_thresh(&dev->mt76, 0x92b, 0);
}

+2 −0
Original line number Diff line number Diff line
@@ -1240,6 +1240,8 @@ const struct ieee80211_ops mt7921_ops = {
	.sta_statistics = mt7921_sta_statistics,
	.sched_scan_start = mt7921_start_sched_scan,
	.sched_scan_stop = mt7921_stop_sched_scan,
	CFG80211_TESTMODE_CMD(mt7921_testmode_cmd)
	CFG80211_TESTMODE_DUMP(mt7921_testmode_dump)
#ifdef CONFIG_PM
	.suspend = mt7921_suspend,
	.resume = mt7921_resume,
+26 −0
Original line number Diff line number Diff line
@@ -320,4 +320,30 @@ struct mt7921_mcu_tx_done_event {

	u8 rsv1[32];
} __packed;

enum {
	TM_SWITCH_MODE,
	TM_SET_AT_CMD,
	TM_QUERY_AT_CMD,
};

enum {
	MT7921_TM_NORMAL,
	MT7921_TM_TESTMODE,
	MT7921_TM_ICAP,
	MT7921_TM_ICAP_OVERLAP,
	MT7921_TM_WIFISPECTRUM,
};

struct mt7921_rftest_cmd {
	u8 action;
	u8 rsv[3];
	__le32 param0;
	__le32 param1;
} __packed;

struct mt7921_rftest_evt {
	__le32 param0;
	__le32 param1;
} __packed;
#endif
Loading