Remove uv3, adjust uv2; todo fix inbetween freq disabling

This commit is contained in:
Lightos1
2025-12-17 19:52:05 +01:00
parent 8a9fc3b5e0
commit eae7ac8d5c
2 changed files with 85 additions and 86 deletions

View File

@@ -20,9 +20,11 @@
#include "customize.hpp" #include "customize.hpp"
/* Never edit these. */
#define AUTO 0 #define AUTO 0
#define ENABLED 1 #define ENABLED 1
#define DISABLED 0 #define DISABLED 0
#define DEACTIVATED_GPU_FREQ 2000
#define CPU_MAX_MAX_VOLT 1235000 #define CPU_MAX_MAX_VOLT 1235000
namespace ams::ldr::oc { namespace ams::ldr::oc {
@@ -38,8 +40,8 @@ volatile CustomizeTable C = {
.commonEmcMemVolt = 1175000, // LPDDR4X JEDEC Specification .commonEmcMemVolt = 1175000, // LPDDR4X JEDEC Specification
.eristaEmcMaxClock = 1600000, // Maximum HB-MGCH ram rating .eristaEmcMaxClock = 1600000, // Maximum HB-MGCH ram rating
.marikoEmcMaxClock = 2133000, // Hynix NME and Samsung AM-MGCJ Rating (others are 4766MT, 2133MHz) .marikoEmcMaxClock = 2133000,
.marikoEmcVddqVolt = 600000, .marikoEmcVddqVolt = 640000,
.emcDvbShift = 0, .emcDvbShift = 0,
// Primary // Primary
@@ -76,7 +78,7 @@ volatile CustomizeTable C = {
.marikoGpuUV = 0, .marikoGpuUV = 0,
/* For automatic vmin detection, set this to AUTO. */ /* For automatic vmin detection, set this to AUTO. */
.marikoGpuVmin = 610, .marikoGpuVmin = 621,
.marikoGpuVmax = 800, .marikoGpuVmax = 800,
@@ -91,68 +93,69 @@ volatile CustomizeTable C = {
/* No warranty is provided in any way whatsoever. */ /* No warranty is provided in any way whatsoever. */
.marikoGpuFullUnlock = DISABLED, .marikoGpuFullUnlock = DISABLED,
// NOTE: These tables should NOT BE USED and are only here as placeholders. Always try and find your own optimal tables. /* This table is used with a gpu uv mode of 2. */
// Ensure the voltages actually increase or stay the sameot /* Setting DEACTIVATED_GPU_FREQ on any freq will disable it and all freqs greater than it. (the latter is a bug :/) */
/* AUTO: Voltage is optimally chosen; with commonGpuVoltOffset applied. */
/* AUTO only works up to 1305 GPU */
/* You can overwrite auto with any voltage (in mv) of your choice - offset will not be applied. */
.eristaGpuVoltArray = { .eristaGpuVoltArray = {
750 /* 76 */, AUTO /* 76 */,
750 /* 115 */, AUTO /* 115 */,
750 /* 153 */, AUTO /* 153 */,
750 /* 192 */, AUTO /* 192 */,
750 /* 230 */, AUTO /* 230 */,
775 /* 269 */, AUTO /* 269 */,
775 /* 307 */, AUTO /* 307 */,
800 /* 346 */, AUTO /* 346 */,
800 /* 384 */, AUTO /* 384 */,
825 /* 422 */, AUTO /* 422 */,
825 /* 460 */, AUTO /* 460 */,
850 /* 499 */, AUTO /* 499 */,
850 /* 537 */, AUTO /* 537 */,
875 /* 576 */, AUTO /* 576 */,
875 /* 614 */, AUTO /* 614 */,
900 /* 652 */, AUTO /* 652 */,
900 /* 691 */, AUTO /* 691 */,
925 /* 729 */, AUTO /* 729 */,
925 /* 768 */, AUTO /* 768 */,
950 /* 806 */, AUTO /* 806 */,
950 /* 844 */, AUTO /* 844 */,
975 /* 883 */, AUTO /* 883 */,
975 /* 921 */, AUTO /* 921 */,
0 /* 960 (Disabled by default) */, DEACTIVATED_GPU_FREQ /* 960 (Disabled by default) */,
0 /* 998 (Disabled by default) */, DEACTIVATED_GPU_FREQ /* 998 (Disabled by default) */,
0 /* 1036 (Disabled by default) */, DEACTIVATED_GPU_FREQ /* 1036 (Disabled by default) */,
0 /* 1075 (Disabled by default) */, DEACTIVATED_GPU_FREQ /* 1075 (Disabled by default) */,
}, },
.marikoGpuVoltArray = { .marikoGpuVoltArray = {
610 /* 76 */, AUTO /* 76 */,
610 /* 153 */, AUTO /* 153 */,
610 /* 230 */, AUTO /* 230 */,
610 /* 307 */, AUTO /* 307 */,
610 /* 384 */, AUTO /* 384 */,
610 /* 460 */, AUTO /* 460 */,
610 /* 537 */, AUTO /* 537 */,
610 /* 614 */, 700 /* 614 */,
615 /* 691 */, AUTO /* 691 */,
625 /* 768 */, AUTO /* 768 */,
635 /* 844 */, AUTO /* 844 */,
655 /* 921 */, AUTO /* 921 */,
690 /* 998 */, AUTO /* 998 */,
725 /* 1075 */, AUTO /* 1075 */,
750 /* 1152 */, AUTO /* 1152 */,
800 /* 1228 */, AUTO /* 1228 */,
0 /* 1267 (Disabled by default) */, AUTO /* 1267 (Disabled by default) */,
0 /* 1305 (Disabled by default) */, DEACTIVATED_GPU_FREQ /* 1305 (Disabled by default) */,
0 /* 1344 (Disabled by default) */, DEACTIVATED_GPU_FREQ /* 1344 (Disabled by default) */,
0 /* 1382 (Disabled by default) */, DEACTIVATED_GPU_FREQ /* 1382 (Disabled by default) */,
0 /* 1420 (Disabled by default) */, DEACTIVATED_GPU_FREQ /* 1420 (Disabled by default) */,
0 /* 1459 (Disabled by default) */, DEACTIVATED_GPU_FREQ /* 1459 (Disabled by default) */,
0 /* 1497 (Disabled by default) */, DEACTIVATED_GPU_FREQ /* 1497 (Disabled by default) */,
0 /* 1536 (Disabled by default) */, DEACTIVATED_GPU_FREQ /* 1536 (Disabled by default) */,
}, },
/* Advanced settings: /* You shouldn't have to anything past here. */
* - Erista CPU DVFS Table:
*/
.eristaCpuDvfsTable = { .eristaCpuDvfsTable = {
{ 204000, { 721094 }, {} }, { 204000, { 721094 }, {} },
{ 306000, { 754040 }, {} }, { 306000, { 754040 }, {} },
@@ -177,9 +180,6 @@ volatile CustomizeTable C = {
{ 2295000, { CPU_MAX_MAX_VOLT }, { 5100873, -279186, 4747 } }, { 2295000, { CPU_MAX_MAX_VOLT }, { 5100873, -279186, 4747 } },
}, },
/* - Mariko CPU DVFS Table:
* 2397000 might not work for some SoCs.
*/
.marikoCpuDvfsTable = { .marikoCpuDvfsTable = {
{ 204000, { 721589, -12695, 27, }, { } }, { 204000, { 721589, -12695, 27, }, { } },
{ 306000, { 747134, -14195, 27, }, { } }, { 306000, { 747134, -14195, 27, }, { } },
@@ -317,8 +317,6 @@ volatile CustomizeTable C = {
{ 2703000, { 1770375, -37515, 113, }, { CPU_MAX_MAX_VOLT, } }, { 2703000, { 1770375, -37515, 113, }, { CPU_MAX_MAX_VOLT, } },
}, },
/* - Erista GPU DVFS Table:
*/
.eristaGpuDvfsTable = { .eristaGpuDvfsTable = {
{ 76800, { }, { 814294, 8144, -940, 808, -21583, 226 } }, { 76800, { }, { 814294, 8144, -940, 808, -21583, 226 } },
{ 115200, { }, { 856185, 8144, -940, 808, -21583, 226 } }, { 115200, { }, { 856185, 8144, -940, 808, -21583, 226 } },
@@ -345,7 +343,6 @@ volatile CustomizeTable C = {
{ 921600, { }, { 1275100, 8144, -940, 808, -21583, 226 } }, { 921600, { }, { 1275100, 8144, -940, 808, -21583, 226 } },
// { 998400, { }, { 1316991, 8144, -940, 808, -21583, 226 } }, // { 998400, { }, { 1316991, 8144, -940, 808, -21583, 226 } },
// { 1075200, { }, { 1358882, 8144, -940, 808, -21583, 226 } }, // { 1075200, { }, { 1358882, 8144, -940, 808, -21583, 226 } },
}, },
.eristaGpuDvfsTableSLT = { .eristaGpuDvfsTableSLT = {
@@ -407,9 +404,6 @@ volatile CustomizeTable C = {
{ 1075200, { }, { 1275100, 8144, -940, 808, -21583, 226 } }, { 1075200, { }, { 1275100, 8144, -940, 808, -21583, 226 } },
}, },
/* - Mariko GPU DVFS Table:
* 1305600 might not work for some SoCs.
*/
.marikoGpuDvfsTable = { .marikoGpuDvfsTable = {
{ 76800, { }, { 480000, } }, { 76800, { }, { 480000, } },
{ 153600, { }, { 480000, } }, { 153600, { }, { 480000, } },

View File

@@ -350,6 +350,14 @@ namespace ams::ldr::oc::pcv {
R_SUCCEED(); R_SUCCEED();
} }
constexpr void ClearCvbPllEntry(cvb_entry_t *entry) {
PATCH_OFFSET(&(entry->cvb_pll_param.c1), 0);
PATCH_OFFSET(&(entry->cvb_pll_param.c2), 0);
PATCH_OFFSET(&(entry->cvb_pll_param.c3), 0);
PATCH_OFFSET(&(entry->cvb_pll_param.c4), 0);
PATCH_OFFSET(&(entry->cvb_pll_param.c5), 0);
}
template <bool isMariko> template <bool isMariko>
Result GpuFreqCvbTable(u32 *ptr) { Result GpuFreqCvbTable(u32 *ptr) {
cvb_entry_t *default_table = isMariko ? (cvb_entry_t *)(&mariko::GpuCvbTableDefault) : (cvb_entry_t *)(&erista::GpuCvbTableDefault); cvb_entry_t *default_table = isMariko ? (cvb_entry_t *)(&mariko::GpuCvbTableDefault) : (cvb_entry_t *)(&erista::GpuCvbTableDefault);
@@ -363,7 +371,6 @@ namespace ams::ldr::oc::pcv {
customize_table = const_cast<cvb_entry_t *>(C.marikoGpuDvfsTableSLT); customize_table = const_cast<cvb_entry_t *>(C.marikoGpuDvfsTableSLT);
break; break;
case 2: case 2:
case 3:
customize_table = const_cast<cvb_entry_t *>(C.marikoGpuDvfsTableHiOPT); customize_table = const_cast<cvb_entry_t *>(C.marikoGpuDvfsTableHiOPT);
break; break;
default: default:
@@ -379,7 +386,6 @@ namespace ams::ldr::oc::pcv {
customize_table = const_cast<cvb_entry_t *>(C.eristaGpuDvfsTableSLT); customize_table = const_cast<cvb_entry_t *>(C.eristaGpuDvfsTableSLT);
break; break;
case 2: case 2:
case 3:
customize_table = const_cast<cvb_entry_t *>(C.eristaGpuDvfsTableHigh); customize_table = const_cast<cvb_entry_t *>(C.eristaGpuDvfsTableHigh);
break; break;
default: default:
@@ -402,32 +408,31 @@ namespace ams::ldr::oc::pcv {
std::memcpy(gpu_cvb_table_head, (void *)customize_table, customize_table_size); std::memcpy(gpu_cvb_table_head, (void *)customize_table, customize_table_size);
// Patch GPU volt // Patch GPU volt
if (C.marikoGpuUV == 3 || C.eristaGpuUV == 3) { if (C.marikoGpuUV == 2 || C.eristaGpuUV == 2) {
cvb_entry_t *entry = static_cast<cvb_entry_t *>(gpu_cvb_table_head); cvb_entry_t *entry = static_cast<cvb_entry_t *>(gpu_cvb_table_head);
for (size_t i = 0; i < customize_entry_count; i++) { for (size_t i = 0; i < customize_entry_count; ++i) {
if (isMariko) { if (isMariko) {
if (C.marikoGpuVoltArray[i] == 0) { if (C.marikoGpuVoltArray[i] != 0) {
continue; PATCH_OFFSET(&(entry->cvb_pll_param.c0), (C.marikoGpuVoltArray[i] * 1000));
ClearCvbPllEntry(entry);
} else {
PATCH_OFFSET(&(entry->cvb_pll_param.c0), (entry->cvb_pll_param.c0 - C.commonGpuVoltOffset * 1000));
} }
PATCH_OFFSET(&(entry->cvb_pll_param.c0), C.marikoGpuVoltArray[i] * 1000);
} else { } else {
if (C.eristaGpuVoltArray[i] == 0) { if (C.eristaGpuVoltArray[i] != 0) {
continue; PATCH_OFFSET(&(entry->cvb_pll_param.c0), (C.eristaGpuVoltArray[i] * 1000));
ClearCvbPllEntry(entry);
} else {
PATCH_OFFSET(&(entry->cvb_pll_param.c0), (entry->cvb_pll_param.c0 - C.commonGpuVoltOffset * 1000));
} }
PATCH_OFFSET(&(entry->cvb_pll_param.c0), C.eristaGpuVoltArray[i] * 1000);
} }
PATCH_OFFSET(&(entry->cvb_pll_param.c1), 0); ++entry;
PATCH_OFFSET(&(entry->cvb_pll_param.c2), 0);
PATCH_OFFSET(&(entry->cvb_pll_param.c3), 0);
PATCH_OFFSET(&(entry->cvb_pll_param.c4), 0);
PATCH_OFFSET(&(entry->cvb_pll_param.c5), 0);
entry++;
} }
} else if (C.commonGpuVoltOffset) { } else if (C.commonGpuVoltOffset) {
cvb_entry_t *entry = static_cast<cvb_entry_t *>(gpu_cvb_table_head); cvb_entry_t *entry = static_cast<cvb_entry_t *>(gpu_cvb_table_head);
for (size_t i = 0; i < customize_entry_count; i++) { for (size_t i = 0; i < customize_entry_count; ++i) {
PATCH_OFFSET(&(entry->cvb_pll_param.c0), (entry->cvb_pll_param.c0 - C.commonGpuVoltOffset * 1000)); PATCH_OFFSET(&(entry->cvb_pll_param.c0), (entry->cvb_pll_param.c0 - C.commonGpuVoltOffset * 1000));
entry++; ++entry;
} }
} }