Maximum RAM frequency will not be used automatically

This commit is contained in:
KazushiM
2023-02-02 17:13:52 +08:00
parent 69f7919c3c
commit 8285e84071
7 changed files with 32 additions and 47 deletions

View File

@@ -30,19 +30,7 @@ Result CpuPtmBoost(perf_conf_entry* entry) {
R_SUCCEED();
}
Result MemPtmMax(perf_conf_entry* entry) {
if (!C.marikoEmcMaxClock)
R_SUCCEED();
u32 memPtmMax = C.marikoEmcMaxClock * 1000;
PatchOffset(&(entry->emc_freq_1), memPtmMax);
PatchOffset(&(entry->emc_freq_2), memPtmMax);
R_SUCCEED();
}
Result MemPtmAlt(perf_conf_entry* entry) {
Result MemPtm(perf_conf_entry* entry) {
PatchOffset(&(entry->emc_freq_1), memPtmLimit);
PatchOffset(&(entry->emc_freq_2), memPtmLimit);
@@ -89,8 +77,7 @@ void Patch(uintptr_t mapped_nso, size_t nso_size) {
PatcherEntry<perf_conf_entry> patches[] = {
{ "CPU Ptm Boost", &CpuPtmBoost, 2, },
{ "MEM Ptm Max", &MemPtmMax, 9, },
{ "MEM Ptm Alt", &MemPtmAlt, 7, },
{ "MEM Ptm", &MemPtm, 16, },
};
for (u32 i = 0; i < entryCnt; i++) {
@@ -115,11 +102,9 @@ void Patch(uintptr_t mapped_nso, size_t nso_size) {
switch (entry->emc_freq_1) {
case memPtmLimit:
patches[1].Apply(entry);
break;
case memPtmAlt:
case memPtmClamp:
patches[2].Apply(entry);
patches[1].Apply(entry);
break;
default:
LOGGING("%u (0x%08x) @%p", entry->emc_freq_1, entry->conf_id, &(entry->emc_freq_2));

View File

@@ -11,22 +11,22 @@
#include <sysclk/apm.h>
SysClkApmConfiguration sysclk_g_apm_configurations[] = {
{0x00010000, 1020000000, 384000000, 1862400000},
{0x00010001, 1020000000, 768000000, 1862400000},
{0x00010002, 1224000000, 691200000, 1862400000},
{0x00020000, 1020000000, 230400000, 1862400000},
{0x00020001, 1020000000, 307200000, 1862400000},
{0x00020002, 1224000000, 230400000, 1862400000},
{0x00020003, 1020000000, 307200000, 1600000000},
{0x00020004, 1020000000, 384000000, 1600000000},
{0x00020005, 1020000000, 307200000, 1600000000},
{0x00020006, 1020000000, 384000000, 1600000000},
{0x92220007, 1020000000, 460800000, 1862400000},
{0x92220008, 1020000000, 460800000, 1600000000},
{0x92220009, 1785000000, 76800000, 1862400000},
{0x9222000A, 1785000000, 76800000, 1600000000},
{0x9222000B, 1020000000, 76800000, 1862400000},
{0x9222000C, 1020000000, 76800000, 1600000000},
{0x00010000, 1020000000, 384000000, 1600000000},
{0x00010001, 1020000000, 768000000, 1600000000},
{0x00010002, 1224000000, 691200000, 1600000000},
{0x00020000, 1020000000, 230400000, 1600000000},
{0x00020001, 1020000000, 307200000, 1600000000},
{0x00020002, 1224000000, 230400000, 1600000000},
{0x00020003, 1020000000, 307000000, 1331200000},
{0x00020004, 1020000000, 384000000, 1331200000},
{0x00020005, 1020000000, 307200000, 1065600000},
{0x00020006, 1020000000, 384000000, 1065600000},
{0x92220007, 1020000000, 460800000, 1600000000},
{0x92220008, 1020000000, 460800000, 1331200000},
{0x92220009, 1785000000, 76800000, 1600000000},
{0x9222000A, 1785000000, 76800000, 1331200000},
{0x9222000B, 1020000000, 76800000, 1600000000},
{0x9222000C, 1020000000, 76800000, 1331200000},
{0, 0, 0, 0},
};

View File

@@ -113,9 +113,7 @@ uint32_t ClockManager::GetHz(SysClkModule module)
768'000'000 : 460'800'000;
break;
case SysClkModule_MEM:
hz = (mode == ReverseNX_Docked ||
this->oc->realProfile == SysClkProfile_Docked) ?
Clocks::maxMemFreq : 1600'000'000;
hz = MEM_CLOCK_DOCK;
break;
default:
break;

View File

@@ -251,7 +251,7 @@ uint32_t Clocks::GetStockClock(SysClkApmConfiguration* apm, SysClkModule module)
case SysClkModule_GPU:
return apm->gpu_hz;
case SysClkModule_MEM:
return apm->mem_hz;
return GetIsMariko() ? MEM_CLOCK_MARIKO_MIN : apm->mem_hz;
default:
ERROR_THROW("Unknown SysClkModule: %x", module);
return 0;
@@ -270,15 +270,15 @@ void Clocks::ResetToStock(unsigned int module)
if (module == SysClkModule_EnumMax || module == SysClkModule_CPU)
{
Clocks::SetHz(SysClkModule_CPU, apmConfiguration->cpu_hz);
Clocks::SetHz(SysClkModule_CPU, GetStockClock(apmConfiguration, SysClkModule_CPU));
}
if (module == SysClkModule_EnumMax || module == SysClkModule_GPU)
{
Clocks::SetHz(SysClkModule_GPU, apmConfiguration->gpu_hz);
Clocks::SetHz(SysClkModule_GPU, GetStockClock(apmConfiguration, SysClkModule_GPU));
}
if (module == SysClkModule_EnumMax || module == SysClkModule_MEM)
{
Clocks::SetHz(SysClkModule_MEM, apmConfiguration->mem_hz);
Clocks::SetHz(SysClkModule_MEM, GetStockClock(apmConfiguration, SysClkModule_MEM));
}
}
else

View File

@@ -13,8 +13,10 @@
#include <switch.h>
#include <sysclk.h>
#define MAX_MEM_CLOCK 1862'400'000
#define BOOST_THRESHOLD 95'0
#define MAX_MEM_CLOCK 1862'400'000
#define MEM_CLOCK_MARIKO_MIN 1600'000'000
#define MEM_CLOCK_DOCK 1600'000'000
#define BOOST_THRESHOLD 95'0
class Clocks
{

2
pages/dist/main.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -392,9 +392,9 @@ function UpdateHTMLForm() {
last_btn.removeAttribute("disabled");
last_btn.addEventListener('click', () => {
// Load last saved from localStorage
JSON.parse(localStorage.getItem("last_saved")!)
.filter((key: string) => key != "custRev")
.forEach((key: string) => (document.getElementById(key) as HTMLInputElement).value = key);
let dict = JSON.parse(localStorage.getItem("last_saved")!);
delete dict["custRev"];
dict.forEach((key: string) => (document.getElementById(key) as HTMLInputElement).value = key);
});
} else {
last_btn.style.setProperty("display", "none");