governor configuration options + gm20b driver fixes
This commit is contained in:
1 parent
01d85ca9ff
commit
9c892ee365
5 files changed
+87
-12
No files matched your search
@@ -62,6 +62,9 @@ typedef enum {
|
|||||||
|
|
||||||
HocClkConfigValue_RAMVoltDisplayMode,
|
HocClkConfigValue_RAMVoltDisplayMode,
|
||||||
HocClkConfigValue_CpuGovernorMinimumFreq,
|
HocClkConfigValue_CpuGovernorMinimumFreq,
|
||||||
|
HocClkConfigValue_GovernorPollRateMs,
|
||||||
|
HocClkConfigValue_GovernorDownHoldTicks,
|
||||||
|
HocClkConfigValue_GovernorStepUtil,
|
||||||
HocClkConfigValue_DisplayVoltage,
|
HocClkConfigValue_DisplayVoltage,
|
||||||
|
|
||||||
HocClkConfigValue_MemoryFrequencyMeasurementMode,
|
HocClkConfigValue_MemoryFrequencyMeasurementMode,
|
||||||
@@ -305,6 +308,12 @@ static inline const char* hocclkFormatConfigValue(HocClkConfigValue val, bool pr
|
|||||||
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 HocClkConfigValue_CpuGovernorMinimumFreq:
|
case HocClkConfigValue_CpuGovernorMinimumFreq:
|
||||||
return pretty ? "CPU Governor Minimum Frequency" : "cpu_gov_min_freq";
|
return pretty ? "CPU Governor Minimum Frequency" : "cpu_gov_min_freq";
|
||||||
|
case HocClkConfigValue_GovernorPollRateMs:
|
||||||
|
return pretty ? "Governor Poll Rate" : "gov_poll_rate_ms";
|
||||||
|
case HocClkConfigValue_GovernorDownHoldTicks:
|
||||||
|
return pretty ? "Governor Down Hold" : "gov_down_hold_ticks";
|
||||||
|
case HocClkConfigValue_GovernorStepUtil:
|
||||||
|
return pretty ? "Governor Step Divisor" : "gov_step_util";
|
||||||
|
|
||||||
case HocClkConfigValue_DisplayVoltage:
|
case HocClkConfigValue_DisplayVoltage:
|
||||||
return pretty ? "Display Voltage" : "display_voltage";
|
return pretty ? "Display Voltage" : "display_voltage";
|
||||||
@@ -603,6 +612,12 @@ static inline uint64_t hocclkDefaultConfigValue(HocClkConfigValue val)
|
|||||||
return 70ULL;
|
return 70ULL;
|
||||||
case HocClkConfigValue_CpuGovernorMinimumFreq:
|
case HocClkConfigValue_CpuGovernorMinimumFreq:
|
||||||
return 612000000ULL; // 612MHz
|
return 612000000ULL; // 612MHz
|
||||||
|
case HocClkConfigValue_GovernorPollRateMs:
|
||||||
|
return 5ULL; // 5ms
|
||||||
|
case HocClkConfigValue_GovernorDownHoldTicks:
|
||||||
|
return 10ULL; // 10 ticks (50ms at 5ms poll)
|
||||||
|
case HocClkConfigValue_GovernorStepUtil:
|
||||||
|
return 900ULL; // max freq at 90% load
|
||||||
case HocClkConfigValue_MaxDisplayClockH:
|
case HocClkConfigValue_MaxDisplayClockH:
|
||||||
return 60ULL;
|
return 60ULL;
|
||||||
case HocClkConfigValue_DisplayVoltage:
|
case HocClkConfigValue_DisplayVoltage:
|
||||||
@@ -795,6 +810,15 @@ static inline uint64_t hocclkValidConfigValue(HocClkConfigValue val, uint64_t in
|
|||||||
case HocClkConfigValue_BatteryChargeCurrent:
|
case HocClkConfigValue_BatteryChargeCurrent:
|
||||||
return ((input >= 1024) && (input <= 3072)) || !input;
|
return ((input >= 1024) && (input <= 3072)) || !input;
|
||||||
|
|
||||||
|
case HocClkConfigValue_GovernorPollRateMs:
|
||||||
|
return ((input >= 1) && (input <= 50));
|
||||||
|
|
||||||
|
case HocClkConfigValue_GovernorDownHoldTicks:
|
||||||
|
return (input <= 100);
|
||||||
|
|
||||||
|
case HocClkConfigValue_GovernorStepUtil:
|
||||||
|
return ((input >= 100) && (input <= 1500));
|
||||||
|
|
||||||
case HocClkConfigValue_InputCurrentLimit:
|
case HocClkConfigValue_InputCurrentLimit:
|
||||||
return ((input >= 100) && (input <= 3000)) || !input;
|
return ((input >= 100) && (input <= 3000)) || !input;
|
||||||
|
|
||||||
|
|||||||
@@ -107,6 +107,26 @@ std::vector<std::string> ConfigInfoStrings(HocClkConfigValue val, bool isMariko,
|
|||||||
"Default: 612MHz"
|
"Default: 612MHz"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
case HocClkConfigValue_GovernorPollRateMs:
|
||||||
|
return {
|
||||||
|
"How often the CPU/GPU governor runs its loop.",
|
||||||
|
"Default: 5ms"
|
||||||
|
};
|
||||||
|
|
||||||
|
case HocClkConfigValue_GovernorDownHoldTicks:
|
||||||
|
return {
|
||||||
|
"How many governor ticks to hold the current frequency",
|
||||||
|
"before ramping down. 0 disables holding",
|
||||||
|
"Default: 10 ticks"
|
||||||
|
};
|
||||||
|
|
||||||
|
case HocClkConfigValue_GovernorStepUtil:
|
||||||
|
return {
|
||||||
|
"Load divisor mapping utilization to frequency.",
|
||||||
|
"Lower ramps up faster, above 1000 caps the top end",
|
||||||
|
"Default: 900"
|
||||||
|
};
|
||||||
|
|
||||||
case HocClkConfigValue_OverwriteRefreshRate:
|
case HocClkConfigValue_OverwriteRefreshRate:
|
||||||
return {
|
return {
|
||||||
"Controls the availability of display refresh rate features.",
|
"Controls the availability of display refresh rate features.",
|
||||||
|
|||||||
@@ -1007,6 +1007,13 @@ class GovernorSettingsSubMenuGui : public MiscGui {
|
|||||||
|
|
||||||
addConfigButton(HocClkConfigValue_CpuGovernorMinimumFreq, "CPU Governor Minimum Frequency", ValueRange(0, 0, 1, "", 0),
|
addConfigButton(HocClkConfigValue_CpuGovernorMinimumFreq, "CPU Governor Minimum Frequency", ValueRange(0, 0, 1, "", 0),
|
||||||
"CPU Governor Minimum Frequency", &thresholdsDisabled, {}, GovernorMinHz, false);
|
"CPU Governor Minimum Frequency", &thresholdsDisabled, {}, GovernorMinHz, false);
|
||||||
|
|
||||||
|
addConfigButton(HocClkConfigValue_GovernorPollRateMs, "Governor Poll Rate", ValueRange(1, 50, 1, " ms", 1),
|
||||||
|
"Governor Poll Rate", &thresholdsDisabled, {}, {}, false);
|
||||||
|
addConfigButton(HocClkConfigValue_GovernorDownHoldTicks, "Governor Down Hold", ValueRange(0, 100, 1, " ticks", 1),
|
||||||
|
"Governor Down Hold", &thresholdsDisabled, {}, {}, false);
|
||||||
|
addConfigButton(HocClkConfigValue_GovernorStepUtil, "Governor Step Divisor", ValueRange(100, 1500, 25, "", 1),
|
||||||
|
"Governor Step Divisor", &thresholdsDisabled, {}, {}, false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1471,7 +1478,7 @@ class RamTimingsSubmenuGui : public MiscGui {
|
|||||||
addConfigTrackbar(KipConfigValue_t1_tRCD, "t1 tRCD", ValueRange(0, 7, 1));
|
addConfigTrackbar(KipConfigValue_t1_tRCD, "t1 tRCD", ValueRange(0, 7, 1));
|
||||||
addConfigTrackbar(KipConfigValue_t2_tRP, "t2 tRP", ValueRange(0, 7, 1));
|
addConfigTrackbar(KipConfigValue_t2_tRP, "t2 tRP", ValueRange(0, 7, 1));
|
||||||
addConfigTrackbar(KipConfigValue_t3_tRAS, "t3 tRAS", ValueRange(0, 9, 1));
|
addConfigTrackbar(KipConfigValue_t3_tRAS, "t3 tRAS", ValueRange(0, 9, 1));
|
||||||
addConfigTrackbar(KipConfigValue_t4_tRRD, "t4 tRRD", ValueRange(0, 6, 1));
|
addConfigTrackbar(KipConfigValue_t4_tRRD, "t4 tRRD", ValueRange(0, IsErista() ? 7u : 6u , 1));
|
||||||
addConfigTrackbar(KipConfigValue_t5_tRFC, "t5 tRFC", ValueRange(0, IsErista() ? 5u : 10u, 1));
|
addConfigTrackbar(KipConfigValue_t5_tRFC, "t5 tRFC", ValueRange(0, IsErista() ? 5u : 10u, 1));
|
||||||
addConfigTrackbar(KipConfigValue_t6_tRTW, "t6 tRTW", ValueRange(0, 9, 1));
|
addConfigTrackbar(KipConfigValue_t6_tRTW, "t6 tRTW", ValueRange(0, 9, 1));
|
||||||
addConfigTrackbar(KipConfigValue_t7_tWTR, "t7 tWTR", ValueRange(0, 9, 1));
|
addConfigTrackbar(KipConfigValue_t7_tWTR, "t7 tWTR", ValueRange(0, 9, 1));
|
||||||
|
|||||||
@@ -134,8 +134,9 @@ namespace board {
|
|||||||
HandleCpuUv();
|
HandleCpuUv();
|
||||||
}
|
}
|
||||||
if (useGm20b) {
|
if (useGm20b) {
|
||||||
gm20b::setClock(hz / 1000);
|
if (gm20b::setClock(hz / 1000)) {
|
||||||
currentInjectedHz = hz;
|
currentInjectedHz = hz;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,7 +154,11 @@ namespace board {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (module == HocClkModule_GPU && currentInjectedHz != 0) {
|
if (module == HocClkModule_GPU && currentInjectedHz != 0) {
|
||||||
return currentInjectedHz;
|
if (GetRealHz(HocClkModule_GPU) != currentInjectedHz) {
|
||||||
|
currentInjectedHz = 0;
|
||||||
|
} else {
|
||||||
|
return currentInjectedHz;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HOSSVC_HAS_CLKRST) {
|
if (HOSSVC_HAS_CLKRST) {
|
||||||
|
|||||||
@@ -21,9 +21,27 @@
|
|||||||
|
|
||||||
namespace governor {
|
namespace governor {
|
||||||
|
|
||||||
#define POLL_NS 5'000'000 // 5 ms – governor poll rate
|
#define DOWN_HOLD_TICKS_DEFAULT 10 // 50 ms at 5ms poll – how long to hold while ramping down
|
||||||
#define DOWN_HOLD_TICKS 10 // 50 ms – how long to in POLL_NS to hold while ramping down
|
#define STEP_UTIL_DEFAULT 900 // multiplier for step calculations (max freq at 90% load)
|
||||||
#define STEP_UTIL 900 // multiplier for step calculations
|
|
||||||
|
u64 GovernorPollNs() {
|
||||||
|
u64 ms = config::GetConfigValue(HocClkConfigValue_GovernorPollRateMs);
|
||||||
|
if (ms < 1 || ms > 50)
|
||||||
|
ms = 5;
|
||||||
|
return ms * 1'000'000ULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 GovernorDownHoldTicks() {
|
||||||
|
u64 ticks = config::GetConfigValue(HocClkConfigValue_GovernorDownHoldTicks);
|
||||||
|
return (ticks <= 100) ? (u32)ticks : DOWN_HOLD_TICKS_DEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 GovernorStepUtil() {
|
||||||
|
u64 step = config::GetConfigValue(HocClkConfigValue_GovernorStepUtil);
|
||||||
|
if (step < 100 || step > 1500)
|
||||||
|
step = STEP_UTIL_DEFAULT;
|
||||||
|
return (u32)step;
|
||||||
|
}
|
||||||
|
|
||||||
bool isGpuGovernorEnabled = false;
|
bool isGpuGovernorEnabled = false;
|
||||||
bool isCpuGovernorEnabled = false;
|
bool isCpuGovernorEnabled = false;
|
||||||
@@ -82,7 +100,7 @@ namespace governor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
u32 SchedutilTargetHz(u32 util, u32 tableMaxHz) {
|
u32 SchedutilTargetHz(u32 util, u32 tableMaxHz) {
|
||||||
u64 hz = (u64)tableMaxHz * util / STEP_UTIL;
|
u64 hz = (u64)tableMaxHz * util / GovernorStepUtil();
|
||||||
return (u32)(std::min(hz, static_cast<u64>(tableMaxHz)));
|
return (u32)(std::min(hz, static_cast<u64>(tableMaxHz)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,13 +133,14 @@ namespace governor {
|
|||||||
u8 vrrFocusTick = 0;
|
u8 vrrFocusTick = 0;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
const u64 pollNs = GovernorPollNs();
|
||||||
|
|
||||||
if (!clockManager::gRunning) {
|
if (!clockManager::gRunning) {
|
||||||
cpuDownHoldRemaining = 0;
|
cpuDownHoldRemaining = 0;
|
||||||
cpuLastHz = 0;
|
cpuLastHz = 0;
|
||||||
gpuDownHoldRemaining = 0;
|
gpuDownHoldRemaining = 0;
|
||||||
gpuLastHz = 0;
|
gpuLastHz = 0;
|
||||||
svcSleepThread(POLL_NS);
|
svcSleepThread(pollNs);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,7 +175,7 @@ namespace governor {
|
|||||||
if (!goingDown)
|
if (!goingDown)
|
||||||
cpuDownHoldRemaining = 0;
|
cpuDownHoldRemaining = 0;
|
||||||
else if (cpuDownHoldRemaining == 0)
|
else if (cpuDownHoldRemaining == 0)
|
||||||
cpuDownHoldRemaining = DOWN_HOLD_TICKS;
|
cpuDownHoldRemaining = GovernorDownHoldTicks();
|
||||||
|
|
||||||
if (cpuDownHoldRemaining > 0)
|
if (cpuDownHoldRemaining > 0)
|
||||||
cpuDownHoldRemaining--;
|
cpuDownHoldRemaining--;
|
||||||
@@ -212,7 +231,7 @@ namespace governor {
|
|||||||
if (!goingDown)
|
if (!goingDown)
|
||||||
gpuDownHoldRemaining = 0;
|
gpuDownHoldRemaining = 0;
|
||||||
else if (gpuDownHoldRemaining == 0)
|
else if (gpuDownHoldRemaining == 0)
|
||||||
gpuDownHoldRemaining = DOWN_HOLD_TICKS;
|
gpuDownHoldRemaining = GovernorDownHoldTicks();
|
||||||
|
|
||||||
if (gpuDownHoldRemaining > 0)
|
if (gpuDownHoldRemaining > 0)
|
||||||
gpuDownHoldRemaining--;
|
gpuDownHoldRemaining--;
|
||||||
@@ -290,7 +309,7 @@ namespace governor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
svcSleepThread(POLL_NS);
|
svcSleepThread(pollNs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user