hocclk: add mariko middle freq hack
This commit is contained in:
@@ -94,7 +94,7 @@ typedef struct
|
|||||||
};
|
};
|
||||||
} HocClkTitleProfileList;
|
} HocClkTitleProfileList;
|
||||||
|
|
||||||
#define HOCCLK_FREQ_LIST_MAX 32
|
#define HOCCLK_FREQ_LIST_MAX 48
|
||||||
|
|
||||||
#define HOCCLK_GLOBAL_PROFILE_TID 0xA111111111111111
|
#define HOCCLK_GLOBAL_PROFILE_TID 0xA111111111111111
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ typedef enum {
|
|||||||
HocClkConfigValue_IsFirstLoad,
|
HocClkConfigValue_IsFirstLoad,
|
||||||
|
|
||||||
HocClkConfigValue_AulaDisplayColorPreset,
|
HocClkConfigValue_AulaDisplayColorPreset,
|
||||||
|
HocClkConfigValue_MarikoMiddleFreqs,
|
||||||
|
|
||||||
KipConfigValue_custRev,
|
KipConfigValue_custRev,
|
||||||
// KipConfigValue_mtcConf,
|
// KipConfigValue_mtcConf,
|
||||||
@@ -289,7 +290,8 @@ static inline const char* hocclkFormatConfigValue(HocClkConfigValue val, bool pr
|
|||||||
return pretty ? "RAM Frequency Display Unit" : "RAM_display_unit";
|
return pretty ? "RAM Frequency Display Unit" : "RAM_display_unit";
|
||||||
case HocClkConfigValue_AulaDisplayColorPreset:
|
case HocClkConfigValue_AulaDisplayColorPreset:
|
||||||
return pretty ? "Aula Display Color Preset" : "aula_color_preset";
|
return pretty ? "Aula Display Color Preset" : "aula_color_preset";
|
||||||
|
case HocClkConfigValue_MarikoMiddleFreqs:
|
||||||
|
return pretty ? "Mariko Middle Clocks" : "mariko_middle_freqs";
|
||||||
// KIP config values
|
// KIP config values
|
||||||
case KipConfigValue_custRev:
|
case KipConfigValue_custRev:
|
||||||
return pretty ? "Custom Revision" : "kip_cust_rev";
|
return pretty ? "Custom Revision" : "kip_cust_rev";
|
||||||
@@ -502,6 +504,7 @@ static inline uint64_t hocclkDefaultConfigValue(HocClkConfigValue val)
|
|||||||
case HocClkConfigValue_LiveCpuUv:
|
case HocClkConfigValue_LiveCpuUv:
|
||||||
case HocClkConfigValue_GPUSchedulingMethod:
|
case HocClkConfigValue_GPUSchedulingMethod:
|
||||||
case HocClkConfigValue_MemoryFrequencyMeasurementMode:
|
case HocClkConfigValue_MemoryFrequencyMeasurementMode:
|
||||||
|
case HocClkConfigValue_MarikoMiddleFreqs:
|
||||||
return 0ULL;
|
return 0ULL;
|
||||||
case HocClkConfigValue_RamDisplayUnit:
|
case HocClkConfigValue_RamDisplayUnit:
|
||||||
return (uint64_t)RamDisplayUnit_MHz;
|
return (uint64_t)RamDisplayUnit_MHz;
|
||||||
@@ -561,6 +564,7 @@ static inline uint64_t hocclkValidConfigValue(HocClkConfigValue val, uint64_t in
|
|||||||
case HocClkConfigValue_EnableExperimentalSettings:
|
case HocClkConfigValue_EnableExperimentalSettings:
|
||||||
case HocClkConfigValue_LiveCpuUv:
|
case HocClkConfigValue_LiveCpuUv:
|
||||||
case HocClkConfigValue_GPUSchedulingMethod:
|
case HocClkConfigValue_GPUSchedulingMethod:
|
||||||
|
case HocClkConfigValue_MarikoMiddleFreqs:
|
||||||
return (input & 0x1) == input;
|
return (input & 0x1) == input;
|
||||||
|
|
||||||
case KipConfigValue_custRev:
|
case KipConfigValue_custRev:
|
||||||
|
|||||||
@@ -649,7 +649,9 @@ protected:
|
|||||||
if (R_FAILED(rc)) [[unlikely]] { FatalGui::openWithResultCode("hocclkIpcGetConfigValues", rc); return; }
|
if (R_FAILED(rc)) [[unlikely]] { FatalGui::openWithResultCode("hocclkIpcGetConfigValues", rc); return; }
|
||||||
this->listElement->addItem(new tsl::elm::CategoryHeader("Experimental Settings"));
|
this->listElement->addItem(new tsl::elm::CategoryHeader("Experimental Settings"));
|
||||||
ValueThresholds thresholdsDisabled(0, 0);
|
ValueThresholds thresholdsDisabled(0, 0);
|
||||||
|
if(IsMariko()) {
|
||||||
|
addConfigToggle(HocClkConfigValue_MarikoMiddleFreqs, nullptr, true);
|
||||||
|
}
|
||||||
addConfigToggle(HocClkConfigValue_LiveCpuUv, nullptr);
|
addConfigToggle(HocClkConfigValue_LiveCpuUv, nullptr);
|
||||||
std::vector<NamedValue> gpuSchedMethodValues = {
|
std::vector<NamedValue> gpuSchedMethodValues = {
|
||||||
NamedValue("INI", GpuSchedulingOverrideMethod_Ini),
|
NamedValue("INI", GpuSchedulingOverrideMethod_Ini),
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
#include "../file/errors.hpp"
|
#include "../file/errors.hpp"
|
||||||
#include "../soc/pllmb.hpp"
|
#include "../soc/pllmb.hpp"
|
||||||
#include "../file/config.hpp"
|
#include "../file/config.hpp"
|
||||||
|
#include "../soc/gm20b.hpp"
|
||||||
namespace board {
|
namespace board {
|
||||||
|
|
||||||
PcvModule GetPcvModule(HocClkModule hocclkModule) {
|
PcvModule GetPcvModule(HocClkModule hocclkModule) {
|
||||||
@@ -77,7 +78,6 @@ namespace board {
|
|||||||
Result rc = 0;
|
Result rc = 0;
|
||||||
bool usesGovenor = module > HocClkModule_MEM;
|
bool usesGovenor = module > HocClkModule_MEM;
|
||||||
|
|
||||||
|
|
||||||
if (module == HocClkModule_Display) {
|
if (module == HocClkModule_Display) {
|
||||||
display::SetRate(hz);
|
display::SetRate(hz);
|
||||||
return;
|
return;
|
||||||
@@ -87,27 +87,35 @@ namespace board {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool useGm20b = (module == HocClkModule_GPU) && (GetSocType() == HocClkSocType_Mariko) && (hz % 38400000 == 0) && (hz % 76800000 != 0);
|
||||||
|
|
||||||
|
u32 pcvHz = useGm20b ? ((hz + 76800000 - 1) / 76800000) * 76800000 : hz;
|
||||||
|
|
||||||
if (HOSSVC_HAS_CLKRST) {
|
if (HOSSVC_HAS_CLKRST) {
|
||||||
ClkrstSession session = {};
|
ClkrstSession session = {};
|
||||||
rc = clkrstOpenSession(&session, GetPcvModuleId(module), 3);
|
rc = clkrstOpenSession(&session, GetPcvModuleId(module), 3);
|
||||||
ASSERT_RESULT_OK(rc, "clkrstOpenSession");
|
ASSERT_RESULT_OK(rc, "clkrstOpenSession");
|
||||||
ClkrstSetHz(session, hz);
|
ClkrstSetHz(session, pcvHz);
|
||||||
|
|
||||||
/* Voltage bug workaround. */
|
/* Voltage bug workaround. */
|
||||||
if (module == HocClkModule_CPU) {
|
if (module == HocClkModule_CPU) {
|
||||||
svcSleepThread(300'000);
|
svcSleepThread(300'000);
|
||||||
ClkrstSetHz(session, hz);
|
ClkrstSetHz(session, pcvHz);
|
||||||
}
|
}
|
||||||
|
|
||||||
clkrstCloseSession(&session);
|
clkrstCloseSession(&session);
|
||||||
} else {
|
} else {
|
||||||
PcvSetHz(GetPcvModule(module), hz);
|
PcvSetHz(GetPcvModule(module), pcvHz);
|
||||||
|
|
||||||
if (module == HocClkModule_CPU) {
|
if (module == HocClkModule_CPU) {
|
||||||
svcSleepThread(300'000);
|
svcSleepThread(300'000);
|
||||||
PcvSetHz(GetPcvModule(module), hz);
|
PcvSetHz(GetPcvModule(module), pcvHz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (useGm20b) {
|
||||||
|
gm20b::setClock(hz / 1000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 GetDisplayRate(u32 hz) {
|
u32 GetDisplayRate(u32 hz) {
|
||||||
|
|||||||
@@ -161,7 +161,6 @@ namespace kip {
|
|||||||
void GetKipData()
|
void GetKipData()
|
||||||
{
|
{
|
||||||
FILE* fp;
|
FILE* fp;
|
||||||
if (config::Refresh()) {
|
|
||||||
fp = fopen("sdmc:/atmosphere/kips/hoc.kip", "r");
|
fp = fopen("sdmc:/atmosphere/kips/hoc.kip", "r");
|
||||||
|
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
@@ -300,9 +299,5 @@ namespace kip {
|
|||||||
fileUtils::LogLine("[kip] Error: Config value list buffer size mismatch");
|
fileUtils::LogLine("[kip] Error: Config value list buffer size mismatch");
|
||||||
notification::writeNotification("Horizon OC\nConfig Buffer Mismatch");
|
notification::writeNotification("Horizon OC\nConfig Buffer Mismatch");
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
fileUtils::LogLine("[kip] Config refresh error in GetKipData!");
|
|
||||||
notification::writeNotification("Horizon OC\nConfig refresh failed");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,7 +135,7 @@ int main(int argc, char** argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
config::Initialize();
|
config::Initialize();
|
||||||
|
config::Refresh(); // Get config from file
|
||||||
board::Initialize();
|
board::Initialize();
|
||||||
processManagement::Initialize();
|
processManagement::Initialize();
|
||||||
|
|
||||||
|
|||||||
@@ -181,6 +181,40 @@ namespace clockManager {
|
|||||||
|
|
||||||
std::uint32_t *hz = &gFreqTable[module].list[0];
|
std::uint32_t *hz = &gFreqTable[module].list[0];
|
||||||
gFreqTable[module].count = 0;
|
gFreqTable[module].count = 0;
|
||||||
|
|
||||||
|
if (module == HocClkModule_GPU && board::GetSocType() == HocClkSocType_Mariko) {
|
||||||
|
constexpr u32 kStep = 38400000;
|
||||||
|
constexpr u32 kPcvStep = 76800000;
|
||||||
|
constexpr u32 kMax = 1228800000;
|
||||||
|
|
||||||
|
for (u32 f = kPcvStep; f <= kMax && gFreqTable[module].count < HOCCLK_FREQ_LIST_MAX; f += kStep) {
|
||||||
|
if (f % kPcvStep != 0) {
|
||||||
|
if (!middleFreqs) continue;
|
||||||
|
*hz = f;
|
||||||
|
gFreqTable[module].count++;
|
||||||
|
hz++;
|
||||||
|
} else {
|
||||||
|
for (u32 i = 0; i < count; i++) {
|
||||||
|
if (freqs[i] == f) {
|
||||||
|
*hz = f;
|
||||||
|
gFreqTable[module].count++;
|
||||||
|
hz++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (u32 i = 0; i < count && gFreqTable[module].count < HOCCLK_FREQ_LIST_MAX; i++) {
|
||||||
|
if (freqs[i] > kMax && IsAssignableHz(module, freqs[i])) {
|
||||||
|
*hz = freqs[i];
|
||||||
|
gFreqTable[module].count++;
|
||||||
|
hz++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (std::uint32_t i = 0; i < count; i++) {
|
for (std::uint32_t i = 0; i < count; i++) {
|
||||||
if (!IsAssignableHz(module, freqs[i])) {
|
if (!IsAssignableHz(module, freqs[i])) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user