diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/customize.cpp b/Source/Atmosphere/stratosphere/loader/source/oc/customize.cpp index 3e736d9a..1e90fc1d 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/customize.cpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/customize.cpp @@ -22,7 +22,7 @@ /* Never edit these. */ #define AUTO 0 -#define AUTO_RAM 1 +#define AUTO_RAM 0 #define ENABLED 1 #define DISABLED 0 #define DEACTIVATED_GPU_FREQ 2000 @@ -105,7 +105,7 @@ volatile CustomizeTable C = { /* For automatic vmin detection, set this to AUTO. */ /* vmin past 795mV won't work due to HOS limitation */ /* Vmin is automatically set to 800mV when SoC temperature is below 20C */ -.marikoGpuVmin = AUTO_RAM, +.marikoGpuVmin = AUTO, .marikoGpuVmax = 800, diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/customize.hpp b/Source/Atmosphere/stratosphere/loader/source/oc/customize.hpp index ac1eb96a..65051d39 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/customize.hpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/customize.hpp @@ -126,6 +126,7 @@ typedef struct CustomizeTable { u32 eristaGpuVoltArray[27]; u32 marikoGpuVoltArray[24]; + u32 fineTune_t6_tRTW; u32 fineTune_t7_tWTR; u32 reserved[60]; diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/mtc_timing_value.hpp b/Source/Atmosphere/stratosphere/loader/source/oc/mtc_timing_value.hpp index dca68572..4d8d45a3 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/mtc_timing_value.hpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/mtc_timing_value.hpp @@ -132,6 +132,7 @@ namespace ams::ldr::hoc { const double tRRD = tRRD_values[C.t4_tRRD]; const u32 tRFCpb = tRFC_values[C.t5_tRFC]; const u32 tWTR = 10 - tWTR_values[C.t7_tWTR]; + const s32 finetRTW = C.fineTune_t6_tRTW; const s32 finetWTR = C.fineTune_t7_tWTR; const u32 tRC = tRAS + tRPpb; @@ -141,7 +142,7 @@ namespace ams::ldr::hoc { const double tRPab = tRPpb + 3; const u32 tR2P = CEIL((RL_DBI * 0.426) - 2.0); - const u32 tR2W = FLOOR(FLOOR((5.0 / tCK_avg) + ((FLOOR(48.0 / WL) - 0.478) * 3.0)) / 1.501) + RL_DBI - (C.t6_tRTW * 3); + const u32 tR2W = FLOOR(FLOOR((5.0 / tCK_avg) + ((FLOOR(48.0 / WL) - 0.478) * 3.0)) / 1.501) + RL_DBI - (C.t6_tRTW * 3) + finetRTW; const u32 tRTM = FLOOR((10.0 + RL_DBI) + (3.502 / tCK_avg)) + FLOOR(7.489 / tCK_avg); const u32 tRATM = CEIL((tRTM - 10.0) + (RL_DBI * 0.426)); inline u32 rext; diff --git a/Source/sys-clk/common/include/sysclk/config.h b/Source/sys-clk/common/include/sysclk/config.h index 864a1735..d4f06a76 100644 --- a/Source/sys-clk/common/include/sysclk/config.h +++ b/Source/sys-clk/common/include/sysclk/config.h @@ -158,6 +158,7 @@ typedef enum { KipConfigValue_g_volt_e_1036800, KipConfigValue_g_volt_e_1075200, + KipConfigValue_t6_tRTW_fine_tune, KipConfigValue_t7_tWTR_fine_tune, KipCrc32, @@ -372,6 +373,7 @@ static inline const char* sysclkFormatConfigValue(SysClkConfigValue val, bool pr case KipConfigValue_g_volt_e_998400: return pretty ? "Erista GPU Volt 998 MHz" : "g_volt_e_998400"; case KipConfigValue_g_volt_e_1036800: return pretty ? "Erista GPU Volt 1036 MHz" : "g_volt_e_1036800"; case KipConfigValue_g_volt_e_1075200: return pretty ? "Erista GPU Volt 1075 MHz" : "g_volt_e_1075200"; + case KipConfigValue_t6_tRTW_fine_tune: return pretty ? "t6 - tRTW Fine Tune" : "t6_tRTW_fine_fune"; case KipConfigValue_t7_tWTR_fine_tune: return pretty ? "t7 - tWTR Fine Tune" : "t7_tWTR_fine_tune"; case KipCrc32: return pretty ? "CRC32" : "crc32"; @@ -537,6 +539,7 @@ static inline uint64_t sysclkValidConfigValue(SysClkConfigValue val, uint64_t in case KipConfigValue_g_volt_e_1075200: case KipConfigValue_eristaCpuVmin: case KipConfigValue_eristaCpuUnlock: + case KipConfigValue_t6_tRTW_fine_tune: case KipConfigValue_t7_tWTR_fine_tune: case KipCrc32: return true; diff --git a/Source/sys-clk/overlay/src/ui/gui/misc_gui.cpp b/Source/sys-clk/overlay/src/ui/gui/misc_gui.cpp index 95213e5d..933fdf40 100644 --- a/Source/sys-clk/overlay/src/ui/gui/misc_gui.cpp +++ b/Source/sys-clk/overlay/src/ui/gui/misc_gui.cpp @@ -652,6 +652,14 @@ protected: addConfigButton(KipConfigValue_t7_tWTR, "t7 tWTR", ValueRange(0, 10, 1, "", 1), "tWTR", &thresholdsDisabled, {}, {}, false); addConfigButton(KipConfigValue_t8_tREFI, "t8 tREFI", ValueRange(0, 6, 1, "", 1), "tREFI", &thresholdsDisabled, {}, {}, false); + std::vector t6_tRTW_fine_tune = { + NamedValue("-2", 0xFFFFFFFE), + NamedValue("-1", 0xFFFFFFFF), + NamedValue(" 0", 0), + NamedValue("+1", 1), + NamedValue("+2", 2), + }; + std::vector t7_tWTR_fine_tune = { NamedValue("-3", 0xFFFFFFFD), NamedValue("-2", 0xFFFFFFFE), @@ -663,7 +671,8 @@ protected: }; this->listElement->addItem(new tsl::elm::CategoryHeader("Advanced")); - addConfigButton(KipConfigValue_t7_tWTR_fine_tune, "t7 tWTR Fine Tune", ValueRange(0, 6, 1, "", 0), "t7 tWTR Fine Tune", &thresholdsDisabled, {}, t7_tWTR_fine_tune, false); + addConfigButton(KipConfigValue_t6_tRTW_fine_tune, "t6 tRTW Fine Tune", ValueRange(0, 4, 1, "", 0), "tRTW Fine Tune", &thresholdsDisabled, {}, t6_tRTW_fine_tune, false); + addConfigButton(KipConfigValue_t7_tWTR_fine_tune, "t7 tWTR Fine Tune", ValueRange(0, 6, 1, "", 0), "tWTR Fine Tune", &thresholdsDisabled, {}, t7_tWTR_fine_tune, false); #if IS_MINIMAL == 0 if(IsMariko()) { diff --git a/Source/sys-clk/sysmodule/src/clock_manager.cpp b/Source/sys-clk/sysmodule/src/clock_manager.cpp index a21f6d5c..7715ce8c 100644 --- a/Source/sys-clk/sysmodule/src/clock_manager.cpp +++ b/Source/sys-clk/sysmodule/src/clock_manager.cpp @@ -816,6 +816,7 @@ void ClockManager::SetKipData() { table.eristaGpuVoltArray[i] = this->config->GetConfigValue((SysClkConfigValue)(KipConfigValue_g_volt_e_76800 + i)); } + CUST_WRITE_FIELD_BATCH(&table, t6_tRTW_fine_tune, this->config->GetConfigValue(KipConfigValue_t6_tRTW_fine_tune)); CUST_WRITE_FIELD_BATCH(&table, t7_tWTR_fine_tune, this->config->GetConfigValue(KipConfigValue_t7_tWTR_fine_tune)); if (!cust_write_table("sdmc:/atmosphere/kips/hoc.kip", &table)) { @@ -927,6 +928,7 @@ void ClockManager::GetKipData() { initialConfigValues[KipConfigValue_marikoGpuVmax] = cust_get_mariko_gpu_vmax(&table); initialConfigValues[KipConfigValue_commonGpuVoltOffset] = cust_get_common_gpu_offset(&table); initialConfigValues[KipConfigValue_gpuSpeedo] = cust_get_gpu_speedo(&table); + initialConfigValues[KipConfigValue_t6_tRTW_fine_tune] = cust_get_tRTW_fine_tune(&table); initialConfigValues[KipConfigValue_t7_tWTR_fine_tune] = cust_get_tWTR_fine_tune(&table); } @@ -985,6 +987,7 @@ void ClockManager::GetKipData() { } configValues.values[KipConfigValue_t7_tWTR_fine_tune] = cust_get_tWTR_fine_tune(&table); + configValues.values[KipConfigValue_t6_tRTW_fine_tune] = cust_get_tRTW_fine_tune(&table); // if(cust_get_cust_rev(&table) == KIP_CUST_REV) // return; diff --git a/Source/sys-clk/sysmodule/src/kip.h b/Source/sys-clk/sysmodule/src/kip.h index 6dc093f6..85f4222f 100644 --- a/Source/sys-clk/sysmodule/src/kip.h +++ b/Source/sys-clk/sysmodule/src/kip.h @@ -78,6 +78,7 @@ typedef struct { u32 eristaGpuVoltArray[27]; u32 marikoGpuVoltArray[24]; + u32 t6_tRTW_fine_tune; u32 t7_tWTR_fine_tune; u32 reserved[60]; @@ -203,6 +204,7 @@ static inline bool cust_set_tRFC(const char* p, u32 v) { CUST_WRITE_FIELD(p, t5_ static inline bool cust_set_tRTW(const char* p, u32 v) { CUST_WRITE_FIELD(p, t6_tRTW, v); } static inline bool cust_set_tWTR(const char* p, u32 v) { CUST_WRITE_FIELD(p, t7_tWTR, v); } static inline bool cust_set_tREFI(const char* p, u32 v) { CUST_WRITE_FIELD(p, t8_tREFI, v); } +static inline bool cust_set_tRTW_fine_tune(const char* p, u32 v) { CUST_WRITE_FIELD(p, t6_tRTW_fine_tune, v); } static inline bool cust_set_tWTR_fine_tune(const char* p, u32 v) { CUST_WRITE_FIELD(p, t7_tWTR_fine_tune, v); } static inline bool cust_set_burst_read_lat(const char* p, u32 v) { CUST_WRITE_FIELD(p, mem_burst_read_latency, v); } static inline bool cust_set_burst_write_lat(const char* p, u32 v) { CUST_WRITE_FIELD(p, mem_burst_write_latency, v); } @@ -271,6 +273,7 @@ static inline u32 cust_get_tRFC(const CustomizeTable* t) { return CUST_GET_FIELD static inline u32 cust_get_tRTW(const CustomizeTable* t) { return CUST_GET_FIELD(t, t6_tRTW); } static inline u32 cust_get_tWTR(const CustomizeTable* t) { return CUST_GET_FIELD(t, t7_tWTR); } static inline u32 cust_get_tREFI(const CustomizeTable* t) { return CUST_GET_FIELD(t, t8_tREFI); } +static inline u32 cust_get_tRTW_fine_tune(const CustomizeTable* t) { return CUST_GET_FIELD(t, t6_tRTW_fine_tune); } static inline u32 cust_get_tWTR_fine_tune(const CustomizeTable* t) { return CUST_GET_FIELD(t, t7_tWTR_fine_tune); } static inline u32 cust_get_burst_read_lat(const CustomizeTable* t) { return CUST_GET_FIELD(t, mem_burst_read_latency); } static inline u32 cust_get_burst_write_lat(const CustomizeTable* t) { return CUST_GET_FIELD(t, mem_burst_write_latency); }