- pages: Drop cust v2 support; Show update time in download section
- oc_loader: Separate Vddq and Vdd2 DRAM voltage for Mariko - sys-clk-OC: Fix wrong regulator ID; Auto CPU Boost for Erista
This commit is contained in:
49
README.md
49
README.md
@@ -1,6 +1,6 @@
|
|||||||
# Switch OC Suite
|
# Switch OC Suite
|
||||||
|
|
||||||
[](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)
|
[](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)
|
||||||
|
|
||||||
Overclocking suite for Horizon OS (HOS) running on Atmosphere CFW.
|
Overclocking suite for Horizon OS (HOS) running on Atmosphere CFW.
|
||||||
|
|
||||||
@@ -22,14 +22,7 @@ Overclocking suite for Horizon OS (HOS) running on Atmosphere CFW.
|
|||||||
- See [README for sys-clk-OC](https://github.com/KazushiMe/Switch-OC-Suite/blob/master/Source/sys-clk-OC/README.md)
|
- See [README for sys-clk-OC](https://github.com/KazushiMe/Switch-OC-Suite/blob/master/Source/sys-clk-OC/README.md)
|
||||||
|
|
||||||
- DRAM Overclock (Safe: 1862.4 MHz)
|
- DRAM Overclock (Safe: 1862.4 MHz)
|
||||||
- Unsafe: Up to 2131 MHz with DRAM bus overvolting depending on your DRAM chip
|
|
||||||
|
|
||||||
- Modded sys-clk and ReverseNX-RT
|
|
||||||
- CPU & GPU frequency governor (Experimental)
|
|
||||||
- Set charging current (100 mA - 2000 mA) and charging limit (20% - 100%)
|
|
||||||
- Global Profile
|
|
||||||
- Sync ReverseNX Mode
|
|
||||||
|
|
||||||
- Mariko variant (HAC-001-01, HDH-001, HEG-001)
|
- Mariko variant (HAC-001-01, HDH-001, HEG-001)
|
||||||
- CPU / GPU Overclock (Safe: 1963 / 998 MHz)
|
- CPU / GPU Overclock (Safe: 1963 / 998 MHz)
|
||||||
- Unsafe
|
- Unsafe
|
||||||
@@ -39,50 +32,44 @@ Overclocking suite for Horizon OS (HOS) running on Atmosphere CFW.
|
|||||||
|
|
||||||
- DRAM Overclock (Safe: 1996.8 MHz)
|
- DRAM Overclock (Safe: 1996.8 MHz)
|
||||||
|
|
||||||
- Modded sys-clk and ReverseNX-RT
|
- Modded sys-clk and ReverseNX-RT
|
||||||
- Auto CPU Boost
|
- Auto CPU Boost
|
||||||
- CPU & GPU frequency governor (Experimental)
|
- For faster game loading
|
||||||
- Set charging current (100 mA - 2000 mA) and charging limit (20% - 100%)
|
- Enable CPU Boost (1785 MHz) when CPU Core#3 (System Core) is stressed (mainly I/O operations).
|
||||||
- Global Profile
|
- Effective only when charger is connected.
|
||||||
- Sync ReverseNX Mode
|
|
||||||
|
|
||||||
- Auto CPU Boost
|
- CPU & GPU frequency governor (Experimental)
|
||||||
- For faster game loading
|
- Adjust frequency based on load. Might decrease power draw but can introduce stutters. Can be turned off for specific titles.
|
||||||
- Enable CPU Boost (1785 MHz) when CPU Core#3 (System Core) is stressed (mainly I/O operations).
|
|
||||||
- Effective only when charger is connected.
|
|
||||||
|
|
||||||
- CPU & GPU frequency governor (Experimental)
|
- Set charging current (100 mA - 2000 mA) and charging limit (20% - 100%)
|
||||||
- Adjust frequency based on load. Might decrease power draw but can introduce stutters. Can be turned off for specific titles.
|
- Long-term use of charge limit may render the battery gauge inaccurate. Performing full cycles could help recalibration, or try [battery_desync_fix_nx](https://github.com/CTCaer/battery_desync_fix_nx).
|
||||||
|
|
||||||
- Setting charge limit (20% - 100%)
|
- Global Profile
|
||||||
- Long-term use of charge limit may render the battery gauge inaccurate. Performing full cycles could help recalibration, or try [battery_desync_fix_nx](https://github.com/CTCaer/battery_desync_fix_nx).
|
- Designated a dummy title id `0xA111111111111111`.
|
||||||
|
- Priority: "Temp overrides" > "Application profile" > "Global profile" > "System default".
|
||||||
|
|
||||||
- Global profile
|
- Sync ReverseNX Mode
|
||||||
- Designated a dummy title id `0xA111111111111111`.
|
- No need to change clocks manually after toggling modes in ReverseNX (-RT and -Tool)
|
||||||
- Priority: "Temp overrides" > "Application profile" > "Global profile" > "System default".
|
|
||||||
|
|
||||||
- Sync ReverseNX Mode
|
|
||||||
- No need to change clocks manually after toggling modes in ReverseNX (-RT and -Tool)
|
|
||||||
|
|
||||||
- **[System Settings (Optional)](https://github.com/KazushiMe/Switch-OC-Suite/blob/master/system_settings.md)**
|
- **[System Settings (Optional)](https://github.com/KazushiMe/Switch-OC-Suite/blob/master/system_settings.md)**
|
||||||
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
1. Download latest [release](https://github.com/KazushiMe/Switch-OC-Suite/releases/latest).
|
1. Download latest [release](https://kazushime.github.io/Switch-OC-Suite/#download).
|
||||||
|
|
||||||
2. Copy all files in `SdOut` to the root of SD card.
|
2. Copy all files in `SdOut` to the root of SD card.
|
||||||
|
|
||||||
3. Grab `x.x.x_loader.kip` for your Atmosphere version, rename it to `loader.kip` and place it in `/atmosphere/kips/`.
|
3. Grab `x.x.x_loader.kip` for your Atmosphere version, rename it to `loader.kip` and place it in `/atmosphere/kips/`.
|
||||||
|
|
||||||
4. Customization via [online loader configurator](https://kazushime.github.io/Switch-OC-Suite/):
|
4. Customization via [online loader configurator](https://kazushime.github.io/Switch-OC-Suite/#config):
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
| Defaults | Mariko | Erista |
|
| Defaults | Mariko | Erista |
|
||||||
| ---------- | ------------- | ------------ |
|
| ---------- | ------------- | ------------ |
|
||||||
| CPU OC | 2397 MHz Max | 2091 MHz Max |
|
| CPU OC | 2397 MHz Max | 2091 MHz Max |
|
||||||
| CPU Boost | 1785 MHz | N/A |
|
| CPU Boost | 1785 MHz | N/A |
|
||||||
| CPU Volt | 1235 mV Max | 1257 mV Max |
|
| CPU Volt | 1235 mV Max | 1235 mV Max |
|
||||||
| GPU OC | 1305 MHz Max | N/A |
|
| GPU OC | 1305 MHz Max | N/A |
|
||||||
| RAM OC | 1996 MHz Max | 1862 MHz Max |
|
| RAM OC | 1996 MHz Max | 1862 MHz Max |
|
||||||
| RAM Volt | Disabled | Disabled |
|
| RAM Volt | Disabled | Disabled |
|
||||||
|
|||||||
@@ -51,9 +51,9 @@ volatile CustomizeTable C = {
|
|||||||
*/
|
*/
|
||||||
.marikoGpuMaxClock = 1305600,
|
.marikoGpuMaxClock = 1305600,
|
||||||
|
|
||||||
/* Mariko EMC:
|
/* Mariko EMC(RAM):
|
||||||
* - RAM Clock in kHz:
|
* - RAM Clock in kHz:
|
||||||
* Values should be > 1600000, and divided evenly by 9600.
|
* Values should be ≥ 1600000, and divided evenly by 9600.
|
||||||
* [WARNING]
|
* [WARNING]
|
||||||
* RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM:
|
* RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM:
|
||||||
* - Graphical glitches
|
* - Graphical glitches
|
||||||
@@ -61,21 +61,21 @@ volatile CustomizeTable C = {
|
|||||||
* - NAND corruption
|
* - NAND corruption
|
||||||
*/
|
*/
|
||||||
.marikoEmcMaxClock = 1996800,
|
.marikoEmcMaxClock = 1996800,
|
||||||
/* - RAM Voltage in uV
|
/* - EMC Vddq (Mariko Only) Voltage in uV
|
||||||
* Range: 600'000 to 650'000 uV
|
* Range: 550'000 to 650'000 uV
|
||||||
* Value should be divided evenly by 5'000
|
* Value should be divided evenly by 5'000
|
||||||
* Default: 600'000
|
* Default: 600'000
|
||||||
* Not enabled by default.
|
* Not enabled by default.
|
||||||
* This will not work without sys-clk-OC.
|
* This will not work without sys-clk-OC.
|
||||||
*/
|
*/
|
||||||
.marikoEmcVolt = 0,
|
.marikoEmcVddqVolt = 0,
|
||||||
|
|
||||||
/* Erista CPU:
|
/* Erista CPU:
|
||||||
* - Max Voltage in mV
|
* - Max Voltage in mV
|
||||||
*/
|
*/
|
||||||
.eristaCpuMaxVolt = 1235,
|
.eristaCpuMaxVolt = 1235,
|
||||||
|
|
||||||
/* Erista EMC:
|
/* Erista EMC(RAM):
|
||||||
* - RAM Clock in kHz
|
* - RAM Clock in kHz
|
||||||
* [WARNING]
|
* [WARNING]
|
||||||
* RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM:
|
* RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM:
|
||||||
@@ -84,13 +84,14 @@ volatile CustomizeTable C = {
|
|||||||
* - NAND corruption
|
* - NAND corruption
|
||||||
*/
|
*/
|
||||||
.eristaEmcMaxClock = 1862400,
|
.eristaEmcMaxClock = 1862400,
|
||||||
/* - RAM Voltage in uV
|
/* - EMC Vddq (Erista Only) and RAM Vdd2 Voltage in uV
|
||||||
* Range: 600'000 to 1250'000 uV
|
* Range: 1100'000 to 1250'000 uV
|
||||||
* Value should be divided evenly by 12'500
|
* Erista Default(HOS): 1125'000 (bootloader: 1100'000)
|
||||||
* Default(HOS): 1125'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.
|
* Not enabled by default.
|
||||||
*/
|
*/
|
||||||
.eristaEmcVolt = 0,
|
.commonEmcMemVolt = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -39,10 +39,10 @@ typedef struct __attribute__((packed)) CustomizeTable {
|
|||||||
u32 marikoCpuMaxVolt;
|
u32 marikoCpuMaxVolt;
|
||||||
u32 marikoGpuMaxClock;
|
u32 marikoGpuMaxClock;
|
||||||
u32 marikoEmcMaxClock;
|
u32 marikoEmcMaxClock;
|
||||||
u32 marikoEmcVolt;
|
u32 marikoEmcVddqVolt;
|
||||||
u32 eristaCpuMaxVolt;
|
u32 eristaCpuMaxVolt;
|
||||||
u32 eristaEmcMaxClock;
|
u32 eristaEmcMaxClock;
|
||||||
u32 eristaEmcVolt;
|
u32 commonEmcMemVolt;
|
||||||
} CustomizeTable;
|
} CustomizeTable;
|
||||||
|
|
||||||
extern volatile CustomizeTable C;
|
extern volatile CustomizeTable C;
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ namespace ams::ldr {
|
|||||||
R_DEFINE_ERROR_RESULT(InvalidRegulatorEntry, 1011);
|
R_DEFINE_ERROR_RESULT(InvalidRegulatorEntry, 1011);
|
||||||
R_DEFINE_ERROR_RESULT(UninitializedPatcher, 1012);
|
R_DEFINE_ERROR_RESULT(UninitializedPatcher, 1012);
|
||||||
R_DEFINE_ERROR_RESULT(UnsuccessfulPatcher, 1013);
|
R_DEFINE_ERROR_RESULT(UnsuccessfulPatcher, 1013);
|
||||||
|
R_DEFINE_ERROR_RESULT(SafetyCheckFailure, 1014);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ams::ldr::oc {
|
namespace ams::ldr::oc {
|
||||||
|
|||||||
@@ -29,14 +29,85 @@ Result MemFreqPllmLimit(u32* ptr) {
|
|||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result MemVoltHandler(u32* ptr) {
|
||||||
|
// ptr value might be default_uv or max_uv
|
||||||
|
regulator* entries[2] = {
|
||||||
|
reinterpret_cast<regulator *>(reinterpret_cast<u8 *>(ptr) - offsetof(regulator, type_1.default_uv)),
|
||||||
|
reinterpret_cast<regulator *>(reinterpret_cast<u8 *>(ptr) - offsetof(regulator, type_1.max_uv)),
|
||||||
|
};
|
||||||
|
|
||||||
|
constexpr u32 uv_step = 12'500;
|
||||||
|
constexpr u32 uv_min = 600'000;
|
||||||
|
|
||||||
|
auto validator = [](regulator* entry) {
|
||||||
|
R_UNLESS(entry->id == 1, ldr::ResultInvalidRegulatorEntry());
|
||||||
|
R_UNLESS(entry->type == 1, ldr::ResultInvalidRegulatorEntry());
|
||||||
|
R_UNLESS(entry->type_1.volt_reg == 0x17, ldr::ResultInvalidRegulatorEntry());
|
||||||
|
R_UNLESS(entry->type_1.step_uv == uv_step, ldr::ResultInvalidRegulatorEntry());
|
||||||
|
R_UNLESS(entry->type_1.min_uv == uv_min, ldr::ResultInvalidRegulatorEntry());
|
||||||
|
R_SUCCEED();
|
||||||
|
};
|
||||||
|
|
||||||
|
regulator* entry = nullptr;
|
||||||
|
for (auto& i : entries) {
|
||||||
|
if (R_SUCCEEDED(validator(i)))
|
||||||
|
entry = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
R_UNLESS(entry, ldr::ResultInvalidRegulatorEntry());
|
||||||
|
|
||||||
|
u32 emc_uv = C.commonEmcMemVolt;
|
||||||
|
if (!emc_uv)
|
||||||
|
R_SKIP();
|
||||||
|
|
||||||
|
if (emc_uv % uv_step)
|
||||||
|
emc_uv = emc_uv / uv_step * uv_step; // rounding
|
||||||
|
|
||||||
|
PatchOffset(ptr, emc_uv);
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
void SafetyCheck() {
|
void SafetyCheck() {
|
||||||
if (C.custRev != CUST_REV ||
|
if (C.custRev != CUST_REV)
|
||||||
C.marikoCpuMaxVolt > 1300 ||
|
|
||||||
C.eristaCpuMaxVolt > 1300 ||
|
|
||||||
(C.eristaEmcVolt && (C.eristaEmcVolt < 600'000 || C.eristaEmcVolt > 1250'000)) ||
|
|
||||||
(C.marikoEmcVolt && (C.marikoEmcVolt < 600'000 || C.marikoEmcVolt > 650'000)))
|
|
||||||
{
|
|
||||||
CRASH("Triggered");
|
CRASH("Triggered");
|
||||||
|
|
||||||
|
struct sValidator {
|
||||||
|
volatile u32 value;
|
||||||
|
u32 min;
|
||||||
|
u32 max;
|
||||||
|
bool value_required = false;
|
||||||
|
|
||||||
|
Result check() {
|
||||||
|
if (!value_required && !value)
|
||||||
|
R_SUCCEED();
|
||||||
|
|
||||||
|
if (min && value < min)
|
||||||
|
R_THROW(ldr::ResultSafetyCheckFailure());
|
||||||
|
if (max && value > max)
|
||||||
|
R_THROW(ldr::ResultSafetyCheckFailure());
|
||||||
|
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
sValidator validators[] = {
|
||||||
|
{ C.marikoCpuMaxClock, 1785'000, 3000'000 },
|
||||||
|
{ C.marikoCpuBoostClock, 1020'000, 3000'000, true },
|
||||||
|
{ C.marikoCpuMaxVolt, 1100, 1300 },
|
||||||
|
{ C.marikoGpuMaxClock, 768'000, 1536'000 },
|
||||||
|
{ C.marikoEmcMaxClock, 1600'000, 2400'000 },
|
||||||
|
{ C.marikoEmcVddqVolt, 550'000, 650'000 },
|
||||||
|
{ C.eristaCpuMaxVolt, 1100, 1300 },
|
||||||
|
{ C.eristaEmcMaxClock, 1600'000, 2400'000 },
|
||||||
|
{ C.commonEmcMemVolt, 1100'000, 1250'000 },
|
||||||
|
};
|
||||||
|
|
||||||
|
printf("marikoCpuMaxClock: %u\n", C.marikoCpuMaxClock);
|
||||||
|
|
||||||
|
for (auto& i : validators) {
|
||||||
|
if (R_FAILED(i.check()))
|
||||||
|
CRASH("Triggered");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -117,11 +117,12 @@ static_assert(sizeof(regulator) == 0x120);
|
|||||||
|
|
||||||
constexpr u32 CpuClkOSLimit = 1785'000;
|
constexpr u32 CpuClkOSLimit = 1785'000;
|
||||||
|
|
||||||
constexpr u32 MemClkOSLimit = 1600'000;
|
constexpr u32 EmcClkOSLimit = 1600'000;
|
||||||
|
|
||||||
#define R_SKIP() R_SUCCEED()
|
#define R_SKIP() R_SUCCEED()
|
||||||
|
|
||||||
Result MemFreqPllmLimit(u32* ptr);
|
Result MemFreqPllmLimit(u32* ptr);
|
||||||
|
Result MemVoltHandler(u32* ptr); // Used for Erista MEM Vdd2 + EMC Vddq or Mariko MEM Vdd2
|
||||||
|
|
||||||
template<typename Table>
|
template<typename Table>
|
||||||
Result MemMtcTableClone(Table* des, Table* src) {
|
Result MemMtcTableClone(Table* des, Table* src) {
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ Result MemFreqMtcTable(u32* ptr) {
|
|||||||
R_UNLESS(table_list[i]->rev == MTC_TABLE_REV, ldr::ResultInvalidMtcTable());
|
R_UNLESS(table_list[i]->rev == MTC_TABLE_REV, ldr::ResultInvalidMtcTable());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (C.eristaEmcMaxClock <= MemClkOSLimit)
|
if (C.eristaEmcMaxClock <= EmcClkOSLimit)
|
||||||
R_SKIP();
|
R_SKIP();
|
||||||
|
|
||||||
// Make room for new mtc table, discarding useless 40.8 MHz table
|
// Make room for new mtc table, discarding useless 40.8 MHz table
|
||||||
@@ -86,7 +86,7 @@ Result MemFreqMtcTable(u32* ptr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result MemFreqMax(u32* ptr) {
|
Result MemFreqMax(u32* ptr) {
|
||||||
if (C.eristaEmcMaxClock <= MemClkOSLimit)
|
if (C.eristaEmcMaxClock <= EmcClkOSLimit)
|
||||||
R_SKIP();
|
R_SKIP();
|
||||||
|
|
||||||
PatchOffset(ptr, C.eristaEmcMaxClock);
|
PatchOffset(ptr, C.eristaEmcMaxClock);
|
||||||
@@ -94,27 +94,13 @@ Result MemFreqMax(u32* ptr) {
|
|||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result MemVoltHandler(u32* ptr) {
|
|
||||||
u32 emc_uv = C.eristaEmcVolt;
|
|
||||||
if (!emc_uv)
|
|
||||||
R_SKIP();
|
|
||||||
|
|
||||||
constexpr u32 uv_step = 12'500;
|
|
||||||
if (emc_uv % uv_step)
|
|
||||||
emc_uv = emc_uv / uv_step * uv_step; // rounding
|
|
||||||
|
|
||||||
PatchOffset(ptr, emc_uv);
|
|
||||||
|
|
||||||
R_SUCCEED();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Patch(uintptr_t mapped_nso, size_t nso_size) {
|
void Patch(uintptr_t mapped_nso, size_t nso_size) {
|
||||||
PatcherEntry<u32> patches[] = {
|
PatcherEntry<u32> patches[] = {
|
||||||
{ "CPU Freq Table", &CpuFreqCvbTable, 1, nullptr, CpuClkOSLimit },
|
{ "CPU Freq Table", &CpuFreqCvbTable, 1, nullptr, CpuClkOSLimit },
|
||||||
{ "CPU Volt Limit", &CpuVoltRange, 0, &CpuMaxVoltPatternFn },
|
{ "CPU Volt Limit", &CpuVoltRange, 0, &CpuMaxVoltPatternFn },
|
||||||
{ "MEM Freq Mtc", &MemFreqMtcTable, 0, nullptr, MemClkOSLimit },
|
{ "MEM Freq Mtc", &MemFreqMtcTable, 0, nullptr, EmcClkOSLimit },
|
||||||
{ "MEM Freq Max", &MemFreqMax, 0, nullptr, MemClkOSLimit },
|
{ "MEM Freq Max", &MemFreqMax, 0, nullptr, EmcClkOSLimit },
|
||||||
{ "MEM Freq PLLM", &MemFreqPllmLimit, 2, nullptr, MemClkPllmLimit },
|
{ "MEM Freq PLLM", &MemFreqPllmLimit, 2, nullptr, EmcClkPllmLimit },
|
||||||
{ "MEM Volt", &MemVoltHandler, 2, nullptr, MemVoltHOS },
|
{ "MEM Volt", &MemVoltHandler, 2, nullptr, MemVoltHOS },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ inline bool CpuMaxVoltPatternFn(u32* ptr32) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
constexpr u32 MemVoltHOS = 1125'000;
|
constexpr u32 MemVoltHOS = 1125'000;
|
||||||
constexpr u32 MemClkPllmLimit = 1866'000'000;
|
constexpr u32 EmcClkPllmLimit = 1866'000'000;
|
||||||
|
|
||||||
constexpr u32 MTC_TABLE_REV = 7;
|
constexpr u32 MTC_TABLE_REV = 7;
|
||||||
|
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ void MemMtcTableAutoAdjust(MarikoMtcTable* table, const MarikoMtcTable* ref) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
#define ADJUST_PROP(TARGET, REF) \
|
#define ADJUST_PROP(TARGET, REF) \
|
||||||
(u32)(std::ceil(REF + ((C.marikoEmcMaxClock-MemClkOSAlt)*(TARGET-REF))/(MemClkOSLimit-MemClkOSAlt)))
|
(u32)(std::ceil(REF + ((C.marikoEmcMaxClock-EmcClkOSAlt)*(TARGET-REF))/(EmcClkOSLimit-EmcClkOSAlt)))
|
||||||
|
|
||||||
#define ADJUST_PARAM(TARGET, REF) \
|
#define ADJUST_PARAM(TARGET, REF) \
|
||||||
TARGET = ADJUST_PROP(TARGET, REF);
|
TARGET = ADJUST_PROP(TARGET, REF);
|
||||||
@@ -319,7 +319,7 @@ Result MemFreqMtcTable(u32* ptr) {
|
|||||||
R_UNLESS(table_list[i]->rev == MTC_TABLE_REV, ldr::ResultInvalidMtcTable());
|
R_UNLESS(table_list[i]->rev == MTC_TABLE_REV, ldr::ResultInvalidMtcTable());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (C.marikoEmcMaxClock <= MemClkOSLimit)
|
if (C.marikoEmcMaxClock <= EmcClkOSLimit)
|
||||||
R_SKIP();
|
R_SKIP();
|
||||||
|
|
||||||
MarikoMtcTable *table_alt = table_list[1], *table_max = table_list[0];
|
MarikoMtcTable *table_alt = table_list[1], *table_max = table_list[0];
|
||||||
@@ -349,7 +349,7 @@ Result MemFreqDvbTable(u32* ptr) {
|
|||||||
bool validated = std::memcmp(mem_dvb_table_head, EmcDvbTableDefault, sizeof(EmcDvbTableDefault)) == 0;
|
bool validated = std::memcmp(mem_dvb_table_head, EmcDvbTableDefault, sizeof(EmcDvbTableDefault)) == 0;
|
||||||
R_UNLESS(validated, ldr::ResultInvalidDvbTable());
|
R_UNLESS(validated, ldr::ResultInvalidDvbTable());
|
||||||
|
|
||||||
if (C.marikoEmcMaxClock <= MemClkOSLimit)
|
if (C.marikoEmcMaxClock <= EmcClkOSLimit)
|
||||||
R_SKIP();
|
R_SKIP();
|
||||||
|
|
||||||
if (C.marikoEmcMaxClock <= 1862400) {
|
if (C.marikoEmcMaxClock <= 1862400) {
|
||||||
@@ -364,25 +364,30 @@ Result MemFreqDvbTable(u32* ptr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Result MemFreqMax(u32* ptr) {
|
Result MemFreqMax(u32* ptr) {
|
||||||
if (C.marikoEmcMaxClock <= MemClkOSLimit)
|
if (C.marikoEmcMaxClock <= EmcClkOSLimit)
|
||||||
R_SKIP();
|
R_SKIP();
|
||||||
|
|
||||||
PatchOffset(ptr, C.marikoEmcMaxClock);
|
PatchOffset(ptr, C.marikoEmcMaxClock);
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result MemVoltHandler(u32* ptr) {
|
Result EmcVddqVolt(u32* ptr) {
|
||||||
regulator* entry = reinterpret_cast<regulator *>(reinterpret_cast<u8 *>(ptr) - offsetof(regulator, type_2_3.default_uv));
|
regulator* entry = reinterpret_cast<regulator *>(reinterpret_cast<u8 *>(ptr) - offsetof(regulator, type_2_3.default_uv));
|
||||||
|
|
||||||
constexpr u32 uv_step = 5'000;
|
constexpr u32 uv_step = 5'000;
|
||||||
constexpr u32 uv_min = 250'000;
|
constexpr u32 uv_min = 250'000;
|
||||||
|
|
||||||
if (entry->id != 2 || entry->type != 3 ||
|
auto validator = [entry]() {
|
||||||
entry->type_2_3.step_uv != uv_step ||
|
R_UNLESS(entry->id == 2, ldr::ResultInvalidRegulatorEntry());
|
||||||
entry->type_2_3.min_uv != uv_min)
|
R_UNLESS(entry->type == 3, ldr::ResultInvalidRegulatorEntry());
|
||||||
R_THROW(ldr::ResultInvalidRegulatorEntry());
|
R_UNLESS(entry->type_2_3.step_uv == uv_step, ldr::ResultInvalidRegulatorEntry());
|
||||||
|
R_UNLESS(entry->type_2_3.min_uv == uv_min, ldr::ResultInvalidRegulatorEntry());
|
||||||
|
R_SUCCEED();
|
||||||
|
};
|
||||||
|
|
||||||
|
R_TRY(validator());
|
||||||
|
|
||||||
u32 emc_uv = C.marikoEmcVolt;
|
u32 emc_uv = C.marikoEmcVddqVolt;
|
||||||
if (!emc_uv)
|
if (!emc_uv)
|
||||||
R_SKIP();
|
R_SKIP();
|
||||||
|
|
||||||
@@ -402,11 +407,12 @@ void Patch(uintptr_t mapped_nso, size_t nso_size) {
|
|||||||
{ "GPU Freq Table", &GpuFreqCvbTable, 1, nullptr, GpuClkOfficial },
|
{ "GPU Freq Table", &GpuFreqCvbTable, 1, nullptr, GpuClkOfficial },
|
||||||
{ "GPU Freq Asm", &GpuFreqMaxAsm, 2, &GpuMaxClockPatternFn },
|
{ "GPU Freq Asm", &GpuFreqMaxAsm, 2, &GpuMaxClockPatternFn },
|
||||||
{ "GPU Freq PLL", &GpuFreqPllLimit, 1, nullptr, GpuClkPllLimit },
|
{ "GPU Freq PLL", &GpuFreqPllLimit, 1, nullptr, GpuClkPllLimit },
|
||||||
{ "MEM Freq Mtc", &MemFreqMtcTable, 0, nullptr, MemClkOSLimit },
|
{ "MEM Freq Mtc", &MemFreqMtcTable, 0, nullptr, EmcClkOSLimit },
|
||||||
{ "MEM Freq Dvb", &MemFreqDvbTable, 1, nullptr, MemClkOSLimit },
|
{ "MEM Freq Dvb", &MemFreqDvbTable, 1, nullptr, EmcClkOSLimit },
|
||||||
{ "MEM Freq Max", &MemFreqMax, 0, nullptr, MemClkOSLimit },
|
{ "MEM Freq Max", &MemFreqMax, 0, nullptr, EmcClkOSLimit },
|
||||||
{ "MEM Freq PLLM", &MemFreqPllmLimit, 2, nullptr, MemClkPllmLimit },
|
{ "MEM Freq PLLM", &MemFreqPllmLimit, 2, nullptr, EmcClkPllmLimit },
|
||||||
{ "MEM Volt", &MemVoltHandler, 2, nullptr, MemVoltDefault }
|
{ "MEM Vddq", &EmcVddqVolt, 2, nullptr, EmcVddqDefault },
|
||||||
|
{ "MEM Vdd2", &MemVoltHandler, 2, nullptr, MemVdd2Default }
|
||||||
};
|
};
|
||||||
|
|
||||||
for (uintptr_t ptr = mapped_nso;
|
for (uintptr_t ptr = mapped_nso;
|
||||||
|
|||||||
@@ -115,9 +115,10 @@ constexpr emc_dvb_dvfs_table_t EmcDvbTableDefault[] = {
|
|||||||
{ 1600000, { 675, 650, 637, } },
|
{ 1600000, { 675, 650, 637, } },
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr u32 MemClkOSAlt = 1331'200;
|
constexpr u32 EmcClkOSAlt = 1331'200;
|
||||||
constexpr u32 MemClkPllmLimit = 2133'000'000;
|
constexpr u32 EmcClkPllmLimit = 2133'000'000;
|
||||||
constexpr u32 MemVoltDefault = 600'000;
|
constexpr u32 EmcVddqDefault = 600'000;
|
||||||
|
constexpr u32 MemVdd2Default = 1100'000;
|
||||||
|
|
||||||
constexpr u32 MTC_TABLE_REV = 3;
|
constexpr u32 MTC_TABLE_REV = 3;
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ bool PtmTablePatternFn(u32* ptr) {
|
|||||||
|
|
||||||
void Patch(uintptr_t mapped_nso, size_t nso_size) {
|
void Patch(uintptr_t mapped_nso, size_t nso_size) {
|
||||||
#ifdef ATMOSPHERE_IS_STRATOSPHERE
|
#ifdef ATMOSPHERE_IS_STRATOSPHERE
|
||||||
|
// Ptm patcher is disabled for Erista
|
||||||
bool isMariko = (spl::GetSocType() == spl::SocType_Mariko);
|
bool isMariko = (spl::GetSocType() == spl::SocType_Mariko);
|
||||||
if (!isMariko)
|
if (!isMariko)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -203,8 +203,8 @@ The `[values]` section allows you to alter timings in sys-clk, you should not ne
|
|||||||
|
|
||||||
| Key | Desc | Default |
|
| Key | Desc | Default |
|
||||||
|:------------------------:|-------------------------------------------------------------------------------|:---------:|
|
|:------------------------:|-------------------------------------------------------------------------------|:---------:|
|
||||||
|**allow_unsafe_freq** | (Mariko Only) Allow unsafe frequencies (CPU > 1963.5 MHz, GPU > 921.6 MHz) | OFF |
|
|**allow_unsafe_freq** | Allow unsafe frequencies (CPU > 1963.5 MHz, GPU > 921.6 MHz) | OFF |
|
||||||
|**auto_cpu_boost** | (Mariko Only) Auto-boost CPU when system Core #3 utilization ≥ 95% | ON |
|
|**auto_cpu_boost** | Auto-boost CPU when system Core #3 utilization ≥ 95% | OFF |
|
||||||
|**sync_reversenx_mode** | Sync nominal profile (mode) with ReverseNX (-Tool and -RT) | ON |
|
|**sync_reversenx_mode** | Sync nominal profile (mode) with ReverseNX (-Tool and -RT) | ON |
|
||||||
|**charging_current** | Charging current limit (100 mA - 2000 mA) | 2000 mA |
|
|**charging_current** | Charging current limit (100 mA - 2000 mA) | 2000 mA |
|
||||||
|**charging_limit_perc** | Charging limit (20% - 100%) | 100%(OFF) |
|
|**charging_limit_perc** | Charging limit (20% - 100%) | 100%(OFF) |
|
||||||
|
|||||||
@@ -67,8 +67,8 @@ static inline uint64_t sysclkDefaultConfigValue(SysClkConfigValue val)
|
|||||||
case SysClkConfigValue_CsvWriteIntervalMs:
|
case SysClkConfigValue_CsvWriteIntervalMs:
|
||||||
case SysClkConfigValue_AllowUnsafeFrequencies:
|
case SysClkConfigValue_AllowUnsafeFrequencies:
|
||||||
case SysClkConfigValue_GovernorExperimental:
|
case SysClkConfigValue_GovernorExperimental:
|
||||||
return 0ULL;
|
|
||||||
case SysClkConfigValue_AutoCPUBoost:
|
case SysClkConfigValue_AutoCPUBoost:
|
||||||
|
return 0ULL;
|
||||||
case SysClkConfigValue_SyncReverseNXMode:
|
case SysClkConfigValue_SyncReverseNXMode:
|
||||||
return 1ULL;
|
return 1ULL;
|
||||||
case SysClkConfigValue_ChargingCurrentLimit:
|
case SysClkConfigValue_ChargingCurrentLimit:
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ const u8 MAX17050_CURRENT_REG = 0x0A;
|
|||||||
|
|
||||||
// Buck Converter
|
// Buck Converter
|
||||||
typedef enum I2c_BuckConverter_Reg {
|
typedef enum I2c_BuckConverter_Reg {
|
||||||
I2c_Max77620_SD1VOLT_REG = 0x16,
|
I2c_Max77620_SD1VOLT_REG = 0x17, // Used for Erista DDR VDDQ+VDD2 / Mariko VDD2
|
||||||
I2c_Max77621_VOLT_REG = 0x00,
|
I2c_Max77621_VOLT_REG = 0x00,
|
||||||
I2c_Max77812_CPUVOLT_REG = 0x26,
|
I2c_Max77812_CPUVOLT_REG = 0x26,
|
||||||
I2c_Max77812_GPUVOLT_REG = 0x23,
|
I2c_Max77812_GPUVOLT_REG = 0x23,
|
||||||
I2c_Max77812_MEMVOLT_REG = 0x25, // Master 3 (GPU 1 + 2, DRAM 3, CPU 4)
|
I2c_Max77812_MEMVOLT_REG = 0x25, // Master 3 (GPU 1 + 2, DRAM 3, CPU 4), used for Mariko VDDQ
|
||||||
} I2c_BuckConverter_Reg;
|
} I2c_BuckConverter_Reg;
|
||||||
|
|
||||||
typedef struct I2c_BuckConverter_Domain {
|
typedef struct I2c_BuckConverter_Domain {
|
||||||
@@ -33,12 +33,13 @@ typedef struct I2c_BuckConverter_Domain {
|
|||||||
u8 por_val;
|
u8 por_val;
|
||||||
} I2c_BuckConverter_Domain;
|
} I2c_BuckConverter_Domain;
|
||||||
|
|
||||||
const I2c_BuckConverter_Domain I2c_Erista_CPU = { I2cDevice_Max77621Cpu, I2c_Max77621_VOLT_REG, 0x7F, 6250, 606250, 1400000, };
|
const I2c_BuckConverter_Domain I2c_Erista_CPU = { I2cDevice_Max77621Cpu, I2c_Max77621_VOLT_REG, 0x7F, 6250, 606250, 1400000, };
|
||||||
const I2c_BuckConverter_Domain I2c_Erista_GPU = { I2cDevice_Max77621Gpu, I2c_Max77621_VOLT_REG, 0x7F, 6250, 606250, 1400000, };
|
const I2c_BuckConverter_Domain I2c_Erista_GPU = { I2cDevice_Max77621Gpu, I2c_Max77621_VOLT_REG, 0x7F, 6250, 606250, 1400000, };
|
||||||
const I2c_BuckConverter_Domain I2c_Erista_DRAM = { I2cDevice_Max77620Pmic, I2c_Max77620_SD1VOLT_REG, 0x7F, 12500, 600000, 1250000, };
|
const I2c_BuckConverter_Domain I2c_Erista_DRAM = { I2cDevice_Max77620Pmic, I2c_Max77620_SD1VOLT_REG, 0x7F, 12500, 600000, 1250000, };
|
||||||
const I2c_BuckConverter_Domain I2c_Mariko_CPU = { I2cDevice_Max77812_2, I2c_Max77812_CPUVOLT_REG, 0xFF, 5000, 250000, 1525000, 0x78 };
|
const I2c_BuckConverter_Domain I2c_Mariko_CPU = { I2cDevice_Max77812_2, I2c_Max77812_CPUVOLT_REG, 0xFF, 5000, 250000, 1525000, 0x78 };
|
||||||
const I2c_BuckConverter_Domain I2c_Mariko_GPU = { I2cDevice_Max77812_2, I2c_Max77812_GPUVOLT_REG, 0xFF, 5000, 250000, 1525000, 0x78 };
|
const I2c_BuckConverter_Domain I2c_Mariko_GPU = { I2cDevice_Max77812_2, I2c_Max77812_GPUVOLT_REG, 0xFF, 5000, 250000, 1525000, 0x78 };
|
||||||
const I2c_BuckConverter_Domain I2c_Mariko_DRAM = { I2cDevice_Max77812_2, I2c_Max77812_MEMVOLT_REG, 0xFF, 5000, 250000, 650000, 0x78 };
|
const I2c_BuckConverter_Domain I2c_Mariko_DRAM_VDDQ = { I2cDevice_Max77812_2, I2c_Max77812_MEMVOLT_REG, 0xFF, 5000, 250000, 650000, 0x78 };
|
||||||
|
const I2c_BuckConverter_Domain I2c_Mariko_DRAM_VDD2 = { I2cDevice_Max77620Pmic, I2c_Max77620_SD1VOLT_REG, 0x7F, 12500, 600000, 1250000, };
|
||||||
|
|
||||||
u32 I2c_BuckConverter_GetMvOut(const I2c_BuckConverter_Domain* domain);
|
u32 I2c_BuckConverter_GetMvOut(const I2c_BuckConverter_Domain* domain);
|
||||||
Result I2c_BuckConverter_SetMvOut(const I2c_BuckConverter_Domain* domain, u32 mvolt);
|
Result I2c_BuckConverter_SetMvOut(const I2c_BuckConverter_Domain* domain, u32 mvolt);
|
||||||
|
|||||||
@@ -99,17 +99,16 @@ u8 I2c_BuckConverter_MvOutToMultiplier(const I2c_BuckConverter_Domain* domain, u
|
|||||||
|
|
||||||
u32 I2c_BuckConverter_GetMvOut(const I2c_BuckConverter_Domain* domain) {
|
u32 I2c_BuckConverter_GetMvOut(const I2c_BuckConverter_Domain* domain) {
|
||||||
u8 val;
|
u8 val;
|
||||||
Result res;
|
// Retry 5 times if received POR value
|
||||||
// Retry 3 times if received POR value
|
for (int i = 0; i < 5; i++) {
|
||||||
for (int i = 0; i < 3; i++) {
|
if (R_FAILED(I2cRead_OutU8(domain->device, domain->reg, &val)))
|
||||||
res = I2cRead_OutU8(domain->device, domain->reg, &val);
|
|
||||||
if (R_FAILED(res))
|
|
||||||
return 0u;
|
return 0u;
|
||||||
|
|
||||||
|
// Wait 1us
|
||||||
|
svcSleepThread(1E3);
|
||||||
|
|
||||||
if (!domain->por_val || val != domain->por_val)
|
if (!domain->por_val || val != domain->por_val)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
svcSleepThread(1000);
|
|
||||||
}
|
}
|
||||||
return I2c_BuckConverter_MultiplierToMvOut(domain, val & domain->volt_mask);
|
return I2c_BuckConverter_MultiplierToMvOut(domain, val & domain->volt_mask);
|
||||||
}
|
}
|
||||||
@@ -128,7 +127,8 @@ Result I2c_BuckConverter_SetMvOut(const I2c_BuckConverter_Domain* domain, u32 mv
|
|||||||
if (R_FAILED(res))
|
if (R_FAILED(res))
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
svcSleepThread(1000);
|
// 5ms Ramp delay
|
||||||
|
svcSleepThread(5E6);
|
||||||
u8 new_val;
|
u8 new_val;
|
||||||
res = I2cRead_OutU8(domain->device, domain->reg, &new_val);
|
res = I2cRead_OutU8(domain->device, domain->reg, &new_val);
|
||||||
if (R_FAILED(res))
|
if (R_FAILED(res))
|
||||||
|
|||||||
@@ -61,10 +61,7 @@ void MiscGui::listUI()
|
|||||||
sysclkIpcGetConfigValues(this->configList);
|
sysclkIpcGetConfigValues(this->configList);
|
||||||
this->listElement->addItem(new tsl::elm::CategoryHeader("Config"));
|
this->listElement->addItem(new tsl::elm::CategoryHeader("Config"));
|
||||||
|
|
||||||
if (this->isMariko) {
|
addConfigToggle(SysClkConfigValue_AutoCPUBoost);
|
||||||
addConfigToggle(SysClkConfigValue_AutoCPUBoost);
|
|
||||||
}
|
|
||||||
|
|
||||||
addConfigToggle(SysClkConfigValue_SyncReverseNXMode);
|
addConfigToggle(SysClkConfigValue_SyncReverseNXMode);
|
||||||
addConfigToggle(SysClkConfigValue_GovernorExperimental);
|
addConfigToggle(SysClkConfigValue_GovernorExperimental);
|
||||||
|
|
||||||
@@ -85,7 +82,7 @@ void MiscGui::listUI()
|
|||||||
uint32_t current_ma = val * 100;
|
uint32_t current_ma = val * 100;
|
||||||
this->configList->values[SysClkConfigValue_ChargingCurrentLimit] = current_ma;
|
this->configList->values[SysClkConfigValue_ChargingCurrentLimit] = current_ma;
|
||||||
|
|
||||||
snprintf(chargingCurrentBarDesc, sizeof(chargingCurrentBarDesc), "Battery Charging Current: %lu mA (Now: %+.2f mA)", this->configList->values[SysClkConfigValue_ChargingCurrentLimit], this->i2cInfo->batCurrent);
|
snprintf(chargingCurrentBarDesc, sizeof(chargingCurrentBarDesc), "Charging Current: %lu mA (Now: %+d mA)", this->configList->values[SysClkConfigValue_ChargingCurrentLimit], (int)this->i2cInfo->batCurrent);
|
||||||
this->chargingCurrentHeader->setText(chargingCurrentBarDesc);
|
this->chargingCurrentHeader->setText(chargingCurrentBarDesc);
|
||||||
|
|
||||||
Result rc = sysclkIpcSetConfigValues(this->configList);
|
Result rc = sysclkIpcSetConfigValues(this->configList);
|
||||||
@@ -172,11 +169,11 @@ void MiscGui::refresh() {
|
|||||||
this->backlightToggle->setState(lblstatus);
|
this->backlightToggle->setState(lblstatus);
|
||||||
|
|
||||||
this->chargingCurrentBar->setProgress(this->configList->values[SysClkConfigValue_ChargingCurrentLimit] / 100);
|
this->chargingCurrentBar->setProgress(this->configList->values[SysClkConfigValue_ChargingCurrentLimit] / 100);
|
||||||
snprintf(chargingCurrentBarDesc, sizeof(chargingCurrentBarDesc), "Battery Charging Current: %lu mA (Now: %+.2f mA)", this->configList->values[SysClkConfigValue_ChargingCurrentLimit], this->i2cInfo->batCurrent);
|
snprintf(chargingCurrentBarDesc, sizeof(chargingCurrentBarDesc), "Charging Current: %lu mA (Now: %+d mA)", this->configList->values[SysClkConfigValue_ChargingCurrentLimit], (int)this->i2cInfo->batCurrent);
|
||||||
this->chargingCurrentHeader->setText(chargingCurrentBarDesc);
|
this->chargingCurrentHeader->setText(chargingCurrentBarDesc);
|
||||||
|
|
||||||
this->chargingLimitBar->setProgress(this->configList->values[SysClkConfigValue_ChargingLimitPercentage]);
|
this->chargingLimitBar->setProgress(this->configList->values[SysClkConfigValue_ChargingLimitPercentage]);
|
||||||
snprintf(chargingLimitBarDesc, sizeof(chargingLimitBarDesc), "Battery Charging Limit: %lu%% (Now: %u%%)", this->configList->values[SysClkConfigValue_ChargingLimitPercentage], this->batteryChargePerc);
|
snprintf(chargingLimitBarDesc, sizeof(chargingLimitBarDesc), "Charging Limit: %lu%% (Now: %u%%)", this->configList->values[SysClkConfigValue_ChargingLimitPercentage], this->batteryChargePerc);
|
||||||
this->chargingLimitHeader->setText(chargingLimitBarDesc);
|
this->chargingLimitHeader->setText(chargingLimitBarDesc);
|
||||||
|
|
||||||
I2cGetInfo(this->i2cInfo);
|
I2cGetInfo(this->i2cInfo);
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ class MiscGui : public BaseMenuGui
|
|||||||
float batCurrent;
|
float batCurrent;
|
||||||
u32 cpuVolt;
|
u32 cpuVolt;
|
||||||
u32 gpuVolt;
|
u32 gpuVolt;
|
||||||
u32 dramVolt;
|
u32 emcVddq;
|
||||||
|
u32 memVdd2;
|
||||||
} I2cInfo;
|
} I2cInfo;
|
||||||
|
|
||||||
void PsmUpdate(uint32_t dispatchId = 0)
|
void PsmUpdate(uint32_t dispatchId = 0)
|
||||||
@@ -60,9 +61,17 @@ class MiscGui : public BaseMenuGui
|
|||||||
float batCurrent = I2c_Max17050_GetBatteryCurrent();
|
float batCurrent = I2c_Max17050_GetBatteryCurrent();
|
||||||
i2cInfo->batCurrent = std::abs(batCurrent) < 10. ? 0. : batCurrent;
|
i2cInfo->batCurrent = std::abs(batCurrent) < 10. ? 0. : batCurrent;
|
||||||
|
|
||||||
i2cInfo->cpuVolt = I2c_BuckConverter_GetMvOut(isMariko ? &I2c_Mariko_CPU : &I2c_Erista_CPU);
|
if (isMariko) {
|
||||||
i2cInfo->gpuVolt = I2c_BuckConverter_GetMvOut(isMariko ? &I2c_Mariko_GPU : &I2c_Erista_GPU);
|
i2cInfo->cpuVolt = I2c_BuckConverter_GetMvOut(&I2c_Mariko_CPU);
|
||||||
i2cInfo->dramVolt = I2c_BuckConverter_GetMvOut(isMariko ? &I2c_Mariko_DRAM : &I2c_Erista_DRAM);
|
i2cInfo->gpuVolt = I2c_BuckConverter_GetMvOut(&I2c_Mariko_GPU);
|
||||||
|
i2cInfo->emcVddq = I2c_BuckConverter_GetMvOut(&I2c_Mariko_DRAM_VDDQ);
|
||||||
|
i2cInfo->memVdd2 = I2c_BuckConverter_GetMvOut(&I2c_Mariko_DRAM_VDD2);
|
||||||
|
} else {
|
||||||
|
i2cInfo->cpuVolt = I2c_BuckConverter_GetMvOut(&I2c_Mariko_CPU);
|
||||||
|
i2cInfo->gpuVolt = I2c_BuckConverter_GetMvOut(&I2c_Mariko_GPU);
|
||||||
|
i2cInfo->emcVddq = I2c_BuckConverter_GetMvOut(&I2c_Erista_DRAM);
|
||||||
|
i2cInfo->memVdd2 = i2cInfo->emcVddq;
|
||||||
|
}
|
||||||
|
|
||||||
I2c_Bq24193_GetFastChargeCurrentLimit(reinterpret_cast<u32 *>(&(chargeInfo->ChargeCurrentLimit)));
|
I2c_Bq24193_GetFastChargeCurrentLimit(reinterpret_cast<u32 *>(&(chargeInfo->ChargeCurrentLimit)));
|
||||||
|
|
||||||
@@ -98,7 +107,7 @@ class MiscGui : public BaseMenuGui
|
|||||||
"%s\n\n"
|
"%s\n\n"
|
||||||
"%dmV\n"
|
"%dmV\n"
|
||||||
"%dmV\n"
|
"%dmV\n"
|
||||||
"%dmV\n"
|
"Vddq %dmV, Vdd2 %dmV\n"
|
||||||
,
|
,
|
||||||
PsmInfoChargerTypeToStr(chargeInfo->ChargerType), chargWattsInfo,
|
PsmInfoChargerTypeToStr(chargeInfo->ChargerType), chargWattsInfo,
|
||||||
(float)chargeInfo->VoltageAvg / 1000, (float)chargeInfo->BatteryTemperature / 1000,
|
(float)chargeInfo->VoltageAvg / 1000, (float)chargeInfo->BatteryTemperature / 1000,
|
||||||
@@ -110,7 +119,7 @@ class MiscGui : public BaseMenuGui
|
|||||||
batCurInfo,
|
batCurInfo,
|
||||||
i2cInfo->cpuVolt,
|
i2cInfo->cpuVolt,
|
||||||
i2cInfo->gpuVolt,
|
i2cInfo->gpuVolt,
|
||||||
i2cInfo->dramVolt
|
i2cInfo->emcVddq, i2cInfo->memVdd2
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,8 +175,8 @@ class MiscGui : public BaseMenuGui
|
|||||||
"GPU Volt:\n"\
|
"GPU Volt:\n"\
|
||||||
"DRAM Volt:";
|
"DRAM Volt:";
|
||||||
char infoVals[300] = "";
|
char infoVals[300] = "";
|
||||||
char chargingLimitBarDesc[50] = "";
|
char chargingLimitBarDesc[40] = "";
|
||||||
char chargingCurrentBarDesc[60] = "";
|
char chargingCurrentBarDesc[50] = "";
|
||||||
u32 batteryChargePerc = 0;
|
u32 batteryChargePerc = 0;
|
||||||
u8 frameCounter = 60;
|
u8 frameCounter = 60;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -217,10 +217,10 @@ bool ClockManager::RefreshContext()
|
|||||||
this->rnxSync->ToggleSync(this->GetConfig()->GetConfigValue(SysClkConfigValue_SyncReverseNXMode));
|
this->rnxSync->ToggleSync(this->GetConfig()->GetConfigValue(SysClkConfigValue_SyncReverseNXMode));
|
||||||
bool allowUnsafe = this->GetConfig()->GetConfigValue(SysClkConfigValue_AllowUnsafeFrequencies);
|
bool allowUnsafe = this->GetConfig()->GetConfigValue(SysClkConfigValue_AllowUnsafeFrequencies);
|
||||||
Clocks::SetAllowUnsafe(allowUnsafe);
|
Clocks::SetAllowUnsafe(allowUnsafe);
|
||||||
if (Clocks::GetIsMariko()) {
|
|
||||||
|
this->governor->SetAutoCPUBoost(this->GetConfig()->GetConfigValue(SysClkConfigValue_AutoCPUBoost));
|
||||||
|
if (Clocks::GetIsMariko())
|
||||||
this->governor->SetCPUBoostHz(Clocks::GetNearestHz(SysClkModule_CPU, SysClkProfile_EnumMax, Clocks::boostCpuFreq));
|
this->governor->SetCPUBoostHz(Clocks::GetNearestHz(SysClkModule_CPU, SysClkProfile_EnumMax, Clocks::boostCpuFreq));
|
||||||
this->governor->SetAutoCPUBoost(this->GetConfig()->GetConfigValue(SysClkConfigValue_AutoCPUBoost));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool enabled = this->GetConfig()->Enabled();
|
bool enabled = this->GetConfig()->Enabled();
|
||||||
|
|||||||
@@ -69,9 +69,7 @@ void Config::Load()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Erista: Disable Mariko only features
|
// Erista: Disable Mariko only features
|
||||||
if (!Clocks::GetIsMariko()) {
|
// if (!Clocks::GetIsMariko()) { }
|
||||||
this->configValues[SysClkConfigValue_AutoCPUBoost] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->loaded = true;
|
this->loaded = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -292,8 +292,13 @@ Result FileUtils::CustParser(const char* filepath, size_t filesize) {
|
|||||||
Clocks::maxMemFreq = table.marikoEmcMaxClock * 1000;
|
Clocks::maxMemFreq = table.marikoEmcMaxClock * 1000;
|
||||||
if (table.marikoEmcVolt && table.marikoEmcVolt >= 600'000 && table.marikoEmcVolt <= 650'000) {
|
if (table.marikoEmcVolt && table.marikoEmcVolt >= 600'000 && table.marikoEmcVolt <= 650'000) {
|
||||||
u32 mvolt = table.marikoEmcVolt / 1000;
|
u32 mvolt = table.marikoEmcVolt / 1000;
|
||||||
Result res = I2c_BuckConverter_SetMvOut(&I2c_Mariko_DRAM, mvolt);
|
Result res = I2c_BuckConverter_SetMvOut(&I2c_Mariko_DRAM_VDDQ, mvolt);
|
||||||
LogLine("Set EMC volt to %u mV: %s", mvolt, R_FAILED(res) ? "Failed" : "OK");
|
LogLine("Set EMC Vddq volt to %u mV: %s", mvolt, R_FAILED(res) ? "Failed" : "OK");
|
||||||
|
}
|
||||||
|
if (table.commonEmcMemVolt && table.commonEmcMemVolt >= 1100'000 && table.commonEmcMemVolt <= 1250'000) {
|
||||||
|
u32 mvolt = table.commonEmcMemVolt / 1000;
|
||||||
|
Result res = I2c_BuckConverter_SetMvOut(&I2c_Mariko_DRAM_VDD2, mvolt);
|
||||||
|
LogLine("Set MEM Vdd2 volt to %u mV: %s", mvolt, R_FAILED(res) ? "Failed" : "OK");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (table.eristaEmcMaxClock)
|
if (table.eristaEmcMaxClock)
|
||||||
|
|||||||
@@ -30,8 +30,6 @@ class FileUtils
|
|||||||
static void Exit();
|
static void Exit();
|
||||||
static Result Initialize();
|
static Result Initialize();
|
||||||
static bool IsInitialized();
|
static bool IsInitialized();
|
||||||
static bool IsLogEnabled();
|
|
||||||
static bool ExistReverseNXTool();
|
|
||||||
static void InitializeAsync();
|
static void InitializeAsync();
|
||||||
static void LogLine(const char *format, ...);
|
static void LogLine(const char *format, ...);
|
||||||
static void WriteContextToCsv(const SysClkContext* context);
|
static void WriteContextToCsv(const SysClkContext* context);
|
||||||
@@ -51,7 +49,7 @@ class FileUtils
|
|||||||
uint32_t marikoEmcVolt;
|
uint32_t marikoEmcVolt;
|
||||||
uint32_t eristaCpuMaxVolt;
|
uint32_t eristaCpuMaxVolt;
|
||||||
uint32_t eristaEmcMaxClock;
|
uint32_t eristaEmcMaxClock;
|
||||||
uint32_t eristaEmcVolt;
|
uint32_t commonEmcMemVolt;
|
||||||
} CustTable;
|
} CustTable;
|
||||||
|
|
||||||
static void RefreshFlags(bool force);
|
static void RefreshFlags(bool force);
|
||||||
|
|||||||
111
pages/dist/index.html
vendored
111
pages/dist/index.html
vendored
@@ -4,10 +4,16 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Switch OC Suite</title>
|
<title>Switch OC Suite > Project Homepage | Overclocking suite for Horizon OS (HOS) running on Atmosphere CFW. Licensed under GPL v2.
|
||||||
|
</title>
|
||||||
<meta name="description"
|
<meta name="description"
|
||||||
content="Overclocking suite for Horizon OS (HOS) running on Atmosphere CFW. Licensed under GPL v2.">
|
content="Overclocking suite for Horizon OS (HOS) running on Atmosphere CFW. Licensed under GPL v2.">
|
||||||
<link rel="stylesheet" href="https://unpkg.com/@picocss/pico@latest/css/pico.min.css">
|
<link rel="stylesheet" href="https://unpkg.com/@picocss/pico@latest/css/pico.min.css">
|
||||||
|
<style>
|
||||||
|
div#download_btn_grid > a {
|
||||||
|
margin: 0.5rem 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@@ -79,21 +85,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>DRAM Overclock (Safe: 1862.4 MHz)
|
<li>DRAM Overclock (Safe: 1862.4 MHz)</li>
|
||||||
<ul>
|
|
||||||
<li>Unsafe: Up to 2131 MHz with DRAM bus overvolting depending on your
|
|
||||||
DRAM chip</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li>Modded sys-clk and ReverseNX-RT
|
|
||||||
<ul>
|
|
||||||
<li>CPU & GPU frequency governor (Experimental)</li>
|
|
||||||
<li>Set charging current (100 mA - 2000 mA) and charging limit (20% -
|
|
||||||
100%)</li>
|
|
||||||
<li>Global Profile</li>
|
|
||||||
<li>Sync ReverseNX Mode</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</details>
|
</details>
|
||||||
<details>
|
<details>
|
||||||
@@ -114,55 +106,46 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>DRAM Overclock (Safe: 1996.8 MHz)</li>
|
<li>DRAM Overclock (Safe: 1996.8 MHz)</li>
|
||||||
<li>Modded sys-clk and ReverseNX-RT
|
</ul>
|
||||||
|
</details>
|
||||||
|
<details>
|
||||||
|
<summary>Modded sys-clk and ReverseNX-RT</summary>
|
||||||
|
<ul>
|
||||||
|
<li>Auto CPU Boost
|
||||||
<ul>
|
<ul>
|
||||||
<li>Auto CPU Boost</li>
|
<li>For faster game loading</li>
|
||||||
<li>CPU & GPU frequency governor (Experimental)</li>
|
<li>Enable CPU Boost (1785 MHz) when CPU Core#3 (System Core) is
|
||||||
<li>Set charging current (100 mA - 2000 mA) and charging limit (20% -
|
stressed (mainly I/O operations).</li>
|
||||||
100%)</li>
|
<li>Effective only when charger is connected.</li>
|
||||||
<li>Global Profile</li>
|
</ul>
|
||||||
<li>Sync ReverseNX Mode</li>
|
</li>
|
||||||
|
<li>CPU & GPU frequency governor (Experimental)
|
||||||
|
<ul>
|
||||||
|
<li>Adjust frequency based on load. Might decrease power draw but can
|
||||||
|
introduce stutters. Can be turned off for specific titles.</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>Set charging current (100 mA - 2000 mA) and charging limit (20% -
|
||||||
|
100%)
|
||||||
|
<ul>
|
||||||
|
<li>Long-term use of charge limit may render the battery gauge
|
||||||
|
inaccurate. Performing full cycles could help recalibration, or try <a
|
||||||
|
href="https://github.com/CTCaer/battery_desync_fix_nx">battery_desync_fix_nx</a>.</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>Global Profile
|
||||||
|
<ul>
|
||||||
|
<li>Designated a dummy title id <code>0xA111111111111111</code>.</li>
|
||||||
|
<li>Priority: "Temp overrides" > "Application profile" > "Global
|
||||||
|
profile" > "System default".</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>Sync ReverseNX Mode
|
||||||
|
<ul>
|
||||||
|
<li>No need to change clocks manually after toggling modes in ReverseNX
|
||||||
|
(-RT and -Tool)</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
|
||||||
</details>
|
|
||||||
<details>
|
|
||||||
<summary>Auto CPU Boost</summary>
|
|
||||||
<ul>
|
|
||||||
<li>For faster game loading</li>
|
|
||||||
<li>Enable CPU Boost (1785 MHz) when CPU Core#3 (System Core) is
|
|
||||||
stressed (mainly I/O operations).</li>
|
|
||||||
<li>Effective only when charger is connected.</li>
|
|
||||||
</ul>
|
|
||||||
</details>
|
|
||||||
<details>
|
|
||||||
<summary>CPU & GPU frequency governor (Experimental)</summary>
|
|
||||||
<ul>
|
|
||||||
<li>Adjust frequency based on load. Might decrease power draw but can
|
|
||||||
introduce stutters. Can be turned off for specific titles.</li>
|
|
||||||
</ul>
|
|
||||||
</details>
|
|
||||||
<details>
|
|
||||||
<summary>Setting charge limit (20% - 100%)</summary>
|
|
||||||
<ul>
|
|
||||||
<li>Long-term use of charge limit may render the battery gauge
|
|
||||||
inaccurate. Performing full cycles could help recalibration, or try <a
|
|
||||||
href="https://github.com/CTCaer/battery_desync_fix_nx">battery_desync_fix_nx</a>.</li>
|
|
||||||
</ul>
|
|
||||||
</details>
|
|
||||||
<details>
|
|
||||||
<summary>Global profile</summary>
|
|
||||||
<ul>
|
|
||||||
<li>Designated a dummy title id <code>0xA111111111111111</code>.</li>
|
|
||||||
<li>Priority: "Temp overrides" > "Application profile" > "Global
|
|
||||||
profile" > "System default".</li>
|
|
||||||
</ul>
|
|
||||||
</details>
|
|
||||||
<details>
|
|
||||||
<summary>Sync ReverseNX Mode</summary>
|
|
||||||
<ul>
|
|
||||||
<li>No need to change clocks manually after toggling modes in ReverseNX
|
|
||||||
(-RT and -Tool)</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</details>
|
</details>
|
||||||
<details>
|
<details>
|
||||||
@@ -201,7 +184,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>CPU Volt</td>
|
<td>CPU Volt</td>
|
||||||
<td>1235 mV Max</td>
|
<td>1235 mV Max</td>
|
||||||
<td>1257 mV Max</td>
|
<td>1235 mV Max</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>GPU OC</td>
|
<td>GPU OC</td>
|
||||||
@@ -336,7 +319,7 @@
|
|||||||
</header>
|
</header>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="grid">
|
<div class="grid" id="download_btn_grid">
|
||||||
<a role="button" aria-busy="true" id="loader_kip_btn">Generating link, please wait...</a>
|
<a role="button" aria-busy="true" id="loader_kip_btn">Generating link, please wait...</a>
|
||||||
<a role="button" aria-busy="true" id="sdout_zip_btn">Generating link, please wait...</a>
|
<a role="button" aria-busy="true" id="sdout_zip_btn">Generating link, please wait...</a>
|
||||||
<a target="_blank" role="button" aria-busy="true" id="ams_btn">Generating link, please wait...</a>
|
<a target="_blank" role="button" aria-busy="true" id="ams_btn">Generating link, please wait...</a>
|
||||||
|
|||||||
302
pages/dist/main.js
vendored
302
pages/dist/main.js
vendored
@@ -8,10 +8,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
/* Config: Cust */
|
/* Config: Cust */
|
||||||
var CUST_REV;
|
const CUST_REV = 3;
|
||||||
var buffer;
|
var buffer;
|
||||||
class CustEntry {
|
class CustEntry {
|
||||||
constructor(name, size, desc, defval, minmax = [0, 1000000], step = 1, extra_validator) {
|
constructor(id, name, size, desc, defval, minmax = [0, 1000000], step = 1, zeroable = true) {
|
||||||
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.size = size;
|
this.size = size;
|
||||||
this.desc = desc;
|
this.desc = desc;
|
||||||
@@ -19,80 +20,106 @@ class CustEntry {
|
|||||||
this.min = minmax[0];
|
this.min = minmax[0];
|
||||||
this.max = minmax[1];
|
this.max = minmax[1];
|
||||||
this.step = step;
|
this.step = step;
|
||||||
this.validator = extra_validator;
|
this.zeroable = zeroable;
|
||||||
this.value = null;
|
this.value = null;
|
||||||
this.offset = null;
|
this.offset = null;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
validate() {
|
||||||
|
let tip = new ErrorToolTip(this.id);
|
||||||
|
tip.clear();
|
||||||
|
if (Number.isNaN(this.value) || this.value === null) {
|
||||||
|
tip.setMsg(`Invalid value: Not a number`);
|
||||||
|
tip.show();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this.zeroable && this.value == 0)
|
||||||
|
return true;
|
||||||
|
if (this.value < this.min || this.value > this.max) {
|
||||||
|
tip.setMsg(`Expected range: [${this.min}, ${this.max}], got ${this.value}.`);
|
||||||
|
tip.show();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this.value % this.step != 0) {
|
||||||
|
tip.setMsg(`${this.value} % ${this.step} ≠ 0`);
|
||||||
|
tip.show();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
update() {
|
||||||
|
this.value = Number(document.getElementById(this.id).value);
|
||||||
|
}
|
||||||
|
getInputElement() {
|
||||||
|
return document.getElementById(this.id);
|
||||||
|
}
|
||||||
|
createForm() {
|
||||||
|
let form = document.getElementById("form");
|
||||||
|
let input = this.getInputElement();
|
||||||
|
if (!input) {
|
||||||
|
let grid = document.createElement("div");
|
||||||
|
grid.classList.add("grid");
|
||||||
|
// Label and input
|
||||||
|
input = document.createElement("input");
|
||||||
|
input.min = String(this.min);
|
||||||
|
input.max = String(this.max);
|
||||||
|
input.id = this.id;
|
||||||
|
input.type = "number";
|
||||||
|
input.step = String(this.step);
|
||||||
|
let label = document.createElement("label");
|
||||||
|
label.setAttribute("for", this.id);
|
||||||
|
label.innerHTML = this.name;
|
||||||
|
label.appendChild(input);
|
||||||
|
grid.appendChild(label);
|
||||||
|
// Description in blockquote style
|
||||||
|
let desc = document.createElement("blockquote");
|
||||||
|
desc.style["margin-top"] = "0";
|
||||||
|
desc.innerHTML = this.desc;
|
||||||
|
desc.setAttribute("for", this.id);
|
||||||
|
grid.appendChild(desc);
|
||||||
|
grid.style["margin-top"] = "3rem";
|
||||||
|
form.appendChild(grid);
|
||||||
|
let tooltip = new ErrorToolTip(this.id);
|
||||||
|
tooltip.addChangeListener();
|
||||||
|
}
|
||||||
|
input.value = String(this.value);
|
||||||
|
}
|
||||||
|
clearForm() {
|
||||||
|
let input = this.getInputElement();
|
||||||
|
if (input) {
|
||||||
|
input.parentElement.parentElement.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var CustTable = null;
|
var CustTable = [
|
||||||
const CustTableV2 = [
|
new CustEntry("mtcConf", "DRAM Timing", 2, "<li><b>0</b>: AUTO_ADJ_MARIKO_SAFE: Auto adjust timings for LPDDR4 ≤3733 Mbps specs, 8Gb density. (Default)</li>\
|
||||||
new CustEntry("mtcConf", 2, "<b>DRAM Timing</b>\
|
<li><b>1</b>: AUTO_ADJ_MARIKO_4266: Auto adjust timings for LPDDR4X 4266 Mbps specs, 8Gb density.</li>\
|
||||||
<li><b>0</b>: AUTO_ADJ_MARIKO_SAFE: Auto adjust timings for LPDDR4 ≤3733 Mbps specs, 8Gb density. (Default)</li>\
|
<li><b>2</b>: NO_ADJ_ALL: No timing adjustment for both Erista and Mariko. Might achieve better performance on Mariko but lower maximum frequency is expected.", 0, [0, 2], 1),
|
||||||
<li><b>1</b>: AUTO_ADJ_MARIKO_4266: Auto adjust timings for LPDDR4X 4266 Mbps specs, 8Gb density.</li>", 0, [0, 3]),
|
new CustEntry("marikoCpuMaxClock", "Mariko CPU Max Clock in kHz", 4, "<li>System default: 1785000</li>\
|
||||||
new CustEntry("marikoCpuMaxClock", 4, "<b>Mariko CPU Max Clock in kHz</b>\
|
<li>2397000 might be unreachable for some SoCs.</li>", 2397000, [1785000, 3000000], 1),
|
||||||
<li>System default: 1785000</li>\
|
new CustEntry("marikoCpuBoostClock", "Mariko CPU Boost Clock in kHz", 4, "<li>System default: 1785000</li>\
|
||||||
<li>2397000 might be unreachable for some SoCs.</li>", 2397000, [1785000, 3000000], 100, (x) => (x % 100) == 0),
|
<li>Boost clock will be applied when applications request higher CPU frequency for quicker loading.</li>\
|
||||||
new CustEntry("marikoCpuBoostClock", 4, "<b>Mariko CPU Boost Clock in kHz</b>\
|
<li>This will be set regardless of whether sys-clk is enabled.</li>", 1785000, [1020000, 3000000], 1, false),
|
||||||
<li>System default: 1785000</li>\
|
new CustEntry("marikoCpuMaxVolt", "Mariko CPU Max Voltage in mV", 4, "<li>System default: 1120</li>\
|
||||||
<li>Boost clock will be applied when applications request higher CPU frequency for quicker loading.</li>\
|
<li>Acceptable range: 1100 ≤ x ≤ 1300</li>", 1235, [1100, 1300], 5),
|
||||||
<li>This will be set regardless of whether sys-clk is enabled.</li>", 1785000, [1785000, 3000000], 100, (x) => (x % 100) == 0),
|
new CustEntry("marikoGpuMaxClock", "Mariko GPU Max Clock in kHz", 4, "<li>System default: 921600</li>\
|
||||||
new CustEntry("marikoCpuMaxVolt", 4, "<b>Mariko CPU Max Voltage in mV</b>\
|
<li>Tegra X1+ official maximum: 1267200</li>\
|
||||||
<li>System default: 1120</li>\
|
<li>1305600 might be unreachable for some SoCs.</li>", 1305600, [768000, 1536000], 100),
|
||||||
<li>Acceptable range: 1100 ≤ x ≤ 1300</li>", 1235, [1100, 1300]),
|
new CustEntry("marikoEmcMaxClock", "Mariko RAM Max Clock in kHz", 4, "<li>Values should be ≥ 1600000, and divided evenly by 3200.</li>\
|
||||||
new CustEntry("marikoGpuMaxClock", 4, "<b>Mariko GPU Max Clock in kHz</b>\
|
<li><b>WARNING:</b> RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM</li>", 1996800, [1600000, 2400000], 3200),
|
||||||
<li>System default: 921600</li>\
|
new CustEntry("marikoEmcVddqVolt", "EMC Vddq (Mariko Only) Voltage in uV", 4, "<li>Acceptable range: 550000 ≤ x ≤ 650000</li>\
|
||||||
<li>Tegra X1+ official maximum: 1267200</li>\
|
<li>Value should be divided evenly by 5000</li>\
|
||||||
<li>1305600 might be unreachable for some SoCs.</li>", 1305600, [768000, 1536000], 100, (x) => (x % 100) == 0),
|
<li>Default: 600000</li>\
|
||||||
new CustEntry("marikoEmcMaxClock", 4, "<b>Mariko RAM Max Clock in kHz</b>\
|
<li>Not enabled by default.</li>\
|
||||||
<li>Values should be > 1600000, and divided evenly by 3200.</li>\
|
<li>This will not work without sys-clk-OC.</li>", 0, [550000, 650000], 5000),
|
||||||
<li><b>WARNING:</b> RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM</li>", 1996800, [1612800, 2400000], 3200, (x) => (x % 3200) == 0),
|
new CustEntry("eristaCpuMaxVolt", "Erista CPU Max Voltage in mV", 4, "<li>Acceptable range: 1100 ≤ x ≤ 1300</li>", 1235, [1100, 1300], 1),
|
||||||
new CustEntry("eristaOCEnable", 4, "<b>Erista CPU Enable Overclock</b>\
|
new CustEntry("eristaEmcMaxClock", "Erista RAM Max Clock in kHz", 4, "<li>Values should be ≥ 1600000, and divided evenly by 3200.</li>\
|
||||||
<li>Not tested</li>", 1, [0, 1]),
|
<li><b>WARNING:</b> RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM</li>", 1862400, [1600000, 2400000], 3200),
|
||||||
new CustEntry("eristaCpuMaxVolt", 4, "<b>Erista CPU Max Voltage in mV</b>\
|
new CustEntry("commonEmcMemVolt", "EMC Vddq (Erista Only) & RAM Vdd2 Voltage in uV", 4, "<li>Acceptable range: 1100000 ≤ x ≤ 1250000, and it should be divided evenly by 12500.</li>\
|
||||||
<li>Acceptable range: 1100 ≤ x ≤ 1300</li>", 1235, [0, 1300], 1, (x) => x >= 1100),
|
<li>Erista Default (HOS): 1125000 (bootloader: 1100000)</li>\
|
||||||
new CustEntry("eristaEmcMaxClock", 4, "<b>Erista RAM Max Clock in kHz</b>\
|
<li>Mariko Default: 1100000 (It will not work without sys-clk-OC)</li>\
|
||||||
<li>Values should be > 1600000, and divided evenly by 3200.</li>\
|
<li>Not enabled by default</li>", 0, [1100000, 1250000], 12500),
|
||||||
<li><b>WARNING:</b> RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM</li>", 1862400, [1600000, 2400000], 3200, (x) => (x % 3200) == 0),
|
|
||||||
new CustEntry("eristaEmcVolt", 4, "<b>Erista RAM Voltage in uV</b>\
|
|
||||||
<li>Acceptable range: 1100000 ≤ x ≤ 1250000, and it should be divided evenly by 12500.</li>\
|
|
||||||
<li>Not enabled by default</li>", 0, [0, 1250000], 12500, (x) => (x % 12500) == 0 && x >= 1100000),
|
|
||||||
];
|
|
||||||
const CustTableV3 = [
|
|
||||||
new CustEntry("mtcConf", 2, "<b>DRAM Timing</b>\
|
|
||||||
<li><b>0</b>: AUTO_ADJ_MARIKO_SAFE: Auto adjust timings for LPDDR4 ≤3733 Mbps specs, 8Gb density. (Default)</li>\
|
|
||||||
<li><b>1</b>: AUTO_ADJ_MARIKO_4266: Auto adjust timings for LPDDR4X 4266 Mbps specs, 8Gb density.</li>\
|
|
||||||
<li><b>2</b>: NO_ADJ_ALL: No timing adjustment for both Erista and Mariko. Might achieve better performance on Mariko but lower maximum frequency is expected.", 0, [0, 3]),
|
|
||||||
new CustEntry("marikoCpuMaxClock", 4, "<b>Mariko CPU Max Clock in kHz</b>\
|
|
||||||
<li>System default: 1785000</li>\
|
|
||||||
<li>2397000 might be unreachable for some SoCs.</li>", 2397000, [1785000, 3000000], 100, (x) => (x % 100) == 0),
|
|
||||||
new CustEntry("marikoCpuBoostClock", 4, "<b>Mariko CPU Boost Clock in kHz</b>\
|
|
||||||
<li>System default: 1785000</li>\
|
|
||||||
<li>Boost clock will be applied when applications request higher CPU frequency for quicker loading.</li>\
|
|
||||||
<li>This will be set regardless of whether sys-clk is enabled.</li>", 1785000, [1785000, 3000000], 100, (x) => (x % 100) == 0),
|
|
||||||
new CustEntry("marikoCpuMaxVolt", 4, "<b>Mariko CPU Max Voltage in mV</b>\
|
|
||||||
<li>System default: 1120</li>\
|
|
||||||
<li>Acceptable range: 1100 ≤ x ≤ 1300</li>", 1235, [1100, 1300]),
|
|
||||||
new CustEntry("marikoGpuMaxClock", 4, "<b>Mariko GPU Max Clock in kHz</b>\
|
|
||||||
<li>System default: 921600</li>\
|
|
||||||
<li>Tegra X1+ official maximum: 1267200</li>\
|
|
||||||
<li>1305600 might be unreachable for some SoCs.</li>", 1305600, [768000, 1536000], 100, (x) => (x % 100) == 0),
|
|
||||||
new CustEntry("marikoEmcMaxClock", 4, "<b>Mariko RAM Max Clock in kHz</b>\
|
|
||||||
<li>Values should be > 1600000, and divided evenly by 3200.</li>\
|
|
||||||
<li><b>WARNING:</b> RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM</li>", 1996800, [1612800, 2400000], 3200, (x) => (x % 3200) == 0),
|
|
||||||
new CustEntry("marikoEmcVolt", 4, "<b>Mariko RAM Voltage in uV</b>\
|
|
||||||
<li>Acceptable range: 600000 ≤ x ≤ 650000</li>\
|
|
||||||
<li>Value should be divided evenly by 5'000</li>\
|
|
||||||
<li>Not enabled by default.</li>\
|
|
||||||
<li>This will not work without sys-clk-OC.</li>", 1, [0, 1]),
|
|
||||||
new CustEntry("eristaCpuMaxVolt", 4, "<b>Erista CPU Max Voltage in mV</b>\
|
|
||||||
<li>Acceptable range: 1100 ≤ x ≤ 1300</li>", 1235, [0, 1300], 1, (x) => x >= 1100),
|
|
||||||
new CustEntry("eristaEmcMaxClock", 4, "<b>Erista RAM Max Clock in kHz</b>\
|
|
||||||
<li>Values should be > 1600000, and divided evenly by 3200.</li>\
|
|
||||||
<li><b>WARNING:</b> RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM</li>", 1862400, [1600000, 2400000], 3200, (x) => (x % 3200) == 0),
|
|
||||||
new CustEntry("eristaEmcVolt", 4, "<b>Erista RAM Voltage in uV</b>\
|
|
||||||
<li>Acceptable range: 1100000 ≤ x ≤ 1250000, and it should be divided evenly by 12500.</li>\
|
|
||||||
<li>Not enabled by default</li>", 0, [0, 1250000], 12500, (x) => (x % 12500) == 0 && x >= 1100000),
|
|
||||||
];
|
];
|
||||||
function FindMagicOffset(buffer) {
|
function FindMagicOffset(buffer) {
|
||||||
let view = new DataView(buffer);
|
let view = new DataView(buffer);
|
||||||
@@ -104,9 +131,12 @@ function FindMagicOffset(buffer) {
|
|||||||
throw new Error("Invalid loader.kip file");
|
throw new Error("Invalid loader.kip file");
|
||||||
}
|
}
|
||||||
class ErrorToolTip {
|
class ErrorToolTip {
|
||||||
constructor(id) {
|
constructor(id, msg) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.element = document.getElementById(id);
|
this.element = document.getElementById(id);
|
||||||
|
if (msg) {
|
||||||
|
this.setMsg(msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
setMsg(msg) {
|
setMsg(msg) {
|
||||||
@@ -134,52 +164,28 @@ class ErrorToolTip {
|
|||||||
addChangeListener() {
|
addChangeListener() {
|
||||||
if (this.element) {
|
if (this.element) {
|
||||||
this.element.addEventListener('change', (_evt) => {
|
this.element.addEventListener('change', (_evt) => {
|
||||||
let obj = CustTable.filter((obj) => { return obj.name === this.id; })[0];
|
let obj = CustTable.filter((obj) => { return obj.id === this.id; })[0];
|
||||||
obj.value = Number(this.element.value);
|
obj.value = Number(this.element.value);
|
||||||
ValidateCustEntry(obj);
|
obj.validate();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
function ValidateCustEntry(entry) {
|
|
||||||
let elementId = entry.name;
|
|
||||||
let tip = new ErrorToolTip(elementId);
|
|
||||||
tip.clear();
|
|
||||||
if (entry.value == 0)
|
|
||||||
return null;
|
|
||||||
if (entry.value < entry.min || entry.value > entry.max) {
|
|
||||||
tip.setMsg(`Expected range: [${entry.min}, ${entry.max}], got ${entry.value}.`);
|
|
||||||
tip.show();
|
|
||||||
return tip;
|
|
||||||
}
|
|
||||||
if (entry.validator && !entry.validator(entry.value)) {
|
|
||||||
tip.setMsg(`Invalid value: ${entry.value}. Did not pass this validator: ${entry.validator}.`);
|
|
||||||
tip.show();
|
|
||||||
return tip;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
function ValidateCust() {
|
|
||||||
let tooltips = [];
|
|
||||||
for (let i of CustTable) {
|
|
||||||
let tip = ValidateCustEntry(i);
|
|
||||||
if (tip) {
|
|
||||||
tooltips.push(tip);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (tooltips.length > 0) {
|
|
||||||
throw new Error("Invalid cust");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function SaveCust(buffer) {
|
function SaveCust(buffer) {
|
||||||
let view = new DataView(buffer);
|
let view = new DataView(buffer);
|
||||||
let storage = {};
|
let storage = {};
|
||||||
storage["custRev"] = CUST_REV;
|
|
||||||
for (let i of CustTable) {
|
for (let i of CustTable) {
|
||||||
let id = i.name;
|
i.update();
|
||||||
i.value = Number(document.getElementById(id).value);
|
if (!i.validate() || i.value === null) {
|
||||||
storage[i.name] = i.value;
|
document.getElementById(i.id).focus();
|
||||||
|
throw new Error(`Invalid ${i.name}`);
|
||||||
|
}
|
||||||
|
if (!i.offset) {
|
||||||
|
document.getElementById(i.id).focus();
|
||||||
|
throw new Error(`Failed to get offset for ${i.name}`);
|
||||||
|
;
|
||||||
|
}
|
||||||
switch (i.size) {
|
switch (i.size) {
|
||||||
case 2:
|
case 2:
|
||||||
view.setUint16(i.offset, i.value, true);
|
view.setUint16(i.offset, i.value, true);
|
||||||
@@ -188,11 +194,12 @@ function SaveCust(buffer) {
|
|||||||
view.setUint32(i.offset, i.value, true);
|
view.setUint32(i.offset, i.value, true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
document.getElementById(i.name).focus();
|
document.getElementById(i.id).focus();
|
||||||
throw new Error("Unknown size at " + i);
|
throw new Error(`Unknown size at ${i.name}`);
|
||||||
}
|
}
|
||||||
|
storage[i.id] = i.value;
|
||||||
}
|
}
|
||||||
ValidateCust();
|
storage["custRev"] = CUST_REV;
|
||||||
localStorage.setItem("last_saved", JSON.stringify(storage));
|
localStorage.setItem("last_saved", JSON.stringify(storage));
|
||||||
let a = document.createElement("a");
|
let a = document.createElement("a");
|
||||||
a.href = window.URL.createObjectURL(new Blob([buffer], { type: "application/octet-stream" }));
|
a.href = window.URL.createObjectURL(new Blob([buffer], { type: "application/octet-stream" }));
|
||||||
@@ -225,68 +232,34 @@ function LoadLastSaved() {
|
|||||||
}
|
}
|
||||||
function LoadDefault() {
|
function LoadDefault() {
|
||||||
for (let i of CustTable) {
|
for (let i of CustTable) {
|
||||||
let id = i.name;
|
document.getElementById(i.id).value = String(i.defval);
|
||||||
document.getElementById(id).value = String(i.defval);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function ClearHTMLForm() {
|
function ClearHTMLForm() {
|
||||||
var _a, _b;
|
|
||||||
if (!CustTable) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (let i of CustTable) {
|
for (let i of CustTable) {
|
||||||
let id = i.name;
|
i.clearForm();
|
||||||
let input = document.getElementById(id);
|
|
||||||
(_b = (_a = input.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.remove();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function UpdateHTMLForm() {
|
function UpdateHTMLForm() {
|
||||||
let dict = Object.assign({}, ...CustTable.map((x) => ({ [x.name]: x })));
|
|
||||||
let form = document.getElementById("form");
|
|
||||||
for (let i of CustTable) {
|
for (let i of CustTable) {
|
||||||
let id = i.name;
|
i.createForm();
|
||||||
let input = document.getElementById(id);
|
|
||||||
if (!input) {
|
|
||||||
let grid = document.createElement("div");
|
|
||||||
grid.classList.add("grid");
|
|
||||||
// Label and input box
|
|
||||||
input = document.createElement("input");
|
|
||||||
input.min = dict[i.name].min;
|
|
||||||
input.max = dict[i.name].max;
|
|
||||||
input.id = id;
|
|
||||||
input.type = "number";
|
|
||||||
input.step = dict[i.name].step;
|
|
||||||
let label = document.createElement("label");
|
|
||||||
label.setAttribute("for", id);
|
|
||||||
label.innerHTML = id;
|
|
||||||
label.appendChild(input);
|
|
||||||
grid.appendChild(label);
|
|
||||||
// Description in blockquote style
|
|
||||||
let desc = dict[i.name].desc;
|
|
||||||
let block = document.createElement("blockquote");
|
|
||||||
block.style["margin-top"] = "0";
|
|
||||||
block.innerHTML = desc;
|
|
||||||
block.setAttribute("for", id);
|
|
||||||
grid.appendChild(block);
|
|
||||||
grid.style["margin-top"] = "3rem";
|
|
||||||
form.appendChild(grid);
|
|
||||||
let tooltip = new ErrorToolTip(id);
|
|
||||||
tooltip.addChangeListener();
|
|
||||||
}
|
|
||||||
input.value = dict[i.name].value;
|
|
||||||
}
|
}
|
||||||
let default_btn = document.getElementById("load_default");
|
let default_btn = document.getElementById("load_default");
|
||||||
default_btn.removeAttribute("disabled");
|
default_btn.removeAttribute("disabled");
|
||||||
default_btn.addEventListener('click', () => {
|
default_btn.addEventListener('click', () => {
|
||||||
LoadDefault();
|
LoadDefault();
|
||||||
});
|
});
|
||||||
|
let last_btn = document.getElementById("load_saved");
|
||||||
if (LastSaved()) {
|
if (LastSaved()) {
|
||||||
let last_btn = document.getElementById("load_saved");
|
last_btn.style.removeProperty("display");
|
||||||
last_btn.removeAttribute("disabled");
|
last_btn.removeAttribute("disabled");
|
||||||
last_btn.addEventListener('click', () => {
|
last_btn.addEventListener('click', () => {
|
||||||
LoadLastSaved();
|
LoadLastSaved();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
last_btn.style.setProperty("display", "none");
|
||||||
|
}
|
||||||
let save_btn = document.getElementById("save");
|
let save_btn = document.getElementById("save");
|
||||||
save_btn.removeAttribute("disabled");
|
save_btn.removeAttribute("disabled");
|
||||||
save_btn.addEventListener('click', () => {
|
save_btn.addEventListener('click', () => {
|
||||||
@@ -303,17 +276,10 @@ function ParseCust(magicOffset, buffer) {
|
|||||||
let view = new DataView(buffer);
|
let view = new DataView(buffer);
|
||||||
let offset = magicOffset + 4;
|
let offset = magicOffset + 4;
|
||||||
let rev = view.getUint16(offset, true);
|
let rev = view.getUint16(offset, true);
|
||||||
if (rev != 2 && rev != 3) {
|
if (rev != CUST_REV) {
|
||||||
throw new Error("Unsupported custRev, expected: 2 or 3, got " + rev);
|
throw new Error(`Unsupported custRev, expected: ${CUST_REV}, got ${rev}`);
|
||||||
}
|
}
|
||||||
CUST_REV = rev;
|
|
||||||
document.getElementById("cust_rev").innerHTML = `Cust V${CUST_REV} is loaded.`;
|
document.getElementById("cust_rev").innerHTML = `Cust V${CUST_REV} is loaded.`;
|
||||||
if (rev == 2) {
|
|
||||||
CustTable = CustTableV2;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
CustTable = CustTableV3;
|
|
||||||
}
|
|
||||||
offset += 2;
|
offset += 2;
|
||||||
for (let i of CustTable) {
|
for (let i of CustTable) {
|
||||||
i.offset = offset;
|
i.offset = offset;
|
||||||
@@ -325,10 +291,11 @@ function ParseCust(magicOffset, buffer) {
|
|||||||
i.value = view.getUint32(offset, true);
|
i.value = view.getUint32(offset, true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
document.getElementById(i.name).focus();
|
document.getElementById(i.id).focus();
|
||||||
throw new Error("Unknown size at " + i);
|
throw new Error("Unknown size at " + i);
|
||||||
}
|
}
|
||||||
offset += i.size;
|
offset += i.size;
|
||||||
|
i.validate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const fileInput = document.getElementById("file");
|
const fileInput = document.getElementById("file");
|
||||||
@@ -342,7 +309,6 @@ fileInput.addEventListener('change', (event) => {
|
|||||||
let offset = FindMagicOffset(buffer);
|
let offset = FindMagicOffset(buffer);
|
||||||
ClearHTMLForm();
|
ClearHTMLForm();
|
||||||
ParseCust(offset, buffer);
|
ParseCust(offset, buffer);
|
||||||
ValidateCust();
|
|
||||||
UpdateHTMLForm();
|
UpdateHTMLForm();
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
@@ -378,7 +344,9 @@ function fetchRelease() {
|
|||||||
let info = {
|
let info = {
|
||||||
OCSuiteVer: latestVerFromSuite,
|
OCSuiteVer: latestVerFromSuite,
|
||||||
LoaderKipUrl: loaderKip.browser_download_url,
|
LoaderKipUrl: loaderKip.browser_download_url,
|
||||||
|
LoaderKipTime: loaderKip.updated_at,
|
||||||
SdOutZipUrl: sdOut.browser_download_url,
|
SdOutZipUrl: sdOut.browser_download_url,
|
||||||
|
SdOutZipTime: sdOut.updated_at,
|
||||||
AMSVer: correspondingVerFromAMS,
|
AMSVer: correspondingVerFromAMS,
|
||||||
AMSUrl: amsReleaseUrl
|
AMSUrl: amsReleaseUrl
|
||||||
};
|
};
|
||||||
@@ -400,11 +368,11 @@ function updateDownloadUrls() {
|
|||||||
};
|
};
|
||||||
let info = yield fetchRelease();
|
let info = yield fetchRelease();
|
||||||
if (info) {
|
if (info) {
|
||||||
const loaderKipName = `loader.kip ${info.OCSuiteVer}`;
|
const loaderKipName = `loader.kip <b>${info.OCSuiteVer}</b><br>${info.LoaderKipTime}`;
|
||||||
updateHref("loader_kip_btn", loaderKipName, info.LoaderKipUrl);
|
updateHref("loader_kip_btn", loaderKipName, info.LoaderKipUrl);
|
||||||
const sdOutName = `SdOut.zip ${info.OCSuiteVer}`;
|
const sdOutName = `SdOut.zip <b>${info.OCSuiteVer}</b><br>${info.SdOutZipTime}`;
|
||||||
updateHref("sdout_zip_btn", sdOutName, info.SdOutZipUrl);
|
updateHref("sdout_zip_btn", sdOutName, info.SdOutZipUrl);
|
||||||
const amsName = `Atmosphere-NX ${info.AMSVer}`;
|
const amsName = `Atmosphere-NX <b>${info.AMSVer}</b>`;
|
||||||
updateHref("ams_btn", amsName, info.AMSUrl);
|
updateHref("ams_btn", amsName, info.AMSUrl);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,10 +4,16 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Switch OC Suite</title>
|
<title>Switch OC Suite > Project Homepage | Overclocking suite for Horizon OS (HOS) running on Atmosphere CFW. Licensed under GPL v2.
|
||||||
|
</title>
|
||||||
<meta name="description"
|
<meta name="description"
|
||||||
content="Overclocking suite for Horizon OS (HOS) running on Atmosphere CFW. Licensed under GPL v2.">
|
content="Overclocking suite for Horizon OS (HOS) running on Atmosphere CFW. Licensed under GPL v2.">
|
||||||
<link rel="stylesheet" href="https://unpkg.com/@picocss/pico@latest/css/pico.min.css">
|
<link rel="stylesheet" href="https://unpkg.com/@picocss/pico@latest/css/pico.min.css">
|
||||||
|
<style>
|
||||||
|
div#download_btn_grid > a {
|
||||||
|
margin: 0.5rem 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@@ -79,21 +85,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>DRAM Overclock (Safe: 1862.4 MHz)
|
<li>DRAM Overclock (Safe: 1862.4 MHz)</li>
|
||||||
<ul>
|
|
||||||
<li>Unsafe: Up to 2131 MHz with DRAM bus overvolting depending on your
|
|
||||||
DRAM chip</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li>Modded sys-clk and ReverseNX-RT
|
|
||||||
<ul>
|
|
||||||
<li>CPU & GPU frequency governor (Experimental)</li>
|
|
||||||
<li>Set charging current (100 mA - 2000 mA) and charging limit (20% -
|
|
||||||
100%)</li>
|
|
||||||
<li>Global Profile</li>
|
|
||||||
<li>Sync ReverseNX Mode</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</details>
|
</details>
|
||||||
<details>
|
<details>
|
||||||
@@ -114,55 +106,46 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>DRAM Overclock (Safe: 1996.8 MHz)</li>
|
<li>DRAM Overclock (Safe: 1996.8 MHz)</li>
|
||||||
<li>Modded sys-clk and ReverseNX-RT
|
</ul>
|
||||||
|
</details>
|
||||||
|
<details>
|
||||||
|
<summary>Modded sys-clk and ReverseNX-RT</summary>
|
||||||
|
<ul>
|
||||||
|
<li>Auto CPU Boost
|
||||||
<ul>
|
<ul>
|
||||||
<li>Auto CPU Boost</li>
|
<li>For faster game loading</li>
|
||||||
<li>CPU & GPU frequency governor (Experimental)</li>
|
<li>Enable CPU Boost (1785 MHz) when CPU Core#3 (System Core) is
|
||||||
<li>Set charging current (100 mA - 2000 mA) and charging limit (20% -
|
stressed (mainly I/O operations).</li>
|
||||||
100%)</li>
|
<li>Effective only when charger is connected.</li>
|
||||||
<li>Global Profile</li>
|
</ul>
|
||||||
<li>Sync ReverseNX Mode</li>
|
</li>
|
||||||
|
<li>CPU & GPU frequency governor (Experimental)
|
||||||
|
<ul>
|
||||||
|
<li>Adjust frequency based on load. Might decrease power draw but can
|
||||||
|
introduce stutters. Can be turned off for specific titles.</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>Set charging current (100 mA - 2000 mA) and charging limit (20% -
|
||||||
|
100%)
|
||||||
|
<ul>
|
||||||
|
<li>Long-term use of charge limit may render the battery gauge
|
||||||
|
inaccurate. Performing full cycles could help recalibration, or try <a
|
||||||
|
href="https://github.com/CTCaer/battery_desync_fix_nx">battery_desync_fix_nx</a>.</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>Global Profile
|
||||||
|
<ul>
|
||||||
|
<li>Designated a dummy title id <code>0xA111111111111111</code>.</li>
|
||||||
|
<li>Priority: "Temp overrides" > "Application profile" > "Global
|
||||||
|
profile" > "System default".</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>Sync ReverseNX Mode
|
||||||
|
<ul>
|
||||||
|
<li>No need to change clocks manually after toggling modes in ReverseNX
|
||||||
|
(-RT and -Tool)</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
|
||||||
</details>
|
|
||||||
<details>
|
|
||||||
<summary>Auto CPU Boost</summary>
|
|
||||||
<ul>
|
|
||||||
<li>For faster game loading</li>
|
|
||||||
<li>Enable CPU Boost (1785 MHz) when CPU Core#3 (System Core) is
|
|
||||||
stressed (mainly I/O operations).</li>
|
|
||||||
<li>Effective only when charger is connected.</li>
|
|
||||||
</ul>
|
|
||||||
</details>
|
|
||||||
<details>
|
|
||||||
<summary>CPU & GPU frequency governor (Experimental)</summary>
|
|
||||||
<ul>
|
|
||||||
<li>Adjust frequency based on load. Might decrease power draw but can
|
|
||||||
introduce stutters. Can be turned off for specific titles.</li>
|
|
||||||
</ul>
|
|
||||||
</details>
|
|
||||||
<details>
|
|
||||||
<summary>Setting charge limit (20% - 100%)</summary>
|
|
||||||
<ul>
|
|
||||||
<li>Long-term use of charge limit may render the battery gauge
|
|
||||||
inaccurate. Performing full cycles could help recalibration, or try <a
|
|
||||||
href="https://github.com/CTCaer/battery_desync_fix_nx">battery_desync_fix_nx</a>.</li>
|
|
||||||
</ul>
|
|
||||||
</details>
|
|
||||||
<details>
|
|
||||||
<summary>Global profile</summary>
|
|
||||||
<ul>
|
|
||||||
<li>Designated a dummy title id <code>0xA111111111111111</code>.</li>
|
|
||||||
<li>Priority: "Temp overrides" > "Application profile" > "Global
|
|
||||||
profile" > "System default".</li>
|
|
||||||
</ul>
|
|
||||||
</details>
|
|
||||||
<details>
|
|
||||||
<summary>Sync ReverseNX Mode</summary>
|
|
||||||
<ul>
|
|
||||||
<li>No need to change clocks manually after toggling modes in ReverseNX
|
|
||||||
(-RT and -Tool)</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</details>
|
</details>
|
||||||
<details>
|
<details>
|
||||||
@@ -201,7 +184,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>CPU Volt</td>
|
<td>CPU Volt</td>
|
||||||
<td>1235 mV Max</td>
|
<td>1235 mV Max</td>
|
||||||
<td>1257 mV Max</td>
|
<td>1235 mV Max</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>GPU OC</td>
|
<td>GPU OC</td>
|
||||||
@@ -336,7 +319,7 @@
|
|||||||
</header>
|
</header>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="grid">
|
<div class="grid" id="download_btn_grid">
|
||||||
<a role="button" aria-busy="true" id="loader_kip_btn">Generating link, please wait...</a>
|
<a role="button" aria-busy="true" id="loader_kip_btn">Generating link, please wait...</a>
|
||||||
<a role="button" aria-busy="true" id="sdout_zip_btn">Generating link, please wait...</a>
|
<a role="button" aria-busy="true" id="sdout_zip_btn">Generating link, please wait...</a>
|
||||||
<a target="_blank" role="button" aria-busy="true" id="ams_btn">Generating link, please wait...</a>
|
<a target="_blank" role="button" aria-busy="true" id="ams_btn">Generating link, please wait...</a>
|
||||||
|
|||||||
@@ -1,20 +1,22 @@
|
|||||||
/* Config: Cust */
|
/* Config: Cust */
|
||||||
var CUST_REV: number | null;
|
const CUST_REV = 3;
|
||||||
var buffer: string | ArrayBuffer;
|
var buffer: string | ArrayBuffer;
|
||||||
|
|
||||||
class CustEntry {
|
class CustEntry {
|
||||||
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
size: number;
|
size: number;
|
||||||
desc: string;
|
desc: string;
|
||||||
defval: number;
|
defval: number;
|
||||||
min: number;
|
min: number;
|
||||||
max: number;
|
max: number;
|
||||||
step: number;
|
step: number; // also as quotient
|
||||||
validator: Function | null;
|
zeroable: boolean;
|
||||||
value: number | null;
|
value: number | null;
|
||||||
offset: number | null;
|
offset: number | null;
|
||||||
|
|
||||||
constructor(name: string, size: number, desc: string, defval: number, minmax = [0, 1_000_000], step = 1, extra_validator?) {
|
constructor(id: string, name: string, size: number, desc: string, defval: number, minmax: [number, number] = [0, 1_000_000], step: number = 1, zeroable: boolean = true) {
|
||||||
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.size = size;
|
this.size = size;
|
||||||
this.desc = desc;
|
this.desc = desc;
|
||||||
@@ -22,229 +24,194 @@ class CustEntry {
|
|||||||
this.min = minmax[0];
|
this.min = minmax[0];
|
||||||
this.max = minmax[1];
|
this.max = minmax[1];
|
||||||
this.step = step;
|
this.step = step;
|
||||||
this.validator = extra_validator;
|
this.zeroable = zeroable;
|
||||||
this.value = null;
|
this.value = null;
|
||||||
this.offset = null;
|
this.offset = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
validate(): boolean {
|
||||||
|
let tip = new ErrorToolTip(this.id);
|
||||||
|
tip.clear();
|
||||||
|
if (Number.isNaN(this.value) || this.value === null) {
|
||||||
|
tip.setMsg(`Invalid value: Not a number`);
|
||||||
|
tip.show();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this.zeroable && this.value == 0)
|
||||||
|
return true;
|
||||||
|
if (this.value < this.min || this.value > this.max) {
|
||||||
|
tip.setMsg(`Expected range: [${this.min}, ${this.max}], got ${this.value}.`);
|
||||||
|
tip.show();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this.value % this.step != 0) {
|
||||||
|
tip.setMsg(`${this.value} % ${this.step} ≠ 0`);
|
||||||
|
tip.show();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
update() {
|
||||||
|
this.value = Number((document.getElementById(this.id) as HTMLInputElement).value);
|
||||||
|
}
|
||||||
|
|
||||||
|
getInputElement(): HTMLInputElement | null {
|
||||||
|
return document.getElementById(this.id) as HTMLInputElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
createForm() {
|
||||||
|
let form = document.getElementById("form")!;
|
||||||
|
let input = this.getInputElement();
|
||||||
|
if (!input) {
|
||||||
|
let grid = document.createElement("div");
|
||||||
|
grid.classList.add("grid");
|
||||||
|
|
||||||
|
// Label and input
|
||||||
|
input = document.createElement("input");
|
||||||
|
input.min = String(this.min);
|
||||||
|
input.max = String(this.max);
|
||||||
|
input.id = this.id;
|
||||||
|
input.type = "number";
|
||||||
|
input.step = String(this.step);
|
||||||
|
let label = document.createElement("label");
|
||||||
|
label.setAttribute("for", this.id);
|
||||||
|
label.innerHTML = this.name;
|
||||||
|
label.appendChild(input);
|
||||||
|
grid.appendChild(label);
|
||||||
|
|
||||||
|
// Description in blockquote style
|
||||||
|
let desc = document.createElement("blockquote");
|
||||||
|
desc.style["margin-top"] = "0";
|
||||||
|
desc.innerHTML = this.desc;
|
||||||
|
desc.setAttribute("for", this.id);
|
||||||
|
grid.appendChild(desc);
|
||||||
|
|
||||||
|
grid.style["margin-top"] = "3rem";
|
||||||
|
form.appendChild(grid);
|
||||||
|
|
||||||
|
let tooltip = new ErrorToolTip(this.id);
|
||||||
|
tooltip.addChangeListener();
|
||||||
|
}
|
||||||
|
input.value = String(this.value!);
|
||||||
|
}
|
||||||
|
|
||||||
|
clearForm() {
|
||||||
|
let input = this.getInputElement();
|
||||||
|
if (input) {
|
||||||
|
input.parentElement!.parentElement!.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var CustTable: Array<CustEntry> | null = null;
|
var CustTable: Array<CustEntry> = [
|
||||||
|
|
||||||
const CustTableV2: Array<CustEntry> = [
|
|
||||||
new CustEntry(
|
new CustEntry(
|
||||||
"mtcConf",
|
"mtcConf",
|
||||||
|
"DRAM Timing",
|
||||||
2,
|
2,
|
||||||
"<b>DRAM Timing</b>\
|
"<li><b>0</b>: AUTO_ADJ_MARIKO_SAFE: Auto adjust timings for LPDDR4 ≤3733 Mbps specs, 8Gb density. (Default)</li>\
|
||||||
<li><b>0</b>: AUTO_ADJ_MARIKO_SAFE: Auto adjust timings for LPDDR4 ≤3733 Mbps specs, 8Gb density. (Default)</li>\
|
<li><b>1</b>: AUTO_ADJ_MARIKO_4266: Auto adjust timings for LPDDR4X 4266 Mbps specs, 8Gb density.</li>\
|
||||||
<li><b>1</b>: AUTO_ADJ_MARIKO_4266: Auto adjust timings for LPDDR4X 4266 Mbps specs, 8Gb density.</li>",
|
<li><b>2</b>: NO_ADJ_ALL: No timing adjustment for both Erista and Mariko. Might achieve better performance on Mariko but lower maximum frequency is expected.",
|
||||||
0,
|
0,
|
||||||
[0, 3],
|
[0, 2],
|
||||||
|
1
|
||||||
),
|
),
|
||||||
new CustEntry(
|
new CustEntry(
|
||||||
"marikoCpuMaxClock",
|
"marikoCpuMaxClock",
|
||||||
|
"Mariko CPU Max Clock in kHz",
|
||||||
4,
|
4,
|
||||||
"<b>Mariko CPU Max Clock in kHz</b>\
|
"<li>System default: 1785000</li>\
|
||||||
<li>System default: 1785000</li>\
|
<li>2397000 might be unreachable for some SoCs.</li>",
|
||||||
<li>2397000 might be unreachable for some SoCs.</li>",
|
|
||||||
2397_000,
|
2397_000,
|
||||||
[1785_000, 3000_000],
|
[1785_000, 3000_000],
|
||||||
100,
|
1,
|
||||||
(x: number) => (x % 100) == 0
|
|
||||||
),
|
),
|
||||||
new CustEntry(
|
new CustEntry(
|
||||||
"marikoCpuBoostClock",
|
"marikoCpuBoostClock",
|
||||||
|
"Mariko CPU Boost Clock in kHz",
|
||||||
4,
|
4,
|
||||||
"<b>Mariko CPU Boost Clock in kHz</b>\
|
"<li>System default: 1785000</li>\
|
||||||
<li>System default: 1785000</li>\
|
<li>Boost clock will be applied when applications request higher CPU frequency for quicker loading.</li>\
|
||||||
<li>Boost clock will be applied when applications request higher CPU frequency for quicker loading.</li>\
|
<li>This will be set regardless of whether sys-clk is enabled.</li>",
|
||||||
<li>This will be set regardless of whether sys-clk is enabled.</li>",
|
|
||||||
1785_000,
|
1785_000,
|
||||||
[1785_000, 3000_000],
|
[1020_000, 3000_000],
|
||||||
100,
|
1,
|
||||||
(x: number) => (x % 100) == 0
|
false
|
||||||
),
|
),
|
||||||
new CustEntry(
|
new CustEntry(
|
||||||
"marikoCpuMaxVolt",
|
"marikoCpuMaxVolt",
|
||||||
|
"Mariko CPU Max Voltage in mV",
|
||||||
4,
|
4,
|
||||||
"<b>Mariko CPU Max Voltage in mV</b>\
|
"<li>System default: 1120</li>\
|
||||||
<li>System default: 1120</li>\
|
<li>Acceptable range: 1100 ≤ x ≤ 1300</li>",
|
||||||
<li>Acceptable range: 1100 ≤ x ≤ 1300</li>",
|
|
||||||
1235,
|
1235,
|
||||||
[1100, 1300],
|
[1100, 1300],
|
||||||
|
5
|
||||||
),
|
),
|
||||||
new CustEntry(
|
new CustEntry(
|
||||||
"marikoGpuMaxClock",
|
"marikoGpuMaxClock",
|
||||||
|
"Mariko GPU Max Clock in kHz",
|
||||||
4,
|
4,
|
||||||
"<b>Mariko GPU Max Clock in kHz</b>\
|
"<li>System default: 921600</li>\
|
||||||
<li>System default: 921600</li>\
|
<li>Tegra X1+ official maximum: 1267200</li>\
|
||||||
<li>Tegra X1+ official maximum: 1267200</li>\
|
<li>1305600 might be unreachable for some SoCs.</li>",
|
||||||
<li>1305600 might be unreachable for some SoCs.</li>",
|
|
||||||
1305_600,
|
1305_600,
|
||||||
[768_000, 1536_000],
|
[768_000, 1536_000],
|
||||||
100,
|
100,
|
||||||
(x: number) => (x % 100) == 0
|
|
||||||
),
|
),
|
||||||
new CustEntry(
|
new CustEntry(
|
||||||
"marikoEmcMaxClock",
|
"marikoEmcMaxClock",
|
||||||
|
"Mariko RAM Max Clock in kHz",
|
||||||
4,
|
4,
|
||||||
"<b>Mariko RAM Max Clock in kHz</b>\
|
"<li>Values should be ≥ 1600000, and divided evenly by 3200.</li>\
|
||||||
<li>Values should be > 1600000, and divided evenly by 3200.</li>\
|
<li><b>WARNING:</b> RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM</li>",
|
||||||
<li><b>WARNING:</b> RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM</li>",
|
|
||||||
1996_800,
|
1996_800,
|
||||||
[1612_800, 2400_000],
|
[1600_000, 2400_000],
|
||||||
3200,
|
3200,
|
||||||
(x: number) => (x % 3200) == 0
|
|
||||||
),
|
),
|
||||||
new CustEntry(
|
new CustEntry(
|
||||||
"eristaOCEnable",
|
"marikoEmcVddqVolt",
|
||||||
|
"EMC Vddq (Mariko Only) Voltage in uV",
|
||||||
4,
|
4,
|
||||||
"<b>Erista CPU Enable Overclock</b>\
|
"<li>Acceptable range: 550000 ≤ x ≤ 650000</li>\
|
||||||
<li>Not tested</li>",
|
<li>Value should be divided evenly by 5000</li>\
|
||||||
1,
|
<li>Default: 600000</li>\
|
||||||
[0, 1]
|
<li>Not enabled by default.</li>\
|
||||||
|
<li>This will not work without sys-clk-OC.</li>",
|
||||||
|
0,
|
||||||
|
[550_000, 650_000],
|
||||||
|
5000,
|
||||||
),
|
),
|
||||||
new CustEntry(
|
new CustEntry(
|
||||||
"eristaCpuMaxVolt",
|
"eristaCpuMaxVolt",
|
||||||
|
"Erista CPU Max Voltage in mV",
|
||||||
4,
|
4,
|
||||||
"<b>Erista CPU Max Voltage in mV</b>\
|
"<li>Acceptable range: 1100 ≤ x ≤ 1300</li>",
|
||||||
<li>Acceptable range: 1100 ≤ x ≤ 1300</li>",
|
|
||||||
1235,
|
|
||||||
[0, 1300],
|
|
||||||
1,
|
|
||||||
(x: number) => x >= 1100
|
|
||||||
),
|
|
||||||
new CustEntry(
|
|
||||||
"eristaEmcMaxClock",
|
|
||||||
4,
|
|
||||||
"<b>Erista RAM Max Clock in kHz</b>\
|
|
||||||
<li>Values should be > 1600000, and divided evenly by 3200.</li>\
|
|
||||||
<li><b>WARNING:</b> RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM</li>",
|
|
||||||
1862_400,
|
|
||||||
[1600_000, 2400_000],
|
|
||||||
3200,
|
|
||||||
(x: number) => (x % 3200) == 0
|
|
||||||
),
|
|
||||||
new CustEntry(
|
|
||||||
"eristaEmcVolt",
|
|
||||||
4,
|
|
||||||
"<b>Erista RAM Voltage in uV</b>\
|
|
||||||
<li>Acceptable range: 1100000 ≤ x ≤ 1250000, and it should be divided evenly by 12500.</li>\
|
|
||||||
<li>Not enabled by default</li>",
|
|
||||||
0,
|
|
||||||
[0, 1250_000],
|
|
||||||
12500,
|
|
||||||
(x: number) => (x % 12500) == 0 && x >= 1100000
|
|
||||||
),
|
|
||||||
];
|
|
||||||
|
|
||||||
const CustTableV3: Array<CustEntry> = [
|
|
||||||
new CustEntry(
|
|
||||||
"mtcConf",
|
|
||||||
2,
|
|
||||||
"<b>DRAM Timing</b>\
|
|
||||||
<li><b>0</b>: AUTO_ADJ_MARIKO_SAFE: Auto adjust timings for LPDDR4 ≤3733 Mbps specs, 8Gb density. (Default)</li>\
|
|
||||||
<li><b>1</b>: AUTO_ADJ_MARIKO_4266: Auto adjust timings for LPDDR4X 4266 Mbps specs, 8Gb density.</li>\
|
|
||||||
<li><b>2</b>: NO_ADJ_ALL: No timing adjustment for both Erista and Mariko. Might achieve better performance on Mariko but lower maximum frequency is expected.",
|
|
||||||
0,
|
|
||||||
[0, 3],
|
|
||||||
),
|
|
||||||
new CustEntry(
|
|
||||||
"marikoCpuMaxClock",
|
|
||||||
4,
|
|
||||||
"<b>Mariko CPU Max Clock in kHz</b>\
|
|
||||||
<li>System default: 1785000</li>\
|
|
||||||
<li>2397000 might be unreachable for some SoCs.</li>",
|
|
||||||
2397_000,
|
|
||||||
[1785_000, 3000_000],
|
|
||||||
100,
|
|
||||||
(x: number) => (x % 100) == 0
|
|
||||||
),
|
|
||||||
new CustEntry(
|
|
||||||
"marikoCpuBoostClock",
|
|
||||||
4,
|
|
||||||
"<b>Mariko CPU Boost Clock in kHz</b>\
|
|
||||||
<li>System default: 1785000</li>\
|
|
||||||
<li>Boost clock will be applied when applications request higher CPU frequency for quicker loading.</li>\
|
|
||||||
<li>This will be set regardless of whether sys-clk is enabled.</li>",
|
|
||||||
1785_000,
|
|
||||||
[1785_000, 3000_000],
|
|
||||||
100,
|
|
||||||
(x: number) => (x % 100) == 0
|
|
||||||
),
|
|
||||||
new CustEntry(
|
|
||||||
"marikoCpuMaxVolt",
|
|
||||||
4,
|
|
||||||
"<b>Mariko CPU Max Voltage in mV</b>\
|
|
||||||
<li>System default: 1120</li>\
|
|
||||||
<li>Acceptable range: 1100 ≤ x ≤ 1300</li>",
|
|
||||||
1235,
|
1235,
|
||||||
[1100, 1300],
|
[1100, 1300],
|
||||||
),
|
|
||||||
new CustEntry(
|
|
||||||
"marikoGpuMaxClock",
|
|
||||||
4,
|
|
||||||
"<b>Mariko GPU Max Clock in kHz</b>\
|
|
||||||
<li>System default: 921600</li>\
|
|
||||||
<li>Tegra X1+ official maximum: 1267200</li>\
|
|
||||||
<li>1305600 might be unreachable for some SoCs.</li>",
|
|
||||||
1305_600,
|
|
||||||
[768_000, 1536_000],
|
|
||||||
100,
|
|
||||||
(x: number) => (x % 100) == 0
|
|
||||||
),
|
|
||||||
new CustEntry(
|
|
||||||
"marikoEmcMaxClock",
|
|
||||||
4,
|
|
||||||
"<b>Mariko RAM Max Clock in kHz</b>\
|
|
||||||
<li>Values should be > 1600000, and divided evenly by 3200.</li>\
|
|
||||||
<li><b>WARNING:</b> RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM</li>",
|
|
||||||
1996_800,
|
|
||||||
[1612_800, 2400_000],
|
|
||||||
3200,
|
|
||||||
(x: number) => (x % 3200) == 0
|
|
||||||
),
|
|
||||||
new CustEntry(
|
|
||||||
"marikoEmcVolt",
|
|
||||||
4,
|
|
||||||
"<b>Mariko RAM Voltage in uV</b>\
|
|
||||||
<li>Acceptable range: 600000 ≤ x ≤ 650000</li>\
|
|
||||||
<li>Value should be divided evenly by 5'000</li>\
|
|
||||||
<li>Not enabled by default.</li>\
|
|
||||||
<li>This will not work without sys-clk-OC.</li>",
|
|
||||||
1,
|
1,
|
||||||
[0, 1]
|
|
||||||
),
|
|
||||||
new CustEntry(
|
|
||||||
"eristaCpuMaxVolt",
|
|
||||||
4,
|
|
||||||
"<b>Erista CPU Max Voltage in mV</b>\
|
|
||||||
<li>Acceptable range: 1100 ≤ x ≤ 1300</li>",
|
|
||||||
1235,
|
|
||||||
[0, 1300],
|
|
||||||
1,
|
|
||||||
(x: number) => x >= 1100
|
|
||||||
),
|
),
|
||||||
new CustEntry(
|
new CustEntry(
|
||||||
"eristaEmcMaxClock",
|
"eristaEmcMaxClock",
|
||||||
|
"Erista RAM Max Clock in kHz",
|
||||||
4,
|
4,
|
||||||
"<b>Erista RAM Max Clock in kHz</b>\
|
"<li>Values should be ≥ 1600000, and divided evenly by 3200.</li>\
|
||||||
<li>Values should be > 1600000, and divided evenly by 3200.</li>\
|
<li><b>WARNING:</b> RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM</li>",
|
||||||
<li><b>WARNING:</b> RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM</li>",
|
|
||||||
1862_400,
|
1862_400,
|
||||||
[1600_000, 2400_000],
|
[1600_000, 2400_000],
|
||||||
3200,
|
3200,
|
||||||
(x: number) => (x % 3200) == 0
|
|
||||||
),
|
),
|
||||||
new CustEntry(
|
new CustEntry(
|
||||||
"eristaEmcVolt",
|
"commonEmcMemVolt",
|
||||||
|
"EMC Vddq (Erista Only) & RAM Vdd2 Voltage in uV",
|
||||||
4,
|
4,
|
||||||
"<b>Erista RAM Voltage in uV</b>\
|
"<li>Acceptable range: 1100000 ≤ x ≤ 1250000, and it should be divided evenly by 12500.</li>\
|
||||||
<li>Acceptable range: 1100000 ≤ x ≤ 1250000, and it should be divided evenly by 12500.</li>\
|
<li>Erista Default (HOS): 1125000 (bootloader: 1100000)</li>\
|
||||||
<li>Not enabled by default</li>",
|
<li>Mariko Default: 1100000 (It will not work without sys-clk-OC)</li>\
|
||||||
|
<li>Not enabled by default</li>",
|
||||||
0,
|
0,
|
||||||
[0, 1250_000],
|
[1100_000, 1250_000],
|
||||||
12500,
|
12500,
|
||||||
(x: number) => (x % 12500) == 0 && x >= 1100000
|
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -263,9 +230,10 @@ class ErrorToolTip {
|
|||||||
message: string | null;
|
message: string | null;
|
||||||
element: HTMLElement | null;
|
element: HTMLElement | null;
|
||||||
|
|
||||||
constructor(id: string) {
|
constructor(id: string, msg?: string) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.element = document.getElementById(id);
|
this.element = document.getElementById(id);
|
||||||
|
if (msg) { this.setMsg(msg); }
|
||||||
};
|
};
|
||||||
|
|
||||||
setMsg(msg: string) {
|
setMsg(msg: string) {
|
||||||
@@ -295,71 +263,43 @@ class ErrorToolTip {
|
|||||||
addChangeListener() {
|
addChangeListener() {
|
||||||
if (this.element) {
|
if (this.element) {
|
||||||
this.element.addEventListener('change', (_evt) => {
|
this.element.addEventListener('change', (_evt) => {
|
||||||
let obj = CustTable!.filter((obj) => { return obj.name === this.id; })[0];
|
let obj = CustTable.filter((obj) => { return obj.id === this.id; })[0];
|
||||||
obj.value = Number((this.element as HTMLInputElement).value);
|
obj.value = Number((this.element as HTMLInputElement).value);
|
||||||
ValidateCustEntry(obj);
|
obj.validate();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function ValidateCustEntry(entry: CustEntry): ErrorToolTip | null {
|
|
||||||
let elementId = entry.name;
|
|
||||||
let tip = new ErrorToolTip(elementId);
|
|
||||||
tip.clear();
|
|
||||||
if (entry.value! == 0)
|
|
||||||
return null;
|
|
||||||
if (entry.value! < entry.min || entry.value! > entry.max) {
|
|
||||||
tip.setMsg(`Expected range: [${entry.min}, ${entry.max}], got ${entry.value}.`);
|
|
||||||
tip.show();
|
|
||||||
return tip;
|
|
||||||
}
|
|
||||||
if (entry.validator && !entry.validator(entry.value)) {
|
|
||||||
tip.setMsg(`Invalid value: ${entry.value}. Did not pass this validator: ${entry.validator}.`);
|
|
||||||
tip.show();
|
|
||||||
return tip;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function ValidateCust() {
|
|
||||||
let tooltips: Array<ErrorToolTip> = [];
|
|
||||||
|
|
||||||
for (let i of CustTable!) {
|
|
||||||
let tip = ValidateCustEntry(i);
|
|
||||||
if (tip) {
|
|
||||||
tooltips.push(tip);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tooltips.length > 0) {
|
|
||||||
throw new Error("Invalid cust");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function SaveCust(buffer) {
|
function SaveCust(buffer) {
|
||||||
let view = new DataView(buffer);
|
let view = new DataView(buffer);
|
||||||
let storage = {};
|
let storage = {};
|
||||||
storage["custRev"] = CUST_REV;
|
|
||||||
|
|
||||||
for (let i of CustTable!) {
|
for (let i of CustTable) {
|
||||||
let id = i.name;
|
i.update();
|
||||||
i.value = Number((document.getElementById(id) as HTMLInputElement).value);
|
if (!i.validate() || i.value === null) {
|
||||||
storage[i.name] = i.value;
|
document.getElementById(i.id)!.focus();
|
||||||
|
throw new Error(`Invalid ${i.name}`);
|
||||||
|
}
|
||||||
|
if (!i.offset) {
|
||||||
|
document.getElementById(i.id)!.focus();
|
||||||
|
throw new Error(`Failed to get offset for ${i.name}`);;
|
||||||
|
}
|
||||||
switch (i.size) {
|
switch (i.size) {
|
||||||
case 2:
|
case 2:
|
||||||
view.setUint16(i.offset!, i.value, true);
|
view.setUint16(i.offset, i.value, true);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
view.setUint32(i.offset!, i.value, true);
|
view.setUint32(i.offset, i.value, true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
document.getElementById(i.name)!.focus();
|
document.getElementById(i.id)!.focus();
|
||||||
throw new Error("Unknown size at " + i);
|
throw new Error(`Unknown size at ${i.name}`);
|
||||||
}
|
}
|
||||||
|
storage[i.id] = i.value;
|
||||||
}
|
}
|
||||||
ValidateCust();
|
|
||||||
|
|
||||||
|
storage["custRev"] = CUST_REV;
|
||||||
localStorage.setItem("last_saved", JSON.stringify(storage));
|
localStorage.setItem("last_saved", JSON.stringify(storage));
|
||||||
let a = document.createElement("a");
|
let a = document.createElement("a");
|
||||||
a.href = window.URL.createObjectURL(new Blob([buffer], { type: "application/octet-stream" }));
|
a.href = window.URL.createObjectURL(new Blob([buffer], { type: "application/octet-stream" }));
|
||||||
@@ -394,61 +334,20 @@ function LoadLastSaved() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function LoadDefault() {
|
function LoadDefault() {
|
||||||
for (let i of CustTable!) {
|
for (let i of CustTable) {
|
||||||
let id = i.name;
|
(document.getElementById(i.id) as HTMLInputElement).value = String(i.defval);
|
||||||
(document.getElementById(id) as HTMLInputElement).value = String(i.defval);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ClearHTMLForm() {
|
function ClearHTMLForm() {
|
||||||
if (!CustTable) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (let i of CustTable) {
|
for (let i of CustTable) {
|
||||||
let id = i.name;
|
i.clearForm();
|
||||||
let input = document.getElementById(id) as HTMLInputElement;
|
|
||||||
input.parentElement?.parentElement?.remove();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function UpdateHTMLForm() {
|
function UpdateHTMLForm() {
|
||||||
let dict = Object.assign({}, ...CustTable!.map((x: { name: any; }) => ({ [x.name]: x })));
|
for (let i of CustTable) {
|
||||||
let form = document.getElementById("form")!;
|
i.createForm();
|
||||||
for (let i of CustTable!) {
|
|
||||||
let id = i.name;
|
|
||||||
let input = document.getElementById(id) as HTMLInputElement;
|
|
||||||
if (!input) {
|
|
||||||
let grid = document.createElement("div");
|
|
||||||
grid.classList.add("grid");
|
|
||||||
|
|
||||||
// Label and input box
|
|
||||||
input = document.createElement("input");
|
|
||||||
input.min = dict[i.name].min;
|
|
||||||
input.max = dict[i.name].max;
|
|
||||||
input.id = id;
|
|
||||||
input.type = "number";
|
|
||||||
input.step = dict[i.name].step;
|
|
||||||
let label = document.createElement("label");
|
|
||||||
label.setAttribute("for", id);
|
|
||||||
label.innerHTML = id;
|
|
||||||
label.appendChild(input);
|
|
||||||
grid.appendChild(label);
|
|
||||||
|
|
||||||
// Description in blockquote style
|
|
||||||
let desc = dict[i.name].desc!;
|
|
||||||
let block = document.createElement("blockquote");
|
|
||||||
block.style["margin-top"] = "0";
|
|
||||||
block.innerHTML = desc;
|
|
||||||
block.setAttribute("for", id);
|
|
||||||
grid.appendChild(block);
|
|
||||||
|
|
||||||
grid.style["margin-top"] = "3rem";
|
|
||||||
form.appendChild(grid);
|
|
||||||
|
|
||||||
let tooltip = new ErrorToolTip(id);
|
|
||||||
tooltip.addChangeListener();
|
|
||||||
}
|
|
||||||
input.value = dict[i.name].value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let default_btn = document.getElementById("load_default")!;
|
let default_btn = document.getElementById("load_default")!;
|
||||||
@@ -457,12 +356,15 @@ function UpdateHTMLForm() {
|
|||||||
LoadDefault();
|
LoadDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let last_btn = document.getElementById("load_saved")!;
|
||||||
if (LastSaved()) {
|
if (LastSaved()) {
|
||||||
let last_btn = document.getElementById("load_saved")!;
|
last_btn.style.removeProperty("display");
|
||||||
last_btn.removeAttribute("disabled");
|
last_btn.removeAttribute("disabled");
|
||||||
last_btn.addEventListener('click', () => {
|
last_btn.addEventListener('click', () => {
|
||||||
LoadLastSaved();
|
LoadLastSaved();
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
last_btn.style.setProperty("display", "none");
|
||||||
}
|
}
|
||||||
|
|
||||||
let save_btn = document.getElementById("save")!;
|
let save_btn = document.getElementById("save")!;
|
||||||
@@ -481,16 +383,10 @@ function ParseCust(magicOffset, buffer) {
|
|||||||
let view = new DataView(buffer);
|
let view = new DataView(buffer);
|
||||||
let offset = magicOffset + 4;
|
let offset = magicOffset + 4;
|
||||||
let rev = view.getUint16(offset, true);
|
let rev = view.getUint16(offset, true);
|
||||||
if (rev != 2 && rev != 3) {
|
if (rev != CUST_REV) {
|
||||||
throw new Error("Unsupported custRev, expected: 2 or 3, got " + rev);
|
throw new Error(`Unsupported custRev, expected: ${CUST_REV}, got ${rev}`);
|
||||||
}
|
}
|
||||||
CUST_REV = rev;
|
|
||||||
document.getElementById("cust_rev")!.innerHTML = `Cust V${CUST_REV} is loaded.`;
|
document.getElementById("cust_rev")!.innerHTML = `Cust V${CUST_REV} is loaded.`;
|
||||||
if (rev == 2) {
|
|
||||||
CustTable = CustTableV2;
|
|
||||||
} else {
|
|
||||||
CustTable = CustTableV3;
|
|
||||||
}
|
|
||||||
|
|
||||||
offset += 2;
|
offset += 2;
|
||||||
for (let i of CustTable) {
|
for (let i of CustTable) {
|
||||||
@@ -503,10 +399,11 @@ function ParseCust(magicOffset, buffer) {
|
|||||||
i.value = view.getUint32(offset, true);
|
i.value = view.getUint32(offset, true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
document.getElementById(i.name)!.focus();
|
document.getElementById(i.id)!.focus();
|
||||||
throw new Error("Unknown size at " + i);
|
throw new Error("Unknown size at " + i);
|
||||||
}
|
}
|
||||||
offset += i.size;
|
offset += i.size;
|
||||||
|
i.validate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -521,7 +418,6 @@ fileInput.addEventListener('change', (event) => {
|
|||||||
let offset = FindMagicOffset(buffer);
|
let offset = FindMagicOffset(buffer);
|
||||||
ClearHTMLForm();
|
ClearHTMLForm();
|
||||||
ParseCust(offset, buffer);
|
ParseCust(offset, buffer);
|
||||||
ValidateCust();
|
|
||||||
UpdateHTMLForm();
|
UpdateHTMLForm();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
@@ -536,7 +432,9 @@ fileInput.addEventListener('change', (event) => {
|
|||||||
type ReleaseInfo = {
|
type ReleaseInfo = {
|
||||||
OCSuiteVer: string;
|
OCSuiteVer: string;
|
||||||
LoaderKipUrl: string;
|
LoaderKipUrl: string;
|
||||||
|
LoaderKipTime: string;
|
||||||
SdOutZipUrl: string;
|
SdOutZipUrl: string;
|
||||||
|
SdOutZipTime: string;
|
||||||
AMSVer: string;
|
AMSVer: string;
|
||||||
AMSUrl: string;
|
AMSUrl: string;
|
||||||
};
|
};
|
||||||
@@ -568,7 +466,9 @@ async function fetchRelease(): Promise<ReleaseInfo | void> {
|
|||||||
let info: ReleaseInfo = {
|
let info: ReleaseInfo = {
|
||||||
OCSuiteVer: latestVerFromSuite,
|
OCSuiteVer: latestVerFromSuite,
|
||||||
LoaderKipUrl: loaderKip.browser_download_url,
|
LoaderKipUrl: loaderKip.browser_download_url,
|
||||||
|
LoaderKipTime: loaderKip.updated_at,
|
||||||
SdOutZipUrl: sdOut.browser_download_url,
|
SdOutZipUrl: sdOut.browser_download_url,
|
||||||
|
SdOutZipTime: sdOut.updated_at,
|
||||||
AMSVer: correspondingVerFromAMS,
|
AMSVer: correspondingVerFromAMS,
|
||||||
AMSUrl: amsReleaseUrl
|
AMSUrl: amsReleaseUrl
|
||||||
};
|
};
|
||||||
@@ -589,13 +489,13 @@ async function updateDownloadUrls() {
|
|||||||
|
|
||||||
let info = await fetchRelease();
|
let info = await fetchRelease();
|
||||||
if (info) {
|
if (info) {
|
||||||
const loaderKipName = `loader.kip ${info.OCSuiteVer}`;
|
const loaderKipName = `loader.kip <b>${info.OCSuiteVer}</b><br>${info.LoaderKipTime}`;
|
||||||
updateHref("loader_kip_btn", loaderKipName, info.LoaderKipUrl);
|
updateHref("loader_kip_btn", loaderKipName, info.LoaderKipUrl);
|
||||||
|
|
||||||
const sdOutName = `SdOut.zip ${info.OCSuiteVer}`;
|
const sdOutName = `SdOut.zip <b>${info.OCSuiteVer}</b><br>${info.SdOutZipTime}`;
|
||||||
updateHref("sdout_zip_btn", sdOutName, info.SdOutZipUrl);
|
updateHref("sdout_zip_btn", sdOutName, info.SdOutZipUrl);
|
||||||
|
|
||||||
const amsName = `Atmosphere-NX ${info.AMSVer}`;
|
const amsName = `Atmosphere-NX <b>${info.AMSVer}</b>`;
|
||||||
updateHref("ams_btn", amsName, info.AMSUrl);
|
updateHref("ams_btn", amsName, info.AMSUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user