/* * Copyright (c) Souldbminer and Horizon OC Contributors * * Copyright (c) 2023 hanai3Bi * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "customize.hpp" #define ENABLED 1 #define DISABLED 0 namespace ams::ldr::oc { //volatile EristaMtcTable EristaMtcTablePlaceholder = { .rev = ERISTA_MTC_MAGIC, }; //volatile MarikoMtcTable MarikoMtcTablePlaceholder = { .rev = MARIKO_MTC_MAGIC, }; volatile CustomizeTable C = { /* Common: * - Boost Clock in kHz: * Default: 1785000 * Boost clock will be applied when applications request higher CPU frequency for quicker loading. * This will be set regardless of whether sys-clk is enabled. */ .commonCpuBoostClock = 1785000, /* - EMC Vddq (Erista Only) and RAM Vdd2 Voltage in uV * Range: 1100'000 to 1250'000 uV * Erista Default(HOS): 1125'000 (bootloader: 1100'000) * Mariko Default: 1100'000 (It will not work without sys-clk-OC.) * Value should be divided evenly by 12'500. * Not enabled by default. */ .commonEmcMemVolt = 1175000, /* Erista CPU: * - Max Voltage in mV * - CpuVoltL4T: 1235 */ .eristaCpuMaxVolt = 1235, /* Erista EMC(RAM): * - RAM Clock in kHz * [WARNING] * RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM: * - Graphical glitches * - System instabilities * - NAND corruption */ .eristaEmcMaxClock = 1862400, /* Mariko CPU: * - Max Voltage in mV: * Default voltage: 1120 */ .marikoCpuMaxVolt = 1120, /* Mariko EMC(RAM): * - RAM Clock in kHz: * Values should be ≥ 1600000, and divided evenly by 9600. * [WARNING] * RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM: * - Graphical glitches * - System instabilities * - NAND corruption */ .marikoEmcMaxClock = 1996800, /* - EMC Vddq (Mariko Only) Voltage in uV * Range: 550'000 to 650'000 uV * Value should be divided evenly by 5'000 * Default: 600'000 * Not enabled by default. * This will not work without sys-clk-OC. */ .marikoEmcVddqVolt = 0, .marikoCpuUV = 0, .marikoGpuUV = 0, .eristaCpuUV = 0, .eristaGpuUV = 0, .enableMarikoGpuUnsafeFreqs = DISABLED, .enableEristaGpuUnsafeFreqs = DISABLED, .enableMarikoCpuUnsafeFreqs = DISABLED, .enableEristaCpuUnsafeFreqs = DISABLED, .commonGpuVoltOffset = 0, .t1_tRCD = 0, .t2_tRP = 0, .t3_tRAS = 0, .t4_tRRD = 0, .t5_tRFC = 0, .t6_tRTW = 0, .t7_tWTR = 0, .t8_tREFI = 0, .mem_burst_latency = 2, // NOTE: These tables should NOT BE USED and are only here as placeholders. Always try and find your own optimal tables. .marikoGpuVoltArray = { 610 /* 76 */, 610 /* 153 */, 610 /* 230 */, 610 /* 307 */, 610 /* 384 */, 610 /* 460 */, 610 /* 537 */, 610 /* 614 */, 610 /* 691 */, 610 /* 768 */, 620 /* 844 */, 640 /* 921 */, 675 /* 998 */, 710 /* 1075 */, 735 /* 1152 */, 785 /* 1228 */, 0 /* 1267 (Disabled by default) */, 0 /* 1305 (Disabled by default) */, 0 /* 1344 (Disabled by default) */, 0 /* 1382 (Disabled by default) */, 0 /* 1420 (Disabled by default) */, 0 /* 1459 (Disabled by default) */, 0 /* 1497 (Disabled by default) */, 0 /* 1536 (Disabled by default) */, }, .eristaGpuVoltArray = { 750 /* 76 */, 750 /* 153 */, 750 /* 230 */, 750 /* 307 */, 775 /* 384 */, 800 /* 460 */, 825 /* 537 */, 850 /* 614 */, 875 /* 691 */, 900 /* 768 */, 950 /* 844 */, 900 /* 921 */, 0 /* 998 (Disabled by default) */, 0 /* 1075 (Disabled by default) */, 0 /* 1152 (Disabled by default) */, }, .marikoCpuVmin = 600, /* Advanced Settings: * - Erista CPU DVFS Table: */ .eristaCpuDvfsTable = { { 204000, { 721094 }, {} }, { 306000, { 754040 }, {} }, { 408000, { 786986 }, {} }, { 510000, { 819932 }, {} }, { 612000, { 852878 }, {} }, { 714000, { 885824 }, {} }, { 816000, { 918770 }, {} }, { 918000, { 951716 }, {} }, { 1020000, { 984662 }, { -2875621, 358099, -8585 } }, { 1122000, { 1017608 }, { -52225, 104159, -2816 } }, { 1224000, { 1050554 }, { 1076868, 8356, -727 } }, { 1326000, { 1083500 }, { 2208191, -84659, 1240 } }, { 1428000, { 1116446 }, { 2519460, -105063, 1611 } }, { 1581000, { 1130000 }, { 2889664, -122173, 1834 } }, { 1683000, { 1168000 }, { 5100873, -279186, 4747 } }, { 1785000, { 1227500 }, { 5100873, -279186, 4747 } }, }, /* - Mariko CPU DVFS Table: * 2397000 might not work for some SoCs. */ .marikoCpuDvfsTable = { { 204000, { 721589, -12695, 27 }, {} }, { 306000, { 747134, -14195, 27 }, {} }, { 408000, { 776324, -15705, 27 }, {} }, { 510000, { 809160, -17205, 27 }, {} }, { 612000, { 845641, -18715, 27 }, {} }, { 714000, { 885768, -20215, 27 }, {} }, { 816000, { 929540, -21725, 27 }, {} }, { 918000, { 976958, -23225, 27 }, {} }, { 1020000, { 1028021, -24725, 27 }, { 1120000 } }, { 1122000, { 1082730, -26235, 27 }, { 1120000 } }, { 1224000, { 1141084, -27735, 27 }, { 1120000 } }, { 1326000, { 1203084, -29245, 27 }, { 1120000 } }, { 1428000, { 1268729, -30745, 27 }, { 1120000 } }, { 1581000, { 1374032, -33005, 27 }, { 1120000 } }, { 1683000, { 1448791, -34505, 27 }, { 1120000 } }, { 1785000, { 1527196, -36015, 27 }, { 1120000 } }, { 1887000, { 1609246, -37515, 27 }, { 1120000 } }, { 1963500, { 1675751, -38635, 27 }, { 1120000 } }, // Appending table { 2091000, { 1716501, -39395, 27 }, { 1235000 } }, { 2193000, { 1775132, -40505, 27 }, { 1235000 } }, { 2295000, { 1866287, -42005, 27 }, { 1235000 } }, //{ 2397000, { 1961107, -43506, 27 }, { 1235000 } }, }, .marikoCpuDvfsTableSLT = { { 204000, { 732856, -17335, 113 }, {} }, { 306000, { 760024, -18195, 113 }, {} }, { 408000, { 789258, -19055, 113 }, {} }, { 510000, { 789258, -19055, 113 }, {} }, { 612000, { 853926, -20775, 113 }, {} }, { 714000, { 889361, -21625, 113 }, {} }, { 816000, { 926862, -22485, 113 }, {} }, { 918000, { 966431, -23345, 113 }, {} }, { 1020000, { 1008066, -24205, 113 }, { 1120000 } }, { 1122000, { 1051768, -25065, 113 }, { 1120000 } }, { 1224000, { 1097537, -25925, 113 }, { 1120000 } }, { 1326000, { 1145373, -26785, 113 }, { 1120000 } }, { 1428000, { 1195276, -27645, 113 }, { 1120000 } }, { 1581000, { 1274006, -28935, 113 }, { 1120000 } }, { 1683000, { 1329076, -29795, 113 }, { 1120000 } }, { 1785000, { 1386213, -30655, 113 }, { 1120000 } }, { 1887000, { 1445416, -31515, 113 }, { 1120000 } }, { 1963500, { 1490873, -32155, 113 }, { 1120000 } }, // Appending table { 2091000, { 1580725, -33235, 113 }, { 1120000 } }, { 2193000, { 1580725, -33235, 113 }, { 1235000 } }, { 2295000, { 1635431, -34095, 113 }, { 1235000 } }, { 2397000, { 1702903, -34955, 113 }, { 1235000 } }, }, /* - Erista GPU DVFS Table: */ .eristaGpuDvfsTable = { { 76800, { }, { 814294, 8144, -940, 808, -21583, 226 } }, { 153600, { }, { 856185, 8144, -940, 808, -21583, 226 } }, { 230400, { }, { 898077, 8144, -940, 808, -21583, 226 } }, { 307200, { }, { 939968, 8144, -940, 808, -21583, 226 } }, { 384000, { }, { 981860, 8144, -940, 808, -21583, 226 } }, { 460800, { }, { 1023751, 8144, -940, 808, -21583, 226 } }, { 537600, { }, { 1065642, 8144, -940, 808, -21583, 226 } }, { 614400, { }, { 1107534, 8144, -940, 808, -21583, 226 } }, { 691200, { }, { 1149425, 8144, -940, 808, -21583, 226 } }, { 768000, { }, { 1191317, 8144, -940, 808, -21583, 226 } }, { 844800, { }, { 1233208, 8144, -940, 808, -21583, 226 } }, { 921600, { }, { 1275100, 8144, -940, 808, -21583, 226 } }, // { 998400, { }, { 1316991, 8144, -940, 808, -21583, 226 } }, // { 1075200, { }, { 1358882, 8144, -940, 808, -21583, 226 } }, }, .eristaGpuDvfsTableSLT = { { 76800, { }, { 772403, 8144, -940, 808, -21583, 226 } }, { 153600, { }, { 814294, 8144, -940, 808, -21583, 226 } }, { 230400, { }, { 856186, 8144, -940, 808, -21583, 226 } }, { 307200, { }, { 898077, 8144, -940, 808, -21583, 226 } }, { 384000, { }, { 939969, 8144, -940, 808, -21583, 226 } }, { 460800, { }, { 981860, 8144, -940, 808, -21583, 226 } }, { 537600, { }, { 1023751, 8144, -940, 808, -21583, 226 } }, { 614400, { }, { 1065643, 8144, -940, 808, -21583, 226 } }, { 691200, { }, { 1107534, 8144, -940, 808, -21583, 226 } }, { 768000, { }, { 1149426, 8144, -940, 808, -21583, 226 } }, { 844800, { }, { 1191317, 8144, -940, 808, -21583, 226 } }, { 921600, { }, { 1233209, 8144, -940, 808, -21583, 226 } }, // { 998400, { }, { 1275100, 8144, -940, 808, -21583, 226 } }, // { 1075200, { }, { 1316991, 8144, -940, 808, -21583, 226 } }, }, .eristaGpuDvfsTableHigh = { { 76800, { }, { 730512, 8144, -940, 808, -21583, 226 } }, { 153600, { }, { 772403, 8144, -940, 808, -21583, 226 } }, { 230400, { }, { 814295, 8144, -940, 808, -21583, 226 } }, { 307200, { }, { 856186, 8144, -940, 808, -21583, 226 } }, { 384000, { }, { 898078, 8144, -940, 808, -21583, 226 } }, { 460800, { }, { 939969, 8144, -940, 808, -21583, 226 } }, { 537600, { }, { 981860, 8144, -940, 808, -21583, 226 } }, { 614400, { }, { 1023752, 8144, -940, 808, -21583, 226 } }, { 691200, { }, { 1065643, 8144, -940, 808, -21583, 226 } }, { 768000, { }, { 1107535, 8144, -940, 808, -21583, 226 } }, { 844800, { }, { 1149426, 8144, -940, 808, -21583, 226 } }, { 921600, { }, { 1191318, 8144, -940, 808, -21583, 226 } }, // { 998400, { }, { 1233209, 8144, -940, 808, -21583, 226 } }, // { 1075200, { }, { 1275100, 8144, -940, 808, -21583, 226 } }, }, /* - Mariko GPU DVFS Table: * 1305600 might not work for some SoCs. */ .marikoGpuDvfsTable = { { 76800, {}, { 610000, } }, { 153600, {}, { 610000, } }, { 230400, {}, { 610000, } }, { 307200, {}, { 610000, } }, { 384000, {}, { 610000, } }, { 460800, {}, { 610000, } }, { 537600, {}, { 801688, -10900, -163, 298, -10599, 162 } }, { 614400, {}, { 824214, -5743, -452, 238, -6325, 81 } }, { 691200, {}, { 848830, -3903, -552, 119, -4030, -2 } }, { 768000, {}, { 891575, -4409, -584, 0, -2849, 39 } }, { 844800, {}, { 940071, -5367, -602, -60, -63, -93 } }, { 921600, {}, { 986765, -6637, -614, -179, 1905, -13 } }, { 998400, {}, { 1098475, -13529, -497, -179, 3626, 9 } }, { 1075200, {}, { 1163644, -12688, -648, 0, 1077, 40 } }, { 1152000, {}, { 1204812, -9908, -830, 0, 1469, 110 } }, // { 1228800, {}, { 1277303, -11675, -859, 0, 3722, 313 } }, // { 1267200, {}, { 1335531, -12567, -867, 0, 3681, 559 } }, // Appending table //{ 1305600, {}, { 1374130, -13725, -859, 0, 4442, 576 } }, }, .marikoGpuDvfsTableSLT = { { 76800, {}, { 590000, } }, { 153600, {}, { 590000, } }, { 230400, {}, { 590000, } }, { 307200, {}, { 590000, } }, { 384000, {}, { 590000, } }, { 460800, {}, { 795089, -11096, -163, 298, -10421, 162 } }, { 537600, {}, { 795089, -11096, -163, 298, -10421, 162 } }, { 614400, {}, { 820606, -6285, -452, 238, -6182, 81 } }, { 691200, {}, { 846289, -4565, -552, 119, -3958, -2 } }, { 768000, {}, { 888720, -5110, -584, 0, -2849, 39 } }, { 844800, {}, { 936634, -6089, -602, -60, -99, -93 } }, { 921600, {}, { 982562, -7373, -614, -179, 1797, -13 } }, { 998400, {}, { 1090179, -14125, -497, -179, 3518, 9 } }, { 1075200, {}, { 1155798, -13465, -648, 0, 1077, 40 } }, { 1152000, {}, { 1198568, -10904, -830, 0, 1469, 110 } }, { 1228800, {}, { 1269988, -12707, -859, 0, 3722, 313 } }, // { 1267200, {}, { 1308155, -13694, -867, 0, 3681, 559 } }, }, .marikoGpuDvfsTableHiOPT = { { 76800, {}, { 590000, } }, { 153600, {}, { 590000, } }, { 230400, {}, { 590000, } }, { 307200, {}, { 590000, } }, { 384000, {}, { 590000, } }, { 460800, {}, { 590000, } }, { 537600, {}, { 590000, } }, { 614400, {}, { 590000, } }, { 691200, {}, { 838712, -7304, -552, 119, -3750, -2 } }, { 768000, {}, { 880210, -7955, -584, 0, -2849, 39 } }, { 844800, {}, { 926398, -8892, -602, -60, -384, -93 } }, { 921600, {}, { 970060, -10108, -614, -179, 1508, -13 } }, { 998400, {}, { 1065665, -16075, -497, -179, 3213, 9 } }, { 1075200, {}, { 1132576, -16093, -648, 0, 1077, 40 } }, { 1152000, {}, { 1180029, -14534, -830, 0, 1469, 110 } }, { 1228800, {}, { 1248293, -16383, -859, 0, 3722, 313 } }, // { 1267200, {}, { 1286399, -17475, -867, 0, 3681, 559 } }, }, //.eristaMtcTable = const_cast(&EristaMtcTablePlaceholder), //.marikoMtcTable = const_cast(&MarikoMtcTablePlaceholder), // UV3 tables .eristaGpuDvfsTableUv3UnsafeFreqs = { { 76800, { }, { 814294, 8144, -940, 808, -21583, 226 } }, { 153600, { }, { 856185, 8144, -940, 808, -21583, 226 } }, { 230400, { }, { 898077, 8144, -940, 808, -21583, 226 } }, { 307200, { }, { 939968, 8144, -940, 808, -21583, 226 } }, { 384000, { }, { 981860, 8144, -940, 808, -21583, 226 } }, { 460800, { }, { 1023751, 8144, -940, 808, -21583, 226 } }, { 537600, { }, { 1065642, 8144, -940, 808, -21583, 226 } }, { 614400, { }, { 1107534, 8144, -940, 808, -21583, 226 } }, { 691200, { }, { 1149425, 8144, -940, 808, -21583, 226 } }, { 768000, { }, { 1191317, 8144, -940, 808, -21583, 226 } }, { 844800, { }, { 1233208, 8144, -940, 808, -21583, 226 } }, { 921600, { }, { 1275100, 8144, -940, 808, -21583, 226 } }, { 998400, { }, { 1316991, 8144, -940, 808, -21583, 226 } }, // UNSAFE { 1075200, { }, { 1358882, 8144, -940, 808, -21583, 226 } }, // UNSAFE { 1152000, { }, { 1400773, 8144, -940, 808, -21583, 226 } }, // DANGEROUS { 1228800, { }, { 1440773, 8144, -940, 808, -21583, 226 } }, // DANGEROUS }, .marikoGpuDvfsTableUv3UnsafeFreqs = { { 76800, {}, { 590000, } }, { 153600, {}, { 590000, } }, { 230400, {}, { 590000, } }, { 307200, {}, { 590000, } }, { 384000, {}, { 590000, } }, { 460800, {}, { 590000, } }, { 537600, {}, { 590000, } }, { 614400, {}, { 590000, } }, { 691200, {}, { 838712, -7304, -552, 119, -3750, -2 } }, { 768000, {}, { 880210, -7955, -584, 0, -2849, 39 } }, { 844800, {}, { 926398, -8892, -602, -60, -384, -93 } }, { 921600, {}, { 970060, -10108, -614, -179, 1508, -13 } }, { 998400, {}, { 1065665, -16075, -497, -179, 3213, 9 } }, { 1075200, {}, { 1132576, -16093, -648, 0, 1077, 40 } }, { 1152000, {}, { 1180029, -14534, -830, 0, 1469, 110 } }, { 1228800, {}, { 1248293, -16383, -859, 0, 3722, 313 } }, { 1267200, {}, { 1286399, -17475, -867, 0, 3681, 559 } }, { 1305600, {}, { 1286399, -17475, -867, 0, 3681, 559 } }, { 1305600, {}, { 1324505, -17475, -867, 0, 3681, 559 } }, { 1344000, {}, { 1362611, -17475, -867, 0, 3681, 559 } }, { 1382400, {}, { 1400717, -17475, -867, 0, 3681, 559 } }, { 1420800, {}, { 1438823, -17475, -867, 0, 3681, 559 } }, { 1459200, {}, { 1476929, -17475, -867, 0, 3681, 559 } }, { 1497600, {}, { 1515035, -17475, -867, 0, 3681, 559 } }, { 1536000, {}, { 1553141, -17475, -867, 0, 3681, 559 } }, }, .marikoCpuDvfsTableUnsafeFreqs = { { 204000, { 732856, -17335, 113 }, { 1120000 } }, { 306000, { 760024, -18195, 113 }, { 1120000 } }, { 408000, { 789258, -19055, 113 }, { 1120000 } }, { 510000, { 789258, -19055, 113 }, { 1120000 } }, { 612000, { 853926, -20775, 113 }, { 1120000 } }, { 714000, { 889361, -21625, 113 }, { 1120000 } }, { 816000, { 926862, -22485, 113 }, { 1120000 } }, { 918000, { 966431, -23345, 113 }, { 1120000 } }, { 1020000, { 1008066, -24205, 113 }, { 1120000 } }, { 1122000, { 1051768, -25065, 113 }, { 1120000 } }, { 1224000, { 1097537, -25925, 113 }, { 1120000 } }, { 1326000, { 1145373, -26785, 113 }, { 1120000 } }, { 1428000, { 1195276, -27645, 113 }, { 1120000 } }, { 1581000, { 1274006, -28935, 113 }, { 1120000 } }, { 1683000, { 1329076, -29795, 113 }, { 1120000 } }, { 1785000, { 1386213, -30655, 113 }, { 1120000 } }, { 1887000, { 1445416, -31515, 113 }, { 1120000 } }, { 1963500, { 1490873, -32155, 113 }, { 1120000 } }, // Appending table { 2091000, { 1580725, -33235, 113 }, { 1120000 } }, { 2193000, { 1580725, -33235, 113 }, { 1235000 } }, { 2295000, { 1635431, -34095, 113 }, { 1235000 } }, { 2397000, { 1702903, -34955, 113 }, { 1235000 } }, { 2499000, { 1754400, -35643, 113 }, { 1235000 } }, { 2601000, { 1805897, -36331, 113 }, { 1235000 } }, { 2703000, { 1857394, -37019, 113 }, { 1235000 } }, { 2805000, { 1908891, -37707, 113 }, { 1235000 } }, { 2907000, { 1960388, -38395, 113 }, { 1235000 } }, }, .eristaCpuDvfsTableUnsafeFreqs = { { 204000, { 721094 }, {} }, { 306000, { 754040 }, {} }, { 408000, { 786986 }, {} }, { 510000, { 819932 }, {} }, { 612000, { 852878 }, {} }, { 714000, { 885824 }, {} }, { 816000, { 918770 }, {} }, { 918000, { 951716 }, {} }, { 1020000, { 984662 }, { -2875621, 358099, -8585 } }, { 1122000, { 1017608 }, { -52225, 104159, -2816 } }, { 1224000, { 1050554 }, { 1076868, 8356, -727 } }, { 1326000, { 1083500 }, { 2208191, -84659, 1240 } }, { 1428000, { 1116446 }, { 2519460, -105063, 1611 } }, { 1581000, { 1130000 }, { 2889664, -122173, 1834 } }, { 1683000, { 1168000 }, { 5100873, -279186, 4747 } }, { 1785000, { 1227500 }, { 5100873, -279186, 4747 } }, // Appending table { 1887000, { 1235000 }, { 5200873, -279186, 4747 } }, { 1963500, { 1235000 }, { 5300873, -279186, 4747 } }, { 2091000, { 1235000 }, { 5400873, -289186, 4847 } }, { 2193000, { 1235000 }, { 5500873, -299186, 4947 } }, { 2295000, { 1235000 }, { 5600873, -239186, 5047 } }, { 2397000, { 1235000 }, { 5700873, -249186, 5047 } }, }, }; }