Skip to content

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvin-cao committed Nov 28, 2023
2 parents d85b221 + f9ba36f commit 3c0e7ab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions inc/switchtec/mrpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ enum mrpc_sub_cmd {
MRPC_DIETEMP_GET = 2,
MRPC_DIETEMP_STOP = 3,
MRPC_DIETEMP_GET_GEN4 = 2,
MRPC_DIETEMP_GET_GEN5 = 4,

MRPC_MULTI_CFG_SUPPORTED = 0,
MRPC_MULTI_CFG_COUNT = 1,
Expand Down
10 changes: 9 additions & 1 deletion lib/switchtec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1806,12 +1806,20 @@ float switchtec_die_temp(struct switchtec_dev *dev)
sizeof(sub_cmd_id), &temp, sizeof(temp));
if (ret)
return -100.0;
} else {
} else if (switchtec_is_gen4(dev)) {
sub_cmd_id = MRPC_DIETEMP_GET_GEN4;
ret = switchtec_cmd(dev, MRPC_DIETEMP, &sub_cmd_id,
sizeof(sub_cmd_id), &temp, sizeof(temp));
if (ret)
return -100.0;
} else {
sub_cmd_id = MRPC_DIETEMP_GET_GEN5;
uint32_t temps[4];
ret = switchtec_cmd(dev, MRPC_DIETEMP, &sub_cmd_id,
sizeof(sub_cmd_id), temps, sizeof(temps));
if (ret)
return -100.0;
temp = (temps[0] + temps[1] + temps[2] + temps[3]) / 4;
}

return le32toh(temp) / 100.;
Expand Down

0 comments on commit 3c0e7ab

Please sign in to comment.