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