ldr: fix rext

This commit is contained in:
Lightos1 committed 2026-08-03 20:37:10 +02:00
1 parent 8476969576
commit 2375210fee
4 files changed
+8 -11

No files matched your search

@@ -20,8 +20,8 @@
namespace ams::ldr::hoc::pcv::mariko {
void GetRext() {
if (auto r = FindRext()) {
void GetRext(u32 freq) {
if (auto r = FindRext(freq)) {
rext = r->rext;
return;
}
@@ -46,7 +46,7 @@ namespace ams::ldr::hoc::pcv::mariko {
}
void AutoLatency(volatile u32 &latency, u32 freq, u32 latencyStep) {
if (freq > 1600'000 && freq <= 1862'400) { /* 1866tRWL */
if (freq > 1600'000 && freq <= 1866'000) { /* 1866tRWL */
latency += latencyStep * 2;
} else { /* 2133tRWL */
latency += latencyStep * 3;
@@ -130,10 +130,8 @@ namespace ams::ldr::hoc::pcv::mariko {
HandleLatency(freq);
GetRext();
GetRext(freq);
/* At 1333WL, for some reason (incorrect ram timing config in mtc table?), tRP causes crashes at high reductions - 2 seems to be the most common limit. */
/* This is a lazy workaround until I find the issue... */
const bool lowFreq = freq < C.timingEmcTbreak;
tRCD = tRCD_values[lowFreq ? C.low_t1_tRCD : C.t1_tRCD];
@@ -315,6 +315,7 @@ namespace ams::ldr::hoc::pcv::mariko {
cmd.val = val;
Result res = i2csessionSendAuto(&_session, &cmd, sizeof(cmd), I2cTransactionOption_All);
i2csessionClose(&_session);
return res;
}
@@ -350,8 +351,6 @@ namespace ams::ldr::hoc::pcv::mariko {
Result resultI2C = I2cSet_U8(I2cDevice_Max77812_2, 0x25, (emc_uv - uv_min) / uv_step);
i2cExit();
R_SUCCEED();
return resultI2C;
}
@@ -35,9 +35,9 @@ namespace ams::ldr::hoc::pcv::mariko {
const u32 g_rext_table_size = sizeof(g_rext_table) / sizeof(g_rext_table[0]);
const ReplacePatch *FindRext() {
const ReplacePatch *FindRext(u32 freq) {
for (u32 i = 0; i < g_rext_table_size; i++) {
if (g_rext_table[i].freq >= C.marikoEmcMaxClock) {
if (g_rext_table[i].freq >= freq) {
return &g_rext_table[i];
}
}
@@ -26,6 +26,6 @@ namespace ams::ldr::hoc::pcv::mariko {
extern const ReplacePatch g_rext_table[];
extern const u32 g_rext_table_size;
const ReplacePatch *FindRext();
const ReplacePatch *FindRext(u32 freq);
}