@@ -49,6 +49,7 @@ enum {
enum {
MCU_ATE_SET_TRX = 0x1,
MCU_ATE_SET_RX_FILTER = 0x3,
+ MCU_ATE_SET_FREQ_OFFSET = 0xa,
};
struct mt7915_mcu_rxd {
@@ -8,6 +8,7 @@
enum {
TM_CHANGED_TXPOWER,
+ TM_CHANGED_FREQ_OFFSET,
/* must be last */
NUM_TM_CHANGED
@@ -15,6 +16,7 @@ enum {
static const u8 tm_change_map[] = {
[TM_CHANGED_TXPOWER] = MT76_TM_ATTR_TX_POWER,
+ [TM_CHANGED_FREQ_OFFSET] = MT76_TM_ATTR_FREQ_OFFSET,
};
struct reg_band {
@@ -80,6 +82,19 @@ mt7915_tm_set_tx_power(struct mt7915_phy *phy)
return ret;
}
+static int
+mt7915_tm_set_freq_offset(struct mt7915_dev *dev, bool en, u32 val)
+{
+ struct mt7915_tm_cmd req = {
+ .testmode_en = en,
+ .param_idx = MCU_ATE_SET_FREQ_OFFSET,
+ .param.freq.freq_offset = cpu_to_le32(val),
+ };
+
+ return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_ATE_CTRL, &req,
+ sizeof(req), false);
+}
+
static int
mt7915_tm_mode_ctrl(struct mt7915_dev *dev, bool enable)
{
@@ -246,6 +261,11 @@ mt7915_tm_set_rx_frames(struct mt7915_dev *dev, bool en)
static void
mt7915_tm_update_params(struct mt7915_dev *dev, u32 changed)
{
+ struct mt76_testmode_data *td = &dev->mt76.test;
+ bool en = dev->mt76.test.state != MT76_TM_STATE_OFF;
+
+ if (changed & BIT(TM_CHANGED_FREQ_OFFSET))
+ mt7915_tm_set_freq_offset(dev, en, en ? td->freq_offset : 0);
if (changed & BIT(TM_CHANGED_TXPOWER))
mt7915_tm_set_tx_power(&dev->phy);
}
@@ -11,6 +11,11 @@ struct mt7915_tm_trx {
u8 rsv;
};
+struct mt7915_tm_freq_offset {
+ u8 band;
+ __le32 freq_offset;
+};
+
struct mt7915_tm_rx_filter {
u8 promiscuous;
u8 report_en;
@@ -27,6 +32,7 @@ struct mt7915_tm_cmd {
union {
__le32 data;
struct mt7915_tm_trx trx;
+ struct mt7915_tm_freq_offset freq;
struct mt7915_tm_rx_filter filter;
u8 test[72];
} param;