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

htop: support show core temperature on rockchip rk3566/3588 #25783

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
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
From ba5738813d27e67057d55af970eba3374a5e288f Mon Sep 17 00:00:00 2001
From: Gabor SEBESTYEN <[email protected]>
Date: Mon, 11 Mar 2024 07:59:41 +0100
Subject: [PATCH] Show core temperatures of Rockchip RK3588 SoC

---
linux/LibSensors.c | 45 +++++++++++++++++++++++++++++++++++++++------
1 file changed, 39 insertions(+), 6 deletions(-)

--- a/linux/LibSensors.c
+++ b/linux/LibSensors.c
@@ -133,13 +133,17 @@ static int tempDriverPriority(const sens
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++)
@@ -208,6 +212,35 @@ void LibSensors_getCPUTemperatures(CPUDa
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;
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
From f2f724b6414d9f49c087e6c177e8a1c2eb80a0c8 Mon Sep 17 00:00:00 2001
From: Benny Baumann <[email protected]>
Date: Fri, 30 Aug 2024 21:56:18 +0200
Subject: [PATCH] Be less strict about thermal zones for RockChip RK3588 SoC

---
linux/LibSensors.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

--- a/linux/LibSensors.c
+++ b/linux/LibSensors.c
@@ -142,6 +142,7 @@ static int tempDriverPriority(const sens
{ "littlecore_thermal", 0 },
{ "bigcore0_thermal", 0 },
{ "bigcore1_thermal", 0 },
+ { "bigcore2_thermal", 0 },
/* Low priority drivers */
{ "acpitz", 1 },
};
@@ -233,7 +234,7 @@ void LibSensors_getCPUTemperatures(CPUDa
coreTempCount += 2;
continue;
}
- if (String_eq(chip->prefix, "bigcore1_thermal")) {
+ if (String_eq(chip->prefix, "bigcore1_thermal") || String_eq(chip->prefix, "bigcore2_thermal")) {
data[7] = temp;
data[8] = temp;
coreTempCount += 2;
39 changes: 39 additions & 0 deletions admin/htop/patches/03-feat-add-sensors-for-Rockchip-RK3566.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
From 1eab0a5b1f58ed893a44e87243cc5d9a236f639f Mon Sep 17 00:00:00 2001
From: KholkinDmitrii <[email protected]>
Date: Wed, 9 Oct 2024 12:46:51 +0200
Subject: [PATCH] feat: add sensors for Rockchip RK3566

---
linux/LibSensors.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

--- a/linux/LibSensors.c
+++ b/linux/LibSensors.c
@@ -143,6 +143,8 @@ static int tempDriverPriority(const sens
{ "bigcore0_thermal", 0 },
{ "bigcore1_thermal", 0 },
{ "bigcore2_thermal", 0 },
+ /* Rockchip RK3566 */
+ { "soc_thermal", 0 },
/* Low priority drivers */
{ "acpitz", 1 },
};
@@ -241,6 +243,18 @@ void LibSensors_getCPUTemperatures(CPUDa
continue;
}
}
+
+ /* Rockchip RK3566 */
+ if (existingCPUs == 4) {
+ if (String_eq(chip->prefix, "soc_thermal")) {
+ data[1] = temp;
+ data[2] = temp;
+ data[3] = temp;
+ data[4] = temp;
+ coreTempCount += 4;
+ continue;
+ }
+ }

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