Skip to content

Commit

Permalink
Show core temperatures of Rockchip RK3588 SoC
Browse files Browse the repository at this point in the history
  • Loading branch information
segabor authored and BenBE committed Aug 29, 2024
1 parent 2503239 commit 6de810f
Showing 1 changed file with 39 additions and 6 deletions.
45 changes: 39 additions & 6 deletions linux/LibSensors.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,17 @@ static int tempDriverPriority(const sensors_chip_name* chip) {
const char* prefix;
int priority;
} tempDrivers[] = {
{ "coretemp", 0 },
{ "via_cputemp", 0 },
{ "cpu_thermal", 0 },
{ "k10temp", 0 },
{ "zenpower", 0 },
{ "coretemp", 0 },
{ "via_cputemp", 0 },
{ "cpu_thermal", 0 },
{ "k10temp", 0 },
{ "zenpower", 0 },
/* Rockchip RK3588 */
{ "littlecore_thermal", 0 },
{ "bigcore0_thermal", 0 },
{ "bigcore1_thermal", 0 },
/* Low priority drivers */
{ "acpitz", 1 },
{ "acpitz", 1 },
};

for (size_t i = 0; i < ARRAYSIZE(tempDrivers); i++)
Expand Down Expand Up @@ -208,6 +212,35 @@ void LibSensors_getCPUTemperatures(CPUData* cpus, unsigned int existingCPUs, uns
if (r != 0)
continue;

/* Map temperature values to Rockchip cores
*
* littlecore -> cores 1..4
* bigcore0 -> cores 5,6
* bigcore1 -> cores 7,8
*/
if (existingCPUs == 8) {
if (String_eq(chip->prefix, "littlecore_thermal")) {
data[1] = temp;
data[2] = temp;
data[3] = temp;
data[4] = temp;
coreTempCount += 4;
continue;
}
if (String_eq(chip->prefix, "bigcore0_thermal")) {
data[5] = temp;
data[6] = temp;
coreTempCount += 2;
continue;
}
if (String_eq(chip->prefix, "bigcore1_thermal")) {
data[7] = temp;
data[8] = temp;
coreTempCount += 2;
continue;
}
}

/* If already set, e.g. Ryzen reporting platform temperature for each die, use the bigger one */
if (isNaN(data[tempID])) {
data[tempID] = temp;
Expand Down

0 comments on commit 6de810f

Please sign in to comment.