Temps (macOS): support M4x

This commit is contained in:
李通洲
2025-02-05 11:01:09 +08:00
parent 70820e424b
commit 76710c8159
4 changed files with 35 additions and 3 deletions
+1
View File
@@ -15,6 +15,7 @@ static double detectCpuTemp(const FFstrbuf* cpuName)
case 1: error = ffDetectSmcTemps(FF_TEMP_CPU_M1X, &result); break;
case 2: error = ffDetectSmcTemps(FF_TEMP_CPU_M2X, &result); break;
case 3: error = ffDetectSmcTemps(FF_TEMP_CPU_M3X, &result); break;
case 4: error = ffDetectSmcTemps(FF_TEMP_CPU_M4X, &result); break;
default: error = "Unsupported Apple Silicon CPU";
}
}
+1
View File
@@ -21,6 +21,7 @@ static double detectGpuTemp(const FFstrbuf* gpuName)
case 1: error = ffDetectSmcTemps(FF_TEMP_GPU_M1X, &result); break;
case 2: error = ffDetectSmcTemps(FF_TEMP_GPU_M2X, &result); break;
case 3: error = ffDetectSmcTemps(FF_TEMP_GPU_M3X, &result); break;
case 4: error = ffDetectSmcTemps(FF_TEMP_GPU_M4X, &result); break;
default: error = "Unsupported Apple Silicon GPU";
}
}
+30 -2
View File
@@ -269,7 +269,7 @@ static const char *smcReadValue(io_connect_t conn, const UInt32Char_t key, doubl
return NULL;
}
static bool detectTemp(io_connect_t conn, const char *sensor, double* sum)
static bool detectTemp(io_connect_t conn, const char* sensor, double* sum)
{
double temp = 0;
const char* error = smcReadValue(conn, sensor, &temp);
@@ -280,7 +280,7 @@ static bool detectTemp(io_connect_t conn, const char *sensor, double* sum)
return true;
}
const char *ffDetectSmcTemps(enum FFTempType type, double *result)
const char* ffDetectSmcTemps(enum FFTempType type, double* result)
{
static io_connect_t conn;
if (!conn)
@@ -353,6 +353,21 @@ const char *ffDetectSmcTemps(enum FFTempType type, double *result)
count += detectTemp(conn, "Tf4E", result); // CPU performance core 12
break;
case FF_TEMP_CPU_M4X:
count += detectTemp(conn, "Te05", result); // CPU efficiency core 1
count += detectTemp(conn, "Te0S", result); // CPU efficiency core 2
count += detectTemp(conn, "Te09", result); // CPU efficiency core 3
count += detectTemp(conn, "Te0H", result); // CPU efficiency core 4
count += detectTemp(conn, "Tp01", result); // CPU performance core 1
count += detectTemp(conn, "Tp05", result); // CPU performance core 2
count += detectTemp(conn, "Tp09", result); // CPU performance core 3
count += detectTemp(conn, "Tp0D", result); // CPU performance core 4
count += detectTemp(conn, "Tp0V", result); // CPU performance core 5
count += detectTemp(conn, "Tp0Y", result); // CPU performance core 6
count += detectTemp(conn, "Tp0b", result); // CPU performance core 7
count += detectTemp(conn, "Tp0e", result); // CPU performance core 8
break;
case FF_TEMP_GPU_INTEL:
count += detectTemp(conn, "TCGC", result); // GPU Intel Graphics
goto gpu_unknown;
@@ -390,6 +405,19 @@ const char *ffDetectSmcTemps(enum FFTempType type, double *result)
count += detectTemp(conn, "Tf2A", result); // GPU 8
break;
case FF_TEMP_GPU_M4X:
count += detectTemp(conn, "Tg0G", result); // GPU 1 (Basic)
count += detectTemp(conn, "Tg0H", result); // GPU 2 (Basic)
count += detectTemp(conn, "Tg1U", result); // GPU 1 (Pro / Max)
count += detectTemp(conn, "Tg1k", result); // GPU 2 (Pro / Max)
count += detectTemp(conn, "Tg0K", result); // GPU 3
count += detectTemp(conn, "Tg0L", result); // GPU 4
count += detectTemp(conn, "Tg0d", result); // GPU 5
count += detectTemp(conn, "Tg0e", result); // GPU 6
count += detectTemp(conn, "Tg0j", result); // GPU 7
count += detectTemp(conn, "Tg0k", result); // GPU 8
break;
case FF_TEMP_BATTERY:
count += detectTemp(conn, "TB1T", result); // Battery
count += detectTemp(conn, "TB2T", result); // Battery
+3 -1
View File
@@ -15,6 +15,7 @@ enum FFTempType
FF_TEMP_CPU_M1X,
FF_TEMP_CPU_M2X,
FF_TEMP_CPU_M3X,
FF_TEMP_CPU_M4X,
FF_TEMP_GPU_INTEL,
FF_TEMP_GPU_AMD,
@@ -22,10 +23,11 @@ enum FFTempType
FF_TEMP_GPU_M1X,
FF_TEMP_GPU_M2X,
FF_TEMP_GPU_M3X,
FF_TEMP_GPU_M4X,
FF_TEMP_BATTERY,
FF_TEMP_MEMORY,
};
const char *ffDetectSmcTemps(enum FFTempType type, double* result);
const char* ffDetectSmcTemps(enum FFTempType type, double* result);