add stable struct to HocClkContext
This commit is contained in:
@@ -30,8 +30,24 @@
|
||||
#include <stdint.h>
|
||||
#include "board.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
|
||||
struct {
|
||||
#define HocClkModuleStable_EnumMax 5
|
||||
#define HocClkThermalSensorStable_EnumMax 11
|
||||
#define HocClkPowerSensorStable_EnumMax 2
|
||||
#define HocClkRamLoadStable_EnumMax 10
|
||||
#define HocClkVoltageStable_EnumMax 7
|
||||
|
||||
u32 freqs[HocClkModuleStable_EnumMax];
|
||||
u32 realFreqs[HocClkModuleStable_EnumMax];
|
||||
u32 overrideFreqs[HocClkModuleStable_EnumMax];
|
||||
s32 temps[HocClkThermalSensorStable_EnumMax];
|
||||
u32 power[HocClkPowerSensorStable_EnumMax];
|
||||
u32 partLoad[HocClkRamLoadStable_EnumMax];
|
||||
u32 voltages[HocClkVoltageStable_EnumMax];
|
||||
} stable;
|
||||
|
||||
uint64_t applicationId;
|
||||
HocClkProfile profile;
|
||||
uint32_t freqs[HocClkModule_EnumMax];
|
||||
@@ -60,7 +76,7 @@ typedef struct
|
||||
u16 resolutionHeight;
|
||||
|
||||
// Reserved for future use
|
||||
u8 reserved[0x41C];
|
||||
u8 reserved[0x368];
|
||||
} HocClkContext;
|
||||
|
||||
typedef struct
|
||||
|
||||
@@ -375,6 +375,9 @@ namespace clockManager {
|
||||
board::SetHz(HocClkModule_Display, targetHz);
|
||||
gContext.freqs[HocClkModule_Display] = targetHz;
|
||||
gContext.realFreqs[HocClkModule_Display] = targetHz;
|
||||
|
||||
gContext.stable.freqs[HocClkModule_Display] = targetHz;
|
||||
gContext.stable.realFreqs[HocClkModule_Display] = targetHz;
|
||||
} else {
|
||||
HandleFreqReset(HocClkModule_Display, isBoost, didHijackPcv);
|
||||
}
|
||||
@@ -409,6 +412,7 @@ namespace clockManager {
|
||||
|
||||
board::SetHz((HocClkModule)module, nearestHz);
|
||||
gContext.freqs[module] = nearestHz;
|
||||
gContext.stable.freqs[module] = nearestHz;
|
||||
|
||||
if (module == HocClkModule_CPU && config::GetConfigValue(HocClkConfigValue_LiveCpuUv)) {
|
||||
HandleCpuUv();
|
||||
@@ -465,6 +469,7 @@ namespace clockManager {
|
||||
if (hz != 0 && hz != gContext.freqs[module]) {
|
||||
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.stable.freqs[module] = hz;
|
||||
hasChanged = true;
|
||||
}
|
||||
|
||||
@@ -474,6 +479,7 @@ namespace clockManager {
|
||||
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.stable.overrideFreqs[module] = hz;
|
||||
hasChanged = true;
|
||||
}
|
||||
}
|
||||
@@ -489,6 +495,7 @@ namespace clockManager {
|
||||
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.stable.temps[sensor] = millis;
|
||||
}
|
||||
|
||||
// power stats do not and should not force a refresh, hasChanged untouched
|
||||
@@ -500,6 +507,7 @@ namespace clockManager {
|
||||
fileUtils::LogLine("[mgr] Power %s: %d mW", board::GetPowerSensorName((HocClkPowerSensor)sensor, false), mw);
|
||||
}
|
||||
gContext.power[sensor] = mw;
|
||||
gContext.stable.power[sensor] = mw;
|
||||
}
|
||||
|
||||
// real freqs do not and should not force a refresh, hasChanged untouched
|
||||
@@ -511,15 +519,18 @@ namespace clockManager {
|
||||
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.stable.realFreqs[module] = realHz;
|
||||
}
|
||||
|
||||
// ram load do not and should not force a refresh, hasChanged untouched
|
||||
for (unsigned int loadSource = 0; loadSource < HocClkPartLoad_EnumMax; loadSource++) {
|
||||
gContext.partLoad[loadSource] = board::GetPartLoad((HocClkPartLoad)loadSource);
|
||||
gContext.stable.partLoad[loadSource] = board::GetPartLoad((HocClkPartLoad)loadSource);
|
||||
}
|
||||
|
||||
for (unsigned int voltageSource = 0; voltageSource < HocClkVoltage_EnumMax; voltageSource++) {
|
||||
gContext.voltages[voltageSource] = board::GetVoltage((HocClkVoltage)voltageSource);
|
||||
gContext.stable.voltages[voltageSource] = board::GetVoltage((HocClkVoltage)voltageSource);
|
||||
}
|
||||
|
||||
if (ConfigIntervalTimeout(HocClkConfigValue_CsvWriteIntervalMs, ns, &gLastCsvWriteNs)) {
|
||||
@@ -559,6 +570,9 @@ namespace clockManager {
|
||||
gContext.freqs[module] = 0;
|
||||
gContext.realFreqs[module] = 0;
|
||||
gContext.overrideFreqs[module] = 0;
|
||||
gContext.stable.freqs[module] = 0;
|
||||
gContext.stable.realFreqs[module] = 0;
|
||||
gContext.stable.overrideFreqs[module] = 0;
|
||||
RefreshFreqTableRow((HocClkModule)module);
|
||||
}
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace governor {
|
||||
u32 targetHz = ResolveTargetHz(HocClkModule_CPU);
|
||||
u32 maxHz = clockManager::GetMaxAllowedHz(HocClkModule_CPU, clockManager::gContext.profile);
|
||||
|
||||
if (targetHz && desiredHz > targetHz)
|
||||
if (targetHz && desiredHz > targetHz)
|
||||
desiredHz = targetHz;
|
||||
if (maxHz && desiredHz > maxHz)
|
||||
desiredHz = maxHz;
|
||||
@@ -171,6 +171,7 @@ namespace governor {
|
||||
if ((!goingDown || (cpuDownHoldRemaining == 0)) && clockManager::IsAssignableHz(HocClkModule_CPU, newHz)) {
|
||||
board::SetHz(HocClkModule_CPU, newHz);
|
||||
clockManager::gContext.freqs[HocClkModule_CPU] = newHz;
|
||||
clockManager::gContext.stable.freqs[HocClkModule_CPU] = newHz;
|
||||
cpuLastHz = newHz;
|
||||
}
|
||||
}
|
||||
@@ -209,6 +210,7 @@ namespace governor {
|
||||
if ((!goingDown || (gpuDownHoldRemaining == 0)) && clockManager::IsAssignableHz(HocClkModule_GPU, newHz)) {
|
||||
board::SetHz(HocClkModule_GPU, newHz);
|
||||
clockManager::gContext.freqs[HocClkModule_GPU] = newHz;
|
||||
clockManager::gContext.stable.freqs[HocClkModule_GPU] = newHz;
|
||||
gpuLastHz = newHz;
|
||||
}
|
||||
} else {
|
||||
@@ -250,6 +252,8 @@ namespace governor {
|
||||
board::SetHz(HocClkModule_Display, fps);
|
||||
clockManager::gContext.freqs[HocClkModule_Display] = fps;
|
||||
clockManager::gContext.realFreqs[HocClkModule_Display] = fps;
|
||||
clockManager::gContext.stable.freqs[HocClkModule_Display] = fps;
|
||||
clockManager::gContext.stable.realFreqs[HocClkModule_Display] = fps;
|
||||
} else {
|
||||
for (u32 i = 0; i < 10; i++) {
|
||||
u32 compareHz = fps * i;
|
||||
@@ -257,6 +261,8 @@ namespace governor {
|
||||
board::SetHz(HocClkModule_Display, compareHz);
|
||||
clockManager::gContext.freqs[HocClkModule_Display] = compareHz;
|
||||
clockManager::gContext.realFreqs[HocClkModule_Display] = compareHz;
|
||||
clockManager::gContext.stable.freqs[HocClkModule_Display] = compareHz;
|
||||
clockManager::gContext.stable.realFreqs[HocClkModule_Display] = compareHz;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user