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:
souldbminersmwc
2026-04-02 16:48:10 -04:00
parent 234fb1655c
commit 52e8f5c584
65 changed files with 1082 additions and 1082 deletions

View File

@@ -24,7 +24,7 @@ extern "C"
{ {
#endif #endif
#include <sysclk/client/ipc.h> #include <hocclk/client/ipc.h>
#if defined(__cplusplus) #if defined(__cplusplus)
} }
@@ -83,7 +83,7 @@ Result nvdecCheck = 1;
Result nvencCheck = 1; Result nvencCheck = 1;
Result nvjpgCheck = 1; Result nvjpgCheck = 1;
Result nifmCheck = 1; Result nifmCheck = 1;
Result sysclkCheck = 1; Result hocclkCheck = 1;
Result pwmDutyCycleCheck = 1; Result pwmDutyCycleCheck = 1;
//Wi-Fi //Wi-Fi
@@ -222,7 +222,7 @@ uint64_t lastFrameNumber = 0;
uint32_t realCPU_Hz = 0; uint32_t realCPU_Hz = 0;
uint32_t realGPU_Hz = 0; uint32_t realGPU_Hz = 0;
uint32_t realRAM_Hz = 0; uint32_t realRAM_Hz = 0;
uint32_t partLoad[SysClkPartLoad_EnumMax]; uint32_t partLoad[HocClkPartLoad_EnumMax];
uint32_t realCPU_mV = 0; uint32_t realCPU_mV = 0;
uint32_t realGPU_mV = 0; uint32_t realGPU_mV = 0;
uint32_t realRAM_mV = 0; uint32_t realRAM_mV = 0;
@@ -512,7 +512,7 @@ void gpuLoadThread(void*) {
std::string getVersionString() { std::string getVersionString() {
char buf[0x100] = ""; // 256 bytes — safe for any expected version string 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') { if (R_FAILED(rc) || buf[0] == '\0') {
return "unknown"; return "unknown";
} }
@@ -575,24 +575,24 @@ void Misc(void*) {
} }
// Get sys-clk data // Get sys-clk data
if (R_SUCCEEDED(sysclkCheck)) { if (R_SUCCEEDED(hocclkCheck)) {
SysClkContext sysclkCTX; HocClkContext hocclkCTX;
if (R_SUCCEEDED(sysclkIpcGetCurrentContext(&sysclkCTX))) { if (R_SUCCEEDED(hocclkIpcGetCurrentContext(&hocclkCTX))) {
realCPU_Hz = sysclkCTX.realFreqs[SysClkModule_CPU]; realCPU_Hz = hocclkCTX.realFreqs[HocClkModule_CPU];
realGPU_Hz = sysclkCTX.realFreqs[SysClkModule_GPU]; realGPU_Hz = hocclkCTX.realFreqs[HocClkModule_GPU];
realRAM_Hz = sysclkCTX.realFreqs[SysClkModule_MEM]; realRAM_Hz = hocclkCTX.realFreqs[HocClkModule_MEM];
partLoad[SysClkPartLoad_EMC] = sysclkCTX.partLoad[SysClkPartLoad_EMC]; partLoad[HocClkPartLoad_EMC] = hocclkCTX.partLoad[HocClkPartLoad_EMC];
partLoad[SysClkPartLoad_EMCCpu] = sysclkCTX.partLoad[SysClkPartLoad_EMCCpu]; partLoad[HocClkPartLoad_EMCCpu] = hocclkCTX.partLoad[HocClkPartLoad_EMCCpu];
realCPU_Temp = sysclkCTX.temps[HorizonOCThermalSensor_CPU]; realCPU_Temp = hocclkCTX.temps[HocClkThermalSensor_CPU];
realGPU_Temp = sysclkCTX.temps[HorizonOCThermalSensor_GPU]; realGPU_Temp = hocclkCTX.temps[HocClkThermalSensor_GPU];
realRAM_Temp = sysclkCTX.temps[HorizonOCThermalSensor_MEM]; realRAM_Temp = hocclkCTX.temps[HocClkThermalSensor_MEM];
realCPU_mV = sysclkCTX.voltages[HocClkVoltage_CPU]; realCPU_mV = hocclkCTX.voltages[HocClkVoltage_CPU];
realGPU_mV = sysclkCTX.voltages[HocClkVoltage_GPU]; realGPU_mV = hocclkCTX.voltages[HocClkVoltage_GPU];
realRAM_mV = sysclkCTX.voltages[HocClkVoltage_EMCVDD2]; realRAM_mV = hocclkCTX.voltages[HocClkVoltage_EMCVDD2];
realSOC_mV = sysclkCTX.voltages[HocClkVoltage_SOC]; realSOC_mV = hocclkCTX.voltages[HocClkVoltage_SOC];
const u32 vdd2_mV = sysclkCTX.voltages[HocClkVoltage_EMCVDD2] / 1000; // µV to mV const u32 vdd2_mV = hocclkCTX.voltages[HocClkVoltage_EMCVDD2] / 1000; // µV to mV
const u32 vddq_mV = sysclkCTX.voltages[HocClkVoltage_EMCVDDQ] / 1000; // µV to mV const u32 vddq_mV = hocclkCTX.voltages[HocClkVoltage_EMCVDDQ] / 1000; // µV to mV
realRAM_mV = vdd2_mV * 100000 + vddq_mV * 10; realRAM_mV = vdd2_mV * 100000 + vddq_mV * 10;
} }
@@ -711,22 +711,22 @@ void Misc3(void*) {
mutexLock(&mutex_Misc); mutexLock(&mutex_Misc);
// Get sys-clk data // Get sys-clk data
if (R_SUCCEEDED(sysclkCheck)) { if (R_SUCCEEDED(hocclkCheck)) {
SysClkContext sysclkCTX; HocClkContext hocclkCTX;
if (R_SUCCEEDED(sysclkIpcGetCurrentContext(&sysclkCTX))) { if (R_SUCCEEDED(hocclkIpcGetCurrentContext(&hocclkCTX))) {
partLoad[SysClkPartLoad_EMC] = sysclkCTX.partLoad[SysClkPartLoad_EMC]; partLoad[HocClkPartLoad_EMC] = hocclkCTX.partLoad[HocClkPartLoad_EMC];
partLoad[SysClkPartLoad_EMCCpu] = sysclkCTX.partLoad[SysClkPartLoad_EMCCpu]; partLoad[HocClkPartLoad_EMCCpu] = hocclkCTX.partLoad[HocClkPartLoad_EMCCpu];
realCPU_Temp = sysclkCTX.temps[HorizonOCThermalSensor_CPU]; realCPU_Temp = hocclkCTX.temps[HocClkThermalSensor_CPU];
realGPU_Temp = sysclkCTX.temps[HorizonOCThermalSensor_GPU]; realGPU_Temp = hocclkCTX.temps[HocClkThermalSensor_GPU];
realRAM_Temp = sysclkCTX.temps[HorizonOCThermalSensor_MEM]; realRAM_Temp = hocclkCTX.temps[HocClkThermalSensor_MEM];
realCPU_mV = sysclkCTX.voltages[HocClkVoltage_CPU]; realCPU_mV = hocclkCTX.voltages[HocClkVoltage_CPU];
realGPU_mV = sysclkCTX.voltages[HocClkVoltage_GPU]; realGPU_mV = hocclkCTX.voltages[HocClkVoltage_GPU];
realRAM_mV = sysclkCTX.voltages[HocClkVoltage_EMCVDD2]; realRAM_mV = hocclkCTX.voltages[HocClkVoltage_EMCVDD2];
realSOC_mV = sysclkCTX.voltages[HocClkVoltage_SOC]; realSOC_mV = hocclkCTX.voltages[HocClkVoltage_SOC];
const u32 vdd2_mV = sysclkCTX.voltages[HocClkVoltage_EMCVDD2] / 1000; // µV to mV const u32 vdd2_mV = hocclkCTX.voltages[HocClkVoltage_EMCVDD2] / 1000; // µV to mV
const u32 vddq_mV = sysclkCTX.voltages[HocClkVoltage_EMCVDDQ] / 1000; // µV to mV const u32 vddq_mV = hocclkCTX.voltages[HocClkVoltage_EMCVDDQ] / 1000; // µV to mV
realRAM_mV = vdd2_mV * 100000 + vddq_mV * 10; realRAM_mV = vdd2_mV * 100000 + vddq_mV * 10;
} }

View File

@@ -441,13 +441,13 @@ public:
if (SaltySD) { if (SaltySD) {
LoadSharedMemoryAndRefreshRate(); LoadSharedMemoryAndRefreshRate();
} }
if (sysclkIpcRunning() && R_SUCCEEDED(sysclkIpcInitialize())) { if (hocclkIpcRunning() && R_SUCCEEDED(hocclkIpcInitialize())) {
uint32_t sysClkApiVer = 0; uint32_t hocClkApiVer = 0;
sysclkIpcGetAPIVersion(&sysClkApiVer); hocclkIpcGetAPIVersion(&hocClkApiVer);
if (sysClkApiVer != SYSCLK_IPC_API_VERSION) { if (hocClkApiVer != HOCCLK_IPC_API_VERSION) {
sysclkIpcExit(); hocclkIpcExit();
} }
else sysclkCheck = 0; else hocclkCheck = 0;
} }
if (R_SUCCEEDED(splInitialize())) { if (R_SUCCEEDED(splInitialize())) {
u64 sku = 0; u64 sku = 0;
@@ -468,8 +468,8 @@ public:
virtual void exitServices() override { virtual void exitServices() override {
CloseThreads(); CloseThreads();
if (R_SUCCEEDED(sysclkCheck)) { if (R_SUCCEEDED(hocclkCheck)) {
sysclkIpcExit(); hocclkIpcExit();
} }
shmemClose(&_sharedmemory); shmemClose(&_sharedmemory);
//Exit services //Exit services
@@ -525,13 +525,13 @@ public:
if (SaltySD) { if (SaltySD) {
LoadSharedMemory(); LoadSharedMemory();
} }
if (sysclkIpcRunning() && R_SUCCEEDED(sysclkIpcInitialize())) { if (hocclkIpcRunning() && R_SUCCEEDED(hocclkIpcInitialize())) {
uint32_t sysClkApiVer = 0; uint32_t hocClkApiVer = 0;
sysclkIpcGetAPIVersion(&sysClkApiVer); hocclkIpcGetAPIVersion(&hocClkApiVer);
if (sysClkApiVer != SYSCLK_IPC_API_VERSION) { if (hocClkApiVer != HOCCLK_IPC_API_VERSION) {
sysclkIpcExit(); hocclkIpcExit();
} }
else sysclkCheck = 0; else hocclkCheck = 0;
} }
if (R_SUCCEEDED(splInitialize())) { if (R_SUCCEEDED(splInitialize())) {
u64 sku = 0; u64 sku = 0;
@@ -552,8 +552,8 @@ public:
virtual void exitServices() override { virtual void exitServices() override {
CloseThreads(); CloseThreads();
shmemClose(&_sharedmemory); shmemClose(&_sharedmemory);
if (R_SUCCEEDED(sysclkCheck)) { if (R_SUCCEEDED(hocclkCheck)) {
sysclkIpcExit(); hocclkIpcExit();
} }
//Exit services //Exit services
clkrstExit(); clkrstExit();
@@ -612,13 +612,13 @@ public:
if (SaltySD) { if (SaltySD) {
LoadSharedMemory(); LoadSharedMemory();
} }
if (sysclkIpcRunning() && R_SUCCEEDED(sysclkIpcInitialize())) { if (hocclkIpcRunning() && R_SUCCEEDED(hocclkIpcInitialize())) {
uint32_t sysClkApiVer = 0; uint32_t hocClkApiVer = 0;
sysclkIpcGetAPIVersion(&sysClkApiVer); hocclkIpcGetAPIVersion(&hocClkApiVer);
if (sysClkApiVer != SYSCLK_IPC_API_VERSION) { if (hocClkApiVer != HOCCLK_IPC_API_VERSION) {
sysclkIpcExit(); hocclkIpcExit();
} }
else sysclkCheck = 0; else hocclkCheck = 0;
} }
if (R_SUCCEEDED(splInitialize())) { if (R_SUCCEEDED(splInitialize())) {
u64 sku = 0; u64 sku = 0;
@@ -640,8 +640,8 @@ public:
virtual void exitServices() override { virtual void exitServices() override {
CloseThreads(); CloseThreads();
shmemClose(&_sharedmemory); shmemClose(&_sharedmemory);
if (R_SUCCEEDED(sysclkCheck)) { if (R_SUCCEEDED(hocclkCheck)) {
sysclkIpcExit(); hocclkIpcExit();
} }
// Exit services // Exit services
clkrstExit(); clkrstExit();
@@ -702,13 +702,13 @@ public:
if (SaltySD) { if (SaltySD) {
LoadSharedMemoryAndRefreshRate(); LoadSharedMemoryAndRefreshRate();
} }
if (sysclkIpcRunning() && R_SUCCEEDED(sysclkIpcInitialize())) { if (hocclkIpcRunning() && R_SUCCEEDED(hocclkIpcInitialize())) {
uint32_t sysClkApiVer = 0; uint32_t hocClkApiVer = 0;
sysclkIpcGetAPIVersion(&sysClkApiVer); hocclkIpcGetAPIVersion(&hocClkApiVer);
if (sysClkApiVer != SYSCLK_IPC_API_VERSION) { if (hocClkApiVer != HOCCLK_IPC_API_VERSION) {
sysclkIpcExit(); hocclkIpcExit();
} }
else sysclkCheck = 0; else hocclkCheck = 0;
} }
if (R_SUCCEEDED(splInitialize())) { if (R_SUCCEEDED(splInitialize())) {
u64 sku = 0; u64 sku = 0;
@@ -729,8 +729,8 @@ public:
virtual void exitServices() override { virtual void exitServices() override {
CloseThreads(); CloseThreads();
shmemClose(&_sharedmemory); shmemClose(&_sharedmemory);
if (R_SUCCEEDED(sysclkCheck)) { if (R_SUCCEEDED(hocclkCheck)) {
sysclkIpcExit(); hocclkIpcExit();
} }
clkrstExit(); clkrstExit();
pcvExit(); pcvExit();
@@ -785,13 +785,13 @@ public:
if (SaltySD) { if (SaltySD) {
LoadSharedMemoryAndRefreshRate(); LoadSharedMemoryAndRefreshRate();
} }
if (sysclkIpcRunning() && R_SUCCEEDED(sysclkIpcInitialize())) { if (hocclkIpcRunning() && R_SUCCEEDED(hocclkIpcInitialize())) {
uint32_t sysClkApiVer = 0; uint32_t hocClkApiVer = 0;
sysclkIpcGetAPIVersion(&sysClkApiVer); hocclkIpcGetAPIVersion(&hocClkApiVer);
if (sysClkApiVer != SYSCLK_IPC_API_VERSION) { if (hocClkApiVer != HOCCLK_IPC_API_VERSION) {
sysclkIpcExit(); hocclkIpcExit();
} }
else sysclkCheck = 0; else hocclkCheck = 0;
} }
if (R_SUCCEEDED(splInitialize())) { if (R_SUCCEEDED(splInitialize())) {
u64 sku = 0; u64 sku = 0;
@@ -812,8 +812,8 @@ public:
virtual void exitServices() override { virtual void exitServices() override {
CloseThreads(); CloseThreads();
shmemClose(&_sharedmemory); shmemClose(&_sharedmemory);
if (R_SUCCEEDED(sysclkCheck)) { if (R_SUCCEEDED(hocclkCheck)) {
sysclkIpcExit(); hocclkIpcExit();
} }
clkrstExit(); clkrstExit();
pcvExit(); pcvExit();
@@ -868,13 +868,13 @@ public:
if (SaltySD) { if (SaltySD) {
LoadSharedMemoryAndRefreshRate(); LoadSharedMemoryAndRefreshRate();
} }
if (sysclkIpcRunning() && R_SUCCEEDED(sysclkIpcInitialize())) { if (hocclkIpcRunning() && R_SUCCEEDED(hocclkIpcInitialize())) {
uint32_t sysClkApiVer = 0; uint32_t hocClkApiVer = 0;
sysclkIpcGetAPIVersion(&sysClkApiVer); hocclkIpcGetAPIVersion(&hocClkApiVer);
if (sysClkApiVer != SYSCLK_IPC_API_VERSION) { if (hocClkApiVer != HOCCLK_IPC_API_VERSION) {
sysclkIpcExit(); hocclkIpcExit();
} }
else sysclkCheck = 0; else hocclkCheck = 0;
} }
if (R_SUCCEEDED(splInitialize())) { if (R_SUCCEEDED(splInitialize())) {
u64 sku = 0; u64 sku = 0;
@@ -895,8 +895,8 @@ public:
virtual void exitServices() override { virtual void exitServices() override {
CloseThreads(); CloseThreads();
shmemClose(&_sharedmemory); shmemClose(&_sharedmemory);
if (R_SUCCEEDED(sysclkCheck)) { if (R_SUCCEEDED(hocclkCheck)) {
sysclkIpcExit(); hocclkIpcExit();
} }
clkrstExit(); clkrstExit();
pcvExit(); pcvExit();

View File

@@ -527,8 +527,8 @@ public:
snprintf(CPU_Load_c, sizeof(CPU_Load_c), "%.1f%%", cpu_usageM); 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(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%%", snprintf(RAM_Load_c, sizeof(RAM_Load_c), "%hu.%hhu%%",
partLoad[SysClkPartLoad_EMC] / 10, partLoad[HocClkPartLoad_EMC] / 10,
partLoad[SysClkPartLoad_EMC] % 10); partLoad[HocClkPartLoad_EMC] % 10);
mutexUnlock(&mutex_Misc); mutexUnlock(&mutex_Misc);

View File

@@ -236,7 +236,7 @@ public:
else if (realRAM_Hz && settings.showDeltas && (settings.showRealFreqs || settings.showTargetFreqs)) { else if (realRAM_Hz && settings.showDeltas && (settings.showRealFreqs || settings.showTargetFreqs)) {
renderer->drawString(DeltaRAM_c, false, COMMON_MARGIN + deltaOffset, height_offset, 15, (settings.textColor)); 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 std::vector<std::string> partLoadColoredChars = {"CPU", "GPU"};
//static auto loadLabelWidth = renderer->getTextDimensions("Load: ", false, 15).first; //static auto loadLabelWidth = renderer->getTextDimensions("Load: ", false, 15).first;
renderer->drawString("Load", false, COMMON_MARGIN, height_offset+15, 15, (settings.catColor2)); renderer->drawString("Load", false, COMMON_MARGIN, height_offset+15, 15, (settings.catColor2));
@@ -483,12 +483,12 @@ public:
RAMPct_systemunsafe RAMPct_systemunsafe
); );
if (R_SUCCEEDED(sysclkCheck)) { if (R_SUCCEEDED(hocclkCheck)) {
const int RAM_GPU_Load = partLoad[SysClkPartLoad_EMC] - partLoad[SysClkPartLoad_EMCCpu]; const int RAM_GPU_Load = partLoad[HocClkPartLoad_EMC] - partLoad[HocClkPartLoad_EMCCpu];
snprintf(RAM_load_c, sizeof RAM_load_c, snprintf(RAM_load_c, sizeof RAM_load_c,
"%u.%u%% CPU %u.%u%% GPU %u.%u%%", "%u.%u%% CPU %u.%u%% GPU %u.%u%%",
partLoad[SysClkPartLoad_EMC] / 10, partLoad[SysClkPartLoad_EMC] % 10, partLoad[HocClkPartLoad_EMC] / 10, partLoad[HocClkPartLoad_EMC] % 10,
partLoad[SysClkPartLoad_EMCCpu] / 10, partLoad[SysClkPartLoad_EMCCpu] % 10, partLoad[HocClkPartLoad_EMCCpu] / 10, partLoad[HocClkPartLoad_EMCCpu] % 10,
RAM_GPU_Load / 10, RAM_GPU_Load % 10); RAM_GPU_Load / 10, RAM_GPU_Load % 10);
} }
///Thermal ///Thermal

View File

@@ -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); snprintf(MICRO_RAM_all_c, sizeof(MICRO_RAM_all_c), "%.0f%.0fGB", RAM_Used_all_f, RAM_Total_all_f);
} else { } else {
// User wants percentage display // User wants percentage display
if (R_SUCCEEDED(sysclkCheck)) { if (R_SUCCEEDED(hocclkCheck)) {
// Use sys-clk's RAM load if available // Use sys-clk's RAM load if available
snprintf(MICRO_RAM_all_c, sizeof(MICRO_RAM_all_c), "%hu%%", snprintf(MICRO_RAM_all_c, sizeof(MICRO_RAM_all_c), "%hu%%",
partLoad[SysClkPartLoad_EMC] / 10); partLoad[HocClkPartLoad_EMC] / 10);
} else { } else {
// Calculate percentage manually when sys-clk isn't available // 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; const uint64_t RAM_Total_all = RAM_Total_application_u + RAM_Total_applet_u + RAM_Total_system_u + RAM_Total_systemunsafe_u;

View File

@@ -360,7 +360,7 @@ public:
if (settings.realTemps) { if (settings.realTemps) {
width += renderer->getTextDimensions(" 888.8°C", false, fontsize).first; 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)); //dimensions = renderer->drawString("100.0%@4444.4", false, 0, 0, fontsize, renderer->a(0x0000));
if (!settings.showpartLoadCPUGPU) { if (!settings.showpartLoadCPUGPU) {
@@ -379,7 +379,7 @@ public:
if (key == "GPU" && settings.realTemps) { if (key == "GPU" && settings.realTemps) {
width += renderer->getTextDimensions(" 88.8°C", false, fontsize).first; 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("44444444MB@4444.4", false, 0, 0, fontsize, renderer->a(0x0000)); //dimensions = renderer->drawString("44444444MB@4444.4", false, 0, 0, fontsize, renderer->a(0x0000));
if (!settings.realVolts) { if (!settings.realVolts) {
width = renderer->getTextDimensions("100%@4444.4", false, fontsize).first; width = renderer->getTextDimensions("100%@4444.4", false, fontsize).first;
@@ -1140,12 +1140,12 @@ public:
} else { } else {
unsigned partLoadInt; unsigned partLoadInt;
if (R_SUCCEEDED(sysclkCheck)) { if (R_SUCCEEDED(hocclkCheck)) {
partLoadInt = partLoad[SysClkPartLoad_EMC] / 10; partLoadInt = partLoad[HocClkPartLoad_EMC] / 10;
if (settings.showpartLoadCPUGPU) { if (settings.showpartLoadCPUGPU) {
unsigned ramCpuLoadInt = partLoad[SysClkPartLoad_EMCCpu] / 10; unsigned ramCpuLoadInt = partLoad[HocClkPartLoad_EMCCpu] / 10;
int RAM_GPU_Load = partLoad[SysClkPartLoad_EMC] - partLoad[SysClkPartLoad_EMCCpu]; int RAM_GPU_Load = partLoad[HocClkPartLoad_EMC] - partLoad[HocClkPartLoad_EMCCpu];
unsigned ramGpuLoadInt = RAM_GPU_Load / 10; unsigned ramGpuLoadInt = RAM_GPU_Load / 10;
if (settings.realFrequencies && realRAM_Hz) { if (settings.realFrequencies && realRAM_Hz) {

View File

@@ -29,128 +29,128 @@
#include <switch.h> #include <switch.h>
#include <string.h> #include <string.h>
#include <stdatomic.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; static atomic_size_t g_refCnt;
bool sysclkIpcRunning() bool hocclkIpcRunning()
{ {
Handle handle; 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) if (!running)
{ {
smUnregisterService(smEncodeName(SYSCLK_IPC_SERVICE_NAME)); smUnregisterService(smEncodeName(HOCCLK_IPC_SERVICE_NAME));
} }
return running; return running;
} }
Result sysclkIpcInitialize(void) Result hocclkIpcInitialize(void)
{ {
Result rc = 0; Result rc = 0;
g_refCnt++; g_refCnt++;
if (serviceIsActive(&g_sysclkSrv)) if (serviceIsActive(&g_hocclkSrv))
return 0; 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; return rc;
} }
void sysclkIpcExit(void) void hocclkIpcExit(void)
{ {
if (--g_refCnt == 0) 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 }, .buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_Out },
.buffers = {{out, len}}, .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 }, .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; 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, .module = module,
.hz = hz .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 }, .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; args.tid = tid;
memcpy(&args.profiles, profiles, sizeof(SysClkTitleProfileList)); memcpy(&args.profiles, profiles, sizeof(HocClkTitleProfileList));
return serviceDispatchIn(&g_sysclkSrv, SysClkIpcCmd_SetProfiles, args); 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 }, .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 }, .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, .module = module,
.maxCount = maxCount .maxCount = maxCount
}; };
return serviceDispatchInOut(&g_sysclkSrv, SysClkIpcCmd_GetFreqList, args, *outCount, return serviceDispatchInOut(&g_hocclkSrv, HocClkIpcCmd_GetFreqList, args, *outCount,
.buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_Out }, .buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_Out },
.buffers = {{list, maxCount * sizeof(u32)}}, .buffers = {{list, maxCount * sizeof(u32)}},
); );
@@ -159,11 +159,11 @@ Result sysclkIpcGetFreqList(SysClkModule module, u32* list, u32 maxCount, u32* o
Result hocClkIpcSetKipData() Result hocClkIpcSetKipData()
{ {
u32 temp = 0; u32 temp = 0;
return serviceDispatchIn(&g_sysclkSrv, HocClkIpcCmd_SetKipData, temp); return serviceDispatchIn(&g_hocclkSrv, HocClkIpcCmd_SetKipData, temp);
} }
Result hocClkIpcGetKipData() Result hocClkIpcGetKipData()
{ {
u32 temp = 0; u32 temp = 0;
return serviceDispatchIn(&g_sysclkSrv, HocClkIpcCmd_GetKipData, temp); return serviceDispatchIn(&g_hocclkSrv, HocClkIpcCmd_GetKipData, temp);
} }

View File

@@ -42,13 +42,13 @@ extern "C" {
// typedef std::int16_t s16; // typedef std::int16_t s16;
// typedef std::uint16_t u16; // typedef std::uint16_t u16;
#include "sysclk/ipc.h" #include "hocclk/ipc.h"
#include "sysclk/board.h" #include "hocclk/board.h"
#include "sysclk/clock_manager.h" #include "hocclk/clock_manager.h"
#include "sysclk/apm.h" #include "hocclk/apm.h"
#include "sysclk/config.h" #include "hocclk/config.h"
#include "sysclk/errors.h" #include "hocclk/errors.h"
#include "sysclk/psm_ext.h" #include "hocclk/psm_ext.h"
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -34,6 +34,6 @@ typedef struct {
uint32_t cpu_hz; uint32_t cpu_hz;
uint32_t gpu_hz; uint32_t gpu_hz;
uint32_t mem_hz; uint32_t mem_hz;
} SysClkApmConfiguration; } HocClkApmConfiguration;
extern SysClkApmConfiguration sysclk_g_apm_configurations[]; extern HocClkApmConfiguration hocclk_g_apm_configurations[];

View File

@@ -33,21 +33,21 @@
#include <switch/types.h> #include <switch/types.h>
typedef enum typedef enum
{ {
SysClkSocType_Erista = 0, HocClkSocType_Erista = 0,
SysClkSocType_Mariko, HocClkSocType_Mariko,
SysClkSocType_EnumMax HocClkSocType_EnumMax
} SysClkSocType; } HocClkSocType;
typedef enum typedef enum
{ {
HorizonOCConsoleType_Icosa = 0, HocClkConsoleType_Icosa = 0,
HorizonOCConsoleType_Copper, HocClkConsoleType_Copper,
HorizonOCConsoleType_Hoag, HocClkConsoleType_Hoag,
HorizonOCConsoleType_Iowa, HocClkConsoleType_Iowa,
HorizonOCConsoleType_Calcio, HocClkConsoleType_Calcio,
HorizonOCConsoleType_Aula, HocClkConsoleType_Aula,
HorizonOCConsoleType_EnumMax, HocClkConsoleType_EnumMax,
} HorizonOCConsoleType; } HocClkConsoleType;
typedef enum { typedef enum {
HocClkVoltage_SOC = 0, HocClkVoltage_SOC = 0,
@@ -62,62 +62,62 @@ typedef enum {
typedef enum typedef enum
{ {
SysClkProfile_Handheld = 0, HocClkProfile_Handheld = 0,
SysClkProfile_HandheldCharging, HocClkProfile_HandheldCharging,
SysClkProfile_HandheldChargingUSB, HocClkProfile_HandheldChargingUSB,
SysClkProfile_HandheldChargingOfficial, HocClkProfile_HandheldChargingOfficial,
SysClkProfile_Docked, HocClkProfile_Docked,
SysClkProfile_EnumMax HocClkProfile_EnumMax
} SysClkProfile; } HocClkProfile;
typedef enum typedef enum
{ {
SysClkModule_CPU = 0, HocClkModule_CPU = 0,
SysClkModule_GPU, HocClkModule_GPU,
SysClkModule_MEM, HocClkModule_MEM,
HorizonOCModule_Governor, HocClkModule_Governor,
HorizonOCModule_Display, HocClkModule_Display,
SysClkModule_EnumMax, HocClkModule_EnumMax,
} SysClkModule; } HocClkModule;
typedef enum typedef enum
{ {
SysClkThermalSensor_SOC = 0, HocClkThermalSensor_SOC = 0,
SysClkThermalSensor_PCB, HocClkThermalSensor_PCB,
SysClkThermalSensor_Skin, HocClkThermalSensor_Skin,
HorizonOCThermalSensor_Battery, HocClkThermalSensor_Battery,
HorizonOCThermalSensor_PMIC, HocClkThermalSensor_PMIC,
HorizonOCThermalSensor_CPU, HocClkThermalSensor_CPU,
HorizonOCThermalSensor_GPU, HocClkThermalSensor_GPU,
HorizonOCThermalSensor_MEM, HocClkThermalSensor_MEM,
HorizonOCThermalSensor_PLLX, HocClkThermalSensor_PLLX,
SysClkThermalSensor_EnumMax HocClkThermalSensor_EnumMax
} SysClkThermalSensor; } HocClkThermalSensor;
typedef enum typedef enum
{ {
SysClkPowerSensor_Now = 0, HocClkPowerSensor_Now = 0,
SysClkPowerSensor_Avg, HocClkPowerSensor_Avg,
SysClkPowerSensor_EnumMax HocClkPowerSensor_EnumMax
} SysClkPowerSensor; } HocClkPowerSensor;
typedef enum typedef enum
{ {
SysClkPartLoad_EMC = 0, HocClkPartLoad_EMC = 0,
SysClkPartLoad_EMCCpu, HocClkPartLoad_EMCCpu,
HocClkPartLoad_GPU, HocClkPartLoad_GPU,
HocClkPartLoad_CPUMax, HocClkPartLoad_CPUMax,
HocClkPartLoad_BAT, HocClkPartLoad_BAT,
HocClkPartLoad_FAN, HocClkPartLoad_FAN,
SysClkPartLoad_EnumMax HocClkPartLoad_EnumMax
} SysClkPartLoad; } HocClkPartLoad;
typedef enum { typedef enum {
HorizonOCSpeedo_CPU = 0, HocClkSpeedo_CPU = 0,
HorizonOCSpeedo_GPU, HocClkSpeedo_GPU,
HorizonOCSpeedo_SOC, HocClkSpeedo_SOC,
HorizonOCSpeedo_EnumMax, HocClkSpeedo_EnumMax,
} HorizonOCSpeedo; } HocClkSpeedo;
typedef enum { typedef enum {
GPUUVLevel_NoUV = 0, GPUUVLevel_NoUV = 0,
@@ -158,7 +158,7 @@ typedef enum {
RamDisplayMode_EnumMax, RamDisplayMode_EnumMax,
} RamDisplayMode; } RamDisplayMode;
#define SYSCLK_ENUM_VALID(n, v) ((v) < n##_EnumMax) #define HOCCLK_ENUM_VALID(n, v) ((v) < n##_EnumMax)
// Packed u32 // Packed u32
// Bits 0-7 - CPU // Bits 0-7 - CPU
@@ -179,77 +179,77 @@ inline u8 GovernorStateVrr(u32 p) {
return (u8)((p >> 16) & 0xFF); 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) switch(module)
{ {
case SysClkModule_CPU: case HocClkModule_CPU:
return pretty ? "CPU" : "cpu"; return pretty ? "CPU" : "cpu";
case SysClkModule_GPU: case HocClkModule_GPU:
return pretty ? "GPU" : "gpu"; return pretty ? "GPU" : "gpu";
case SysClkModule_MEM: case HocClkModule_MEM:
return pretty ? "Memory" : "mem"; return pretty ? "Memory" : "mem";
case HorizonOCModule_Display: case HocClkModule_Display:
return pretty ? "Display" : "display"; return pretty ? "Display" : "display";
case HorizonOCModule_Governor: case HocClkModule_Governor:
return pretty ? "Governor" : "governor"; return pretty ? "Governor" : "governor";
default: default:
return "null"; return "null";
} }
} }
static inline const char* sysclkFormatThermalSensor(SysClkThermalSensor thermSensor, bool pretty) static inline const char* hocclkFormatThermalSensor(HocClkThermalSensor thermSensor, bool pretty)
{ {
switch(thermSensor) { switch(thermSensor) {
case SysClkThermalSensor_SOC: case HocClkThermalSensor_SOC:
return pretty ? "SOC" : "soc"; return pretty ? "SOC" : "soc";
case SysClkThermalSensor_PCB: case HocClkThermalSensor_PCB:
return pretty ? "PCB" : "pcb"; return pretty ? "PCB" : "pcb";
case SysClkThermalSensor_Skin: case HocClkThermalSensor_Skin:
return pretty ? "Skin" : "skin"; return pretty ? "Skin" : "skin";
case HorizonOCThermalSensor_Battery: case HocClkThermalSensor_Battery:
return pretty ? "BAT" : "battery"; return pretty ? "BAT" : "battery";
case HorizonOCThermalSensor_PMIC: case HocClkThermalSensor_PMIC:
return pretty ? "PMIC" : "pmic"; return pretty ? "PMIC" : "pmic";
case HorizonOCThermalSensor_CPU: case HocClkThermalSensor_CPU:
return pretty ? "CPU" : "cpu"; return pretty ? "CPU" : "cpu";
case HorizonOCThermalSensor_GPU: case HocClkThermalSensor_GPU:
return pretty ? "GPU" : "gpu"; return pretty ? "GPU" : "gpu";
case HorizonOCThermalSensor_MEM: case HocClkThermalSensor_MEM:
return pretty ? "MEM" : "mem"; return pretty ? "MEM" : "mem";
case HorizonOCThermalSensor_PLLX: case HocClkThermalSensor_PLLX:
return pretty ? "PLLX" : "pllx"; return pretty ? "PLLX" : "pllx";
default: default:
return NULL; return NULL;
} }
} }
static inline const char* sysclkFormatPowerSensor(SysClkPowerSensor powSensor, bool pretty) static inline const char* hocclkFormatPowerSensor(HocClkPowerSensor powSensor, bool pretty)
{ {
switch(powSensor) switch(powSensor)
{ {
case SysClkPowerSensor_Now: case HocClkPowerSensor_Now:
return pretty ? "Now" : "now"; return pretty ? "Now" : "now";
case SysClkPowerSensor_Avg: case HocClkPowerSensor_Avg:
return pretty ? "Avg" : "avg"; return pretty ? "Avg" : "avg";
default: default:
return NULL; return NULL;
} }
} }
static inline const char* sysclkFormatProfile(SysClkProfile profile, bool pretty) static inline const char* hocclkFormatProfile(HocClkProfile profile, bool pretty)
{ {
switch(profile) switch(profile)
{ {
case SysClkProfile_Docked: case HocClkProfile_Docked:
return pretty ? "Docked" : "docked"; return pretty ? "Docked" : "docked";
case SysClkProfile_Handheld: case HocClkProfile_Handheld:
return pretty ? "Handheld" : "handheld"; return pretty ? "Handheld" : "handheld";
case SysClkProfile_HandheldCharging: case HocClkProfile_HandheldCharging:
return pretty ? "Charging" : "handheld_charging"; return pretty ? "Charging" : "handheld_charging";
case SysClkProfile_HandheldChargingUSB: case HocClkProfile_HandheldChargingUSB:
return pretty ? "USB Charger" : "handheld_charging_usb"; return pretty ? "USB Charger" : "handheld_charging_usb";
case SysClkProfile_HandheldChargingOfficial: case HocClkProfile_HandheldChargingOfficial:
return pretty ? "PD Charger" : "handheld_charging_official"; return pretty ? "PD Charger" : "handheld_charging_official";
default: default:
return NULL; return NULL;

View File

@@ -32,26 +32,26 @@
#include "../board.h" #include "../board.h"
#include "../ipc.h" #include "../ipc.h"
bool sysclkIpcRunning(); bool hocclkIpcRunning();
Result sysclkIpcInitialize(void); Result hocclkIpcInitialize(void);
void sysclkIpcExit(void); void hocclkIpcExit(void);
Result sysclkIpcGetAPIVersion(u32* out_ver); Result hocclkIpcGetAPIVersion(u32* out_ver);
Result sysclkIpcGetVersionString(char* out, size_t len); Result hocclkIpcGetVersionString(char* out, size_t len);
Result sysclkIpcGetCurrentContext(SysClkContext* out_context); Result hocclkIpcGetCurrentContext(HocClkContext* out_context);
Result sysclkIpcGetProfileCount(u64 tid, u8* out_count); Result hocclkIpcGetProfileCount(u64 tid, u8* out_count);
Result sysclkIpcSetEnabled(bool enabled); Result hocclkIpcSetEnabled(bool enabled);
Result sysclkIpcExitCmd(); Result hocclkIpcExitCmd();
Result sysclkIpcSetOverride(SysClkModule module, u32 hz); Result hocclkIpcSetOverride(HocClkModule module, u32 hz);
Result sysclkIpcGetProfiles(u64 tid, SysClkTitleProfileList* out_profiles); Result hocclkIpcGetProfiles(u64 tid, HocClkTitleProfileList* out_profiles);
Result sysclkIpcSetProfiles(u64 tid, SysClkTitleProfileList* profiles); Result hocclkIpcSetProfiles(u64 tid, HocClkTitleProfileList* profiles);
Result sysclkIpcGetConfigValues(SysClkConfigValueList* out_configValues); Result hocclkIpcGetConfigValues(HocClkConfigValueList* out_configValues);
Result sysclkIpcSetConfigValues(SysClkConfigValueList* configValues); Result hocclkIpcSetConfigValues(HocClkConfigValueList* configValues);
Result sysclkIpcGetFreqList(SysClkModule module, u32* list, u32 maxCount, u32* outCount); Result hocclkIpcGetFreqList(HocClkModule module, u32* list, u32 maxCount, u32* outCount);
Result hocClkIpcSetKipData(); Result hocClkIpcSetKipData();
Result hocClkIpcGetKipData(); Result hocClkIpcGetKipData();
static inline Result sysclkIpcRemoveOverride(SysClkModule module) static inline Result hocclkIpcRemoveOverride(HocClkModule module)
{ {
return sysclkIpcSetOverride(module, 0); return hocclkIpcSetOverride(module, 0);
} }

View File

@@ -33,16 +33,16 @@
typedef struct typedef struct
{ {
uint64_t applicationId; uint64_t applicationId;
SysClkProfile profile; HocClkProfile profile;
uint32_t freqs[SysClkModule_EnumMax]; uint32_t freqs[HocClkModule_EnumMax];
uint32_t realFreqs[SysClkModule_EnumMax]; uint32_t realFreqs[HocClkModule_EnumMax];
uint32_t overrideFreqs[SysClkModule_EnumMax]; uint32_t overrideFreqs[HocClkModule_EnumMax];
uint32_t temps[SysClkThermalSensor_EnumMax]; uint32_t temps[HocClkThermalSensor_EnumMax];
int32_t power[SysClkPowerSensor_EnumMax]; int32_t power[HocClkPowerSensor_EnumMax];
uint32_t partLoad[SysClkPartLoad_EnumMax]; uint32_t partLoad[HocClkPartLoad_EnumMax];
uint32_t voltages[HocClkVoltage_EnumMax]; uint32_t voltages[HocClkVoltage_EnumMax];
u16 speedos[HorizonOCSpeedo_EnumMax]; u16 speedos[HocClkSpeedo_EnumMax];
u16 iddq[HorizonOCSpeedo_EnumMax]; u16 iddq[HocClkSpeedo_EnumMax];
u16 waferX; u16 waferX;
u16 waferY; u16 waferY;
@@ -58,16 +58,16 @@ typedef struct
// FPS / Resolution // FPS / Resolution
u8 fps; u8 fps;
u16 resolutionHeight; u16 resolutionHeight;
} SysClkContext; } HocClkContext;
typedef struct typedef struct
{ {
union { union {
uint32_t mhz[+SysClkProfile_EnumMax * +SysClkModule_EnumMax]; uint32_t mhz[+HocClkProfile_EnumMax * +HocClkModule_EnumMax];
uint32_t mhzMap[+SysClkProfile_EnumMax][+SysClkModule_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 #define GLOBAL_PROFILE_ID 0xA111111111111111

View File

@@ -31,11 +31,11 @@
#include <stddef.h> #include <stddef.h>
typedef enum { typedef enum {
SysClkConfigValue_PollingIntervalMs = 0, HocClkConfigValue_PollingIntervalMs = 0,
SysClkConfigValue_TempLogIntervalMs, HocClkConfigValue_TempLogIntervalMs,
SysClkConfigValue_FreqLogIntervalMs, HocClkConfigValue_FreqLogIntervalMs,
SysClkConfigValue_PowerLogIntervalMs, HocClkConfigValue_PowerLogIntervalMs,
SysClkConfigValue_CsvWriteIntervalMs, HocClkConfigValue_CsvWriteIntervalMs,
HocClkConfigValue_UncappedClocks, HocClkConfigValue_UncappedClocks,
HocClkConfigValue_OverwriteBoostMode, HocClkConfigValue_OverwriteBoostMode,
@@ -51,21 +51,21 @@ typedef enum {
HocClkConfigValue_LiteTDPLimit, HocClkConfigValue_LiteTDPLimit,
HorizonOCConfigValue_BatteryChargeCurrent, HocClkConfigValue_BatteryChargeCurrent,
HorizonOCConfigValue_OverwriteRefreshRate, HocClkConfigValue_OverwriteRefreshRate,
HorizonOCConfigValue_MaxDisplayClockH, HocClkConfigValue_MaxDisplayClockH,
HorizonOCConfigValue_DVFSMode, HocClkConfigValue_DVFSMode,
HorizonOCConfigValue_DVFSOffset, HocClkConfigValue_DVFSOffset,
HorizonOCConfigValue_LiveCpuUv, HocClkConfigValue_LiveCpuUv,
HorizonOCConfigValue_EnableExperimentalSettings, HocClkConfigValue_EnableExperimentalSettings,
HorizonOCConfigValue_GPUScheduling, HocClkConfigValue_GPUScheduling,
HorizonOCConfigValue_GPUSchedulingMethod, HocClkConfigValue_GPUSchedulingMethod,
HorizonOCConfigValue_RAMVoltDisplayMode, HocClkConfigValue_RAMVoltDisplayMode,
HorizonOCConfigValue_CpuGovernorMinimumFreq, HocClkConfigValue_CpuGovernorMinimumFreq,
KipConfigValue_custRev, KipConfigValue_custRev,
// KipConfigValue_mtcConf, // KipConfigValue_mtcConf,
@@ -173,26 +173,26 @@ typedef enum {
KipCrc32, KipCrc32,
HocClkConfigValue_IsFirstLoad, HocClkConfigValue_IsFirstLoad,
SysClkConfigValue_EnumMax, HocClkConfigValue_EnumMax,
} SysClkConfigValue; } HocClkConfigValue;
typedef struct { typedef struct {
uint64_t values[SysClkConfigValue_EnumMax]; uint64_t values[HocClkConfigValue_EnumMax];
} SysClkConfigValueList; } HocClkConfigValueList;
static inline const char* sysclkFormatConfigValue(SysClkConfigValue val, bool pretty) static inline const char* hocclkFormatConfigValue(HocClkConfigValue val, bool pretty)
{ {
switch(val) switch(val)
{ {
case SysClkConfigValue_PollingIntervalMs: case HocClkConfigValue_PollingIntervalMs:
return pretty ? "Polling Interval (ms)" : "poll_interval_ms"; return pretty ? "Polling Interval (ms)" : "poll_interval_ms";
case SysClkConfigValue_TempLogIntervalMs: case HocClkConfigValue_TempLogIntervalMs:
return pretty ? "Temperature logging interval (ms)" : "temp_log_interval_ms"; 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"; 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"; 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"; return pretty ? "CSV write interval (ms)" : "csv_write_interval_ms";
case HocClkConfigValue_UncappedClocks: case HocClkConfigValue_UncappedClocks:
@@ -221,36 +221,36 @@ static inline const char* sysclkFormatConfigValue(SysClkConfigValue val, bool pr
case HocClkConfigValue_LiteTDPLimit: case HocClkConfigValue_LiteTDPLimit:
return pretty ? "Handheld TDP Limit" : "tdp_limit_l"; return pretty ? "Handheld TDP Limit" : "tdp_limit_l";
case HorizonOCConfigValue_BatteryChargeCurrent: case HocClkConfigValue_BatteryChargeCurrent:
return pretty ? "Battery Charge Current" : "bat_charge_current"; return pretty ? "Battery Charge Current" : "bat_charge_current";
case HorizonOCConfigValue_OverwriteRefreshRate: case HocClkConfigValue_OverwriteRefreshRate:
return pretty ? "Display Refresh Rate Changing" : "drr_changing"; return pretty ? "Display Refresh Rate Changing" : "drr_changing";
case HorizonOCConfigValue_MaxDisplayClockH: case HocClkConfigValue_MaxDisplayClockH:
return pretty ? "Max Display Clock (Handheld)" : "drr_max_clock"; return pretty ? "Max Display Clock (Handheld)" : "drr_max_clock";
case HorizonOCConfigValue_DVFSMode: case HocClkConfigValue_DVFSMode:
return pretty ? "DVFS Mode" : "dvfs_mode"; return pretty ? "DVFS Mode" : "dvfs_mode";
case HorizonOCConfigValue_DVFSOffset: case HocClkConfigValue_DVFSOffset:
return pretty ? "DVFS Offset" : "dvfs_offset"; return pretty ? "DVFS Offset" : "dvfs_offset";
case HorizonOCConfigValue_GPUScheduling: case HocClkConfigValue_GPUScheduling:
return pretty ? "GPU Scheduling" : "gpu_scheduling"; return pretty ? "GPU Scheduling" : "gpu_scheduling";
case HorizonOCConfigValue_GPUSchedulingMethod: case HocClkConfigValue_GPUSchedulingMethod:
return pretty ? "GPU Scheduling Method" : "gpu_sched_method"; return pretty ? "GPU Scheduling Method" : "gpu_sched_method";
case HorizonOCConfigValue_LiveCpuUv: case HocClkConfigValue_LiveCpuUv:
return pretty ? "Live CPU Undervolt" : "live_cpu_uv"; return pretty ? "Live CPU Undervolt" : "live_cpu_uv";
case HorizonOCConfigValue_EnableExperimentalSettings: case HocClkConfigValue_EnableExperimentalSettings:
return pretty ? "Enable Experimental Settings" : "enable_experimental_settings"; 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"; 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"; return pretty ? "CPU Governor Minimum Frequency" : "cpu_gov_min_freq";
// KIP config values // KIP config values
case KipConfigValue_custRev: 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) switch(val)
{ {
case SysClkConfigValue_PollingIntervalMs: case HocClkConfigValue_PollingIntervalMs:
return 300ULL; return 300ULL;
case SysClkConfigValue_TempLogIntervalMs: case HocClkConfigValue_TempLogIntervalMs:
case SysClkConfigValue_FreqLogIntervalMs: case HocClkConfigValue_FreqLogIntervalMs:
case SysClkConfigValue_PowerLogIntervalMs: case HocClkConfigValue_PowerLogIntervalMs:
case SysClkConfigValue_CsvWriteIntervalMs: case HocClkConfigValue_CsvWriteIntervalMs:
case HocClkConfigValue_UncappedClocks: case HocClkConfigValue_UncappedClocks:
case HocClkConfigValue_OverwriteBoostMode: case HocClkConfigValue_OverwriteBoostMode:
case HorizonOCConfigValue_BatteryChargeCurrent: case HocClkConfigValue_BatteryChargeCurrent:
case HorizonOCConfigValue_OverwriteRefreshRate: case HocClkConfigValue_OverwriteRefreshRate:
case HorizonOCConfigValue_GPUScheduling: case HocClkConfigValue_GPUScheduling:
case HorizonOCConfigValue_LiveCpuUv: case HocClkConfigValue_LiveCpuUv:
case HorizonOCConfigValue_GPUSchedulingMethod: case HocClkConfigValue_GPUSchedulingMethod:
return 0ULL; return 0ULL;
case HocClkConfigValue_EristaMaxCpuClock: case HocClkConfigValue_EristaMaxCpuClock:
return 1785ULL; return 1785ULL;
@@ -441,7 +441,7 @@ static inline uint64_t sysclkDefaultConfigValue(SysClkConfigValue val)
case HocClkConfigValue_ThermalThrottle: case HocClkConfigValue_ThermalThrottle:
case HocClkConfigValue_HandheldTDP: case HocClkConfigValue_HandheldTDP:
case HocClkConfigValue_IsFirstLoad: case HocClkConfigValue_IsFirstLoad:
case HorizonOCConfigValue_DVFSMode: case HocClkConfigValue_DVFSMode:
return 1ULL; return 1ULL;
case HocClkConfigValue_ThermalThrottleThreshold: case HocClkConfigValue_ThermalThrottleThreshold:
return 70ULL; 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 return 9600ULL; // 8600mW will trigger on erista stock, so raise it a bit
case HocClkConfigValue_LiteTDPLimit: case HocClkConfigValue_LiteTDPLimit:
return 6400ULL; // 0.5C return 6400ULL; // 0.5C
case HorizonOCConfigValue_CpuGovernorMinimumFreq: case HocClkConfigValue_CpuGovernorMinimumFreq:
return 612000000ULL; // 612MHz return 612000000ULL; // 612MHz
case HorizonOCConfigValue_MaxDisplayClockH: case HocClkConfigValue_MaxDisplayClockH:
return 60ULL; return 60ULL;
default: default:
return 0ULL; return 0ULL;
} }
} }
static inline uint64_t sysclkValidConfigValue(SysClkConfigValue val, uint64_t input) static inline uint64_t hocclkValidConfigValue(HocClkConfigValue val, uint64_t input)
{ {
switch(val) switch(val)
{ {
@@ -467,23 +467,23 @@ static inline uint64_t sysclkValidConfigValue(SysClkConfigValue val, uint64_t in
case HocClkConfigValue_ThermalThrottleThreshold: case HocClkConfigValue_ThermalThrottleThreshold:
case HocClkConfigValue_HandheldTDPLimit: case HocClkConfigValue_HandheldTDPLimit:
case HocClkConfigValue_LiteTDPLimit: case HocClkConfigValue_LiteTDPLimit:
case SysClkConfigValue_PollingIntervalMs: case HocClkConfigValue_PollingIntervalMs:
case HorizonOCConfigValue_MaxDisplayClockH: case HocClkConfigValue_MaxDisplayClockH:
return input > 0; return input > 0;
case SysClkConfigValue_TempLogIntervalMs: case HocClkConfigValue_TempLogIntervalMs:
case SysClkConfigValue_FreqLogIntervalMs: case HocClkConfigValue_FreqLogIntervalMs:
case SysClkConfigValue_PowerLogIntervalMs: case HocClkConfigValue_PowerLogIntervalMs:
case SysClkConfigValue_CsvWriteIntervalMs: case HocClkConfigValue_CsvWriteIntervalMs:
case HocClkConfigValue_UncappedClocks: case HocClkConfigValue_UncappedClocks:
case HocClkConfigValue_OverwriteBoostMode: case HocClkConfigValue_OverwriteBoostMode:
case HocClkConfigValue_ThermalThrottle: case HocClkConfigValue_ThermalThrottle:
case HocClkConfigValue_HandheldTDP: case HocClkConfigValue_HandheldTDP:
case HorizonOCConfigValue_OverwriteRefreshRate: case HocClkConfigValue_OverwriteRefreshRate:
case HocClkConfigValue_IsFirstLoad: case HocClkConfigValue_IsFirstLoad:
case HorizonOCConfigValue_EnableExperimentalSettings: case HocClkConfigValue_EnableExperimentalSettings:
case HorizonOCConfigValue_LiveCpuUv: case HocClkConfigValue_LiveCpuUv:
case HorizonOCConfigValue_GPUSchedulingMethod: case HocClkConfigValue_GPUSchedulingMethod:
return (input & 0x1) == input; return (input & 0x1) == input;
case KipConfigValue_custRev: 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_t6_tRTW_fine_tune:
case KipConfigValue_t7_tWTR_fine_tune: case KipConfigValue_t7_tWTR_fine_tune:
case KipCrc32: case KipCrc32:
case HorizonOCConfigValue_DVFSMode: case HocClkConfigValue_DVFSMode:
case HorizonOCConfigValue_DVFSOffset: case HocClkConfigValue_DVFSOffset:
case HorizonOCConfigValue_GPUScheduling: case HocClkConfigValue_GPUScheduling:
case HorizonOCConfigValue_RAMVoltDisplayMode: case HocClkConfigValue_RAMVoltDisplayMode:
case HorizonOCConfigValue_CpuGovernorMinimumFreq: case HocClkConfigValue_CpuGovernorMinimumFreq:
return true; return true;
case HorizonOCConfigValue_BatteryChargeCurrent: case HocClkConfigValue_BatteryChargeCurrent:
return ((input >= 1024) && (input <= 3072)) || !input; return ((input >= 1024) && (input <= 3072)) || !input;
default: default:
return false; return false;

View File

@@ -27,13 +27,13 @@
#pragma once #pragma once
#define SYSCLK_ERROR_MODULE 388 #define HOCCLK_ERROR_MODULE 388
#define SYSCLK_ERROR(desc) ((SYSCLK_ERROR_MODULE & 0x1FF) | (SysClkError_##desc & 0x1FFF)<<9) #define HOCCLK_ERROR(desc) ((HOCCLK_ERROR_MODULE & 0x1FF) | (HocClkError_##desc & 0x1FFF)<<9)
typedef enum typedef enum
{ {
SysClkError_Generic = 0, HocClkError_Generic = 0,
SysClkError_ConfigNotLoaded = 1, HocClkError_ConfigNotLoaded = 1,
SysClkError_ConfigSaveFailed = 2, HocClkError_ConfigSaveFailed = 2,
// HocClkError_SocThermFail = 3, // HocClkError_SocThermFail = 3,
} SysClkError; } HocClkError;

View File

@@ -31,23 +31,23 @@
#include "board.h" #include "board.h"
#include "clock_manager.h" #include "clock_manager.h"
#define SYSCLK_IPC_API_VERSION 1 #define HOCCLK_IPC_API_VERSION 1
#define SYSCLK_IPC_SERVICE_NAME "hoc:clk" #define HOCCLK_IPC_SERVICE_NAME "hoc:clk"
enum SysClkIpcCmd enum HocClkIpcCmd
{ {
SysClkIpcCmd_GetApiVersion = 0, HocClkIpcCmd_GetApiVersion = 0,
SysClkIpcCmd_GetVersionString = 1, HocClkIpcCmd_GetVersionString = 1,
SysClkIpcCmd_GetCurrentContext = 2, HocClkIpcCmd_GetCurrentContext = 2,
SysClkIpcCmd_Exit = 3, HocClkIpcCmd_Exit = 3,
SysClkIpcCmd_GetProfileCount = 4, HocClkIpcCmd_GetProfileCount = 4,
SysClkIpcCmd_GetProfiles = 5, HocClkIpcCmd_GetProfiles = 5,
SysClkIpcCmd_SetProfiles = 6, HocClkIpcCmd_SetProfiles = 6,
SysClkIpcCmd_SetEnabled = 7, HocClkIpcCmd_SetEnabled = 7,
SysClkIpcCmd_SetOverride = 8, HocClkIpcCmd_SetOverride = 8,
SysClkIpcCmd_GetConfigValues = 9, HocClkIpcCmd_GetConfigValues = 9,
SysClkIpcCmd_SetConfigValues = 10, HocClkIpcCmd_SetConfigValues = 10,
SysClkIpcCmd_GetFreqList = 11, HocClkIpcCmd_GetFreqList = 11,
HocClkIpcCmd_SetKipData = 12, HocClkIpcCmd_SetKipData = 12,
HocClkIpcCmd_GetKipData = 13, HocClkIpcCmd_GetKipData = 13,
}; };
@@ -56,17 +56,17 @@ enum SysClkIpcCmd
typedef struct typedef struct
{ {
uint64_t tid; uint64_t tid;
SysClkTitleProfileList profiles; HocClkTitleProfileList profiles;
} SysClkIpc_SetProfiles_Args; } HocClkIpc_SetProfiles_Args;
typedef struct typedef struct
{ {
SysClkModule module; HocClkModule module;
uint32_t hz; uint32_t hz;
} SysClkIpc_SetOverride_Args; } HocClkIpc_SetOverride_Args;
typedef struct typedef struct
{ {
SysClkModule module; HocClkModule module;
uint32_t maxCount; uint32_t maxCount;
} SysClkIpc_GetFreqList_Args; } HocClkIpc_GetFreqList_Args;

View File

@@ -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}, {0x00010000, 1020000000, 384000000, 1600000000},
{0x00010001, 1020000000, 768000000, 1600000000}, {0x00010001, 1020000000, 768000000, 1600000000},
{0x00010002, 1224000000, 691200000, 1600000000}, {0x00010002, 1224000000, 691200000, 1600000000},

View File

@@ -29,128 +29,128 @@
#include <switch.h> #include <switch.h>
#include <string.h> #include <string.h>
#include <stdatomic.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; static atomic_size_t g_refCnt;
bool sysclkIpcRunning() bool hocclkIpcRunning()
{ {
Handle handle; 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) if (!running)
{ {
smUnregisterService(smEncodeName(SYSCLK_IPC_SERVICE_NAME)); smUnregisterService(smEncodeName(HOCCLK_IPC_SERVICE_NAME));
} }
return running; return running;
} }
Result sysclkIpcInitialize(void) Result hocclkIpcInitialize(void)
{ {
Result rc = 0; Result rc = 0;
g_refCnt++; g_refCnt++;
if (serviceIsActive(&g_sysclkSrv)) if (serviceIsActive(&g_hocclkSrv))
return 0; 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; return rc;
} }
void sysclkIpcExit(void) void hocclkIpcExit(void)
{ {
if (--g_refCnt == 0) 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 }, .buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_Out },
.buffers = {{out, len}}, .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 }, .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; 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, .module = module,
.hz = hz .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 }, .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; args.tid = tid;
memcpy(&args.profiles, profiles, sizeof(SysClkTitleProfileList)); memcpy(&args.profiles, profiles, sizeof(HocClkTitleProfileList));
return serviceDispatchIn(&g_sysclkSrv, SysClkIpcCmd_SetProfiles, args); 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 }, .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 }, .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, .module = module,
.maxCount = maxCount .maxCount = maxCount
}; };
return serviceDispatchInOut(&g_sysclkSrv, SysClkIpcCmd_GetFreqList, args, *outCount, return serviceDispatchInOut(&g_hocclkSrv, HocClkIpcCmd_GetFreqList, args, *outCount,
.buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_Out }, .buffer_attrs = { SfBufferAttr_HipcAutoSelect | SfBufferAttr_Out },
.buffers = {{list, maxCount * sizeof(u32)}}, .buffers = {{list, maxCount * sizeof(u32)}},
); );
@@ -159,11 +159,11 @@ Result sysclkIpcGetFreqList(SysClkModule module, u32* list, u32 maxCount, u32* o
Result hocClkIpcSetKipData() Result hocClkIpcSetKipData()
{ {
u32 temp = 0; u32 temp = 0;
return serviceDispatchIn(&g_sysclkSrv, HocClkIpcCmd_SetKipData, temp); return serviceDispatchIn(&g_hocclkSrv, HocClkIpcCmd_SetKipData, temp);
} }
Result hocClkIpcGetKipData() Result hocClkIpcGetKipData()
{ {
u32 temp = 0; u32 temp = 0;
return serviceDispatchIn(&g_sysclkSrv, HocClkIpcCmd_GetKipData, temp); return serviceDispatchIn(&g_hocclkSrv, HocClkIpcCmd_GetKipData, temp);
} }

View File

@@ -15,7 +15,7 @@
* *
*/ */
#include <sysclk/psm_ext.h> #include <hocclk/psm_ext.h>
const char* PsmPowerRoleToStr(PsmPowerRole role) { const char* PsmPowerRoleToStr(PsmPowerRole role) {
switch (role) { switch (role) {

View File

@@ -34,8 +34,8 @@ extern "C"
{ {
#endif #endif
#include <sysclk.h> #include <hocclk.h>
#include <sysclk/client/ipc.h> #include <hocclk/client/ipc.h>
#if defined(__cplusplus) #if defined(__cplusplus)
} }

View File

@@ -43,7 +43,7 @@ class AppOverlay : public tsl::Overlay
virtual void exitServices() override { virtual void exitServices() override {
rgltrExit(); rgltrExit();
sysclkIpcExit(); hocclkIpcExit();
} }
virtual std::unique_ptr<tsl::Gui> loadInitialGui() override virtual std::unique_ptr<tsl::Gui> loadInitialGui() override
@@ -53,7 +53,7 @@ class AppOverlay : public tsl::Overlay
tsl::hlp::ScopeGuard smGuard([] { smExit(); }); tsl::hlp::ScopeGuard smGuard([] { smExit(); });
if(!sysclkIpcRunning()) if(!hocclkIpcRunning())
{ {
return initially<FatalGui>( return initially<FatalGui>(
"hoc-clk is not running.\n\n" "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>( return initially<FatalGui>(
"Could not connect to hoc-clk.\n\n" "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>( return initially<FatalGui>(
"Overlay not compatible with\n\n" "Overlay not compatible with\n\n"

View File

@@ -302,9 +302,9 @@ void AboutGui::refresh()
if (!this->context) if (!this->context)
return; return;
// Format strings once per refresh // 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 // 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]); SpeedoItem->setValue(strings[0]);
IddqItem->setValue(strings[1]); IddqItem->setValue(strings[1]);
DramModule->setValue(formatRamModule()); DramModule->setValue(formatRamModule());
@@ -320,7 +320,7 @@ void AboutGui::refresh()
waferCordsItem->setValue(strings[2]); waferCordsItem->setValue(strings[2]);
if(IsErista()) { if(IsErista()) {
u32 millis = context->temps[HorizonOCThermalSensor_PLLX]; u32 millis = context->temps[HocClkThermalSensor_PLLX];
sprintf(strings[3], "%u.%u", millis / 1000U, (millis % 1000U) / 100U); sprintf(strings[3], "%u.%u", millis / 1000U, (millis % 1000U) / 100U);
eristaPLLXItem->setValue(strings[3]); eristaPLLXItem->setValue(strings[3]);
} }

View File

@@ -30,7 +30,7 @@
#include "../format.h" #include "../format.h"
#include "fatal_gui.h" #include "fatal_gui.h"
#include "labels.h" #include "labels.h"
AppProfileGui::AppProfileGui(std::uint64_t applicationId, SysClkTitleProfileList* profileList) AppProfileGui::AppProfileGui(std::uint64_t applicationId, HocClkTitleProfileList* profileList)
{ {
this->applicationId = applicationId; this->applicationId = applicationId;
this->profileList = profileList; this->profileList = profileList;
@@ -41,31 +41,31 @@ AppProfileGui::~AppProfileGui()
delete this->profileList; 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; 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)) if(R_FAILED(rc))
{ {
FatalGui::openWithResultCode("sysclkIpcGetFreqList", rc); FatalGui::openWithResultCode("hocclkIpcGetFreqList", rc);
return; return;
} }
std::map<uint32_t, std::string> labels = {}; 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]; 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); 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]]); 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) { 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; this->profileList->mhzMap[profile][module] = hz / 1000000;
listItem->setValue(formatListFreqMHz(this->profileList->mhzMap[profile][module])); 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)) if(R_FAILED(rc))
{ {
FatalGui::openWithResultCode("sysclkIpcSetProfiles", rc); FatalGui::openWithResultCode("hocclkIpcSetProfiles", rc);
return false; 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->setValue(formatListFreqMHz(this->profileList->mhzMap[profile][module]));
listItem->setClickListener([this, listItem, profile, module](u64 keys) { listItem->setClickListener([this, listItem, profile, module](u64 keys) {
if((keys & HidNpadButton_A) == HidNpadButton_A) if((keys & HidNpadButton_A) == HidNpadButton_A)
@@ -117,10 +117,10 @@ void AppProfileGui::addModuleListItem(SysClkProfile profile, SysClkModule module
this->profileList->mhzMap[profile][module] = 0; this->profileList->mhzMap[profile][module] = 0;
listItem->setValue(formatListFreqMHz(0)); listItem->setValue(formatListFreqMHz(0));
Result rc = sysclkIpcSetProfiles(this->applicationId, this->profileList); Result rc = hocclkIpcSetProfiles(this->applicationId, this->profileList);
if(R_FAILED(rc)) if(R_FAILED(rc))
{ {
FatalGui::openWithResultCode("sysclkIpcSetProfiles", rc); FatalGui::openWithResultCode("hocclkIpcSetProfiles", rc);
return false; return false;
} }
return true; return true;
@@ -130,9 +130,9 @@ void AppProfileGui::addModuleListItem(SysClkProfile profile, SysClkModule module
this->listElement->addItem(listItem); 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]; std::uint32_t currentValue = this->profileList->mhzMap[profile][module];
tsl::elm::ToggleListItem* toggle = new tsl::elm::ToggleListItem(moduleName, currentValue != 0); 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) { toggle->setStateChangedListener([this, profile, module](bool state) {
this->profileList->mhzMap[profile][module] = state ? 1 : 0; 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)) if(R_FAILED(rc))
{ {
FatalGui::openWithResultCode("sysclkIpcSetProfiles", rc); FatalGui::openWithResultCode("hocclkIpcSetProfiles", rc);
} }
}); });
@@ -181,8 +181,8 @@ std::string AppProfileGui::formatValueDisplay(
} }
void AppProfileGui::addModuleListItemValue( void AppProfileGui::addModuleListItemValue(
SysClkProfile profile, HocClkProfile profile,
SysClkModule module, HocClkModule module,
const std::string& categoryName, const std::string& categoryName,
std::uint32_t min, std::uint32_t min,
std::uint32_t max, std::uint32_t max,
@@ -196,7 +196,7 @@ void AppProfileGui::addModuleListItemValue(
) )
{ {
tsl::elm::ListItem* listItem = 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]; std::uint32_t storedValue = this->profileList->mhzMap[profile][module];
listItem->setValue(this->formatValueDisplay(storedValue, namedValues, suffix, divisor, decimalPlaces)); 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)); listItem->setValue(this->formatValueDisplay(value / divisor, namedValues, suffix, divisor, decimalPlaces));
Result rc = Result rc =
sysclkIpcSetProfiles(this->applicationId, hocclkIpcSetProfiles(this->applicationId,
this->profileList); this->profileList);
if (R_FAILED(rc)) if (R_FAILED(rc))
{ {
FatalGui::openWithResultCode( FatalGui::openWithResultCode(
"sysclkIpcSetProfiles", rc); "hocclkIpcSetProfiles", rc);
return false; return false;
} }
return true; return true;
@@ -263,11 +263,11 @@ void AppProfileGui::addModuleListItemValue(
this->profileList->mhzMap[profile][module] = 0; this->profileList->mhzMap[profile][module] = 0;
listItem->setValue(FREQ_DEFAULT_TEXT); listItem->setValue(FREQ_DEFAULT_TEXT);
Result rc = Result rc =
sysclkIpcSetProfiles(this->applicationId, hocclkIpcSetProfiles(this->applicationId,
this->profileList); this->profileList);
if (R_FAILED(rc)) if (R_FAILED(rc))
{ {
FatalGui::openWithResultCode("sysclkIpcSetProfiles", rc); FatalGui::openWithResultCode("hocclkIpcSetProfiles", rc);
return false; return false;
} }
return true; return true;
@@ -279,16 +279,16 @@ void AppProfileGui::addModuleListItemValue(
class GovernorProfileSubMenuGui : public BaseMenuGui { class GovernorProfileSubMenuGui : public BaseMenuGui {
uint64_t applicationId; uint64_t applicationId;
SysClkTitleProfileList* profileList; HocClkTitleProfileList* profileList;
SysClkProfile profile; HocClkProfile profile;
public: public:
GovernorProfileSubMenuGui(uint64_t appId, SysClkTitleProfileList* pList, SysClkProfile prof) GovernorProfileSubMenuGui(uint64_t appId, HocClkTitleProfileList* pList, HocClkProfile prof)
: applicationId(appId), profileList(pList), profile(prof) {} : applicationId(appId), profileList(pList), profile(prof) {}
void listUI() override { void listUI() override {
Result rc = sysclkIpcGetConfigValues(&configList); Result rc = hocclkIpcGetConfigValues(&configList);
if (R_FAILED(rc)) [[unlikely]] { if (R_FAILED(rc)) [[unlikely]] {
FatalGui::openWithResultCode("sysclkIpcGetConfigValues", rc); FatalGui::openWithResultCode("hocclkIpcGetConfigValues", rc);
return; return;
} }
this->listElement->addItem(new tsl::elm::CategoryHeader("Governor")); this->listElement->addItem(new tsl::elm::CategoryHeader("Governor"));
@@ -296,10 +296,10 @@ public:
static constexpr struct { const char* label; int shift; } kAll[] = { static constexpr struct { const char* label; int shift; } kAll[] = {
{"CPU", 0}, {"GPU", 8}, {"VRR", 16} {"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++) { 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( auto* bar = new tsl::elm::NamedStepTrackBar(
"", {"Do Not Override", "Disabled", "Enabled"}, "", {"Do Not Override", "Disabled", "Enabled"},
true, kAll[i].label true, kAll[i].label
@@ -307,17 +307,17 @@ public:
bar->setProgress(cur); bar->setProgress(cur);
int shift = kAll[i].shift; int shift = kAll[i].shift;
bar->setValueChangedListener([this, shift](u8 value) { 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); packed = (packed & ~(0xFFu << shift)) | ((u32)value << shift);
Result rc = sysclkIpcSetProfiles(this->applicationId, this->profileList); Result rc = hocclkIpcSetProfiles(this->applicationId, this->profileList);
if (R_FAILED(rc)) FatalGui::openWithResultCode("sysclkIpcSetProfiles", rc); if (R_FAILED(rc)) FatalGui::openWithResultCode("hocclkIpcSetProfiles", rc);
}); });
this->listElement->addItem(bar); this->listElement->addItem(bar);
} }
} }
}; };
void AppProfileGui::addGovernorSection(SysClkProfile profile) { void AppProfileGui::addGovernorSection(HocClkProfile profile) {
auto* item = new tsl::elm::ListItem("Governor"); auto* item = new tsl::elm::ListItem("Governor");
item->setValue("\u2192"); // Right arrow item->setValue("\u2192"); // Right arrow
item->setClickListener([this, profile](u64 keys) { item->setClickListener([this, profile](u64 keys) {
@@ -332,29 +332,29 @@ void AppProfileGui::addGovernorSection(SysClkProfile profile) {
this->listElement->addItem(item); this->listElement->addItem(item);
} }
void AppProfileGui::addProfileUI(SysClkProfile profile) void AppProfileGui::addProfileUI(HocClkProfile profile)
{ {
BaseMenuGui::refresh(); BaseMenuGui::refresh();
if(!this->context) if(!this->context)
return; return;
Result rc = sysclkIpcGetConfigValues(&configList); Result rc = hocclkIpcGetConfigValues(&configList);
if (R_FAILED(rc)) [[unlikely]] { if (R_FAILED(rc)) [[unlikely]] {
FatalGui::openWithResultCode("sysclkIpcGetConfigValues", rc); FatalGui::openWithResultCode("hocclkIpcGetConfigValues", rc);
return; return;
} }
if((profile == SysClkProfile_Docked && IsHoag()) || profile == SysClkProfile_HandheldCharging) if((profile == HocClkProfile_Docked && IsHoag()) || profile == HocClkProfile_HandheldCharging)
return; return;
this->listElement->addItem(new tsl::elm::CategoryHeader(sysclkFormatProfile(profile, true) + std::string(" ") + ult::DIVIDER_SYMBOL + " \ue0e3 Reset")); this->listElement->addItem(new tsl::elm::CategoryHeader(hocclkFormatProfile(profile, true) + std::string(" ") + ult::DIVIDER_SYMBOL + " \ue0e3 Reset"));
this->addModuleListItem(profile, SysClkModule_CPU); this->addModuleListItem(profile, HocClkModule_CPU);
this->addModuleListItem(profile, SysClkModule_GPU); this->addModuleListItem(profile, HocClkModule_GPU);
this->addModuleListItem(profile, SysClkModule_MEM); this->addModuleListItem(profile, HocClkModule_MEM);
#if IS_MINIMAL == 0 #if IS_MINIMAL == 0
ValueThresholds lcdThresholds(60, 65); ValueThresholds lcdThresholds(60, 65);
ValueThresholds DThresholdsOLED(120, 500); // nothing is dangerous, past 120hz you can get applet crashes ValueThresholds DThresholdsOLED(120, 500); // nothing is dangerous, past 120hz you can get applet crashes
if(configList.values[HorizonOCConfigValue_OverwriteRefreshRate]) { if(configList.values[HocClkConfigValue_OverwriteRefreshRate]) {
if(profile != SysClkProfile_Docked) { if(profile != HocClkProfile_Docked) {
this->addModuleListItemValue(profile, HorizonOCModule_Display, "Display", IsAula() ? 45 : 40, configList.values[HorizonOCConfigValue_MaxDisplayClockH], this->context->isUsingRetroSuper ? 5 : 1, " Hz", 1, 0, lcdThresholds); this->addModuleListItemValue(profile, HocClkModule_Display, "Display", IsAula() ? 45 : 40, configList.values[HocClkConfigValue_MaxDisplayClockH], this->context->isUsingRetroSuper ? 5 : 1, " Hz", 1, 0, lcdThresholds);
} else { } else {
if(IsAula() && this->context->isSysDockInstalled) { if(IsAula() && this->context->isSysDockInstalled) {
std::vector<NamedValue> dockedFreqs = { std::vector<NamedValue> dockedFreqs = {
@@ -388,7 +388,7 @@ void AppProfileGui::addProfileUI(SysClkProfile profile)
NamedValue("240 Hz", 240) 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) { } else if (IsAula() && !this->context->isSysDockInstalled) {
std::vector<NamedValue> dockedFreqsLimited = { std::vector<NamedValue> dockedFreqsLimited = {
NamedValue("50 Hz", 50), NamedValue("50 Hz", 50),
@@ -400,7 +400,7 @@ void AppProfileGui::addProfileUI(SysClkProfile profile)
NamedValue("75 Hz", 75) 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 { } else {
std::vector<NamedValue> dockedFreqsStandard = { std::vector<NamedValue> dockedFreqsStandard = {
NamedValue("50 Hz", 50), NamedValue("50 Hz", 50),
@@ -420,7 +420,7 @@ void AppProfileGui::addProfileUI(SysClkProfile profile)
NamedValue("115 Hz", 115), NamedValue("115 Hz", 115),
NamedValue("120 Hz", 120) 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() void AppProfileGui::listUI()
{ {
this->addProfileUI(SysClkProfile_Docked); this->addProfileUI(HocClkProfile_Docked);
this->addProfileUI(SysClkProfile_Handheld); this->addProfileUI(HocClkProfile_Handheld);
this->addProfileUI(SysClkProfile_HandheldCharging); this->addProfileUI(HocClkProfile_HandheldCharging);
this->addProfileUI(SysClkProfile_HandheldChargingOfficial); this->addProfileUI(HocClkProfile_HandheldChargingOfficial);
this->addProfileUI(SysClkProfile_HandheldChargingUSB); this->addProfileUI(HocClkProfile_HandheldChargingUSB);
} }
void AppProfileGui::changeTo(std::uint64_t applicationId) void AppProfileGui::changeTo(std::uint64_t applicationId)
{ {
SysClkTitleProfileList* profileList = new SysClkTitleProfileList; HocClkTitleProfileList* profileList = new HocClkTitleProfileList;
Result rc = sysclkIpcGetProfiles(applicationId, profileList); Result rc = hocclkIpcGetProfiles(applicationId, profileList);
if(R_FAILED(rc)) if(R_FAILED(rc))
{ {
delete profileList; delete profileList;
FatalGui::openWithResultCode("sysclkIpcGetProfiles", rc); FatalGui::openWithResultCode("hocclkIpcGetProfiles", rc);
return; return;
} }
@@ -455,7 +455,7 @@ void AppProfileGui::update()
{ {
BaseMenuGui::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>( tsl::changeTo<FatalGui>(
"Application changed\n\n" "Application changed\n\n"

View File

@@ -28,15 +28,15 @@
#include "base_menu_gui.h" #include "base_menu_gui.h"
#include "freq_choice_gui.h" #include "freq_choice_gui.h"
#include "value_choice_gui.h" #include "value_choice_gui.h"
#define SYSCLK_GLOBAL_PROFILE_TID 0xA111111111111111 #define HOCCLK_GLOBAL_PROFILE_TID 0xA111111111111111
class AppProfileGui : public BaseMenuGui class AppProfileGui : public BaseMenuGui
{ {
protected: protected:
std::uint64_t applicationId; std::uint64_t applicationId;
SysClkTitleProfileList* profileList; HocClkTitleProfileList* profileList;
void openFreqChoiceGui(tsl::elm::ListItem* listItem, SysClkProfile profile, SysClkModule module); void openFreqChoiceGui(tsl::elm::ListItem* listItem, HocClkProfile profile, HocClkModule module);
void addModuleListItem(SysClkProfile profile, SysClkModule module); void addModuleListItem(HocClkProfile profile, HocClkModule module);
void addModuleListItemToggle(SysClkProfile profile, SysClkModule module); void addModuleListItemToggle(HocClkProfile profile, HocClkModule module);
void openValueChoiceGui( void openValueChoiceGui(
tsl::elm::ListItem* listItem, tsl::elm::ListItem* listItem,
std::uint32_t currentValue, std::uint32_t currentValue,
@@ -57,8 +57,8 @@ class AppProfileGui : public BaseMenuGui
int decimalPlaces int decimalPlaces
); );
void addModuleListItemValue( void addModuleListItemValue(
SysClkProfile profile, HocClkProfile profile,
SysClkModule module, HocClkModule module,
const std::string& categoryName, const std::string& categoryName,
std::uint32_t min, std::uint32_t min,
std::uint32_t max, std::uint32_t max,
@@ -70,10 +70,10 @@ class AppProfileGui : public BaseMenuGui
std::vector<NamedValue> namedValues = {}, std::vector<NamedValue> namedValues = {},
bool showDefaultValue = true bool showDefaultValue = true
); );
void addGovernorSection(SysClkProfile profile); void addGovernorSection(HocClkProfile profile);
void addProfileUI(SysClkProfile profile); void addProfileUI(HocClkProfile profile);
public: public:
AppProfileGui(std::uint64_t applicationId, SysClkTitleProfileList* profileList); AppProfileGui(std::uint64_t applicationId, HocClkTitleProfileList* profileList);
~AppProfileGui(); ~AppProfileGui();
void listUI() override; void listUI() override;
static void changeTo(std::uint64_t applicationId); static void changeTo(std::uint64_t applicationId);

View File

@@ -41,7 +41,7 @@
std::string getVersionString() { std::string getVersionString() {
char buf[0x100] = ""; char buf[0x100] = "";
Result rc = sysclkIpcGetVersionString(buf, sizeof(buf)); Result rc = hocclkIpcGetVersionString(buf, sizeof(buf));
if (R_FAILED(rc) || buf[0] == '\0') { if (R_FAILED(rc) || buf[0] == '\0') {
return "Unknown"; return "Unknown";
} }

View File

@@ -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[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[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[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[HorizonOCThermalSensor_GPU]); // GPU 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[HorizonOCThermalSensor_MEM]); // RAM Real Temp renderer->drawString(displayStrings[30], false, positions[4], y, SMALL_TEXT_SIZE, tempColors[HocClkThermalSensor_MEM]); // RAM Real Temp
// === REAL FREQUENCIES === // === 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); renderer->drawString(labels[7], false, positions[7], y, SMALL_TEXT_SIZE, tsl::sectionTextColor);
// Temperatures with color - use pre-computed colors // 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[11], false, dataPositions[0], y, SMALL_TEXT_SIZE, tempColors[HocClkThermalSensor_SOC]); // SOC
renderer->drawString(displayStrings[12], false, dataPositions[1], y, SMALL_TEXT_SIZE, tempColors[SysClkThermalSensor_PCB]); // PCB 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[SysClkThermalSensor_Skin]); // Skin renderer->drawString(displayStrings[13], false, dataPositions[2], y, SMALL_TEXT_SIZE, tempColors[HocClkThermalSensor_Skin]); // Skin
y += 20; // Direct assignment (191 + 20) 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(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 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 // Lazy context allocation
if (!this->context) [[unlikely]] { if (!this->context) [[unlikely]] {
this->context = new SysClkContext; this->context = new HocClkContext;
} }
// === SYSCLK CONTEXT UPDATE === // === HOCCLK CONTEXT UPDATE ===
Result rc = sysclkIpcGetCurrentContext(this->context); Result rc = hocclkIpcGetCurrentContext(this->context);
if (R_FAILED(rc)) [[unlikely]] { if (R_FAILED(rc)) [[unlikely]] {
FatalGui::openWithResultCode("sysclkIpcGetCurrentContext", rc); FatalGui::openWithResultCode("hocclkIpcGetCurrentContext", rc);
return; return;
} }
rc = sysclkIpcGetConfigValues(&configList); rc = hocclkIpcGetConfigValues(&configList);
if (R_FAILED(rc)) [[unlikely]] { if (R_FAILED(rc)) [[unlikely]] {
FatalGui::openWithResultCode("sysclkIpcGetConfigValues", rc); FatalGui::openWithResultCode("hocclkIpcGetConfigValues", rc);
return; return;
} }
// dockedHighestAllowedRefreshRate = this->context->maxDisplayFreq; // dockedHighestAllowedRefreshRate = this->context->maxDisplayFreq;
@@ -220,33 +220,33 @@ void BaseMenuGui::refresh()
sprintf(displayStrings[0], "%016lX", context->applicationId); sprintf(displayStrings[0], "%016lX", context->applicationId);
// Profile // Profile
strcpy(displayStrings[1], sysclkFormatProfile(context->profile, true)); strcpy(displayStrings[1], hocclkFormatProfile(context->profile, true));
// Current frequencies // 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); 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); 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); sprintf(displayStrings[4], "%u.%u MHz", hz / 1000000U, (hz / 100000U) % 10U);
// Real frequencies // 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); 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); 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); sprintf(displayStrings[7], "%u.%u MHz", hz / 1000000U, (hz / 100000U) % 10U);
// Voltages // Voltages
sprintf(displayStrings[8], "%.1f mV", context->voltages[HocClkVoltage_CPU] / 1000.0); sprintf(displayStrings[8], "%.1f mV", context->voltages[HocClkVoltage_CPU] / 1000.0);
sprintf(displayStrings[9], "%.1f mV", context->voltages[HocClkVoltage_GPU] / 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: case RamDisplayMode_VDD2:
sprintf(displayStrings[10], "%u.%u mV", context->voltages[HocClkVoltage_EMCVDD2] / 1000U, (context->voltages[HocClkVoltage_EMCVDD2] % 1000U) / 100U); sprintf(displayStrings[10], "%u.%u mV", context->voltages[HocClkVoltage_EMCVDD2] / 1000U, (context->voltages[HocClkVoltage_EMCVDD2] % 1000U) / 100U);
break; break;
@@ -259,17 +259,17 @@ void BaseMenuGui::refresh()
} }
// Temperatures and pre-compute colors // 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); 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); 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); 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) // SOC voltage (if available)
sprintf(displayStrings[14], "%u mV", context->voltages[HocClkVoltage_SOC] / 1000U); 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[16], "%d mW", context->power[1]); // Avg
sprintf(displayStrings[17], "%u%%", context->partLoad[HocClkPartLoad_GPU] / 10); 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); 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); 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 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[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(this->context->isSaltyNXInstalled) {
if(context->fps == 254) { if(context->fps == 254) {
strcpy(displayStrings[26], "N/A"); 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); 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); 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); 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);
} }

View File

@@ -36,9 +36,9 @@ class BaseMenuGui : public BaseGui
public: public:
// u8 dockedHighestAllowedRefreshRate = 60; // u8 dockedHighestAllowedRefreshRate = 60;
SysClkContext* context; HocClkContext* context;
std::uint64_t lastContextUpdate; std::uint64_t lastContextUpdate;
SysClkConfigValueList configList; HocClkConfigValueList configList;
bool g_hardwareModelCached = false; bool g_hardwareModelCached = false;
bool g_isMariko = false; bool g_isMariko = false;
bool g_isAula = false; bool g_isAula = false;
@@ -87,5 +87,5 @@ class BaseMenuGui : public BaseGui
private: private:
char displayStrings[48][32]; // Pre-formatted display strings 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
}; };

View File

@@ -33,7 +33,7 @@
FreqChoiceGui::FreqChoiceGui(std::uint32_t selectedHz, FreqChoiceGui::FreqChoiceGui(std::uint32_t selectedHz,
std::uint32_t* hzList, std::uint32_t* hzList,
std::uint32_t hzCount, std::uint32_t hzCount,
SysClkModule module, HocClkModule module,
FreqChoiceListener listener, FreqChoiceListener listener,
bool checkMax, bool checkMax,
std::map<uint32_t, std::string> labels) std::map<uint32_t, std::string> labels)
@@ -45,7 +45,7 @@ FreqChoiceGui::FreqChoiceGui(std::uint32_t selectedHz,
this->listener = listener; this->listener = listener;
this->checkMax = checkMax; this->checkMax = checkMax;
this->labels = labels; this->labels = labels;
this->configList = new SysClkConfigValueList {}; this->configList = new HocClkConfigValueList {};
} }
FreqChoiceGui::~FreqChoiceGui() FreqChoiceGui::~FreqChoiceGui()
@@ -106,10 +106,10 @@ tsl::elm::ListItem* FreqChoiceGui::createFreqListItem(std::uint32_t hz, bool sel
void FreqChoiceGui::listUI() void FreqChoiceGui::listUI()
{ {
sysclkIpcGetConfigValues(this->configList); hocclkIpcGetConfigValues(this->configList);
// Header based on CPU/GPU/MEM module // 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)); this->listElement->addItem(new tsl::elm::CategoryHeader(moduleName));
// Default option // Default option

View File

@@ -37,11 +37,11 @@ using FreqChoiceListener = std::function<bool(std::uint32_t hz)>;
class FreqChoiceGui : public BaseMenuGui class FreqChoiceGui : public BaseMenuGui
{ {
protected: protected:
SysClkConfigValueList* configList; HocClkConfigValueList* configList;
std::uint32_t selectedHz; std::uint32_t selectedHz;
std::uint32_t* hzList; std::uint32_t* hzList;
std::uint32_t hzCount; std::uint32_t hzCount;
SysClkModule module; HocClkModule module;
FreqChoiceListener listener; FreqChoiceListener listener;
bool checkMax; bool checkMax;
@@ -53,7 +53,7 @@ public:
FreqChoiceGui(std::uint32_t selectedHz, FreqChoiceGui(std::uint32_t selectedHz,
std::uint32_t* hzList, std::uint32_t* hzList,
std::uint32_t hzCount, std::uint32_t hzCount,
SysClkModule module, HocClkModule module,
FreqChoiceListener listener, FreqChoiceListener listener,
bool checkMax = true, bool checkMax = true,
std::map<uint32_t, std::string> labels = {}); std::map<uint32_t, std::string> labels = {});

View File

@@ -24,37 +24,37 @@
GlobalOverrideGui::GlobalOverrideGui() 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->listItems[m] = nullptr;
this->listHz[m] = 0; 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; std::uint32_t hzCount;
Result rc = Result rc =
sysclkIpcGetFreqList(module, &hzList[0], SYSCLK_FREQ_LIST_MAX, &hzCount); hocclkIpcGetFreqList(module, &hzList[0], HOCCLK_FREQ_LIST_MAX, &hzCount);
if (R_FAILED(rc)) { if (R_FAILED(rc)) {
FatalGui::openWithResultCode("sysclkIpcGetFreqList", rc); FatalGui::openWithResultCode("hocclkIpcGetFreqList", rc);
return; return;
} }
std::map<uint32_t, std::string> labels = {}; 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]; 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); 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]]); labels = IsMariko() ? *(marikoUV[configList.values[KipConfigValue_marikoGpuUV]]) : *(eristaUV[configList.values[KipConfigValue_eristaGpuUV]]);
} }
tsl::changeTo<FreqChoiceGui>( tsl::changeTo<FreqChoiceGui>(
this->context->overrideFreqs[module], hzList, hzCount, module, this->context->overrideFreqs[module], hzList, hzCount, module,
[this, module](std::uint32_t hz) { [this, module](std::uint32_t hz) {
Result rc = sysclkIpcSetOverride(module, hz); Result rc = hocclkIpcSetOverride(module, hz);
if (R_FAILED(rc)) { if (R_FAILED(rc)) {
FatalGui::openWithResultCode("sysclkIpcSetOverride", rc); FatalGui::openWithResultCode("hocclkIpcSetOverride", rc);
return false; return false;
} }
@@ -95,7 +95,7 @@ void GlobalOverrideGui::openValueChoiceGui(
} }
void GlobalOverrideGui::addModuleListItemValue( void GlobalOverrideGui::addModuleListItemValue(
SysClkModule module, HocClkModule module,
const std::string& categoryName, const std::string& categoryName,
std::uint32_t min, std::uint32_t min,
std::uint32_t max, std::uint32_t max,
@@ -115,7 +115,7 @@ void GlobalOverrideGui::addModuleListItemValue(
} }
tsl::elm::ListItem* listItem = tsl::elm::ListItem* listItem =
new tsl::elm::ListItem(sysclkFormatModule(module, true)); new tsl::elm::ListItem(hocclkFormatModule(module, true));
listItem->setValue(FREQ_DEFAULT_TEXT); listItem->setValue(FREQ_DEFAULT_TEXT);
@@ -191,12 +191,12 @@ void GlobalOverrideGui::addModuleListItemValue(
} }
Result rc = Result rc =
sysclkIpcSetOverride(module, this->context->overrideFreqs[module]); hocclkIpcSetOverride(module, this->context->overrideFreqs[module]);
if (R_FAILED(rc)) if (R_FAILED(rc))
{ {
FatalGui::openWithResultCode( FatalGui::openWithResultCode(
"sysclkIpcSetOverride", rc); "hocclkIpcSetOverride", rc);
return false; return false;
} }
@@ -223,11 +223,11 @@ void GlobalOverrideGui::addModuleListItemValue(
this->listHz[module] = 0; this->listHz[module] = 0;
listItem->setValue(FREQ_DEFAULT_TEXT); listItem->setValue(FREQ_DEFAULT_TEXT);
Result rc = sysclkIpcSetOverride(module, 0); Result rc = hocclkIpcSetOverride(module, 0);
if (R_FAILED(rc)) if (R_FAILED(rc))
{ {
FatalGui::openWithResultCode("sysclkIpcSetOverride", rc); FatalGui::openWithResultCode("hocclkIpcSetOverride", rc);
return false; return false;
} }
@@ -242,19 +242,19 @@ void GlobalOverrideGui::addModuleListItemValue(
this->listItems[module] = listItem; this->listItems[module] = listItem;
} }
void GlobalOverrideGui::addModuleListItem(SysClkModule module) void GlobalOverrideGui::addModuleListItem(HocClkModule module)
{ {
tsl::elm::ListItem *listItem = tsl::elm::ListItem *listItem =
new tsl::elm::ListItem(sysclkFormatModule(module, true)); new tsl::elm::ListItem(hocclkFormatModule(module, true));
listItem->setValue(formatListFreqMHz(0)); listItem->setValue(formatListFreqMHz(0));
listItem->setClickListener([this, module](u64 keys) { listItem->setClickListener([this, module](u64 keys) {
if ((keys & HidNpadButton_A) == HidNpadButton_A) { if ((keys & HidNpadButton_A) == HidNpadButton_A) {
this->openFreqChoiceGui(module); this->openFreqChoiceGui(module);
return true; return true;
} else if ((keys & HidNpadButton_Y) == HidNpadButton_Y) { } else if ((keys & HidNpadButton_Y) == HidNpadButton_Y) {
Result rc = sysclkIpcSetOverride(module, 0); Result rc = hocclkIpcSetOverride(module, 0);
if (R_FAILED(rc)) { if (R_FAILED(rc)) {
FatalGui::openWithResultCode("sysclkIpcSetOverride", rc); FatalGui::openWithResultCode("hocclkIpcSetOverride", rc);
return false; return false;
} }
@@ -273,18 +273,18 @@ void GlobalOverrideGui::addModuleListItem(SysClkModule module)
this->listItems[module] = listItem; 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]; bool isOn = this->listHz[module];
tsl::elm::ToggleListItem *toggle = tsl::elm::ToggleListItem *toggle =
new tsl::elm::ToggleListItem(moduleName, isOn); new tsl::elm::ToggleListItem(moduleName, isOn);
toggle->setStateChangedListener([this, module, toggle](bool state) { 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)) { if (R_FAILED(rc)) {
FatalGui::openWithResultCode("sysclkIpcSetProfiles", rc); FatalGui::openWithResultCode("hocclkIpcSetProfiles", rc);
} }
this->lastContextUpdate = armGetSystemTick(); this->lastContextUpdate = armGetSystemTick();
this->context->overrideFreqs[module] = 0; this->context->overrideFreqs[module] = 0;
@@ -300,9 +300,9 @@ public:
GovernorOverrideSubMenuGui(u32 initialPacked) : packed(initialPacked) {} GovernorOverrideSubMenuGui(u32 initialPacked) : packed(initialPacked) {}
void listUI() override { 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]] { if (R_FAILED(rc)) [[unlikely]] {
FatalGui::openWithResultCode("sysclkIpcGetConfigValues", rc); FatalGui::openWithResultCode("hocclkIpcGetConfigValues", rc);
return; return;
} }
this->listElement->addItem(new tsl::elm::CategoryHeader("Governor")); this->listElement->addItem(new tsl::elm::CategoryHeader("Governor"));
@@ -310,7 +310,7 @@ public:
static constexpr struct { const char* label; int shift; } kAll[] = { static constexpr struct { const char* label; int shift; } kAll[] = {
{"CPU", 0}, {"GPU", 8}, {"VRR", 16} {"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++) { for (int i = 0; i < count; i++) {
u8 cur = (this->packed >> kAll[i].shift) & 0xFF; u8 cur = (this->packed >> kAll[i].shift) & 0xFF;
@@ -322,8 +322,8 @@ public:
int shift = kAll[i].shift; int shift = kAll[i].shift;
bar->setValueChangedListener([this, shift](u8 value) { bar->setValueChangedListener([this, shift](u8 value) {
this->packed = (this->packed & ~(0xFFu << shift)) | ((u32)value << shift); this->packed = (this->packed & ~(0xFFu << shift)) | ((u32)value << shift);
Result rc = sysclkIpcSetOverride(HorizonOCModule_Governor, this->packed); Result rc = hocclkIpcSetOverride(HocClkModule_Governor, this->packed);
if (R_FAILED(rc)) FatalGui::openWithResultCode("sysclkIpcSetOverride", rc); if (R_FAILED(rc)) FatalGui::openWithResultCode("hocclkIpcSetOverride", rc);
this->lastContextUpdate = armGetSystemTick(); this->lastContextUpdate = armGetSystemTick();
}); });
this->listElement->addItem(bar); this->listElement->addItem(bar);
@@ -336,7 +336,7 @@ void GlobalOverrideGui::addGovernorSection() {
item->setValue("\u2192"); // right arrow item->setValue("\u2192"); // right arrow
item->setClickListener([this](u64 keys) { item->setClickListener([this](u64 keys) {
if (keys & HidNpadButton_A) { 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); tsl::changeTo<GovernorOverrideSubMenuGui>(packed);
return true; return true;
} }
@@ -351,21 +351,21 @@ void GlobalOverrideGui::listUI()
if(!this->context) if(!this->context)
return; 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]] { if (R_FAILED(rc)) [[unlikely]] {
FatalGui::openWithResultCode("sysclkIpcGetConfigValues", rc); FatalGui::openWithResultCode("hocclkIpcGetConfigValues", rc);
return; return;
} }
this->listElement->addItem(new tsl::elm::CategoryHeader( this->listElement->addItem(new tsl::elm::CategoryHeader(
"Temporary Overrides " + ult::DIVIDER_SYMBOL + " \ue0e3 Reset")); "Temporary Overrides " + ult::DIVIDER_SYMBOL + " \ue0e3 Reset"));
this->addModuleListItem(SysClkModule_CPU); this->addModuleListItem(HocClkModule_CPU);
this->addModuleListItem(SysClkModule_GPU); this->addModuleListItem(HocClkModule_GPU);
this->addModuleListItem(SysClkModule_MEM); this->addModuleListItem(HocClkModule_MEM);
#if IS_MINIMAL == 0 #if IS_MINIMAL == 0
ValueThresholds lcdThresholds(60, 65); ValueThresholds lcdThresholds(60, 65);
if(configList.values[HorizonOCConfigValue_OverwriteRefreshRate]) if(configList.values[HocClkConfigValue_OverwriteRefreshRate])
this->addModuleListItemValue(HorizonOCModule_Display, "Display", IsAula() ? 45 : 40, configList.values[HorizonOCConfigValue_MaxDisplayClockH], this->context->isUsingRetroSuper ? 5 : 1, " Hz", 1, 0, lcdThresholds); this->addModuleListItemValue(HocClkModule_Display, "Display", IsAula() ? 45 : 40, configList.values[HocClkConfigValue_MaxDisplayClockH], this->context->isUsingRetroSuper ? 5 : 1, " Hz", 1, 0, lcdThresholds);
#endif #endif
this->addGovernorSection(); this->addGovernorSection();
@@ -378,8 +378,8 @@ void GlobalOverrideGui::refresh()
if (!this->context) if (!this->context)
return; return;
for (std::uint16_t m = 0; m < SysClkModule_EnumMax; m++) { for (std::uint16_t m = 0; m < HocClkModule_EnumMax; m++) {
if (m == HorizonOCModule_Governor) { if (m == HocClkModule_Governor) {
this->listHz[m] = this->context->overrideFreqs[m]; this->listHz[m] = this->context->overrideFreqs[m];
continue; continue;
} }
@@ -387,7 +387,7 @@ void GlobalOverrideGui::refresh()
if (this->listItems[m] != nullptr && if (this->listItems[m] != nullptr &&
this->listHz[m] != this->context->overrideFreqs[m]) { 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()) { if (it != this->customFormatModules.end()) {
std::string suffix = std::get<0>(it->second); std::string suffix = std::get<0>(it->second);
std::uint32_t divisor = std::get<1>(it->second); std::uint32_t divisor = std::get<1>(it->second);

View File

@@ -33,13 +33,13 @@
class GlobalOverrideGui : public BaseMenuGui class GlobalOverrideGui : public BaseMenuGui
{ {
protected: protected:
std::map<SysClkModule, std::tuple<std::string, std::uint32_t, int>> customFormatModules; std::map<HocClkModule, std::tuple<std::string, std::uint32_t, int>> customFormatModules;
tsl::elm::ListItem* listItems[SysClkModule_EnumMax]; tsl::elm::ListItem* listItems[HocClkModule_EnumMax];
std::uint32_t listHz[SysClkModule_EnumMax]; std::uint32_t listHz[HocClkModule_EnumMax];
void openFreqChoiceGui(SysClkModule module); void openFreqChoiceGui(HocClkModule module);
void addGovernorSection(); void addGovernorSection();
void addModuleListItem(SysClkModule module); void addModuleListItem(HocClkModule module);
void addModuleToggleItem(SysClkModule module); void addModuleToggleItem(HocClkModule module);
void openValueChoiceGui( void openValueChoiceGui(
tsl::elm::ListItem* listItem, tsl::elm::ListItem* listItem,
std::uint32_t currentValue, std::uint32_t currentValue,
@@ -53,7 +53,7 @@ class GlobalOverrideGui : public BaseMenuGui
bool showDefaultValue bool showDefaultValue
); );
void addModuleListItemValue( void addModuleListItemValue(
SysClkModule module, HocClkModule module,
const std::string& categoryName, const std::string& categoryName,
std::uint32_t min, std::uint32_t min,
std::uint32_t max, std::uint32_t max,
@@ -70,5 +70,5 @@ class GlobalOverrideGui : public BaseMenuGui
~GlobalOverrideGui() {} ~GlobalOverrideGui() {}
void listUI() override; void listUI() override;
void refresh() 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);
}; };

View File

@@ -37,10 +37,10 @@ void MainGui::listUI()
{ {
// this->enabledToggle = new tsl::elm::ToggleListItem("Enable", false); // this->enabledToggle = new tsl::elm::ToggleListItem("Enable", false);
// enabledToggle->setStateChangedListener([this](bool state) { // enabledToggle->setStateChangedListener([this](bool state) {
// Result rc = sysclkIpcSetEnabled(state); // Result rc = hocclkIpcSetEnabled(state);
// if(R_FAILED(rc)) // if(R_FAILED(rc))
// { // {
// FatalGui::openWithResultCode("sysclkIpcSetEnabled", rc); // FatalGui::openWithResultCode("hocclkIpcSetEnabled", rc);
// } // }
// this->lastContextUpdate = armGetSystemTick(); // this->lastContextUpdate = armGetSystemTick();
@@ -65,7 +65,7 @@ void MainGui::listUI()
globalProfileItem->setClickListener([this](u64 keys) { globalProfileItem->setClickListener([this](u64 keys) {
if((keys & HidNpadButton_A) == HidNpadButton_A && this->context) if((keys & HidNpadButton_A) == HidNpadButton_A && this->context)
{ {
AppProfileGui::changeTo(SYSCLK_GLOBAL_PROFILE_TID); AppProfileGui::changeTo(HOCCLK_GLOBAL_PROFILE_TID);
return true; return true;
} }

View File

@@ -45,7 +45,7 @@ class RamTableEditor;
MiscGui::MiscGui() MiscGui::MiscGui()
{ {
this->configList = new SysClkConfigValueList {}; this->configList = new HocClkConfigValueList {};
} }
MiscGui::~MiscGui() MiscGui::~MiscGui()
@@ -57,14 +57,14 @@ MiscGui::~MiscGui()
this->configRanges.clear(); this->configRanges.clear();
} }
void MiscGui::addConfigToggle(SysClkConfigValue configVal, const char* altName) { void MiscGui::addConfigToggle(HocClkConfigValue configVal, const char* altName) {
const char* configName = altName ? altName : sysclkFormatConfigValue(configVal, true); const char* configName = altName ? altName : hocclkFormatConfigValue(configVal, true);
tsl::elm::ToggleListItem* toggle = new tsl::elm::ToggleListItem(configName, this->configList->values[configVal]); tsl::elm::ToggleListItem* toggle = new tsl::elm::ToggleListItem(configName, this->configList->values[configVal]);
toggle->setStateChangedListener([this, configVal](bool state) { toggle->setStateChangedListener([this, configVal](bool state) {
this->configList->values[configVal] = uint64_t(state); this->configList->values[configVal] = uint64_t(state);
Result rc = sysclkIpcSetConfigValues(this->configList); Result rc = hocclkIpcSetConfigValues(this->configList);
if (R_FAILED(rc)) if (R_FAILED(rc))
FatalGui::openWithResultCode("sysclkIpcSetConfigValues", rc); FatalGui::openWithResultCode("hocclkIpcSetConfigValues", rc);
this->lastContextUpdate = armGetSystemTick(); this->lastContextUpdate = armGetSystemTick();
}); });
this->listElement->addItem(toggle); 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 char* altName,
const ValueRange& range, const ValueRange& range,
const std::string& categoryName, const std::string& categoryName,
@@ -81,7 +81,7 @@ void MiscGui::addConfigButton(SysClkConfigValue configVal,
const std::vector<NamedValue>& namedValues, const std::vector<NamedValue>& namedValues,
bool showDefaultValue) 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); tsl::elm::ListItem* listItem = new tsl::elm::ListItem(configName);
@@ -128,9 +128,9 @@ void MiscGui::addConfigButton(SysClkConfigValue configVal,
categoryName, categoryName,
[this, configVal](std::uint32_t value) { [this, configVal](std::uint32_t value) {
this->configList->values[configVal] = value; this->configList->values[configVal] = value;
Result rc = sysclkIpcSetConfigValues(this->configList); Result rc = hocclkIpcSetConfigValues(this->configList);
if (R_FAILED(rc)) { if (R_FAILED(rc)) {
FatalGui::openWithResultCode("sysclkIpcSetConfigValues", rc); FatalGui::openWithResultCode("hocclkIpcSetConfigValues", rc);
return false; return false;
} }
this->lastContextUpdate = armGetSystemTick(); this->lastContextUpdate = armGetSystemTick();
@@ -150,9 +150,9 @@ void MiscGui::addConfigButton(SysClkConfigValue configVal,
categoryName, categoryName,
[this, configVal](std::uint32_t value) { [this, configVal](std::uint32_t value) {
this->configList->values[configVal] = value; this->configList->values[configVal] = value;
Result rc = sysclkIpcSetConfigValues(this->configList); Result rc = hocclkIpcSetConfigValues(this->configList);
if (R_FAILED(rc)) { if (R_FAILED(rc)) {
FatalGui::openWithResultCode("sysclkIpcSetConfigValues", rc); FatalGui::openWithResultCode("hocclkIpcSetConfigValues", rc);
return false; return false;
} }
this->lastContextUpdate = armGetSystemTick(); this->lastContextUpdate = armGetSystemTick();
@@ -175,7 +175,7 @@ void MiscGui::addConfigButton(SysClkConfigValue configVal,
this->configNamedValues[configVal] = namedValues; this->configNamedValues[configVal] = namedValues;
} }
void MiscGui::addConfigButtonS(SysClkConfigValue configVal, void MiscGui::addConfigButtonS(HocClkConfigValue configVal,
const char* altName, const char* altName,
const ValueRange& range, const ValueRange& range,
const std::string& categoryName, const std::string& categoryName,
@@ -232,9 +232,9 @@ void MiscGui::addConfigButtonS(SysClkConfigValue configVal,
categoryName, categoryName,
[this, configVal](std::uint32_t value) { [this, configVal](std::uint32_t value) {
this->configList->values[configVal] = value; this->configList->values[configVal] = value;
Result rc = sysclkIpcSetConfigValues(this->configList); Result rc = hocclkIpcSetConfigValues(this->configList);
if (R_FAILED(rc)) { if (R_FAILED(rc)) {
FatalGui::openWithResultCode("sysclkIpcSetConfigValues", rc); FatalGui::openWithResultCode("hocclkIpcSetConfigValues", rc);
return false; return false;
} }
this->lastContextUpdate = armGetSystemTick(); this->lastContextUpdate = armGetSystemTick();
@@ -254,9 +254,9 @@ void MiscGui::addConfigButtonS(SysClkConfigValue configVal,
categoryName, categoryName,
[this, configVal](std::uint32_t value) { [this, configVal](std::uint32_t value) {
this->configList->values[configVal] = value; this->configList->values[configVal] = value;
Result rc = sysclkIpcSetConfigValues(this->configList); Result rc = hocclkIpcSetConfigValues(this->configList);
if (R_FAILED(rc)) { if (R_FAILED(rc)) {
FatalGui::openWithResultCode("sysclkIpcSetConfigValues", rc); FatalGui::openWithResultCode("hocclkIpcSetConfigValues", rc);
return false; return false;
} }
this->lastContextUpdate = armGetSystemTick(); this->lastContextUpdate = armGetSystemTick();
@@ -289,12 +289,12 @@ void MiscGui::updateConfigToggles() {
} }
} }
void MiscGui::addFreqButton(SysClkConfigValue configVal, void MiscGui::addFreqButton(HocClkConfigValue configVal,
const char* altName, const char* altName,
SysClkModule module, HocClkModule module,
const std::map<uint32_t, std::string>& labels) 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); tsl::elm::ListItem* listItem = new tsl::elm::ListItem(configName);
@@ -309,12 +309,12 @@ void MiscGui::addFreqButton(SysClkConfigValue configVal,
if ((keys & HidNpadButton_A) == 0) if ((keys & HidNpadButton_A) == 0)
return false; return false;
std::uint32_t hzList[SYSCLK_FREQ_LIST_MAX]; std::uint32_t hzList[HOCCLK_FREQ_LIST_MAX];
std::uint32_t hzCount; 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)) { if (R_FAILED(rc)) {
FatalGui::openWithResultCode("sysclkIpcGetFreqList", rc); FatalGui::openWithResultCode("hocclkIpcGetFreqList", rc);
return false; return false;
} }
@@ -330,9 +330,9 @@ void MiscGui::addFreqButton(SysClkConfigValue configVal,
uint64_t mhz = hz / 1'000'000; uint64_t mhz = hz / 1'000'000;
this->configList->values[configVal] = mhz; this->configList->values[configVal] = mhz;
Result rc = sysclkIpcSetConfigValues(this->configList); Result rc = hocclkIpcSetConfigValues(this->configList);
if (R_FAILED(rc)) { if (R_FAILED(rc)) {
FatalGui::openWithResultCode("sysclkIpcSetConfigValues", rc); FatalGui::openWithResultCode("hocclkIpcSetConfigValues", rc);
return false; return false;
} }
@@ -354,9 +354,9 @@ void MiscGui::addFreqButton(SysClkConfigValue configVal,
void MiscGui::listUI() void MiscGui::listUI()
{ {
Result rc = sysclkIpcGetConfigValues(configList); Result rc = hocclkIpcGetConfigValues(configList);
if (R_FAILED(rc)) [[unlikely]] { if (R_FAILED(rc)) [[unlikely]] {
FatalGui::openWithResultCode("sysclkIpcGetConfigValues", rc); FatalGui::openWithResultCode("hocclkIpcGetConfigValues", rc);
return; return;
} }
@@ -471,16 +471,16 @@ void MiscGui::listUI()
// NamedValue("2816mA", 2816), // NamedValue("2816mA", 2816),
// NamedValue("3072mA", 3072), // NamedValue("3072mA", 3072),
// }; // };
if(this->configList->values[HorizonOCConfigValue_EnableExperimentalSettings]) { if(this->configList->values[HocClkConfigValue_EnableExperimentalSettings]) {
this->listElement->addItem(new tsl::elm::CategoryHeader("Experimental")); this->listElement->addItem(new tsl::elm::CategoryHeader("Experimental"));
addConfigToggle(HorizonOCConfigValue_LiveCpuUv, nullptr); addConfigToggle(HocClkConfigValue_LiveCpuUv, nullptr);
std::vector<NamedValue> gpuSchedMethodValues = { std::vector<NamedValue> gpuSchedMethodValues = {
NamedValue("INI", GpuSchedulingOverrideMethod_Ini), NamedValue("INI", GpuSchedulingOverrideMethod_Ini),
NamedValue("NV Service", GpuSchedulingOverrideMethod_NvService), NamedValue("NV Service", GpuSchedulingOverrideMethod_NvService),
}; };
addConfigButton( addConfigButton(
HorizonOCConfigValue_GPUSchedulingMethod, HocClkConfigValue_GPUSchedulingMethod,
"GPU Scheduling Override Method", "GPU Scheduling Override Method",
ValueRange(0, 0, 1, "", 0), ValueRange(0, 0, 1, "", 0),
"GPU Scheduling Override Method", "GPU Scheduling Override Method",
@@ -514,7 +514,7 @@ void MiscGui::listUI()
ValueThresholds chargerThresholds(2048, 2049); ValueThresholds chargerThresholds(2048, 2049);
addConfigButton( addConfigButton(
HorizonOCConfigValue_BatteryChargeCurrent, HocClkConfigValue_BatteryChargeCurrent,
"Charge Current Override", "Charge Current Override",
ValueRange(0, 0, 1, "", 0), ValueRange(0, 0, 1, "", 0),
"Charge Current Override", "Charge Current Override",
@@ -539,7 +539,7 @@ void MiscGui::listUI()
ValueThresholds chargerThresholds(1792, 1793); ValueThresholds chargerThresholds(1792, 1793);
addConfigButton( addConfigButton(
HorizonOCConfigValue_BatteryChargeCurrent, HocClkConfigValue_BatteryChargeCurrent,
"Charge Current Override", "Charge Current Override",
ValueRange(0, 0, 1, "", 0), ValueRange(0, 0, 1, "", 0),
"Charge Current Override", "Charge Current Override",
@@ -567,10 +567,10 @@ protected:
NamedValue("VDDQ", RamDisplayMode_VDDQ), 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( addConfigButton(
SysClkConfigValue_PollingIntervalMs, HocClkConfigValue_PollingIntervalMs,
"Polling Interval", "Polling Interval",
ValueRange(50, 1000, 50, "ms", 1), ValueRange(50, 1000, 50, "ms", 1),
"Polling Interval", "Polling Interval",
@@ -601,7 +601,7 @@ protected:
}; };
addConfigButton( addConfigButton(
HorizonOCConfigValue_CpuGovernorMinimumFreq, HocClkConfigValue_CpuGovernorMinimumFreq,
"CPU Governor Minimum Frequency", "CPU Governor Minimum Frequency",
ValueRange(0, 0, 1, "", 0), ValueRange(0, 0, 1, "", 0),
"CPU Governor Minimum Frequency", "CPU Governor Minimum Frequency",
@@ -626,7 +626,7 @@ protected:
return; return;
this->listElement->addItem(new tsl::elm::CategoryHeader("Display Settings")); this->listElement->addItem(new tsl::elm::CategoryHeader("Display Settings"));
addConfigToggle(HorizonOCConfigValue_OverwriteRefreshRate, nullptr); addConfigToggle(HocClkConfigValue_OverwriteRefreshRate, nullptr);
if(!this->context->isUsingRetroSuper) { if(!this->context->isUsingRetroSuper) {
tsl::elm::CustomDrawer* warningText = new tsl::elm::CustomDrawer([](tsl::gfx::Renderer *renderer, s32 x, s32 y, s32 w, s32 h) { 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); 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); this->listElement->addItem(warningText);
ValueThresholds displayThresholds(60, 65); ValueThresholds displayThresholds(60, 65);
addConfigButton( addConfigButton(
HorizonOCConfigValue_MaxDisplayClockH, HocClkConfigValue_MaxDisplayClockH,
"Max Handheld Display", "Max Handheld Display",
ValueRange(60, IsAula() ? 65 : 75, 1, " Hz", 1), ValueRange(60, IsAula() ? 65 : 75, 1, " Hz", 1),
"Display Clock", "Display Clock",
@@ -958,9 +958,9 @@ public:
protected: protected:
void listUI() override { 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]] { if (R_FAILED(rc)) [[unlikely]] {
FatalGui::openWithResultCode("sysclkIpcGetConfigValues", rc); FatalGui::openWithResultCode("hocclkIpcGetConfigValues", rc);
return; return;
} }
@@ -1369,7 +1369,7 @@ protected:
}; };
addConfigButton( addConfigButton(
HorizonOCConfigValue_GPUScheduling, HocClkConfigValue_GPUScheduling,
"GPU Scheduling Override", "GPU Scheduling Override",
ValueRange(0, 0, 1, "", 0), ValueRange(0, 0, 1, "", 0),
"GPU Scheduling Override", "GPU Scheduling Override",
@@ -1410,7 +1410,7 @@ protected:
}; };
addConfigButton( addConfigButton(
HorizonOCConfigValue_DVFSMode, HocClkConfigValue_DVFSMode,
"GPU DVFS Mode", "GPU DVFS Mode",
ValueRange(0, 0, 1, "", 0), ValueRange(0, 0, 1, "", 0),
"GPU DVFS Mode", "GPU DVFS Mode",
@@ -1420,7 +1420,7 @@ protected:
false 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"); tsl::elm::ListItem* customTableSubmenu = new tsl::elm::ListItem("GPU Voltage Table");
@@ -1443,9 +1443,9 @@ public:
protected: protected:
void listUI() override { 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]] { if (R_FAILED(rc)) [[unlikely]] {
FatalGui::openWithResultCode("sysclkIpcGetConfigValues", rc); FatalGui::openWithResultCode("hocclkIpcGetConfigValues", rc);
return; return;
} }
@@ -1696,9 +1696,9 @@ void MiscGui::refresh() {
if (this->context && ++frameCounter >= 60) { if (this->context && ++frameCounter >= 60) {
frameCounter = 0; frameCounter = 0;
Result rc = sysclkIpcGetConfigValues(this->configList); Result rc = hocclkIpcGetConfigValues(this->configList);
if (R_FAILED(rc)) [[unlikely]] { if (R_FAILED(rc)) [[unlikely]] {
FatalGui::openWithResultCode("sysclkIpcGetConfigValues", rc); FatalGui::openWithResultCode("hocclkIpcGetConfigValues", rc);
return; return;
} }
updateConfigToggles(); updateConfigToggles();

View File

@@ -33,17 +33,17 @@ public:
void refresh() override; void refresh() override;
protected: protected:
SysClkConfigValueList* configList; HocClkConfigValueList* configList;
std::map<SysClkConfigValue, tsl::elm::ListItem*> configButtons; std::map<HocClkConfigValue, tsl::elm::ListItem*> configButtons;
std::map<SysClkConfigValue, ValueRange> configRanges; std::map<HocClkConfigValue, ValueRange> configRanges;
std::map<SysClkConfigValue, std::vector<NamedValue>> configNamedValues; std::map<HocClkConfigValue, std::vector<NamedValue>> configNamedValues;
std::map<SysClkConfigValue, tsl::elm::ToggleListItem*> configToggles; std::map<HocClkConfigValue, tsl::elm::ToggleListItem*> configToggles;
std::map<SysClkConfigValue, std::tuple<tsl::elm::TrackBar*, tsl::elm::ListItem*, std::vector<uint64_t>>> configTrackbars; std::map<HocClkConfigValue, std::tuple<tsl::elm::TrackBar*, tsl::elm::ListItem*, std::vector<uint64_t>>> configTrackbars;
std::set<SysClkConfigValue> configButtonSKeys; std::set<HocClkConfigValue> configButtonSKeys;
std::map<SysClkConfigValue, std::string> configButtonSSubtext; std::map<HocClkConfigValue, std::string> configButtonSSubtext;
void addConfigToggle(SysClkConfigValue configVal, const char* altName); void addConfigToggle(HocClkConfigValue configVal, const char* altName);
void addConfigButton(SysClkConfigValue configVal, void addConfigButton(HocClkConfigValue configVal,
const char* altName, const char* altName,
const ValueRange& range, const ValueRange& range,
const std::string& categoryName, const std::string& categoryName,
@@ -52,7 +52,7 @@ protected:
const std::vector<NamedValue>& namedValues = {}, const std::vector<NamedValue>& namedValues = {},
bool showDefaultValue = true); bool showDefaultValue = true);
void addConfigButtonS(SysClkConfigValue configVal, void addConfigButtonS(HocClkConfigValue configVal,
const char* altName, const char* altName,
const ValueRange& range, const ValueRange& range,
const std::string& categoryName, const std::string& categoryName,
@@ -61,9 +61,9 @@ protected:
const std::vector<NamedValue>& namedValues = {}, const std::vector<NamedValue>& namedValues = {},
bool showDefaultValue = true, bool showDefaultValue = true,
const char* subText = nullptr); const char* subText = nullptr);
void addFreqButton(SysClkConfigValue configVal, void addFreqButton(HocClkConfigValue configVal,
const char* altName, const char* altName,
SysClkModule module, HocClkModule module,
const std::map<uint32_t, std::string>& labels = {}); const std::map<uint32_t, std::string>& labels = {});
void updateConfigToggles(); void updateConfigToggles();

View File

@@ -25,7 +25,7 @@
*/ */
#include <nxExt.h> #include <nxExt.h>
#include <sysclk.h> #include <hocclk.h>
#include <switch.h> #include <switch.h>
#include <pwm.h> #include <pwm.h>
#include <registers.h> #include <registers.h>
@@ -44,9 +44,9 @@
#include "../file_utils.hpp" #include "../file_utils.hpp"
namespace board { namespace board {
SysClkSocType gSocType; HocClkSocType gSocType;
u8 gDramID; u8 gDramID;
HorizonOCConsoleType gConsoleType = HorizonOCConsoleType_Iowa; HocClkConsoleType gConsoleType = HocClkConsoleType_Iowa;
FuseData fuseData; FuseData fuseData;
u8 speedoBracket; u8 speedoBracket;
PwmChannelSession iCon; PwmChannelSession iCon;
@@ -71,17 +71,17 @@ namespace board {
switch(sku) { switch(sku) {
case 2 ... 5: case 2 ... 5:
gSocType = SysClkSocType_Mariko; gSocType = HocClkSocType_Mariko;
break; break;
default: default:
gSocType = SysClkSocType_Erista; gSocType = HocClkSocType_Erista;
} }
if (gSocType == SysClkSocType_Mariko) { if (gSocType == HocClkSocType_Mariko) {
CacheGpuVoltTable(); CacheGpuVoltTable();
} }
gConsoleType = static_cast<HorizonOCConsoleType>(sku); gConsoleType = static_cast<HocClkConsoleType>(sku);
} }
/* TODO: Check for config */ /* TODO: Check for config */
@@ -153,7 +153,7 @@ namespace board {
rc = svcQueryMemoryMapping(&dsiVirtAddr, &outsize, 0x54300000, 0x40000); rc = svcQueryMemoryMapping(&dsiVirtAddr, &outsize, 0x54300000, 0x40000);
ASSERT_RESULT_OK(rc, "svcQueryMemoryMapping (dsi)"); 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); display::Initialize(&cfg);
CacheDfllData(); CacheDfllData();
@@ -189,11 +189,11 @@ namespace board {
nvExit(); nvExit();
} }
SysClkSocType GetSocType() { HocClkSocType GetSocType() {
return gSocType; return gSocType;
} }
HorizonOCConsoleType GetConsoleType() { HocClkConsoleType GetConsoleType() {
return gConsoleType; return gConsoleType;
} }
@@ -217,7 +217,7 @@ namespace board {
/* TODO: Put this into a different file. */ /* TODO: Put this into a different file. */
void SetDisplayRefreshDockedState(bool docked) { void SetDisplayRefreshDockedState(bool docked) {
if (GetConsoleType() != HorizonOCConsoleType_Hoag) { if (GetConsoleType() != HocClkConsoleType_Hoag) {
display::SetDockedState(docked); display::SetDockedState(docked);
} }
} }

View File

@@ -27,7 +27,7 @@
#pragma once #pragma once
#include <switch.h> #include <switch.h>
#include <sysclk.h> #include <hocclk.h>
#include "board_fuse.hpp" #include "board_fuse.hpp"
#include "board_load.hpp" #include "board_load.hpp"
#include "board_name.hpp" #include "board_name.hpp"
@@ -43,8 +43,8 @@ namespace board {
void Initialize(); void Initialize();
void Exit(); void Exit();
SysClkSocType GetSocType(); HocClkSocType GetSocType();
HorizonOCConsoleType GetConsoleType(); HocClkConsoleType GetConsoleType();
u8 GetDramID(); u8 GetDramID();
u8 GetGpuSpeedoBracket(); u8 GetGpuSpeedoBracket();
bool IsDram8GB(); bool IsDram8GB();

View File

@@ -25,7 +25,7 @@
*/ */
#include <switch.h> #include <switch.h>
#include <sysclk.h> #include <hocclk.h>
#include <nxExt.h> #include <nxExt.h>
#include "display_refresh_rate.hpp" #include "display_refresh_rate.hpp"
#include "board.hpp" #include "board.hpp"
@@ -34,24 +34,24 @@
namespace board { namespace board {
PcvModule GetPcvModule(SysClkModule sysclkModule) { PcvModule GetPcvModule(HocClkModule hocclkModule) {
switch (sysclkModule) { switch (hocclkModule) {
case SysClkModule_CPU: case HocClkModule_CPU:
return PcvModule_CpuBus; return PcvModule_CpuBus;
case SysClkModule_GPU: case HocClkModule_GPU:
return PcvModule_GPU; return PcvModule_GPU;
case SysClkModule_MEM: case HocClkModule_MEM:
return PcvModule_EMC; return PcvModule_EMC;
default: default:
ASSERT_ENUM_VALID(SysClkModule, sysclkModule); ASSERT_ENUM_VALID(HocClkModule, hocclkModule);
} }
return static_cast<PcvModule>(0); return static_cast<PcvModule>(0);
} }
PcvModuleId GetPcvModuleId(SysClkModule sysclkModule) { PcvModuleId GetPcvModuleId(HocClkModule hocclkModule) {
PcvModuleId pcvModuleId; PcvModuleId pcvModuleId;
Result rc = pcvGetModuleId(&pcvModuleId, GetPcvModule(sysclkModule)); Result rc = pcvGetModuleId(&pcvModuleId, GetPcvModule(hocclkModule));
ASSERT_RESULT_OK(rc, "pcvGetModuleId"); ASSERT_RESULT_OK(rc, "pcvGetModuleId");
return pcvModuleId; return pcvModuleId;
@@ -65,12 +65,12 @@ namespace board {
ASSERT_RESULT_OK(pcvSetClockRate(moduleID, hz), "pcvSetClockRate"); ASSERT_RESULT_OK(pcvSetClockRate(moduleID, hz), "pcvSetClockRate");
} }
void SetHz(SysClkModule module, u32 hz) { void SetHz(HocClkModule module, u32 hz) {
Result rc = 0; Result rc = 0;
bool usesGovenor = module > SysClkModule_MEM; bool usesGovenor = module > HocClkModule_MEM;
if (module == HorizonOCModule_Display) { if (module == HocClkModule_Display) {
display::SetRate(hz); display::SetRate(hz);
return; return;
} }
@@ -86,7 +86,7 @@ namespace board {
ClkrstSetHz(session, hz); ClkrstSetHz(session, hz);
/* Voltage bug workaround. */ /* Voltage bug workaround. */
if (module == SysClkModule_CPU) { if (module == HocClkModule_CPU) {
svcSleepThread(250'000); svcSleepThread(250'000);
ClkrstSetHz(session, hz); ClkrstSetHz(session, hz);
} }
@@ -95,7 +95,7 @@ namespace board {
} else { } else {
PcvSetHz(GetPcvModule(module), hz); PcvSetHz(GetPcvModule(module), hz);
if (module == SysClkModule_CPU) { if (module == HocClkModule_CPU) {
svcSleepThread(250'000); svcSleepThread(250'000);
PcvSetHz(GetPcvModule(module), hz); PcvSetHz(GetPcvModule(module), hz);
} }
@@ -107,11 +107,11 @@ namespace board {
return hz; return hz;
} }
u32 GetHz(SysClkModule module) { u32 GetHz(HocClkModule module) {
Result rc = 0; Result rc = 0;
u32 hz = 0; u32 hz = 0;
if (module == HorizonOCModule_Display) { if (module == HocClkModule_Display) {
return GetDisplayRate(hz); return GetDisplayRate(hz);
} }
@@ -133,26 +133,26 @@ namespace board {
return hz; return hz;
} }
u32 GetRealHz(SysClkModule module) { u32 GetRealHz(HocClkModule module) {
u32 hz = 0; u32 hz = 0;
switch (module) { switch (module) {
case SysClkModule_CPU: case HocClkModule_CPU:
return t210ClkCpuFreq(); return t210ClkCpuFreq();
case SysClkModule_GPU: case HocClkModule_GPU:
return t210ClkGpuFreq(); return t210ClkGpuFreq();
case SysClkModule_MEM: case HocClkModule_MEM:
return t210ClkMemFreq(); return t210ClkMemFreq();
case HorizonOCModule_Display: case HocClkModule_Display:
return GetDisplayRate(hz); return GetDisplayRate(hz);
return hz; return hz;
default: default:
ASSERT_ENUM_VALID(SysClkModule, module); ASSERT_ENUM_VALID(HocClkModule, module);
} }
return 0; 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; Result rc = 0;
PcvClockRatesListType type; PcvClockRatesListType type;
s32 tmpInMaxCount = maxCount; s32 tmpInMaxCount = maxCount;
@@ -182,7 +182,7 @@ namespace board {
} }
u32 GetHighestDockedDisplayRate() { u32 GetHighestDockedDisplayRate() {
if (GetConsoleType() != HorizonOCConsoleType_Hoag) { if (GetConsoleType() != HocClkConsoleType_Hoag) {
return display::GetDockedHighestAllowed(); return display::GetDockedHighestAllowed();
} }
@@ -196,10 +196,10 @@ namespace board {
rc = apmExtGetCurrentPerformanceConfiguration(&confId); rc = apmExtGetCurrentPerformanceConfiguration(&confId);
ASSERT_RESULT_OK(rc, "apmExtGetCurrentPerformanceConfiguration"); ASSERT_RESULT_OK(rc, "apmExtGetCurrentPerformanceConfiguration");
SysClkApmConfiguration* apmConfiguration = nullptr; HocClkApmConfiguration* apmConfiguration = nullptr;
for (size_t i = 0; sysclk_g_apm_configurations[i].id; ++i) { for (size_t i = 0; hocclk_g_apm_configurations[i].id; ++i) {
if(sysclk_g_apm_configurations[i].id == confId) { if(hocclk_g_apm_configurations[i].id == confId) {
apmConfiguration = &sysclk_g_apm_configurations[i]; apmConfiguration = &hocclk_g_apm_configurations[i];
break; break;
} }
} }
@@ -208,9 +208,9 @@ namespace board {
ERROR_THROW("Unknown apm configuration: %x", confId); ERROR_THROW("Unknown apm configuration: %x", confId);
} }
SetHz(SysClkModule_CPU, apmConfiguration->cpu_hz); SetHz(HocClkModule_CPU, apmConfiguration->cpu_hz);
SetHz(SysClkModule_GPU, apmConfiguration->gpu_hz); SetHz(HocClkModule_GPU, apmConfiguration->gpu_hz);
SetHz(SysClkModule_MEM, apmConfiguration->mem_hz); SetHz(HocClkModule_MEM, apmConfiguration->mem_hz);
} else { } else {
u32 mode = 0; u32 mode = 0;
rc = apmExtGetPerformanceMode(&mode); rc = apmExtGetPerformanceMode(&mode);
@@ -222,7 +222,7 @@ namespace board {
} }
void ResetToStockDisplay() { void ResetToStockDisplay() {
if (GetConsoleType() != HorizonOCConsoleType_Hoag) { if (GetConsoleType() != HocClkConsoleType_Hoag) {
display::SetRate(60); display::SetRate(60);
} }
} }

View File

@@ -26,24 +26,24 @@
#pragma once #pragma once
#include <switch.h> #include <switch.h>
#include <sysclk.h> #include <hocclk.h>
#include <nxExt.h> #include <nxExt.h>
#include "../errors.hpp" #include "../errors.hpp"
namespace board { namespace board {
void SetHz(SysClkModule module, u32 hz); void SetHz(HocClkModule module, u32 hz);
u32 GetHz(SysClkModule module); u32 GetHz(HocClkModule module);
u32 GetRealHz(SysClkModule module); u32 GetRealHz(HocClkModule module);
void GetFreqList(SysClkModule module, u32 *outList, u32 maxCount, u32 *outCount); void GetFreqList(HocClkModule module, u32 *outList, u32 maxCount, u32 *outCount);
u32 GetHighestDockedDisplayRate(); u32 GetHighestDockedDisplayRate();
void ResetToStock(); void ResetToStock();
void ResetToStockDisplay(); void ResetToStockDisplay();
template <typename Getter> template <typename Getter>
void ResetToStockModule(Getter getHzFunc, SysClkModule module) { void ResetToStockModule(Getter getHzFunc, HocClkModule module) {
Result rc = 0; Result rc = 0;
if (hosversionAtLeast(9, 0, 0)) { if (hosversionAtLeast(9, 0, 0)) {
@@ -51,11 +51,11 @@ namespace board {
rc = apmExtGetCurrentPerformanceConfiguration(&confId); rc = apmExtGetCurrentPerformanceConfiguration(&confId);
ASSERT_RESULT_OK(rc, "apmExtGetCurrentPerformanceConfiguration"); ASSERT_RESULT_OK(rc, "apmExtGetCurrentPerformanceConfiguration");
SysClkApmConfiguration* apmConfiguration = nullptr; HocClkApmConfiguration* apmConfiguration = nullptr;
for (size_t i = 0; sysclk_g_apm_configurations[i].id; ++i) { for (size_t i = 0; hocclk_g_apm_configurations[i].id; ++i) {
if (sysclk_g_apm_configurations[i].id == confId) { if (hocclk_g_apm_configurations[i].id == confId) {
apmConfiguration = &sysclk_g_apm_configurations[i]; apmConfiguration = &hocclk_g_apm_configurations[i];
break; break;
} }
} }
@@ -76,15 +76,15 @@ namespace board {
} }
inline void ResetToStockCpu() { 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() { 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() { inline void ResetToStockMem() {
ResetToStockModule([](const SysClkApmConfiguration& cfg){ return cfg.mem_hz; }, SysClkModule_MEM); ResetToStockModule([](const HocClkApmConfiguration& cfg){ return cfg.mem_hz; }, HocClkModule_MEM);
} }
} }

View File

@@ -25,7 +25,7 @@
*/ */
#include <switch.h> #include <switch.h>
#include <sysclk.h> #include <hocclk.h>
#include <nxExt.h> #include <nxExt.h>
#include <algorithm> #include <algorithm>
#include <math.h> #include <math.h>
@@ -104,11 +104,11 @@ namespace board {
return std::round(std::max({cpuUsage0, cpuUsage1, cpuUsage2})); return std::round(std::max({cpuUsage0, cpuUsage1, cpuUsage2}));
} }
u32 GetPartLoad(SysClkPartLoad loadSource) { u32 GetPartLoad(HocClkPartLoad loadSource) {
switch(loadSource) { switch(loadSource) {
case SysClkPartLoad_EMC: case HocClkPartLoad_EMC:
return t210EmcLoadAll(); return t210EmcLoadAll();
case SysClkPartLoad_EMCCpu: case HocClkPartLoad_EMCCpu:
return t210EmcLoadCpu(); return t210EmcLoadCpu();
case HocClkPartLoad_GPU: case HocClkPartLoad_GPU:
return gpuLoad; return gpuLoad;
@@ -121,7 +121,7 @@ namespace board {
case HocClkPartLoad_FAN: case HocClkPartLoad_FAN:
return GetFanLevel(); return GetFanLevel();
default: default:
ASSERT_ENUM_VALID(SysClkPartLoad, loadSource); ASSERT_ENUM_VALID(HocClkPartLoad, loadSource);
} }
return 0; return 0;
} }

View File

@@ -26,13 +26,13 @@
#pragma once #pragma once
#include <switch.h> #include <switch.h>
#include <sysclk.h> #include <hocclk.h>
namespace board { namespace board {
void StartLoad(Result nvCheck, u32 fd); void StartLoad(Result nvCheck, u32 fd);
void ExitLoad(); void ExitLoad();
u32 GetPartLoad(SysClkPartLoad loadSource); u32 GetPartLoad(HocClkPartLoad loadSource);
void SetGpuSchedulingMode(GpuSchedulingMode mode, GpuSchedulingOverrideMethod method); void SetGpuSchedulingMode(GpuSchedulingMode mode, GpuSchedulingOverrideMethod method);
void SchedSetFD2(u32 fd2); void SchedSetFD2(u32 fd2);
void NvSchedSucceed(Result nvSched); void NvSchedSucceed(Result nvSched);

View File

@@ -27,7 +27,7 @@
#pragma once #pragma once
#include <switch.h> #include <switch.h>
#include <sysclk.h> #include <hocclk.h>
#include <pwm.h> #include <pwm.h>
namespace board { namespace board {

View File

@@ -25,29 +25,29 @@
*/ */
#include <switch.h> #include <switch.h>
#include <sysclk.h> #include <hocclk.h>
#include "board.hpp" #include "board.hpp"
namespace board { namespace board {
const char *GetModuleName(SysClkModule module, bool pretty) { const char *GetModuleName(HocClkModule module, bool pretty) {
ASSERT_ENUM_VALID(SysClkModule, module); ASSERT_ENUM_VALID(HocClkModule, module);
return sysclkFormatModule(module, pretty); return hocclkFormatModule(module, pretty);
} }
const char *GetProfileName(SysClkProfile profile, bool pretty) { const char *GetProfileName(HocClkProfile profile, bool pretty) {
ASSERT_ENUM_VALID(SysClkProfile, profile); ASSERT_ENUM_VALID(HocClkProfile, profile);
return sysclkFormatProfile(profile, pretty); return hocclkFormatProfile(profile, pretty);
} }
const char *GetThermalSensorName(SysClkThermalSensor sensor, bool pretty) { const char *GetThermalSensorName(HocClkThermalSensor sensor, bool pretty) {
ASSERT_ENUM_VALID(SysClkThermalSensor, sensor); ASSERT_ENUM_VALID(HocClkThermalSensor, sensor);
return sysclkFormatThermalSensor(sensor, pretty); return hocclkFormatThermalSensor(sensor, pretty);
} }
const char *GetPowerSensorName(SysClkPowerSensor sensor, bool pretty) { const char *GetPowerSensorName(HocClkPowerSensor sensor, bool pretty) {
ASSERT_ENUM_VALID(SysClkPowerSensor, sensor); ASSERT_ENUM_VALID(HocClkPowerSensor, sensor);
return sysclkFormatPowerSensor(sensor, pretty); return hocclkFormatPowerSensor(sensor, pretty);
} }
} }

View File

@@ -26,13 +26,13 @@
#pragma once #pragma once
#include <switch.h> #include <switch.h>
#include <sysclk.h> #include <hocclk.h>
namespace board { namespace board {
const char *GetModuleName(SysClkModule module, bool pretty); const char *GetModuleName(HocClkModule module, bool pretty);
const char *GetProfileName(SysClkProfile profile, bool pretty); const char *GetProfileName(HocClkProfile profile, bool pretty);
const char *GetThermalSensorName(SysClkThermalSensor sensor, bool pretty); const char *GetThermalSensorName(HocClkThermalSensor sensor, bool pretty);
const char *GetPowerSensorName(SysClkPowerSensor sensor, bool pretty); const char *GetPowerSensorName(HocClkPowerSensor sensor, bool pretty);
} }

View File

@@ -25,19 +25,19 @@
*/ */
#include <switch.h> #include <switch.h>
#include <sysclk.h> #include <hocclk.h>
#include <nxExt.h> #include <nxExt.h>
#include "board.hpp" #include "board.hpp"
namespace board { namespace board {
SysClkProfile GetProfile() { HocClkProfile GetProfile() {
u32 mode = 0; u32 mode = 0;
Result rc = apmExtGetPerformanceMode(&mode); Result rc = apmExtGetPerformanceMode(&mode);
ASSERT_RESULT_OK(rc, "apmExtGetPerformanceMode"); ASSERT_RESULT_OK(rc, "apmExtGetPerformanceMode");
if (mode) { if (mode) {
return SysClkProfile_Docked; return HocClkProfile_Docked;
} }
PsmChargerType chargerType; PsmChargerType chargerType;
@@ -46,12 +46,12 @@ namespace board {
ASSERT_RESULT_OK(rc, "psmGetChargerType"); ASSERT_RESULT_OK(rc, "psmGetChargerType");
if (chargerType == PsmChargerType_EnoughPower) { if (chargerType == PsmChargerType_EnoughPower) {
return SysClkProfile_HandheldChargingOfficial; return HocClkProfile_HandheldChargingOfficial;
} else if (chargerType == PsmChargerType_LowPower) { } else if (chargerType == PsmChargerType_LowPower) {
return SysClkProfile_HandheldChargingUSB; return HocClkProfile_HandheldChargingUSB;
} }
return SysClkProfile_Handheld; return HocClkProfile_Handheld;
} }
} }

View File

@@ -25,10 +25,10 @@
*/ */
#pragma once #pragma once
#include <sysclk.h> #include <hocclk.h>
namespace board { namespace board {
SysClkProfile GetProfile(); HocClkProfile GetProfile();
} }

View File

@@ -24,7 +24,7 @@
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
#include <sysclk.h> #include <hocclk.h>
#include <switch.h> #include <switch.h>
#include <nxExt.h> #include <nxExt.h>
#include <cmath> #include <cmath>
@@ -35,7 +35,7 @@
namespace board { namespace board {
s32 GetTemperatureMilli(SysClkThermalSensor sensor) { s32 GetTemperatureMilli(HocClkThermalSensor sensor) {
s32 millis = 0; s32 millis = 0;
BatteryChargeInfo info; BatteryChargeInfo info;
@@ -43,15 +43,15 @@ namespace board {
soctherm::ReadSensors(temps); soctherm::ReadSensors(temps);
switch(sensor) { switch(sensor) {
case SysClkThermalSensor_SOC: { case HocClkThermalSensor_SOC: {
millis = tmp451TempSoc(); millis = tmp451TempSoc();
break; break;
} }
case SysClkThermalSensor_PCB: { case HocClkThermalSensor_PCB: {
millis = tmp451TempPcb(); millis = tmp451TempPcb();
break; break;
} }
case SysClkThermalSensor_Skin: { case HocClkThermalSensor_Skin: {
if (HOSSVC_HAS_TC) { if (HOSSVC_HAS_TC) {
Result rc; Result rc;
rc = tcGetSkinTemperatureMilliC(&millis); rc = tcGetSkinTemperatureMilliC(&millis);
@@ -59,46 +59,46 @@ namespace board {
} }
break; break;
} }
case HorizonOCThermalSensor_Battery: { case HocClkThermalSensor_Battery: {
batteryInfoGetChargeInfo(&info); batteryInfoGetChargeInfo(&info);
millis = batteryInfoGetTemperatureMiliCelsius(&info); millis = batteryInfoGetTemperatureMiliCelsius(&info);
break; break;
} }
case HorizonOCThermalSensor_PMIC: { case HocClkThermalSensor_PMIC: {
millis = 50000; millis = 50000;
break; break;
} }
case HorizonOCThermalSensor_CPU: { case HocClkThermalSensor_CPU: {
millis = temps.cpu; millis = temps.cpu;
break; break;
} }
case HorizonOCThermalSensor_GPU: { case HocClkThermalSensor_GPU: {
millis = temps.gpu; millis = temps.gpu;
break; break;
} }
case HorizonOCThermalSensor_MEM: { case HocClkThermalSensor_MEM: {
millis = board::GetSocType() == SysClkSocType_Mariko ? temps.pllx : temps.mem; millis = board::GetSocType() == HocClkSocType_Mariko ? temps.pllx : temps.mem;
break; break;
} }
case HorizonOCThermalSensor_PLLX: { case HocClkThermalSensor_PLLX: {
millis = temps.pllx; millis = temps.pllx;
} }
default: { default: {
ASSERT_ENUM_VALID(SysClkThermalSensor, sensor); ASSERT_ENUM_VALID(HocClkThermalSensor, sensor);
} }
} }
return std::max(0, millis); return std::max(0, millis);
} }
s32 GetPowerMw(SysClkPowerSensor sensor) { s32 GetPowerMw(HocClkPowerSensor sensor) {
switch (sensor) { switch (sensor) {
case SysClkPowerSensor_Now: case HocClkPowerSensor_Now:
return max17050PowerNow(); return max17050PowerNow();
case SysClkPowerSensor_Avg: case HocClkPowerSensor_Avg:
return max17050PowerAvg(); return max17050PowerAvg();
default: default:
ASSERT_ENUM_VALID(SysClkPowerSensor, sensor); ASSERT_ENUM_VALID(HocClkPowerSensor, sensor);
} }
return 0; return 0;

View File

@@ -25,12 +25,12 @@
*/ */
#pragma once #pragma once
#include <sysclk.h> #include <hocclk.h>
#include <switch.h> #include <switch.h>
namespace board { namespace board {
s32 GetTemperatureMilli(SysClkThermalSensor sensor); s32 GetTemperatureMilli(HocClkThermalSensor sensor);
s32 GetPowerMw(SysClkPowerSensor sensor); s32 GetPowerMw(HocClkPowerSensor sensor);
} }

View File

@@ -25,7 +25,7 @@
*/ */
#include <switch.h> #include <switch.h>
#include <sysclk.h> #include <hocclk.h>
#include <memmem.h> #include <memmem.h>
#include <registers.h> #include <registers.h>
#include <cstring> #include <cstring>
@@ -100,11 +100,11 @@ namespace board {
Result rc = svcQueryMemoryMapping(&cldvfs, &temp, CLDVFS_REGION_BASE, CLDVFS_REGION_SIZE); Result rc = svcQueryMemoryMapping(&cldvfs, &temp, CLDVFS_REGION_BASE, CLDVFS_REGION_SIZE);
ASSERT_RESULT_OK(rc, "svcQueryMemoryMapping (cldvfs)"); 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.tune0Low = *reinterpret_cast<u32 *>(cldvfs + CL_DVFS_TUNE0_0);
cachedTune.tune1Low = *reinterpret_cast<u32 *>(cldvfs + CL_DVFS_TUNE1_0); cachedTune.tune1Low = *reinterpret_cast<u32 *>(cldvfs + CL_DVFS_TUNE1_0);
} else { } else {
SetHz(SysClkModule_CPU, 1785000000); SetHz(HocClkModule_CPU, 1785000000);
cachedTune.tune0High = *reinterpret_cast<u32 *>(cldvfs + CL_DVFS_TUNE0_0); cachedTune.tune0High = *reinterpret_cast<u32 *>(cldvfs + CL_DVFS_TUNE0_0);
ResetToStockCpu(); ResetToStockCpu();
} }
@@ -114,8 +114,8 @@ namespace board {
void SetDfllTunings(u32 levelLow, u32 levelHigh, u32 tbreakPoint) { void SetDfllTunings(u32 levelLow, u32 levelHigh, u32 tbreakPoint) {
u32* tune0_ptr = reinterpret_cast<u32 *>(cldvfs + CL_DVFS_TUNE0_0); u32* tune0_ptr = reinterpret_cast<u32 *>(cldvfs + CL_DVFS_TUNE0_0);
u32* tune1_ptr = reinterpret_cast<u32 *>(cldvfs + CL_DVFS_TUNE1_0); u32* tune1_ptr = reinterpret_cast<u32 *>(cldvfs + CL_DVFS_TUNE1_0);
if (GetSocType() == SysClkSocType_Mariko) { if (GetSocType() == HocClkSocType_Mariko) {
if (GetHz(SysClkModule_CPU) < tbreakPoint && (levelLow || levelHigh)) { if (GetHz(HocClkModule_CPU) < tbreakPoint && (levelLow || levelHigh)) {
if (levelLow) { if (levelLow) {
*tune0_ptr = marikoCpuUvLow[levelLow-1].tune0_low; *tune0_ptr = marikoCpuUvLow[levelLow-1].tune0_low;
*tune1_ptr = marikoCpuUvLow[levelLow-1].tune1_low; *tune1_ptr = marikoCpuUvLow[levelLow-1].tune1_low;
@@ -132,17 +132,17 @@ namespace board {
} }
return; return;
} }
if (GetHz(SysClkModule_CPU) < tbreakPoint || (!levelLow)) { // account for tbreak if (GetHz(HocClkModule_CPU) < tbreakPoint || (!levelLow)) { // account for tbreak
*tune0_ptr = 0xCFFF; *tune0_ptr = 0xCFFF;
*tune1_ptr = 0xFF072201; *tune1_ptr = 0xFF072201;
return; return;
} else if (GetHz(SysClkModule_CPU) >= tbreakPoint || (!levelHigh)) { } else if (GetHz(HocClkModule_CPU) >= tbreakPoint || (!levelHigh)) {
*tune0_ptr = cachedTune.tune0High; // per console? *tune0_ptr = cachedTune.tune0High; // per console?
*tune1_ptr = 0xFFF7FF3F; *tune1_ptr = 0xFFF7FF3F;
return; return;
} }
} else { } 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? *tune0_ptr = cachedTune.tune0Low; // I think each erista has a different tune0/tune1?
*tune1_ptr = cachedTune.tune1Low; *tune1_ptr = cachedTune.tune1Low;
return; return;
@@ -167,7 +167,7 @@ namespace board {
}; };
*/ */
u32 CalculateTbreak(u32 table) { u32 CalculateTbreak(u32 table) {
if (GetSocType() == SysClkSocType_Erista) { if (GetSocType() == HocClkSocType_Erista) {
return 1581000000; return 1581000000;
} else { } else {
switch (table) { switch (table) {
@@ -241,7 +241,7 @@ namespace board {
rgltrCloseSession(&session); rgltrCloseSession(&session);
break; break;
case HocClkVoltage_CPU: case HocClkVoltage_CPU:
if (GetSocType() == SysClkSocType_Mariko) { if (GetSocType() == HocClkSocType_Mariko) {
rc = rgltrOpenSession(&session, PcvPowerDomainId_Max77621_Cpu); rc = rgltrOpenSession(&session, PcvPowerDomainId_Max77621_Cpu);
} else { } else {
rc = rgltrOpenSession(&session, PcvPowerDomainId_Max77812_Cpu); rc = rgltrOpenSession(&session, PcvPowerDomainId_Max77812_Cpu);
@@ -251,7 +251,7 @@ namespace board {
rgltrCloseSession(&session); rgltrCloseSession(&session);
break; break;
case HocClkVoltage_GPU: case HocClkVoltage_GPU:
if (GetSocType() == SysClkSocType_Mariko) { if (GetSocType() == HocClkSocType_Mariko) {
rc = rgltrOpenSession(&session, PcvPowerDomainId_Max77621_Gpu); rc = rgltrOpenSession(&session, PcvPowerDomainId_Max77621_Gpu);
} else { } else {
rc = rgltrOpenSession(&session, PcvPowerDomainId_Max77812_Gpu); rc = rgltrOpenSession(&session, PcvPowerDomainId_Max77812_Gpu);
@@ -261,7 +261,7 @@ namespace board {
rgltrCloseSession(&session); rgltrCloseSession(&session);
break; break;
case HocClkVoltage_EMCVDDQ: case HocClkVoltage_EMCVDDQ:
if (GetSocType() == SysClkSocType_Mariko) { if (GetSocType() == HocClkSocType_Mariko) {
rc = rgltrOpenSession(&session, PcvPowerDomainId_Max77812_Dram); rc = rgltrOpenSession(&session, PcvPowerDomainId_Max77812_Dram);
ASSERT_RESULT_OK(rc, "rgltrOpenSession") ASSERT_RESULT_OK(rc, "rgltrOpenSession")
rgltrGetVoltage(&session, &out); rgltrGetVoltage(&session, &out);

View File

@@ -26,7 +26,7 @@
#pragma once #pragma once
#include <switch.h> #include <switch.h>
#include <sysclk.h> #include <hocclk.h>
namespace board { namespace board {

View File

@@ -49,36 +49,36 @@ namespace clockManager {
bool gRunning = false; bool gRunning = false;
LockableMutex gContextMutex; LockableMutex gContextMutex;
SysClkContext gContext = {}; HocClkContext gContext = {};
FreqTable gFreqTable[SysClkModule_EnumMax]; FreqTable gFreqTable[HocClkModule_EnumMax];
std::uint64_t gLastTempLogNs = 0; std::uint64_t gLastTempLogNs = 0;
std::uint64_t gLastFreqLogNs = 0; std::uint64_t gLastFreqLogNs = 0;
std::uint64_t gLastPowerLogNs = 0; std::uint64_t gLastPowerLogNs = 0;
std::uint64_t gLastCsvWriteNs = 0; std::uint64_t gLastCsvWriteNs = 0;
bool IsAssignableHz(SysClkModule module, std::uint32_t hz) bool IsAssignableHz(HocClkModule module, std::uint32_t hz)
{ {
switch (module) { switch (module) {
case SysClkModule_CPU: case HocClkModule_CPU:
return hz >= 500000000; return hz >= 500000000;
case SysClkModule_MEM: case HocClkModule_MEM:
return hz >= 665600000; return hz >= 665600000;
default: default:
return true; return true;
} }
} }
std::uint32_t GetMaxAllowedHz(SysClkModule module, SysClkProfile profile) std::uint32_t GetMaxAllowedHz(HocClkModule module, HocClkProfile profile)
{ {
if (config::GetConfigValue(HocClkConfigValue_UncappedClocks)) { if (config::GetConfigValue(HocClkConfigValue_UncappedClocks)) {
return ~0; // Integer limit, uncapped clocks ON return ~0; // Integer limit, uncapped clocks ON
} else { } else {
if (module == SysClkModule_GPU) { if (module == HocClkModule_GPU) {
if (profile < SysClkProfile_HandheldCharging) { if (profile < HocClkProfile_HandheldCharging) {
switch (board::GetSocType()) { switch (board::GetSocType()) {
case SysClkSocType_Erista: case HocClkSocType_Erista:
return 460800000; return 460800000;
case SysClkSocType_Mariko: case HocClkSocType_Mariko:
switch (config::GetConfigValue(KipConfigValue_marikoGpuUV)) { switch (config::GetConfigValue(KipConfigValue_marikoGpuUV)) {
case 0: case 0:
return 614400000; return 614400000;
@@ -92,11 +92,11 @@ namespace clockManager {
default: default:
return 460800000; return 460800000;
} }
} else if (profile <= SysClkProfile_HandheldChargingUSB) { } else if (profile <= HocClkProfile_HandheldChargingUSB) {
switch (board::GetSocType()) { switch (board::GetSocType()) {
case SysClkSocType_Erista: case HocClkSocType_Erista:
return 768000000; return 768000000;
case SysClkSocType_Mariko: case HocClkSocType_Mariko:
switch (config::GetConfigValue(KipConfigValue_marikoGpuUV)) { switch (config::GetConfigValue(KipConfigValue_marikoGpuUV)) {
case 0: case 0:
return 844800000; return 844800000;
@@ -111,8 +111,8 @@ namespace clockManager {
return 768000000; return 768000000;
} }
} }
} else if (module == SysClkModule_CPU) { } else if (module == HocClkModule_CPU) {
if (profile < SysClkProfile_HandheldCharging && board::GetSocType() == SysClkSocType_Erista) { if (profile < HocClkProfile_HandheldCharging && board::GetSocType() == HocClkSocType_Erista) {
return 1581000000; return 1581000000;
} else { } else {
return ~0; return ~0;
@@ -122,7 +122,7 @@ namespace clockManager {
return 0; 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]; std::uint32_t *freqs = &gFreqTable[module].list[0];
size_t count = gFreqTable[module].count - 1; size_t count = gFreqTable[module].count - 1;
@@ -144,8 +144,8 @@ namespace clockManager {
void ResetToStockClocks() void ResetToStockClocks()
{ {
board::ResetToStockCpu(); board::ResetToStockCpu();
if (config::GetConfigValue(HorizonOCConfigValue_LiveCpuUv)) { if (config::GetConfigValue(HocClkConfigValue_LiveCpuUv)) {
if (board::GetSocType() == SysClkSocType_Erista) if (board::GetSocType() == HocClkSocType_Erista)
board::SetDfllTunings(config::GetConfigValue(KipConfigValue_eristaCpuUV), 0, 1581000000); board::SetDfllTunings(config::GetConfigValue(KipConfigValue_eristaCpuUV), 0, 1581000000);
else else
board::SetDfllTunings(config::GetConfigValue(KipConfigValue_marikoCpuUVLow), config::GetConfigValue(KipConfigValue_marikoCpuUVHigh), board::CalculateTbreak(config::GetConfigValue(KipConfigValue_tableConf))); board::SetDfllTunings(config::GetConfigValue(KipConfigValue_marikoCpuUVLow), config::GetConfigValue(KipConfigValue_marikoCpuUVHigh), board::CalculateTbreak(config::GetConfigValue(KipConfigValue_tableConf)));
@@ -154,7 +154,7 @@ namespace clockManager {
board::ResetToStockGpu(); 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; std::uint64_t logInterval = config::GetConfigValue(intervalMsConfigValue) * 1000000ULL;
bool shouldLog = logInterval && ((ns - *lastLogNs) > logInterval); bool shouldLog = logInterval && ((ns - *lastLogNs) > logInterval);
@@ -166,15 +166,15 @@ namespace clockManager {
return shouldLog; return shouldLog;
} }
void RefreshFreqTableRow(SysClkModule module) void RefreshFreqTableRow(HocClkModule module)
{ {
std::scoped_lock lock{gContextMutex}; 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; std::uint32_t count;
fileUtils::LogLine("[mgr] %s freq list refresh", board::GetModuleName(module, true)); 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]; std::uint32_t *hz = &gFreqTable[module].list[0];
gFreqTable[module].count = 0; gFreqTable[module].count = 0;
@@ -195,14 +195,14 @@ namespace clockManager {
void HandleSafetyFeatures() void HandleSafetyFeatures()
{ {
if (config::GetConfigValue(HocClkConfigValue_HandheldTDP) && (gContext.profile != SysClkProfile_Docked)) { if (config::GetConfigValue(HocClkConfigValue_HandheldTDP) && (gContext.profile != HocClkProfile_Docked)) {
if (board::GetConsoleType() == HorizonOCConsoleType_Hoag) { if (board::GetConsoleType() == HocClkConsoleType_Hoag) {
if (board::GetPowerMw(SysClkPowerSensor_Avg) < -(int)config::GetConfigValue(HocClkConfigValue_LiteTDPLimit)) { if (board::GetPowerMw(HocClkPowerSensor_Avg) < -(int)config::GetConfigValue(HocClkConfigValue_LiteTDPLimit)) {
ResetToStockClocks(); ResetToStockClocks();
return; return;
} }
} else { } else {
if (board::GetPowerMw(SysClkPowerSensor_Avg) < -(int)config::GetConfigValue(HocClkConfigValue_HandheldTDPLimit)) { if (board::GetPowerMw(HocClkPowerSensor_Avg) < -(int)config::GetConfigValue(HocClkConfigValue_HandheldTDPLimit)) {
ResetToStockClocks(); ResetToStockClocks();
return; return;
} }
@@ -217,14 +217,14 @@ namespace clockManager {
void HandleMiscFeatures() void HandleMiscFeatures()
{ {
if (config::GetConfigValue(HorizonOCConfigValue_BatteryChargeCurrent)) { if (config::GetConfigValue(HocClkConfigValue_BatteryChargeCurrent)) {
I2c_Bq24193_SetFastChargeCurrentLimit(config::GetConfigValue(HorizonOCConfigValue_BatteryChargeCurrent)); I2c_Bq24193_SetFastChargeCurrentLimit(config::GetConfigValue(HocClkConfigValue_BatteryChargeCurrent));
} }
} }
void DVFSBeforeSet(u32 targetHz) 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; u32 vmin = board::GetMinimumGpuVmin(targetHz / 1000000, board::GetGpuSpeedoBracket()) + dvfsOffset;
board::PcvHijackGpuVolts(vmin); board::PcvHijackGpuVolts(vmin);
@@ -239,7 +239,7 @@ namespace clockManager {
void DVFSAfterSet(u32 targetHz) void DVFSAfterSet(u32 targetHz)
{ {
s32 dvfsOffset = config::GetConfigValue(HorizonOCConfigValue_DVFSOffset); s32 dvfsOffset = config::GetConfigValue(HocClkConfigValue_DVFSOffset);
dvfsOffset = std::max(dvfsOffset, -80); dvfsOffset = std::max(dvfsOffset, -80);
u32 vmin = board::GetMinimumGpuVmin(targetHz / 1000000, board::GetGpuSpeedoBracket()); u32 vmin = board::GetMinimumGpuVmin(targetHz / 1000000, board::GetGpuSpeedoBracket());
@@ -247,22 +247,22 @@ namespace clockManager {
vmin += dvfsOffset; vmin += dvfsOffset;
} }
u32 maxHz = GetMaxAllowedHz(SysClkModule_GPU, gContext.profile); u32 maxHz = GetMaxAllowedHz(HocClkModule_GPU, gContext.profile);
u32 nearestHz = GetNearestHz(SysClkModule_GPU, targetHz, maxHz); u32 nearestHz = GetNearestHz(HocClkModule_GPU, targetHz, maxHz);
board::PcvHijackGpuVolts(vmin); board::PcvHijackGpuVolts(vmin);
if (targetHz) { if (targetHz) {
board::SetHz(SysClkModule_GPU, ~0); board::SetHz(HocClkModule_GPU, ~0);
board::SetHz(SysClkModule_GPU, nearestHz); board::SetHz(HocClkModule_GPU, nearestHz);
} else { } else {
board::SetHz(SysClkModule_GPU, ~0); board::SetHz(HocClkModule_GPU, ~0);
board::ResetToStockGpu(); board::ResetToStockGpu();
} }
} }
void HandleCpuUv() void HandleCpuUv()
{ {
if (board::GetSocType() == SysClkSocType_Erista) if (board::GetSocType() == HocClkSocType_Erista)
board::SetDfllTunings(config::GetConfigValue(KipConfigValue_eristaCpuUV), 0, 1581000000); board::SetDfllTunings(config::GetConfigValue(KipConfigValue_eristaCpuUV), 0, 1581000000);
else else
board::SetDfllTunings(config::GetConfigValue(KipConfigValue_marikoCpuUVLow), config::GetConfigValue(KipConfigValue_marikoCpuUVHigh), board::CalculateTbreak(config::GetConfigValue(KipConfigValue_tableConf))); board::SetDfllTunings(config::GetConfigValue(KipConfigValue_marikoCpuUVLow), config::GetConfigValue(KipConfigValue_marikoCpuUVHigh), board::CalculateTbreak(config::GetConfigValue(KipConfigValue_tableConf)));
@@ -270,50 +270,50 @@ namespace clockManager {
void DVFSReset() 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); board::PcvHijackGpuVolts(0);
u32 targetHz = gContext.overrideFreqs[SysClkModule_GPU]; u32 targetHz = gContext.overrideFreqs[HocClkModule_GPU];
if (!targetHz) { if (!targetHz) {
targetHz = config::GetAutoClockHz(gContext.applicationId, SysClkModule_GPU, gContext.profile, false); targetHz = config::GetAutoClockHz(gContext.applicationId, HocClkModule_GPU, gContext.profile, false);
if (!targetHz) { 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 maxHz = GetMaxAllowedHz(HocClkModule_GPU, gContext.profile);
u32 nearestHz = GetNearestHz(SysClkModule_GPU, targetHz, maxHz); u32 nearestHz = GetNearestHz(HocClkModule_GPU, targetHz, maxHz);
board::SetHz(SysClkModule_GPU, ~0); board::SetHz(HocClkModule_GPU, ~0);
if (targetHz) { if (targetHz) {
board::SetHz(SysClkModule_GPU, nearestHz); board::SetHz(HocClkModule_GPU, nearestHz);
} else { } else {
board::ResetToStockGpu(); board::ResetToStockGpu();
} }
} }
} }
void HandleFreqReset(SysClkModule module, bool isBoost) void HandleFreqReset(HocClkModule module, bool isBoost)
{ {
switch (module) { switch (module) {
case SysClkModule_CPU: case HocClkModule_CPU:
if (!(isBoost || (config::GetConfigValue(HocClkConfigValue_OverwriteBoostMode) && isBoost))) if (!(isBoost || (config::GetConfigValue(HocClkConfigValue_OverwriteBoostMode) && isBoost)))
board::ResetToStockCpu(); board::ResetToStockCpu();
if (config::GetConfigValue(HorizonOCConfigValue_LiveCpuUv)) { if (config::GetConfigValue(HocClkConfigValue_LiveCpuUv)) {
if (board::GetSocType() == SysClkSocType_Erista) if (board::GetSocType() == HocClkSocType_Erista)
board::SetDfllTunings(config::GetConfigValue(KipConfigValue_eristaCpuUV), 0, 1581000000); board::SetDfllTunings(config::GetConfigValue(KipConfigValue_eristaCpuUV), 0, 1581000000);
else else
board::SetDfllTunings(config::GetConfigValue(KipConfigValue_marikoCpuUVLow), config::GetConfigValue(KipConfigValue_marikoCpuUVHigh), board::CalculateTbreak(config::GetConfigValue(KipConfigValue_tableConf))); board::SetDfllTunings(config::GetConfigValue(KipConfigValue_marikoCpuUVLow), config::GetConfigValue(KipConfigValue_marikoCpuUVHigh), board::CalculateTbreak(config::GetConfigValue(KipConfigValue_tableConf)));
} }
break; break;
case SysClkModule_GPU: case HocClkModule_GPU:
board::ResetToStockGpu(); board::ResetToStockGpu();
break; break;
case SysClkModule_MEM: case HocClkModule_MEM:
board::ResetToStockMem(); board::ResetToStockMem();
DVFSReset(); DVFSReset();
break; break;
case HorizonOCModule_Display: case HocClkModule_Display:
if (config::GetConfigValue(HorizonOCConfigValue_OverwriteRefreshRate)) { if (config::GetConfigValue(HocClkConfigValue_OverwriteRefreshRate)) {
board::ResetToStockDisplay(); board::ResetToStockDisplay();
} }
break; break;
@@ -329,87 +329,87 @@ namespace clockManager {
std::uint32_t nearestHz = 0; std::uint32_t nearestHz = 0;
if (isBoost && !config::GetConfigValue(HocClkConfigValue_OverwriteBoostMode)) { if (isBoost && !config::GetConfigValue(HocClkConfigValue_OverwriteBoostMode)) {
u32 boostFreq = board::GetHz(SysClkModule_CPU); u32 boostFreq = board::GetHz(HocClkModule_CPU);
if (boostFreq / 1000000 > 1785) { if (boostFreq / 1000000 > 1785) {
board::SetHz(SysClkModule_CPU, boostFreq); board::SetHz(HocClkModule_CPU, boostFreq);
} }
return; // Return if we aren't overwriting boost mode return; // Return if we aren't overwriting boost mode
} }
bool returnRaw = false; // Return a value scaled to MHz instead of raw value bool returnRaw = false; // Return a value scaled to MHz instead of raw value
for (unsigned int module = 0; module < SysClkModule_EnumMax; module++) { for (unsigned int module = 0; module < HocClkModule_EnumMax; module++) {
u32 oldHz = board::GetHz((SysClkModule)module); // Get Old hz (used primarily for DVFS Logic) u32 oldHz = board::GetHz((HocClkModule)module); // Get Old hz (used primarily for DVFS Logic)
if (module > SysClkModule_MEM) if (module > HocClkModule_MEM)
returnRaw = true; returnRaw = true;
else else
returnRaw = false; returnRaw = false;
targetHz = gContext.overrideFreqs[module]; targetHz = gContext.overrideFreqs[module];
if (!targetHz) { if (!targetHz) {
targetHz = config::GetAutoClockHz(gContext.applicationId, (SysClkModule)module, gContext.profile, returnRaw); targetHz = config::GetAutoClockHz(gContext.applicationId, (HocClkModule)module, gContext.profile, returnRaw);
if (!targetHz) 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); governor::HandleGovernor(targetHz);
} }
bool noCPU = governor::isCpuGovernorEnabled; bool noCPU = governor::isCpuGovernorEnabled;
bool noGPU = governor::isGpuGovernorEnabled; bool noGPU = governor::isGpuGovernorEnabled;
bool noDisp = governor::isVRREnabled; bool noDisp = governor::isVRREnabled;
if (noDisp && module == HorizonOCModule_Display) if (noDisp && module == HocClkModule_Display)
continue; continue;
if (module == HorizonOCModule_Display && config::GetConfigValue(HorizonOCConfigValue_OverwriteRefreshRate) && !noDisp) { if (module == HocClkModule_Display && config::GetConfigValue(HocClkConfigValue_OverwriteRefreshRate) && !noDisp) {
if (targetHz) { if (targetHz) {
board::SetHz(HorizonOCModule_Display, targetHz); board::SetHz(HocClkModule_Display, targetHz);
gContext.freqs[HorizonOCModule_Display] = targetHz; gContext.freqs[HocClkModule_Display] = targetHz;
gContext.realFreqs[HorizonOCModule_Display] = targetHz; gContext.realFreqs[HocClkModule_Display] = targetHz;
} else { } else {
HandleFreqReset(HorizonOCModule_Display, isBoost); HandleFreqReset(HocClkModule_Display, isBoost);
} }
} }
// Skip GPU and CPU if governors handle them // Skip GPU and CPU if governors handle them
if (module > SysClkModule_MEM) { if (module > HocClkModule_MEM) {
continue; continue;
} }
if (noCPU && module == SysClkModule_CPU) if (noCPU && module == HocClkModule_CPU)
continue; continue;
if (noGPU && module == SysClkModule_GPU) if (noGPU && module == HocClkModule_GPU)
continue; continue;
if (targetHz) { if (targetHz) {
maxHz = GetMaxAllowedHz((SysClkModule)module, gContext.profile); maxHz = GetMaxAllowedHz((HocClkModule)module, gContext.profile);
nearestHz = GetNearestHz((SysClkModule)module, targetHz, maxHz); nearestHz = GetNearestHz((HocClkModule)module, targetHz, maxHz);
if (nearestHz != gContext.freqs[module]) { if (nearestHz != gContext.freqs[module]) {
fileUtils::LogLine( fileUtils::LogLine(
"[mgr] %s clock set : %u.%u MHz (target = %u.%u MHz)", "[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, nearestHz / 1000000, nearestHz / 100000 - nearestHz / 1000000 * 10,
targetHz / 1000000, targetHz / 100000 - targetHz / 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); DVFSBeforeSet(targetHz);
} }
board::SetHz((SysClkModule)module, nearestHz); board::SetHz((HocClkModule)module, nearestHz);
gContext.freqs[module] = nearestHz; gContext.freqs[module] = nearestHz;
if (module == SysClkModule_CPU && config::GetConfigValue(HorizonOCConfigValue_LiveCpuUv)) { if (module == HocClkModule_CPU && config::GetConfigValue(HocClkConfigValue_LiveCpuUv)) {
HandleCpuUv(); 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); DVFSAfterSet(targetHz);
} }
} }
} else { } else {
HandleFreqReset((SysClkModule)module, isBoost); HandleFreqReset((HocClkModule)module, isBoost);
} }
} }
} }
@@ -429,7 +429,7 @@ namespace clockManager {
hasChanged = true; hasChanged = true;
} }
SysClkProfile profile = board::GetProfile(); HocClkProfile profile = board::GetProfile();
if (profile != gContext.profile) { if (profile != gContext.profile) {
fileUtils::LogLine("[mgr] Profile change: %s", board::GetProfileName(profile, true)); fileUtils::LogLine("[mgr] Profile change: %s", board::GetProfileName(profile, true));
gContext.profile = profile; gContext.profile = profile;
@@ -439,27 +439,27 @@ namespace clockManager {
// restore clocks to stock values on app or profile change // restore clocks to stock values on app or profile change
if (hasChanged) { if (hasChanged) {
board::ResetToStock(); 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::PcvHijackGpuVolts(0);
board::SetHz(SysClkModule_GPU, ~0); board::SetHz(HocClkModule_GPU, ~0);
board::ResetToStockGpu(); board::ResetToStockGpu();
} }
WaitForNextTick(); WaitForNextTick();
} }
std::uint32_t hz = 0; std::uint32_t hz = 0;
for (unsigned int module = 0; module < SysClkModule_EnumMax; module++) { for (unsigned int module = 0; module < HocClkModule_EnumMax; module++) {
hz = board::GetHz((SysClkModule)module); hz = board::GetHz((HocClkModule)module);
if (hz != 0 && hz != gContext.freqs[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; gContext.freqs[module] = hz;
hasChanged = true; hasChanged = true;
} }
hz = config::GetOverrideHz((SysClkModule)module); hz = config::GetOverrideHz((HocClkModule)module);
if (hz != gContext.overrideFreqs[module]) { if (hz != gContext.overrideFreqs[module]) {
if (hz) { 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; gContext.overrideFreqs[module] = hz;
hasChanged = true; hasChanged = true;
@@ -470,60 +470,60 @@ namespace clockManager {
// temperatures do not and should not force a refresh, hasChanged untouched // temperatures do not and should not force a refresh, hasChanged untouched
std::uint32_t millis = 0; std::uint32_t millis = 0;
bool shouldLogTemp = ConfigIntervalTimeout(SysClkConfigValue_TempLogIntervalMs, ns, &gLastTempLogNs); bool shouldLogTemp = ConfigIntervalTimeout(HocClkConfigValue_TempLogIntervalMs, ns, &gLastTempLogNs);
for (unsigned int sensor = 0; sensor < SysClkThermalSensor_EnumMax; sensor++) { for (unsigned int sensor = 0; sensor < HocClkThermalSensor_EnumMax; sensor++) {
millis = board::GetTemperatureMilli((SysClkThermalSensor)sensor); millis = board::GetTemperatureMilli((HocClkThermalSensor)sensor);
if (shouldLogTemp) { 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; gContext.temps[sensor] = millis;
} }
// power stats do not and should not force a refresh, hasChanged untouched // power stats do not and should not force a refresh, hasChanged untouched
std::int32_t mw = 0; std::int32_t mw = 0;
bool shouldLogPower = ConfigIntervalTimeout(SysClkConfigValue_PowerLogIntervalMs, ns, &gLastPowerLogNs); bool shouldLogPower = ConfigIntervalTimeout(HocClkConfigValue_PowerLogIntervalMs, ns, &gLastPowerLogNs);
for (unsigned int sensor = 0; sensor < SysClkPowerSensor_EnumMax; sensor++) { for (unsigned int sensor = 0; sensor < HocClkPowerSensor_EnumMax; sensor++) {
mw = board::GetPowerMw((SysClkPowerSensor)sensor); mw = board::GetPowerMw((HocClkPowerSensor)sensor);
if (shouldLogPower) { 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; gContext.power[sensor] = mw;
} }
// real freqs do not and should not force a refresh, hasChanged untouched // real freqs do not and should not force a refresh, hasChanged untouched
std::uint32_t realHz = 0; std::uint32_t realHz = 0;
bool shouldLogFreq = ConfigIntervalTimeout(SysClkConfigValue_FreqLogIntervalMs, ns, &gLastFreqLogNs); bool shouldLogFreq = ConfigIntervalTimeout(HocClkConfigValue_FreqLogIntervalMs, ns, &gLastFreqLogNs);
for (unsigned int module = 0; module < SysClkModule_EnumMax; module++) { for (unsigned int module = 0; module < HocClkModule_EnumMax; module++) {
realHz = board::GetRealHz((SysClkModule)module); realHz = board::GetRealHz((HocClkModule)module);
if (shouldLogFreq) { 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; gContext.realFreqs[module] = realHz;
} }
// ram load do not and should not force a refresh, hasChanged untouched // ram load do not and should not force a refresh, hasChanged untouched
for (unsigned int loadSource = 0; loadSource < SysClkPartLoad_EnumMax; loadSource++) { for (unsigned int loadSource = 0; loadSource < HocClkPartLoad_EnumMax; loadSource++) {
gContext.partLoad[loadSource] = board::GetPartLoad((SysClkPartLoad)loadSource); gContext.partLoad[loadSource] = board::GetPartLoad((HocClkPartLoad)loadSource);
} }
for (unsigned int voltageSource = 0; voltageSource < HocClkVoltage_EnumMax; voltageSource++) { for (unsigned int voltageSource = 0; voltageSource < HocClkVoltage_EnumMax; voltageSource++) {
gContext.voltages[voltageSource] = board::GetVoltage((HocClkVoltage)voltageSource); gContext.voltages[voltageSource] = board::GetVoltage((HocClkVoltage)voltageSource);
} }
if (ConfigIntervalTimeout(SysClkConfigValue_CsvWriteIntervalMs, ns, &gLastCsvWriteNs)) { if (ConfigIntervalTimeout(HocClkConfigValue_CsvWriteIntervalMs, ns, &gLastCsvWriteNs)) {
fileUtils::WriteContextToCsv(&gContext); fileUtils::WriteContextToCsv(&gContext);
} }
// this->context->maxDisplayFreq = board::GetHighestDockedDisplayRate(); // this->context->maxDisplayFreq = board::GetHighestDockedDisplayRate();
u32 targetHz = gContext.overrideFreqs[HorizonOCModule_Display]; u32 targetHz = gContext.overrideFreqs[HocClkModule_Display];
if (!targetHz) { if (!targetHz) {
targetHz = config::GetAutoClockHz(gContext.applicationId, HorizonOCModule_Display, gContext.profile, true); targetHz = config::GetAutoClockHz(gContext.applicationId, HocClkModule_Display, gContext.profile, true);
if (!targetHz) 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) if (board::GetConsoleType() != HocClkConsoleType_Hoag)
board::SetDisplayRefreshDockedState(gContext.profile == SysClkProfile_Docked); board::SetDisplayRefreshDockedState(gContext.profile == HocClkProfile_Docked);
if (gContext.isSaltyNXInstalled) if (gContext.isSaltyNXInstalled)
gContext.fps = integrations::GetSaltyNXFPS(); gContext.fps = integrations::GetSaltyNXFPS();
@@ -544,12 +544,12 @@ namespace clockManager {
gContext = {}; gContext = {};
gContext.applicationId = 0; gContext.applicationId = 0;
gContext.profile = SysClkProfile_Handheld; gContext.profile = HocClkProfile_Handheld;
for (unsigned int module = 0; module < SysClkModule_EnumMax; module++) { for (unsigned int module = 0; module < HocClkModule_EnumMax; module++) {
gContext.freqs[module] = 0; gContext.freqs[module] = 0;
gContext.realFreqs[module] = 0; gContext.realFreqs[module] = 0;
gContext.overrideFreqs[module] = 0; gContext.overrideFreqs[module] = 0;
RefreshFreqTableRow((SysClkModule)module); RefreshFreqTableRow((HocClkModule)module);
} }
gRunning = false; gRunning = false;
@@ -571,8 +571,8 @@ namespace clockManager {
gContext.dramID = board::GetDramID(); gContext.dramID = board::GetDramID();
gContext.isDram8GB = board::IsDram8GB(); gContext.isDram8GB = board::IsDram8GB();
board::SetGpuSchedulingMode((GpuSchedulingMode)config::GetConfigValue(HorizonOCConfigValue_GPUScheduling), (GpuSchedulingOverrideMethod)config::GetConfigValue(HorizonOCConfigValue_GPUSchedulingMethod)); board::SetGpuSchedulingMode((GpuSchedulingMode)config::GetConfigValue(HocClkConfigValue_GPUScheduling), (GpuSchedulingOverrideMethod)config::GetConfigValue(HocClkConfigValue_GPUSchedulingMethod));
gContext.gpuSchedulingMode = (GpuSchedulingMode)config::GetConfigValue(HorizonOCConfigValue_GPUScheduling); gContext.gpuSchedulingMode = (GpuSchedulingMode)config::GetConfigValue(HocClkConfigValue_GPUScheduling);
gContext.isSysDockInstalled = integrations::GetSysDockState(); gContext.isSysDockInstalled = integrations::GetSysDockState();
gContext.isSaltyNXInstalled = integrations::GetSaltyNXState(); gContext.isSaltyNXInstalled = integrations::GetSaltyNXState();
@@ -590,7 +590,7 @@ namespace clockManager {
config::Exit(); config::Exit();
} }
SysClkContext GetCurrentContext() HocClkContext GetCurrentContext()
{ {
std::scoped_lock lock{gContextMutex}; std::scoped_lock lock{gContextMutex};
return gContext; return gContext;
@@ -606,9 +606,9 @@ namespace clockManager {
return gRunning; 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); *outCount = std::min(maxCount, gFreqTable[module].count);
memcpy(list, &gFreqTable[module].list[0], *outCount * sizeof(gFreqTable[0].list[0])); memcpy(list, &gFreqTable[module].list[0], *outCount * sizeof(gFreqTable[0].list[0]));
@@ -616,7 +616,7 @@ namespace clockManager {
void Tick() 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::scoped_lock lock{gContextMutex};
std::uint32_t mode = 0; std::uint32_t mode = 0;
Result rc = apmExtGetCurrentPerformanceConfiguration(&mode); Result rc = apmExtGetCurrentPerformanceConfiguration(&mode);
@@ -634,8 +634,8 @@ namespace clockManager {
void WaitForNextTick() void WaitForNextTick()
{ {
if (board::GetHz(SysClkModule_MEM) > 665000000) if (board::GetHz(HocClkModule_MEM) > 665000000)
svcSleepThread(config::GetConfigValue(SysClkConfigValue_PollingIntervalMs) * 1000000ULL); svcSleepThread(config::GetConfigValue(HocClkConfigValue_PollingIntervalMs) * 1000000ULL);
else else
svcSleepThread(5000 * 1000000ULL); // 5 seconds in sleep mode svcSleepThread(5000 * 1000000ULL); // 5 seconds in sleep mode
} }

View File

@@ -26,7 +26,7 @@
#pragma once #pragma once
#include <sysclk.h> #include <hocclk.h>
#include <switch.h> #include <switch.h>
#include <nxExt/cpp/lockable_mutex.h> #include <nxExt/cpp/lockable_mutex.h>
@@ -34,7 +34,7 @@ namespace clockManager {
struct FreqTable { struct FreqTable {
std::uint32_t count; 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 // instance variables
extern bool gRunning; extern bool gRunning;
extern LockableMutex gContextMutex; extern LockableMutex gContextMutex;
extern SysClkContext gContext; extern HocClkContext gContext;
extern FreqTable gFreqTable[SysClkModule_EnumMax]; extern FreqTable gFreqTable[HocClkModule_EnumMax];
extern std::uint64_t gLastTempLogNs; extern std::uint64_t gLastTempLogNs;
extern std::uint64_t gLastFreqLogNs; extern std::uint64_t gLastFreqLogNs;
extern std::uint64_t gLastPowerLogNs; extern std::uint64_t gLastPowerLogNs;
@@ -54,15 +54,15 @@ namespace clockManager {
void Initialize(); void Initialize();
void Exit(); void Exit();
SysClkContext GetCurrentContext(); HocClkContext GetCurrentContext();
void SetRunning(bool running); void SetRunning(bool running);
bool Running(); bool Running();
std::uint32_t GetMaxAllowedHz(SysClkModule module, SysClkProfile profile); std::uint32_t GetMaxAllowedHz(HocClkModule module, HocClkProfile profile);
bool IsAssignableHz(SysClkModule module, std::uint32_t hz); 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 Tick();
void WaitForNextTick(); void WaitForNextTick();

View File

@@ -44,7 +44,7 @@
namespace config { namespace config {
uint64_t configValues[SysClkConfigValue_EnumMax]; uint64_t configValues[HocClkConfigValue_EnumMax];
namespace { namespace {
@@ -52,8 +52,8 @@ namespace config {
std::string gPath; std::string gPath;
time_t gMtime = 0; time_t gMtime = 0;
std::atomic_bool gEnabled{false}; std::atomic_bool gEnabled{false};
std::uint32_t gOverrideFreqs[SysClkModule_EnumMax]; std::uint32_t gOverrideFreqs[HocClkModule_EnumMax];
std::map<std::tuple<std::uint64_t, SysClkProfile, SysClkModule>, std::uint32_t> gProfileMHzMap; std::map<std::tuple<std::uint64_t, HocClkProfile, HocClkModule>, std::uint32_t> gProfileMHzMap;
std::map<std::uint64_t, std::uint8_t> gProfileCountMap; std::map<std::uint64_t, std::uint8_t> gProfileCountMap;
LockableMutex gConfigMutex; LockableMutex gConfigMutex;
LockableMutex gOverrideMutex; LockableMutex gOverrideMutex;
@@ -67,7 +67,7 @@ namespace config {
return mtime; 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) { if (gLoaded) {
auto it = gProfileMHzMap.find(std::make_tuple(tid, profile, module)); auto it = gProfileMHzMap.find(std::make_tuple(tid, profile, module));
if (it != gProfileMHzMap.end()) { if (it != gProfileMHzMap.end()) {
@@ -77,7 +77,7 @@ namespace config {
return 0; 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; std::uint32_t mhz = 0;
if (gLoaded) { if (gLoaded) {
@@ -96,11 +96,11 @@ namespace config {
(void)userdata; (void)userdata;
std::uint64_t input; std::uint64_t input;
if (!strcmp(section, CONFIG_VAL_SECTION)) { if (!strcmp(section, CONFIG_VAL_SECTION)) {
for (unsigned int kval = 0; kval < SysClkConfigValue_EnumMax; kval++) { for (unsigned int kval = 0; kval < HocClkConfigValue_EnumMax; kval++) {
if (!strcmp(key, sysclkFormatConfigValue((SysClkConfigValue)kval, false))) { if (!strcmp(key, hocclkFormatConfigValue((HocClkConfigValue)kval, false))) {
input = strtoul(value, NULL, 0); input = strtoul(value, NULL, 0);
if (!sysclkValidConfigValue((SysClkConfigValue)kval, input)) { if (!hocclkValidConfigValue((HocClkConfigValue)kval, input)) {
input = sysclkDefaultConfigValue((SysClkConfigValue)kval); input = hocclkDefaultConfigValue((HocClkConfigValue)kval);
fileUtils::LogLine("[cfg] Invalid value for key '%s' in section '%s': using default %d", key, section, input); fileUtils::LogLine("[cfg] Invalid value for key '%s' in section '%s': using default %d", key, section, input);
} }
configValues[kval] = input; configValues[kval] = input;
@@ -119,28 +119,28 @@ namespace config {
return 1; return 1;
} }
SysClkProfile parsedProfile = SysClkProfile_EnumMax; HocClkProfile parsedProfile = HocClkProfile_EnumMax;
SysClkModule parsedModule = SysClkModule_EnumMax; HocClkModule parsedModule = HocClkModule_EnumMax;
for (unsigned int profile = 0; profile < SysClkProfile_EnumMax; profile++) { for (unsigned int profile = 0; profile < HocClkProfile_EnumMax; profile++) {
const char* profileCode = board::GetProfileName((SysClkProfile)profile, false); const char* profileCode = board::GetProfileName((HocClkProfile)profile, false);
size_t profileCodeLen = strlen(profileCode); size_t profileCodeLen = strlen(profileCode);
if (!strncmp(key, profileCode, profileCodeLen) && key[profileCodeLen] == '_') { if (!strncmp(key, profileCode, profileCodeLen) && key[profileCodeLen] == '_') {
const char* subkey = key + profileCodeLen + 1; const char* subkey = key + profileCodeLen + 1;
for (unsigned int module = 0; module < SysClkModule_EnumMax; module++) { for (unsigned int module = 0; module < HocClkModule_EnumMax; module++) {
const char* moduleCode = board::GetModuleName((SysClkModule)module, false); const char* moduleCode = board::GetModuleName((HocClkModule)module, false);
size_t moduleCodeLen = strlen(moduleCode); size_t moduleCodeLen = strlen(moduleCode);
if (!strncmp(subkey, moduleCode, moduleCodeLen) && subkey[moduleCodeLen] == '\0') { if (!strncmp(subkey, moduleCode, moduleCodeLen) && subkey[moduleCodeLen] == '\0') {
parsedProfile = (SysClkProfile)profile; parsedProfile = (HocClkProfile)profile;
parsedModule = (SysClkModule)module; 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); fileUtils::LogLine("[cfg] Skipping key '%s' in section '%s': Unrecognized key", key, section);
return 1; return 1;
} }
@@ -166,8 +166,8 @@ namespace config {
gLoaded = false; gLoaded = false;
gProfileMHzMap.clear(); gProfileMHzMap.clear();
gProfileCountMap.clear(); gProfileCountMap.clear();
for (unsigned int i = 0; i < SysClkConfigValue_EnumMax; i++) { for (unsigned int i = 0; i < HocClkConfigValue_EnumMax; i++) {
configValues[i] = sysclkDefaultConfigValue((SysClkConfigValue)i); configValues[i] = hocclkDefaultConfigValue((HocClkConfigValue)i);
} }
} }
@@ -194,11 +194,11 @@ namespace config {
gProfileCountMap.clear(); gProfileCountMap.clear();
gMtime = 0; gMtime = 0;
gEnabled = false; gEnabled = false;
for (unsigned int i = 0; i < SysClkModule_EnumMax; i++) { for (unsigned int i = 0; i < HocClkModule_EnumMax; i++) {
gOverrideFreqs[i] = 0; gOverrideFreqs[i] = 0;
} }
for (unsigned int i = 0; i < SysClkConfigValue_EnumMax; i++) { for (unsigned int i = 0; i < HocClkConfigValue_EnumMax; i++) {
configValues[i] = sysclkDefaultConfigValue((SysClkConfigValue)i); configValues[i] = hocclkDefaultConfigValue((HocClkConfigValue)i);
} }
} }
@@ -221,34 +221,34 @@ namespace config {
return gLoaded; 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}; std::scoped_lock lock{gConfigMutex};
switch (profile) { switch (profile) {
case SysClkProfile_Handheld: case HocClkProfile_Handheld:
return FindClockHzFromProfiles(tid, module, {SysClkProfile_Handheld}, returnRaw ? 1 : 1000000); return FindClockHzFromProfiles(tid, module, {HocClkProfile_Handheld}, returnRaw ? 1 : 1000000);
case SysClkProfile_HandheldCharging: case HocClkProfile_HandheldCharging:
case SysClkProfile_HandheldChargingUSB: case HocClkProfile_HandheldChargingUSB:
return FindClockHzFromProfiles(tid, module, {SysClkProfile_HandheldChargingUSB, SysClkProfile_HandheldCharging, SysClkProfile_Handheld}, returnRaw ? 1 : 1000000); return FindClockHzFromProfiles(tid, module, {HocClkProfile_HandheldChargingUSB, HocClkProfile_HandheldCharging, HocClkProfile_Handheld}, returnRaw ? 1 : 1000000);
case SysClkProfile_HandheldChargingOfficial: case HocClkProfile_HandheldChargingOfficial:
return FindClockHzFromProfiles(tid, module, {SysClkProfile_HandheldChargingOfficial, SysClkProfile_HandheldCharging, SysClkProfile_Handheld}, returnRaw ? 1 : 1000000); return FindClockHzFromProfiles(tid, module, {HocClkProfile_HandheldChargingOfficial, HocClkProfile_HandheldCharging, HocClkProfile_Handheld}, returnRaw ? 1 : 1000000);
case SysClkProfile_Docked: case HocClkProfile_Docked:
return FindClockHzFromProfiles(tid, module, {SysClkProfile_Docked}, returnRaw ? 1 : 1000000); return FindClockHzFromProfiles(tid, module, {HocClkProfile_Docked}, returnRaw ? 1 : 1000000);
default: default:
ERROR_THROW("Unhandled SysClkProfile: %u", profile); ERROR_THROW("Unhandled HocClkProfile: %u", profile);
} }
return 0; 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}; std::scoped_lock lock{gConfigMutex};
for (unsigned int profile = 0; profile < SysClkProfile_EnumMax; profile++) { for (unsigned int profile = 0; profile < HocClkProfile_EnumMax; profile++) {
for (unsigned int module = 0; module < SysClkModule_EnumMax; module++) { for (unsigned int module = 0; module < HocClkModule_EnumMax; module++) {
out_profiles->mhzMap[profile][module] = FindClockMHz(tid, (SysClkModule)module, (SysClkProfile)profile); 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}; std::scoped_lock lock{gConfigMutex};
uint8_t numProfiles = 0; uint8_t numProfiles = 0;
@@ -257,19 +257,19 @@ namespace config {
std::vector<std::string> keys; std::vector<std::string> keys;
std::vector<std::string> values; std::vector<std::string> values;
keys.reserve(SysClkProfile_EnumMax * SysClkModule_EnumMax); keys.reserve(HocClkProfile_EnumMax * HocClkModule_EnumMax);
values.reserve(SysClkProfile_EnumMax * SysClkModule_EnumMax); values.reserve(HocClkProfile_EnumMax * HocClkModule_EnumMax);
std::uint32_t* mhz = &profiles->mhz[0]; std::uint32_t* mhz = &profiles->mhz[0];
for (unsigned int profile = 0; profile < SysClkProfile_EnumMax; profile++) { for (unsigned int profile = 0; profile < HocClkProfile_EnumMax; profile++) {
for (unsigned int module = 0; module < SysClkModule_EnumMax; module++) { for (unsigned int module = 0; module < HocClkModule_EnumMax; module++) {
if (*mhz) { if (*mhz) {
numProfiles++; 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); std::string value = std::to_string(*mhz);
keys.push_back(key); keys.push_back(key);
@@ -298,12 +298,12 @@ namespace config {
if (immediate) { if (immediate) {
mhz = &profiles->mhz[0]; mhz = &profiles->mhz[0];
gProfileCountMap[tid] = numProfiles; gProfileCountMap[tid] = numProfiles;
for (unsigned int profile = 0; profile < SysClkProfile_EnumMax; profile++) { for (unsigned int profile = 0; profile < HocClkProfile_EnumMax; profile++) {
for (unsigned int module = 0; module < SysClkModule_EnumMax; module++) { for (unsigned int module = 0; module < HocClkModule_EnumMax; module++) {
if (*mhz) { if (*mhz) {
gProfileMHzMap[std::make_tuple(tid, (SysClkProfile)profile, (SysClkModule)module)] = *mhz; gProfileMHzMap[std::make_tuple(tid, (HocClkProfile)profile, (HocClkModule)module)] = *mhz;
} else { } else {
gProfileMHzMap.erase(std::make_tuple(tid, (SysClkProfile)profile, (SysClkModule)module)); gProfileMHzMap.erase(std::make_tuple(tid, (HocClkProfile)profile, (HocClkModule)module));
} }
mhz++; mhz++;
} }
@@ -329,51 +329,51 @@ namespace config {
return gEnabled; return gEnabled;
} }
void SetOverrideHz(SysClkModule module, std::uint32_t hz) { void SetOverrideHz(HocClkModule module, std::uint32_t hz) {
ASSERT_ENUM_VALID(SysClkModule, module); ASSERT_ENUM_VALID(HocClkModule, module);
std::scoped_lock lock{gOverrideMutex}; std::scoped_lock lock{gOverrideMutex};
gOverrideFreqs[module] = hz; gOverrideFreqs[module] = hz;
} }
std::uint32_t GetOverrideHz(SysClkModule module) { std::uint32_t GetOverrideHz(HocClkModule module) {
ASSERT_ENUM_VALID(SysClkModule, module); ASSERT_ENUM_VALID(HocClkModule, module);
std::scoped_lock lock{gOverrideMutex}; std::scoped_lock lock{gOverrideMutex};
return gOverrideFreqs[module]; return gOverrideFreqs[module];
} }
std::uint64_t GetConfigValue(SysClkConfigValue kval) { std::uint64_t GetConfigValue(HocClkConfigValue kval) {
ASSERT_ENUM_VALID(SysClkConfigValue, kval); ASSERT_ENUM_VALID(HocClkConfigValue, kval);
std::scoped_lock lock{gConfigMutex}; std::scoped_lock lock{gConfigMutex};
return configValues[kval]; return configValues[kval];
} }
const char* GetConfigValueName(SysClkConfigValue kval, bool pretty) { const char* GetConfigValueName(HocClkConfigValue kval, bool pretty) {
ASSERT_ENUM_VALID(SysClkConfigValue, kval); ASSERT_ENUM_VALID(HocClkConfigValue, kval);
return sysclkFormatConfigValue(kval, pretty); return hocclkFormatConfigValue(kval, pretty);
} }
void GetConfigValues(SysClkConfigValueList* out_configValues) { void GetConfigValues(HocClkConfigValueList* out_configValues) {
std::scoped_lock lock{gConfigMutex}; 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]; out_configValues->values[kval] = configValues[kval];
} }
} }
bool SetConfigValues(SysClkConfigValueList* configValues, bool immediate) { bool SetConfigValues(HocClkConfigValueList* configValues, bool immediate) {
std::scoped_lock lock{gConfigMutex}; std::scoped_lock lock{gConfigMutex};
std::vector<const char*> iniKeys; std::vector<const char*> iniKeys;
std::vector<std::string> iniValues; std::vector<std::string> iniValues;
iniKeys.reserve(SysClkConfigValue_EnumMax + 1); iniKeys.reserve(HocClkConfigValue_EnumMax + 1);
iniValues.reserve(SysClkConfigValue_EnumMax); iniValues.reserve(HocClkConfigValue_EnumMax);
for (unsigned int kval = 0; kval < SysClkConfigValue_EnumMax; kval++) { for (unsigned int kval = 0; kval < HocClkConfigValue_EnumMax; kval++) {
if (!sysclkValidConfigValue((SysClkConfigValue)kval, configValues->values[kval]) || if (!hocclkValidConfigValue((HocClkConfigValue)kval, configValues->values[kval]) ||
configValues->values[kval] == sysclkDefaultConfigValue((SysClkConfigValue)kval)) { configValues->values[kval] == hocclkDefaultConfigValue((HocClkConfigValue)kval)) {
continue; continue;
} }
iniValues.push_back(std::to_string(configValues->values[kval])); 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); iniKeys.push_back(NULL);
@@ -390,11 +390,11 @@ namespace config {
} }
if (immediate) { if (immediate) {
for (unsigned int kval = 0; kval < SysClkConfigValue_EnumMax; kval++) { for (unsigned int kval = 0; kval < HocClkConfigValue_EnumMax; kval++) {
if (sysclkValidConfigValue((SysClkConfigValue)kval, configValues->values[kval])) { if (hocclkValidConfigValue((HocClkConfigValue)kval, configValues->values[kval])) {
config::configValues[kval] = configValues->values[kval]; config::configValues[kval] = configValues->values[kval];
} else { } else {
config::configValues[kval] = sysclkDefaultConfigValue((SysClkConfigValue)kval); config::configValues[kval] = hocclkDefaultConfigValue((HocClkConfigValue)kval);
} }
} }
} }
@@ -402,22 +402,22 @@ namespace config {
return true; return true;
} }
bool ResetConfigValue(SysClkConfigValue kval) { bool ResetConfigValue(HocClkConfigValue kval) {
if (!SYSCLK_ENUM_VALID(SysClkConfigValue, kval)) { if (!HOCCLK_ENUM_VALID(HocClkConfigValue, kval)) {
fileUtils::LogLine("[cfg] Invalid SysClkConfigValue: %u", kval); fileUtils::LogLine("[cfg] Invalid HocClkConfigValue: %u", kval);
return false; return false;
} }
std::scoped_lock lock{gConfigMutex}; std::scoped_lock lock{gConfigMutex};
std::uint64_t defaultValue = sysclkDefaultConfigValue(kval); std::uint64_t defaultValue = hocclkDefaultConfigValue(kval);
std::vector<const char*> iniKeys; std::vector<const char*> iniKeys;
std::vector<std::string> iniValues; std::vector<std::string> iniValues;
iniKeys.reserve(2); iniKeys.reserve(2);
iniValues.reserve(1); iniValues.reserve(1);
iniKeys.push_back(sysclkFormatConfigValue(kval, false)); iniKeys.push_back(hocclkFormatConfigValue(kval, false));
iniValues.push_back(""); iniValues.push_back("");
iniKeys.push_back(NULL); iniKeys.push_back(NULL);
@@ -439,11 +439,11 @@ namespace config {
return true; return true;
} }
bool SetConfigValue(SysClkConfigValue kval, std::uint64_t value, bool immediate) { bool SetConfigValue(HocClkConfigValue kval, std::uint64_t value, bool immediate) {
if (!SYSCLK_ENUM_VALID(SysClkConfigValue, kval)) { if (!HOCCLK_ENUM_VALID(HocClkConfigValue, kval)) {
return false; return false;
} }
if (!sysclkValidConfigValue(kval, value)) { if (!hocclkValidConfigValue(kval, value)) {
return false; return false;
} }
@@ -454,7 +454,7 @@ namespace config {
iniKeys.reserve(2); iniKeys.reserve(2);
iniValues.reserve(1); iniValues.reserve(1);
iniKeys.push_back(sysclkFormatConfigValue(kval, false)); iniKeys.push_back(hocclkFormatConfigValue(kval, false));
iniValues.push_back(std::to_string(value)); iniValues.push_back(std::to_string(value));
iniKeys.push_back(NULL); iniKeys.push_back(NULL);

View File

@@ -26,7 +26,7 @@
#pragma once #pragma once
#include <sysclk.h> #include <hocclk.h>
#include <switch.h> #include <switch.h>
#define CONFIG_VAL_SECTION "values" #define CONFIG_VAL_SECTION "values"
@@ -40,22 +40,22 @@ namespace config {
bool HasProfilesLoaded(); bool HasProfilesLoaded();
std::uint8_t GetProfileCount(std::uint64_t tid); std::uint8_t GetProfileCount(std::uint64_t tid);
void GetProfiles(std::uint64_t tid, SysClkTitleProfileList* out_profiles); void GetProfiles(std::uint64_t tid, HocClkTitleProfileList* out_profiles);
bool SetProfiles(std::uint64_t tid, SysClkTitleProfileList* profiles, bool immediate); bool SetProfiles(std::uint64_t tid, HocClkTitleProfileList* profiles, bool immediate);
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);
void SetEnabled(bool enabled); void SetEnabled(bool enabled);
bool Enabled(); bool Enabled();
void SetOverrideHz(SysClkModule module, std::uint32_t hz); void SetOverrideHz(HocClkModule module, std::uint32_t hz);
std::uint32_t GetOverrideHz(SysClkModule module); std::uint32_t GetOverrideHz(HocClkModule module);
std::uint64_t GetConfigValue(SysClkConfigValue val); std::uint64_t GetConfigValue(HocClkConfigValue val);
const char* GetConfigValueName(SysClkConfigValue val, bool pretty); const char* GetConfigValueName(HocClkConfigValue val, bool pretty);
void GetConfigValues(SysClkConfigValueList* out_configValues); void GetConfigValues(HocClkConfigValueList* out_configValues);
bool SetConfigValues(SysClkConfigValueList* configValues, bool immediate); bool SetConfigValues(HocClkConfigValueList* configValues, bool immediate);
bool ResetConfigValue(SysClkConfigValue kval); bool ResetConfigValue(HocClkConfigValue kval);
bool SetConfigValue(SysClkConfigValue kval, std::uint64_t value, bool immediate = true); bool SetConfigValue(HocClkConfigValue kval, std::uint64_t value, bool immediate = true);
extern uint64_t configValues[SysClkConfigValue_EnumMax]; extern uint64_t configValues[HocClkConfigValue_EnumMax];
} }

View File

@@ -37,7 +37,7 @@
ERROR_RESULT_THROW(rc, "ASSERT_RESULT_OK: " format, ##__VA_ARGS__); \ ERROR_RESULT_THROW(rc, "ASSERT_RESULT_OK: " format, ##__VA_ARGS__); \
} }
#define ASSERT_ENUM_VALID(n, v) \ #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); \ ERROR_THROW("No such %s: %u", #n, v); \
} }

View File

@@ -96,7 +96,7 @@ namespace fileUtils {
va_end(args); va_end(args);
} }
void WriteContextToCsv(const SysClkContext* context) { void WriteContextToCsv(const HocClkContext* context) {
std::scoped_lock lock{g_csv_mutex}; std::scoped_lock lock{g_csv_mutex};
FILE* file = fopen(FILE_CONTEXT_CSV_PATH, "a"); FILE* file = fopen(FILE_CONTEXT_CSV_PATH, "a");
@@ -106,20 +106,20 @@ namespace fileUtils {
if (!ftell(file)) { if (!ftell(file)) {
fprintf(file, "timestamp,profile,app_tid"); fprintf(file, "timestamp,profile,app_tid");
for (unsigned int module = 0; module < SysClkModule_EnumMax; module++) { for (unsigned int module = 0; module < HocClkModule_EnumMax; module++) {
fprintf(file, ",%s_hz", sysclkFormatModule((SysClkModule)module, false)); fprintf(file, ",%s_hz", hocclkFormatModule((HocClkModule)module, false));
} }
for (unsigned int sensor = 0; sensor < SysClkThermalSensor_EnumMax; sensor++) { for (unsigned int sensor = 0; sensor < HocClkThermalSensor_EnumMax; sensor++) {
fprintf(file, ",%s_milliC", sysclkFormatThermalSensor((SysClkThermalSensor)sensor, false)); fprintf(file, ",%s_milliC", hocclkFormatThermalSensor((HocClkThermalSensor)sensor, false));
} }
for (unsigned int module = 0; module < SysClkModule_EnumMax; module++) { for (unsigned int module = 0; module < HocClkModule_EnumMax; module++) {
fprintf(file, ",%s_real_hz", sysclkFormatModule((SysClkModule)module, false)); fprintf(file, ",%s_real_hz", hocclkFormatModule((HocClkModule)module, false));
} }
for (unsigned int sensor = 0; sensor < SysClkPowerSensor_EnumMax; sensor++) { for (unsigned int sensor = 0; sensor < HocClkPowerSensor_EnumMax; sensor++) {
fprintf(file, ",%s_mw", sysclkFormatPowerSensor((SysClkPowerSensor)sensor, false)); fprintf(file, ",%s_mw", hocclkFormatPowerSensor((HocClkPowerSensor)sensor, false));
} }
fprintf(file, "\n"); fprintf(file, "\n");
@@ -128,21 +128,21 @@ namespace fileUtils {
struct timespec now; struct timespec now;
clock_gettime(CLOCK_REALTIME, &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]); 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]); 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]); 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]); fprintf(file, ",%d", context->power[sensor]);
} }

View File

@@ -32,7 +32,7 @@
#include <string> #include <string>
#include <atomic> #include <atomic>
#include <cstdarg> #include <cstdarg>
#include <sysclk.h> #include <hocclk.h>
#define FILE_CONFIG_DIR "/config/" TARGET #define FILE_CONFIG_DIR "/config/" TARGET
#define FILE_FLAG_CHECK_INTERVAL_NS (10000ULL * 1000000000ULL) #define FILE_FLAG_CHECK_INTERVAL_NS (10000ULL * 1000000000ULL)
@@ -48,6 +48,6 @@ namespace fileUtils {
bool IsLogEnabled(); bool IsLogEnabled();
void InitializeAsync(); void InitializeAsync();
void LogLine(const char* format, ...); void LogLine(const char* format, ...);
void WriteContextToCsv(const SysClkContext* context); void WriteContextToCsv(const HocClkContext* context);
} }

View File

@@ -22,11 +22,11 @@ namespace governor {
void HandleGovernor(uint32_t targetHz) void HandleGovernor(uint32_t targetHz)
{ {
u32 tempTargetHz = clockManager::gContext.overrideFreqs[HorizonOCModule_Governor]; u32 tempTargetHz = clockManager::gContext.overrideFreqs[HocClkModule_Governor];
if (!tempTargetHz) { 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) 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 { auto resolve = [](u8 app, u8 temp) -> u8 {
@@ -81,7 +81,7 @@ namespace governor {
return table.count - 1; return table.count - 1;
} }
u32 ResolveTargetHz(SysClkModule module) u32 ResolveTargetHz(HocClkModule module)
{ {
u32 hz = clockManager::gContext.overrideFreqs[module]; u32 hz = clockManager::gContext.overrideFreqs[module];
if (!hz) if (!hz)
@@ -123,7 +123,7 @@ namespace governor {
isCpuGovernorInBoostMode = false; isCpuGovernorInBoostMode = false;
} }
auto& table = clockManager::gFreqTable[SysClkModule_CPU]; auto& table = clockManager::gFreqTable[HocClkModule_CPU];
if (table.count == 0) if (table.count == 0)
continue; continue;
@@ -134,8 +134,8 @@ namespace governor {
u32 tableMaxHz = table.list[table.count - 1]; u32 tableMaxHz = table.list[table.count - 1];
u32 desiredHz = SchedutilTargetHz(cpuLoad, tableMaxHz); u32 desiredHz = SchedutilTargetHz(cpuLoad, tableMaxHz);
u32 targetHz = ResolveTargetHz(SysClkModule_CPU); u32 targetHz = ResolveTargetHz(HocClkModule_CPU);
u32 maxHz = clockManager::GetMaxAllowedHz(SysClkModule_CPU, clockManager::gContext.profile); u32 maxHz = clockManager::GetMaxAllowedHz(HocClkModule_CPU, clockManager::gContext.profile);
if (targetHz && desiredHz > targetHz) if (targetHz && desiredHz > targetHz)
desiredHz = targetHz; desiredHz = targetHz;
@@ -157,16 +157,16 @@ namespace governor {
downHoldRemaining--; downHoldRemaining--;
if (++tick > 50) { if (++tick > 50) {
minHz = config::GetConfigValue(HorizonOCConfigValue_CpuGovernorMinimumFreq); minHz = config::GetConfigValue(HocClkConfigValue_CpuGovernorMinimumFreq);
tick = 0; tick = 0;
} }
if (newHz < minHz) if (newHz < minHz)
newHz = minHz; newHz = minHz;
if ((!goingDown || (downHoldRemaining == 0)) && clockManager::IsAssignableHz(SysClkModule_CPU, newHz)) { if ((!goingDown || (downHoldRemaining == 0)) && clockManager::IsAssignableHz(HocClkModule_CPU, newHz)) {
board::SetHz(SysClkModule_CPU, newHz); board::SetHz(HocClkModule_CPU, newHz);
clockManager::gContext.freqs[SysClkModule_CPU] = newHz; clockManager::gContext.freqs[HocClkModule_CPU] = newHz;
lastHz = newHz; lastHz = newHz;
} }
@@ -189,7 +189,7 @@ namespace governor {
continue; continue;
} }
auto& table = clockManager::gFreqTable[SysClkModule_GPU]; auto& table = clockManager::gFreqTable[HocClkModule_GPU];
if (table.count == 0) if (table.count == 0)
continue; continue;
@@ -198,8 +198,8 @@ namespace governor {
u32 gpuLoad = board::GetPartLoad(HocClkPartLoad_GPU); u32 gpuLoad = board::GetPartLoad(HocClkPartLoad_GPU);
u32 tableMaxHz = table.list[table.count - 1]; u32 tableMaxHz = table.list[table.count - 1];
u32 desiredHz = SchedutilTargetHz(gpuLoad, tableMaxHz); u32 desiredHz = SchedutilTargetHz(gpuLoad, tableMaxHz);
u32 targetHz = ResolveTargetHz(SysClkModule_GPU); u32 targetHz = ResolveTargetHz(HocClkModule_GPU);
u32 maxHz = clockManager::GetMaxAllowedHz(SysClkModule_GPU, clockManager::gContext.profile); u32 maxHz = clockManager::GetMaxAllowedHz(HocClkModule_GPU, clockManager::gContext.profile);
if (targetHz && desiredHz > targetHz) if (targetHz && desiredHz > targetHz)
desiredHz = targetHz; desiredHz = targetHz;
@@ -218,9 +218,9 @@ namespace governor {
if (downHoldRemaining > 0) if (downHoldRemaining > 0)
downHoldRemaining--; downHoldRemaining--;
if ((!goingDown || (downHoldRemaining == 0)) && clockManager::IsAssignableHz(SysClkModule_GPU, newHz)) { if ((!goingDown || (downHoldRemaining == 0)) && clockManager::IsAssignableHz(HocClkModule_GPU, newHz)) {
board::SetHz(SysClkModule_GPU, newHz); board::SetHz(HocClkModule_GPU, newHz);
clockManager::gContext.freqs[SysClkModule_GPU] = newHz; clockManager::gContext.freqs[HocClkModule_GPU] = newHz;
lastHz = newHz; lastHz = newHz;
} }
@@ -234,7 +234,7 @@ namespace governor {
u8 tick = 0; u8 tick = 0;
for (;;) { for (;;) {
if (!clockManager::gRunning || clockManager::gContext.profile == SysClkProfile_Docked || !isVRREnabled) { if (!clockManager::gRunning || clockManager::gContext.profile == HocClkProfile_Docked || !isVRREnabled) {
svcSleepThread(POLL_NS); svcSleepThread(POLL_NS);
continue; continue;
} }
@@ -259,11 +259,11 @@ namespace governor {
// continue; // continue;
// } // }
u32 targetHz = clockManager::gContext.overrideFreqs[HorizonOCModule_Display]; u32 targetHz = clockManager::gContext.overrideFreqs[HocClkModule_Display];
if (!targetHz) { 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) 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; u8 maxDisplay;
@@ -273,28 +273,28 @@ namespace governor {
maxDisplay = 60; // don't assume display stuff! 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) if (maxDisplay == minDisplay)
continue; continue;
if (fps >= minDisplay && fps <= maxDisplay) { if (fps >= minDisplay && fps <= maxDisplay) {
board::SetHz(HorizonOCModule_Display, fps); board::SetHz(HocClkModule_Display, fps);
clockManager::gContext.freqs[HorizonOCModule_Display] = fps; clockManager::gContext.freqs[HocClkModule_Display] = fps;
clockManager::gContext.realFreqs[HorizonOCModule_Display] = fps; clockManager::gContext.realFreqs[HocClkModule_Display] = fps;
} else { } else {
for (u32 i = 0; i < 10; i++) { for (u32 i = 0; i < 10; i++) {
u32 compareHz = fps * i; u32 compareHz = fps * i;
if (compareHz >= minDisplay && compareHz <= maxDisplay) { if (compareHz >= minDisplay && compareHz <= maxDisplay) {
board::SetHz(HorizonOCModule_Display, compareHz); board::SetHz(HocClkModule_Display, compareHz);
clockManager::gContext.freqs[HorizonOCModule_Display] = compareHz; clockManager::gContext.freqs[HocClkModule_Display] = compareHz;
clockManager::gContext.realFreqs[HorizonOCModule_Display] = compareHz; clockManager::gContext.realFreqs[HocClkModule_Display] = compareHz;
break; break;
} }
} }
} }
if (++tick > 50) { if (++tick > 50) {
board::SetHz(HorizonOCModule_Display, maxDisplay); board::SetHz(HocClkModule_Display, maxDisplay);
tick = 0; tick = 0;
svcSleepThread(50'000'000); svcSleepThread(50'000'000);
} }

View File

@@ -1,5 +1,5 @@
#include <switch.h> #include <switch.h>
#include <sysclk.h> #include <hocclk.h>
#include "board/board.hpp" #include "board/board.hpp"
#include "clock_manager.hpp" #include "clock_manager.hpp"
#include <cstring> #include <cstring>

View File

@@ -27,7 +27,7 @@
#pragma once #pragma once
#include <switch.h> #include <switch.h>
#include <sysclk.h> #include <hocclk.h>
namespace integrations { namespace integrations {

View File

@@ -43,7 +43,7 @@ namespace ipcService {
IpcServer gServer; IpcServer gServer;
Result GetApiVersion(u32* out_version) { Result GetApiVersion(u32* out_version) {
*out_version = SYSCLK_IPC_API_VERSION; *out_version = HOCCLK_IPC_API_VERSION;
return 0; return 0;
} }
@@ -54,7 +54,7 @@ namespace ipcService {
return 0; return 0;
} }
Result GetCurrentContext(SysClkContext* out_ctx) { Result GetCurrentContext(HocClkContext* out_ctx) {
*out_ctx = clockManager::GetCurrentContext(); *out_ctx = clockManager::GetCurrentContext();
return 0; return 0;
} }
@@ -66,27 +66,27 @@ namespace ipcService {
Result GetProfileCount(std::uint64_t* tid, std::uint8_t* out_count) { Result GetProfileCount(std::uint64_t* tid, std::uint8_t* out_count) {
if (!config::HasProfilesLoaded()) { if (!config::HasProfilesLoaded()) {
return SYSCLK_ERROR(ConfigNotLoaded); return HOCCLK_ERROR(ConfigNotLoaded);
} }
*out_count = config::GetProfileCount(*tid); *out_count = config::GetProfileCount(*tid);
return 0; return 0;
} }
Result GetProfiles(std::uint64_t* tid, SysClkTitleProfileList* out_profiles) { Result GetProfiles(std::uint64_t* tid, HocClkTitleProfileList* out_profiles) {
if (!config::HasProfilesLoaded()) { if (!config::HasProfilesLoaded()) {
return SYSCLK_ERROR(ConfigNotLoaded); return HOCCLK_ERROR(ConfigNotLoaded);
} }
config::GetProfiles(*tid, out_profiles); config::GetProfiles(*tid, out_profiles);
return 0; return 0;
} }
Result SetProfiles(SysClkIpc_SetProfiles_Args* args) { Result SetProfiles(HocClkIpc_SetProfiles_Args* args) {
if (!config::HasProfilesLoaded()) { 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)) { if (!config::SetProfiles(args->tid, &profiles, true)) {
return SYSCLK_ERROR(ConfigSaveFailed); return HOCCLK_ERROR(ConfigSaveFailed);
} }
return 0; return 0;
} }
@@ -96,39 +96,39 @@ namespace ipcService {
return 0; return 0;
} }
Result SetOverride(SysClkIpc_SetOverride_Args* args) { Result SetOverride(HocClkIpc_SetOverride_Args* args) {
if (!SYSCLK_ENUM_VALID(SysClkModule, args->module)) { if (!HOCCLK_ENUM_VALID(HocClkModule, args->module)) {
return SYSCLK_ERROR(Generic); return HOCCLK_ERROR(Generic);
} }
config::SetOverrideHz(args->module, args->hz); config::SetOverrideHz(args->module, args->hz);
return 0; return 0;
} }
Result GetConfigValuesHandler(SysClkConfigValueList* out_configValues) { Result GetConfigValuesHandler(HocClkConfigValueList* out_configValues) {
if (!config::HasProfilesLoaded()) { if (!config::HasProfilesLoaded()) {
return SYSCLK_ERROR(ConfigNotLoaded); return HOCCLK_ERROR(ConfigNotLoaded);
} }
config::GetConfigValues(out_configValues); config::GetConfigValues(out_configValues);
return 0; return 0;
} }
Result SetConfigValuesHandler(SysClkConfigValueList* configValues) { Result SetConfigValuesHandler(HocClkConfigValueList* configValues) {
if (!config::HasProfilesLoaded()) { if (!config::HasProfilesLoaded()) {
return SYSCLK_ERROR(ConfigNotLoaded); return HOCCLK_ERROR(ConfigNotLoaded);
} }
SysClkConfigValueList copy = *configValues; HocClkConfigValueList copy = *configValues;
if (!config::SetConfigValues(&copy, true)) { if (!config::SetConfigValues(&copy, true)) {
return SYSCLK_ERROR(ConfigSaveFailed); return HOCCLK_ERROR(ConfigSaveFailed);
} }
return 0; return 0;
} }
Result GetFreqList(SysClkIpc_GetFreqList_Args* args, std::uint32_t* out_list, std::size_t size, std::uint32_t* out_count) { Result GetFreqList(HocClkIpc_GetFreqList_Args* args, std::uint32_t* out_list, std::size_t size, std::uint32_t* out_count) {
if (!SYSCLK_ENUM_VALID(SysClkModule, args->module)) { if (!HOCCLK_ENUM_VALID(HocClkModule, args->module)) {
return SYSCLK_ERROR(Generic); return HOCCLK_ERROR(Generic);
} }
if (args->maxCount != size/sizeof(*out_list)) { 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); clockManager::GetFreqList(args->module, out_list, args->maxCount, out_count);
return 0; return 0;
@@ -137,11 +137,11 @@ namespace ipcService {
Result ServiceHandlerFunc(void* arg, const IpcServerRequest* r, u8* out_data, size_t* out_dataSize) { Result ServiceHandlerFunc(void* arg, const IpcServerRequest* r, u8* out_data, size_t* out_dataSize) {
(void)arg; (void)arg;
switch (r->data.cmdId) { switch (r->data.cmdId) {
case SysClkIpcCmd_GetApiVersion: case HocClkIpcCmd_GetApiVersion:
*out_dataSize = sizeof(u32); *out_dataSize = sizeof(u32);
return GetApiVersion((u32*)out_data); return GetApiVersion((u32*)out_data);
case SysClkIpcCmd_GetVersionString: case HocClkIpcCmd_GetVersionString:
if (r->hipc.meta.num_recv_buffers >= 1) { if (r->hipc.meta.num_recv_buffers >= 1) {
return GetVersionString( return GetVersionString(
(char*)hipcGetBufferAddress(r->hipc.data.recv_buffers), (char*)hipcGetBufferAddress(r->hipc.data.recv_buffers),
@@ -150,75 +150,75 @@ namespace ipcService {
} }
break; break;
case SysClkIpcCmd_GetCurrentContext: case HocClkIpcCmd_GetCurrentContext:
if (r->data.size >= sizeof(std::uint64_t) && r->hipc.meta.num_recv_buffers >= 1) { if (r->data.size >= sizeof(std::uint64_t) && r->hipc.meta.num_recv_buffers >= 1) {
size_t bufSize = hipcGetBufferSize(r->hipc.data.recv_buffers); size_t bufSize = hipcGetBufferSize(r->hipc.data.recv_buffers);
if (bufSize >= sizeof(SysClkContext)) { if (bufSize >= sizeof(HocClkContext)) {
return GetCurrentContext((SysClkContext*)hipcGetBufferAddress(r->hipc.data.recv_buffers)); return GetCurrentContext((HocClkContext*)hipcGetBufferAddress(r->hipc.data.recv_buffers));
} }
} }
break; break;
case SysClkIpcCmd_Exit: case HocClkIpcCmd_Exit:
return ExitHandler(); return ExitHandler();
case SysClkIpcCmd_GetProfileCount: case HocClkIpcCmd_GetProfileCount:
if (r->data.size >= sizeof(std::uint64_t)) { if (r->data.size >= sizeof(std::uint64_t)) {
*out_dataSize = sizeof(std::uint8_t); *out_dataSize = sizeof(std::uint8_t);
return GetProfileCount((std::uint64_t*)r->data.ptr, (std::uint8_t*)out_data); return GetProfileCount((std::uint64_t*)r->data.ptr, (std::uint8_t*)out_data);
} }
break; break;
case SysClkIpcCmd_GetProfiles: case HocClkIpcCmd_GetProfiles:
if (r->data.size >= sizeof(std::uint64_t) && r->hipc.meta.num_recv_buffers >= 1) { if (r->data.size >= sizeof(std::uint64_t) && r->hipc.meta.num_recv_buffers >= 1) {
size_t bufSize = hipcGetBufferSize(r->hipc.data.recv_buffers); size_t bufSize = hipcGetBufferSize(r->hipc.data.recv_buffers);
if (bufSize >= sizeof(SysClkTitleProfileList)) { if (bufSize >= sizeof(HocClkTitleProfileList)) {
return GetProfiles((std::uint64_t*)r->data.ptr, (SysClkTitleProfileList*)hipcGetBufferAddress(r->hipc.data.recv_buffers)); return GetProfiles((std::uint64_t*)r->data.ptr, (HocClkTitleProfileList*)hipcGetBufferAddress(r->hipc.data.recv_buffers));
} }
} }
break; break;
case SysClkIpcCmd_SetProfiles: case HocClkIpcCmd_SetProfiles:
if (r->data.size >= sizeof(SysClkIpc_SetProfiles_Args)) { if (r->data.size >= sizeof(HocClkIpc_SetProfiles_Args)) {
return SetProfiles((SysClkIpc_SetProfiles_Args*)r->data.ptr); return SetProfiles((HocClkIpc_SetProfiles_Args*)r->data.ptr);
} }
break; break;
case SysClkIpcCmd_SetEnabled: case HocClkIpcCmd_SetEnabled:
if (r->data.size >= sizeof(std::uint8_t)) { if (r->data.size >= sizeof(std::uint8_t)) {
return SetEnabled((std::uint8_t*)r->data.ptr); return SetEnabled((std::uint8_t*)r->data.ptr);
} }
break; break;
case SysClkIpcCmd_SetOverride: case HocClkIpcCmd_SetOverride:
if (r->data.size >= sizeof(SysClkIpc_SetOverride_Args)) { if (r->data.size >= sizeof(HocClkIpc_SetOverride_Args)) {
return SetOverride((SysClkIpc_SetOverride_Args*)r->data.ptr); return SetOverride((HocClkIpc_SetOverride_Args*)r->data.ptr);
} }
break; break;
case SysClkIpcCmd_GetConfigValues: case HocClkIpcCmd_GetConfigValues:
if (r->hipc.meta.num_recv_buffers >= 1) { if (r->hipc.meta.num_recv_buffers >= 1) {
size_t bufSize = hipcGetBufferSize(r->hipc.data.recv_buffers); size_t bufSize = hipcGetBufferSize(r->hipc.data.recv_buffers);
if (bufSize >= sizeof(SysClkConfigValueList)) { if (bufSize >= sizeof(HocClkConfigValueList)) {
return GetConfigValuesHandler((SysClkConfigValueList*)hipcGetBufferAddress(r->hipc.data.recv_buffers)); return GetConfigValuesHandler((HocClkConfigValueList*)hipcGetBufferAddress(r->hipc.data.recv_buffers));
} }
} }
break; break;
case SysClkIpcCmd_SetConfigValues: case HocClkIpcCmd_SetConfigValues:
if (r->hipc.meta.num_send_buffers >= 1) { if (r->hipc.meta.num_send_buffers >= 1) {
size_t bufSize = hipcGetBufferSize(r->hipc.data.send_buffers); size_t bufSize = hipcGetBufferSize(r->hipc.data.send_buffers);
if (bufSize >= sizeof(SysClkConfigValueList)) { if (bufSize >= sizeof(HocClkConfigValueList)) {
return SetConfigValuesHandler((SysClkConfigValueList*)hipcGetBufferAddress(r->hipc.data.send_buffers)); return SetConfigValuesHandler((HocClkConfigValueList*)hipcGetBufferAddress(r->hipc.data.send_buffers));
} }
} }
break; break;
case SysClkIpcCmd_GetFreqList: case HocClkIpcCmd_GetFreqList:
if (r->data.size >= sizeof(SysClkIpc_GetFreqList_Args) && r->hipc.meta.num_recv_buffers >= 1) { if (r->data.size >= sizeof(HocClkIpc_GetFreqList_Args) && r->hipc.meta.num_recv_buffers >= 1) {
*out_dataSize = sizeof(std::uint32_t); *out_dataSize = sizeof(std::uint32_t);
return GetFreqList( return GetFreqList(
(SysClkIpc_GetFreqList_Args*)r->data.ptr, (HocClkIpc_GetFreqList_Args*)r->data.ptr,
(std::uint32_t*)hipcGetBufferAddress(r->hipc.data.recv_buffers), (std::uint32_t*)hipcGetBufferAddress(r->hipc.data.recv_buffers),
hipcGetBufferSize(r->hipc.data.recv_buffers), hipcGetBufferSize(r->hipc.data.recv_buffers),
(std::uint32_t*)out_data (std::uint32_t*)out_data
@@ -234,7 +234,7 @@ namespace ipcService {
break; break;
} }
return SYSCLK_ERROR(Generic); return HOCCLK_ERROR(Generic);
} }
void ProcessThreadFunc(void* arg) { void ProcessThreadFunc(void* arg) {
@@ -259,7 +259,7 @@ namespace ipcService {
std::int32_t priority; std::int32_t priority;
Result rc = svcGetThreadPriority(&priority, CUR_THREAD_HANDLE); Result rc = svcGetThreadPriority(&priority, CUR_THREAD_HANDLE);
ASSERT_RESULT_OK(rc, "svcGetThreadPriority"); 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"); ASSERT_RESULT_OK(rc, "ipcServerInit");
rc = threadCreate(&gThread, &ProcessThreadFunc, nullptr, NULL, 0x2000, priority, -2); rc = threadCreate(&gThread, &ProcessThreadFunc, nullptr, NULL, 0x2000, priority, -2);
ASSERT_RESULT_OK(rc, "threadCreate"); ASSERT_RESULT_OK(rc, "threadCreate");

View File

@@ -26,7 +26,7 @@
#pragma once #pragma once
#include <sysclk.h> #include <hocclk.h>
#include <switch.h> #include <switch.h>
namespace ipcService { namespace ipcService {

View File

@@ -34,7 +34,7 @@ namespace kip {
void SetKipData() void SetKipData()
{ {
// TODO: figure out if this REALLY causes issues (i doubt it) // 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))) { // if(R_FAILED(I2c_BuckConverter_SetMvOut(&I2c_Mariko_DRAM_VDDQ, config::GetConfigValue(KipConfigValue_marikoEmcVddqVolt) / 1000))) {
// fileUtils::LogLine("[clock_manager] Failed set i2c vddq"); // fileUtils::LogLine("[clock_manager] Failed set i2c vddq");
// notification::writeNotification("Horizon OC\nFailed to write I2C\nwhile setting 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)); CUST_WRITE_FIELD_BATCH(&table, gpuSpeedo, config::GetConfigValue(KipConfigValue_gpuSpeedo));
for (int i = 0; i < 24; i++) { 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++) { 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)); 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"); notification::writeNotification("Horizon OC\nKip write failed");
} }
SysClkConfigValueList configValues; HocClkConfigValueList configValues;
config::GetConfigValues(&configValues); config::GetConfigValues(&configValues);
configValues.values[KipCrc32] = (u64)crc32::checksum_file("sdmc:/atmosphere/kips/hoc.kip"); // write checksum configValues.values[KipCrc32] = (u64)crc32::checksum_file("sdmc:/atmosphere/kips/hoc.kip"); // write checksum
@@ -153,7 +153,7 @@ namespace kip {
fclose(fp); fclose(fp);
} }
SysClkConfigValueList configValues; HocClkConfigValueList configValues;
config::GetConfigValues(&configValues); config::GetConfigValues(&configValues);
CustomizeTable table; CustomizeTable table;
@@ -236,7 +236,7 @@ namespace kip {
// if(cust_get_cust_rev(&table) == KIP_CUST_REV) // if(cust_get_cust_rev(&table) == KIP_CUST_REV)
// return; // return;
if (sizeof(SysClkConfigValueList) <= sizeof(configValues)) { if (sizeof(HocClkConfigValueList) <= sizeof(configValues)) {
if (config::SetConfigValues(&configValues, false)) { if (config::SetConfigValues(&configValues, false)) {
fileUtils::LogLine("[clock_manager] Successfully loaded KIP data into config"); fileUtils::LogLine("[clock_manager] Successfully loaded KIP data into config");
} else { } else {

View File

@@ -30,7 +30,7 @@
*/ */
#include <switch.h> #include <switch.h>
#include <sysclk.h> #include <hocclk.h>
#include "soctherm.hpp" #include "soctherm.hpp"
#include "board/board.hpp" #include "board/board.hpp"
#include "file_utils.hpp" #include "file_utils.hpp"
@@ -551,7 +551,7 @@ namespace soctherm {
temps.gpu = TranslateTemp(ReadReg(socthermVa, SENSOR_TEMP1) & SENSOR_TEMP1_GPU_TEMP_MASK); temps.gpu = TranslateTemp(ReadReg(socthermVa, SENSOR_TEMP1) & SENSOR_TEMP1_GPU_TEMP_MASK);
temps.pllx = TranslateTemp(ReadReg(socthermVa, SENSOR_TEMP2) & SENSOR_TEMP2_PLLX_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); temps.mem = TranslateTemp(ReadReg(socthermVa, SENSOR_TEMP2) >> 16);
} else { } else {
temps.mem = -1; temps.mem = -1;
@@ -617,7 +617,7 @@ namespace soctherm {
} }
void Initialize() { void Initialize() {
isMariko = board::GetSocType() == SysClkSocType_Mariko; isMariko = board::GetSocType() == HocClkSocType_Mariko;
constexpr u64 SocthermPa = 0x700E2000, FusePa = 0x7000F000, CarPa = 0x60006000; constexpr u64 SocthermPa = 0x700E2000, FusePa = 0x7000F000, CarPa = 0x60006000;
R_UNLESS(MapAddress(socthermVa, SocthermPa, "soctherm")); R_UNLESS(MapAddress(socthermVa, SocthermPa, "soctherm"));

View File

@@ -32,7 +32,7 @@
#pragma once #pragma once
#include <switch.h> #include <switch.h>
#include <sysclk.h> #include <hocclk.h>
namespace soctherm { namespace soctherm {