This commit is contained in:
hanai3Bi
2023-04-01 01:49:31 +03:00
committed by hanabbi
parent 63bbde2f58
commit 3db0b9b380
210 changed files with 1286 additions and 48394 deletions

View File

@@ -66,14 +66,13 @@ typedef struct
SysClkProfile realProfile;
} SysClkOcExtra;
#define FREQ_TABLE_MAX_ENTRY_COUNT 31
typedef struct
{
uint32_t values[20];
uint32_t freq[FREQ_TABLE_MAX_ENTRY_COUNT];
} SysClkFrequencyTable;
uint32_t* GetModuleFreqTable(SysClkModule module);
uint32_t GetModuleMaximumFreq(SysClkModule module);
typedef enum {
SysClkOcGovernorConfig_AllDisabled = 0,
SysClkOcGovernorConfig_CPU_Shift = 0,

View File

@@ -13,6 +13,8 @@
#include <stdint.h>
#include <stddef.h>
const uint32_t CHARGING_CURRENT_MA_LIMIT = 3000;
typedef enum {
SysClkConfigValue_PollingIntervalMs = 0,
SysClkConfigValue_TempLogIntervalMs,
@@ -95,7 +97,7 @@ static inline uint64_t sysclkValidConfigValue(SysClkConfigValue val, uint64_t in
case SysClkConfigValue_GovernorExperimental:
return (input & 0x1) == input;
case SysClkConfigValue_ChargingCurrentLimit:
return (input >= 100 && input <= 2000 && input % 100 == 0);
return (input >= 100 && input <= CHARGING_CURRENT_MA_LIMIT && input % 100 == 0);
case SysClkConfigValue_ChargingLimitPercentage:
return (input <= 100 && input >= 20);
default:

View File

@@ -18,4 +18,5 @@ typedef enum
SysClkError_Generic = 0,
SysClkError_ConfigNotLoaded = 1,
SysClkError_ConfigSaveFailed = 2,
SysClkError_InternalFrequencyTableError = 3,
} SysClkError;

View File

@@ -13,7 +13,7 @@
#include <stdint.h>
#include "clocks.h"
#define SYSCLK_IPC_API_VERSION 1
#define SYSCLK_IPC_API_VERSION 2
#define SYSCLK_IPC_SERVICE_NAME "sysclkOC"
enum SysClkIpcCmd

View File

@@ -1,99 +0,0 @@
/*
* --------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <p-sam@d3vs.net>, <natinusala@gmail.com>, <m4x@m4xw.net>
* wrote this file. As long as you retain this notice you can do whatever you
* want with this stuff. If you meet any of us some day, and you think this
* stuff is worth it, you can buy us a beer in return. - The sys-clk authors
* --------------------------------------------------------------------------
*/
#include <stdint.h>
#include <sysclk/clocks.h>
uint32_t g_freq_table_mem_hz[] = {
// From Hekate Minerva module
665600000,
800000000,
1065600000,
1331200000,
1600000000,
// 1728000000,
// 1795200000,
1862400000, // Max Hz
// 1894400000,
// 1932800000,
// 1996800000,
// 2064000000,
// 2099200000,
// 2131200000,
0,
};
uint32_t g_freq_table_cpu_hz[] = {
408000000,
510000000,
612000000,
714000000,
816000000,
918000000,
1020000000,
1122000000,
1224000000,
1326000000,
1428000000,
1581000000,
1683000000,
1785000000,
1887000000,
1963500000,
2091000000,
2193000000,
2295000000,
2397000000,
0,
};
uint32_t g_freq_table_gpu_hz[] = {
76800000,
153600000,
230400000,
307200000,
384000000,
460800000,
537600000,
614400000,
691200000,
768000000,
844800000,
921600000,
998400000,
1075200000,
1152000000,
1228800000,
1267200000,
1305600000,
0,
};
uint32_t* GetModuleFreqTable(SysClkModule module) {
switch (module) {
case SysClkModule_CPU:
return &g_freq_table_cpu_hz[0];
case SysClkModule_GPU:
return &g_freq_table_gpu_hz[0];
case SysClkModule_MEM:
return &g_freq_table_mem_hz[0];
default:
return NULL;
}
}
uint32_t GetModuleMaximumFreq(SysClkModule module) {
uint32_t* p = GetModuleFreqTable(module);
if (p == NULL || *p == 0)
return UINT32_MAX;
while (*(++p));
return *(--p);
}