Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mt7615: mt7663: get temperature for chip mt7663 #514

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
skb_pull(skb, sizeof(*rxd) + 4 * is_mt7663(mdev));
skb_pull(skb, sizeof(*rxd) + is_mt7663(mdev)?4:0);

A bit more readable/robust imho...

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,
};
ptpt52 marked this conversation as resolved.
Show resolved Hide resolved

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