sysclk: rename to hocclk
idc about compatability when the programs are structured very differently, work very differently, and send/get data in very different ways
This commit is contained in:
@@ -24,7 +24,7 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <sysclk/client/ipc.h>
|
||||
#include <hocclk/client/ipc.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
@@ -83,7 +83,7 @@ Result nvdecCheck = 1;
|
||||
Result nvencCheck = 1;
|
||||
Result nvjpgCheck = 1;
|
||||
Result nifmCheck = 1;
|
||||
Result sysclkCheck = 1;
|
||||
Result hocclkCheck = 1;
|
||||
Result pwmDutyCycleCheck = 1;
|
||||
|
||||
//Wi-Fi
|
||||
@@ -222,7 +222,7 @@ uint64_t lastFrameNumber = 0;
|
||||
uint32_t realCPU_Hz = 0;
|
||||
uint32_t realGPU_Hz = 0;
|
||||
uint32_t realRAM_Hz = 0;
|
||||
uint32_t partLoad[SysClkPartLoad_EnumMax];
|
||||
uint32_t partLoad[HocClkPartLoad_EnumMax];
|
||||
uint32_t realCPU_mV = 0;
|
||||
uint32_t realGPU_mV = 0;
|
||||
uint32_t realRAM_mV = 0;
|
||||
@@ -512,7 +512,7 @@ void gpuLoadThread(void*) {
|
||||
|
||||
std::string getVersionString() {
|
||||
char buf[0x100] = ""; // 256 bytes — safe for any expected version string
|
||||
Result rc = sysclkIpcGetVersionString(buf, sizeof(buf));
|
||||
Result rc = hocclkIpcGetVersionString(buf, sizeof(buf));
|
||||
if (R_FAILED(rc) || buf[0] == '\0') {
|
||||
return "unknown";
|
||||
}
|
||||
@@ -575,24 +575,24 @@ void Misc(void*) {
|
||||
}
|
||||
|
||||
// Get sys-clk data
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
SysClkContext sysclkCTX;
|
||||
if (R_SUCCEEDED(sysclkIpcGetCurrentContext(&sysclkCTX))) {
|
||||
realCPU_Hz = sysclkCTX.realFreqs[SysClkModule_CPU];
|
||||
realGPU_Hz = sysclkCTX.realFreqs[SysClkModule_GPU];
|
||||
realRAM_Hz = sysclkCTX.realFreqs[SysClkModule_MEM];
|
||||
partLoad[SysClkPartLoad_EMC] = sysclkCTX.partLoad[SysClkPartLoad_EMC];
|
||||
partLoad[SysClkPartLoad_EMCCpu] = sysclkCTX.partLoad[SysClkPartLoad_EMCCpu];
|
||||
realCPU_Temp = sysclkCTX.temps[HorizonOCThermalSensor_CPU];
|
||||
realGPU_Temp = sysclkCTX.temps[HorizonOCThermalSensor_GPU];
|
||||
realRAM_Temp = sysclkCTX.temps[HorizonOCThermalSensor_MEM];
|
||||
if (R_SUCCEEDED(hocclkCheck)) {
|
||||
HocClkContext hocclkCTX;
|
||||
if (R_SUCCEEDED(hocclkIpcGetCurrentContext(&hocclkCTX))) {
|
||||
realCPU_Hz = hocclkCTX.realFreqs[HocClkModule_CPU];
|
||||
realGPU_Hz = hocclkCTX.realFreqs[HocClkModule_GPU];
|
||||
realRAM_Hz = hocclkCTX.realFreqs[HocClkModule_MEM];
|
||||
partLoad[HocClkPartLoad_EMC] = hocclkCTX.partLoad[HocClkPartLoad_EMC];
|
||||
partLoad[HocClkPartLoad_EMCCpu] = hocclkCTX.partLoad[HocClkPartLoad_EMCCpu];
|
||||
realCPU_Temp = hocclkCTX.temps[HocClkThermalSensor_CPU];
|
||||
realGPU_Temp = hocclkCTX.temps[HocClkThermalSensor_GPU];
|
||||
realRAM_Temp = hocclkCTX.temps[HocClkThermalSensor_MEM];
|
||||
|
||||
realCPU_mV = sysclkCTX.voltages[HocClkVoltage_CPU];
|
||||
realGPU_mV = sysclkCTX.voltages[HocClkVoltage_GPU];
|
||||
realRAM_mV = sysclkCTX.voltages[HocClkVoltage_EMCVDD2];
|
||||
realSOC_mV = sysclkCTX.voltages[HocClkVoltage_SOC];
|
||||
const u32 vdd2_mV = sysclkCTX.voltages[HocClkVoltage_EMCVDD2] / 1000; // µV to mV
|
||||
const u32 vddq_mV = sysclkCTX.voltages[HocClkVoltage_EMCVDDQ] / 1000; // µV to mV
|
||||
realCPU_mV = hocclkCTX.voltages[HocClkVoltage_CPU];
|
||||
realGPU_mV = hocclkCTX.voltages[HocClkVoltage_GPU];
|
||||
realRAM_mV = hocclkCTX.voltages[HocClkVoltage_EMCVDD2];
|
||||
realSOC_mV = hocclkCTX.voltages[HocClkVoltage_SOC];
|
||||
const u32 vdd2_mV = hocclkCTX.voltages[HocClkVoltage_EMCVDD2] / 1000; // µV to mV
|
||||
const u32 vddq_mV = hocclkCTX.voltages[HocClkVoltage_EMCVDDQ] / 1000; // µV to mV
|
||||
realRAM_mV = vdd2_mV * 100000 + vddq_mV * 10;
|
||||
|
||||
}
|
||||
@@ -711,22 +711,22 @@ void Misc3(void*) {
|
||||
mutexLock(&mutex_Misc);
|
||||
|
||||
// Get sys-clk data
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
SysClkContext sysclkCTX;
|
||||
if (R_SUCCEEDED(sysclkIpcGetCurrentContext(&sysclkCTX))) {
|
||||
partLoad[SysClkPartLoad_EMC] = sysclkCTX.partLoad[SysClkPartLoad_EMC];
|
||||
partLoad[SysClkPartLoad_EMCCpu] = sysclkCTX.partLoad[SysClkPartLoad_EMCCpu];
|
||||
if (R_SUCCEEDED(hocclkCheck)) {
|
||||
HocClkContext hocclkCTX;
|
||||
if (R_SUCCEEDED(hocclkIpcGetCurrentContext(&hocclkCTX))) {
|
||||
partLoad[HocClkPartLoad_EMC] = hocclkCTX.partLoad[HocClkPartLoad_EMC];
|
||||
partLoad[HocClkPartLoad_EMCCpu] = hocclkCTX.partLoad[HocClkPartLoad_EMCCpu];
|
||||
|
||||
realCPU_Temp = sysclkCTX.temps[HorizonOCThermalSensor_CPU];
|
||||
realGPU_Temp = sysclkCTX.temps[HorizonOCThermalSensor_GPU];
|
||||
realRAM_Temp = sysclkCTX.temps[HorizonOCThermalSensor_MEM];
|
||||
realCPU_Temp = hocclkCTX.temps[HocClkThermalSensor_CPU];
|
||||
realGPU_Temp = hocclkCTX.temps[HocClkThermalSensor_GPU];
|
||||
realRAM_Temp = hocclkCTX.temps[HocClkThermalSensor_MEM];
|
||||
|
||||
realCPU_mV = sysclkCTX.voltages[HocClkVoltage_CPU];
|
||||
realGPU_mV = sysclkCTX.voltages[HocClkVoltage_GPU];
|
||||
realRAM_mV = sysclkCTX.voltages[HocClkVoltage_EMCVDD2];
|
||||
realSOC_mV = sysclkCTX.voltages[HocClkVoltage_SOC];
|
||||
const u32 vdd2_mV = sysclkCTX.voltages[HocClkVoltage_EMCVDD2] / 1000; // µV to mV
|
||||
const u32 vddq_mV = sysclkCTX.voltages[HocClkVoltage_EMCVDDQ] / 1000; // µV to mV
|
||||
realCPU_mV = hocclkCTX.voltages[HocClkVoltage_CPU];
|
||||
realGPU_mV = hocclkCTX.voltages[HocClkVoltage_GPU];
|
||||
realRAM_mV = hocclkCTX.voltages[HocClkVoltage_EMCVDD2];
|
||||
realSOC_mV = hocclkCTX.voltages[HocClkVoltage_SOC];
|
||||
const u32 vdd2_mV = hocclkCTX.voltages[HocClkVoltage_EMCVDD2] / 1000; // µV to mV
|
||||
const u32 vddq_mV = hocclkCTX.voltages[HocClkVoltage_EMCVDDQ] / 1000; // µV to mV
|
||||
realRAM_mV = vdd2_mV * 100000 + vddq_mV * 10;
|
||||
|
||||
}
|
||||
|
||||
@@ -441,13 +441,13 @@ public:
|
||||
if (SaltySD) {
|
||||
LoadSharedMemoryAndRefreshRate();
|
||||
}
|
||||
if (sysclkIpcRunning() && R_SUCCEEDED(sysclkIpcInitialize())) {
|
||||
uint32_t sysClkApiVer = 0;
|
||||
sysclkIpcGetAPIVersion(&sysClkApiVer);
|
||||
if (sysClkApiVer != SYSCLK_IPC_API_VERSION) {
|
||||
sysclkIpcExit();
|
||||
if (hocclkIpcRunning() && R_SUCCEEDED(hocclkIpcInitialize())) {
|
||||
uint32_t hocClkApiVer = 0;
|
||||
hocclkIpcGetAPIVersion(&hocClkApiVer);
|
||||
if (hocClkApiVer != HOCCLK_IPC_API_VERSION) {
|
||||
hocclkIpcExit();
|
||||
}
|
||||
else sysclkCheck = 0;
|
||||
else hocclkCheck = 0;
|
||||
}
|
||||
if (R_SUCCEEDED(splInitialize())) {
|
||||
u64 sku = 0;
|
||||
@@ -468,8 +468,8 @@ public:
|
||||
|
||||
virtual void exitServices() override {
|
||||
CloseThreads();
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
sysclkIpcExit();
|
||||
if (R_SUCCEEDED(hocclkCheck)) {
|
||||
hocclkIpcExit();
|
||||
}
|
||||
shmemClose(&_sharedmemory);
|
||||
//Exit services
|
||||
@@ -525,13 +525,13 @@ public:
|
||||
if (SaltySD) {
|
||||
LoadSharedMemory();
|
||||
}
|
||||
if (sysclkIpcRunning() && R_SUCCEEDED(sysclkIpcInitialize())) {
|
||||
uint32_t sysClkApiVer = 0;
|
||||
sysclkIpcGetAPIVersion(&sysClkApiVer);
|
||||
if (sysClkApiVer != SYSCLK_IPC_API_VERSION) {
|
||||
sysclkIpcExit();
|
||||
if (hocclkIpcRunning() && R_SUCCEEDED(hocclkIpcInitialize())) {
|
||||
uint32_t hocClkApiVer = 0;
|
||||
hocclkIpcGetAPIVersion(&hocClkApiVer);
|
||||
if (hocClkApiVer != HOCCLK_IPC_API_VERSION) {
|
||||
hocclkIpcExit();
|
||||
}
|
||||
else sysclkCheck = 0;
|
||||
else hocclkCheck = 0;
|
||||
}
|
||||
if (R_SUCCEEDED(splInitialize())) {
|
||||
u64 sku = 0;
|
||||
@@ -552,8 +552,8 @@ public:
|
||||
virtual void exitServices() override {
|
||||
CloseThreads();
|
||||
shmemClose(&_sharedmemory);
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
sysclkIpcExit();
|
||||
if (R_SUCCEEDED(hocclkCheck)) {
|
||||
hocclkIpcExit();
|
||||
}
|
||||
//Exit services
|
||||
clkrstExit();
|
||||
@@ -612,13 +612,13 @@ public:
|
||||
if (SaltySD) {
|
||||
LoadSharedMemory();
|
||||
}
|
||||
if (sysclkIpcRunning() && R_SUCCEEDED(sysclkIpcInitialize())) {
|
||||
uint32_t sysClkApiVer = 0;
|
||||
sysclkIpcGetAPIVersion(&sysClkApiVer);
|
||||
if (sysClkApiVer != SYSCLK_IPC_API_VERSION) {
|
||||
sysclkIpcExit();
|
||||
if (hocclkIpcRunning() && R_SUCCEEDED(hocclkIpcInitialize())) {
|
||||
uint32_t hocClkApiVer = 0;
|
||||
hocclkIpcGetAPIVersion(&hocClkApiVer);
|
||||
if (hocClkApiVer != HOCCLK_IPC_API_VERSION) {
|
||||
hocclkIpcExit();
|
||||
}
|
||||
else sysclkCheck = 0;
|
||||
else hocclkCheck = 0;
|
||||
}
|
||||
if (R_SUCCEEDED(splInitialize())) {
|
||||
u64 sku = 0;
|
||||
@@ -640,8 +640,8 @@ public:
|
||||
virtual void exitServices() override {
|
||||
CloseThreads();
|
||||
shmemClose(&_sharedmemory);
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
sysclkIpcExit();
|
||||
if (R_SUCCEEDED(hocclkCheck)) {
|
||||
hocclkIpcExit();
|
||||
}
|
||||
// Exit services
|
||||
clkrstExit();
|
||||
@@ -702,13 +702,13 @@ public:
|
||||
if (SaltySD) {
|
||||
LoadSharedMemoryAndRefreshRate();
|
||||
}
|
||||
if (sysclkIpcRunning() && R_SUCCEEDED(sysclkIpcInitialize())) {
|
||||
uint32_t sysClkApiVer = 0;
|
||||
sysclkIpcGetAPIVersion(&sysClkApiVer);
|
||||
if (sysClkApiVer != SYSCLK_IPC_API_VERSION) {
|
||||
sysclkIpcExit();
|
||||
if (hocclkIpcRunning() && R_SUCCEEDED(hocclkIpcInitialize())) {
|
||||
uint32_t hocClkApiVer = 0;
|
||||
hocclkIpcGetAPIVersion(&hocClkApiVer);
|
||||
if (hocClkApiVer != HOCCLK_IPC_API_VERSION) {
|
||||
hocclkIpcExit();
|
||||
}
|
||||
else sysclkCheck = 0;
|
||||
else hocclkCheck = 0;
|
||||
}
|
||||
if (R_SUCCEEDED(splInitialize())) {
|
||||
u64 sku = 0;
|
||||
@@ -729,8 +729,8 @@ public:
|
||||
virtual void exitServices() override {
|
||||
CloseThreads();
|
||||
shmemClose(&_sharedmemory);
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
sysclkIpcExit();
|
||||
if (R_SUCCEEDED(hocclkCheck)) {
|
||||
hocclkIpcExit();
|
||||
}
|
||||
clkrstExit();
|
||||
pcvExit();
|
||||
@@ -785,13 +785,13 @@ public:
|
||||
if (SaltySD) {
|
||||
LoadSharedMemoryAndRefreshRate();
|
||||
}
|
||||
if (sysclkIpcRunning() && R_SUCCEEDED(sysclkIpcInitialize())) {
|
||||
uint32_t sysClkApiVer = 0;
|
||||
sysclkIpcGetAPIVersion(&sysClkApiVer);
|
||||
if (sysClkApiVer != SYSCLK_IPC_API_VERSION) {
|
||||
sysclkIpcExit();
|
||||
if (hocclkIpcRunning() && R_SUCCEEDED(hocclkIpcInitialize())) {
|
||||
uint32_t hocClkApiVer = 0;
|
||||
hocclkIpcGetAPIVersion(&hocClkApiVer);
|
||||
if (hocClkApiVer != HOCCLK_IPC_API_VERSION) {
|
||||
hocclkIpcExit();
|
||||
}
|
||||
else sysclkCheck = 0;
|
||||
else hocclkCheck = 0;
|
||||
}
|
||||
if (R_SUCCEEDED(splInitialize())) {
|
||||
u64 sku = 0;
|
||||
@@ -812,8 +812,8 @@ public:
|
||||
virtual void exitServices() override {
|
||||
CloseThreads();
|
||||
shmemClose(&_sharedmemory);
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
sysclkIpcExit();
|
||||
if (R_SUCCEEDED(hocclkCheck)) {
|
||||
hocclkIpcExit();
|
||||
}
|
||||
clkrstExit();
|
||||
pcvExit();
|
||||
@@ -868,13 +868,13 @@ public:
|
||||
if (SaltySD) {
|
||||
LoadSharedMemoryAndRefreshRate();
|
||||
}
|
||||
if (sysclkIpcRunning() && R_SUCCEEDED(sysclkIpcInitialize())) {
|
||||
uint32_t sysClkApiVer = 0;
|
||||
sysclkIpcGetAPIVersion(&sysClkApiVer);
|
||||
if (sysClkApiVer != SYSCLK_IPC_API_VERSION) {
|
||||
sysclkIpcExit();
|
||||
if (hocclkIpcRunning() && R_SUCCEEDED(hocclkIpcInitialize())) {
|
||||
uint32_t hocClkApiVer = 0;
|
||||
hocclkIpcGetAPIVersion(&hocClkApiVer);
|
||||
if (hocClkApiVer != HOCCLK_IPC_API_VERSION) {
|
||||
hocclkIpcExit();
|
||||
}
|
||||
else sysclkCheck = 0;
|
||||
else hocclkCheck = 0;
|
||||
}
|
||||
if (R_SUCCEEDED(splInitialize())) {
|
||||
u64 sku = 0;
|
||||
@@ -895,8 +895,8 @@ public:
|
||||
virtual void exitServices() override {
|
||||
CloseThreads();
|
||||
shmemClose(&_sharedmemory);
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
sysclkIpcExit();
|
||||
if (R_SUCCEEDED(hocclkCheck)) {
|
||||
hocclkIpcExit();
|
||||
}
|
||||
clkrstExit();
|
||||
pcvExit();
|
||||
|
||||
@@ -527,8 +527,8 @@ public:
|
||||
snprintf(CPU_Load_c, sizeof(CPU_Load_c), "%.1f%%", cpu_usageM);
|
||||
snprintf(GPU_Load_c, sizeof(GPU_Load_c), "%d.%d%%", GPU_Load_u / 10, GPU_Load_u % 10);
|
||||
snprintf(RAM_Load_c, sizeof(RAM_Load_c), "%hu.%hhu%%",
|
||||
partLoad[SysClkPartLoad_EMC] / 10,
|
||||
partLoad[SysClkPartLoad_EMC] % 10);
|
||||
partLoad[HocClkPartLoad_EMC] / 10,
|
||||
partLoad[HocClkPartLoad_EMC] % 10);
|
||||
|
||||
mutexUnlock(&mutex_Misc);
|
||||
|
||||
|
||||
@@ -236,7 +236,7 @@ public:
|
||||
else if (realRAM_Hz && settings.showDeltas && (settings.showRealFreqs || settings.showTargetFreqs)) {
|
||||
renderer->drawString(DeltaRAM_c, false, COMMON_MARGIN + deltaOffset, height_offset, 15, (settings.textColor));
|
||||
}
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
if (R_SUCCEEDED(hocclkCheck)) {
|
||||
static std::vector<std::string> partLoadColoredChars = {"CPU", "GPU"};
|
||||
//static auto loadLabelWidth = renderer->getTextDimensions("Load: ", false, 15).first;
|
||||
renderer->drawString("Load", false, COMMON_MARGIN, height_offset+15, 15, (settings.catColor2));
|
||||
@@ -483,12 +483,12 @@ public:
|
||||
RAMPct_systemunsafe
|
||||
);
|
||||
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
const int RAM_GPU_Load = partLoad[SysClkPartLoad_EMC] - partLoad[SysClkPartLoad_EMCCpu];
|
||||
if (R_SUCCEEDED(hocclkCheck)) {
|
||||
const int RAM_GPU_Load = partLoad[HocClkPartLoad_EMC] - partLoad[HocClkPartLoad_EMCCpu];
|
||||
snprintf(RAM_load_c, sizeof RAM_load_c,
|
||||
"%u.%u%% CPU %u.%u%% GPU %u.%u%%",
|
||||
partLoad[SysClkPartLoad_EMC] / 10, partLoad[SysClkPartLoad_EMC] % 10,
|
||||
partLoad[SysClkPartLoad_EMCCpu] / 10, partLoad[SysClkPartLoad_EMCCpu] % 10,
|
||||
partLoad[HocClkPartLoad_EMC] / 10, partLoad[HocClkPartLoad_EMC] % 10,
|
||||
partLoad[HocClkPartLoad_EMCCpu] / 10, partLoad[HocClkPartLoad_EMCCpu] % 10,
|
||||
RAM_GPU_Load / 10, RAM_GPU_Load % 10);
|
||||
}
|
||||
///Thermal
|
||||
|
||||
@@ -953,10 +953,10 @@ public:
|
||||
snprintf(MICRO_RAM_all_c, sizeof(MICRO_RAM_all_c), "%.0f%.0fGB", RAM_Used_all_f, RAM_Total_all_f);
|
||||
} else {
|
||||
// User wants percentage display
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
if (R_SUCCEEDED(hocclkCheck)) {
|
||||
// Use sys-clk's RAM load if available
|
||||
snprintf(MICRO_RAM_all_c, sizeof(MICRO_RAM_all_c), "%hu%%",
|
||||
partLoad[SysClkPartLoad_EMC] / 10);
|
||||
partLoad[HocClkPartLoad_EMC] / 10);
|
||||
} else {
|
||||
// Calculate percentage manually when sys-clk isn't available
|
||||
const uint64_t RAM_Total_all = RAM_Total_application_u + RAM_Total_applet_u + RAM_Total_system_u + RAM_Total_systemunsafe_u;
|
||||
|
||||
@@ -360,7 +360,7 @@ public:
|
||||
if (settings.realTemps) {
|
||||
width += renderer->getTextDimensions(" 888.8°C", false, fontsize).first;
|
||||
}
|
||||
} else if (key == "GPU" || (key == "RAM" && settings.showpartLoad && R_SUCCEEDED(sysclkCheck))) {
|
||||
} else if (key == "GPU" || (key == "RAM" && settings.showpartLoad && R_SUCCEEDED(hocclkCheck))) {
|
||||
//dimensions = renderer->drawString("100.0%@4444.4", false, 0, 0, fontsize, renderer->a(0x0000));
|
||||
|
||||
if (!settings.showpartLoadCPUGPU) {
|
||||
@@ -379,7 +379,7 @@ public:
|
||||
if (key == "GPU" && settings.realTemps) {
|
||||
width += renderer->getTextDimensions(" 88.8°C", false, fontsize).first;
|
||||
}
|
||||
} else if (key == "RAM" && (!settings.showpartLoad || R_FAILED(sysclkCheck))) {
|
||||
} else if (key == "RAM" && (!settings.showpartLoad || R_FAILED(hocclkCheck))) {
|
||||
//dimensions = renderer->drawString("44444444MB@4444.4", false, 0, 0, fontsize, renderer->a(0x0000));
|
||||
if (!settings.realVolts) {
|
||||
width = renderer->getTextDimensions("100%@4444.4", false, fontsize).first;
|
||||
@@ -1140,12 +1140,12 @@ public:
|
||||
} else {
|
||||
unsigned partLoadInt;
|
||||
|
||||
if (R_SUCCEEDED(sysclkCheck)) {
|
||||
partLoadInt = partLoad[SysClkPartLoad_EMC] / 10;
|
||||
if (R_SUCCEEDED(hocclkCheck)) {
|
||||
partLoadInt = partLoad[HocClkPartLoad_EMC] / 10;
|
||||
|
||||
if (settings.showpartLoadCPUGPU) {
|
||||
unsigned ramCpuLoadInt = partLoad[SysClkPartLoad_EMCCpu] / 10;
|
||||
int RAM_GPU_Load = partLoad[SysClkPartLoad_EMC] - partLoad[SysClkPartLoad_EMCCpu];
|
||||
unsigned ramCpuLoadInt = partLoad[HocClkPartLoad_EMCCpu] / 10;
|
||||
int RAM_GPU_Load = partLoad[HocClkPartLoad_EMC] - partLoad[HocClkPartLoad_EMCCpu];
|
||||
unsigned ramGpuLoadInt = RAM_GPU_Load / 10;
|
||||
|
||||
if (settings.realFrequencies && realRAM_Hz) {
|
||||
|
||||
@@ -29,128 +29,128 @@
|
||||
#include <switch.h>
|
||||
#include <string.h>
|
||||
#include <stdatomic.h>
|
||||
#include <sysclk/client/ipc.h>
|
||||
#include <hocclk/client/ipc.h>
|
||||
|
||||
static Service g_sysclkSrv;
|
||||
static Service g_hocclkSrv;
|
||||
static atomic_size_t g_refCnt;
|
||||
|
||||
bool sysclkIpcRunning()
|
||||
bool hocclkIpcRunning()
|
||||
{
|
||||
Handle handle;
|
||||
bool running = R_FAILED(smRegisterService(&handle, smEncodeName(SYSCLK_IPC_SERVICE_NAME), false, 1));
|
||||
bool running = R_FAILED(smRegisterService(&handle, smEncodeName(HOCCLK_IPC_SERVICE_NAME), false, 1));
|
||||
|
||||
if (!running)
|
||||
{
|
||||
smUnregisterService(smEncodeName(SYSCLK_IPC_SERVICE_NAME));
|
||||
smUnregisterService(smEncodeName(HOCCLK_IPC_SERVICE_NAME));
|
||||
}
|
||||
|
||||
return running;
|
||||
}
|
||||
|
||||
Result sysclkIpcInitialize(void)
|
||||
Result hocclkIpcInitialize(void)
|
||||
{
|
||||
Result rc = 0;
|
||||
|
||||
g_refCnt++;
|
||||
|
||||
if (serviceIsActive(&g_sysclkSrv))
|
||||
if (serviceIsActive(&g_hocclkSrv))
|
||||
return 0;
|
||||
|
||||
rc = smGetService(&g_sysclkSrv, SYSCLK_IPC_SERVICE_NAME);
|
||||
rc = smGetService(&g_hocclkSrv, HOCCLK_IPC_SERVICE_NAME);
|
||||
|
||||
if (R_FAILED(rc)) sysclkIpcExit();
|
||||
if (R_FAILED(rc)) hocclkIpcExit();
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
void sysclkIpcExit(void)
|
||||
void hocclkIpcExit(void)
|
||||
{
|
||||
if (--g_refCnt == 0)
|
||||
{
|
||||
serviceClose(&g_sysclkSrv);
|
||||
serviceClose(&g_hocclkSrv);
|
||||
}
|
||||
}
|
||||
|
||||
Result sysclkIpcGetAPIVersion(u32* out_ver)
|
||||
Result hocclkIpcGetAPIVersion(u32* out_ver)
|
||||
{
|
||||
return serviceDispatchOut(&g_sysclkSrv, SysClkIpcCmd_GetApiVersion, *out_ver);
|
||||
return serviceDispatchOut(&g_hocclkSrv, HocClkIpcCmd_GetApiVersion, *out_ver);
|
||||
}
|
||||
|
||||
Result sysclkIpcGetVersionString(char* out, size_t len)
|
||||
Result hocclkIpcGetVersionString(char* out, size_t len)
|
||||
{
|
||||
return serviceDispatch(&g_sysclkSrv, SysClkIpcCmd_GetVersionString,
|
||||
return serviceDispatch(&g_hocclkSrv, HocClkIpcCmd_GetVersionString,
|
||||
.buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_Out },
|
||||
.buffers = {{out, len}},
|
||||
);
|
||||
}
|
||||
|
||||
Result sysclkIpcGetCurrentContext(SysClkContext* out_context)
|
||||
Result hocclkIpcGetCurrentContext(HocClkContext* out_context)
|
||||
{
|
||||
return serviceDispatch(&g_sysclkSrv, SysClkIpcCmd_GetCurrentContext,
|
||||
return serviceDispatch(&g_hocclkSrv, HocClkIpcCmd_GetCurrentContext,
|
||||
.buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_Out },
|
||||
.buffers = {{out_context, sizeof(SysClkContext)}},
|
||||
.buffers = {{out_context, sizeof(HocClkContext)}},
|
||||
);
|
||||
}
|
||||
|
||||
Result sysclkIpcGetProfileCount(u64 tid, u8* out_count)
|
||||
Result hocclkIpcGetProfileCount(u64 tid, u8* out_count)
|
||||
{
|
||||
return serviceDispatchInOut(&g_sysclkSrv, SysClkIpcCmd_GetProfileCount, tid, *out_count);
|
||||
return serviceDispatchInOut(&g_hocclkSrv, HocClkIpcCmd_GetProfileCount, tid, *out_count);
|
||||
}
|
||||
|
||||
Result sysclkIpcSetEnabled(bool enabled)
|
||||
Result hocclkIpcSetEnabled(bool enabled)
|
||||
{
|
||||
u8 enabledRaw = (u8)enabled;
|
||||
return serviceDispatchIn(&g_sysclkSrv, SysClkIpcCmd_SetEnabled, enabledRaw);
|
||||
return serviceDispatchIn(&g_hocclkSrv, HocClkIpcCmd_SetEnabled, enabledRaw);
|
||||
}
|
||||
|
||||
Result sysclkIpcSetOverride(SysClkModule module, u32 hz)
|
||||
Result hocclkIpcSetOverride(HocClkModule module, u32 hz)
|
||||
{
|
||||
SysClkIpc_SetOverride_Args args = {
|
||||
HocClkIpc_SetOverride_Args args = {
|
||||
.module = module,
|
||||
.hz = hz
|
||||
};
|
||||
return serviceDispatchIn(&g_sysclkSrv, SysClkIpcCmd_SetOverride, args);
|
||||
return serviceDispatchIn(&g_hocclkSrv, HocClkIpcCmd_SetOverride, args);
|
||||
}
|
||||
|
||||
Result sysclkIpcGetProfiles(u64 tid, SysClkTitleProfileList* out_profiles)
|
||||
Result hocclkIpcGetProfiles(u64 tid, HocClkTitleProfileList* out_profiles)
|
||||
{
|
||||
return serviceDispatchIn(&g_sysclkSrv, SysClkIpcCmd_GetProfiles, tid,
|
||||
return serviceDispatchIn(&g_hocclkSrv, HocClkIpcCmd_GetProfiles, tid,
|
||||
.buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_Out },
|
||||
.buffers = {{out_profiles, sizeof(SysClkTitleProfileList)}},
|
||||
.buffers = {{out_profiles, sizeof(HocClkTitleProfileList)}},
|
||||
);
|
||||
}
|
||||
|
||||
Result sysclkIpcSetProfiles(u64 tid, SysClkTitleProfileList* profiles)
|
||||
Result hocclkIpcSetProfiles(u64 tid, HocClkTitleProfileList* profiles)
|
||||
{
|
||||
SysClkIpc_SetProfiles_Args args;
|
||||
HocClkIpc_SetProfiles_Args args;
|
||||
args.tid = tid;
|
||||
memcpy(&args.profiles, profiles, sizeof(SysClkTitleProfileList));
|
||||
return serviceDispatchIn(&g_sysclkSrv, SysClkIpcCmd_SetProfiles, args);
|
||||
memcpy(&args.profiles, profiles, sizeof(HocClkTitleProfileList));
|
||||
return serviceDispatchIn(&g_hocclkSrv, HocClkIpcCmd_SetProfiles, args);
|
||||
}
|
||||
|
||||
Result sysclkIpcGetConfigValues(SysClkConfigValueList* out_configValues)
|
||||
Result hocclkIpcGetConfigValues(HocClkConfigValueList* out_configValues)
|
||||
{
|
||||
return serviceDispatch(&g_sysclkSrv, SysClkIpcCmd_GetConfigValues,
|
||||
return serviceDispatch(&g_hocclkSrv, HocClkIpcCmd_GetConfigValues,
|
||||
.buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_Out },
|
||||
.buffers = {{out_configValues, sizeof(SysClkConfigValueList)}},
|
||||
.buffers = {{out_configValues, sizeof(HocClkConfigValueList)}},
|
||||
);
|
||||
}
|
||||
|
||||
Result sysclkIpcSetConfigValues(SysClkConfigValueList* configValues)
|
||||
Result hocclkIpcSetConfigValues(HocClkConfigValueList* configValues)
|
||||
{
|
||||
return serviceDispatch(&g_sysclkSrv, SysClkIpcCmd_SetConfigValues,
|
||||
return serviceDispatch(&g_hocclkSrv, HocClkIpcCmd_SetConfigValues,
|
||||
.buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_In },
|
||||
.buffers = {{configValues, sizeof(SysClkConfigValueList)}},
|
||||
.buffers = {{configValues, sizeof(HocClkConfigValueList)}},
|
||||
);
|
||||
}
|
||||
|
||||
Result sysclkIpcGetFreqList(SysClkModule module, u32* list, u32 maxCount, u32* outCount)
|
||||
Result hocclkIpcGetFreqList(HocClkModule module, u32* list, u32 maxCount, u32* outCount)
|
||||
{
|
||||
SysClkIpc_GetFreqList_Args args = {
|
||||
HocClkIpc_GetFreqList_Args args = {
|
||||
.module = module,
|
||||
.maxCount = maxCount
|
||||
};
|
||||
return serviceDispatchInOut(&g_sysclkSrv, SysClkIpcCmd_GetFreqList, args, *outCount,
|
||||
return serviceDispatchInOut(&g_hocclkSrv, HocClkIpcCmd_GetFreqList, args, *outCount,
|
||||
.buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_Out },
|
||||
.buffers = {{list, maxCount * sizeof(u32)}},
|
||||
);
|
||||
@@ -159,11 +159,11 @@ Result sysclkIpcGetFreqList(SysClkModule module, u32* list, u32 maxCount, u32* o
|
||||
Result hocClkIpcSetKipData()
|
||||
{
|
||||
u32 temp = 0;
|
||||
return serviceDispatchIn(&g_sysclkSrv, HocClkIpcCmd_SetKipData, temp);
|
||||
return serviceDispatchIn(&g_hocclkSrv, HocClkIpcCmd_SetKipData, temp);
|
||||
}
|
||||
|
||||
Result hocClkIpcGetKipData()
|
||||
{
|
||||
u32 temp = 0;
|
||||
return serviceDispatchIn(&g_sysclkSrv, HocClkIpcCmd_GetKipData, temp);
|
||||
return serviceDispatchIn(&g_hocclkSrv, HocClkIpcCmd_GetKipData, temp);
|
||||
}
|
||||
@@ -42,13 +42,13 @@ extern "C" {
|
||||
// typedef std::int16_t s16;
|
||||
// typedef std::uint16_t u16;
|
||||
|
||||
#include "sysclk/ipc.h"
|
||||
#include "sysclk/board.h"
|
||||
#include "sysclk/clock_manager.h"
|
||||
#include "sysclk/apm.h"
|
||||
#include "sysclk/config.h"
|
||||
#include "sysclk/errors.h"
|
||||
#include "sysclk/psm_ext.h"
|
||||
#include "hocclk/ipc.h"
|
||||
#include "hocclk/board.h"
|
||||
#include "hocclk/clock_manager.h"
|
||||
#include "hocclk/apm.h"
|
||||
#include "hocclk/config.h"
|
||||
#include "hocclk/errors.h"
|
||||
#include "hocclk/psm_ext.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
@@ -34,6 +34,6 @@ typedef struct {
|
||||
uint32_t cpu_hz;
|
||||
uint32_t gpu_hz;
|
||||
uint32_t mem_hz;
|
||||
} SysClkApmConfiguration;
|
||||
} HocClkApmConfiguration;
|
||||
|
||||
extern SysClkApmConfiguration sysclk_g_apm_configurations[];
|
||||
extern HocClkApmConfiguration hocclk_g_apm_configurations[];
|
||||
@@ -33,21 +33,21 @@
|
||||
#include <switch/types.h>
|
||||
typedef enum
|
||||
{
|
||||
SysClkSocType_Erista = 0,
|
||||
SysClkSocType_Mariko,
|
||||
SysClkSocType_EnumMax
|
||||
} SysClkSocType;
|
||||
HocClkSocType_Erista = 0,
|
||||
HocClkSocType_Mariko,
|
||||
HocClkSocType_EnumMax
|
||||
} HocClkSocType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
HorizonOCConsoleType_Icosa = 0,
|
||||
HorizonOCConsoleType_Copper,
|
||||
HorizonOCConsoleType_Hoag,
|
||||
HorizonOCConsoleType_Iowa,
|
||||
HorizonOCConsoleType_Calcio,
|
||||
HorizonOCConsoleType_Aula,
|
||||
HorizonOCConsoleType_EnumMax,
|
||||
} HorizonOCConsoleType;
|
||||
HocClkConsoleType_Icosa = 0,
|
||||
HocClkConsoleType_Copper,
|
||||
HocClkConsoleType_Hoag,
|
||||
HocClkConsoleType_Iowa,
|
||||
HocClkConsoleType_Calcio,
|
||||
HocClkConsoleType_Aula,
|
||||
HocClkConsoleType_EnumMax,
|
||||
} HocClkConsoleType;
|
||||
|
||||
typedef enum {
|
||||
HocClkVoltage_SOC = 0,
|
||||
@@ -62,62 +62,62 @@ typedef enum {
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SysClkProfile_Handheld = 0,
|
||||
SysClkProfile_HandheldCharging,
|
||||
SysClkProfile_HandheldChargingUSB,
|
||||
SysClkProfile_HandheldChargingOfficial,
|
||||
SysClkProfile_Docked,
|
||||
SysClkProfile_EnumMax
|
||||
} SysClkProfile;
|
||||
HocClkProfile_Handheld = 0,
|
||||
HocClkProfile_HandheldCharging,
|
||||
HocClkProfile_HandheldChargingUSB,
|
||||
HocClkProfile_HandheldChargingOfficial,
|
||||
HocClkProfile_Docked,
|
||||
HocClkProfile_EnumMax
|
||||
} HocClkProfile;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SysClkModule_CPU = 0,
|
||||
SysClkModule_GPU,
|
||||
SysClkModule_MEM,
|
||||
HorizonOCModule_Governor,
|
||||
HorizonOCModule_Display,
|
||||
SysClkModule_EnumMax,
|
||||
} SysClkModule;
|
||||
HocClkModule_CPU = 0,
|
||||
HocClkModule_GPU,
|
||||
HocClkModule_MEM,
|
||||
HocClkModule_Governor,
|
||||
HocClkModule_Display,
|
||||
HocClkModule_EnumMax,
|
||||
} HocClkModule;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SysClkThermalSensor_SOC = 0,
|
||||
SysClkThermalSensor_PCB,
|
||||
SysClkThermalSensor_Skin,
|
||||
HorizonOCThermalSensor_Battery,
|
||||
HorizonOCThermalSensor_PMIC,
|
||||
HorizonOCThermalSensor_CPU,
|
||||
HorizonOCThermalSensor_GPU,
|
||||
HorizonOCThermalSensor_MEM,
|
||||
HorizonOCThermalSensor_PLLX,
|
||||
SysClkThermalSensor_EnumMax
|
||||
} SysClkThermalSensor;
|
||||
HocClkThermalSensor_SOC = 0,
|
||||
HocClkThermalSensor_PCB,
|
||||
HocClkThermalSensor_Skin,
|
||||
HocClkThermalSensor_Battery,
|
||||
HocClkThermalSensor_PMIC,
|
||||
HocClkThermalSensor_CPU,
|
||||
HocClkThermalSensor_GPU,
|
||||
HocClkThermalSensor_MEM,
|
||||
HocClkThermalSensor_PLLX,
|
||||
HocClkThermalSensor_EnumMax
|
||||
} HocClkThermalSensor;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SysClkPowerSensor_Now = 0,
|
||||
SysClkPowerSensor_Avg,
|
||||
SysClkPowerSensor_EnumMax
|
||||
} SysClkPowerSensor;
|
||||
HocClkPowerSensor_Now = 0,
|
||||
HocClkPowerSensor_Avg,
|
||||
HocClkPowerSensor_EnumMax
|
||||
} HocClkPowerSensor;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SysClkPartLoad_EMC = 0,
|
||||
SysClkPartLoad_EMCCpu,
|
||||
HocClkPartLoad_EMC = 0,
|
||||
HocClkPartLoad_EMCCpu,
|
||||
HocClkPartLoad_GPU,
|
||||
HocClkPartLoad_CPUMax,
|
||||
HocClkPartLoad_BAT,
|
||||
HocClkPartLoad_FAN,
|
||||
SysClkPartLoad_EnumMax
|
||||
} SysClkPartLoad;
|
||||
HocClkPartLoad_EnumMax
|
||||
} HocClkPartLoad;
|
||||
|
||||
typedef enum {
|
||||
HorizonOCSpeedo_CPU = 0,
|
||||
HorizonOCSpeedo_GPU,
|
||||
HorizonOCSpeedo_SOC,
|
||||
HorizonOCSpeedo_EnumMax,
|
||||
} HorizonOCSpeedo;
|
||||
HocClkSpeedo_CPU = 0,
|
||||
HocClkSpeedo_GPU,
|
||||
HocClkSpeedo_SOC,
|
||||
HocClkSpeedo_EnumMax,
|
||||
} HocClkSpeedo;
|
||||
|
||||
typedef enum {
|
||||
GPUUVLevel_NoUV = 0,
|
||||
@@ -158,7 +158,7 @@ typedef enum {
|
||||
RamDisplayMode_EnumMax,
|
||||
} RamDisplayMode;
|
||||
|
||||
#define SYSCLK_ENUM_VALID(n, v) ((v) < n##_EnumMax)
|
||||
#define HOCCLK_ENUM_VALID(n, v) ((v) < n##_EnumMax)
|
||||
|
||||
// Packed u32
|
||||
// Bits 0-7 - CPU
|
||||
@@ -179,77 +179,77 @@ inline u8 GovernorStateVrr(u32 p) {
|
||||
return (u8)((p >> 16) & 0xFF);
|
||||
}
|
||||
|
||||
static inline const char* sysclkFormatModule(SysClkModule module, bool pretty)
|
||||
static inline const char* hocclkFormatModule(HocClkModule module, bool pretty)
|
||||
{
|
||||
switch(module)
|
||||
{
|
||||
case SysClkModule_CPU:
|
||||
case HocClkModule_CPU:
|
||||
return pretty ? "CPU" : "cpu";
|
||||
case SysClkModule_GPU:
|
||||
case HocClkModule_GPU:
|
||||
return pretty ? "GPU" : "gpu";
|
||||
case SysClkModule_MEM:
|
||||
case HocClkModule_MEM:
|
||||
return pretty ? "Memory" : "mem";
|
||||
case HorizonOCModule_Display:
|
||||
case HocClkModule_Display:
|
||||
return pretty ? "Display" : "display";
|
||||
case HorizonOCModule_Governor:
|
||||
case HocClkModule_Governor:
|
||||
return pretty ? "Governor" : "governor";
|
||||
default:
|
||||
return "null";
|
||||
}
|
||||
}
|
||||
|
||||
static inline const char* sysclkFormatThermalSensor(SysClkThermalSensor thermSensor, bool pretty)
|
||||
static inline const char* hocclkFormatThermalSensor(HocClkThermalSensor thermSensor, bool pretty)
|
||||
{
|
||||
switch(thermSensor) {
|
||||
case SysClkThermalSensor_SOC:
|
||||
case HocClkThermalSensor_SOC:
|
||||
return pretty ? "SOC" : "soc";
|
||||
case SysClkThermalSensor_PCB:
|
||||
case HocClkThermalSensor_PCB:
|
||||
return pretty ? "PCB" : "pcb";
|
||||
case SysClkThermalSensor_Skin:
|
||||
case HocClkThermalSensor_Skin:
|
||||
return pretty ? "Skin" : "skin";
|
||||
case HorizonOCThermalSensor_Battery:
|
||||
case HocClkThermalSensor_Battery:
|
||||
return pretty ? "BAT" : "battery";
|
||||
case HorizonOCThermalSensor_PMIC:
|
||||
case HocClkThermalSensor_PMIC:
|
||||
return pretty ? "PMIC" : "pmic";
|
||||
case HorizonOCThermalSensor_CPU:
|
||||
case HocClkThermalSensor_CPU:
|
||||
return pretty ? "CPU" : "cpu";
|
||||
case HorizonOCThermalSensor_GPU:
|
||||
case HocClkThermalSensor_GPU:
|
||||
return pretty ? "GPU" : "gpu";
|
||||
case HorizonOCThermalSensor_MEM:
|
||||
case HocClkThermalSensor_MEM:
|
||||
return pretty ? "MEM" : "mem";
|
||||
case HorizonOCThermalSensor_PLLX:
|
||||
case HocClkThermalSensor_PLLX:
|
||||
return pretty ? "PLLX" : "pllx";
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static inline const char* sysclkFormatPowerSensor(SysClkPowerSensor powSensor, bool pretty)
|
||||
static inline const char* hocclkFormatPowerSensor(HocClkPowerSensor powSensor, bool pretty)
|
||||
{
|
||||
switch(powSensor)
|
||||
{
|
||||
case SysClkPowerSensor_Now:
|
||||
case HocClkPowerSensor_Now:
|
||||
return pretty ? "Now" : "now";
|
||||
case SysClkPowerSensor_Avg:
|
||||
case HocClkPowerSensor_Avg:
|
||||
return pretty ? "Avg" : "avg";
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static inline const char* sysclkFormatProfile(SysClkProfile profile, bool pretty)
|
||||
static inline const char* hocclkFormatProfile(HocClkProfile profile, bool pretty)
|
||||
{
|
||||
switch(profile)
|
||||
{
|
||||
case SysClkProfile_Docked:
|
||||
case HocClkProfile_Docked:
|
||||
return pretty ? "Docked" : "docked";
|
||||
case SysClkProfile_Handheld:
|
||||
case HocClkProfile_Handheld:
|
||||
return pretty ? "Handheld" : "handheld";
|
||||
case SysClkProfile_HandheldCharging:
|
||||
case HocClkProfile_HandheldCharging:
|
||||
return pretty ? "Charging" : "handheld_charging";
|
||||
case SysClkProfile_HandheldChargingUSB:
|
||||
case HocClkProfile_HandheldChargingUSB:
|
||||
return pretty ? "USB Charger" : "handheld_charging_usb";
|
||||
case SysClkProfile_HandheldChargingOfficial:
|
||||
case HocClkProfile_HandheldChargingOfficial:
|
||||
return pretty ? "PD Charger" : "handheld_charging_official";
|
||||
default:
|
||||
return NULL;
|
||||
@@ -32,26 +32,26 @@
|
||||
#include "../board.h"
|
||||
#include "../ipc.h"
|
||||
|
||||
bool sysclkIpcRunning();
|
||||
Result sysclkIpcInitialize(void);
|
||||
void sysclkIpcExit(void);
|
||||
bool hocclkIpcRunning();
|
||||
Result hocclkIpcInitialize(void);
|
||||
void hocclkIpcExit(void);
|
||||
|
||||
Result sysclkIpcGetAPIVersion(u32* out_ver);
|
||||
Result sysclkIpcGetVersionString(char* out, size_t len);
|
||||
Result sysclkIpcGetCurrentContext(SysClkContext* out_context);
|
||||
Result sysclkIpcGetProfileCount(u64 tid, u8* out_count);
|
||||
Result sysclkIpcSetEnabled(bool enabled);
|
||||
Result sysclkIpcExitCmd();
|
||||
Result sysclkIpcSetOverride(SysClkModule module, u32 hz);
|
||||
Result sysclkIpcGetProfiles(u64 tid, SysClkTitleProfileList* out_profiles);
|
||||
Result sysclkIpcSetProfiles(u64 tid, SysClkTitleProfileList* profiles);
|
||||
Result sysclkIpcGetConfigValues(SysClkConfigValueList* out_configValues);
|
||||
Result sysclkIpcSetConfigValues(SysClkConfigValueList* configValues);
|
||||
Result sysclkIpcGetFreqList(SysClkModule module, u32* list, u32 maxCount, u32* outCount);
|
||||
Result hocclkIpcGetAPIVersion(u32* out_ver);
|
||||
Result hocclkIpcGetVersionString(char* out, size_t len);
|
||||
Result hocclkIpcGetCurrentContext(HocClkContext* out_context);
|
||||
Result hocclkIpcGetProfileCount(u64 tid, u8* out_count);
|
||||
Result hocclkIpcSetEnabled(bool enabled);
|
||||
Result hocclkIpcExitCmd();
|
||||
Result hocclkIpcSetOverride(HocClkModule module, u32 hz);
|
||||
Result hocclkIpcGetProfiles(u64 tid, HocClkTitleProfileList* out_profiles);
|
||||
Result hocclkIpcSetProfiles(u64 tid, HocClkTitleProfileList* profiles);
|
||||
Result hocclkIpcGetConfigValues(HocClkConfigValueList* out_configValues);
|
||||
Result hocclkIpcSetConfigValues(HocClkConfigValueList* configValues);
|
||||
Result hocclkIpcGetFreqList(HocClkModule module, u32* list, u32 maxCount, u32* outCount);
|
||||
Result hocClkIpcSetKipData();
|
||||
Result hocClkIpcGetKipData();
|
||||
|
||||
static inline Result sysclkIpcRemoveOverride(SysClkModule module)
|
||||
static inline Result hocclkIpcRemoveOverride(HocClkModule module)
|
||||
{
|
||||
return sysclkIpcSetOverride(module, 0);
|
||||
return hocclkIpcSetOverride(module, 0);
|
||||
}
|
||||
@@ -33,16 +33,16 @@
|
||||
typedef struct
|
||||
{
|
||||
uint64_t applicationId;
|
||||
SysClkProfile profile;
|
||||
uint32_t freqs[SysClkModule_EnumMax];
|
||||
uint32_t realFreqs[SysClkModule_EnumMax];
|
||||
uint32_t overrideFreqs[SysClkModule_EnumMax];
|
||||
uint32_t temps[SysClkThermalSensor_EnumMax];
|
||||
int32_t power[SysClkPowerSensor_EnumMax];
|
||||
uint32_t partLoad[SysClkPartLoad_EnumMax];
|
||||
HocClkProfile profile;
|
||||
uint32_t freqs[HocClkModule_EnumMax];
|
||||
uint32_t realFreqs[HocClkModule_EnumMax];
|
||||
uint32_t overrideFreqs[HocClkModule_EnumMax];
|
||||
uint32_t temps[HocClkThermalSensor_EnumMax];
|
||||
int32_t power[HocClkPowerSensor_EnumMax];
|
||||
uint32_t partLoad[HocClkPartLoad_EnumMax];
|
||||
uint32_t voltages[HocClkVoltage_EnumMax];
|
||||
u16 speedos[HorizonOCSpeedo_EnumMax];
|
||||
u16 iddq[HorizonOCSpeedo_EnumMax];
|
||||
u16 speedos[HocClkSpeedo_EnumMax];
|
||||
u16 iddq[HocClkSpeedo_EnumMax];
|
||||
u16 waferX;
|
||||
u16 waferY;
|
||||
|
||||
@@ -58,16 +58,16 @@ typedef struct
|
||||
// FPS / Resolution
|
||||
u8 fps;
|
||||
u16 resolutionHeight;
|
||||
} SysClkContext;
|
||||
} HocClkContext;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
union {
|
||||
uint32_t mhz[+SysClkProfile_EnumMax * +SysClkModule_EnumMax];
|
||||
uint32_t mhzMap[+SysClkProfile_EnumMax][+SysClkModule_EnumMax];
|
||||
uint32_t mhz[+HocClkProfile_EnumMax * +HocClkModule_EnumMax];
|
||||
uint32_t mhzMap[+HocClkProfile_EnumMax][+HocClkModule_EnumMax];
|
||||
};
|
||||
} SysClkTitleProfileList;
|
||||
} HocClkTitleProfileList;
|
||||
|
||||
#define SYSCLK_FREQ_LIST_MAX 32
|
||||
#define HOCCLK_FREQ_LIST_MAX 32
|
||||
|
||||
#define GLOBAL_PROFILE_ID 0xA111111111111111
|
||||
@@ -31,11 +31,11 @@
|
||||
#include <stddef.h>
|
||||
|
||||
typedef enum {
|
||||
SysClkConfigValue_PollingIntervalMs = 0,
|
||||
SysClkConfigValue_TempLogIntervalMs,
|
||||
SysClkConfigValue_FreqLogIntervalMs,
|
||||
SysClkConfigValue_PowerLogIntervalMs,
|
||||
SysClkConfigValue_CsvWriteIntervalMs,
|
||||
HocClkConfigValue_PollingIntervalMs = 0,
|
||||
HocClkConfigValue_TempLogIntervalMs,
|
||||
HocClkConfigValue_FreqLogIntervalMs,
|
||||
HocClkConfigValue_PowerLogIntervalMs,
|
||||
HocClkConfigValue_CsvWriteIntervalMs,
|
||||
|
||||
HocClkConfigValue_UncappedClocks,
|
||||
HocClkConfigValue_OverwriteBoostMode,
|
||||
@@ -51,21 +51,21 @@ typedef enum {
|
||||
|
||||
HocClkConfigValue_LiteTDPLimit,
|
||||
|
||||
HorizonOCConfigValue_BatteryChargeCurrent,
|
||||
HocClkConfigValue_BatteryChargeCurrent,
|
||||
|
||||
HorizonOCConfigValue_OverwriteRefreshRate,
|
||||
HorizonOCConfigValue_MaxDisplayClockH,
|
||||
HocClkConfigValue_OverwriteRefreshRate,
|
||||
HocClkConfigValue_MaxDisplayClockH,
|
||||
|
||||
HorizonOCConfigValue_DVFSMode,
|
||||
HorizonOCConfigValue_DVFSOffset,
|
||||
HorizonOCConfigValue_LiveCpuUv,
|
||||
HorizonOCConfigValue_EnableExperimentalSettings,
|
||||
HocClkConfigValue_DVFSMode,
|
||||
HocClkConfigValue_DVFSOffset,
|
||||
HocClkConfigValue_LiveCpuUv,
|
||||
HocClkConfigValue_EnableExperimentalSettings,
|
||||
|
||||
HorizonOCConfigValue_GPUScheduling,
|
||||
HorizonOCConfigValue_GPUSchedulingMethod,
|
||||
HocClkConfigValue_GPUScheduling,
|
||||
HocClkConfigValue_GPUSchedulingMethod,
|
||||
|
||||
HorizonOCConfigValue_RAMVoltDisplayMode,
|
||||
HorizonOCConfigValue_CpuGovernorMinimumFreq,
|
||||
HocClkConfigValue_RAMVoltDisplayMode,
|
||||
HocClkConfigValue_CpuGovernorMinimumFreq,
|
||||
|
||||
KipConfigValue_custRev,
|
||||
// KipConfigValue_mtcConf,
|
||||
@@ -173,26 +173,26 @@ typedef enum {
|
||||
|
||||
KipCrc32,
|
||||
HocClkConfigValue_IsFirstLoad,
|
||||
SysClkConfigValue_EnumMax,
|
||||
} SysClkConfigValue;
|
||||
HocClkConfigValue_EnumMax,
|
||||
} HocClkConfigValue;
|
||||
|
||||
typedef struct {
|
||||
uint64_t values[SysClkConfigValue_EnumMax];
|
||||
} SysClkConfigValueList;
|
||||
uint64_t values[HocClkConfigValue_EnumMax];
|
||||
} HocClkConfigValueList;
|
||||
|
||||
static inline const char* sysclkFormatConfigValue(SysClkConfigValue val, bool pretty)
|
||||
static inline const char* hocclkFormatConfigValue(HocClkConfigValue val, bool pretty)
|
||||
{
|
||||
switch(val)
|
||||
{
|
||||
case SysClkConfigValue_PollingIntervalMs:
|
||||
case HocClkConfigValue_PollingIntervalMs:
|
||||
return pretty ? "Polling Interval (ms)" : "poll_interval_ms";
|
||||
case SysClkConfigValue_TempLogIntervalMs:
|
||||
case HocClkConfigValue_TempLogIntervalMs:
|
||||
return pretty ? "Temperature logging interval (ms)" : "temp_log_interval_ms";
|
||||
case SysClkConfigValue_FreqLogIntervalMs:
|
||||
case HocClkConfigValue_FreqLogIntervalMs:
|
||||
return pretty ? "Frequency logging interval (ms)" : "freq_log_interval_ms";
|
||||
case SysClkConfigValue_PowerLogIntervalMs:
|
||||
case HocClkConfigValue_PowerLogIntervalMs:
|
||||
return pretty ? "Power logging interval (ms)" : "power_log_interval_ms";
|
||||
case SysClkConfigValue_CsvWriteIntervalMs:
|
||||
case HocClkConfigValue_CsvWriteIntervalMs:
|
||||
return pretty ? "CSV write interval (ms)" : "csv_write_interval_ms";
|
||||
|
||||
case HocClkConfigValue_UncappedClocks:
|
||||
@@ -221,36 +221,36 @@ static inline const char* sysclkFormatConfigValue(SysClkConfigValue val, bool pr
|
||||
case HocClkConfigValue_LiteTDPLimit:
|
||||
return pretty ? "Handheld TDP Limit" : "tdp_limit_l";
|
||||
|
||||
case HorizonOCConfigValue_BatteryChargeCurrent:
|
||||
case HocClkConfigValue_BatteryChargeCurrent:
|
||||
return pretty ? "Battery Charge Current" : "bat_charge_current";
|
||||
|
||||
case HorizonOCConfigValue_OverwriteRefreshRate:
|
||||
case HocClkConfigValue_OverwriteRefreshRate:
|
||||
return pretty ? "Display Refresh Rate Changing" : "drr_changing";
|
||||
|
||||
case HorizonOCConfigValue_MaxDisplayClockH:
|
||||
case HocClkConfigValue_MaxDisplayClockH:
|
||||
return pretty ? "Max Display Clock (Handheld)" : "drr_max_clock";
|
||||
|
||||
case HorizonOCConfigValue_DVFSMode:
|
||||
case HocClkConfigValue_DVFSMode:
|
||||
return pretty ? "DVFS Mode" : "dvfs_mode";
|
||||
|
||||
case HorizonOCConfigValue_DVFSOffset:
|
||||
case HocClkConfigValue_DVFSOffset:
|
||||
return pretty ? "DVFS Offset" : "dvfs_offset";
|
||||
|
||||
case HorizonOCConfigValue_GPUScheduling:
|
||||
case HocClkConfigValue_GPUScheduling:
|
||||
return pretty ? "GPU Scheduling" : "gpu_scheduling";
|
||||
|
||||
case HorizonOCConfigValue_GPUSchedulingMethod:
|
||||
case HocClkConfigValue_GPUSchedulingMethod:
|
||||
return pretty ? "GPU Scheduling Method" : "gpu_sched_method";
|
||||
|
||||
case HorizonOCConfigValue_LiveCpuUv:
|
||||
case HocClkConfigValue_LiveCpuUv:
|
||||
return pretty ? "Live CPU Undervolt" : "live_cpu_uv";
|
||||
|
||||
case HorizonOCConfigValue_EnableExperimentalSettings:
|
||||
case HocClkConfigValue_EnableExperimentalSettings:
|
||||
return pretty ? "Enable Experimental Settings" : "enable_experimental_settings";
|
||||
|
||||
case HorizonOCConfigValue_RAMVoltDisplayMode:
|
||||
case HocClkConfigValue_RAMVoltDisplayMode:
|
||||
return pretty ? "RAM Voltage / Usage Display Mode" : "ram_volt_usage_display_mode";
|
||||
case HorizonOCConfigValue_CpuGovernorMinimumFreq:
|
||||
case HocClkConfigValue_CpuGovernorMinimumFreq:
|
||||
return pretty ? "CPU Governor Minimum Frequency" : "cpu_gov_min_freq";
|
||||
// KIP config values
|
||||
case KipConfigValue_custRev:
|
||||
@@ -414,23 +414,23 @@ static inline const char* sysclkFormatConfigValue(SysClkConfigValue val, bool pr
|
||||
}
|
||||
}
|
||||
|
||||
static inline uint64_t sysclkDefaultConfigValue(SysClkConfigValue val)
|
||||
static inline uint64_t hocclkDefaultConfigValue(HocClkConfigValue val)
|
||||
{
|
||||
switch(val)
|
||||
{
|
||||
case SysClkConfigValue_PollingIntervalMs:
|
||||
case HocClkConfigValue_PollingIntervalMs:
|
||||
return 300ULL;
|
||||
case SysClkConfigValue_TempLogIntervalMs:
|
||||
case SysClkConfigValue_FreqLogIntervalMs:
|
||||
case SysClkConfigValue_PowerLogIntervalMs:
|
||||
case SysClkConfigValue_CsvWriteIntervalMs:
|
||||
case HocClkConfigValue_TempLogIntervalMs:
|
||||
case HocClkConfigValue_FreqLogIntervalMs:
|
||||
case HocClkConfigValue_PowerLogIntervalMs:
|
||||
case HocClkConfigValue_CsvWriteIntervalMs:
|
||||
case HocClkConfigValue_UncappedClocks:
|
||||
case HocClkConfigValue_OverwriteBoostMode:
|
||||
case HorizonOCConfigValue_BatteryChargeCurrent:
|
||||
case HorizonOCConfigValue_OverwriteRefreshRate:
|
||||
case HorizonOCConfigValue_GPUScheduling:
|
||||
case HorizonOCConfigValue_LiveCpuUv:
|
||||
case HorizonOCConfigValue_GPUSchedulingMethod:
|
||||
case HocClkConfigValue_BatteryChargeCurrent:
|
||||
case HocClkConfigValue_OverwriteRefreshRate:
|
||||
case HocClkConfigValue_GPUScheduling:
|
||||
case HocClkConfigValue_LiveCpuUv:
|
||||
case HocClkConfigValue_GPUSchedulingMethod:
|
||||
return 0ULL;
|
||||
case HocClkConfigValue_EristaMaxCpuClock:
|
||||
return 1785ULL;
|
||||
@@ -441,7 +441,7 @@ static inline uint64_t sysclkDefaultConfigValue(SysClkConfigValue val)
|
||||
case HocClkConfigValue_ThermalThrottle:
|
||||
case HocClkConfigValue_HandheldTDP:
|
||||
case HocClkConfigValue_IsFirstLoad:
|
||||
case HorizonOCConfigValue_DVFSMode:
|
||||
case HocClkConfigValue_DVFSMode:
|
||||
return 1ULL;
|
||||
case HocClkConfigValue_ThermalThrottleThreshold:
|
||||
return 70ULL;
|
||||
@@ -449,16 +449,16 @@ static inline uint64_t sysclkDefaultConfigValue(SysClkConfigValue val)
|
||||
return 9600ULL; // 8600mW will trigger on erista stock, so raise it a bit
|
||||
case HocClkConfigValue_LiteTDPLimit:
|
||||
return 6400ULL; // 0.5C
|
||||
case HorizonOCConfigValue_CpuGovernorMinimumFreq:
|
||||
case HocClkConfigValue_CpuGovernorMinimumFreq:
|
||||
return 612000000ULL; // 612MHz
|
||||
case HorizonOCConfigValue_MaxDisplayClockH:
|
||||
case HocClkConfigValue_MaxDisplayClockH:
|
||||
return 60ULL;
|
||||
default:
|
||||
return 0ULL;
|
||||
}
|
||||
}
|
||||
|
||||
static inline uint64_t sysclkValidConfigValue(SysClkConfigValue val, uint64_t input)
|
||||
static inline uint64_t hocclkValidConfigValue(HocClkConfigValue val, uint64_t input)
|
||||
{
|
||||
switch(val)
|
||||
{
|
||||
@@ -467,23 +467,23 @@ static inline uint64_t sysclkValidConfigValue(SysClkConfigValue val, uint64_t in
|
||||
case HocClkConfigValue_ThermalThrottleThreshold:
|
||||
case HocClkConfigValue_HandheldTDPLimit:
|
||||
case HocClkConfigValue_LiteTDPLimit:
|
||||
case SysClkConfigValue_PollingIntervalMs:
|
||||
case HorizonOCConfigValue_MaxDisplayClockH:
|
||||
case HocClkConfigValue_PollingIntervalMs:
|
||||
case HocClkConfigValue_MaxDisplayClockH:
|
||||
return input > 0;
|
||||
|
||||
case SysClkConfigValue_TempLogIntervalMs:
|
||||
case SysClkConfigValue_FreqLogIntervalMs:
|
||||
case SysClkConfigValue_PowerLogIntervalMs:
|
||||
case SysClkConfigValue_CsvWriteIntervalMs:
|
||||
case HocClkConfigValue_TempLogIntervalMs:
|
||||
case HocClkConfigValue_FreqLogIntervalMs:
|
||||
case HocClkConfigValue_PowerLogIntervalMs:
|
||||
case HocClkConfigValue_CsvWriteIntervalMs:
|
||||
case HocClkConfigValue_UncappedClocks:
|
||||
case HocClkConfigValue_OverwriteBoostMode:
|
||||
case HocClkConfigValue_ThermalThrottle:
|
||||
case HocClkConfigValue_HandheldTDP:
|
||||
case HorizonOCConfigValue_OverwriteRefreshRate:
|
||||
case HocClkConfigValue_OverwriteRefreshRate:
|
||||
case HocClkConfigValue_IsFirstLoad:
|
||||
case HorizonOCConfigValue_EnableExperimentalSettings:
|
||||
case HorizonOCConfigValue_LiveCpuUv:
|
||||
case HorizonOCConfigValue_GPUSchedulingMethod:
|
||||
case HocClkConfigValue_EnableExperimentalSettings:
|
||||
case HocClkConfigValue_LiveCpuUv:
|
||||
case HocClkConfigValue_GPUSchedulingMethod:
|
||||
return (input & 0x1) == input;
|
||||
|
||||
case KipConfigValue_custRev:
|
||||
@@ -580,13 +580,13 @@ static inline uint64_t sysclkValidConfigValue(SysClkConfigValue val, uint64_t in
|
||||
case KipConfigValue_t6_tRTW_fine_tune:
|
||||
case KipConfigValue_t7_tWTR_fine_tune:
|
||||
case KipCrc32:
|
||||
case HorizonOCConfigValue_DVFSMode:
|
||||
case HorizonOCConfigValue_DVFSOffset:
|
||||
case HorizonOCConfigValue_GPUScheduling:
|
||||
case HorizonOCConfigValue_RAMVoltDisplayMode:
|
||||
case HorizonOCConfigValue_CpuGovernorMinimumFreq:
|
||||
case HocClkConfigValue_DVFSMode:
|
||||
case HocClkConfigValue_DVFSOffset:
|
||||
case HocClkConfigValue_GPUScheduling:
|
||||
case HocClkConfigValue_RAMVoltDisplayMode:
|
||||
case HocClkConfigValue_CpuGovernorMinimumFreq:
|
||||
return true;
|
||||
case HorizonOCConfigValue_BatteryChargeCurrent:
|
||||
case HocClkConfigValue_BatteryChargeCurrent:
|
||||
return ((input >= 1024) && (input <= 3072)) || !input;
|
||||
default:
|
||||
return false;
|
||||
@@ -27,13 +27,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define SYSCLK_ERROR_MODULE 388
|
||||
#define SYSCLK_ERROR(desc) ((SYSCLK_ERROR_MODULE & 0x1FF) | (SysClkError_##desc & 0x1FFF)<<9)
|
||||
#define HOCCLK_ERROR_MODULE 388
|
||||
#define HOCCLK_ERROR(desc) ((HOCCLK_ERROR_MODULE & 0x1FF) | (HocClkError_##desc & 0x1FFF)<<9)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SysClkError_Generic = 0,
|
||||
SysClkError_ConfigNotLoaded = 1,
|
||||
SysClkError_ConfigSaveFailed = 2,
|
||||
HocClkError_Generic = 0,
|
||||
HocClkError_ConfigNotLoaded = 1,
|
||||
HocClkError_ConfigSaveFailed = 2,
|
||||
// HocClkError_SocThermFail = 3,
|
||||
} SysClkError;
|
||||
} HocClkError;
|
||||
@@ -31,23 +31,23 @@
|
||||
#include "board.h"
|
||||
#include "clock_manager.h"
|
||||
|
||||
#define SYSCLK_IPC_API_VERSION 1
|
||||
#define SYSCLK_IPC_SERVICE_NAME "hoc:clk"
|
||||
#define HOCCLK_IPC_API_VERSION 1
|
||||
#define HOCCLK_IPC_SERVICE_NAME "hoc:clk"
|
||||
|
||||
enum SysClkIpcCmd
|
||||
enum HocClkIpcCmd
|
||||
{
|
||||
SysClkIpcCmd_GetApiVersion = 0,
|
||||
SysClkIpcCmd_GetVersionString = 1,
|
||||
SysClkIpcCmd_GetCurrentContext = 2,
|
||||
SysClkIpcCmd_Exit = 3,
|
||||
SysClkIpcCmd_GetProfileCount = 4,
|
||||
SysClkIpcCmd_GetProfiles = 5,
|
||||
SysClkIpcCmd_SetProfiles = 6,
|
||||
SysClkIpcCmd_SetEnabled = 7,
|
||||
SysClkIpcCmd_SetOverride = 8,
|
||||
SysClkIpcCmd_GetConfigValues = 9,
|
||||
SysClkIpcCmd_SetConfigValues = 10,
|
||||
SysClkIpcCmd_GetFreqList = 11,
|
||||
HocClkIpcCmd_GetApiVersion = 0,
|
||||
HocClkIpcCmd_GetVersionString = 1,
|
||||
HocClkIpcCmd_GetCurrentContext = 2,
|
||||
HocClkIpcCmd_Exit = 3,
|
||||
HocClkIpcCmd_GetProfileCount = 4,
|
||||
HocClkIpcCmd_GetProfiles = 5,
|
||||
HocClkIpcCmd_SetProfiles = 6,
|
||||
HocClkIpcCmd_SetEnabled = 7,
|
||||
HocClkIpcCmd_SetOverride = 8,
|
||||
HocClkIpcCmd_GetConfigValues = 9,
|
||||
HocClkIpcCmd_SetConfigValues = 10,
|
||||
HocClkIpcCmd_GetFreqList = 11,
|
||||
HocClkIpcCmd_SetKipData = 12,
|
||||
HocClkIpcCmd_GetKipData = 13,
|
||||
};
|
||||
@@ -56,17 +56,17 @@ enum SysClkIpcCmd
|
||||
typedef struct
|
||||
{
|
||||
uint64_t tid;
|
||||
SysClkTitleProfileList profiles;
|
||||
} SysClkIpc_SetProfiles_Args;
|
||||
HocClkTitleProfileList profiles;
|
||||
} HocClkIpc_SetProfiles_Args;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SysClkModule module;
|
||||
HocClkModule module;
|
||||
uint32_t hz;
|
||||
} SysClkIpc_SetOverride_Args;
|
||||
} HocClkIpc_SetOverride_Args;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SysClkModule module;
|
||||
HocClkModule module;
|
||||
uint32_t maxCount;
|
||||
} SysClkIpc_GetFreqList_Args;
|
||||
} HocClkIpc_GetFreqList_Args;
|
||||
@@ -25,9 +25,9 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <sysclk/apm.h>
|
||||
#include <hocclk/apm.h>
|
||||
|
||||
SysClkApmConfiguration sysclk_g_apm_configurations[] = {
|
||||
HocClkApmConfiguration hocclk_g_apm_configurations[] = {
|
||||
{0x00010000, 1020000000, 384000000, 1600000000},
|
||||
{0x00010001, 1020000000, 768000000, 1600000000},
|
||||
{0x00010002, 1224000000, 691200000, 1600000000},
|
||||
|
||||
@@ -29,128 +29,128 @@
|
||||
#include <switch.h>
|
||||
#include <string.h>
|
||||
#include <stdatomic.h>
|
||||
#include <sysclk/client/ipc.h>
|
||||
#include <hocclk/client/ipc.h>
|
||||
|
||||
static Service g_sysclkSrv;
|
||||
static Service g_hocclkSrv;
|
||||
static atomic_size_t g_refCnt;
|
||||
|
||||
bool sysclkIpcRunning()
|
||||
bool hocclkIpcRunning()
|
||||
{
|
||||
Handle handle;
|
||||
bool running = R_FAILED(smRegisterService(&handle, smEncodeName(SYSCLK_IPC_SERVICE_NAME), false, 1));
|
||||
bool running = R_FAILED(smRegisterService(&handle, smEncodeName(HOCCLK_IPC_SERVICE_NAME), false, 1));
|
||||
|
||||
if (!running)
|
||||
{
|
||||
smUnregisterService(smEncodeName(SYSCLK_IPC_SERVICE_NAME));
|
||||
smUnregisterService(smEncodeName(HOCCLK_IPC_SERVICE_NAME));
|
||||
}
|
||||
|
||||
return running;
|
||||
}
|
||||
|
||||
Result sysclkIpcInitialize(void)
|
||||
Result hocclkIpcInitialize(void)
|
||||
{
|
||||
Result rc = 0;
|
||||
|
||||
g_refCnt++;
|
||||
|
||||
if (serviceIsActive(&g_sysclkSrv))
|
||||
if (serviceIsActive(&g_hocclkSrv))
|
||||
return 0;
|
||||
|
||||
rc = smGetService(&g_sysclkSrv, SYSCLK_IPC_SERVICE_NAME);
|
||||
rc = smGetService(&g_hocclkSrv, HOCCLK_IPC_SERVICE_NAME);
|
||||
|
||||
if (R_FAILED(rc)) sysclkIpcExit();
|
||||
if (R_FAILED(rc)) hocclkIpcExit();
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
void sysclkIpcExit(void)
|
||||
void hocclkIpcExit(void)
|
||||
{
|
||||
if (--g_refCnt == 0)
|
||||
{
|
||||
serviceClose(&g_sysclkSrv);
|
||||
serviceClose(&g_hocclkSrv);
|
||||
}
|
||||
}
|
||||
|
||||
Result sysclkIpcGetAPIVersion(u32* out_ver)
|
||||
Result hocclkIpcGetAPIVersion(u32* out_ver)
|
||||
{
|
||||
return serviceDispatchOut(&g_sysclkSrv, SysClkIpcCmd_GetApiVersion, *out_ver);
|
||||
return serviceDispatchOut(&g_hocclkSrv, HocClkIpcCmd_GetApiVersion, *out_ver);
|
||||
}
|
||||
|
||||
Result sysclkIpcGetVersionString(char* out, size_t len)
|
||||
Result hocclkIpcGetVersionString(char* out, size_t len)
|
||||
{
|
||||
return serviceDispatch(&g_sysclkSrv, SysClkIpcCmd_GetVersionString,
|
||||
return serviceDispatch(&g_hocclkSrv, HocClkIpcCmd_GetVersionString,
|
||||
.buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_Out },
|
||||
.buffers = {{out, len}},
|
||||
);
|
||||
}
|
||||
|
||||
Result sysclkIpcGetCurrentContext(SysClkContext* out_context)
|
||||
Result hocclkIpcGetCurrentContext(HocClkContext* out_context)
|
||||
{
|
||||
return serviceDispatch(&g_sysclkSrv, SysClkIpcCmd_GetCurrentContext,
|
||||
return serviceDispatch(&g_hocclkSrv, HocClkIpcCmd_GetCurrentContext,
|
||||
.buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_Out },
|
||||
.buffers = {{out_context, sizeof(SysClkContext)}},
|
||||
.buffers = {{out_context, sizeof(HocClkContext)}},
|
||||
);
|
||||
}
|
||||
|
||||
Result sysclkIpcGetProfileCount(u64 tid, u8* out_count)
|
||||
Result hocclkIpcGetProfileCount(u64 tid, u8* out_count)
|
||||
{
|
||||
return serviceDispatchInOut(&g_sysclkSrv, SysClkIpcCmd_GetProfileCount, tid, *out_count);
|
||||
return serviceDispatchInOut(&g_hocclkSrv, HocClkIpcCmd_GetProfileCount, tid, *out_count);
|
||||
}
|
||||
|
||||
Result sysclkIpcSetEnabled(bool enabled)
|
||||
Result hocclkIpcSetEnabled(bool enabled)
|
||||
{
|
||||
u8 enabledRaw = (u8)enabled;
|
||||
return serviceDispatchIn(&g_sysclkSrv, SysClkIpcCmd_SetEnabled, enabledRaw);
|
||||
return serviceDispatchIn(&g_hocclkSrv, HocClkIpcCmd_SetEnabled, enabledRaw);
|
||||
}
|
||||
|
||||
Result sysclkIpcSetOverride(SysClkModule module, u32 hz)
|
||||
Result hocclkIpcSetOverride(HocClkModule module, u32 hz)
|
||||
{
|
||||
SysClkIpc_SetOverride_Args args = {
|
||||
HocClkIpc_SetOverride_Args args = {
|
||||
.module = module,
|
||||
.hz = hz
|
||||
};
|
||||
return serviceDispatchIn(&g_sysclkSrv, SysClkIpcCmd_SetOverride, args);
|
||||
return serviceDispatchIn(&g_hocclkSrv, HocClkIpcCmd_SetOverride, args);
|
||||
}
|
||||
|
||||
Result sysclkIpcGetProfiles(u64 tid, SysClkTitleProfileList* out_profiles)
|
||||
Result hocclkIpcGetProfiles(u64 tid, HocClkTitleProfileList* out_profiles)
|
||||
{
|
||||
return serviceDispatchIn(&g_sysclkSrv, SysClkIpcCmd_GetProfiles, tid,
|
||||
return serviceDispatchIn(&g_hocclkSrv, HocClkIpcCmd_GetProfiles, tid,
|
||||
.buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_Out },
|
||||
.buffers = {{out_profiles, sizeof(SysClkTitleProfileList)}},
|
||||
.buffers = {{out_profiles, sizeof(HocClkTitleProfileList)}},
|
||||
);
|
||||
}
|
||||
|
||||
Result sysclkIpcSetProfiles(u64 tid, SysClkTitleProfileList* profiles)
|
||||
Result hocclkIpcSetProfiles(u64 tid, HocClkTitleProfileList* profiles)
|
||||
{
|
||||
SysClkIpc_SetProfiles_Args args;
|
||||
HocClkIpc_SetProfiles_Args args;
|
||||
args.tid = tid;
|
||||
memcpy(&args.profiles, profiles, sizeof(SysClkTitleProfileList));
|
||||
return serviceDispatchIn(&g_sysclkSrv, SysClkIpcCmd_SetProfiles, args);
|
||||
memcpy(&args.profiles, profiles, sizeof(HocClkTitleProfileList));
|
||||
return serviceDispatchIn(&g_hocclkSrv, HocClkIpcCmd_SetProfiles, args);
|
||||
}
|
||||
|
||||
Result sysclkIpcGetConfigValues(SysClkConfigValueList* out_configValues)
|
||||
Result hocclkIpcGetConfigValues(HocClkConfigValueList* out_configValues)
|
||||
{
|
||||
return serviceDispatch(&g_sysclkSrv, SysClkIpcCmd_GetConfigValues,
|
||||
return serviceDispatch(&g_hocclkSrv, HocClkIpcCmd_GetConfigValues,
|
||||
.buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_Out },
|
||||
.buffers = {{out_configValues, sizeof(SysClkConfigValueList)}},
|
||||
.buffers = {{out_configValues, sizeof(HocClkConfigValueList)}},
|
||||
);
|
||||
}
|
||||
|
||||
Result sysclkIpcSetConfigValues(SysClkConfigValueList* configValues)
|
||||
Result hocclkIpcSetConfigValues(HocClkConfigValueList* configValues)
|
||||
{
|
||||
return serviceDispatch(&g_sysclkSrv, SysClkIpcCmd_SetConfigValues,
|
||||
return serviceDispatch(&g_hocclkSrv, HocClkIpcCmd_SetConfigValues,
|
||||
.buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_In },
|
||||
.buffers = {{configValues, sizeof(SysClkConfigValueList)}},
|
||||
.buffers = {{configValues, sizeof(HocClkConfigValueList)}},
|
||||
);
|
||||
}
|
||||
|
||||
Result sysclkIpcGetFreqList(SysClkModule module, u32* list, u32 maxCount, u32* outCount)
|
||||
Result hocclkIpcGetFreqList(HocClkModule module, u32* list, u32 maxCount, u32* outCount)
|
||||
{
|
||||
SysClkIpc_GetFreqList_Args args = {
|
||||
HocClkIpc_GetFreqList_Args args = {
|
||||
.module = module,
|
||||
.maxCount = maxCount
|
||||
};
|
||||
return serviceDispatchInOut(&g_sysclkSrv, SysClkIpcCmd_GetFreqList, args, *outCount,
|
||||
return serviceDispatchInOut(&g_hocclkSrv, HocClkIpcCmd_GetFreqList, args, *outCount,
|
||||
.buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_Out },
|
||||
.buffers = {{list, maxCount * sizeof(u32)}},
|
||||
);
|
||||
@@ -159,11 +159,11 @@ Result sysclkIpcGetFreqList(SysClkModule module, u32* list, u32 maxCount, u32* o
|
||||
Result hocClkIpcSetKipData()
|
||||
{
|
||||
u32 temp = 0;
|
||||
return serviceDispatchIn(&g_sysclkSrv, HocClkIpcCmd_SetKipData, temp);
|
||||
return serviceDispatchIn(&g_hocclkSrv, HocClkIpcCmd_SetKipData, temp);
|
||||
}
|
||||
|
||||
Result hocClkIpcGetKipData()
|
||||
{
|
||||
u32 temp = 0;
|
||||
return serviceDispatchIn(&g_sysclkSrv, HocClkIpcCmd_GetKipData, temp);
|
||||
return serviceDispatchIn(&g_hocclkSrv, HocClkIpcCmd_GetKipData, temp);
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sysclk/psm_ext.h>
|
||||
#include <hocclk/psm_ext.h>
|
||||
|
||||
const char* PsmPowerRoleToStr(PsmPowerRole role) {
|
||||
switch (role) {
|
||||
|
||||
@@ -34,8 +34,8 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <sysclk.h>
|
||||
#include <sysclk/client/ipc.h>
|
||||
#include <hocclk.h>
|
||||
#include <hocclk/client/ipc.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class AppOverlay : public tsl::Overlay
|
||||
|
||||
virtual void exitServices() override {
|
||||
rgltrExit();
|
||||
sysclkIpcExit();
|
||||
hocclkIpcExit();
|
||||
}
|
||||
|
||||
virtual std::unique_ptr<tsl::Gui> loadInitialGui() override
|
||||
@@ -53,7 +53,7 @@ class AppOverlay : public tsl::Overlay
|
||||
|
||||
tsl::hlp::ScopeGuard smGuard([] { smExit(); });
|
||||
|
||||
if(!sysclkIpcRunning())
|
||||
if(!hocclkIpcRunning())
|
||||
{
|
||||
return initially<FatalGui>(
|
||||
"hoc-clk is not running.\n\n"
|
||||
@@ -64,7 +64,7 @@ class AppOverlay : public tsl::Overlay
|
||||
);
|
||||
}
|
||||
|
||||
if(R_FAILED(sysclkIpcInitialize()) || R_FAILED(sysclkIpcGetAPIVersion(&apiVersion)))
|
||||
if(R_FAILED(hocclkIpcInitialize()) || R_FAILED(hocclkIpcGetAPIVersion(&apiVersion)))
|
||||
{
|
||||
return initially<FatalGui>(
|
||||
"Could not connect to hoc-clk.\n\n"
|
||||
@@ -75,7 +75,7 @@ class AppOverlay : public tsl::Overlay
|
||||
);
|
||||
}
|
||||
|
||||
if(SYSCLK_IPC_API_VERSION != apiVersion)
|
||||
if(HOCCLK_IPC_API_VERSION != apiVersion)
|
||||
{
|
||||
return initially<FatalGui>(
|
||||
"Overlay not compatible with\n\n"
|
||||
|
||||
@@ -302,9 +302,9 @@ void AboutGui::refresh()
|
||||
if (!this->context)
|
||||
return;
|
||||
// Format strings once per refresh
|
||||
sprintf(strings[0], "%u/%u/%u", this->context->speedos[HorizonOCSpeedo_CPU], this->context->speedos[HorizonOCSpeedo_GPU], this->context->speedos[HorizonOCSpeedo_SOC]);
|
||||
sprintf(strings[0], "%u/%u/%u", this->context->speedos[HocClkSpeedo_CPU], this->context->speedos[HocClkSpeedo_GPU], this->context->speedos[HocClkSpeedo_SOC]);
|
||||
// This is how hekate does it
|
||||
sprintf(strings[1], "%u/%u/%u", this->context->iddq[HorizonOCSpeedo_CPU], this->context->iddq[HorizonOCSpeedo_GPU], this->context->iddq[HorizonOCSpeedo_SOC]);
|
||||
sprintf(strings[1], "%u/%u/%u", this->context->iddq[HocClkSpeedo_CPU], this->context->iddq[HocClkSpeedo_GPU], this->context->iddq[HocClkSpeedo_SOC]);
|
||||
SpeedoItem->setValue(strings[0]);
|
||||
IddqItem->setValue(strings[1]);
|
||||
DramModule->setValue(formatRamModule());
|
||||
@@ -320,7 +320,7 @@ void AboutGui::refresh()
|
||||
waferCordsItem->setValue(strings[2]);
|
||||
|
||||
if(IsErista()) {
|
||||
u32 millis = context->temps[HorizonOCThermalSensor_PLLX];
|
||||
u32 millis = context->temps[HocClkThermalSensor_PLLX];
|
||||
sprintf(strings[3], "%u.%u", millis / 1000U, (millis % 1000U) / 100U);
|
||||
eristaPLLXItem->setValue(strings[3]);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "../format.h"
|
||||
#include "fatal_gui.h"
|
||||
#include "labels.h"
|
||||
AppProfileGui::AppProfileGui(std::uint64_t applicationId, SysClkTitleProfileList* profileList)
|
||||
AppProfileGui::AppProfileGui(std::uint64_t applicationId, HocClkTitleProfileList* profileList)
|
||||
{
|
||||
this->applicationId = applicationId;
|
||||
this->profileList = profileList;
|
||||
@@ -41,31 +41,31 @@ AppProfileGui::~AppProfileGui()
|
||||
delete this->profileList;
|
||||
}
|
||||
|
||||
void AppProfileGui::openFreqChoiceGui(tsl::elm::ListItem* listItem, SysClkProfile profile, SysClkModule module)
|
||||
void AppProfileGui::openFreqChoiceGui(tsl::elm::ListItem* listItem, HocClkProfile profile, HocClkModule module)
|
||||
{
|
||||
std::uint32_t hzList[SYSCLK_FREQ_LIST_MAX];
|
||||
std::uint32_t hzList[HOCCLK_FREQ_LIST_MAX];
|
||||
std::uint32_t hzCount;
|
||||
Result rc = sysclkIpcGetFreqList(module, &hzList[0], SYSCLK_FREQ_LIST_MAX, &hzCount);
|
||||
Result rc = hocclkIpcGetFreqList(module, &hzList[0], HOCCLK_FREQ_LIST_MAX, &hzCount);
|
||||
if(R_FAILED(rc))
|
||||
{
|
||||
FatalGui::openWithResultCode("sysclkIpcGetFreqList", rc);
|
||||
FatalGui::openWithResultCode("hocclkIpcGetFreqList", rc);
|
||||
return;
|
||||
}
|
||||
std::map<uint32_t, std::string> labels = {};
|
||||
|
||||
if (module == SysClkModule_CPU) {
|
||||
if (module == HocClkModule_CPU) {
|
||||
bool isUsingUv = IsMariko() ? configList.values[KipConfigValue_marikoCpuUVHigh] : configList.values[KipConfigValue_eristaCpuUV];
|
||||
labels = IsMariko() ? (isUsingUv ? cpu_freq_label_m_uv : cpu_freq_label_m) : (isUsingUv ? cpu_freq_label_e_uv : cpu_freq_label_e);
|
||||
} else if (module == SysClkModule_GPU) {
|
||||
} else if (module == HocClkModule_GPU) {
|
||||
labels = IsMariko() ? *(marikoUV[configList.values[KipConfigValue_marikoGpuUV]]) : *(eristaUV[configList.values[KipConfigValue_eristaGpuUV]]);
|
||||
}
|
||||
tsl::changeTo<FreqChoiceGui>(this->profileList->mhzMap[profile][module] * 1000000, hzList, hzCount, module, [this, listItem, profile, module](std::uint32_t hz) {
|
||||
this->profileList->mhzMap[profile][module] = hz / 1000000;
|
||||
listItem->setValue(formatListFreqMHz(this->profileList->mhzMap[profile][module]));
|
||||
Result rc = sysclkIpcSetProfiles(this->applicationId, this->profileList);
|
||||
Result rc = hocclkIpcSetProfiles(this->applicationId, this->profileList);
|
||||
if(R_FAILED(rc))
|
||||
{
|
||||
FatalGui::openWithResultCode("sysclkIpcSetProfiles", rc);
|
||||
FatalGui::openWithResultCode("hocclkIpcSetProfiles", rc);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -101,9 +101,9 @@ void AppProfileGui::openValueChoiceGui(
|
||||
);
|
||||
}
|
||||
|
||||
void AppProfileGui::addModuleListItem(SysClkProfile profile, SysClkModule module)
|
||||
void AppProfileGui::addModuleListItem(HocClkProfile profile, HocClkModule module)
|
||||
{
|
||||
tsl::elm::ListItem* listItem = new tsl::elm::ListItem(sysclkFormatModule(module, true));
|
||||
tsl::elm::ListItem* listItem = new tsl::elm::ListItem(hocclkFormatModule(module, true));
|
||||
listItem->setValue(formatListFreqMHz(this->profileList->mhzMap[profile][module]));
|
||||
listItem->setClickListener([this, listItem, profile, module](u64 keys) {
|
||||
if((keys & HidNpadButton_A) == HidNpadButton_A)
|
||||
@@ -117,10 +117,10 @@ void AppProfileGui::addModuleListItem(SysClkProfile profile, SysClkModule module
|
||||
this->profileList->mhzMap[profile][module] = 0;
|
||||
listItem->setValue(formatListFreqMHz(0));
|
||||
|
||||
Result rc = sysclkIpcSetProfiles(this->applicationId, this->profileList);
|
||||
Result rc = hocclkIpcSetProfiles(this->applicationId, this->profileList);
|
||||
if(R_FAILED(rc))
|
||||
{
|
||||
FatalGui::openWithResultCode("sysclkIpcSetProfiles", rc);
|
||||
FatalGui::openWithResultCode("hocclkIpcSetProfiles", rc);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -130,9 +130,9 @@ void AppProfileGui::addModuleListItem(SysClkProfile profile, SysClkModule module
|
||||
this->listElement->addItem(listItem);
|
||||
}
|
||||
|
||||
void AppProfileGui::addModuleListItemToggle(SysClkProfile profile, SysClkModule module)
|
||||
void AppProfileGui::addModuleListItemToggle(HocClkProfile profile, HocClkModule module)
|
||||
{
|
||||
const char* moduleName = sysclkFormatModule(module, true);
|
||||
const char* moduleName = hocclkFormatModule(module, true);
|
||||
std::uint32_t currentValue = this->profileList->mhzMap[profile][module];
|
||||
|
||||
tsl::elm::ToggleListItem* toggle = new tsl::elm::ToggleListItem(moduleName, currentValue != 0);
|
||||
@@ -140,10 +140,10 @@ void AppProfileGui::addModuleListItemToggle(SysClkProfile profile, SysClkModule
|
||||
toggle->setStateChangedListener([this, profile, module](bool state) {
|
||||
this->profileList->mhzMap[profile][module] = state ? 1 : 0;
|
||||
|
||||
Result rc = sysclkIpcSetProfiles(this->applicationId, this->profileList);
|
||||
Result rc = hocclkIpcSetProfiles(this->applicationId, this->profileList);
|
||||
if(R_FAILED(rc))
|
||||
{
|
||||
FatalGui::openWithResultCode("sysclkIpcSetProfiles", rc);
|
||||
FatalGui::openWithResultCode("hocclkIpcSetProfiles", rc);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -181,8 +181,8 @@ std::string AppProfileGui::formatValueDisplay(
|
||||
}
|
||||
|
||||
void AppProfileGui::addModuleListItemValue(
|
||||
SysClkProfile profile,
|
||||
SysClkModule module,
|
||||
HocClkProfile profile,
|
||||
HocClkModule module,
|
||||
const std::string& categoryName,
|
||||
std::uint32_t min,
|
||||
std::uint32_t max,
|
||||
@@ -196,7 +196,7 @@ void AppProfileGui::addModuleListItemValue(
|
||||
)
|
||||
{
|
||||
tsl::elm::ListItem* listItem =
|
||||
new tsl::elm::ListItem(sysclkFormatModule(module, true));
|
||||
new tsl::elm::ListItem(hocclkFormatModule(module, true));
|
||||
std::uint32_t storedValue = this->profileList->mhzMap[profile][module];
|
||||
|
||||
listItem->setValue(this->formatValueDisplay(storedValue, namedValues, suffix, divisor, decimalPlaces));
|
||||
@@ -240,12 +240,12 @@ void AppProfileGui::addModuleListItemValue(
|
||||
listItem->setValue(this->formatValueDisplay(value / divisor, namedValues, suffix, divisor, decimalPlaces));
|
||||
|
||||
Result rc =
|
||||
sysclkIpcSetProfiles(this->applicationId,
|
||||
hocclkIpcSetProfiles(this->applicationId,
|
||||
this->profileList);
|
||||
if (R_FAILED(rc))
|
||||
{
|
||||
FatalGui::openWithResultCode(
|
||||
"sysclkIpcSetProfiles", rc);
|
||||
"hocclkIpcSetProfiles", rc);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -263,11 +263,11 @@ void AppProfileGui::addModuleListItemValue(
|
||||
this->profileList->mhzMap[profile][module] = 0;
|
||||
listItem->setValue(FREQ_DEFAULT_TEXT);
|
||||
Result rc =
|
||||
sysclkIpcSetProfiles(this->applicationId,
|
||||
hocclkIpcSetProfiles(this->applicationId,
|
||||
this->profileList);
|
||||
if (R_FAILED(rc))
|
||||
{
|
||||
FatalGui::openWithResultCode("sysclkIpcSetProfiles", rc);
|
||||
FatalGui::openWithResultCode("hocclkIpcSetProfiles", rc);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -279,16 +279,16 @@ void AppProfileGui::addModuleListItemValue(
|
||||
|
||||
class GovernorProfileSubMenuGui : public BaseMenuGui {
|
||||
uint64_t applicationId;
|
||||
SysClkTitleProfileList* profileList;
|
||||
SysClkProfile profile;
|
||||
HocClkTitleProfileList* profileList;
|
||||
HocClkProfile profile;
|
||||
public:
|
||||
GovernorProfileSubMenuGui(uint64_t appId, SysClkTitleProfileList* pList, SysClkProfile prof)
|
||||
GovernorProfileSubMenuGui(uint64_t appId, HocClkTitleProfileList* pList, HocClkProfile prof)
|
||||
: applicationId(appId), profileList(pList), profile(prof) {}
|
||||
|
||||
void listUI() override {
|
||||
Result rc = sysclkIpcGetConfigValues(&configList);
|
||||
Result rc = hocclkIpcGetConfigValues(&configList);
|
||||
if (R_FAILED(rc)) [[unlikely]] {
|
||||
FatalGui::openWithResultCode("sysclkIpcGetConfigValues", rc);
|
||||
FatalGui::openWithResultCode("hocclkIpcGetConfigValues", rc);
|
||||
return;
|
||||
}
|
||||
this->listElement->addItem(new tsl::elm::CategoryHeader("Governor"));
|
||||
@@ -296,10 +296,10 @@ public:
|
||||
static constexpr struct { const char* label; int shift; } kAll[] = {
|
||||
{"CPU", 0}, {"GPU", 8}, {"VRR", 16}
|
||||
};
|
||||
int count = configList.values[HorizonOCConfigValue_OverwriteRefreshRate] ? 3 : 2;
|
||||
int count = configList.values[HocClkConfigValue_OverwriteRefreshRate] ? 3 : 2;
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
u8 cur = (this->profileList->mhzMap[this->profile][HorizonOCModule_Governor] >> kAll[i].shift) & 0xFF;
|
||||
u8 cur = (this->profileList->mhzMap[this->profile][HocClkModule_Governor] >> kAll[i].shift) & 0xFF;
|
||||
auto* bar = new tsl::elm::NamedStepTrackBar(
|
||||
"", {"Do Not Override", "Disabled", "Enabled"},
|
||||
true, kAll[i].label
|
||||
@@ -307,17 +307,17 @@ public:
|
||||
bar->setProgress(cur);
|
||||
int shift = kAll[i].shift;
|
||||
bar->setValueChangedListener([this, shift](u8 value) {
|
||||
u32& packed = this->profileList->mhzMap[this->profile][HorizonOCModule_Governor];
|
||||
u32& packed = this->profileList->mhzMap[this->profile][HocClkModule_Governor];
|
||||
packed = (packed & ~(0xFFu << shift)) | ((u32)value << shift);
|
||||
Result rc = sysclkIpcSetProfiles(this->applicationId, this->profileList);
|
||||
if (R_FAILED(rc)) FatalGui::openWithResultCode("sysclkIpcSetProfiles", rc);
|
||||
Result rc = hocclkIpcSetProfiles(this->applicationId, this->profileList);
|
||||
if (R_FAILED(rc)) FatalGui::openWithResultCode("hocclkIpcSetProfiles", rc);
|
||||
});
|
||||
this->listElement->addItem(bar);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void AppProfileGui::addGovernorSection(SysClkProfile profile) {
|
||||
void AppProfileGui::addGovernorSection(HocClkProfile profile) {
|
||||
auto* item = new tsl::elm::ListItem("Governor");
|
||||
item->setValue("\u2192"); // Right arrow
|
||||
item->setClickListener([this, profile](u64 keys) {
|
||||
@@ -332,29 +332,29 @@ void AppProfileGui::addGovernorSection(SysClkProfile profile) {
|
||||
this->listElement->addItem(item);
|
||||
}
|
||||
|
||||
void AppProfileGui::addProfileUI(SysClkProfile profile)
|
||||
void AppProfileGui::addProfileUI(HocClkProfile profile)
|
||||
{
|
||||
BaseMenuGui::refresh();
|
||||
if(!this->context)
|
||||
return;
|
||||
Result rc = sysclkIpcGetConfigValues(&configList);
|
||||
Result rc = hocclkIpcGetConfigValues(&configList);
|
||||
if (R_FAILED(rc)) [[unlikely]] {
|
||||
FatalGui::openWithResultCode("sysclkIpcGetConfigValues", rc);
|
||||
FatalGui::openWithResultCode("hocclkIpcGetConfigValues", rc);
|
||||
return;
|
||||
}
|
||||
if((profile == SysClkProfile_Docked && IsHoag()) || profile == SysClkProfile_HandheldCharging)
|
||||
if((profile == HocClkProfile_Docked && IsHoag()) || profile == HocClkProfile_HandheldCharging)
|
||||
return;
|
||||
this->listElement->addItem(new tsl::elm::CategoryHeader(sysclkFormatProfile(profile, true) + std::string(" ") + ult::DIVIDER_SYMBOL + " \ue0e3 Reset"));
|
||||
this->addModuleListItem(profile, SysClkModule_CPU);
|
||||
this->addModuleListItem(profile, SysClkModule_GPU);
|
||||
this->addModuleListItem(profile, SysClkModule_MEM);
|
||||
this->listElement->addItem(new tsl::elm::CategoryHeader(hocclkFormatProfile(profile, true) + std::string(" ") + ult::DIVIDER_SYMBOL + " \ue0e3 Reset"));
|
||||
this->addModuleListItem(profile, HocClkModule_CPU);
|
||||
this->addModuleListItem(profile, HocClkModule_GPU);
|
||||
this->addModuleListItem(profile, HocClkModule_MEM);
|
||||
#if IS_MINIMAL == 0
|
||||
ValueThresholds lcdThresholds(60, 65);
|
||||
ValueThresholds DThresholdsOLED(120, 500); // nothing is dangerous, past 120hz you can get applet crashes
|
||||
|
||||
if(configList.values[HorizonOCConfigValue_OverwriteRefreshRate]) {
|
||||
if(profile != SysClkProfile_Docked) {
|
||||
this->addModuleListItemValue(profile, HorizonOCModule_Display, "Display", IsAula() ? 45 : 40, configList.values[HorizonOCConfigValue_MaxDisplayClockH], this->context->isUsingRetroSuper ? 5 : 1, " Hz", 1, 0, lcdThresholds);
|
||||
if(configList.values[HocClkConfigValue_OverwriteRefreshRate]) {
|
||||
if(profile != HocClkProfile_Docked) {
|
||||
this->addModuleListItemValue(profile, HocClkModule_Display, "Display", IsAula() ? 45 : 40, configList.values[HocClkConfigValue_MaxDisplayClockH], this->context->isUsingRetroSuper ? 5 : 1, " Hz", 1, 0, lcdThresholds);
|
||||
} else {
|
||||
if(IsAula() && this->context->isSysDockInstalled) {
|
||||
std::vector<NamedValue> dockedFreqs = {
|
||||
@@ -388,7 +388,7 @@ void AppProfileGui::addProfileUI(SysClkProfile profile)
|
||||
NamedValue("240 Hz", 240)
|
||||
};
|
||||
|
||||
this->addModuleListItemValue(profile, HorizonOCModule_Display, "Display", 40, 240, 1, " Hz", 1, 0, DThresholdsOLED, dockedFreqs);
|
||||
this->addModuleListItemValue(profile, HocClkModule_Display, "Display", 40, 240, 1, " Hz", 1, 0, DThresholdsOLED, dockedFreqs);
|
||||
} else if (IsAula() && !this->context->isSysDockInstalled) {
|
||||
std::vector<NamedValue> dockedFreqsLimited = {
|
||||
NamedValue("50 Hz", 50),
|
||||
@@ -400,7 +400,7 @@ void AppProfileGui::addProfileUI(SysClkProfile profile)
|
||||
NamedValue("75 Hz", 75)
|
||||
};
|
||||
|
||||
this->addModuleListItemValue(profile, HorizonOCModule_Display, "Display", 50, 75, 1, " Hz", 1, 0, DThresholdsOLED, dockedFreqsLimited);
|
||||
this->addModuleListItemValue(profile, HocClkModule_Display, "Display", 50, 75, 1, " Hz", 1, 0, DThresholdsOLED, dockedFreqsLimited);
|
||||
} else {
|
||||
std::vector<NamedValue> dockedFreqsStandard = {
|
||||
NamedValue("50 Hz", 50),
|
||||
@@ -420,7 +420,7 @@ void AppProfileGui::addProfileUI(SysClkProfile profile)
|
||||
NamedValue("115 Hz", 115),
|
||||
NamedValue("120 Hz", 120)
|
||||
};
|
||||
this->addModuleListItemValue(profile, HorizonOCModule_Display, "Display", 50, 120, 1, " Hz", 1, 0, ValueThresholds(), dockedFreqsStandard);
|
||||
this->addModuleListItemValue(profile, HocClkModule_Display, "Display", 50, 120, 1, " Hz", 1, 0, ValueThresholds(), dockedFreqsStandard);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -430,21 +430,21 @@ void AppProfileGui::addProfileUI(SysClkProfile profile)
|
||||
|
||||
void AppProfileGui::listUI()
|
||||
{
|
||||
this->addProfileUI(SysClkProfile_Docked);
|
||||
this->addProfileUI(SysClkProfile_Handheld);
|
||||
this->addProfileUI(SysClkProfile_HandheldCharging);
|
||||
this->addProfileUI(SysClkProfile_HandheldChargingOfficial);
|
||||
this->addProfileUI(SysClkProfile_HandheldChargingUSB);
|
||||
this->addProfileUI(HocClkProfile_Docked);
|
||||
this->addProfileUI(HocClkProfile_Handheld);
|
||||
this->addProfileUI(HocClkProfile_HandheldCharging);
|
||||
this->addProfileUI(HocClkProfile_HandheldChargingOfficial);
|
||||
this->addProfileUI(HocClkProfile_HandheldChargingUSB);
|
||||
}
|
||||
|
||||
void AppProfileGui::changeTo(std::uint64_t applicationId)
|
||||
{
|
||||
SysClkTitleProfileList* profileList = new SysClkTitleProfileList;
|
||||
Result rc = sysclkIpcGetProfiles(applicationId, profileList);
|
||||
HocClkTitleProfileList* profileList = new HocClkTitleProfileList;
|
||||
Result rc = hocclkIpcGetProfiles(applicationId, profileList);
|
||||
if(R_FAILED(rc))
|
||||
{
|
||||
delete profileList;
|
||||
FatalGui::openWithResultCode("sysclkIpcGetProfiles", rc);
|
||||
FatalGui::openWithResultCode("hocclkIpcGetProfiles", rc);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -455,7 +455,7 @@ void AppProfileGui::update()
|
||||
{
|
||||
BaseMenuGui::update();
|
||||
|
||||
if((this->context && this->applicationId != this->context->applicationId) && this->applicationId != SYSCLK_GLOBAL_PROFILE_TID)
|
||||
if((this->context && this->applicationId != this->context->applicationId) && this->applicationId != HOCCLK_GLOBAL_PROFILE_TID)
|
||||
{
|
||||
tsl::changeTo<FatalGui>(
|
||||
"Application changed\n\n"
|
||||
|
||||
@@ -28,15 +28,15 @@
|
||||
#include "base_menu_gui.h"
|
||||
#include "freq_choice_gui.h"
|
||||
#include "value_choice_gui.h"
|
||||
#define SYSCLK_GLOBAL_PROFILE_TID 0xA111111111111111
|
||||
#define HOCCLK_GLOBAL_PROFILE_TID 0xA111111111111111
|
||||
class AppProfileGui : public BaseMenuGui
|
||||
{
|
||||
protected:
|
||||
std::uint64_t applicationId;
|
||||
SysClkTitleProfileList* profileList;
|
||||
void openFreqChoiceGui(tsl::elm::ListItem* listItem, SysClkProfile profile, SysClkModule module);
|
||||
void addModuleListItem(SysClkProfile profile, SysClkModule module);
|
||||
void addModuleListItemToggle(SysClkProfile profile, SysClkModule module);
|
||||
HocClkTitleProfileList* profileList;
|
||||
void openFreqChoiceGui(tsl::elm::ListItem* listItem, HocClkProfile profile, HocClkModule module);
|
||||
void addModuleListItem(HocClkProfile profile, HocClkModule module);
|
||||
void addModuleListItemToggle(HocClkProfile profile, HocClkModule module);
|
||||
void openValueChoiceGui(
|
||||
tsl::elm::ListItem* listItem,
|
||||
std::uint32_t currentValue,
|
||||
@@ -57,8 +57,8 @@ class AppProfileGui : public BaseMenuGui
|
||||
int decimalPlaces
|
||||
);
|
||||
void addModuleListItemValue(
|
||||
SysClkProfile profile,
|
||||
SysClkModule module,
|
||||
HocClkProfile profile,
|
||||
HocClkModule module,
|
||||
const std::string& categoryName,
|
||||
std::uint32_t min,
|
||||
std::uint32_t max,
|
||||
@@ -70,10 +70,10 @@ class AppProfileGui : public BaseMenuGui
|
||||
std::vector<NamedValue> namedValues = {},
|
||||
bool showDefaultValue = true
|
||||
);
|
||||
void addGovernorSection(SysClkProfile profile);
|
||||
void addProfileUI(SysClkProfile profile);
|
||||
void addGovernorSection(HocClkProfile profile);
|
||||
void addProfileUI(HocClkProfile profile);
|
||||
public:
|
||||
AppProfileGui(std::uint64_t applicationId, SysClkTitleProfileList* profileList);
|
||||
AppProfileGui(std::uint64_t applicationId, HocClkTitleProfileList* profileList);
|
||||
~AppProfileGui();
|
||||
void listUI() override;
|
||||
static void changeTo(std::uint64_t applicationId);
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
std::string getVersionString() {
|
||||
char buf[0x100] = "";
|
||||
Result rc = sysclkIpcGetVersionString(buf, sizeof(buf));
|
||||
Result rc = hocclkIpcGetVersionString(buf, sizeof(buf));
|
||||
if (R_FAILED(rc) || buf[0] == '\0') {
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
@@ -111,9 +111,9 @@ void BaseMenuGui::preDraw(tsl::gfx::Renderer* renderer) {
|
||||
renderer->drawString(displayStrings[6], false, dataPositions[1], y, SMALL_TEXT_SIZE, tsl::infoTextColor); // GPU real
|
||||
renderer->drawString(displayStrings[7], false, dataPositions[2], y, SMALL_TEXT_SIZE, tsl::infoTextColor); // MEM real
|
||||
|
||||
renderer->drawString(displayStrings[28], false, positions[2], y, SMALL_TEXT_SIZE, tempColors[HorizonOCThermalSensor_CPU]); // CPU Real Temp
|
||||
renderer->drawString(displayStrings[29], false, positions[3], y, SMALL_TEXT_SIZE, tempColors[HorizonOCThermalSensor_GPU]); // GPU Real Temp
|
||||
renderer->drawString(displayStrings[30], false, positions[4], y, SMALL_TEXT_SIZE, tempColors[HorizonOCThermalSensor_MEM]); // RAM Real Temp
|
||||
renderer->drawString(displayStrings[28], false, positions[2], y, SMALL_TEXT_SIZE, tempColors[HocClkThermalSensor_CPU]); // CPU Real Temp
|
||||
renderer->drawString(displayStrings[29], false, positions[3], y, SMALL_TEXT_SIZE, tempColors[HocClkThermalSensor_GPU]); // GPU Real Temp
|
||||
renderer->drawString(displayStrings[30], false, positions[4], y, SMALL_TEXT_SIZE, tempColors[HocClkThermalSensor_MEM]); // RAM Real Temp
|
||||
|
||||
// === REAL FREQUENCIES ===
|
||||
|
||||
@@ -138,9 +138,9 @@ void BaseMenuGui::preDraw(tsl::gfx::Renderer* renderer) {
|
||||
renderer->drawString(labels[7], false, positions[7], y, SMALL_TEXT_SIZE, tsl::sectionTextColor);
|
||||
|
||||
// Temperatures with color - use pre-computed colors
|
||||
renderer->drawString(displayStrings[11], false, dataPositions[0], y, SMALL_TEXT_SIZE, tempColors[SysClkThermalSensor_SOC]); // SOC
|
||||
renderer->drawString(displayStrings[12], false, dataPositions[1], y, SMALL_TEXT_SIZE, tempColors[SysClkThermalSensor_PCB]); // PCB
|
||||
renderer->drawString(displayStrings[13], false, dataPositions[2], y, SMALL_TEXT_SIZE, tempColors[SysClkThermalSensor_Skin]); // Skin
|
||||
renderer->drawString(displayStrings[11], false, dataPositions[0], y, SMALL_TEXT_SIZE, tempColors[HocClkThermalSensor_SOC]); // SOC
|
||||
renderer->drawString(displayStrings[12], false, dataPositions[1], y, SMALL_TEXT_SIZE, tempColors[HocClkThermalSensor_PCB]); // PCB
|
||||
renderer->drawString(displayStrings[13], false, dataPositions[2], y, SMALL_TEXT_SIZE, tempColors[HocClkThermalSensor_Skin]); // Skin
|
||||
|
||||
y += 20; // Direct assignment (191 + 20)
|
||||
|
||||
@@ -157,7 +157,7 @@ void BaseMenuGui::preDraw(tsl::gfx::Renderer* renderer) {
|
||||
|
||||
renderer->drawString(labels[10], false, positions[2], y, SMALL_TEXT_SIZE, tsl::sectionTextColor);
|
||||
|
||||
renderer->drawString(displayStrings[20], false, dataPositions[0], y, SMALL_TEXT_SIZE, tempColors[HorizonOCThermalSensor_Battery]); // Battery
|
||||
renderer->drawString(displayStrings[20], false, dataPositions[0], y, SMALL_TEXT_SIZE, tempColors[HocClkThermalSensor_Battery]); // Battery
|
||||
|
||||
renderer->drawString(labels[13], false, positions[4], y, SMALL_TEXT_SIZE, tsl::sectionTextColor); // disp label
|
||||
|
||||
@@ -198,19 +198,19 @@ void BaseMenuGui::refresh()
|
||||
|
||||
// Lazy context allocation
|
||||
if (!this->context) [[unlikely]] {
|
||||
this->context = new SysClkContext;
|
||||
this->context = new HocClkContext;
|
||||
}
|
||||
|
||||
// === SYSCLK CONTEXT UPDATE ===
|
||||
Result rc = sysclkIpcGetCurrentContext(this->context);
|
||||
// === HOCCLK CONTEXT UPDATE ===
|
||||
Result rc = hocclkIpcGetCurrentContext(this->context);
|
||||
if (R_FAILED(rc)) [[unlikely]] {
|
||||
FatalGui::openWithResultCode("sysclkIpcGetCurrentContext", rc);
|
||||
FatalGui::openWithResultCode("hocclkIpcGetCurrentContext", rc);
|
||||
return;
|
||||
}
|
||||
|
||||
rc = sysclkIpcGetConfigValues(&configList);
|
||||
rc = hocclkIpcGetConfigValues(&configList);
|
||||
if (R_FAILED(rc)) [[unlikely]] {
|
||||
FatalGui::openWithResultCode("sysclkIpcGetConfigValues", rc);
|
||||
FatalGui::openWithResultCode("hocclkIpcGetConfigValues", rc);
|
||||
return;
|
||||
}
|
||||
// dockedHighestAllowedRefreshRate = this->context->maxDisplayFreq;
|
||||
@@ -220,33 +220,33 @@ void BaseMenuGui::refresh()
|
||||
sprintf(displayStrings[0], "%016lX", context->applicationId);
|
||||
|
||||
// Profile
|
||||
strcpy(displayStrings[1], sysclkFormatProfile(context->profile, true));
|
||||
strcpy(displayStrings[1], hocclkFormatProfile(context->profile, true));
|
||||
|
||||
// Current frequencies
|
||||
u32 hz = context->freqs[SysClkModule_CPU]; // CPU
|
||||
u32 hz = context->freqs[HocClkModule_CPU]; // CPU
|
||||
sprintf(displayStrings[2], "%u.%u MHz", hz / 1000000U, (hz / 100000U) % 10U);
|
||||
|
||||
hz = context->freqs[SysClkModule_GPU]; // GPU
|
||||
hz = context->freqs[HocClkModule_GPU]; // GPU
|
||||
sprintf(displayStrings[3], "%u.%u MHz", hz / 1000000U, (hz / 100000U) % 10U);
|
||||
|
||||
hz = context->freqs[SysClkModule_MEM]; // MEM
|
||||
hz = context->freqs[HocClkModule_MEM]; // MEM
|
||||
sprintf(displayStrings[4], "%u.%u MHz", hz / 1000000U, (hz / 100000U) % 10U);
|
||||
|
||||
// Real frequencies
|
||||
hz = context->realFreqs[SysClkModule_CPU]; // CPU
|
||||
hz = context->realFreqs[HocClkModule_CPU]; // CPU
|
||||
sprintf(displayStrings[5], "%u.%u MHz", hz / 1000000U, (hz / 100000U) % 10U);
|
||||
|
||||
hz = context->realFreqs[SysClkModule_GPU]; // GPU
|
||||
hz = context->realFreqs[HocClkModule_GPU]; // GPU
|
||||
sprintf(displayStrings[6], "%u.%u MHz", hz / 1000000U, (hz / 100000U) % 10U);
|
||||
|
||||
hz = context->realFreqs[SysClkModule_MEM]; // MEM
|
||||
hz = context->realFreqs[HocClkModule_MEM]; // MEM
|
||||
sprintf(displayStrings[7], "%u.%u MHz", hz / 1000000U, (hz / 100000U) % 10U);
|
||||
|
||||
// Voltages
|
||||
sprintf(displayStrings[8], "%.1f mV", context->voltages[HocClkVoltage_CPU] / 1000.0);
|
||||
sprintf(displayStrings[9], "%.1f mV", context->voltages[HocClkVoltage_GPU] / 1000.0);
|
||||
|
||||
switch(configList.values[HorizonOCConfigValue_RAMVoltDisplayMode]) {
|
||||
switch(configList.values[HocClkConfigValue_RAMVoltDisplayMode]) {
|
||||
case RamDisplayMode_VDD2:
|
||||
sprintf(displayStrings[10], "%u.%u mV", context->voltages[HocClkVoltage_EMCVDD2] / 1000U, (context->voltages[HocClkVoltage_EMCVDD2] % 1000U) / 100U);
|
||||
break;
|
||||
@@ -259,17 +259,17 @@ void BaseMenuGui::refresh()
|
||||
}
|
||||
|
||||
// Temperatures and pre-compute colors
|
||||
u32 millis = context->temps[SysClkThermalSensor_SOC]; // SOC
|
||||
u32 millis = context->temps[HocClkThermalSensor_SOC]; // SOC
|
||||
sprintf(displayStrings[11], "%u.%u °C", millis / 1000U, (millis % 1000U) / 100U);
|
||||
tempColors[SysClkThermalSensor_SOC] = tsl::GradientColor(millis * 0.001f);
|
||||
tempColors[HocClkThermalSensor_SOC] = tsl::GradientColor(millis * 0.001f);
|
||||
|
||||
millis = context->temps[SysClkThermalSensor_PCB]; // PCB
|
||||
millis = context->temps[HocClkThermalSensor_PCB]; // PCB
|
||||
sprintf(displayStrings[12], "%u.%u °C", millis / 1000U, (millis % 1000U) / 100U);
|
||||
tempColors[SysClkThermalSensor_PCB] = tsl::GradientColor(millis * 0.001f);
|
||||
tempColors[HocClkThermalSensor_PCB] = tsl::GradientColor(millis * 0.001f);
|
||||
|
||||
millis = context->temps[SysClkThermalSensor_Skin]; // Skin
|
||||
millis = context->temps[HocClkThermalSensor_Skin]; // Skin
|
||||
sprintf(displayStrings[13], "%u.%u °C", millis / 1000U, (millis % 1000U) / 100U);
|
||||
tempColors[SysClkThermalSensor_Skin] = tsl::GradientColor(millis * 0.001f);
|
||||
tempColors[HocClkThermalSensor_Skin] = tsl::GradientColor(millis * 0.001f);
|
||||
|
||||
// SOC voltage (if available)
|
||||
sprintf(displayStrings[14], "%u mV", context->voltages[HocClkVoltage_SOC] / 1000U);
|
||||
@@ -279,12 +279,12 @@ void BaseMenuGui::refresh()
|
||||
sprintf(displayStrings[16], "%d mW", context->power[1]); // Avg
|
||||
|
||||
sprintf(displayStrings[17], "%u%%", context->partLoad[HocClkPartLoad_GPU] / 10);
|
||||
sprintf(displayStrings[18], "%u%%", context->partLoad[SysClkPartLoad_EMC] / 10);
|
||||
sprintf(displayStrings[18], "%u%%", context->partLoad[HocClkPartLoad_EMC] / 10);
|
||||
sprintf(displayStrings[19], "%u%%", context->partLoad[HocClkPartLoad_CPUMax] / 10);
|
||||
|
||||
millis = context->temps[HorizonOCThermalSensor_Battery]; // Battery
|
||||
millis = context->temps[HocClkThermalSensor_Battery]; // Battery
|
||||
sprintf(displayStrings[20], "%u.%u °C", millis / 1000U, (millis % 1000U) / 100U);
|
||||
tempColors[HorizonOCThermalSensor_Battery] = tsl::GradientColor(millis * 0.001f);
|
||||
tempColors[HocClkThermalSensor_Battery] = tsl::GradientColor(millis * 0.001f);
|
||||
|
||||
sprintf(displayStrings[21], "%d mV", context->voltages[HocClkVoltage_Battery]); // BAT AVG
|
||||
|
||||
@@ -292,7 +292,7 @@ void BaseMenuGui::refresh()
|
||||
|
||||
sprintf(displayStrings[24], "%u%%", context->partLoad[HocClkPartLoad_FAN]);
|
||||
|
||||
sprintf(displayStrings[25], "%u Hz", context->realFreqs[HorizonOCModule_Display]);
|
||||
sprintf(displayStrings[25], "%u Hz", context->realFreqs[HocClkModule_Display]);
|
||||
if(this->context->isSaltyNXInstalled) {
|
||||
if(context->fps == 254) {
|
||||
strcpy(displayStrings[26], "N/A");
|
||||
@@ -311,17 +311,17 @@ void BaseMenuGui::refresh()
|
||||
}
|
||||
}
|
||||
|
||||
millis = context->temps[HorizonOCThermalSensor_CPU];
|
||||
millis = context->temps[HocClkThermalSensor_CPU];
|
||||
sprintf(displayStrings[28], "%u.%u", millis / 1000U, (millis % 1000U) / 100U);
|
||||
tempColors[HorizonOCThermalSensor_CPU] = tsl::GradientColor(millis * 0.001f);
|
||||
tempColors[HocClkThermalSensor_CPU] = tsl::GradientColor(millis * 0.001f);
|
||||
|
||||
millis = context->temps[HorizonOCThermalSensor_GPU];
|
||||
millis = context->temps[HocClkThermalSensor_GPU];
|
||||
sprintf(displayStrings[29], "%u.%u", millis / 1000U, (millis % 1000U) / 100U);
|
||||
tempColors[HorizonOCThermalSensor_GPU] = tsl::GradientColor(millis * 0.001f);
|
||||
tempColors[HocClkThermalSensor_GPU] = tsl::GradientColor(millis * 0.001f);
|
||||
|
||||
millis = context->temps[HorizonOCThermalSensor_MEM];
|
||||
millis = context->temps[HocClkThermalSensor_MEM];
|
||||
sprintf(displayStrings[30], "%u.%u", millis / 1000U, (millis % 1000U) / 100U);
|
||||
tempColors[HorizonOCThermalSensor_MEM] = tsl::GradientColor(millis * 0.001f);
|
||||
tempColors[HocClkThermalSensor_MEM] = tsl::GradientColor(millis * 0.001f);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -36,9 +36,9 @@ class BaseMenuGui : public BaseGui
|
||||
|
||||
public:
|
||||
// u8 dockedHighestAllowedRefreshRate = 60;
|
||||
SysClkContext* context;
|
||||
HocClkContext* context;
|
||||
std::uint64_t lastContextUpdate;
|
||||
SysClkConfigValueList configList;
|
||||
HocClkConfigValueList configList;
|
||||
bool g_hardwareModelCached = false;
|
||||
bool g_isMariko = false;
|
||||
bool g_isAula = false;
|
||||
@@ -87,5 +87,5 @@ class BaseMenuGui : public BaseGui
|
||||
|
||||
private:
|
||||
char displayStrings[48][32]; // Pre-formatted display strings
|
||||
tsl::Color tempColors[SysClkThermalSensor_EnumMax]; // Pre-computed temperature colors
|
||||
tsl::Color tempColors[HocClkThermalSensor_EnumMax]; // Pre-computed temperature colors
|
||||
};
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
FreqChoiceGui::FreqChoiceGui(std::uint32_t selectedHz,
|
||||
std::uint32_t* hzList,
|
||||
std::uint32_t hzCount,
|
||||
SysClkModule module,
|
||||
HocClkModule module,
|
||||
FreqChoiceListener listener,
|
||||
bool checkMax,
|
||||
std::map<uint32_t, std::string> labels)
|
||||
@@ -45,7 +45,7 @@ FreqChoiceGui::FreqChoiceGui(std::uint32_t selectedHz,
|
||||
this->listener = listener;
|
||||
this->checkMax = checkMax;
|
||||
this->labels = labels;
|
||||
this->configList = new SysClkConfigValueList {};
|
||||
this->configList = new HocClkConfigValueList {};
|
||||
}
|
||||
|
||||
FreqChoiceGui::~FreqChoiceGui()
|
||||
@@ -106,10 +106,10 @@ tsl::elm::ListItem* FreqChoiceGui::createFreqListItem(std::uint32_t hz, bool sel
|
||||
|
||||
void FreqChoiceGui::listUI()
|
||||
{
|
||||
sysclkIpcGetConfigValues(this->configList);
|
||||
hocclkIpcGetConfigValues(this->configList);
|
||||
|
||||
// Header based on CPU/GPU/MEM module
|
||||
std::string moduleName = sysclkFormatModule(this->module, false);
|
||||
std::string moduleName = hocclkFormatModule(this->module, false);
|
||||
this->listElement->addItem(new tsl::elm::CategoryHeader(moduleName));
|
||||
|
||||
// Default option
|
||||
|
||||
@@ -37,11 +37,11 @@ using FreqChoiceListener = std::function<bool(std::uint32_t hz)>;
|
||||
class FreqChoiceGui : public BaseMenuGui
|
||||
{
|
||||
protected:
|
||||
SysClkConfigValueList* configList;
|
||||
HocClkConfigValueList* configList;
|
||||
std::uint32_t selectedHz;
|
||||
std::uint32_t* hzList;
|
||||
std::uint32_t hzCount;
|
||||
SysClkModule module;
|
||||
HocClkModule module;
|
||||
FreqChoiceListener listener;
|
||||
bool checkMax;
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
FreqChoiceGui(std::uint32_t selectedHz,
|
||||
std::uint32_t* hzList,
|
||||
std::uint32_t hzCount,
|
||||
SysClkModule module,
|
||||
HocClkModule module,
|
||||
FreqChoiceListener listener,
|
||||
bool checkMax = true,
|
||||
std::map<uint32_t, std::string> labels = {});
|
||||
|
||||
@@ -24,37 +24,37 @@
|
||||
|
||||
GlobalOverrideGui::GlobalOverrideGui()
|
||||
{
|
||||
for (std::uint16_t m = 0; m < SysClkModule_EnumMax; m++) {
|
||||
for (std::uint16_t m = 0; m < HocClkModule_EnumMax; m++) {
|
||||
this->listItems[m] = nullptr;
|
||||
this->listHz[m] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void GlobalOverrideGui::openFreqChoiceGui(SysClkModule module)
|
||||
void GlobalOverrideGui::openFreqChoiceGui(HocClkModule module)
|
||||
{
|
||||
std::uint32_t hzList[SYSCLK_FREQ_LIST_MAX];
|
||||
std::uint32_t hzList[HOCCLK_FREQ_LIST_MAX];
|
||||
std::uint32_t hzCount;
|
||||
Result rc =
|
||||
sysclkIpcGetFreqList(module, &hzList[0], SYSCLK_FREQ_LIST_MAX, &hzCount);
|
||||
hocclkIpcGetFreqList(module, &hzList[0], HOCCLK_FREQ_LIST_MAX, &hzCount);
|
||||
if (R_FAILED(rc)) {
|
||||
FatalGui::openWithResultCode("sysclkIpcGetFreqList", rc);
|
||||
FatalGui::openWithResultCode("hocclkIpcGetFreqList", rc);
|
||||
return;
|
||||
}
|
||||
|
||||
std::map<uint32_t, std::string> labels = {};
|
||||
|
||||
if (module == SysClkModule_CPU) {
|
||||
if (module == HocClkModule_CPU) {
|
||||
bool isUsingUv = IsMariko() ? configList.values[KipConfigValue_marikoCpuUVHigh] : configList.values[KipConfigValue_eristaCpuUV];
|
||||
labels = IsMariko() ? (isUsingUv ? cpu_freq_label_m_uv : cpu_freq_label_m) : (isUsingUv ? cpu_freq_label_e_uv : cpu_freq_label_e);
|
||||
} else if (module == SysClkModule_GPU) {
|
||||
} else if (module == HocClkModule_GPU) {
|
||||
labels = IsMariko() ? *(marikoUV[configList.values[KipConfigValue_marikoGpuUV]]) : *(eristaUV[configList.values[KipConfigValue_eristaGpuUV]]);
|
||||
}
|
||||
tsl::changeTo<FreqChoiceGui>(
|
||||
this->context->overrideFreqs[module], hzList, hzCount, module,
|
||||
[this, module](std::uint32_t hz) {
|
||||
Result rc = sysclkIpcSetOverride(module, hz);
|
||||
Result rc = hocclkIpcSetOverride(module, hz);
|
||||
if (R_FAILED(rc)) {
|
||||
FatalGui::openWithResultCode("sysclkIpcSetOverride", rc);
|
||||
FatalGui::openWithResultCode("hocclkIpcSetOverride", rc);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ void GlobalOverrideGui::openValueChoiceGui(
|
||||
}
|
||||
|
||||
void GlobalOverrideGui::addModuleListItemValue(
|
||||
SysClkModule module,
|
||||
HocClkModule module,
|
||||
const std::string& categoryName,
|
||||
std::uint32_t min,
|
||||
std::uint32_t max,
|
||||
@@ -115,7 +115,7 @@ void GlobalOverrideGui::addModuleListItemValue(
|
||||
}
|
||||
|
||||
tsl::elm::ListItem* listItem =
|
||||
new tsl::elm::ListItem(sysclkFormatModule(module, true));
|
||||
new tsl::elm::ListItem(hocclkFormatModule(module, true));
|
||||
|
||||
listItem->setValue(FREQ_DEFAULT_TEXT);
|
||||
|
||||
@@ -191,12 +191,12 @@ void GlobalOverrideGui::addModuleListItemValue(
|
||||
}
|
||||
|
||||
Result rc =
|
||||
sysclkIpcSetOverride(module, this->context->overrideFreqs[module]);
|
||||
hocclkIpcSetOverride(module, this->context->overrideFreqs[module]);
|
||||
|
||||
if (R_FAILED(rc))
|
||||
{
|
||||
FatalGui::openWithResultCode(
|
||||
"sysclkIpcSetOverride", rc);
|
||||
"hocclkIpcSetOverride", rc);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -223,11 +223,11 @@ void GlobalOverrideGui::addModuleListItemValue(
|
||||
this->listHz[module] = 0;
|
||||
listItem->setValue(FREQ_DEFAULT_TEXT);
|
||||
|
||||
Result rc = sysclkIpcSetOverride(module, 0);
|
||||
Result rc = hocclkIpcSetOverride(module, 0);
|
||||
|
||||
if (R_FAILED(rc))
|
||||
{
|
||||
FatalGui::openWithResultCode("sysclkIpcSetOverride", rc);
|
||||
FatalGui::openWithResultCode("hocclkIpcSetOverride", rc);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -242,19 +242,19 @@ void GlobalOverrideGui::addModuleListItemValue(
|
||||
this->listItems[module] = listItem;
|
||||
}
|
||||
|
||||
void GlobalOverrideGui::addModuleListItem(SysClkModule module)
|
||||
void GlobalOverrideGui::addModuleListItem(HocClkModule module)
|
||||
{
|
||||
tsl::elm::ListItem *listItem =
|
||||
new tsl::elm::ListItem(sysclkFormatModule(module, true));
|
||||
new tsl::elm::ListItem(hocclkFormatModule(module, true));
|
||||
listItem->setValue(formatListFreqMHz(0));
|
||||
listItem->setClickListener([this, module](u64 keys) {
|
||||
if ((keys & HidNpadButton_A) == HidNpadButton_A) {
|
||||
this->openFreqChoiceGui(module);
|
||||
return true;
|
||||
} else if ((keys & HidNpadButton_Y) == HidNpadButton_Y) {
|
||||
Result rc = sysclkIpcSetOverride(module, 0);
|
||||
Result rc = hocclkIpcSetOverride(module, 0);
|
||||
if (R_FAILED(rc)) {
|
||||
FatalGui::openWithResultCode("sysclkIpcSetOverride", rc);
|
||||
FatalGui::openWithResultCode("hocclkIpcSetOverride", rc);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -273,18 +273,18 @@ void GlobalOverrideGui::addModuleListItem(SysClkModule module)
|
||||
this->listItems[module] = listItem;
|
||||
}
|
||||
|
||||
void GlobalOverrideGui::addModuleToggleItem(SysClkModule module)
|
||||
void GlobalOverrideGui::addModuleToggleItem(HocClkModule module)
|
||||
{
|
||||
const char *moduleName = sysclkFormatModule(module, true);
|
||||
const char *moduleName = hocclkFormatModule(module, true);
|
||||
bool isOn = this->listHz[module];
|
||||
|
||||
tsl::elm::ToggleListItem *toggle =
|
||||
new tsl::elm::ToggleListItem(moduleName, isOn);
|
||||
|
||||
toggle->setStateChangedListener([this, module, toggle](bool state) {
|
||||
Result rc = sysclkIpcSetOverride(module, state ? 1 : 0);
|
||||
Result rc = hocclkIpcSetOverride(module, state ? 1 : 0);
|
||||
if (R_FAILED(rc)) {
|
||||
FatalGui::openWithResultCode("sysclkIpcSetProfiles", rc);
|
||||
FatalGui::openWithResultCode("hocclkIpcSetProfiles", rc);
|
||||
}
|
||||
this->lastContextUpdate = armGetSystemTick();
|
||||
this->context->overrideFreqs[module] = 0;
|
||||
@@ -300,9 +300,9 @@ public:
|
||||
GovernorOverrideSubMenuGui(u32 initialPacked) : packed(initialPacked) {}
|
||||
|
||||
void listUI() override {
|
||||
Result rc = sysclkIpcGetConfigValues(&configList); // idk why this is needed, probably some refreshing issue
|
||||
Result rc = hocclkIpcGetConfigValues(&configList); // idk why this is needed, probably some refreshing issue
|
||||
if (R_FAILED(rc)) [[unlikely]] {
|
||||
FatalGui::openWithResultCode("sysclkIpcGetConfigValues", rc);
|
||||
FatalGui::openWithResultCode("hocclkIpcGetConfigValues", rc);
|
||||
return;
|
||||
}
|
||||
this->listElement->addItem(new tsl::elm::CategoryHeader("Governor"));
|
||||
@@ -310,7 +310,7 @@ public:
|
||||
static constexpr struct { const char* label; int shift; } kAll[] = {
|
||||
{"CPU", 0}, {"GPU", 8}, {"VRR", 16}
|
||||
};
|
||||
int count = configList.values[HorizonOCConfigValue_OverwriteRefreshRate] ? 3 : 2;
|
||||
int count = configList.values[HocClkConfigValue_OverwriteRefreshRate] ? 3 : 2;
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
u8 cur = (this->packed >> kAll[i].shift) & 0xFF;
|
||||
@@ -322,8 +322,8 @@ public:
|
||||
int shift = kAll[i].shift;
|
||||
bar->setValueChangedListener([this, shift](u8 value) {
|
||||
this->packed = (this->packed & ~(0xFFu << shift)) | ((u32)value << shift);
|
||||
Result rc = sysclkIpcSetOverride(HorizonOCModule_Governor, this->packed);
|
||||
if (R_FAILED(rc)) FatalGui::openWithResultCode("sysclkIpcSetOverride", rc);
|
||||
Result rc = hocclkIpcSetOverride(HocClkModule_Governor, this->packed);
|
||||
if (R_FAILED(rc)) FatalGui::openWithResultCode("hocclkIpcSetOverride", rc);
|
||||
this->lastContextUpdate = armGetSystemTick();
|
||||
});
|
||||
this->listElement->addItem(bar);
|
||||
@@ -336,7 +336,7 @@ void GlobalOverrideGui::addGovernorSection() {
|
||||
item->setValue("\u2192"); // right arrow
|
||||
item->setClickListener([this](u64 keys) {
|
||||
if (keys & HidNpadButton_A) {
|
||||
u32 packed = this->context ? this->context->overrideFreqs[HorizonOCModule_Governor] : 0;
|
||||
u32 packed = this->context ? this->context->overrideFreqs[HocClkModule_Governor] : 0;
|
||||
tsl::changeTo<GovernorOverrideSubMenuGui>(packed);
|
||||
return true;
|
||||
}
|
||||
@@ -351,21 +351,21 @@ void GlobalOverrideGui::listUI()
|
||||
if(!this->context)
|
||||
return;
|
||||
|
||||
Result rc = sysclkIpcGetConfigValues(&configList); // idk why this is needed, probably some refreshing issue
|
||||
Result rc = hocclkIpcGetConfigValues(&configList); // idk why this is needed, probably some refreshing issue
|
||||
if (R_FAILED(rc)) [[unlikely]] {
|
||||
FatalGui::openWithResultCode("sysclkIpcGetConfigValues", rc);
|
||||
FatalGui::openWithResultCode("hocclkIpcGetConfigValues", rc);
|
||||
return;
|
||||
}
|
||||
|
||||
this->listElement->addItem(new tsl::elm::CategoryHeader(
|
||||
"Temporary Overrides " + ult::DIVIDER_SYMBOL + " \ue0e3 Reset"));
|
||||
this->addModuleListItem(SysClkModule_CPU);
|
||||
this->addModuleListItem(SysClkModule_GPU);
|
||||
this->addModuleListItem(SysClkModule_MEM);
|
||||
this->addModuleListItem(HocClkModule_CPU);
|
||||
this->addModuleListItem(HocClkModule_GPU);
|
||||
this->addModuleListItem(HocClkModule_MEM);
|
||||
#if IS_MINIMAL == 0
|
||||
ValueThresholds lcdThresholds(60, 65);
|
||||
if(configList.values[HorizonOCConfigValue_OverwriteRefreshRate])
|
||||
this->addModuleListItemValue(HorizonOCModule_Display, "Display", IsAula() ? 45 : 40, configList.values[HorizonOCConfigValue_MaxDisplayClockH], this->context->isUsingRetroSuper ? 5 : 1, " Hz", 1, 0, lcdThresholds);
|
||||
if(configList.values[HocClkConfigValue_OverwriteRefreshRate])
|
||||
this->addModuleListItemValue(HocClkModule_Display, "Display", IsAula() ? 45 : 40, configList.values[HocClkConfigValue_MaxDisplayClockH], this->context->isUsingRetroSuper ? 5 : 1, " Hz", 1, 0, lcdThresholds);
|
||||
#endif
|
||||
|
||||
this->addGovernorSection();
|
||||
@@ -378,8 +378,8 @@ void GlobalOverrideGui::refresh()
|
||||
if (!this->context)
|
||||
return;
|
||||
|
||||
for (std::uint16_t m = 0; m < SysClkModule_EnumMax; m++) {
|
||||
if (m == HorizonOCModule_Governor) {
|
||||
for (std::uint16_t m = 0; m < HocClkModule_EnumMax; m++) {
|
||||
if (m == HocClkModule_Governor) {
|
||||
this->listHz[m] = this->context->overrideFreqs[m];
|
||||
continue;
|
||||
}
|
||||
@@ -387,7 +387,7 @@ void GlobalOverrideGui::refresh()
|
||||
if (this->listItems[m] != nullptr &&
|
||||
this->listHz[m] != this->context->overrideFreqs[m]) {
|
||||
|
||||
auto it = this->customFormatModules.find((SysClkModule)m);
|
||||
auto it = this->customFormatModules.find((HocClkModule)m);
|
||||
if (it != this->customFormatModules.end()) {
|
||||
std::string suffix = std::get<0>(it->second);
|
||||
std::uint32_t divisor = std::get<1>(it->second);
|
||||
|
||||
@@ -33,13 +33,13 @@
|
||||
class GlobalOverrideGui : public BaseMenuGui
|
||||
{
|
||||
protected:
|
||||
std::map<SysClkModule, std::tuple<std::string, std::uint32_t, int>> customFormatModules;
|
||||
tsl::elm::ListItem* listItems[SysClkModule_EnumMax];
|
||||
std::uint32_t listHz[SysClkModule_EnumMax];
|
||||
void openFreqChoiceGui(SysClkModule module);
|
||||
std::map<HocClkModule, std::tuple<std::string, std::uint32_t, int>> customFormatModules;
|
||||
tsl::elm::ListItem* listItems[HocClkModule_EnumMax];
|
||||
std::uint32_t listHz[HocClkModule_EnumMax];
|
||||
void openFreqChoiceGui(HocClkModule module);
|
||||
void addGovernorSection();
|
||||
void addModuleListItem(SysClkModule module);
|
||||
void addModuleToggleItem(SysClkModule module);
|
||||
void addModuleListItem(HocClkModule module);
|
||||
void addModuleToggleItem(HocClkModule module);
|
||||
void openValueChoiceGui(
|
||||
tsl::elm::ListItem* listItem,
|
||||
std::uint32_t currentValue,
|
||||
@@ -53,7 +53,7 @@ class GlobalOverrideGui : public BaseMenuGui
|
||||
bool showDefaultValue
|
||||
);
|
||||
void addModuleListItemValue(
|
||||
SysClkModule module,
|
||||
HocClkModule module,
|
||||
const std::string& categoryName,
|
||||
std::uint32_t min,
|
||||
std::uint32_t max,
|
||||
@@ -70,5 +70,5 @@ class GlobalOverrideGui : public BaseMenuGui
|
||||
~GlobalOverrideGui() {}
|
||||
void listUI() override;
|
||||
void refresh() override;
|
||||
void setModuleCustomFormat(SysClkModule module, const std::string& suffix, std::uint32_t divisor, int decimalPlaces);
|
||||
void setModuleCustomFormat(HocClkModule module, const std::string& suffix, std::uint32_t divisor, int decimalPlaces);
|
||||
};
|
||||
@@ -37,10 +37,10 @@ void MainGui::listUI()
|
||||
{
|
||||
// this->enabledToggle = new tsl::elm::ToggleListItem("Enable", false);
|
||||
// enabledToggle->setStateChangedListener([this](bool state) {
|
||||
// Result rc = sysclkIpcSetEnabled(state);
|
||||
// Result rc = hocclkIpcSetEnabled(state);
|
||||
// if(R_FAILED(rc))
|
||||
// {
|
||||
// FatalGui::openWithResultCode("sysclkIpcSetEnabled", rc);
|
||||
// FatalGui::openWithResultCode("hocclkIpcSetEnabled", rc);
|
||||
// }
|
||||
|
||||
// this->lastContextUpdate = armGetSystemTick();
|
||||
@@ -65,7 +65,7 @@ void MainGui::listUI()
|
||||
globalProfileItem->setClickListener([this](u64 keys) {
|
||||
if((keys & HidNpadButton_A) == HidNpadButton_A && this->context)
|
||||
{
|
||||
AppProfileGui::changeTo(SYSCLK_GLOBAL_PROFILE_TID);
|
||||
AppProfileGui::changeTo(HOCCLK_GLOBAL_PROFILE_TID);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ class RamTableEditor;
|
||||
|
||||
MiscGui::MiscGui()
|
||||
{
|
||||
this->configList = new SysClkConfigValueList {};
|
||||
this->configList = new HocClkConfigValueList {};
|
||||
}
|
||||
|
||||
MiscGui::~MiscGui()
|
||||
@@ -57,14 +57,14 @@ MiscGui::~MiscGui()
|
||||
this->configRanges.clear();
|
||||
}
|
||||
|
||||
void MiscGui::addConfigToggle(SysClkConfigValue configVal, const char* altName) {
|
||||
const char* configName = altName ? altName : sysclkFormatConfigValue(configVal, true);
|
||||
void MiscGui::addConfigToggle(HocClkConfigValue configVal, const char* altName) {
|
||||
const char* configName = altName ? altName : hocclkFormatConfigValue(configVal, true);
|
||||
tsl::elm::ToggleListItem* toggle = new tsl::elm::ToggleListItem(configName, this->configList->values[configVal]);
|
||||
toggle->setStateChangedListener([this, configVal](bool state) {
|
||||
this->configList->values[configVal] = uint64_t(state);
|
||||
Result rc = sysclkIpcSetConfigValues(this->configList);
|
||||
Result rc = hocclkIpcSetConfigValues(this->configList);
|
||||
if (R_FAILED(rc))
|
||||
FatalGui::openWithResultCode("sysclkIpcSetConfigValues", rc);
|
||||
FatalGui::openWithResultCode("hocclkIpcSetConfigValues", rc);
|
||||
this->lastContextUpdate = armGetSystemTick();
|
||||
});
|
||||
this->listElement->addItem(toggle);
|
||||
@@ -72,7 +72,7 @@ void MiscGui::addConfigToggle(SysClkConfigValue configVal, const char* altName)
|
||||
}
|
||||
|
||||
|
||||
void MiscGui::addConfigButton(SysClkConfigValue configVal,
|
||||
void MiscGui::addConfigButton(HocClkConfigValue configVal,
|
||||
const char* altName,
|
||||
const ValueRange& range,
|
||||
const std::string& categoryName,
|
||||
@@ -81,7 +81,7 @@ void MiscGui::addConfigButton(SysClkConfigValue configVal,
|
||||
const std::vector<NamedValue>& namedValues,
|
||||
bool showDefaultValue)
|
||||
{
|
||||
const char* configName = altName ? altName : sysclkFormatConfigValue(configVal, true);
|
||||
const char* configName = altName ? altName : hocclkFormatConfigValue(configVal, true);
|
||||
|
||||
tsl::elm::ListItem* listItem = new tsl::elm::ListItem(configName);
|
||||
|
||||
@@ -128,9 +128,9 @@ void MiscGui::addConfigButton(SysClkConfigValue configVal,
|
||||
categoryName,
|
||||
[this, configVal](std::uint32_t value) {
|
||||
this->configList->values[configVal] = value;
|
||||
Result rc = sysclkIpcSetConfigValues(this->configList);
|
||||
Result rc = hocclkIpcSetConfigValues(this->configList);
|
||||
if (R_FAILED(rc)) {
|
||||
FatalGui::openWithResultCode("sysclkIpcSetConfigValues", rc);
|
||||
FatalGui::openWithResultCode("hocclkIpcSetConfigValues", rc);
|
||||
return false;
|
||||
}
|
||||
this->lastContextUpdate = armGetSystemTick();
|
||||
@@ -150,9 +150,9 @@ void MiscGui::addConfigButton(SysClkConfigValue configVal,
|
||||
categoryName,
|
||||
[this, configVal](std::uint32_t value) {
|
||||
this->configList->values[configVal] = value;
|
||||
Result rc = sysclkIpcSetConfigValues(this->configList);
|
||||
Result rc = hocclkIpcSetConfigValues(this->configList);
|
||||
if (R_FAILED(rc)) {
|
||||
FatalGui::openWithResultCode("sysclkIpcSetConfigValues", rc);
|
||||
FatalGui::openWithResultCode("hocclkIpcSetConfigValues", rc);
|
||||
return false;
|
||||
}
|
||||
this->lastContextUpdate = armGetSystemTick();
|
||||
@@ -175,7 +175,7 @@ void MiscGui::addConfigButton(SysClkConfigValue configVal,
|
||||
this->configNamedValues[configVal] = namedValues;
|
||||
}
|
||||
|
||||
void MiscGui::addConfigButtonS(SysClkConfigValue configVal,
|
||||
void MiscGui::addConfigButtonS(HocClkConfigValue configVal,
|
||||
const char* altName,
|
||||
const ValueRange& range,
|
||||
const std::string& categoryName,
|
||||
@@ -232,9 +232,9 @@ void MiscGui::addConfigButtonS(SysClkConfigValue configVal,
|
||||
categoryName,
|
||||
[this, configVal](std::uint32_t value) {
|
||||
this->configList->values[configVal] = value;
|
||||
Result rc = sysclkIpcSetConfigValues(this->configList);
|
||||
Result rc = hocclkIpcSetConfigValues(this->configList);
|
||||
if (R_FAILED(rc)) {
|
||||
FatalGui::openWithResultCode("sysclkIpcSetConfigValues", rc);
|
||||
FatalGui::openWithResultCode("hocclkIpcSetConfigValues", rc);
|
||||
return false;
|
||||
}
|
||||
this->lastContextUpdate = armGetSystemTick();
|
||||
@@ -254,9 +254,9 @@ void MiscGui::addConfigButtonS(SysClkConfigValue configVal,
|
||||
categoryName,
|
||||
[this, configVal](std::uint32_t value) {
|
||||
this->configList->values[configVal] = value;
|
||||
Result rc = sysclkIpcSetConfigValues(this->configList);
|
||||
Result rc = hocclkIpcSetConfigValues(this->configList);
|
||||
if (R_FAILED(rc)) {
|
||||
FatalGui::openWithResultCode("sysclkIpcSetConfigValues", rc);
|
||||
FatalGui::openWithResultCode("hocclkIpcSetConfigValues", rc);
|
||||
return false;
|
||||
}
|
||||
this->lastContextUpdate = armGetSystemTick();
|
||||
@@ -289,12 +289,12 @@ void MiscGui::updateConfigToggles() {
|
||||
}
|
||||
}
|
||||
|
||||
void MiscGui::addFreqButton(SysClkConfigValue configVal,
|
||||
void MiscGui::addFreqButton(HocClkConfigValue configVal,
|
||||
const char* altName,
|
||||
SysClkModule module,
|
||||
HocClkModule module,
|
||||
const std::map<uint32_t, std::string>& labels)
|
||||
{
|
||||
const char* configName = altName ? altName : sysclkFormatConfigValue(configVal, true);
|
||||
const char* configName = altName ? altName : hocclkFormatConfigValue(configVal, true);
|
||||
|
||||
tsl::elm::ListItem* listItem = new tsl::elm::ListItem(configName);
|
||||
|
||||
@@ -309,12 +309,12 @@ void MiscGui::addFreqButton(SysClkConfigValue configVal,
|
||||
if ((keys & HidNpadButton_A) == 0)
|
||||
return false;
|
||||
|
||||
std::uint32_t hzList[SYSCLK_FREQ_LIST_MAX];
|
||||
std::uint32_t hzList[HOCCLK_FREQ_LIST_MAX];
|
||||
std::uint32_t hzCount;
|
||||
|
||||
Result rc = sysclkIpcGetFreqList(module, hzList, SYSCLK_FREQ_LIST_MAX, &hzCount);
|
||||
Result rc = hocclkIpcGetFreqList(module, hzList, HOCCLK_FREQ_LIST_MAX, &hzCount);
|
||||
if (R_FAILED(rc)) {
|
||||
FatalGui::openWithResultCode("sysclkIpcGetFreqList", rc);
|
||||
FatalGui::openWithResultCode("hocclkIpcGetFreqList", rc);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -330,9 +330,9 @@ void MiscGui::addFreqButton(SysClkConfigValue configVal,
|
||||
uint64_t mhz = hz / 1'000'000;
|
||||
this->configList->values[configVal] = mhz;
|
||||
|
||||
Result rc = sysclkIpcSetConfigValues(this->configList);
|
||||
Result rc = hocclkIpcSetConfigValues(this->configList);
|
||||
if (R_FAILED(rc)) {
|
||||
FatalGui::openWithResultCode("sysclkIpcSetConfigValues", rc);
|
||||
FatalGui::openWithResultCode("hocclkIpcSetConfigValues", rc);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -354,9 +354,9 @@ void MiscGui::addFreqButton(SysClkConfigValue configVal,
|
||||
|
||||
void MiscGui::listUI()
|
||||
{
|
||||
Result rc = sysclkIpcGetConfigValues(configList);
|
||||
Result rc = hocclkIpcGetConfigValues(configList);
|
||||
if (R_FAILED(rc)) [[unlikely]] {
|
||||
FatalGui::openWithResultCode("sysclkIpcGetConfigValues", rc);
|
||||
FatalGui::openWithResultCode("hocclkIpcGetConfigValues", rc);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -471,16 +471,16 @@ void MiscGui::listUI()
|
||||
// NamedValue("2816mA", 2816),
|
||||
// NamedValue("3072mA", 3072),
|
||||
// };
|
||||
if(this->configList->values[HorizonOCConfigValue_EnableExperimentalSettings]) {
|
||||
if(this->configList->values[HocClkConfigValue_EnableExperimentalSettings]) {
|
||||
this->listElement->addItem(new tsl::elm::CategoryHeader("Experimental"));
|
||||
|
||||
addConfigToggle(HorizonOCConfigValue_LiveCpuUv, nullptr);
|
||||
addConfigToggle(HocClkConfigValue_LiveCpuUv, nullptr);
|
||||
std::vector<NamedValue> gpuSchedMethodValues = {
|
||||
NamedValue("INI", GpuSchedulingOverrideMethod_Ini),
|
||||
NamedValue("NV Service", GpuSchedulingOverrideMethod_NvService),
|
||||
};
|
||||
addConfigButton(
|
||||
HorizonOCConfigValue_GPUSchedulingMethod,
|
||||
HocClkConfigValue_GPUSchedulingMethod,
|
||||
"GPU Scheduling Override Method",
|
||||
ValueRange(0, 0, 1, "", 0),
|
||||
"GPU Scheduling Override Method",
|
||||
@@ -514,7 +514,7 @@ void MiscGui::listUI()
|
||||
ValueThresholds chargerThresholds(2048, 2049);
|
||||
|
||||
addConfigButton(
|
||||
HorizonOCConfigValue_BatteryChargeCurrent,
|
||||
HocClkConfigValue_BatteryChargeCurrent,
|
||||
"Charge Current Override",
|
||||
ValueRange(0, 0, 1, "", 0),
|
||||
"Charge Current Override",
|
||||
@@ -539,7 +539,7 @@ void MiscGui::listUI()
|
||||
ValueThresholds chargerThresholds(1792, 1793);
|
||||
|
||||
addConfigButton(
|
||||
HorizonOCConfigValue_BatteryChargeCurrent,
|
||||
HocClkConfigValue_BatteryChargeCurrent,
|
||||
"Charge Current Override",
|
||||
ValueRange(0, 0, 1, "", 0),
|
||||
"Charge Current Override",
|
||||
@@ -567,10 +567,10 @@ protected:
|
||||
NamedValue("VDDQ", RamDisplayMode_VDDQ),
|
||||
};
|
||||
|
||||
addConfigButton(HorizonOCConfigValue_RAMVoltDisplayMode, "RAM Voltage Display Mode", ValueRange(0, 12, 1, "", 0), "RAM Voltage Display Mode", &thresholdsDisabled, {}, ramVoltDispModes, false);
|
||||
addConfigButton(HocClkConfigValue_RAMVoltDisplayMode, "RAM Voltage Display Mode", ValueRange(0, 12, 1, "", 0), "RAM Voltage Display Mode", &thresholdsDisabled, {}, ramVoltDispModes, false);
|
||||
|
||||
addConfigButton(
|
||||
SysClkConfigValue_PollingIntervalMs,
|
||||
HocClkConfigValue_PollingIntervalMs,
|
||||
"Polling Interval",
|
||||
ValueRange(50, 1000, 50, "ms", 1),
|
||||
"Polling Interval",
|
||||
@@ -601,7 +601,7 @@ protected:
|
||||
};
|
||||
|
||||
addConfigButton(
|
||||
HorizonOCConfigValue_CpuGovernorMinimumFreq,
|
||||
HocClkConfigValue_CpuGovernorMinimumFreq,
|
||||
"CPU Governor Minimum Frequency",
|
||||
ValueRange(0, 0, 1, "", 0),
|
||||
"CPU Governor Minimum Frequency",
|
||||
@@ -626,7 +626,7 @@ protected:
|
||||
return;
|
||||
|
||||
this->listElement->addItem(new tsl::elm::CategoryHeader("Display Settings"));
|
||||
addConfigToggle(HorizonOCConfigValue_OverwriteRefreshRate, nullptr);
|
||||
addConfigToggle(HocClkConfigValue_OverwriteRefreshRate, nullptr);
|
||||
if(!this->context->isUsingRetroSuper) {
|
||||
tsl::elm::CustomDrawer* warningText = new tsl::elm::CustomDrawer([](tsl::gfx::Renderer *renderer, s32 x, s32 y, s32 w, s32 h) {
|
||||
renderer->drawString("\uE150 Usage of unsafe display", false, x + 20, y + 30, 18, tsl::style::color::ColorText);
|
||||
@@ -639,7 +639,7 @@ protected:
|
||||
this->listElement->addItem(warningText);
|
||||
ValueThresholds displayThresholds(60, 65);
|
||||
addConfigButton(
|
||||
HorizonOCConfigValue_MaxDisplayClockH,
|
||||
HocClkConfigValue_MaxDisplayClockH,
|
||||
"Max Handheld Display",
|
||||
ValueRange(60, IsAula() ? 65 : 75, 1, " Hz", 1),
|
||||
"Display Clock",
|
||||
@@ -958,9 +958,9 @@ public:
|
||||
|
||||
protected:
|
||||
void listUI() override {
|
||||
Result rc = sysclkIpcGetConfigValues(this->configList); // populate config list early otherwise wont work
|
||||
Result rc = hocclkIpcGetConfigValues(this->configList); // populate config list early otherwise wont work
|
||||
if (R_FAILED(rc)) [[unlikely]] {
|
||||
FatalGui::openWithResultCode("sysclkIpcGetConfigValues", rc);
|
||||
FatalGui::openWithResultCode("hocclkIpcGetConfigValues", rc);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1369,7 +1369,7 @@ protected:
|
||||
};
|
||||
|
||||
addConfigButton(
|
||||
HorizonOCConfigValue_GPUScheduling,
|
||||
HocClkConfigValue_GPUScheduling,
|
||||
"GPU Scheduling Override",
|
||||
ValueRange(0, 0, 1, "", 0),
|
||||
"GPU Scheduling Override",
|
||||
@@ -1410,7 +1410,7 @@ protected:
|
||||
};
|
||||
|
||||
addConfigButton(
|
||||
HorizonOCConfigValue_DVFSMode,
|
||||
HocClkConfigValue_DVFSMode,
|
||||
"GPU DVFS Mode",
|
||||
ValueRange(0, 0, 1, "", 0),
|
||||
"GPU DVFS Mode",
|
||||
@@ -1420,7 +1420,7 @@ protected:
|
||||
false
|
||||
);
|
||||
|
||||
addConfigButton(HorizonOCConfigValue_DVFSOffset, "GPU DVFS Offset", ValueRange(0, 12, 1, "", 0), "GPU DVFS Offset", &thresholdsDisabled, {}, dvfsOffset, false);
|
||||
addConfigButton(HocClkConfigValue_DVFSOffset, "GPU DVFS Offset", ValueRange(0, 12, 1, "", 0), "GPU DVFS Offset", &thresholdsDisabled, {}, dvfsOffset, false);
|
||||
}
|
||||
|
||||
tsl::elm::ListItem* customTableSubmenu = new tsl::elm::ListItem("GPU Voltage Table");
|
||||
@@ -1443,9 +1443,9 @@ public:
|
||||
protected:
|
||||
void listUI() override {
|
||||
|
||||
Result rc = sysclkIpcGetConfigValues(this->configList); // populate config list early otherwise wont work
|
||||
Result rc = hocclkIpcGetConfigValues(this->configList); // populate config list early otherwise wont work
|
||||
if (R_FAILED(rc)) [[unlikely]] {
|
||||
FatalGui::openWithResultCode("sysclkIpcGetConfigValues", rc);
|
||||
FatalGui::openWithResultCode("hocclkIpcGetConfigValues", rc);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1696,9 +1696,9 @@ void MiscGui::refresh() {
|
||||
if (this->context && ++frameCounter >= 60) {
|
||||
frameCounter = 0;
|
||||
|
||||
Result rc = sysclkIpcGetConfigValues(this->configList);
|
||||
Result rc = hocclkIpcGetConfigValues(this->configList);
|
||||
if (R_FAILED(rc)) [[unlikely]] {
|
||||
FatalGui::openWithResultCode("sysclkIpcGetConfigValues", rc);
|
||||
FatalGui::openWithResultCode("hocclkIpcGetConfigValues", rc);
|
||||
return;
|
||||
}
|
||||
updateConfigToggles();
|
||||
|
||||
@@ -33,17 +33,17 @@ public:
|
||||
void refresh() override;
|
||||
|
||||
protected:
|
||||
SysClkConfigValueList* configList;
|
||||
std::map<SysClkConfigValue, tsl::elm::ListItem*> configButtons;
|
||||
std::map<SysClkConfigValue, ValueRange> configRanges;
|
||||
std::map<SysClkConfigValue, std::vector<NamedValue>> configNamedValues;
|
||||
std::map<SysClkConfigValue, tsl::elm::ToggleListItem*> configToggles;
|
||||
std::map<SysClkConfigValue, std::tuple<tsl::elm::TrackBar*, tsl::elm::ListItem*, std::vector<uint64_t>>> configTrackbars;
|
||||
std::set<SysClkConfigValue> configButtonSKeys;
|
||||
std::map<SysClkConfigValue, std::string> configButtonSSubtext;
|
||||
HocClkConfigValueList* configList;
|
||||
std::map<HocClkConfigValue, tsl::elm::ListItem*> configButtons;
|
||||
std::map<HocClkConfigValue, ValueRange> configRanges;
|
||||
std::map<HocClkConfigValue, std::vector<NamedValue>> configNamedValues;
|
||||
std::map<HocClkConfigValue, tsl::elm::ToggleListItem*> configToggles;
|
||||
std::map<HocClkConfigValue, std::tuple<tsl::elm::TrackBar*, tsl::elm::ListItem*, std::vector<uint64_t>>> configTrackbars;
|
||||
std::set<HocClkConfigValue> configButtonSKeys;
|
||||
std::map<HocClkConfigValue, std::string> configButtonSSubtext;
|
||||
|
||||
void addConfigToggle(SysClkConfigValue configVal, const char* altName);
|
||||
void addConfigButton(SysClkConfigValue configVal,
|
||||
void addConfigToggle(HocClkConfigValue configVal, const char* altName);
|
||||
void addConfigButton(HocClkConfigValue configVal,
|
||||
const char* altName,
|
||||
const ValueRange& range,
|
||||
const std::string& categoryName,
|
||||
@@ -52,7 +52,7 @@ protected:
|
||||
const std::vector<NamedValue>& namedValues = {},
|
||||
bool showDefaultValue = true);
|
||||
|
||||
void addConfigButtonS(SysClkConfigValue configVal,
|
||||
void addConfigButtonS(HocClkConfigValue configVal,
|
||||
const char* altName,
|
||||
const ValueRange& range,
|
||||
const std::string& categoryName,
|
||||
@@ -61,9 +61,9 @@ protected:
|
||||
const std::vector<NamedValue>& namedValues = {},
|
||||
bool showDefaultValue = true,
|
||||
const char* subText = nullptr);
|
||||
void addFreqButton(SysClkConfigValue configVal,
|
||||
void addFreqButton(HocClkConfigValue configVal,
|
||||
const char* altName,
|
||||
SysClkModule module,
|
||||
HocClkModule module,
|
||||
const std::map<uint32_t, std::string>& labels = {});
|
||||
void updateConfigToggles();
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
#include <nxExt.h>
|
||||
#include <sysclk.h>
|
||||
#include <hocclk.h>
|
||||
#include <switch.h>
|
||||
#include <pwm.h>
|
||||
#include <registers.h>
|
||||
@@ -44,9 +44,9 @@
|
||||
#include "../file_utils.hpp"
|
||||
namespace board {
|
||||
|
||||
SysClkSocType gSocType;
|
||||
HocClkSocType gSocType;
|
||||
u8 gDramID;
|
||||
HorizonOCConsoleType gConsoleType = HorizonOCConsoleType_Iowa;
|
||||
HocClkConsoleType gConsoleType = HocClkConsoleType_Iowa;
|
||||
FuseData fuseData;
|
||||
u8 speedoBracket;
|
||||
PwmChannelSession iCon;
|
||||
@@ -71,17 +71,17 @@ namespace board {
|
||||
|
||||
switch(sku) {
|
||||
case 2 ... 5:
|
||||
gSocType = SysClkSocType_Mariko;
|
||||
gSocType = HocClkSocType_Mariko;
|
||||
break;
|
||||
default:
|
||||
gSocType = SysClkSocType_Erista;
|
||||
gSocType = HocClkSocType_Erista;
|
||||
}
|
||||
|
||||
if (gSocType == SysClkSocType_Mariko) {
|
||||
if (gSocType == HocClkSocType_Mariko) {
|
||||
CacheGpuVoltTable();
|
||||
}
|
||||
|
||||
gConsoleType = static_cast<HorizonOCConsoleType>(sku);
|
||||
gConsoleType = static_cast<HocClkConsoleType>(sku);
|
||||
}
|
||||
|
||||
/* TODO: Check for config */
|
||||
@@ -153,7 +153,7 @@ namespace board {
|
||||
rc = svcQueryMemoryMapping(&dsiVirtAddr, &outsize, 0x54300000, 0x40000);
|
||||
ASSERT_RESULT_OK(rc, "svcQueryMemoryMapping (dsi)");
|
||||
|
||||
display::DisplayRefreshConfig cfg = {.clkVirtAddr = clkVirtAddr, .dsiVirtAddr = dsiVirtAddr, .isLite = (GetConsoleType() == HorizonOCConsoleType_Hoag), .isRetroSUPER = integrations::GetRETROSuperStatus()};
|
||||
display::DisplayRefreshConfig cfg = {.clkVirtAddr = clkVirtAddr, .dsiVirtAddr = dsiVirtAddr, .isLite = (GetConsoleType() == HocClkConsoleType_Hoag), .isRetroSUPER = integrations::GetRETROSuperStatus()};
|
||||
display::Initialize(&cfg);
|
||||
|
||||
CacheDfllData();
|
||||
@@ -189,11 +189,11 @@ namespace board {
|
||||
nvExit();
|
||||
}
|
||||
|
||||
SysClkSocType GetSocType() {
|
||||
HocClkSocType GetSocType() {
|
||||
return gSocType;
|
||||
}
|
||||
|
||||
HorizonOCConsoleType GetConsoleType() {
|
||||
HocClkConsoleType GetConsoleType() {
|
||||
return gConsoleType;
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ namespace board {
|
||||
|
||||
/* TODO: Put this into a different file. */
|
||||
void SetDisplayRefreshDockedState(bool docked) {
|
||||
if (GetConsoleType() != HorizonOCConsoleType_Hoag) {
|
||||
if (GetConsoleType() != HocClkConsoleType_Hoag) {
|
||||
display::SetDockedState(docked);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <switch.h>
|
||||
#include <sysclk.h>
|
||||
#include <hocclk.h>
|
||||
#include "board_fuse.hpp"
|
||||
#include "board_load.hpp"
|
||||
#include "board_name.hpp"
|
||||
@@ -43,8 +43,8 @@ namespace board {
|
||||
|
||||
void Initialize();
|
||||
void Exit();
|
||||
SysClkSocType GetSocType();
|
||||
HorizonOCConsoleType GetConsoleType();
|
||||
HocClkSocType GetSocType();
|
||||
HocClkConsoleType GetConsoleType();
|
||||
u8 GetDramID();
|
||||
u8 GetGpuSpeedoBracket();
|
||||
bool IsDram8GB();
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
#include <switch.h>
|
||||
#include <sysclk.h>
|
||||
#include <hocclk.h>
|
||||
#include <nxExt.h>
|
||||
#include "display_refresh_rate.hpp"
|
||||
#include "board.hpp"
|
||||
@@ -34,24 +34,24 @@
|
||||
|
||||
namespace board {
|
||||
|
||||
PcvModule GetPcvModule(SysClkModule sysclkModule) {
|
||||
switch (sysclkModule) {
|
||||
case SysClkModule_CPU:
|
||||
PcvModule GetPcvModule(HocClkModule hocclkModule) {
|
||||
switch (hocclkModule) {
|
||||
case HocClkModule_CPU:
|
||||
return PcvModule_CpuBus;
|
||||
case SysClkModule_GPU:
|
||||
case HocClkModule_GPU:
|
||||
return PcvModule_GPU;
|
||||
case SysClkModule_MEM:
|
||||
case HocClkModule_MEM:
|
||||
return PcvModule_EMC;
|
||||
default:
|
||||
ASSERT_ENUM_VALID(SysClkModule, sysclkModule);
|
||||
ASSERT_ENUM_VALID(HocClkModule, hocclkModule);
|
||||
}
|
||||
|
||||
return static_cast<PcvModule>(0);
|
||||
}
|
||||
|
||||
PcvModuleId GetPcvModuleId(SysClkModule sysclkModule) {
|
||||
PcvModuleId GetPcvModuleId(HocClkModule hocclkModule) {
|
||||
PcvModuleId pcvModuleId;
|
||||
Result rc = pcvGetModuleId(&pcvModuleId, GetPcvModule(sysclkModule));
|
||||
Result rc = pcvGetModuleId(&pcvModuleId, GetPcvModule(hocclkModule));
|
||||
ASSERT_RESULT_OK(rc, "pcvGetModuleId");
|
||||
|
||||
return pcvModuleId;
|
||||
@@ -65,12 +65,12 @@ namespace board {
|
||||
ASSERT_RESULT_OK(pcvSetClockRate(moduleID, hz), "pcvSetClockRate");
|
||||
}
|
||||
|
||||
void SetHz(SysClkModule module, u32 hz) {
|
||||
void SetHz(HocClkModule module, u32 hz) {
|
||||
Result rc = 0;
|
||||
bool usesGovenor = module > SysClkModule_MEM;
|
||||
bool usesGovenor = module > HocClkModule_MEM;
|
||||
|
||||
|
||||
if (module == HorizonOCModule_Display) {
|
||||
if (module == HocClkModule_Display) {
|
||||
display::SetRate(hz);
|
||||
return;
|
||||
}
|
||||
@@ -86,7 +86,7 @@ namespace board {
|
||||
ClkrstSetHz(session, hz);
|
||||
|
||||
/* Voltage bug workaround. */
|
||||
if (module == SysClkModule_CPU) {
|
||||
if (module == HocClkModule_CPU) {
|
||||
svcSleepThread(250'000);
|
||||
ClkrstSetHz(session, hz);
|
||||
}
|
||||
@@ -95,7 +95,7 @@ namespace board {
|
||||
} else {
|
||||
PcvSetHz(GetPcvModule(module), hz);
|
||||
|
||||
if (module == SysClkModule_CPU) {
|
||||
if (module == HocClkModule_CPU) {
|
||||
svcSleepThread(250'000);
|
||||
PcvSetHz(GetPcvModule(module), hz);
|
||||
}
|
||||
@@ -107,11 +107,11 @@ namespace board {
|
||||
return hz;
|
||||
}
|
||||
|
||||
u32 GetHz(SysClkModule module) {
|
||||
u32 GetHz(HocClkModule module) {
|
||||
Result rc = 0;
|
||||
u32 hz = 0;
|
||||
|
||||
if (module == HorizonOCModule_Display) {
|
||||
if (module == HocClkModule_Display) {
|
||||
return GetDisplayRate(hz);
|
||||
}
|
||||
|
||||
@@ -133,26 +133,26 @@ namespace board {
|
||||
return hz;
|
||||
}
|
||||
|
||||
u32 GetRealHz(SysClkModule module) {
|
||||
u32 GetRealHz(HocClkModule module) {
|
||||
u32 hz = 0;
|
||||
switch (module) {
|
||||
case SysClkModule_CPU:
|
||||
case HocClkModule_CPU:
|
||||
return t210ClkCpuFreq();
|
||||
case SysClkModule_GPU:
|
||||
case HocClkModule_GPU:
|
||||
return t210ClkGpuFreq();
|
||||
case SysClkModule_MEM:
|
||||
case HocClkModule_MEM:
|
||||
return t210ClkMemFreq();
|
||||
case HorizonOCModule_Display:
|
||||
case HocClkModule_Display:
|
||||
return GetDisplayRate(hz);
|
||||
return hz;
|
||||
default:
|
||||
ASSERT_ENUM_VALID(SysClkModule, module);
|
||||
ASSERT_ENUM_VALID(HocClkModule, module);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void GetFreqList(SysClkModule module, u32 *outList, u32 maxCount, u32 *outCount) {
|
||||
void GetFreqList(HocClkModule module, u32 *outList, u32 maxCount, u32 *outCount) {
|
||||
Result rc = 0;
|
||||
PcvClockRatesListType type;
|
||||
s32 tmpInMaxCount = maxCount;
|
||||
@@ -182,7 +182,7 @@ namespace board {
|
||||
}
|
||||
|
||||
u32 GetHighestDockedDisplayRate() {
|
||||
if (GetConsoleType() != HorizonOCConsoleType_Hoag) {
|
||||
if (GetConsoleType() != HocClkConsoleType_Hoag) {
|
||||
return display::GetDockedHighestAllowed();
|
||||
}
|
||||
|
||||
@@ -196,10 +196,10 @@ namespace board {
|
||||
rc = apmExtGetCurrentPerformanceConfiguration(&confId);
|
||||
ASSERT_RESULT_OK(rc, "apmExtGetCurrentPerformanceConfiguration");
|
||||
|
||||
SysClkApmConfiguration* apmConfiguration = nullptr;
|
||||
for (size_t i = 0; sysclk_g_apm_configurations[i].id; ++i) {
|
||||
if(sysclk_g_apm_configurations[i].id == confId) {
|
||||
apmConfiguration = &sysclk_g_apm_configurations[i];
|
||||
HocClkApmConfiguration* apmConfiguration = nullptr;
|
||||
for (size_t i = 0; hocclk_g_apm_configurations[i].id; ++i) {
|
||||
if(hocclk_g_apm_configurations[i].id == confId) {
|
||||
apmConfiguration = &hocclk_g_apm_configurations[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -208,9 +208,9 @@ namespace board {
|
||||
ERROR_THROW("Unknown apm configuration: %x", confId);
|
||||
}
|
||||
|
||||
SetHz(SysClkModule_CPU, apmConfiguration->cpu_hz);
|
||||
SetHz(SysClkModule_GPU, apmConfiguration->gpu_hz);
|
||||
SetHz(SysClkModule_MEM, apmConfiguration->mem_hz);
|
||||
SetHz(HocClkModule_CPU, apmConfiguration->cpu_hz);
|
||||
SetHz(HocClkModule_GPU, apmConfiguration->gpu_hz);
|
||||
SetHz(HocClkModule_MEM, apmConfiguration->mem_hz);
|
||||
} else {
|
||||
u32 mode = 0;
|
||||
rc = apmExtGetPerformanceMode(&mode);
|
||||
@@ -222,7 +222,7 @@ namespace board {
|
||||
}
|
||||
|
||||
void ResetToStockDisplay() {
|
||||
if (GetConsoleType() != HorizonOCConsoleType_Hoag) {
|
||||
if (GetConsoleType() != HocClkConsoleType_Hoag) {
|
||||
display::SetRate(60);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,24 +26,24 @@
|
||||
|
||||
#pragma once
|
||||
#include <switch.h>
|
||||
#include <sysclk.h>
|
||||
#include <hocclk.h>
|
||||
#include <nxExt.h>
|
||||
#include "../errors.hpp"
|
||||
|
||||
namespace board {
|
||||
|
||||
void SetHz(SysClkModule module, u32 hz);
|
||||
void SetHz(HocClkModule module, u32 hz);
|
||||
|
||||
u32 GetHz(SysClkModule module);
|
||||
u32 GetRealHz(SysClkModule module);
|
||||
void GetFreqList(SysClkModule module, u32 *outList, u32 maxCount, u32 *outCount);
|
||||
u32 GetHz(HocClkModule module);
|
||||
u32 GetRealHz(HocClkModule module);
|
||||
void GetFreqList(HocClkModule module, u32 *outList, u32 maxCount, u32 *outCount);
|
||||
u32 GetHighestDockedDisplayRate();
|
||||
|
||||
void ResetToStock();
|
||||
void ResetToStockDisplay();
|
||||
|
||||
template <typename Getter>
|
||||
void ResetToStockModule(Getter getHzFunc, SysClkModule module) {
|
||||
void ResetToStockModule(Getter getHzFunc, HocClkModule module) {
|
||||
Result rc = 0;
|
||||
|
||||
if (hosversionAtLeast(9, 0, 0)) {
|
||||
@@ -51,11 +51,11 @@ namespace board {
|
||||
rc = apmExtGetCurrentPerformanceConfiguration(&confId);
|
||||
ASSERT_RESULT_OK(rc, "apmExtGetCurrentPerformanceConfiguration");
|
||||
|
||||
SysClkApmConfiguration* apmConfiguration = nullptr;
|
||||
for (size_t i = 0; sysclk_g_apm_configurations[i].id; ++i) {
|
||||
HocClkApmConfiguration* apmConfiguration = nullptr;
|
||||
for (size_t i = 0; hocclk_g_apm_configurations[i].id; ++i) {
|
||||
|
||||
if (sysclk_g_apm_configurations[i].id == confId) {
|
||||
apmConfiguration = &sysclk_g_apm_configurations[i];
|
||||
if (hocclk_g_apm_configurations[i].id == confId) {
|
||||
apmConfiguration = &hocclk_g_apm_configurations[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -76,15 +76,15 @@ namespace board {
|
||||
}
|
||||
|
||||
inline void ResetToStockCpu() {
|
||||
ResetToStockModule([](const SysClkApmConfiguration& cfg) {return cfg.cpu_hz; }, SysClkModule_CPU);
|
||||
ResetToStockModule([](const HocClkApmConfiguration& cfg) {return cfg.cpu_hz; }, HocClkModule_CPU);
|
||||
}
|
||||
|
||||
inline void ResetToStockGpu() {
|
||||
ResetToStockModule([](const SysClkApmConfiguration& cfg){ return cfg.gpu_hz; }, SysClkModule_GPU);
|
||||
ResetToStockModule([](const HocClkApmConfiguration& cfg){ return cfg.gpu_hz; }, HocClkModule_GPU);
|
||||
}
|
||||
|
||||
inline void ResetToStockMem() {
|
||||
ResetToStockModule([](const SysClkApmConfiguration& cfg){ return cfg.mem_hz; }, SysClkModule_MEM);
|
||||
ResetToStockModule([](const HocClkApmConfiguration& cfg){ return cfg.mem_hz; }, HocClkModule_MEM);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
#include <switch.h>
|
||||
#include <sysclk.h>
|
||||
#include <hocclk.h>
|
||||
#include <nxExt.h>
|
||||
#include <algorithm>
|
||||
#include <math.h>
|
||||
@@ -104,11 +104,11 @@ namespace board {
|
||||
return std::round(std::max({cpuUsage0, cpuUsage1, cpuUsage2}));
|
||||
}
|
||||
|
||||
u32 GetPartLoad(SysClkPartLoad loadSource) {
|
||||
u32 GetPartLoad(HocClkPartLoad loadSource) {
|
||||
switch(loadSource) {
|
||||
case SysClkPartLoad_EMC:
|
||||
case HocClkPartLoad_EMC:
|
||||
return t210EmcLoadAll();
|
||||
case SysClkPartLoad_EMCCpu:
|
||||
case HocClkPartLoad_EMCCpu:
|
||||
return t210EmcLoadCpu();
|
||||
case HocClkPartLoad_GPU:
|
||||
return gpuLoad;
|
||||
@@ -121,7 +121,7 @@ namespace board {
|
||||
case HocClkPartLoad_FAN:
|
||||
return GetFanLevel();
|
||||
default:
|
||||
ASSERT_ENUM_VALID(SysClkPartLoad, loadSource);
|
||||
ASSERT_ENUM_VALID(HocClkPartLoad, loadSource);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -26,13 +26,13 @@
|
||||
|
||||
#pragma once
|
||||
#include <switch.h>
|
||||
#include <sysclk.h>
|
||||
#include <hocclk.h>
|
||||
|
||||
namespace board {
|
||||
|
||||
void StartLoad(Result nvCheck, u32 fd);
|
||||
void ExitLoad();
|
||||
u32 GetPartLoad(SysClkPartLoad loadSource);
|
||||
u32 GetPartLoad(HocClkPartLoad loadSource);
|
||||
void SetGpuSchedulingMode(GpuSchedulingMode mode, GpuSchedulingOverrideMethod method);
|
||||
void SchedSetFD2(u32 fd2);
|
||||
void NvSchedSucceed(Result nvSched);
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <switch.h>
|
||||
#include <sysclk.h>
|
||||
#include <hocclk.h>
|
||||
#include <pwm.h>
|
||||
|
||||
namespace board {
|
||||
|
||||
@@ -25,29 +25,29 @@
|
||||
*/
|
||||
|
||||
#include <switch.h>
|
||||
#include <sysclk.h>
|
||||
#include <hocclk.h>
|
||||
#include "board.hpp"
|
||||
|
||||
namespace board {
|
||||
|
||||
const char *GetModuleName(SysClkModule module, bool pretty) {
|
||||
ASSERT_ENUM_VALID(SysClkModule, module);
|
||||
return sysclkFormatModule(module, pretty);
|
||||
const char *GetModuleName(HocClkModule module, bool pretty) {
|
||||
ASSERT_ENUM_VALID(HocClkModule, module);
|
||||
return hocclkFormatModule(module, pretty);
|
||||
}
|
||||
|
||||
const char *GetProfileName(SysClkProfile profile, bool pretty) {
|
||||
ASSERT_ENUM_VALID(SysClkProfile, profile);
|
||||
return sysclkFormatProfile(profile, pretty);
|
||||
const char *GetProfileName(HocClkProfile profile, bool pretty) {
|
||||
ASSERT_ENUM_VALID(HocClkProfile, profile);
|
||||
return hocclkFormatProfile(profile, pretty);
|
||||
}
|
||||
|
||||
const char *GetThermalSensorName(SysClkThermalSensor sensor, bool pretty) {
|
||||
ASSERT_ENUM_VALID(SysClkThermalSensor, sensor);
|
||||
return sysclkFormatThermalSensor(sensor, pretty);
|
||||
const char *GetThermalSensorName(HocClkThermalSensor sensor, bool pretty) {
|
||||
ASSERT_ENUM_VALID(HocClkThermalSensor, sensor);
|
||||
return hocclkFormatThermalSensor(sensor, pretty);
|
||||
}
|
||||
|
||||
const char *GetPowerSensorName(SysClkPowerSensor sensor, bool pretty) {
|
||||
ASSERT_ENUM_VALID(SysClkPowerSensor, sensor);
|
||||
return sysclkFormatPowerSensor(sensor, pretty);
|
||||
const char *GetPowerSensorName(HocClkPowerSensor sensor, bool pretty) {
|
||||
ASSERT_ENUM_VALID(HocClkPowerSensor, sensor);
|
||||
return hocclkFormatPowerSensor(sensor, pretty);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,13 +26,13 @@
|
||||
|
||||
#pragma once
|
||||
#include <switch.h>
|
||||
#include <sysclk.h>
|
||||
#include <hocclk.h>
|
||||
|
||||
namespace board {
|
||||
|
||||
const char *GetModuleName(SysClkModule module, bool pretty);
|
||||
const char *GetProfileName(SysClkProfile profile, bool pretty);
|
||||
const char *GetThermalSensorName(SysClkThermalSensor sensor, bool pretty);
|
||||
const char *GetPowerSensorName(SysClkPowerSensor sensor, bool pretty);
|
||||
const char *GetModuleName(HocClkModule module, bool pretty);
|
||||
const char *GetProfileName(HocClkProfile profile, bool pretty);
|
||||
const char *GetThermalSensorName(HocClkThermalSensor sensor, bool pretty);
|
||||
const char *GetPowerSensorName(HocClkPowerSensor sensor, bool pretty);
|
||||
|
||||
}
|
||||
|
||||
@@ -25,19 +25,19 @@
|
||||
*/
|
||||
|
||||
#include <switch.h>
|
||||
#include <sysclk.h>
|
||||
#include <hocclk.h>
|
||||
#include <nxExt.h>
|
||||
#include "board.hpp"
|
||||
|
||||
namespace board {
|
||||
|
||||
SysClkProfile GetProfile() {
|
||||
HocClkProfile GetProfile() {
|
||||
u32 mode = 0;
|
||||
Result rc = apmExtGetPerformanceMode(&mode);
|
||||
ASSERT_RESULT_OK(rc, "apmExtGetPerformanceMode");
|
||||
|
||||
if (mode) {
|
||||
return SysClkProfile_Docked;
|
||||
return HocClkProfile_Docked;
|
||||
}
|
||||
|
||||
PsmChargerType chargerType;
|
||||
@@ -46,12 +46,12 @@ namespace board {
|
||||
ASSERT_RESULT_OK(rc, "psmGetChargerType");
|
||||
|
||||
if (chargerType == PsmChargerType_EnoughPower) {
|
||||
return SysClkProfile_HandheldChargingOfficial;
|
||||
return HocClkProfile_HandheldChargingOfficial;
|
||||
} else if (chargerType == PsmChargerType_LowPower) {
|
||||
return SysClkProfile_HandheldChargingUSB;
|
||||
return HocClkProfile_HandheldChargingUSB;
|
||||
}
|
||||
|
||||
return SysClkProfile_Handheld;
|
||||
return HocClkProfile_Handheld;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <sysclk.h>
|
||||
#include <hocclk.h>
|
||||
|
||||
namespace board {
|
||||
|
||||
SysClkProfile GetProfile();
|
||||
HocClkProfile GetProfile();
|
||||
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <sysclk.h>
|
||||
#include <hocclk.h>
|
||||
#include <switch.h>
|
||||
#include <nxExt.h>
|
||||
#include <cmath>
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
namespace board {
|
||||
|
||||
s32 GetTemperatureMilli(SysClkThermalSensor sensor) {
|
||||
s32 GetTemperatureMilli(HocClkThermalSensor sensor) {
|
||||
s32 millis = 0;
|
||||
BatteryChargeInfo info;
|
||||
|
||||
@@ -43,15 +43,15 @@ namespace board {
|
||||
soctherm::ReadSensors(temps);
|
||||
|
||||
switch(sensor) {
|
||||
case SysClkThermalSensor_SOC: {
|
||||
case HocClkThermalSensor_SOC: {
|
||||
millis = tmp451TempSoc();
|
||||
break;
|
||||
}
|
||||
case SysClkThermalSensor_PCB: {
|
||||
case HocClkThermalSensor_PCB: {
|
||||
millis = tmp451TempPcb();
|
||||
break;
|
||||
}
|
||||
case SysClkThermalSensor_Skin: {
|
||||
case HocClkThermalSensor_Skin: {
|
||||
if (HOSSVC_HAS_TC) {
|
||||
Result rc;
|
||||
rc = tcGetSkinTemperatureMilliC(&millis);
|
||||
@@ -59,46 +59,46 @@ namespace board {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HorizonOCThermalSensor_Battery: {
|
||||
case HocClkThermalSensor_Battery: {
|
||||
batteryInfoGetChargeInfo(&info);
|
||||
millis = batteryInfoGetTemperatureMiliCelsius(&info);
|
||||
break;
|
||||
}
|
||||
case HorizonOCThermalSensor_PMIC: {
|
||||
case HocClkThermalSensor_PMIC: {
|
||||
millis = 50000;
|
||||
break;
|
||||
}
|
||||
case HorizonOCThermalSensor_CPU: {
|
||||
case HocClkThermalSensor_CPU: {
|
||||
millis = temps.cpu;
|
||||
break;
|
||||
}
|
||||
case HorizonOCThermalSensor_GPU: {
|
||||
case HocClkThermalSensor_GPU: {
|
||||
millis = temps.gpu;
|
||||
break;
|
||||
}
|
||||
case HorizonOCThermalSensor_MEM: {
|
||||
millis = board::GetSocType() == SysClkSocType_Mariko ? temps.pllx : temps.mem;
|
||||
case HocClkThermalSensor_MEM: {
|
||||
millis = board::GetSocType() == HocClkSocType_Mariko ? temps.pllx : temps.mem;
|
||||
break;
|
||||
}
|
||||
case HorizonOCThermalSensor_PLLX: {
|
||||
case HocClkThermalSensor_PLLX: {
|
||||
millis = temps.pllx;
|
||||
}
|
||||
default: {
|
||||
ASSERT_ENUM_VALID(SysClkThermalSensor, sensor);
|
||||
ASSERT_ENUM_VALID(HocClkThermalSensor, sensor);
|
||||
}
|
||||
}
|
||||
|
||||
return std::max(0, millis);
|
||||
}
|
||||
|
||||
s32 GetPowerMw(SysClkPowerSensor sensor) {
|
||||
s32 GetPowerMw(HocClkPowerSensor sensor) {
|
||||
switch (sensor) {
|
||||
case SysClkPowerSensor_Now:
|
||||
case HocClkPowerSensor_Now:
|
||||
return max17050PowerNow();
|
||||
case SysClkPowerSensor_Avg:
|
||||
case HocClkPowerSensor_Avg:
|
||||
return max17050PowerAvg();
|
||||
default:
|
||||
ASSERT_ENUM_VALID(SysClkPowerSensor, sensor);
|
||||
ASSERT_ENUM_VALID(HocClkPowerSensor, sensor);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <sysclk.h>
|
||||
#include <hocclk.h>
|
||||
#include <switch.h>
|
||||
|
||||
namespace board {
|
||||
|
||||
s32 GetTemperatureMilli(SysClkThermalSensor sensor);
|
||||
s32 GetPowerMw(SysClkPowerSensor sensor);
|
||||
s32 GetTemperatureMilli(HocClkThermalSensor sensor);
|
||||
s32 GetPowerMw(HocClkPowerSensor sensor);
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
#include <switch.h>
|
||||
#include <sysclk.h>
|
||||
#include <hocclk.h>
|
||||
#include <memmem.h>
|
||||
#include <registers.h>
|
||||
#include <cstring>
|
||||
@@ -100,11 +100,11 @@ namespace board {
|
||||
Result rc = svcQueryMemoryMapping(&cldvfs, &temp, CLDVFS_REGION_BASE, CLDVFS_REGION_SIZE);
|
||||
ASSERT_RESULT_OK(rc, "svcQueryMemoryMapping (cldvfs)");
|
||||
|
||||
if (GetSocType() == SysClkSocType_Erista) {
|
||||
if (GetSocType() == HocClkSocType_Erista) {
|
||||
cachedTune.tune0Low = *reinterpret_cast<u32 *>(cldvfs + CL_DVFS_TUNE0_0);
|
||||
cachedTune.tune1Low = *reinterpret_cast<u32 *>(cldvfs + CL_DVFS_TUNE1_0);
|
||||
} else {
|
||||
SetHz(SysClkModule_CPU, 1785000000);
|
||||
SetHz(HocClkModule_CPU, 1785000000);
|
||||
cachedTune.tune0High = *reinterpret_cast<u32 *>(cldvfs + CL_DVFS_TUNE0_0);
|
||||
ResetToStockCpu();
|
||||
}
|
||||
@@ -114,8 +114,8 @@ namespace board {
|
||||
void SetDfllTunings(u32 levelLow, u32 levelHigh, u32 tbreakPoint) {
|
||||
u32* tune0_ptr = reinterpret_cast<u32 *>(cldvfs + CL_DVFS_TUNE0_0);
|
||||
u32* tune1_ptr = reinterpret_cast<u32 *>(cldvfs + CL_DVFS_TUNE1_0);
|
||||
if (GetSocType() == SysClkSocType_Mariko) {
|
||||
if (GetHz(SysClkModule_CPU) < tbreakPoint && (levelLow || levelHigh)) {
|
||||
if (GetSocType() == HocClkSocType_Mariko) {
|
||||
if (GetHz(HocClkModule_CPU) < tbreakPoint && (levelLow || levelHigh)) {
|
||||
if (levelLow) {
|
||||
*tune0_ptr = marikoCpuUvLow[levelLow-1].tune0_low;
|
||||
*tune1_ptr = marikoCpuUvLow[levelLow-1].tune1_low;
|
||||
@@ -132,17 +132,17 @@ namespace board {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (GetHz(SysClkModule_CPU) < tbreakPoint || (!levelLow)) { // account for tbreak
|
||||
if (GetHz(HocClkModule_CPU) < tbreakPoint || (!levelLow)) { // account for tbreak
|
||||
*tune0_ptr = 0xCFFF;
|
||||
*tune1_ptr = 0xFF072201;
|
||||
return;
|
||||
} else if (GetHz(SysClkModule_CPU) >= tbreakPoint || (!levelHigh)) {
|
||||
} else if (GetHz(HocClkModule_CPU) >= tbreakPoint || (!levelHigh)) {
|
||||
*tune0_ptr = cachedTune.tune0High; // per console?
|
||||
*tune1_ptr = 0xFFF7FF3F;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (GetHz(SysClkModule_CPU) < tbreakPoint || (!levelLow)) { // account for tbreak
|
||||
if (GetHz(HocClkModule_CPU) < tbreakPoint || (!levelLow)) { // account for tbreak
|
||||
*tune0_ptr = cachedTune.tune0Low; // I think each erista has a different tune0/tune1?
|
||||
*tune1_ptr = cachedTune.tune1Low;
|
||||
return;
|
||||
@@ -167,7 +167,7 @@ namespace board {
|
||||
};
|
||||
*/
|
||||
u32 CalculateTbreak(u32 table) {
|
||||
if (GetSocType() == SysClkSocType_Erista) {
|
||||
if (GetSocType() == HocClkSocType_Erista) {
|
||||
return 1581000000;
|
||||
} else {
|
||||
switch (table) {
|
||||
@@ -241,7 +241,7 @@ namespace board {
|
||||
rgltrCloseSession(&session);
|
||||
break;
|
||||
case HocClkVoltage_CPU:
|
||||
if (GetSocType() == SysClkSocType_Mariko) {
|
||||
if (GetSocType() == HocClkSocType_Mariko) {
|
||||
rc = rgltrOpenSession(&session, PcvPowerDomainId_Max77621_Cpu);
|
||||
} else {
|
||||
rc = rgltrOpenSession(&session, PcvPowerDomainId_Max77812_Cpu);
|
||||
@@ -251,7 +251,7 @@ namespace board {
|
||||
rgltrCloseSession(&session);
|
||||
break;
|
||||
case HocClkVoltage_GPU:
|
||||
if (GetSocType() == SysClkSocType_Mariko) {
|
||||
if (GetSocType() == HocClkSocType_Mariko) {
|
||||
rc = rgltrOpenSession(&session, PcvPowerDomainId_Max77621_Gpu);
|
||||
} else {
|
||||
rc = rgltrOpenSession(&session, PcvPowerDomainId_Max77812_Gpu);
|
||||
@@ -261,7 +261,7 @@ namespace board {
|
||||
rgltrCloseSession(&session);
|
||||
break;
|
||||
case HocClkVoltage_EMCVDDQ:
|
||||
if (GetSocType() == SysClkSocType_Mariko) {
|
||||
if (GetSocType() == HocClkSocType_Mariko) {
|
||||
rc = rgltrOpenSession(&session, PcvPowerDomainId_Max77812_Dram);
|
||||
ASSERT_RESULT_OK(rc, "rgltrOpenSession")
|
||||
rgltrGetVoltage(&session, &out);
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#pragma once
|
||||
#include <switch.h>
|
||||
#include <sysclk.h>
|
||||
#include <hocclk.h>
|
||||
|
||||
namespace board {
|
||||
|
||||
|
||||
@@ -49,36 +49,36 @@ namespace clockManager {
|
||||
|
||||
bool gRunning = false;
|
||||
LockableMutex gContextMutex;
|
||||
SysClkContext gContext = {};
|
||||
FreqTable gFreqTable[SysClkModule_EnumMax];
|
||||
HocClkContext gContext = {};
|
||||
FreqTable gFreqTable[HocClkModule_EnumMax];
|
||||
std::uint64_t gLastTempLogNs = 0;
|
||||
std::uint64_t gLastFreqLogNs = 0;
|
||||
std::uint64_t gLastPowerLogNs = 0;
|
||||
std::uint64_t gLastCsvWriteNs = 0;
|
||||
|
||||
bool IsAssignableHz(SysClkModule module, std::uint32_t hz)
|
||||
bool IsAssignableHz(HocClkModule module, std::uint32_t hz)
|
||||
{
|
||||
switch (module) {
|
||||
case SysClkModule_CPU:
|
||||
case HocClkModule_CPU:
|
||||
return hz >= 500000000;
|
||||
case SysClkModule_MEM:
|
||||
case HocClkModule_MEM:
|
||||
return hz >= 665600000;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
std::uint32_t GetMaxAllowedHz(SysClkModule module, SysClkProfile profile)
|
||||
std::uint32_t GetMaxAllowedHz(HocClkModule module, HocClkProfile profile)
|
||||
{
|
||||
if (config::GetConfigValue(HocClkConfigValue_UncappedClocks)) {
|
||||
return ~0; // Integer limit, uncapped clocks ON
|
||||
} else {
|
||||
if (module == SysClkModule_GPU) {
|
||||
if (profile < SysClkProfile_HandheldCharging) {
|
||||
if (module == HocClkModule_GPU) {
|
||||
if (profile < HocClkProfile_HandheldCharging) {
|
||||
switch (board::GetSocType()) {
|
||||
case SysClkSocType_Erista:
|
||||
case HocClkSocType_Erista:
|
||||
return 460800000;
|
||||
case SysClkSocType_Mariko:
|
||||
case HocClkSocType_Mariko:
|
||||
switch (config::GetConfigValue(KipConfigValue_marikoGpuUV)) {
|
||||
case 0:
|
||||
return 614400000;
|
||||
@@ -92,11 +92,11 @@ namespace clockManager {
|
||||
default:
|
||||
return 460800000;
|
||||
}
|
||||
} else if (profile <= SysClkProfile_HandheldChargingUSB) {
|
||||
} else if (profile <= HocClkProfile_HandheldChargingUSB) {
|
||||
switch (board::GetSocType()) {
|
||||
case SysClkSocType_Erista:
|
||||
case HocClkSocType_Erista:
|
||||
return 768000000;
|
||||
case SysClkSocType_Mariko:
|
||||
case HocClkSocType_Mariko:
|
||||
switch (config::GetConfigValue(KipConfigValue_marikoGpuUV)) {
|
||||
case 0:
|
||||
return 844800000;
|
||||
@@ -111,8 +111,8 @@ namespace clockManager {
|
||||
return 768000000;
|
||||
}
|
||||
}
|
||||
} else if (module == SysClkModule_CPU) {
|
||||
if (profile < SysClkProfile_HandheldCharging && board::GetSocType() == SysClkSocType_Erista) {
|
||||
} else if (module == HocClkModule_CPU) {
|
||||
if (profile < HocClkProfile_HandheldCharging && board::GetSocType() == HocClkSocType_Erista) {
|
||||
return 1581000000;
|
||||
} else {
|
||||
return ~0;
|
||||
@@ -122,7 +122,7 @@ namespace clockManager {
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::uint32_t GetNearestHz(SysClkModule module, std::uint32_t inHz, std::uint32_t maxHz)
|
||||
std::uint32_t GetNearestHz(HocClkModule module, std::uint32_t inHz, std::uint32_t maxHz)
|
||||
{
|
||||
std::uint32_t *freqs = &gFreqTable[module].list[0];
|
||||
size_t count = gFreqTable[module].count - 1;
|
||||
@@ -144,8 +144,8 @@ namespace clockManager {
|
||||
void ResetToStockClocks()
|
||||
{
|
||||
board::ResetToStockCpu();
|
||||
if (config::GetConfigValue(HorizonOCConfigValue_LiveCpuUv)) {
|
||||
if (board::GetSocType() == SysClkSocType_Erista)
|
||||
if (config::GetConfigValue(HocClkConfigValue_LiveCpuUv)) {
|
||||
if (board::GetSocType() == HocClkSocType_Erista)
|
||||
board::SetDfllTunings(config::GetConfigValue(KipConfigValue_eristaCpuUV), 0, 1581000000);
|
||||
else
|
||||
board::SetDfllTunings(config::GetConfigValue(KipConfigValue_marikoCpuUVLow), config::GetConfigValue(KipConfigValue_marikoCpuUVHigh), board::CalculateTbreak(config::GetConfigValue(KipConfigValue_tableConf)));
|
||||
@@ -154,7 +154,7 @@ namespace clockManager {
|
||||
board::ResetToStockGpu();
|
||||
}
|
||||
|
||||
bool ConfigIntervalTimeout(SysClkConfigValue intervalMsConfigValue, std::uint64_t ns, std::uint64_t *lastLogNs)
|
||||
bool ConfigIntervalTimeout(HocClkConfigValue intervalMsConfigValue, std::uint64_t ns, std::uint64_t *lastLogNs)
|
||||
{
|
||||
std::uint64_t logInterval = config::GetConfigValue(intervalMsConfigValue) * 1000000ULL;
|
||||
bool shouldLog = logInterval && ((ns - *lastLogNs) > logInterval);
|
||||
@@ -166,15 +166,15 @@ namespace clockManager {
|
||||
return shouldLog;
|
||||
}
|
||||
|
||||
void RefreshFreqTableRow(SysClkModule module)
|
||||
void RefreshFreqTableRow(HocClkModule module)
|
||||
{
|
||||
std::scoped_lock lock{gContextMutex};
|
||||
|
||||
std::uint32_t freqs[SYSCLK_FREQ_LIST_MAX];
|
||||
std::uint32_t freqs[HOCCLK_FREQ_LIST_MAX];
|
||||
std::uint32_t count;
|
||||
|
||||
fileUtils::LogLine("[mgr] %s freq list refresh", board::GetModuleName(module, true));
|
||||
board::GetFreqList(module, &freqs[0], SYSCLK_FREQ_LIST_MAX, &count);
|
||||
board::GetFreqList(module, &freqs[0], HOCCLK_FREQ_LIST_MAX, &count);
|
||||
|
||||
std::uint32_t *hz = &gFreqTable[module].list[0];
|
||||
gFreqTable[module].count = 0;
|
||||
@@ -195,14 +195,14 @@ namespace clockManager {
|
||||
|
||||
void HandleSafetyFeatures()
|
||||
{
|
||||
if (config::GetConfigValue(HocClkConfigValue_HandheldTDP) && (gContext.profile != SysClkProfile_Docked)) {
|
||||
if (board::GetConsoleType() == HorizonOCConsoleType_Hoag) {
|
||||
if (board::GetPowerMw(SysClkPowerSensor_Avg) < -(int)config::GetConfigValue(HocClkConfigValue_LiteTDPLimit)) {
|
||||
if (config::GetConfigValue(HocClkConfigValue_HandheldTDP) && (gContext.profile != HocClkProfile_Docked)) {
|
||||
if (board::GetConsoleType() == HocClkConsoleType_Hoag) {
|
||||
if (board::GetPowerMw(HocClkPowerSensor_Avg) < -(int)config::GetConfigValue(HocClkConfigValue_LiteTDPLimit)) {
|
||||
ResetToStockClocks();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (board::GetPowerMw(SysClkPowerSensor_Avg) < -(int)config::GetConfigValue(HocClkConfigValue_HandheldTDPLimit)) {
|
||||
if (board::GetPowerMw(HocClkPowerSensor_Avg) < -(int)config::GetConfigValue(HocClkConfigValue_HandheldTDPLimit)) {
|
||||
ResetToStockClocks();
|
||||
return;
|
||||
}
|
||||
@@ -217,14 +217,14 @@ namespace clockManager {
|
||||
|
||||
void HandleMiscFeatures()
|
||||
{
|
||||
if (config::GetConfigValue(HorizonOCConfigValue_BatteryChargeCurrent)) {
|
||||
I2c_Bq24193_SetFastChargeCurrentLimit(config::GetConfigValue(HorizonOCConfigValue_BatteryChargeCurrent));
|
||||
if (config::GetConfigValue(HocClkConfigValue_BatteryChargeCurrent)) {
|
||||
I2c_Bq24193_SetFastChargeCurrentLimit(config::GetConfigValue(HocClkConfigValue_BatteryChargeCurrent));
|
||||
}
|
||||
}
|
||||
|
||||
void DVFSBeforeSet(u32 targetHz)
|
||||
{
|
||||
s32 dvfsOffset = config::GetConfigValue(HorizonOCConfigValue_DVFSOffset);
|
||||
s32 dvfsOffset = config::GetConfigValue(HocClkConfigValue_DVFSOffset);
|
||||
u32 vmin = board::GetMinimumGpuVmin(targetHz / 1000000, board::GetGpuSpeedoBracket()) + dvfsOffset;
|
||||
|
||||
board::PcvHijackGpuVolts(vmin);
|
||||
@@ -239,7 +239,7 @@ namespace clockManager {
|
||||
|
||||
void DVFSAfterSet(u32 targetHz)
|
||||
{
|
||||
s32 dvfsOffset = config::GetConfigValue(HorizonOCConfigValue_DVFSOffset);
|
||||
s32 dvfsOffset = config::GetConfigValue(HocClkConfigValue_DVFSOffset);
|
||||
dvfsOffset = std::max(dvfsOffset, -80);
|
||||
u32 vmin = board::GetMinimumGpuVmin(targetHz / 1000000, board::GetGpuSpeedoBracket());
|
||||
|
||||
@@ -247,22 +247,22 @@ namespace clockManager {
|
||||
vmin += dvfsOffset;
|
||||
}
|
||||
|
||||
u32 maxHz = GetMaxAllowedHz(SysClkModule_GPU, gContext.profile);
|
||||
u32 nearestHz = GetNearestHz(SysClkModule_GPU, targetHz, maxHz);
|
||||
u32 maxHz = GetMaxAllowedHz(HocClkModule_GPU, gContext.profile);
|
||||
u32 nearestHz = GetNearestHz(HocClkModule_GPU, targetHz, maxHz);
|
||||
board::PcvHijackGpuVolts(vmin);
|
||||
|
||||
if (targetHz) {
|
||||
board::SetHz(SysClkModule_GPU, ~0);
|
||||
board::SetHz(SysClkModule_GPU, nearestHz);
|
||||
board::SetHz(HocClkModule_GPU, ~0);
|
||||
board::SetHz(HocClkModule_GPU, nearestHz);
|
||||
} else {
|
||||
board::SetHz(SysClkModule_GPU, ~0);
|
||||
board::SetHz(HocClkModule_GPU, ~0);
|
||||
board::ResetToStockGpu();
|
||||
}
|
||||
}
|
||||
|
||||
void HandleCpuUv()
|
||||
{
|
||||
if (board::GetSocType() == SysClkSocType_Erista)
|
||||
if (board::GetSocType() == HocClkSocType_Erista)
|
||||
board::SetDfllTunings(config::GetConfigValue(KipConfigValue_eristaCpuUV), 0, 1581000000);
|
||||
else
|
||||
board::SetDfllTunings(config::GetConfigValue(KipConfigValue_marikoCpuUVLow), config::GetConfigValue(KipConfigValue_marikoCpuUVHigh), board::CalculateTbreak(config::GetConfigValue(KipConfigValue_tableConf)));
|
||||
@@ -270,50 +270,50 @@ namespace clockManager {
|
||||
|
||||
void DVFSReset()
|
||||
{
|
||||
if (board::GetSocType() == SysClkSocType_Mariko && config::GetConfigValue(HorizonOCConfigValue_DVFSMode) == DVFSMode_Hijack) {
|
||||
if (board::GetSocType() == HocClkSocType_Mariko && config::GetConfigValue(HocClkConfigValue_DVFSMode) == DVFSMode_Hijack) {
|
||||
board::PcvHijackGpuVolts(0);
|
||||
|
||||
u32 targetHz = gContext.overrideFreqs[SysClkModule_GPU];
|
||||
u32 targetHz = gContext.overrideFreqs[HocClkModule_GPU];
|
||||
if (!targetHz) {
|
||||
targetHz = config::GetAutoClockHz(gContext.applicationId, SysClkModule_GPU, gContext.profile, false);
|
||||
targetHz = config::GetAutoClockHz(gContext.applicationId, HocClkModule_GPU, gContext.profile, false);
|
||||
if (!targetHz) {
|
||||
targetHz = config::GetAutoClockHz(GLOBAL_PROFILE_ID, SysClkModule_GPU, gContext.profile, false);
|
||||
targetHz = config::GetAutoClockHz(GLOBAL_PROFILE_ID, HocClkModule_GPU, gContext.profile, false);
|
||||
}
|
||||
}
|
||||
u32 maxHz = GetMaxAllowedHz(SysClkModule_GPU, gContext.profile);
|
||||
u32 nearestHz = GetNearestHz(SysClkModule_GPU, targetHz, maxHz);
|
||||
u32 maxHz = GetMaxAllowedHz(HocClkModule_GPU, gContext.profile);
|
||||
u32 nearestHz = GetNearestHz(HocClkModule_GPU, targetHz, maxHz);
|
||||
|
||||
board::SetHz(SysClkModule_GPU, ~0);
|
||||
board::SetHz(HocClkModule_GPU, ~0);
|
||||
if (targetHz) {
|
||||
board::SetHz(SysClkModule_GPU, nearestHz);
|
||||
board::SetHz(HocClkModule_GPU, nearestHz);
|
||||
} else {
|
||||
board::ResetToStockGpu();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HandleFreqReset(SysClkModule module, bool isBoost)
|
||||
void HandleFreqReset(HocClkModule module, bool isBoost)
|
||||
{
|
||||
switch (module) {
|
||||
case SysClkModule_CPU:
|
||||
case HocClkModule_CPU:
|
||||
if (!(isBoost || (config::GetConfigValue(HocClkConfigValue_OverwriteBoostMode) && isBoost)))
|
||||
board::ResetToStockCpu();
|
||||
if (config::GetConfigValue(HorizonOCConfigValue_LiveCpuUv)) {
|
||||
if (board::GetSocType() == SysClkSocType_Erista)
|
||||
if (config::GetConfigValue(HocClkConfigValue_LiveCpuUv)) {
|
||||
if (board::GetSocType() == HocClkSocType_Erista)
|
||||
board::SetDfllTunings(config::GetConfigValue(KipConfigValue_eristaCpuUV), 0, 1581000000);
|
||||
else
|
||||
board::SetDfllTunings(config::GetConfigValue(KipConfigValue_marikoCpuUVLow), config::GetConfigValue(KipConfigValue_marikoCpuUVHigh), board::CalculateTbreak(config::GetConfigValue(KipConfigValue_tableConf)));
|
||||
}
|
||||
break;
|
||||
case SysClkModule_GPU:
|
||||
case HocClkModule_GPU:
|
||||
board::ResetToStockGpu();
|
||||
break;
|
||||
case SysClkModule_MEM:
|
||||
case HocClkModule_MEM:
|
||||
board::ResetToStockMem();
|
||||
DVFSReset();
|
||||
break;
|
||||
case HorizonOCModule_Display:
|
||||
if (config::GetConfigValue(HorizonOCConfigValue_OverwriteRefreshRate)) {
|
||||
case HocClkModule_Display:
|
||||
if (config::GetConfigValue(HocClkConfigValue_OverwriteRefreshRate)) {
|
||||
board::ResetToStockDisplay();
|
||||
}
|
||||
break;
|
||||
@@ -329,87 +329,87 @@ namespace clockManager {
|
||||
std::uint32_t nearestHz = 0;
|
||||
|
||||
if (isBoost && !config::GetConfigValue(HocClkConfigValue_OverwriteBoostMode)) {
|
||||
u32 boostFreq = board::GetHz(SysClkModule_CPU);
|
||||
u32 boostFreq = board::GetHz(HocClkModule_CPU);
|
||||
if (boostFreq / 1000000 > 1785) {
|
||||
board::SetHz(SysClkModule_CPU, boostFreq);
|
||||
board::SetHz(HocClkModule_CPU, boostFreq);
|
||||
}
|
||||
return; // Return if we aren't overwriting boost mode
|
||||
}
|
||||
|
||||
bool returnRaw = false; // Return a value scaled to MHz instead of raw value
|
||||
for (unsigned int module = 0; module < SysClkModule_EnumMax; module++) {
|
||||
u32 oldHz = board::GetHz((SysClkModule)module); // Get Old hz (used primarily for DVFS Logic)
|
||||
for (unsigned int module = 0; module < HocClkModule_EnumMax; module++) {
|
||||
u32 oldHz = board::GetHz((HocClkModule)module); // Get Old hz (used primarily for DVFS Logic)
|
||||
|
||||
if (module > SysClkModule_MEM)
|
||||
if (module > HocClkModule_MEM)
|
||||
returnRaw = true;
|
||||
else
|
||||
returnRaw = false;
|
||||
targetHz = gContext.overrideFreqs[module];
|
||||
if (!targetHz) {
|
||||
targetHz = config::GetAutoClockHz(gContext.applicationId, (SysClkModule)module, gContext.profile, returnRaw);
|
||||
targetHz = config::GetAutoClockHz(gContext.applicationId, (HocClkModule)module, gContext.profile, returnRaw);
|
||||
if (!targetHz)
|
||||
targetHz = config::GetAutoClockHz(GLOBAL_PROFILE_ID, (SysClkModule)module, gContext.profile, returnRaw);
|
||||
targetHz = config::GetAutoClockHz(GLOBAL_PROFILE_ID, (HocClkModule)module, gContext.profile, returnRaw);
|
||||
}
|
||||
|
||||
if (module == HorizonOCModule_Governor) {
|
||||
if (module == HocClkModule_Governor) {
|
||||
governor::HandleGovernor(targetHz);
|
||||
}
|
||||
|
||||
bool noCPU = governor::isCpuGovernorEnabled;
|
||||
bool noGPU = governor::isGpuGovernorEnabled;
|
||||
bool noDisp = governor::isVRREnabled;
|
||||
if (noDisp && module == HorizonOCModule_Display)
|
||||
if (noDisp && module == HocClkModule_Display)
|
||||
continue;
|
||||
|
||||
if (module == HorizonOCModule_Display && config::GetConfigValue(HorizonOCConfigValue_OverwriteRefreshRate) && !noDisp) {
|
||||
if (module == HocClkModule_Display && config::GetConfigValue(HocClkConfigValue_OverwriteRefreshRate) && !noDisp) {
|
||||
if (targetHz) {
|
||||
board::SetHz(HorizonOCModule_Display, targetHz);
|
||||
gContext.freqs[HorizonOCModule_Display] = targetHz;
|
||||
gContext.realFreqs[HorizonOCModule_Display] = targetHz;
|
||||
board::SetHz(HocClkModule_Display, targetHz);
|
||||
gContext.freqs[HocClkModule_Display] = targetHz;
|
||||
gContext.realFreqs[HocClkModule_Display] = targetHz;
|
||||
} else {
|
||||
HandleFreqReset(HorizonOCModule_Display, isBoost);
|
||||
HandleFreqReset(HocClkModule_Display, isBoost);
|
||||
}
|
||||
}
|
||||
|
||||
// Skip GPU and CPU if governors handle them
|
||||
if (module > SysClkModule_MEM) {
|
||||
if (module > HocClkModule_MEM) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (noCPU && module == SysClkModule_CPU)
|
||||
if (noCPU && module == HocClkModule_CPU)
|
||||
continue;
|
||||
if (noGPU && module == SysClkModule_GPU)
|
||||
if (noGPU && module == HocClkModule_GPU)
|
||||
continue;
|
||||
|
||||
if (targetHz) {
|
||||
maxHz = GetMaxAllowedHz((SysClkModule)module, gContext.profile);
|
||||
nearestHz = GetNearestHz((SysClkModule)module, targetHz, maxHz);
|
||||
maxHz = GetMaxAllowedHz((HocClkModule)module, gContext.profile);
|
||||
nearestHz = GetNearestHz((HocClkModule)module, targetHz, maxHz);
|
||||
|
||||
if (nearestHz != gContext.freqs[module]) {
|
||||
fileUtils::LogLine(
|
||||
"[mgr] %s clock set : %u.%u MHz (target = %u.%u MHz)",
|
||||
board::GetModuleName((SysClkModule)module, true),
|
||||
board::GetModuleName((HocClkModule)module, true),
|
||||
nearestHz / 1000000, nearestHz / 100000 - nearestHz / 1000000 * 10,
|
||||
targetHz / 1000000, targetHz / 100000 - targetHz / 1000000 * 10
|
||||
);
|
||||
|
||||
if (module == SysClkModule_MEM && board::GetSocType() == SysClkSocType_Mariko && targetHz > oldHz && config::GetConfigValue(HorizonOCConfigValue_DVFSMode) == DVFSMode_Hijack) {
|
||||
if (module == HocClkModule_MEM && board::GetSocType() == HocClkSocType_Mariko && targetHz > oldHz && config::GetConfigValue(HocClkConfigValue_DVFSMode) == DVFSMode_Hijack) {
|
||||
DVFSBeforeSet(targetHz);
|
||||
}
|
||||
|
||||
board::SetHz((SysClkModule)module, nearestHz);
|
||||
board::SetHz((HocClkModule)module, nearestHz);
|
||||
gContext.freqs[module] = nearestHz;
|
||||
|
||||
if (module == SysClkModule_CPU && config::GetConfigValue(HorizonOCConfigValue_LiveCpuUv)) {
|
||||
if (module == HocClkModule_CPU && config::GetConfigValue(HocClkConfigValue_LiveCpuUv)) {
|
||||
HandleCpuUv();
|
||||
}
|
||||
|
||||
if (module == SysClkModule_MEM && board::GetSocType() == SysClkSocType_Mariko && targetHz < oldHz && config::GetConfigValue(HorizonOCConfigValue_DVFSMode) == DVFSMode_Hijack) {
|
||||
if (module == HocClkModule_MEM && board::GetSocType() == HocClkSocType_Mariko && targetHz < oldHz && config::GetConfigValue(HocClkConfigValue_DVFSMode) == DVFSMode_Hijack) {
|
||||
DVFSAfterSet(targetHz);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
HandleFreqReset((SysClkModule)module, isBoost);
|
||||
HandleFreqReset((HocClkModule)module, isBoost);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -429,7 +429,7 @@ namespace clockManager {
|
||||
hasChanged = true;
|
||||
}
|
||||
|
||||
SysClkProfile profile = board::GetProfile();
|
||||
HocClkProfile profile = board::GetProfile();
|
||||
if (profile != gContext.profile) {
|
||||
fileUtils::LogLine("[mgr] Profile change: %s", board::GetProfileName(profile, true));
|
||||
gContext.profile = profile;
|
||||
@@ -439,27 +439,27 @@ namespace clockManager {
|
||||
// restore clocks to stock values on app or profile change
|
||||
if (hasChanged) {
|
||||
board::ResetToStock();
|
||||
if (board::GetSocType() == SysClkSocType_Mariko && config::GetConfigValue(HorizonOCConfigValue_DVFSMode) == DVFSMode_Hijack) {
|
||||
if (board::GetSocType() == HocClkSocType_Mariko && config::GetConfigValue(HocClkConfigValue_DVFSMode) == DVFSMode_Hijack) {
|
||||
board::PcvHijackGpuVolts(0);
|
||||
board::SetHz(SysClkModule_GPU, ~0);
|
||||
board::SetHz(HocClkModule_GPU, ~0);
|
||||
board::ResetToStockGpu();
|
||||
}
|
||||
WaitForNextTick();
|
||||
}
|
||||
|
||||
std::uint32_t hz = 0;
|
||||
for (unsigned int module = 0; module < SysClkModule_EnumMax; module++) {
|
||||
hz = board::GetHz((SysClkModule)module);
|
||||
for (unsigned int module = 0; module < HocClkModule_EnumMax; module++) {
|
||||
hz = board::GetHz((HocClkModule)module);
|
||||
if (hz != 0 && hz != gContext.freqs[module]) {
|
||||
fileUtils::LogLine("[mgr] %s clock change: %u.%u MHz", board::GetModuleName((SysClkModule)module, true), hz / 1000000, hz / 100000 - hz / 1000000 * 10);
|
||||
fileUtils::LogLine("[mgr] %s clock change: %u.%u MHz", board::GetModuleName((HocClkModule)module, true), hz / 1000000, hz / 100000 - hz / 1000000 * 10);
|
||||
gContext.freqs[module] = hz;
|
||||
hasChanged = true;
|
||||
}
|
||||
|
||||
hz = config::GetOverrideHz((SysClkModule)module);
|
||||
hz = config::GetOverrideHz((HocClkModule)module);
|
||||
if (hz != gContext.overrideFreqs[module]) {
|
||||
if (hz) {
|
||||
fileUtils::LogLine("[mgr] %s override change: %u.%u MHz", board::GetModuleName((SysClkModule)module, true), hz / 1000000, hz / 100000 - hz / 1000000 * 10);
|
||||
fileUtils::LogLine("[mgr] %s override change: %u.%u MHz", board::GetModuleName((HocClkModule)module, true), hz / 1000000, hz / 100000 - hz / 1000000 * 10);
|
||||
}
|
||||
gContext.overrideFreqs[module] = hz;
|
||||
hasChanged = true;
|
||||
@@ -470,60 +470,60 @@ namespace clockManager {
|
||||
|
||||
// temperatures do not and should not force a refresh, hasChanged untouched
|
||||
std::uint32_t millis = 0;
|
||||
bool shouldLogTemp = ConfigIntervalTimeout(SysClkConfigValue_TempLogIntervalMs, ns, &gLastTempLogNs);
|
||||
for (unsigned int sensor = 0; sensor < SysClkThermalSensor_EnumMax; sensor++) {
|
||||
millis = board::GetTemperatureMilli((SysClkThermalSensor)sensor);
|
||||
bool shouldLogTemp = ConfigIntervalTimeout(HocClkConfigValue_TempLogIntervalMs, ns, &gLastTempLogNs);
|
||||
for (unsigned int sensor = 0; sensor < HocClkThermalSensor_EnumMax; sensor++) {
|
||||
millis = board::GetTemperatureMilli((HocClkThermalSensor)sensor);
|
||||
if (shouldLogTemp) {
|
||||
fileUtils::LogLine("[mgr] %s temp: %u.%u °C", board::GetThermalSensorName((SysClkThermalSensor)sensor, true), millis / 1000, (millis - millis / 1000 * 1000) / 100);
|
||||
fileUtils::LogLine("[mgr] %s temp: %u.%u °C", board::GetThermalSensorName((HocClkThermalSensor)sensor, true), millis / 1000, (millis - millis / 1000 * 1000) / 100);
|
||||
}
|
||||
gContext.temps[sensor] = millis;
|
||||
}
|
||||
|
||||
// power stats do not and should not force a refresh, hasChanged untouched
|
||||
std::int32_t mw = 0;
|
||||
bool shouldLogPower = ConfigIntervalTimeout(SysClkConfigValue_PowerLogIntervalMs, ns, &gLastPowerLogNs);
|
||||
for (unsigned int sensor = 0; sensor < SysClkPowerSensor_EnumMax; sensor++) {
|
||||
mw = board::GetPowerMw((SysClkPowerSensor)sensor);
|
||||
bool shouldLogPower = ConfigIntervalTimeout(HocClkConfigValue_PowerLogIntervalMs, ns, &gLastPowerLogNs);
|
||||
for (unsigned int sensor = 0; sensor < HocClkPowerSensor_EnumMax; sensor++) {
|
||||
mw = board::GetPowerMw((HocClkPowerSensor)sensor);
|
||||
if (shouldLogPower) {
|
||||
fileUtils::LogLine("[mgr] Power %s: %d mW", board::GetPowerSensorName((SysClkPowerSensor)sensor, false), mw);
|
||||
fileUtils::LogLine("[mgr] Power %s: %d mW", board::GetPowerSensorName((HocClkPowerSensor)sensor, false), mw);
|
||||
}
|
||||
gContext.power[sensor] = mw;
|
||||
}
|
||||
|
||||
// real freqs do not and should not force a refresh, hasChanged untouched
|
||||
std::uint32_t realHz = 0;
|
||||
bool shouldLogFreq = ConfigIntervalTimeout(SysClkConfigValue_FreqLogIntervalMs, ns, &gLastFreqLogNs);
|
||||
for (unsigned int module = 0; module < SysClkModule_EnumMax; module++) {
|
||||
realHz = board::GetRealHz((SysClkModule)module);
|
||||
bool shouldLogFreq = ConfigIntervalTimeout(HocClkConfigValue_FreqLogIntervalMs, ns, &gLastFreqLogNs);
|
||||
for (unsigned int module = 0; module < HocClkModule_EnumMax; module++) {
|
||||
realHz = board::GetRealHz((HocClkModule)module);
|
||||
if (shouldLogFreq) {
|
||||
fileUtils::LogLine("[mgr] %s real freq: %u.%u MHz", board::GetModuleName((SysClkModule)module, true), realHz / 1000000, realHz / 100000 - realHz / 1000000 * 10);
|
||||
fileUtils::LogLine("[mgr] %s real freq: %u.%u MHz", board::GetModuleName((HocClkModule)module, true), realHz / 1000000, realHz / 100000 - realHz / 1000000 * 10);
|
||||
}
|
||||
gContext.realFreqs[module] = realHz;
|
||||
}
|
||||
|
||||
// ram load do not and should not force a refresh, hasChanged untouched
|
||||
for (unsigned int loadSource = 0; loadSource < SysClkPartLoad_EnumMax; loadSource++) {
|
||||
gContext.partLoad[loadSource] = board::GetPartLoad((SysClkPartLoad)loadSource);
|
||||
for (unsigned int loadSource = 0; loadSource < HocClkPartLoad_EnumMax; loadSource++) {
|
||||
gContext.partLoad[loadSource] = board::GetPartLoad((HocClkPartLoad)loadSource);
|
||||
}
|
||||
|
||||
for (unsigned int voltageSource = 0; voltageSource < HocClkVoltage_EnumMax; voltageSource++) {
|
||||
gContext.voltages[voltageSource] = board::GetVoltage((HocClkVoltage)voltageSource);
|
||||
}
|
||||
|
||||
if (ConfigIntervalTimeout(SysClkConfigValue_CsvWriteIntervalMs, ns, &gLastCsvWriteNs)) {
|
||||
if (ConfigIntervalTimeout(HocClkConfigValue_CsvWriteIntervalMs, ns, &gLastCsvWriteNs)) {
|
||||
fileUtils::WriteContextToCsv(&gContext);
|
||||
}
|
||||
|
||||
// this->context->maxDisplayFreq = board::GetHighestDockedDisplayRate();
|
||||
u32 targetHz = gContext.overrideFreqs[HorizonOCModule_Display];
|
||||
u32 targetHz = gContext.overrideFreqs[HocClkModule_Display];
|
||||
if (!targetHz) {
|
||||
targetHz = config::GetAutoClockHz(gContext.applicationId, HorizonOCModule_Display, gContext.profile, true);
|
||||
targetHz = config::GetAutoClockHz(gContext.applicationId, HocClkModule_Display, gContext.profile, true);
|
||||
if (!targetHz)
|
||||
targetHz = config::GetAutoClockHz(GLOBAL_PROFILE_ID, HorizonOCModule_Display, gContext.profile, true);
|
||||
targetHz = config::GetAutoClockHz(GLOBAL_PROFILE_ID, HocClkModule_Display, gContext.profile, true);
|
||||
}
|
||||
|
||||
if (board::GetConsoleType() != HorizonOCConsoleType_Hoag)
|
||||
board::SetDisplayRefreshDockedState(gContext.profile == SysClkProfile_Docked);
|
||||
if (board::GetConsoleType() != HocClkConsoleType_Hoag)
|
||||
board::SetDisplayRefreshDockedState(gContext.profile == HocClkProfile_Docked);
|
||||
|
||||
if (gContext.isSaltyNXInstalled)
|
||||
gContext.fps = integrations::GetSaltyNXFPS();
|
||||
@@ -544,12 +544,12 @@ namespace clockManager {
|
||||
|
||||
gContext = {};
|
||||
gContext.applicationId = 0;
|
||||
gContext.profile = SysClkProfile_Handheld;
|
||||
for (unsigned int module = 0; module < SysClkModule_EnumMax; module++) {
|
||||
gContext.profile = HocClkProfile_Handheld;
|
||||
for (unsigned int module = 0; module < HocClkModule_EnumMax; module++) {
|
||||
gContext.freqs[module] = 0;
|
||||
gContext.realFreqs[module] = 0;
|
||||
gContext.overrideFreqs[module] = 0;
|
||||
RefreshFreqTableRow((SysClkModule)module);
|
||||
RefreshFreqTableRow((HocClkModule)module);
|
||||
}
|
||||
|
||||
gRunning = false;
|
||||
@@ -571,8 +571,8 @@ namespace clockManager {
|
||||
|
||||
gContext.dramID = board::GetDramID();
|
||||
gContext.isDram8GB = board::IsDram8GB();
|
||||
board::SetGpuSchedulingMode((GpuSchedulingMode)config::GetConfigValue(HorizonOCConfigValue_GPUScheduling), (GpuSchedulingOverrideMethod)config::GetConfigValue(HorizonOCConfigValue_GPUSchedulingMethod));
|
||||
gContext.gpuSchedulingMode = (GpuSchedulingMode)config::GetConfigValue(HorizonOCConfigValue_GPUScheduling);
|
||||
board::SetGpuSchedulingMode((GpuSchedulingMode)config::GetConfigValue(HocClkConfigValue_GPUScheduling), (GpuSchedulingOverrideMethod)config::GetConfigValue(HocClkConfigValue_GPUSchedulingMethod));
|
||||
gContext.gpuSchedulingMode = (GpuSchedulingMode)config::GetConfigValue(HocClkConfigValue_GPUScheduling);
|
||||
|
||||
gContext.isSysDockInstalled = integrations::GetSysDockState();
|
||||
gContext.isSaltyNXInstalled = integrations::GetSaltyNXState();
|
||||
@@ -590,7 +590,7 @@ namespace clockManager {
|
||||
config::Exit();
|
||||
}
|
||||
|
||||
SysClkContext GetCurrentContext()
|
||||
HocClkContext GetCurrentContext()
|
||||
{
|
||||
std::scoped_lock lock{gContextMutex};
|
||||
return gContext;
|
||||
@@ -606,9 +606,9 @@ namespace clockManager {
|
||||
return gRunning;
|
||||
}
|
||||
|
||||
void GetFreqList(SysClkModule module, std::uint32_t *list, std::uint32_t maxCount, std::uint32_t *outCount)
|
||||
void GetFreqList(HocClkModule module, std::uint32_t *list, std::uint32_t maxCount, std::uint32_t *outCount)
|
||||
{
|
||||
ASSERT_ENUM_VALID(SysClkModule, module);
|
||||
ASSERT_ENUM_VALID(HocClkModule, module);
|
||||
|
||||
*outCount = std::min(maxCount, gFreqTable[module].count);
|
||||
memcpy(list, &gFreqTable[module].list[0], *outCount * sizeof(gFreqTable[0].list[0]));
|
||||
@@ -616,7 +616,7 @@ namespace clockManager {
|
||||
|
||||
void Tick()
|
||||
{
|
||||
fileUtils::LogLine("CPU Temp: %d", board::GetTemperatureMilli(HorizonOCThermalSensor_CPU));
|
||||
fileUtils::LogLine("CPU Temp: %d", board::GetTemperatureMilli(HocClkThermalSensor_CPU));
|
||||
std::scoped_lock lock{gContextMutex};
|
||||
std::uint32_t mode = 0;
|
||||
Result rc = apmExtGetCurrentPerformanceConfiguration(&mode);
|
||||
@@ -634,8 +634,8 @@ namespace clockManager {
|
||||
|
||||
void WaitForNextTick()
|
||||
{
|
||||
if (board::GetHz(SysClkModule_MEM) > 665000000)
|
||||
svcSleepThread(config::GetConfigValue(SysClkConfigValue_PollingIntervalMs) * 1000000ULL);
|
||||
if (board::GetHz(HocClkModule_MEM) > 665000000)
|
||||
svcSleepThread(config::GetConfigValue(HocClkConfigValue_PollingIntervalMs) * 1000000ULL);
|
||||
else
|
||||
svcSleepThread(5000 * 1000000ULL); // 5 seconds in sleep mode
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <sysclk.h>
|
||||
#include <hocclk.h>
|
||||
#include <switch.h>
|
||||
#include <nxExt/cpp/lockable_mutex.h>
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace clockManager {
|
||||
|
||||
struct FreqTable {
|
||||
std::uint32_t count;
|
||||
std::uint32_t list[SYSCLK_FREQ_LIST_MAX];
|
||||
std::uint32_t list[HOCCLK_FREQ_LIST_MAX];
|
||||
};
|
||||
|
||||
|
||||
@@ -43,8 +43,8 @@ namespace clockManager {
|
||||
// instance variables
|
||||
extern bool gRunning;
|
||||
extern LockableMutex gContextMutex;
|
||||
extern SysClkContext gContext;
|
||||
extern FreqTable gFreqTable[SysClkModule_EnumMax];
|
||||
extern HocClkContext gContext;
|
||||
extern FreqTable gFreqTable[HocClkModule_EnumMax];
|
||||
extern std::uint64_t gLastTempLogNs;
|
||||
extern std::uint64_t gLastFreqLogNs;
|
||||
extern std::uint64_t gLastPowerLogNs;
|
||||
@@ -54,15 +54,15 @@ namespace clockManager {
|
||||
void Initialize();
|
||||
void Exit();
|
||||
|
||||
SysClkContext GetCurrentContext();
|
||||
HocClkContext GetCurrentContext();
|
||||
|
||||
void SetRunning(bool running);
|
||||
bool Running();
|
||||
|
||||
std::uint32_t GetMaxAllowedHz(SysClkModule module, SysClkProfile profile);
|
||||
bool IsAssignableHz(SysClkModule module, std::uint32_t hz);
|
||||
std::uint32_t GetMaxAllowedHz(HocClkModule module, HocClkProfile profile);
|
||||
bool IsAssignableHz(HocClkModule module, std::uint32_t hz);
|
||||
|
||||
void GetFreqList(SysClkModule module, std::uint32_t* list, std::uint32_t maxCount, std::uint32_t* outCount);
|
||||
void GetFreqList(HocClkModule module, std::uint32_t* list, std::uint32_t maxCount, std::uint32_t* outCount);
|
||||
|
||||
void Tick();
|
||||
void WaitForNextTick();
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
namespace config {
|
||||
|
||||
uint64_t configValues[SysClkConfigValue_EnumMax];
|
||||
uint64_t configValues[HocClkConfigValue_EnumMax];
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -52,8 +52,8 @@ namespace config {
|
||||
std::string gPath;
|
||||
time_t gMtime = 0;
|
||||
std::atomic_bool gEnabled{false};
|
||||
std::uint32_t gOverrideFreqs[SysClkModule_EnumMax];
|
||||
std::map<std::tuple<std::uint64_t, SysClkProfile, SysClkModule>, std::uint32_t> gProfileMHzMap;
|
||||
std::uint32_t gOverrideFreqs[HocClkModule_EnumMax];
|
||||
std::map<std::tuple<std::uint64_t, HocClkProfile, HocClkModule>, std::uint32_t> gProfileMHzMap;
|
||||
std::map<std::uint64_t, std::uint8_t> gProfileCountMap;
|
||||
LockableMutex gConfigMutex;
|
||||
LockableMutex gOverrideMutex;
|
||||
@@ -67,7 +67,7 @@ namespace config {
|
||||
return mtime;
|
||||
}
|
||||
|
||||
std::uint32_t FindClockMHz(std::uint64_t tid, SysClkModule module, SysClkProfile profile) {
|
||||
std::uint32_t FindClockMHz(std::uint64_t tid, HocClkModule module, HocClkProfile profile) {
|
||||
if (gLoaded) {
|
||||
auto it = gProfileMHzMap.find(std::make_tuple(tid, profile, module));
|
||||
if (it != gProfileMHzMap.end()) {
|
||||
@@ -77,7 +77,7 @@ namespace config {
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::uint32_t FindClockHzFromProfiles(std::uint64_t tid, SysClkModule module, std::initializer_list<SysClkProfile> profiles, u32 mhzMultiplier = 1000000) {
|
||||
std::uint32_t FindClockHzFromProfiles(std::uint64_t tid, HocClkModule module, std::initializer_list<HocClkProfile> profiles, u32 mhzMultiplier = 1000000) {
|
||||
std::uint32_t mhz = 0;
|
||||
|
||||
if (gLoaded) {
|
||||
@@ -96,11 +96,11 @@ namespace config {
|
||||
(void)userdata;
|
||||
std::uint64_t input;
|
||||
if (!strcmp(section, CONFIG_VAL_SECTION)) {
|
||||
for (unsigned int kval = 0; kval < SysClkConfigValue_EnumMax; kval++) {
|
||||
if (!strcmp(key, sysclkFormatConfigValue((SysClkConfigValue)kval, false))) {
|
||||
for (unsigned int kval = 0; kval < HocClkConfigValue_EnumMax; kval++) {
|
||||
if (!strcmp(key, hocclkFormatConfigValue((HocClkConfigValue)kval, false))) {
|
||||
input = strtoul(value, NULL, 0);
|
||||
if (!sysclkValidConfigValue((SysClkConfigValue)kval, input)) {
|
||||
input = sysclkDefaultConfigValue((SysClkConfigValue)kval);
|
||||
if (!hocclkValidConfigValue((HocClkConfigValue)kval, input)) {
|
||||
input = hocclkDefaultConfigValue((HocClkConfigValue)kval);
|
||||
fileUtils::LogLine("[cfg] Invalid value for key '%s' in section '%s': using default %d", key, section, input);
|
||||
}
|
||||
configValues[kval] = input;
|
||||
@@ -119,28 +119,28 @@ namespace config {
|
||||
return 1;
|
||||
}
|
||||
|
||||
SysClkProfile parsedProfile = SysClkProfile_EnumMax;
|
||||
SysClkModule parsedModule = SysClkModule_EnumMax;
|
||||
HocClkProfile parsedProfile = HocClkProfile_EnumMax;
|
||||
HocClkModule parsedModule = HocClkModule_EnumMax;
|
||||
|
||||
for (unsigned int profile = 0; profile < SysClkProfile_EnumMax; profile++) {
|
||||
const char* profileCode = board::GetProfileName((SysClkProfile)profile, false);
|
||||
for (unsigned int profile = 0; profile < HocClkProfile_EnumMax; profile++) {
|
||||
const char* profileCode = board::GetProfileName((HocClkProfile)profile, false);
|
||||
size_t profileCodeLen = strlen(profileCode);
|
||||
|
||||
if (!strncmp(key, profileCode, profileCodeLen) && key[profileCodeLen] == '_') {
|
||||
const char* subkey = key + profileCodeLen + 1;
|
||||
|
||||
for (unsigned int module = 0; module < SysClkModule_EnumMax; module++) {
|
||||
const char* moduleCode = board::GetModuleName((SysClkModule)module, false);
|
||||
for (unsigned int module = 0; module < HocClkModule_EnumMax; module++) {
|
||||
const char* moduleCode = board::GetModuleName((HocClkModule)module, false);
|
||||
size_t moduleCodeLen = strlen(moduleCode);
|
||||
if (!strncmp(subkey, moduleCode, moduleCodeLen) && subkey[moduleCodeLen] == '\0') {
|
||||
parsedProfile = (SysClkProfile)profile;
|
||||
parsedModule = (SysClkModule)module;
|
||||
parsedProfile = (HocClkProfile)profile;
|
||||
parsedModule = (HocClkModule)module;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (parsedModule == SysClkModule_EnumMax || parsedProfile == SysClkProfile_EnumMax) {
|
||||
if (parsedModule == HocClkModule_EnumMax || parsedProfile == HocClkProfile_EnumMax) {
|
||||
fileUtils::LogLine("[cfg] Skipping key '%s' in section '%s': Unrecognized key", key, section);
|
||||
return 1;
|
||||
}
|
||||
@@ -166,8 +166,8 @@ namespace config {
|
||||
gLoaded = false;
|
||||
gProfileMHzMap.clear();
|
||||
gProfileCountMap.clear();
|
||||
for (unsigned int i = 0; i < SysClkConfigValue_EnumMax; i++) {
|
||||
configValues[i] = sysclkDefaultConfigValue((SysClkConfigValue)i);
|
||||
for (unsigned int i = 0; i < HocClkConfigValue_EnumMax; i++) {
|
||||
configValues[i] = hocclkDefaultConfigValue((HocClkConfigValue)i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,11 +194,11 @@ namespace config {
|
||||
gProfileCountMap.clear();
|
||||
gMtime = 0;
|
||||
gEnabled = false;
|
||||
for (unsigned int i = 0; i < SysClkModule_EnumMax; i++) {
|
||||
for (unsigned int i = 0; i < HocClkModule_EnumMax; i++) {
|
||||
gOverrideFreqs[i] = 0;
|
||||
}
|
||||
for (unsigned int i = 0; i < SysClkConfigValue_EnumMax; i++) {
|
||||
configValues[i] = sysclkDefaultConfigValue((SysClkConfigValue)i);
|
||||
for (unsigned int i = 0; i < HocClkConfigValue_EnumMax; i++) {
|
||||
configValues[i] = hocclkDefaultConfigValue((HocClkConfigValue)i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,34 +221,34 @@ namespace config {
|
||||
return gLoaded;
|
||||
}
|
||||
|
||||
std::uint32_t GetAutoClockHz(std::uint64_t tid, SysClkModule module, SysClkProfile profile, bool returnRaw) {
|
||||
std::uint32_t GetAutoClockHz(std::uint64_t tid, HocClkModule module, HocClkProfile profile, bool returnRaw) {
|
||||
std::scoped_lock lock{gConfigMutex};
|
||||
switch (profile) {
|
||||
case SysClkProfile_Handheld:
|
||||
return FindClockHzFromProfiles(tid, module, {SysClkProfile_Handheld}, returnRaw ? 1 : 1000000);
|
||||
case SysClkProfile_HandheldCharging:
|
||||
case SysClkProfile_HandheldChargingUSB:
|
||||
return FindClockHzFromProfiles(tid, module, {SysClkProfile_HandheldChargingUSB, SysClkProfile_HandheldCharging, SysClkProfile_Handheld}, returnRaw ? 1 : 1000000);
|
||||
case SysClkProfile_HandheldChargingOfficial:
|
||||
return FindClockHzFromProfiles(tid, module, {SysClkProfile_HandheldChargingOfficial, SysClkProfile_HandheldCharging, SysClkProfile_Handheld}, returnRaw ? 1 : 1000000);
|
||||
case SysClkProfile_Docked:
|
||||
return FindClockHzFromProfiles(tid, module, {SysClkProfile_Docked}, returnRaw ? 1 : 1000000);
|
||||
case HocClkProfile_Handheld:
|
||||
return FindClockHzFromProfiles(tid, module, {HocClkProfile_Handheld}, returnRaw ? 1 : 1000000);
|
||||
case HocClkProfile_HandheldCharging:
|
||||
case HocClkProfile_HandheldChargingUSB:
|
||||
return FindClockHzFromProfiles(tid, module, {HocClkProfile_HandheldChargingUSB, HocClkProfile_HandheldCharging, HocClkProfile_Handheld}, returnRaw ? 1 : 1000000);
|
||||
case HocClkProfile_HandheldChargingOfficial:
|
||||
return FindClockHzFromProfiles(tid, module, {HocClkProfile_HandheldChargingOfficial, HocClkProfile_HandheldCharging, HocClkProfile_Handheld}, returnRaw ? 1 : 1000000);
|
||||
case HocClkProfile_Docked:
|
||||
return FindClockHzFromProfiles(tid, module, {HocClkProfile_Docked}, returnRaw ? 1 : 1000000);
|
||||
default:
|
||||
ERROR_THROW("Unhandled SysClkProfile: %u", profile);
|
||||
ERROR_THROW("Unhandled HocClkProfile: %u", profile);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void GetProfiles(std::uint64_t tid, SysClkTitleProfileList* out_profiles) {
|
||||
void GetProfiles(std::uint64_t tid, HocClkTitleProfileList* out_profiles) {
|
||||
std::scoped_lock lock{gConfigMutex};
|
||||
for (unsigned int profile = 0; profile < SysClkProfile_EnumMax; profile++) {
|
||||
for (unsigned int module = 0; module < SysClkModule_EnumMax; module++) {
|
||||
out_profiles->mhzMap[profile][module] = FindClockMHz(tid, (SysClkModule)module, (SysClkProfile)profile);
|
||||
for (unsigned int profile = 0; profile < HocClkProfile_EnumMax; profile++) {
|
||||
for (unsigned int module = 0; module < HocClkModule_EnumMax; module++) {
|
||||
out_profiles->mhzMap[profile][module] = FindClockMHz(tid, (HocClkModule)module, (HocClkProfile)profile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool SetProfiles(std::uint64_t tid, SysClkTitleProfileList* profiles, bool immediate) {
|
||||
bool SetProfiles(std::uint64_t tid, HocClkTitleProfileList* profiles, bool immediate) {
|
||||
std::scoped_lock lock{gConfigMutex};
|
||||
uint8_t numProfiles = 0;
|
||||
|
||||
@@ -257,19 +257,19 @@ namespace config {
|
||||
|
||||
std::vector<std::string> keys;
|
||||
std::vector<std::string> values;
|
||||
keys.reserve(SysClkProfile_EnumMax * SysClkModule_EnumMax);
|
||||
values.reserve(SysClkProfile_EnumMax * SysClkModule_EnumMax);
|
||||
keys.reserve(HocClkProfile_EnumMax * HocClkModule_EnumMax);
|
||||
values.reserve(HocClkProfile_EnumMax * HocClkModule_EnumMax);
|
||||
|
||||
std::uint32_t* mhz = &profiles->mhz[0];
|
||||
|
||||
for (unsigned int profile = 0; profile < SysClkProfile_EnumMax; profile++) {
|
||||
for (unsigned int module = 0; module < SysClkModule_EnumMax; module++) {
|
||||
for (unsigned int profile = 0; profile < HocClkProfile_EnumMax; profile++) {
|
||||
for (unsigned int module = 0; module < HocClkModule_EnumMax; module++) {
|
||||
if (*mhz) {
|
||||
numProfiles++;
|
||||
|
||||
std::string key = std::string(board::GetProfileName((SysClkProfile)profile, false)) +
|
||||
std::string key = std::string(board::GetProfileName((HocClkProfile)profile, false)) +
|
||||
"_" +
|
||||
board::GetModuleName((SysClkModule)module, false);
|
||||
board::GetModuleName((HocClkModule)module, false);
|
||||
std::string value = std::to_string(*mhz);
|
||||
|
||||
keys.push_back(key);
|
||||
@@ -298,12 +298,12 @@ namespace config {
|
||||
if (immediate) {
|
||||
mhz = &profiles->mhz[0];
|
||||
gProfileCountMap[tid] = numProfiles;
|
||||
for (unsigned int profile = 0; profile < SysClkProfile_EnumMax; profile++) {
|
||||
for (unsigned int module = 0; module < SysClkModule_EnumMax; module++) {
|
||||
for (unsigned int profile = 0; profile < HocClkProfile_EnumMax; profile++) {
|
||||
for (unsigned int module = 0; module < HocClkModule_EnumMax; module++) {
|
||||
if (*mhz) {
|
||||
gProfileMHzMap[std::make_tuple(tid, (SysClkProfile)profile, (SysClkModule)module)] = *mhz;
|
||||
gProfileMHzMap[std::make_tuple(tid, (HocClkProfile)profile, (HocClkModule)module)] = *mhz;
|
||||
} else {
|
||||
gProfileMHzMap.erase(std::make_tuple(tid, (SysClkProfile)profile, (SysClkModule)module));
|
||||
gProfileMHzMap.erase(std::make_tuple(tid, (HocClkProfile)profile, (HocClkModule)module));
|
||||
}
|
||||
mhz++;
|
||||
}
|
||||
@@ -329,51 +329,51 @@ namespace config {
|
||||
return gEnabled;
|
||||
}
|
||||
|
||||
void SetOverrideHz(SysClkModule module, std::uint32_t hz) {
|
||||
ASSERT_ENUM_VALID(SysClkModule, module);
|
||||
void SetOverrideHz(HocClkModule module, std::uint32_t hz) {
|
||||
ASSERT_ENUM_VALID(HocClkModule, module);
|
||||
std::scoped_lock lock{gOverrideMutex};
|
||||
gOverrideFreqs[module] = hz;
|
||||
}
|
||||
|
||||
std::uint32_t GetOverrideHz(SysClkModule module) {
|
||||
ASSERT_ENUM_VALID(SysClkModule, module);
|
||||
std::uint32_t GetOverrideHz(HocClkModule module) {
|
||||
ASSERT_ENUM_VALID(HocClkModule, module);
|
||||
std::scoped_lock lock{gOverrideMutex};
|
||||
return gOverrideFreqs[module];
|
||||
}
|
||||
|
||||
std::uint64_t GetConfigValue(SysClkConfigValue kval) {
|
||||
ASSERT_ENUM_VALID(SysClkConfigValue, kval);
|
||||
std::uint64_t GetConfigValue(HocClkConfigValue kval) {
|
||||
ASSERT_ENUM_VALID(HocClkConfigValue, kval);
|
||||
std::scoped_lock lock{gConfigMutex};
|
||||
return configValues[kval];
|
||||
}
|
||||
|
||||
const char* GetConfigValueName(SysClkConfigValue kval, bool pretty) {
|
||||
ASSERT_ENUM_VALID(SysClkConfigValue, kval);
|
||||
return sysclkFormatConfigValue(kval, pretty);
|
||||
const char* GetConfigValueName(HocClkConfigValue kval, bool pretty) {
|
||||
ASSERT_ENUM_VALID(HocClkConfigValue, kval);
|
||||
return hocclkFormatConfigValue(kval, pretty);
|
||||
}
|
||||
|
||||
void GetConfigValues(SysClkConfigValueList* out_configValues) {
|
||||
void GetConfigValues(HocClkConfigValueList* out_configValues) {
|
||||
std::scoped_lock lock{gConfigMutex};
|
||||
for (unsigned int kval = 0; kval < SysClkConfigValue_EnumMax; kval++) {
|
||||
for (unsigned int kval = 0; kval < HocClkConfigValue_EnumMax; kval++) {
|
||||
out_configValues->values[kval] = configValues[kval];
|
||||
}
|
||||
}
|
||||
|
||||
bool SetConfigValues(SysClkConfigValueList* configValues, bool immediate) {
|
||||
bool SetConfigValues(HocClkConfigValueList* configValues, bool immediate) {
|
||||
std::scoped_lock lock{gConfigMutex};
|
||||
|
||||
std::vector<const char*> iniKeys;
|
||||
std::vector<std::string> iniValues;
|
||||
iniKeys.reserve(SysClkConfigValue_EnumMax + 1);
|
||||
iniValues.reserve(SysClkConfigValue_EnumMax);
|
||||
iniKeys.reserve(HocClkConfigValue_EnumMax + 1);
|
||||
iniValues.reserve(HocClkConfigValue_EnumMax);
|
||||
|
||||
for (unsigned int kval = 0; kval < SysClkConfigValue_EnumMax; kval++) {
|
||||
if (!sysclkValidConfigValue((SysClkConfigValue)kval, configValues->values[kval]) ||
|
||||
configValues->values[kval] == sysclkDefaultConfigValue((SysClkConfigValue)kval)) {
|
||||
for (unsigned int kval = 0; kval < HocClkConfigValue_EnumMax; kval++) {
|
||||
if (!hocclkValidConfigValue((HocClkConfigValue)kval, configValues->values[kval]) ||
|
||||
configValues->values[kval] == hocclkDefaultConfigValue((HocClkConfigValue)kval)) {
|
||||
continue;
|
||||
}
|
||||
iniValues.push_back(std::to_string(configValues->values[kval]));
|
||||
iniKeys.push_back(sysclkFormatConfigValue((SysClkConfigValue)kval, false));
|
||||
iniKeys.push_back(hocclkFormatConfigValue((HocClkConfigValue)kval, false));
|
||||
}
|
||||
|
||||
iniKeys.push_back(NULL);
|
||||
@@ -390,11 +390,11 @@ namespace config {
|
||||
}
|
||||
|
||||
if (immediate) {
|
||||
for (unsigned int kval = 0; kval < SysClkConfigValue_EnumMax; kval++) {
|
||||
if (sysclkValidConfigValue((SysClkConfigValue)kval, configValues->values[kval])) {
|
||||
for (unsigned int kval = 0; kval < HocClkConfigValue_EnumMax; kval++) {
|
||||
if (hocclkValidConfigValue((HocClkConfigValue)kval, configValues->values[kval])) {
|
||||
config::configValues[kval] = configValues->values[kval];
|
||||
} else {
|
||||
config::configValues[kval] = sysclkDefaultConfigValue((SysClkConfigValue)kval);
|
||||
config::configValues[kval] = hocclkDefaultConfigValue((HocClkConfigValue)kval);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -402,22 +402,22 @@ namespace config {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ResetConfigValue(SysClkConfigValue kval) {
|
||||
if (!SYSCLK_ENUM_VALID(SysClkConfigValue, kval)) {
|
||||
fileUtils::LogLine("[cfg] Invalid SysClkConfigValue: %u", kval);
|
||||
bool ResetConfigValue(HocClkConfigValue kval) {
|
||||
if (!HOCCLK_ENUM_VALID(HocClkConfigValue, kval)) {
|
||||
fileUtils::LogLine("[cfg] Invalid HocClkConfigValue: %u", kval);
|
||||
return false;
|
||||
}
|
||||
|
||||
std::scoped_lock lock{gConfigMutex};
|
||||
|
||||
std::uint64_t defaultValue = sysclkDefaultConfigValue(kval);
|
||||
std::uint64_t defaultValue = hocclkDefaultConfigValue(kval);
|
||||
|
||||
std::vector<const char*> iniKeys;
|
||||
std::vector<std::string> iniValues;
|
||||
iniKeys.reserve(2);
|
||||
iniValues.reserve(1);
|
||||
|
||||
iniKeys.push_back(sysclkFormatConfigValue(kval, false));
|
||||
iniKeys.push_back(hocclkFormatConfigValue(kval, false));
|
||||
iniValues.push_back("");
|
||||
iniKeys.push_back(NULL);
|
||||
|
||||
@@ -439,11 +439,11 @@ namespace config {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SetConfigValue(SysClkConfigValue kval, std::uint64_t value, bool immediate) {
|
||||
if (!SYSCLK_ENUM_VALID(SysClkConfigValue, kval)) {
|
||||
bool SetConfigValue(HocClkConfigValue kval, std::uint64_t value, bool immediate) {
|
||||
if (!HOCCLK_ENUM_VALID(HocClkConfigValue, kval)) {
|
||||
return false;
|
||||
}
|
||||
if (!sysclkValidConfigValue(kval, value)) {
|
||||
if (!hocclkValidConfigValue(kval, value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -454,7 +454,7 @@ namespace config {
|
||||
iniKeys.reserve(2);
|
||||
iniValues.reserve(1);
|
||||
|
||||
iniKeys.push_back(sysclkFormatConfigValue(kval, false));
|
||||
iniKeys.push_back(hocclkFormatConfigValue(kval, false));
|
||||
iniValues.push_back(std::to_string(value));
|
||||
iniKeys.push_back(NULL);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <sysclk.h>
|
||||
#include <hocclk.h>
|
||||
#include <switch.h>
|
||||
|
||||
#define CONFIG_VAL_SECTION "values"
|
||||
@@ -40,22 +40,22 @@ namespace config {
|
||||
bool HasProfilesLoaded();
|
||||
|
||||
std::uint8_t GetProfileCount(std::uint64_t tid);
|
||||
void GetProfiles(std::uint64_t tid, SysClkTitleProfileList* out_profiles);
|
||||
bool SetProfiles(std::uint64_t tid, SysClkTitleProfileList* profiles, bool immediate);
|
||||
std::uint32_t GetAutoClockHz(std::uint64_t tid, SysClkModule module, SysClkProfile profile, bool returnRaw);
|
||||
void GetProfiles(std::uint64_t tid, HocClkTitleProfileList* out_profiles);
|
||||
bool SetProfiles(std::uint64_t tid, HocClkTitleProfileList* profiles, bool immediate);
|
||||
std::uint32_t GetAutoClockHz(std::uint64_t tid, HocClkModule module, HocClkProfile profile, bool returnRaw);
|
||||
|
||||
void SetEnabled(bool enabled);
|
||||
bool Enabled();
|
||||
void SetOverrideHz(SysClkModule module, std::uint32_t hz);
|
||||
std::uint32_t GetOverrideHz(SysClkModule module);
|
||||
void SetOverrideHz(HocClkModule module, std::uint32_t hz);
|
||||
std::uint32_t GetOverrideHz(HocClkModule module);
|
||||
|
||||
std::uint64_t GetConfigValue(SysClkConfigValue val);
|
||||
const char* GetConfigValueName(SysClkConfigValue val, bool pretty);
|
||||
void GetConfigValues(SysClkConfigValueList* out_configValues);
|
||||
bool SetConfigValues(SysClkConfigValueList* configValues, bool immediate);
|
||||
bool ResetConfigValue(SysClkConfigValue kval);
|
||||
bool SetConfigValue(SysClkConfigValue kval, std::uint64_t value, bool immediate = true);
|
||||
std::uint64_t GetConfigValue(HocClkConfigValue val);
|
||||
const char* GetConfigValueName(HocClkConfigValue val, bool pretty);
|
||||
void GetConfigValues(HocClkConfigValueList* out_configValues);
|
||||
bool SetConfigValues(HocClkConfigValueList* configValues, bool immediate);
|
||||
bool ResetConfigValue(HocClkConfigValue kval);
|
||||
bool SetConfigValue(HocClkConfigValue kval, std::uint64_t value, bool immediate = true);
|
||||
|
||||
extern uint64_t configValues[SysClkConfigValue_EnumMax];
|
||||
extern uint64_t configValues[HocClkConfigValue_EnumMax];
|
||||
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
ERROR_RESULT_THROW(rc, "ASSERT_RESULT_OK: " format, ##__VA_ARGS__); \
|
||||
}
|
||||
#define ASSERT_ENUM_VALID(n, v) \
|
||||
if (!SYSCLK_ENUM_VALID(n, v)) { \
|
||||
if (!HOCCLK_ENUM_VALID(n, v)) { \
|
||||
ERROR_THROW("No such %s: %u", #n, v); \
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace fileUtils {
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void WriteContextToCsv(const SysClkContext* context) {
|
||||
void WriteContextToCsv(const HocClkContext* context) {
|
||||
std::scoped_lock lock{g_csv_mutex};
|
||||
|
||||
FILE* file = fopen(FILE_CONTEXT_CSV_PATH, "a");
|
||||
@@ -106,20 +106,20 @@ namespace fileUtils {
|
||||
if (!ftell(file)) {
|
||||
fprintf(file, "timestamp,profile,app_tid");
|
||||
|
||||
for (unsigned int module = 0; module < SysClkModule_EnumMax; module++) {
|
||||
fprintf(file, ",%s_hz", sysclkFormatModule((SysClkModule)module, false));
|
||||
for (unsigned int module = 0; module < HocClkModule_EnumMax; module++) {
|
||||
fprintf(file, ",%s_hz", hocclkFormatModule((HocClkModule)module, false));
|
||||
}
|
||||
|
||||
for (unsigned int sensor = 0; sensor < SysClkThermalSensor_EnumMax; sensor++) {
|
||||
fprintf(file, ",%s_milliC", sysclkFormatThermalSensor((SysClkThermalSensor)sensor, false));
|
||||
for (unsigned int sensor = 0; sensor < HocClkThermalSensor_EnumMax; sensor++) {
|
||||
fprintf(file, ",%s_milliC", hocclkFormatThermalSensor((HocClkThermalSensor)sensor, false));
|
||||
}
|
||||
|
||||
for (unsigned int module = 0; module < SysClkModule_EnumMax; module++) {
|
||||
fprintf(file, ",%s_real_hz", sysclkFormatModule((SysClkModule)module, false));
|
||||
for (unsigned int module = 0; module < HocClkModule_EnumMax; module++) {
|
||||
fprintf(file, ",%s_real_hz", hocclkFormatModule((HocClkModule)module, false));
|
||||
}
|
||||
|
||||
for (unsigned int sensor = 0; sensor < SysClkPowerSensor_EnumMax; sensor++) {
|
||||
fprintf(file, ",%s_mw", sysclkFormatPowerSensor((SysClkPowerSensor)sensor, false));
|
||||
for (unsigned int sensor = 0; sensor < HocClkPowerSensor_EnumMax; sensor++) {
|
||||
fprintf(file, ",%s_mw", hocclkFormatPowerSensor((HocClkPowerSensor)sensor, false));
|
||||
}
|
||||
|
||||
fprintf(file, "\n");
|
||||
@@ -128,21 +128,21 @@ namespace fileUtils {
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_REALTIME, &now);
|
||||
|
||||
fprintf(file, "%ld%03ld,%s,%016lx", now.tv_sec, now.tv_nsec / 1000000UL, sysclkFormatProfile(context->profile, false), context->applicationId);
|
||||
fprintf(file, "%ld%03ld,%s,%016lx", now.tv_sec, now.tv_nsec / 1000000UL, hocclkFormatProfile(context->profile, false), context->applicationId);
|
||||
|
||||
for (unsigned int module = 0; module < SysClkModule_EnumMax; module++) {
|
||||
for (unsigned int module = 0; module < HocClkModule_EnumMax; module++) {
|
||||
fprintf(file, ",%d", context->freqs[module]);
|
||||
}
|
||||
|
||||
for (unsigned int sensor = 0; sensor < SysClkThermalSensor_EnumMax; sensor++) {
|
||||
for (unsigned int sensor = 0; sensor < HocClkThermalSensor_EnumMax; sensor++) {
|
||||
fprintf(file, ",%d", context->temps[sensor]);
|
||||
}
|
||||
|
||||
for (unsigned int module = 0; module < SysClkModule_EnumMax; module++) {
|
||||
for (unsigned int module = 0; module < HocClkModule_EnumMax; module++) {
|
||||
fprintf(file, ",%d", context->realFreqs[module]);
|
||||
}
|
||||
|
||||
for (unsigned int sensor = 0; sensor < SysClkPowerSensor_EnumMax; sensor++) {
|
||||
for (unsigned int sensor = 0; sensor < HocClkPowerSensor_EnumMax; sensor++) {
|
||||
fprintf(file, ",%d", context->power[sensor]);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <string>
|
||||
#include <atomic>
|
||||
#include <cstdarg>
|
||||
#include <sysclk.h>
|
||||
#include <hocclk.h>
|
||||
|
||||
#define FILE_CONFIG_DIR "/config/" TARGET
|
||||
#define FILE_FLAG_CHECK_INTERVAL_NS (10000ULL * 1000000000ULL)
|
||||
@@ -48,6 +48,6 @@ namespace fileUtils {
|
||||
bool IsLogEnabled();
|
||||
void InitializeAsync();
|
||||
void LogLine(const char* format, ...);
|
||||
void WriteContextToCsv(const SysClkContext* context);
|
||||
void WriteContextToCsv(const HocClkContext* context);
|
||||
|
||||
}
|
||||
|
||||
@@ -22,11 +22,11 @@ namespace governor {
|
||||
|
||||
void HandleGovernor(uint32_t targetHz)
|
||||
{
|
||||
u32 tempTargetHz = clockManager::gContext.overrideFreqs[HorizonOCModule_Governor];
|
||||
u32 tempTargetHz = clockManager::gContext.overrideFreqs[HocClkModule_Governor];
|
||||
if (!tempTargetHz) {
|
||||
tempTargetHz = config::GetAutoClockHz(clockManager::gContext.applicationId, HorizonOCModule_Governor, clockManager::gContext.profile, true);
|
||||
tempTargetHz = config::GetAutoClockHz(clockManager::gContext.applicationId, HocClkModule_Governor, clockManager::gContext.profile, true);
|
||||
if (!tempTargetHz)
|
||||
tempTargetHz = config::GetAutoClockHz(GLOBAL_PROFILE_ID, HorizonOCModule_Governor, clockManager::gContext.profile, true);
|
||||
tempTargetHz = config::GetAutoClockHz(GLOBAL_PROFILE_ID, HocClkModule_Governor, clockManager::gContext.profile, true);
|
||||
}
|
||||
|
||||
auto resolve = [](u8 app, u8 temp) -> u8 {
|
||||
@@ -81,7 +81,7 @@ namespace governor {
|
||||
return table.count - 1;
|
||||
}
|
||||
|
||||
u32 ResolveTargetHz(SysClkModule module)
|
||||
u32 ResolveTargetHz(HocClkModule module)
|
||||
{
|
||||
u32 hz = clockManager::gContext.overrideFreqs[module];
|
||||
if (!hz)
|
||||
@@ -123,7 +123,7 @@ namespace governor {
|
||||
isCpuGovernorInBoostMode = false;
|
||||
}
|
||||
|
||||
auto& table = clockManager::gFreqTable[SysClkModule_CPU];
|
||||
auto& table = clockManager::gFreqTable[HocClkModule_CPU];
|
||||
|
||||
if (table.count == 0)
|
||||
continue;
|
||||
@@ -134,8 +134,8 @@ namespace governor {
|
||||
|
||||
u32 tableMaxHz = table.list[table.count - 1];
|
||||
u32 desiredHz = SchedutilTargetHz(cpuLoad, tableMaxHz);
|
||||
u32 targetHz = ResolveTargetHz(SysClkModule_CPU);
|
||||
u32 maxHz = clockManager::GetMaxAllowedHz(SysClkModule_CPU, clockManager::gContext.profile);
|
||||
u32 targetHz = ResolveTargetHz(HocClkModule_CPU);
|
||||
u32 maxHz = clockManager::GetMaxAllowedHz(HocClkModule_CPU, clockManager::gContext.profile);
|
||||
|
||||
if (targetHz && desiredHz > targetHz)
|
||||
desiredHz = targetHz;
|
||||
@@ -157,16 +157,16 @@ namespace governor {
|
||||
downHoldRemaining--;
|
||||
|
||||
if (++tick > 50) {
|
||||
minHz = config::GetConfigValue(HorizonOCConfigValue_CpuGovernorMinimumFreq);
|
||||
minHz = config::GetConfigValue(HocClkConfigValue_CpuGovernorMinimumFreq);
|
||||
tick = 0;
|
||||
}
|
||||
|
||||
if (newHz < minHz)
|
||||
newHz = minHz;
|
||||
|
||||
if ((!goingDown || (downHoldRemaining == 0)) && clockManager::IsAssignableHz(SysClkModule_CPU, newHz)) {
|
||||
board::SetHz(SysClkModule_CPU, newHz);
|
||||
clockManager::gContext.freqs[SysClkModule_CPU] = newHz;
|
||||
if ((!goingDown || (downHoldRemaining == 0)) && clockManager::IsAssignableHz(HocClkModule_CPU, newHz)) {
|
||||
board::SetHz(HocClkModule_CPU, newHz);
|
||||
clockManager::gContext.freqs[HocClkModule_CPU] = newHz;
|
||||
lastHz = newHz;
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ namespace governor {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto& table = clockManager::gFreqTable[SysClkModule_GPU];
|
||||
auto& table = clockManager::gFreqTable[HocClkModule_GPU];
|
||||
if (table.count == 0)
|
||||
continue;
|
||||
|
||||
@@ -198,8 +198,8 @@ namespace governor {
|
||||
u32 gpuLoad = board::GetPartLoad(HocClkPartLoad_GPU);
|
||||
u32 tableMaxHz = table.list[table.count - 1];
|
||||
u32 desiredHz = SchedutilTargetHz(gpuLoad, tableMaxHz);
|
||||
u32 targetHz = ResolveTargetHz(SysClkModule_GPU);
|
||||
u32 maxHz = clockManager::GetMaxAllowedHz(SysClkModule_GPU, clockManager::gContext.profile);
|
||||
u32 targetHz = ResolveTargetHz(HocClkModule_GPU);
|
||||
u32 maxHz = clockManager::GetMaxAllowedHz(HocClkModule_GPU, clockManager::gContext.profile);
|
||||
|
||||
if (targetHz && desiredHz > targetHz)
|
||||
desiredHz = targetHz;
|
||||
@@ -218,9 +218,9 @@ namespace governor {
|
||||
if (downHoldRemaining > 0)
|
||||
downHoldRemaining--;
|
||||
|
||||
if ((!goingDown || (downHoldRemaining == 0)) && clockManager::IsAssignableHz(SysClkModule_GPU, newHz)) {
|
||||
board::SetHz(SysClkModule_GPU, newHz);
|
||||
clockManager::gContext.freqs[SysClkModule_GPU] = newHz;
|
||||
if ((!goingDown || (downHoldRemaining == 0)) && clockManager::IsAssignableHz(HocClkModule_GPU, newHz)) {
|
||||
board::SetHz(HocClkModule_GPU, newHz);
|
||||
clockManager::gContext.freqs[HocClkModule_GPU] = newHz;
|
||||
lastHz = newHz;
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ namespace governor {
|
||||
|
||||
u8 tick = 0;
|
||||
for (;;) {
|
||||
if (!clockManager::gRunning || clockManager::gContext.profile == SysClkProfile_Docked || !isVRREnabled) {
|
||||
if (!clockManager::gRunning || clockManager::gContext.profile == HocClkProfile_Docked || !isVRREnabled) {
|
||||
svcSleepThread(POLL_NS);
|
||||
continue;
|
||||
}
|
||||
@@ -259,11 +259,11 @@ namespace governor {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
u32 targetHz = clockManager::gContext.overrideFreqs[HorizonOCModule_Display];
|
||||
u32 targetHz = clockManager::gContext.overrideFreqs[HocClkModule_Display];
|
||||
if (!targetHz) {
|
||||
targetHz = config::GetAutoClockHz(clockManager::gContext.applicationId, HorizonOCModule_Display, clockManager::gContext.profile, false);
|
||||
targetHz = config::GetAutoClockHz(clockManager::gContext.applicationId, HocClkModule_Display, clockManager::gContext.profile, false);
|
||||
if (!targetHz)
|
||||
targetHz = config::GetAutoClockHz(GLOBAL_PROFILE_ID, HorizonOCModule_Display, clockManager::gContext.profile, false);
|
||||
targetHz = config::GetAutoClockHz(GLOBAL_PROFILE_ID, HocClkModule_Display, clockManager::gContext.profile, false);
|
||||
}
|
||||
|
||||
u8 maxDisplay;
|
||||
@@ -273,28 +273,28 @@ namespace governor {
|
||||
maxDisplay = 60; // don't assume display stuff!
|
||||
}
|
||||
|
||||
u8 minDisplay = board::GetConsoleType() == HorizonOCConsoleType_Aula ? 45 : 40;
|
||||
u8 minDisplay = board::GetConsoleType() == HocClkConsoleType_Aula ? 45 : 40;
|
||||
if (maxDisplay == minDisplay)
|
||||
continue;
|
||||
|
||||
if (fps >= minDisplay && fps <= maxDisplay) {
|
||||
board::SetHz(HorizonOCModule_Display, fps);
|
||||
clockManager::gContext.freqs[HorizonOCModule_Display] = fps;
|
||||
clockManager::gContext.realFreqs[HorizonOCModule_Display] = fps;
|
||||
board::SetHz(HocClkModule_Display, fps);
|
||||
clockManager::gContext.freqs[HocClkModule_Display] = fps;
|
||||
clockManager::gContext.realFreqs[HocClkModule_Display] = fps;
|
||||
} else {
|
||||
for (u32 i = 0; i < 10; i++) {
|
||||
u32 compareHz = fps * i;
|
||||
if (compareHz >= minDisplay && compareHz <= maxDisplay) {
|
||||
board::SetHz(HorizonOCModule_Display, compareHz);
|
||||
clockManager::gContext.freqs[HorizonOCModule_Display] = compareHz;
|
||||
clockManager::gContext.realFreqs[HorizonOCModule_Display] = compareHz;
|
||||
board::SetHz(HocClkModule_Display, compareHz);
|
||||
clockManager::gContext.freqs[HocClkModule_Display] = compareHz;
|
||||
clockManager::gContext.realFreqs[HocClkModule_Display] = compareHz;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (++tick > 50) {
|
||||
board::SetHz(HorizonOCModule_Display, maxDisplay);
|
||||
board::SetHz(HocClkModule_Display, maxDisplay);
|
||||
tick = 0;
|
||||
svcSleepThread(50'000'000);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <switch.h>
|
||||
#include <sysclk.h>
|
||||
#include <hocclk.h>
|
||||
#include "board/board.hpp"
|
||||
#include "clock_manager.hpp"
|
||||
#include <cstring>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <switch.h>
|
||||
#include <sysclk.h>
|
||||
#include <hocclk.h>
|
||||
|
||||
namespace integrations {
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace ipcService {
|
||||
IpcServer gServer;
|
||||
|
||||
Result GetApiVersion(u32* out_version) {
|
||||
*out_version = SYSCLK_IPC_API_VERSION;
|
||||
*out_version = HOCCLK_IPC_API_VERSION;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace ipcService {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Result GetCurrentContext(SysClkContext* out_ctx) {
|
||||
Result GetCurrentContext(HocClkContext* out_ctx) {
|
||||
*out_ctx = clockManager::GetCurrentContext();
|
||||
return 0;
|
||||
}
|
||||
@@ -66,27 +66,27 @@ namespace ipcService {
|
||||
|
||||
Result GetProfileCount(std::uint64_t* tid, std::uint8_t* out_count) {
|
||||
if (!config::HasProfilesLoaded()) {
|
||||
return SYSCLK_ERROR(ConfigNotLoaded);
|
||||
return HOCCLK_ERROR(ConfigNotLoaded);
|
||||
}
|
||||
*out_count = config::GetProfileCount(*tid);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Result GetProfiles(std::uint64_t* tid, SysClkTitleProfileList* out_profiles) {
|
||||
Result GetProfiles(std::uint64_t* tid, HocClkTitleProfileList* out_profiles) {
|
||||
if (!config::HasProfilesLoaded()) {
|
||||
return SYSCLK_ERROR(ConfigNotLoaded);
|
||||
return HOCCLK_ERROR(ConfigNotLoaded);
|
||||
}
|
||||
config::GetProfiles(*tid, out_profiles);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Result SetProfiles(SysClkIpc_SetProfiles_Args* args) {
|
||||
Result SetProfiles(HocClkIpc_SetProfiles_Args* args) {
|
||||
if (!config::HasProfilesLoaded()) {
|
||||
return SYSCLK_ERROR(ConfigNotLoaded);
|
||||
return HOCCLK_ERROR(ConfigNotLoaded);
|
||||
}
|
||||
SysClkTitleProfileList profiles = args->profiles;
|
||||
HocClkTitleProfileList profiles = args->profiles;
|
||||
if (!config::SetProfiles(args->tid, &profiles, true)) {
|
||||
return SYSCLK_ERROR(ConfigSaveFailed);
|
||||
return HOCCLK_ERROR(ConfigSaveFailed);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -96,39 +96,39 @@ namespace ipcService {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Result SetOverride(SysClkIpc_SetOverride_Args* args) {
|
||||
if (!SYSCLK_ENUM_VALID(SysClkModule, args->module)) {
|
||||
return SYSCLK_ERROR(Generic);
|
||||
Result SetOverride(HocClkIpc_SetOverride_Args* args) {
|
||||
if (!HOCCLK_ENUM_VALID(HocClkModule, args->module)) {
|
||||
return HOCCLK_ERROR(Generic);
|
||||
}
|
||||
config::SetOverrideHz(args->module, args->hz);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Result GetConfigValuesHandler(SysClkConfigValueList* out_configValues) {
|
||||
Result GetConfigValuesHandler(HocClkConfigValueList* out_configValues) {
|
||||
if (!config::HasProfilesLoaded()) {
|
||||
return SYSCLK_ERROR(ConfigNotLoaded);
|
||||
return HOCCLK_ERROR(ConfigNotLoaded);
|
||||
}
|
||||
config::GetConfigValues(out_configValues);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Result SetConfigValuesHandler(SysClkConfigValueList* configValues) {
|
||||
Result SetConfigValuesHandler(HocClkConfigValueList* configValues) {
|
||||
if (!config::HasProfilesLoaded()) {
|
||||
return SYSCLK_ERROR(ConfigNotLoaded);
|
||||
return HOCCLK_ERROR(ConfigNotLoaded);
|
||||
}
|
||||
SysClkConfigValueList copy = *configValues;
|
||||
HocClkConfigValueList copy = *configValues;
|
||||
if (!config::SetConfigValues(©, true)) {
|
||||
return SYSCLK_ERROR(ConfigSaveFailed);
|
||||
return HOCCLK_ERROR(ConfigSaveFailed);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Result GetFreqList(SysClkIpc_GetFreqList_Args* args, std::uint32_t* out_list, std::size_t size, std::uint32_t* out_count) {
|
||||
if (!SYSCLK_ENUM_VALID(SysClkModule, args->module)) {
|
||||
return SYSCLK_ERROR(Generic);
|
||||
Result GetFreqList(HocClkIpc_GetFreqList_Args* args, std::uint32_t* out_list, std::size_t size, std::uint32_t* out_count) {
|
||||
if (!HOCCLK_ENUM_VALID(HocClkModule, args->module)) {
|
||||
return HOCCLK_ERROR(Generic);
|
||||
}
|
||||
if (args->maxCount != size/sizeof(*out_list)) {
|
||||
return SYSCLK_ERROR(Generic);
|
||||
return HOCCLK_ERROR(Generic);
|
||||
}
|
||||
clockManager::GetFreqList(args->module, out_list, args->maxCount, out_count);
|
||||
return 0;
|
||||
@@ -137,11 +137,11 @@ namespace ipcService {
|
||||
Result ServiceHandlerFunc(void* arg, const IpcServerRequest* r, u8* out_data, size_t* out_dataSize) {
|
||||
(void)arg;
|
||||
switch (r->data.cmdId) {
|
||||
case SysClkIpcCmd_GetApiVersion:
|
||||
case HocClkIpcCmd_GetApiVersion:
|
||||
*out_dataSize = sizeof(u32);
|
||||
return GetApiVersion((u32*)out_data);
|
||||
|
||||
case SysClkIpcCmd_GetVersionString:
|
||||
case HocClkIpcCmd_GetVersionString:
|
||||
if (r->hipc.meta.num_recv_buffers >= 1) {
|
||||
return GetVersionString(
|
||||
(char*)hipcGetBufferAddress(r->hipc.data.recv_buffers),
|
||||
@@ -150,75 +150,75 @@ namespace ipcService {
|
||||
}
|
||||
break;
|
||||
|
||||
case SysClkIpcCmd_GetCurrentContext:
|
||||
case HocClkIpcCmd_GetCurrentContext:
|
||||
if (r->data.size >= sizeof(std::uint64_t) && r->hipc.meta.num_recv_buffers >= 1) {
|
||||
size_t bufSize = hipcGetBufferSize(r->hipc.data.recv_buffers);
|
||||
if (bufSize >= sizeof(SysClkContext)) {
|
||||
return GetCurrentContext((SysClkContext*)hipcGetBufferAddress(r->hipc.data.recv_buffers));
|
||||
if (bufSize >= sizeof(HocClkContext)) {
|
||||
return GetCurrentContext((HocClkContext*)hipcGetBufferAddress(r->hipc.data.recv_buffers));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SysClkIpcCmd_Exit:
|
||||
case HocClkIpcCmd_Exit:
|
||||
return ExitHandler();
|
||||
|
||||
case SysClkIpcCmd_GetProfileCount:
|
||||
case HocClkIpcCmd_GetProfileCount:
|
||||
if (r->data.size >= sizeof(std::uint64_t)) {
|
||||
*out_dataSize = sizeof(std::uint8_t);
|
||||
return GetProfileCount((std::uint64_t*)r->data.ptr, (std::uint8_t*)out_data);
|
||||
}
|
||||
break;
|
||||
|
||||
case SysClkIpcCmd_GetProfiles:
|
||||
case HocClkIpcCmd_GetProfiles:
|
||||
if (r->data.size >= sizeof(std::uint64_t) && r->hipc.meta.num_recv_buffers >= 1) {
|
||||
size_t bufSize = hipcGetBufferSize(r->hipc.data.recv_buffers);
|
||||
if (bufSize >= sizeof(SysClkTitleProfileList)) {
|
||||
return GetProfiles((std::uint64_t*)r->data.ptr, (SysClkTitleProfileList*)hipcGetBufferAddress(r->hipc.data.recv_buffers));
|
||||
if (bufSize >= sizeof(HocClkTitleProfileList)) {
|
||||
return GetProfiles((std::uint64_t*)r->data.ptr, (HocClkTitleProfileList*)hipcGetBufferAddress(r->hipc.data.recv_buffers));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SysClkIpcCmd_SetProfiles:
|
||||
if (r->data.size >= sizeof(SysClkIpc_SetProfiles_Args)) {
|
||||
return SetProfiles((SysClkIpc_SetProfiles_Args*)r->data.ptr);
|
||||
case HocClkIpcCmd_SetProfiles:
|
||||
if (r->data.size >= sizeof(HocClkIpc_SetProfiles_Args)) {
|
||||
return SetProfiles((HocClkIpc_SetProfiles_Args*)r->data.ptr);
|
||||
}
|
||||
break;
|
||||
|
||||
case SysClkIpcCmd_SetEnabled:
|
||||
case HocClkIpcCmd_SetEnabled:
|
||||
if (r->data.size >= sizeof(std::uint8_t)) {
|
||||
return SetEnabled((std::uint8_t*)r->data.ptr);
|
||||
}
|
||||
break;
|
||||
|
||||
case SysClkIpcCmd_SetOverride:
|
||||
if (r->data.size >= sizeof(SysClkIpc_SetOverride_Args)) {
|
||||
return SetOverride((SysClkIpc_SetOverride_Args*)r->data.ptr);
|
||||
case HocClkIpcCmd_SetOverride:
|
||||
if (r->data.size >= sizeof(HocClkIpc_SetOverride_Args)) {
|
||||
return SetOverride((HocClkIpc_SetOverride_Args*)r->data.ptr);
|
||||
}
|
||||
break;
|
||||
|
||||
case SysClkIpcCmd_GetConfigValues:
|
||||
case HocClkIpcCmd_GetConfigValues:
|
||||
if (r->hipc.meta.num_recv_buffers >= 1) {
|
||||
size_t bufSize = hipcGetBufferSize(r->hipc.data.recv_buffers);
|
||||
if (bufSize >= sizeof(SysClkConfigValueList)) {
|
||||
return GetConfigValuesHandler((SysClkConfigValueList*)hipcGetBufferAddress(r->hipc.data.recv_buffers));
|
||||
if (bufSize >= sizeof(HocClkConfigValueList)) {
|
||||
return GetConfigValuesHandler((HocClkConfigValueList*)hipcGetBufferAddress(r->hipc.data.recv_buffers));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SysClkIpcCmd_SetConfigValues:
|
||||
case HocClkIpcCmd_SetConfigValues:
|
||||
if (r->hipc.meta.num_send_buffers >= 1) {
|
||||
size_t bufSize = hipcGetBufferSize(r->hipc.data.send_buffers);
|
||||
if (bufSize >= sizeof(SysClkConfigValueList)) {
|
||||
return SetConfigValuesHandler((SysClkConfigValueList*)hipcGetBufferAddress(r->hipc.data.send_buffers));
|
||||
if (bufSize >= sizeof(HocClkConfigValueList)) {
|
||||
return SetConfigValuesHandler((HocClkConfigValueList*)hipcGetBufferAddress(r->hipc.data.send_buffers));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SysClkIpcCmd_GetFreqList:
|
||||
if (r->data.size >= sizeof(SysClkIpc_GetFreqList_Args) && r->hipc.meta.num_recv_buffers >= 1) {
|
||||
case HocClkIpcCmd_GetFreqList:
|
||||
if (r->data.size >= sizeof(HocClkIpc_GetFreqList_Args) && r->hipc.meta.num_recv_buffers >= 1) {
|
||||
*out_dataSize = sizeof(std::uint32_t);
|
||||
return GetFreqList(
|
||||
(SysClkIpc_GetFreqList_Args*)r->data.ptr,
|
||||
(HocClkIpc_GetFreqList_Args*)r->data.ptr,
|
||||
(std::uint32_t*)hipcGetBufferAddress(r->hipc.data.recv_buffers),
|
||||
hipcGetBufferSize(r->hipc.data.recv_buffers),
|
||||
(std::uint32_t*)out_data
|
||||
@@ -234,7 +234,7 @@ namespace ipcService {
|
||||
break;
|
||||
}
|
||||
|
||||
return SYSCLK_ERROR(Generic);
|
||||
return HOCCLK_ERROR(Generic);
|
||||
}
|
||||
|
||||
void ProcessThreadFunc(void* arg) {
|
||||
@@ -259,7 +259,7 @@ namespace ipcService {
|
||||
std::int32_t priority;
|
||||
Result rc = svcGetThreadPriority(&priority, CUR_THREAD_HANDLE);
|
||||
ASSERT_RESULT_OK(rc, "svcGetThreadPriority");
|
||||
rc = ipcServerInit(&gServer, SYSCLK_IPC_SERVICE_NAME, 42);
|
||||
rc = ipcServerInit(&gServer, HOCCLK_IPC_SERVICE_NAME, 42);
|
||||
ASSERT_RESULT_OK(rc, "ipcServerInit");
|
||||
rc = threadCreate(&gThread, &ProcessThreadFunc, nullptr, NULL, 0x2000, priority, -2);
|
||||
ASSERT_RESULT_OK(rc, "threadCreate");
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <sysclk.h>
|
||||
#include <hocclk.h>
|
||||
#include <switch.h>
|
||||
|
||||
namespace ipcService {
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace kip {
|
||||
void SetKipData()
|
||||
{
|
||||
// TODO: figure out if this REALLY causes issues (i doubt it)
|
||||
// if(board::GetSocType() == SysClkSocType_Mariko) {
|
||||
// if(board::GetSocType() == HocClkSocType_Mariko) {
|
||||
// if(R_FAILED(I2c_BuckConverter_SetMvOut(&I2c_Mariko_DRAM_VDDQ, config::GetConfigValue(KipConfigValue_marikoEmcVddqVolt) / 1000))) {
|
||||
// fileUtils::LogLine("[clock_manager] Failed set i2c vddq");
|
||||
// notification::writeNotification("Horizon OC\nFailed to write I2C\nwhile setting vddq");
|
||||
@@ -108,11 +108,11 @@ namespace kip {
|
||||
CUST_WRITE_FIELD_BATCH(&table, gpuSpeedo, config::GetConfigValue(KipConfigValue_gpuSpeedo));
|
||||
|
||||
for (int i = 0; i < 24; i++) {
|
||||
table.marikoGpuVoltArray[i] = config::GetConfigValue((SysClkConfigValue)(KipConfigValue_g_volt_76800 + i));
|
||||
table.marikoGpuVoltArray[i] = config::GetConfigValue((HocClkConfigValue)(KipConfigValue_g_volt_76800 + i));
|
||||
}
|
||||
|
||||
for (int i = 0; i < 27; i++) {
|
||||
table.eristaGpuVoltArray[i] = config::GetConfigValue((SysClkConfigValue)(KipConfigValue_g_volt_e_76800 + i));
|
||||
table.eristaGpuVoltArray[i] = config::GetConfigValue((HocClkConfigValue)(KipConfigValue_g_volt_e_76800 + i));
|
||||
}
|
||||
|
||||
CUST_WRITE_FIELD_BATCH(&table, t6_tRTW_fine_tune, config::GetConfigValue(KipConfigValue_t6_tRTW_fine_tune));
|
||||
@@ -123,7 +123,7 @@ namespace kip {
|
||||
notification::writeNotification("Horizon OC\nKip write failed");
|
||||
}
|
||||
|
||||
SysClkConfigValueList configValues;
|
||||
HocClkConfigValueList configValues;
|
||||
config::GetConfigValues(&configValues);
|
||||
|
||||
configValues.values[KipCrc32] = (u64)crc32::checksum_file("sdmc:/atmosphere/kips/hoc.kip"); // write checksum
|
||||
@@ -153,7 +153,7 @@ namespace kip {
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
SysClkConfigValueList configValues;
|
||||
HocClkConfigValueList configValues;
|
||||
config::GetConfigValues(&configValues);
|
||||
|
||||
CustomizeTable table;
|
||||
@@ -236,7 +236,7 @@ namespace kip {
|
||||
// if(cust_get_cust_rev(&table) == KIP_CUST_REV)
|
||||
// return;
|
||||
|
||||
if (sizeof(SysClkConfigValueList) <= sizeof(configValues)) {
|
||||
if (sizeof(HocClkConfigValueList) <= sizeof(configValues)) {
|
||||
if (config::SetConfigValues(&configValues, false)) {
|
||||
fileUtils::LogLine("[clock_manager] Successfully loaded KIP data into config");
|
||||
} else {
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
*/
|
||||
|
||||
#include <switch.h>
|
||||
#include <sysclk.h>
|
||||
#include <hocclk.h>
|
||||
#include "soctherm.hpp"
|
||||
#include "board/board.hpp"
|
||||
#include "file_utils.hpp"
|
||||
@@ -551,7 +551,7 @@ namespace soctherm {
|
||||
temps.gpu = TranslateTemp(ReadReg(socthermVa, SENSOR_TEMP1) & SENSOR_TEMP1_GPU_TEMP_MASK);
|
||||
temps.pllx = TranslateTemp(ReadReg(socthermVa, SENSOR_TEMP2) & SENSOR_TEMP2_PLLX_TEMP_MASK);
|
||||
|
||||
if (board::GetSocType() == SysClkSocType_Erista) {
|
||||
if (board::GetSocType() == HocClkSocType_Erista) {
|
||||
temps.mem = TranslateTemp(ReadReg(socthermVa, SENSOR_TEMP2) >> 16);
|
||||
} else {
|
||||
temps.mem = -1;
|
||||
@@ -617,7 +617,7 @@ namespace soctherm {
|
||||
}
|
||||
|
||||
void Initialize() {
|
||||
isMariko = board::GetSocType() == SysClkSocType_Mariko;
|
||||
isMariko = board::GetSocType() == HocClkSocType_Mariko;
|
||||
|
||||
constexpr u64 SocthermPa = 0x700E2000, FusePa = 0x7000F000, CarPa = 0x60006000;
|
||||
R_UNLESS(MapAddress(socthermVa, SocthermPa, "soctherm"));
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <switch.h>
|
||||
#include <sysclk.h>
|
||||
#include <hocclk.h>
|
||||
|
||||
namespace soctherm {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user