Skip to content

Commit

Permalink
mt7615: mt7663: get temperature for chip mt7663
Browse files Browse the repository at this point in the history
Tested on chip mt7613

Signed-off-by: Chen Minqiang <[email protected]>
  • Loading branch information
ptpt52 committed Apr 5, 2021
1 parent f8c6c7c commit dac85a8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
5 changes: 4 additions & 1 deletion mt7615/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
18 changes: 17 additions & 1 deletion mt7615/mcu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions mt7615/mt7615.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit dac85a8

Please sign in to comment.