UV2 with dynamic voltages

This commit is contained in:
Lightos1
2025-12-12 18:16:15 +01:00
parent 5ed2c33e50
commit a637c0460a
5 changed files with 202 additions and 86 deletions

View File

@@ -48,8 +48,9 @@ namespace ams::ldr::oc::pcv {
{ },
};
constexpr int gpuVmax = 750;
constexpr int gpuVmin = 610;
constexpr u32 CpuClkOfficial = 1963'500;
constexpr u32 CpuVoltOfficial = 1120;
constexpr u32 CpuVminOfficial = 620;
constexpr u32 CpuVoltagePatchValues[] = { 850, 38, 1120, 1000, 100, 1000, 0 };
constexpr s32 CpuVoltagePatchOffsets[] = { -2, -1, 5, 6, 7, 8, 9 };
@@ -59,9 +60,6 @@ namespace ams::ldr::oc::pcv {
constexpr s32 CpuVoltageSecondaryPatchOffsets[] = { -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
static_assert(sizeof(CpuVoltageSecondaryPatchValues) == sizeof(CpuVoltageSecondaryPatchOffsets), "Invalid secondary CpuVoltagePatch size");
constexpr u32 CpuClkOfficial = 1963'500;
constexpr u32 CpuVoltOfficial = 1120;
constexpr cvb_entry_t GpuCvbTableDefault[] = {
// GPUB01_NA_CVB_TABLE
{ 76800, {}, { 610000, } },
@@ -86,8 +84,68 @@ namespace ams::ldr::oc::pcv {
constexpr u32 GpuClkPllMax = 1300'000'000;
constexpr u32 GpuClkPllLimit = 2'600'000;
constexpr int GpuVminOfficial = 610;
constexpr u32 CpuVminOfficial = 620;
constexpr u32 GpuDVFSPattern[] = { 1050, 1000, 100, 1000, 10, };
constexpr u32 GpuVoltThermalPattern[] = { 800, 1120, 0, 610, 1120, 20000, 610, 1120, 30000, 610, 1120, 50000, 610, 1120, 70000, 610, 1120, 90000, };
static_assert(sizeof(GpuVoltThermalPattern) == 72, "Invalid GpuVoltThermalPattern");
struct SpeedoVminTable {
u32 speedo;
u32 voltage;
};
struct RamVminOffsetTable {
u32 maxClock;
u32 offset;
};
constexpr u32 GetGpuVminVoltage() {
constexpr SpeedoVminTable Table[] {
{1560, 590},
{1583, 570},
{1620, 565},
{1670, 560},
{1694, 555},
{1731, 550},
{1750, 540},
{0xFFFFFFFF, 530},
};
for (auto e : Table) {
if (C.gpuSpeedo <= e.speedo) {
return e.voltage;
}
}
return 530;
}
constexpr u32 GetRamVminAdjustment(u32 vmin) {
if (C.marikoEmcMaxClock < 2133000) {
return vmin;
}
const u32 ramScale = (((C.marikoEmcMaxClock / 1000) - 2133) / 33) * 5 + vmin;
constexpr RamVminOffsetTable RamOffset[] {
{2400000, 5},
{2533000, 10},
{2666000, 15},
{2800000, 20},
{2933000, 25},
{3200000, 30},
{0xFFFFFFFF, 35},
};
for (auto r : RamOffset) {
if (C.marikoEmcMaxClock < r.maxClock) {
return ramScale + r.offset;
}
}
return ramScale;
}
/* GPU Max Clock asm Pattern:
*
@@ -157,7 +215,7 @@ namespace ams::ldr::oc::pcv {
{ },
};
constexpr int gpuVmin = 810;
constexpr int GpuVminOfficial = 810;
constexpr u32 CpuVoltOfficial = 1235;