diff --git a/mt7615/debugfs.c b/mt7615/debugfs.c index 1b4142205..e646bcd14 100644 --- a/mt7615/debugfs.c +++ b/mt7615/debugfs.c @@ -301,7 +301,10 @@ static int mt7615_read_temperature(struct seq_file *s, void *data) /* cpu */ mt7615_mutex_acquire(dev); - temp = mt7615_mcu_get_temperature(dev, 0); + if (is_mt7663(&dev->mt76)) + temp = mt7663_mcu_get_temperature(dev, 0); + else + temp = mt7615_mcu_get_temperature(dev, 0); mt7615_mutex_release(dev); seq_printf(s, "Temperature: %d\n", temp); diff --git a/mt7615/mcu.c b/mt7615/mcu.c index 8c0a21e24..6e16a26e1 100644 --- a/mt7615/mcu.c +++ b/mt7615/mcu.c @@ -190,7 +190,7 @@ int mt7615_mcu_parse_response(struct mt76_dev *mdev, int cmd, ret = *skb->data; break; case MCU_EXT_CMD_GET_TEMP: - skb_pull(skb, sizeof(*rxd)); + skb_pull(skb, sizeof(*rxd) + 4 * is_mt7663(mdev)); ret = le32_to_cpu(*(__le32 *)skb->data); break; case MCU_EXT_CMD_RF_REG_ACCESS | MCU_QUERY_PREFIX: @@ -2297,6 +2297,22 @@ int mt7615_mcu_get_temperature(struct mt7615_dev *dev, int index) sizeof(req), true); } +int mt7663_mcu_get_temperature(struct mt7615_dev *dev, int index) +{ + struct { + u8 ctrl_id; + u8 action; + u8 band; + u8 rsv[1]; + u32 res; + } req = { + .action = index, + }; + + return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_GET_TEMP, &req, + sizeof(req), true); +} + int mt7615_mcu_set_test_param(struct mt7615_dev *dev, u8 param, bool test_mode, u32 val) { diff --git a/mt7615/mt7615.h b/mt7615/mt7615.h index dbabdeef4..ae238687e 100644 --- a/mt7615/mt7615.h +++ b/mt7615/mt7615.h @@ -498,6 +498,7 @@ int mt7615_rf_wr(struct mt7615_dev *dev, u32 wf, u32 reg, u32 val); int mt7615_mcu_set_dbdc(struct mt7615_dev *dev); int mt7615_mcu_set_eeprom(struct mt7615_dev *dev); int mt7615_mcu_get_temperature(struct mt7615_dev *dev, int index); +int mt7663_mcu_get_temperature(struct mt7615_dev *dev, int index); int mt7615_mcu_set_tx_power(struct mt7615_phy *phy); void mt7615_mcu_exit(struct mt7615_dev *dev); void mt7615_mcu_fill_msg(struct mt7615_dev *dev, struct sk_buff *skb,