33 Commits
0.32 ... 0.33

Author SHA1 Message Date
souldbminersmwc
606cafbaad sysclk: rework TDP 2026-02-01 16:33:15 -05:00
souldbminersmwc
0d4ca24538 sysclk: add kip auto update feature 2026-02-01 16:15:08 -05:00
souldbminersmwc
bf8a6c4785 sysclk: fix uv3 cappings 2026-02-01 15:27:17 -05:00
souldbminersmwc
2376b85d3a remove build action
way too slow to be practical
2026-01-31 18:52:23 -05:00
souldbminersmwc
26fb76e448 Update build.yml 2026-01-31 18:42:54 -05:00
souldbminersmwc
159c7567c0 Update build.yml 2026-01-31 18:41:42 -05:00
souldbminersmwc
39366ce238 Update build.yml 2026-01-31 18:40:33 -05:00
souldbminersmwc
da631ad268 Create build.yml 2026-01-31 18:37:47 -05:00
souldbminersmwc
d508177d4b Delete build.yml 2026-01-31 17:31:47 -05:00
souldbminersmwc
d8527410de Update build.yml 2026-01-31 17:30:17 -05:00
souldbminersmwc
bae7216de0 Update build.yml 2026-01-31 17:29:34 -05:00
souldbminersmwc
b3ddf172e8 Update build.yml 2026-01-31 17:28:25 -05:00
souldbminersmwc
cdaea8f729 fix build script 2026-01-31 17:27:18 -05:00
souldbminersmwc
918ca5757c chore: add build script 2026-01-31 17:25:30 -05:00
souldbminersmwc
93cb0e99c4 build: remove broken build script 2026-01-31 17:20:06 -05:00
souldbminersmwc
4692529346 chore: clean up repo 2026-01-31 17:19:33 -05:00
souldbminersmwc
8de1191ed5 sysclk: rename ipc service 2026-01-31 17:15:06 -05:00
souldbminersmwc
1c21187f73 sysclk: remove unused stuff 2026-01-31 17:12:50 -05:00
souldbminersmwc
2646995b72 sysclk: rework clock capping 2026-01-30 19:44:12 -05:00
souldbminersmwc
cf21342b2e Update pcv_erista.cpp 2026-01-28 15:45:45 -05:00
souldbminersmwc
3709fb3fba ldr: fix default gpu vmin 2026-01-28 15:41:50 -05:00
souldbminersmwc
ea754707ee sysclk: fix erista gpu vmin 2026-01-28 15:39:56 -05:00
souldbminersmwc
bb96267d6c Adjust license 2026-01-26 19:30:18 -05:00
souldbminersmwc
a1fa16da3c misc changes 2026-01-26 19:29:45 -05:00
souldbminersmwc
aad126d611 rename uv table 2026-01-26 19:26:30 -05:00
souldbminersmwc
835189febc update 2026-01-26 19:23:28 -05:00
souldbminersmwc
a9cf59fe28 ldr: UV3 doesn't exist anymore 2026-01-26 19:08:27 -05:00
souldbminersmwc
7708e4bae6 Update pcv.cpp 2026-01-26 19:07:52 -05:00
souldbminersmwc
8c71227c63 sysclk: improve cpu fix 2026-01-26 16:41:35 -05:00
souldbminersmwc
627732326b Merge branch 'develop' of https://github.com/Horizon-OC/Horizon-OC into develop 2026-01-26 16:26:09 -05:00
souldbminersmwc
f5d9761853 fix cpu bug 2026-01-26 16:25:25 -05:00
Lightos1
1d219e9425 Extend vdd2 validators 2026-01-25 13:07:13 +01:00
Lightos1
2c14ddad5c Extend vddq validator 2026-01-25 11:41:05 +01:00
103 changed files with 314 additions and 1522 deletions

View File

@@ -1,6 +1,8 @@
/* /*
* Copyright (c) Atmosphère-NX * Copyright (c) Atmosphère-NX
* *
* Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
*
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation. * version 2, as published by the Free Software Foundation.

View File

@@ -3,7 +3,7 @@
* *
* Copyright (c) 2023 hanai3Bi * Copyright (c) 2023 hanai3Bi
* *
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@@ -37,7 +37,7 @@ volatile CustomizeTable C = {
.commonEmcMemVolt = 1175000, // LPDDR4X JEDEC Specification .commonEmcMemVolt = 1175000, // LPDDR4X JEDEC Specification
.eristaEmcMaxClock = 1600000, // Maximum HB-MGCH ram rating .eristaEmcMaxClock = 1600000, // Maximum HB-MGCH ram rating
.marikoEmcMaxClock = 1866000, .marikoEmcMaxClock = 1866000, // 1866MHz @ 1866tWRL is guaranteed to work on all Mariko units
.marikoEmcVddqVolt = 600000, .marikoEmcVddqVolt = 600000,
.emcDvbShift = 0, .emcDvbShift = 0,
@@ -96,7 +96,7 @@ volatile CustomizeTable C = {
.marikoCpuBoostClock = 1963000, // Default boost clock .marikoCpuBoostClock = 1963000, // Default boost clock
.eristaGpuUV = 0, .eristaGpuUV = 0,
.eristaGpuVmin = 800, .eristaGpuVmin = 810,
.marikoGpuUV = 0, .marikoGpuUV = 0,
/* For automatic vmin detection, set this to AUTO. */ /* For automatic vmin detection, set this to AUTO. */
@@ -327,7 +327,7 @@ volatile CustomizeTable C = {
{ 2703000, { 1838820, -36648, 113, }, { CPU_MAX_MAX_VOLT, } }, { 2703000, { 1838820, -36648, 113, }, { CPU_MAX_MAX_VOLT, } },
}, },
.marikoCpuDvfsTableHelios { .marikoCpuDvfsTableExtreme {
{ 204000, { 732856, -17335, 113, }, { } }, { 204000, { 732856, -17335, 113, }, { } },
{ 306000, { 760024, -18195, 113, }, { } }, { 306000, { 760024, -18195, 113, }, { } },
{ 408000, { 789258, -19055, 113, }, { } }, { 408000, { 789258, -19055, 113, }, { } },

View File

@@ -3,7 +3,7 @@
* *
* Copyright (c) 2023 hanai3Bi * Copyright (c) 2023 hanai3Bi
* *
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@@ -38,7 +38,7 @@ enum TableConfig: u32 {
DEFAULT_TABLE = 1, DEFAULT_TABLE = 1,
TBREAK_1581 = 2, TBREAK_1581 = 2,
TBREAK_1683 = 3, TBREAK_1683 = 3,
HELIOS_TABLE = 4, EXTREME_TABLE = 4,
}; };
using CustomizeCpuDvfsTable = pcv::cvb_entry_t[pcv::DvfsTableEntryLimit]; using CustomizeCpuDvfsTable = pcv::cvb_entry_t[pcv::DvfsTableEntryLimit];
@@ -114,7 +114,7 @@ typedef struct CustomizeTable {
CustomizeCpuDvfsTable marikoCpuDvfsTableSLT; CustomizeCpuDvfsTable marikoCpuDvfsTableSLT;
CustomizeCpuDvfsTable marikoCpuDvfsTable1581Tbreak; CustomizeCpuDvfsTable marikoCpuDvfsTable1581Tbreak;
CustomizeCpuDvfsTable marikoCpuDvfsTable1683Tbreak; CustomizeCpuDvfsTable marikoCpuDvfsTable1683Tbreak;
CustomizeCpuDvfsTable marikoCpuDvfsTableHelios; CustomizeCpuDvfsTable marikoCpuDvfsTableExtreme;
CustomizeGpuDvfsTable eristaGpuDvfsTable; CustomizeGpuDvfsTable eristaGpuDvfsTable;
CustomizeGpuDvfsTable eristaGpuDvfsTableSLT; CustomizeGpuDvfsTable eristaGpuDvfsTableSLT;

View File

@@ -1,7 +1,7 @@
/* /*
* Copyright (C) Switch-OC-Suite * Copyright (C) Switch-OC-Suite
* *
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,7 +1,7 @@
/* /*
* Copyright (C) Switch-OC-Suite * Copyright (C) Switch-OC-Suite
* *
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,7 +1,7 @@
/* /*
* Copyright (C) Switch-OC-Suite * Copyright (C) Switch-OC-Suite
* *
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,7 +1,7 @@
/* /*
* Copyright (C) Switch-OC-Suite * Copyright (C) Switch-OC-Suite
* *
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -3,7 +3,7 @@
* *
* Copyright (c) 2023 hanai3Bi * Copyright (c) 2023 hanai3Bi
* *
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@@ -115,7 +115,6 @@ void SafetyCheck() {
eristaGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.eristaGpuDvfsTableSLT)->freq); eristaGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.eristaGpuDvfsTableSLT)->freq);
break; break;
case 2: case 2:
case 3:
eristaGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.eristaGpuDvfsTableHiOPT)->freq); eristaGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.eristaGpuDvfsTableHiOPT)->freq);
break; break;
default: default:
@@ -132,7 +131,6 @@ void SafetyCheck() {
marikoGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.marikoGpuDvfsTableSLT)->freq); marikoGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.marikoGpuDvfsTableSLT)->freq);
break; break;
case 2: case 2:
case 3:
marikoGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.marikoGpuDvfsTableHiOPT)->freq); marikoGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.marikoGpuDvfsTableHiOPT)->freq);
break; break;
default: default:
@@ -143,12 +141,12 @@ void SafetyCheck() {
sValidator validators[] = { sValidator validators[] = {
{ C.eristaCpuBoostClock, 1020'000, 2295'000, true }, { C.eristaCpuBoostClock, 1020'000, 2295'000, true },
{ C.marikoCpuBoostClock, 1020'000, 2703'000, true }, { C.marikoCpuBoostClock, 1020'000, 2703'000, true },
{ C.commonEmcMemVolt, 1100'000, 1350'000 }, // Official burst vmax for the RAMs is 1500mV { C.commonEmcMemVolt, 912'500, 1350'000 }, // Official burst vmax for the RAMs is 1500mV
{ C.eristaCpuMaxVolt, 1100, 1257 }, { C.eristaCpuMaxVolt, 1000, 1257 },
{ C.eristaEmcMaxClock, 1600'000, 2600'200 }, { C.eristaEmcMaxClock, 1600'000, 2600'000 },
{ C.marikoCpuMaxVolt, 1100, 1235 }, { C.marikoCpuMaxVolt, 1000, 1235 },
{ C.marikoEmcMaxClock, 1600'000, 3500'000 }, { C.marikoEmcMaxClock, 1600'000, 3500'000 },
{ C.marikoEmcVddqVolt, 550'000, 700'000 }, { C.marikoEmcVddqVolt, 250'000, 700'000 },
{ eristaCpuDvfsMaxFreq, 1785'000, 2295'000 }, { eristaCpuDvfsMaxFreq, 1785'000, 2295'000 },
{ marikoCpuDvfsMaxFreq, 1785'000, 2703'000 }, { marikoCpuDvfsMaxFreq, 1785'000, 2703'000 },
{ eristaGpuDvfsMaxFreq, 768'000, 1152'000 }, { eristaGpuDvfsMaxFreq, 768'000, 1152'000 },

View File

@@ -3,7 +3,7 @@
* *
* Copyright (c) 2023 hanai3Bi * Copyright (c) 2023 hanai3Bi
* *
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@@ -216,9 +216,8 @@ namespace ams::ldr::oc::pcv {
constexpr u32 GpuClkPllLimit = 921'600'000; constexpr u32 GpuClkPllLimit = 921'600'000;
constexpr u32 GpuVminOfficial = 810; constexpr u32 GpuVminOfficial = 810;
static const u32 gpuVoltDvfsPattern[] = { 1150, 1000, 100, 1000, 10, }; static const u32 gpuVoltDvfsPattern[] = { 810, 1150, 1000, 100, 1000, 10, };
static const u32 gpuVoltDvfsOffsets[] = { 1, 2, 3, 4, 5, }; static_assert(sizeof(gpuVoltDvfsPattern) == (sizeof(u32) * 6), "Invalid gpuVoltDvfsPattern");
static_assert(sizeof(gpuVoltDvfsPattern) == sizeof(gpuVoltDvfsOffsets), "Invalid gpuVoltDvfsPattern");
static const u32 gpuVoltThermalPattern[] = { 950, 1132, 0, 810, 1132, 15000, 810, 1132, 30000, 810, 1132, 50000, 810, 1132, 70000, 810, 1132, 105000 }; static const u32 gpuVoltThermalPattern[] = { 950, 1132, 0, 810, 1132, 15000, 810, 1132, 30000, 810, 1132, 50000, 810, 1132, 70000, 810, 1132, 105000 };
static_assert(sizeof(gpuVoltThermalPattern) == 0x48, "invalid gpuVoltageThermalPattern size"); static_assert(sizeof(gpuVoltThermalPattern) == 0x48, "invalid gpuVoltageThermalPattern size");
@@ -309,8 +308,8 @@ namespace ams::ldr::oc::pcv {
customize_table = const_cast<cvb_entry_t *>(C.marikoCpuDvfsTable1581Tbreak); customize_table = const_cast<cvb_entry_t *>(C.marikoCpuDvfsTable1581Tbreak);
break; break;
} }
case HELIOS_TABLE: { case EXTREME_TABLE: {
customize_table = const_cast<cvb_entry_t *>(C.marikoCpuDvfsTableHelios); customize_table = const_cast<cvb_entry_t *>(C.marikoCpuDvfsTableExtreme);
break; break;
} }
case DEFAULT_TABLE: case DEFAULT_TABLE:

View File

@@ -1,7 +1,7 @@
/* /*
* Copyright (C) Switch-OC-Suite * Copyright (C) Switch-OC-Suite
* *
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -3,7 +3,7 @@
* *
* Copyright (c) 2023 hanai3Bi * Copyright (c) 2023 hanai3Bi
* *
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@@ -103,14 +103,15 @@ namespace ams::ldr::oc::pcv::erista {
} }
Result GpuVoltDVFS(u32 *ptr) { Result GpuVoltDVFS(u32 *ptr) {
if (MatchesPattern(ptr, gpuVoltDvfsPattern, gpuVoltDvfsOffsets)) { u32 result = std::memcmp(ptr, gpuVoltDvfsPattern, sizeof(gpuVoltDvfsPattern));
if (C.eristaGpuVmin) {
PATCH_OFFSET(ptr, C.eristaGpuVmin);
}
R_SUCCEED();
}
R_THROW(ldr::ResultInvalidGpuDvfs()); if (result)
R_THROW(ldr::ResultInvalidGpuDvfs());
if (C.eristaGpuVmin)
PATCH_OFFSET(ptr, C.eristaGpuVmin);
R_SUCCEED();
} }
Result GpuVoltThermals(u32 *ptr) { Result GpuVoltThermals(u32 *ptr) {
@@ -730,17 +731,14 @@ namespace ams::ldr::oc::pcv::erista {
} }
void Patch(uintptr_t mapped_nso, size_t nso_size) { void Patch(uintptr_t mapped_nso, size_t nso_size) {
u32 CpuCvbDefaultMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(CpuCvbTableDefault)->freq);
u32 GpuCvbDefaultMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(GpuCvbTableDefault)->freq);
PatcherEntry<u32> patches[] = { PatcherEntry<u32> patches[] = {
{"CPU Freq Table", CpuFreqCvbTable<false>, 1, nullptr, CpuCvbDefaultMaxFreq}, {"CPU Freq Table", CpuFreqCvbTable<false>, 1, nullptr, static_cast<u32>(GetDvfsTableLastEntry(CpuCvbTableDefault)->freq)},
{"CPU Volt DVFS", &CpuVoltDvfs, 1, nullptr, 825}, {"CPU Volt DVFS", &CpuVoltDvfs, 1, nullptr, 825},
{"CPU Volt Thermals", &CpuVoltThermals, 1, nullptr, 825}, {"CPU Volt Thermals", &CpuVoltThermals, 1, nullptr, 825},
{"CPU Volt Dfll", &CpuVoltDfll, 1, nullptr, 0xFFD0EAFF}, {"CPU Volt Dfll", &CpuVoltDfll, 1, nullptr, 0xFFD0EAFF},
{"GPU Volt DVFS", &GpuVoltDVFS, 1, nullptr, 810}, {"GPU Volt DVFS", &GpuVoltDVFS, 1, nullptr, 810},
{"GPU Volt Thermals", &GpuVoltThermals, 1, nullptr, 810}, {"GPU Volt Thermals", &GpuVoltThermals, 1, nullptr, 810},
{"GPU Freq Table", GpuFreqCvbTable<false>, 1, nullptr, GpuCvbDefaultMaxFreq}, {"GPU Freq Table", GpuFreqCvbTable<false>, 1, nullptr, static_cast<u32>(GetDvfsTableLastEntry(GpuCvbTableDefault)->freq)},
{"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, EmcClkOSLimit}, {"MEM Freq Mtc", &MemFreqMtcTable, 0, nullptr, EmcClkOSLimit},

View File

@@ -1,7 +1,7 @@
/* /*
* Copyright (C) Switch-OC-Suite * Copyright (C) Switch-OC-Suite
* *
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,7 +1,7 @@
/* /*
* Copyright (C) Switch-OC-Suite * Copyright (C) Switch-OC-Suite
* *
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,287 +0,0 @@
diff --git a/Overlay/Makefile b/Overlay/Makefile
index 9656834..3b2ebd5 100644
--- a/Overlay/Makefile
+++ b/Overlay/Makefile
@@ -38,7 +38,7 @@ include $(DEVKITPRO)/libnx/switch_rules
# NACP building is skipped as well.
#---------------------------------------------------------------------------------
APP_TITLE := ReverseNX-RT
-APP_VERSION := 1.1.1
+APP_VERSION := 1.1.1-OC
TARGET := ReverseNX-RT-ovl
BUILD := build
diff --git a/Overlay/source/main.cpp b/Overlay/source/main.cpp
index 810295c..2b3aa52 100644
--- a/Overlay/source/main.cpp
+++ b/Overlay/source/main.cpp
@@ -1,7 +1,202 @@
#define TESLA_INIT_IMPL // If you have more than one file using the tesla header, only define this in the main one
#include <tesla.hpp> // The Tesla Header
+#include <atomic>
#include "SaltyNX.h"
+class ModeSync {
+public:
+ enum ReverseNXMode {
+ ReverseNX_NotValid = 0,
+ ReverseNX_SystemDefault = 0,
+ ReverseNX_Handheld,
+ ReverseNX_Docked,
+ ReverseNX_Undefined,
+ };
+
+ void SetMode(bool isDefault, bool setDock, char* descBuf, size_t bufSize) {
+ auto changeHandler = [this](ReverseNXMode newMode) {
+ if (this->currentMode == ReverseNX_Undefined || this->currentMode != newMode) {
+ if (R_FAILED(this->ipc->SetMode(newMode))) {
+ this->ipc->ipcStatus = Ipc::IpcStatus_ConnectFailed;
+ return;
+ }
+ this->currentMode = newMode;
+ }
+ };
+
+ tsl::hlp::ScopeGuard updateBufGuard([&] { this->ipc->UpdateStatusDesc(descBuf, bufSize); });
+
+ if (isDefault) {
+ changeHandler(ReverseNX_SystemDefault);
+ return;
+ }
+
+ changeHandler(setDock ? ReverseNX_Docked : ReverseNX_Handheld);
+ }
+
+ ModeSync() {
+ this->ipc = new Ipc;
+ this->ipc->Init();
+ }
+
+ ~ModeSync() {
+ this->ipc->Exit();
+ delete this->ipc;
+ }
+
+protected:
+ struct Ipc {
+ #define API_VER 2
+ #define SERVICE_NAME "sysclkOC"
+
+ enum SysClkIpcCmd {
+ SysClkIpcCmd_GetApiVersion = 0,
+ SysClkIpcCmd_GetConfigValues = 9,
+ SysClkIpcCmd_SetReverseNXRTMode = 11,
+ };
+
+ enum SysClkConfigValue {
+ SysClkConfigValue_SyncReverseNXMode = 4,
+ SysClkConfigValue_EnumMax = 8,
+ };
+
+ struct SysClkConfigValueList {
+ uint64_t values[SysClkConfigValue_EnumMax];
+ };
+
+ enum IpcStatus {
+ IpcStatus_OK,
+
+ IpcStatus_Unknown,
+ IpcStatus_NotRunning,
+ IpcStatus_InitFailed,
+ IpcStatus_ConnectFailed,
+ IpcStatus_UnsupportedVer,
+
+ IpcStatus_Count,
+ };
+
+ static constexpr const char* IpcStatusStr[IpcStatus_Count] = {
+ "",
+
+ "Unknown",
+ "Err: Not running",
+ "Err: Failed to init",
+ "Err: Failed to connect",
+ "Err: Unsupported version",
+ };
+
+ Result Init() {
+ Result rc = 0;
+
+ rc = IpcInitialize();
+
+ rc = GetStatus();
+
+ return rc;
+ }
+
+ void Exit() {
+ if (--refCnt == 0)
+ serviceClose(&service);
+ }
+
+ bool IsServiceRunning() {
+ Handle handle;
+ SmServiceName name = smEncodeName(SERVICE_NAME);
+ if (R_FAILED(smRegisterService(&handle, name, false, 1))) {
+ return true;
+ }
+ svcCloseHandle(handle);
+ smUnregisterService(name);
+ return false;
+ }
+
+ Result IpcInitialize(void) {
+ Result rc = 0;
+ refCnt++;
+
+ if (serviceIsActive(&service))
+ return 0;
+
+ rc = smGetService(&service, SERVICE_NAME);
+
+ if (R_FAILED(rc)) {
+ this->ipcStatus = IpcStatus_InitFailed;
+ rc = this->ipcStatus;
+ this->Exit();
+ return rc;
+ }
+
+ return rc;
+ }
+
+ Result GetApiVersion(u32* outVer) {
+ return serviceDispatchOut(&service, SysClkIpcCmd_GetApiVersion, *outVer);
+ }
+
+ Result GetConfigValues(SysClkConfigValueList* outConfigValues) {
+ return serviceDispatchOut(&service, SysClkIpcCmd_GetConfigValues, *outConfigValues);
+ }
+
+ Result SetMode(ReverseNXMode mode) {
+ return serviceDispatchIn(&service, SysClkIpcCmd_SetReverseNXRTMode, mode);
+ }
+
+ Result GetStatus() {
+ if (!IsServiceRunning()) {
+ this->ipcStatus = IpcStatus_NotRunning;
+ return this->ipcStatus;
+ }
+
+ tsl::hlp::ScopeGuard exitSrvGuard([&] { this->Exit(); });
+
+ uint32_t api_ver;
+ if (R_FAILED(GetApiVersion(&api_ver))) {
+ this->ipcStatus = IpcStatus_ConnectFailed;
+ return this->ipcStatus;
+ }
+
+ if (api_ver != API_VER) {
+ this->ipcStatus = IpcStatus_UnsupportedVer;
+ return this->ipcStatus;
+ }
+
+ SysClkConfigValueList* list = new SysClkConfigValueList;
+ tsl::hlp::ScopeGuard listGuard([&] { delete list; });
+
+ if (R_FAILED(GetConfigValues(list))) {
+ this->ipcStatus = IpcStatus_ConnectFailed;
+ return this->ipcStatus;
+ }
+
+ exitSrvGuard.dismiss();
+
+ shouldSync = bool(list->values[SysClkConfigValue_SyncReverseNXMode]);
+ this->ipcStatus = IpcStatus_OK;
+ return this->ipcStatus;
+ }
+
+ void UpdateStatusDesc(char* buffer, size_t size) {
+ snprintf(buffer, size,
+ "Mode Sync: %s%s",
+ IpcStatusStr[ipcStatus],
+ (ipcStatus == IpcStatus_OK) ? (
+ shouldSync ? "ON" : "OFF"
+ ) : ""
+ );
+ }
+
+ Service service = {};
+ std::atomic<std::size_t> refCnt = 0;
+ IpcStatus ipcStatus = IpcStatus_Unknown;
+ bool shouldSync = false;
+ };
+
+ Ipc* ipc = nullptr;
+ ReverseNXMode currentMode = ReverseNX_Undefined;
+};
+
bool* def = 0;
bool* isDocked = 0;
bool* pluginActive = 0;
@@ -17,6 +212,7 @@ bool plugin = false;
char DockedChar[32];
char SystemChar[32];
char PluginChar[36];
+char SysclkChar[0x40];
uint64_t PID = 0;
Handle remoteSharedMemory = 1;
SharedMemory _sharedmemory = {};
@@ -73,7 +269,7 @@ bool CheckPort () {
class GuiTest : public tsl::Gui {
public:
- GuiTest(u8 arg1, u8 arg2, bool arg3) { }
+ GuiTest(ModeSync* p) : modeSync(p) { }
// Called when this Gui gets loaded to create the UI
// Allocate all elements on the heap. libtesla will make sure to clean them up when not needed anymore
@@ -112,6 +308,7 @@ public:
else {
renderer->drawString(SystemChar, false, x, y+40, 20, renderer->a(0xFFFF));
renderer->drawString(DockedChar, false, x, y+60, 20, renderer->a(0xFFFF));
+ renderer->drawString(SysclkChar, false, x, y+80, 20, renderer->a(0xFFFF));
}
}
}), 100);
@@ -190,6 +387,8 @@ public:
if (_def) sprintf(SystemChar, "Controlled by system: Yes");
else sprintf(SystemChar, "Controlled by system: No");
+
+ modeSync->SetMode(_def, _isDocked, SysclkChar, sizeof(SysclkChar));
}
else i++;
}
@@ -200,6 +399,8 @@ public:
virtual bool handleInput(u64 keysDown, u64 keysHeld, const HidTouchState &touchPos, HidAnalogStickState joyStickPosLeft, HidAnalogStickState joyStickPosRight) override {
return false; // Return true here to singal the inputs have been consumed
}
+
+ ModeSync* modeSync;
};
class OverlayTest : public tsl::Overlay {
@@ -248,9 +449,11 @@ public:
});
+ modeSync = new ModeSync;
} // Called at the start to initialize all services necessary for this Overlay
virtual void exitServices() override {
+ delete modeSync;
shmemClose(&_sharedmemory);
fsdevUnmountDevice("sdmc");
} // Callet at the end to clean up all services previously initialized
@@ -260,8 +463,10 @@ public:
virtual void onHide() override {} // Called before overlay wants to change from visible to invisible state
virtual std::unique_ptr<tsl::Gui> loadInitialGui() override {
- return initially<GuiTest>(1, 2, true); // Initial Gui to load. It's possible to pass arguments to it's constructor like this
+ return initially<GuiTest>(modeSync); // Initial Gui to load. It's possible to pass arguments to it's constructor like this
}
+
+ ModeSync* modeSync = nullptr;
};
int main(int argc, char **argv) {

View File

@@ -1,241 +0,0 @@
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <inttypes.h>
#include <unistd.h>
#include <switch.h>
/* Recompile nx-hbloader with following added in config.json "kernel_capabilities"
{
"type": "map",
"value": {
"address": "0x60006000",
"size": "0x1000",
"is_ro": false,
"is_io": true
}
}
*/
void waitForKey(PadState pad) {
while (appletMainLoop())
{
padUpdate(&pad);
u64 kDown = padGetButtonsDown(&pad);
if (kDown & HidNpadButton_A)
break;
if (kDown & HidNpadButton_Plus || kDown & HidNpadButton_B) {
consoleExit(NULL);
exit(0);
}
consoleUpdate(NULL);
}
}
#define CLK_RST_IO_BASE 0x60006000
#define CLK_RST_IO_SIZE 0x1000
#define REG(OFFSET) (*reinterpret_cast<volatile u32 *>(OFFSET))
#define GET_BITS(VAL, HIGH, LOW) ((VAL & ((1UL << (HIGH + 1UL)) - 1UL)) >> LOW)
#define GET_BIT(VAL, BIT) GET_BITS(VAL, BIT, BIT)
static u64 clkrst_base = 0;
static u64 clkrst_size = 0;
// From jetson nano kernel
typedef enum {
/* divider = 2 */
CLK_PLLX = 5,
CLK_PLLM = 2,
CLK_PLLMB = 37,
/* PLLX & PLLG are backup PLLs for CPU & GPU */
/* divider = 1 */
CLK_CCLK_G = 18, // A57 CPU cluster
CLK_EMC = 36,
} PTO_ID; // PLL Test Output Register ID
/* See if GM20B clock GPC PLL regs are accessible. */
#define PLLX_MISC0 0xE4
#define PLLM_MISC2 0x9C
double ptoGetMHz(PTO_ID pto_id, u32 divider = 1, u32 presel_reg = 0, u32 presel_mask = 0) {
u32 pre_val, val, presel_val;
if (presel_reg) {
val = REG(clkrst_base + presel_reg);
usleep(10);
presel_val = val & presel_mask;
val &= ~presel_mask;
val |= presel_mask;
REG(clkrst_base + presel_reg) = val;
usleep(10);
}
constexpr u32 cycle_count = 16;
pre_val = REG(clkrst_base + 0x60);
val = BIT(23) | BIT(13) | (cycle_count - 1);
val |= pto_id << 14;
REG(clkrst_base + 0x60) = val;
usleep(10);
REG(clkrst_base + 0x60) = val | BIT(10);
usleep(10);
REG(clkrst_base + 0x60) = val;
usleep(10);
REG(clkrst_base + 0x60) = val | BIT(9);
usleep(500);
while(REG(clkrst_base + 0x64) & BIT(31))
;
val = REG(clkrst_base + 0x64);
val &= 0xFFFFFF;
val *= divider;
double rate_mhz = (u64)val * 32768. / cycle_count / 1000. / 1000.;
usleep(10);
REG(clkrst_base + 0x60) = pre_val;
usleep(10);
if (presel_reg) {
val = REG(clkrst_base + presel_reg);
usleep(10);
val &= ~presel_mask;
val |= presel_val;
REG(clkrst_base + presel_reg) = val;
usleep(10);
}
return rate_mhz;
}
int main() {
consoleInit(NULL);
PadState pad;
padConfigureInput(1, HidNpadStyleSet_NpadStandard);
padInitializeDefault(&pad);
// Get clkrst MMIO virtual address
Result rc = svcQueryIoMapping(&clkrst_base, &clkrst_size, CLK_RST_IO_BASE, CLK_RST_IO_SIZE);
if (R_FAILED(rc)) {
printf("[ERROR] svcQueryIoMapping: 0x%X\n", rc);
consoleUpdate(NULL);
waitForKey(pad);
consoleExit(NULL);
}
printf("clkrst_base: 0x%lX\nclkrst_size: 0x%lX\n", clkrst_base, clkrst_size);
{
#define CLKRST_PLLX_BASE 0xE0
u32 pllx_base = REG(clkrst_base + CLKRST_PLLX_BASE);
printf("\n"\
"PLLX_BASE: 0x%X\n"\
"PLLX_ENABLE: %lu\n"\
"PLLX_REF_DIS: %lu\n"\
"PLLX_LOCK: %lu\n"\
"PLLX_DIVP: %lu\n"\
"PLLX_DIVN: %lu\n"\
"PLLX_DIVM: %lu\n",
pllx_base,
GET_BIT(pllx_base, 30),
GET_BIT(pllx_base, 29),
GET_BIT(pllx_base, 27),
GET_BITS(pllx_base, 24, 20),
GET_BITS(pllx_base, 15, 8),
GET_BITS(pllx_base, 7, 0));
}
{
#define CLKRST_PLLX_MISC 0xE4
u32 pllx_misc = REG(clkrst_base + CLKRST_PLLX_MISC);
printf("\n"\
"PLLX_MISC: 0x%X\n"\
"PLLX_FO_G_DISABLE: %lu\n"\
"PLLX_PTS: %lu\n"\
"PLLX_LOCK_ENABLE: %lu\n",
pllx_misc,
GET_BIT(pllx_misc, 28),
GET_BITS(pllx_misc, 23, 22),
GET_BIT(pllx_misc, 18));
}
{
#define CLKRST_PLLMB_SS_CFG 0x780
u32 pllmb_ss_cfg = REG(clkrst_base + CLKRST_PLLMB_SS_CFG);
printf("\n"\
"PLLMB_SS_CFG: 0x%X\n"\
"PLLMB_EN_SDM: %lu\n"\
"PLLMB_EN_SSC: %lu\n",
pllmb_ss_cfg,
GET_BIT(pllmb_ss_cfg, 31),
GET_BIT(pllmb_ss_cfg, 30));
}
{
#define CLKRST_PLLMB_SS_CTRL1 0x784
u32 pllmb_ss_ctrl1 = REG(clkrst_base + CLKRST_PLLMB_SS_CTRL1);
printf("\n"\
"PLLMB_SS_CTRL1: 0x%X\n"\
"PLLMB_SDM_SSC_MAX: %lu\n"\
"PLLMB_SDM_SSC_MIN: %lu\n",
pllmb_ss_ctrl1,
GET_BITS(pllmb_ss_ctrl1, 31, 16),
GET_BITS(pllmb_ss_ctrl1, 15, 0));
}
{
#define CLKRST_PLLM_BASE 0x90
u32 pllm_base = REG(clkrst_base + CLKRST_PLLM_BASE);
printf("\n"\
"PLLM_BASE: 0x%X\n"\
"PLLM_DIVP: %lu\n"\
"PLLM_DIVN: %lu\n"\
"PLLM_DIVM: %lu\n",
pllm_base,
GET_BITS(pllm_base, 24, 20),
GET_BITS(pllm_base, 15, 8),
GET_BITS(pllm_base, 7, 0));
}
{
#define CLKRST_PLLMB_BASE 0x5e8
u32 pllmb_base = REG(clkrst_base + CLKRST_PLLMB_BASE);
printf("\n"\
"PLLMB_BASE: 0x%X\n"\
"PLLMB_DIVP: %lu\n"\
"PLLMB_DIVN: %lu\n"\
"PLLMB_DIVM: %lu\n",
pllmb_base,
GET_BITS(pllmb_base, 24, 20),
GET_BITS(pllmb_base, 15, 8),
GET_BITS(pllmb_base, 7, 0));
}
printf("\n"\
"EMC: %6.1f MHz\n"\
"CCLK_G: %6.1f MHz\n"\
"PLLX: %6.1f MHz\n"\
"PLLM: %6.1f MHz\n"\
"PLLMB: %6.1f MHz\n",
ptoGetMHz(CLK_EMC),
ptoGetMHz(CLK_CCLK_G),
ptoGetMHz(CLK_PLLX, 2, PLLX_MISC0, BIT(22)),
ptoGetMHz(CLK_PLLM, 2, PLLM_MISC2, BIT(8)),
ptoGetMHz(CLK_PLLMB, 2, PLLM_MISC2, BIT(9))
);
waitForKey(pad);
consoleExit(NULL);
return 0;
}

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -0,0 +1,56 @@
/*
* Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#include <stdio.h>
#include <stdint.h>
uint32_t crc32(const uint8_t *data, size_t length) {
uint32_t crc = 0xFFFFFFFF;
for (size_t i = 0; i < length; i++) {
crc ^= data[i];
for (int j = 0; j < 8; j++) {
crc = (crc >> 1) ^ (0xEDB88320 & -(crc & 1));
}
}
return ~crc;
}
uint32_t checksum_file(const char *filename) {
FILE *file = fopen(filename, "rb");
if (!file) {
perror("[crc32] Error opening file");
return 0;
}
uint8_t buffer[1024];
uint32_t crc = 0xFFFFFFFF;
size_t bytes_read;
while ((bytes_read = fread(buffer, 1, sizeof(buffer), file)) > 0) {
for (size_t i = 0; i < bytes_read; i++) {
crc ^= buffer[i];
for (int j = 0; j < 8; j++) {
crc = (crc >> 1) ^ (0xEDB88320 & -(crc & 1));
}
}
}
fclose(file);
return ~crc;
}

View File

@@ -22,7 +22,7 @@
#include <cstdio> #include <cstdio>
static void writeNotification(const std::string& message) { static void writeNotification(const std::string& message) {
const char* flagPath = "sdmc:/config/ultrahand/flags/NOTIFICATIONS.flag"; static const char* flagPath = "sdmc:/config/ultrahand/flags/NOTIFICATIONS.flag";
FILE* flagFile = fopen(flagPath, "r"); FILE* flagFile = fopen(flagPath, "r");
if (!flagFile) { if (!flagFile) {

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,3 +1,20 @@
/*
* Copyright (c) MasaGratoR
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once #pragma once
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@@ -125,6 +125,13 @@ typedef enum {
HorizonOCSpeedo_EnumMax, HorizonOCSpeedo_EnumMax,
} HorizonOCSpeedo; } HorizonOCSpeedo;
typedef enum {
GPUUVLevel_NoUV = 0,
GPUUVLevel_SLT,
GPUUVLevel_HiOPT,
GPUUVLevel_EnumMax,
} GPUUndervoltLevel;
#define SYSCLK_ENUM_VALID(n, v) ((v) < n##_EnumMax) #define SYSCLK_ENUM_VALID(n, v) ((v) < n##_EnumMax)
static inline const char* sysclkFormatModule(SysClkModule module, bool pretty) static inline const char* sysclkFormatModule(SysClkModule module, bool pretty)

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@@ -41,11 +41,7 @@ typedef enum {
HocClkConfigValue_OverwriteBoostMode, HocClkConfigValue_OverwriteBoostMode,
HocClkConfigValue_EristaMaxCpuClock, HocClkConfigValue_EristaMaxCpuClock,
HocClkConfigValue_EristaMaxGpuClock,
HocClkConfigValue_EristaMaxMemClock,
HocClkConfigValue_MarikoMaxCpuClock, HocClkConfigValue_MarikoMaxCpuClock,
HocClkConfigValue_MarikoMaxGpuClock,
HocClkConfigValue_MarikoMaxMemClock,
HocClkConfigValue_ThermalThrottle, HocClkConfigValue_ThermalThrottle,
HocClkConfigValue_ThermalThrottleThreshold, HocClkConfigValue_ThermalThrottleThreshold,
@@ -56,9 +52,6 @@ typedef enum {
HocClkConfigValue_LiteTDPLimit, HocClkConfigValue_LiteTDPLimit,
HocClkConfigValue_EnforceBoardLimit, HocClkConfigValue_EnforceBoardLimit,
HocClkConfigValue_KipEditing,
HocClkConfigValue_KipFileName,
HorizonOCConfigValue_BatteryChargeCurrent, HorizonOCConfigValue_BatteryChargeCurrent,
@@ -165,6 +158,8 @@ typedef enum {
KipConfigValue_g_volt_e_1036800, KipConfigValue_g_volt_e_1036800,
KipConfigValue_g_volt_e_1075200, KipConfigValue_g_volt_e_1075200,
KipCrc32,
HocClkConfigValue_IsFirstLoad,
SysClkConfigValue_EnumMax, SysClkConfigValue_EnumMax,
} SysClkConfigValue; } SysClkConfigValue;
@@ -194,17 +189,9 @@ static inline const char* sysclkFormatConfigValue(SysClkConfigValue val, bool pr
case HocClkConfigValue_EristaMaxCpuClock: case HocClkConfigValue_EristaMaxCpuClock:
return pretty ? "CPU Max Display Clock" : "cpu_max_e"; return pretty ? "CPU Max Display Clock" : "cpu_max_e";
case HocClkConfigValue_EristaMaxGpuClock:
return pretty ? "Max GPU Clock" : "gpu_max_e";
case HocClkConfigValue_EristaMaxMemClock:
return pretty ? "Erista Max MEM Clock" : "mem_max_e";
case HocClkConfigValue_MarikoMaxCpuClock: case HocClkConfigValue_MarikoMaxCpuClock:
return pretty ? "CPU Max Display Clock" : "cpu_max_m"; return pretty ? "CPU Max Display Clock" : "cpu_max_m";
case HocClkConfigValue_MarikoMaxGpuClock:
return pretty ? "Mariko Max GPU Clock" : "gpu_max_m";
case HocClkConfigValue_MarikoMaxMemClock:
return pretty ? "Mariko Max MEM Clock" : "mem_max_m";
case HocClkConfigValue_ThermalThrottle: case HocClkConfigValue_ThermalThrottle:
return pretty ? "Thermal Throttle" : "thermal_throttle"; return pretty ? "Thermal Throttle" : "thermal_throttle";
@@ -224,12 +211,6 @@ static inline const char* sysclkFormatConfigValue(SysClkConfigValue val, bool pr
case HocClkConfigValue_EnforceBoardLimit: case HocClkConfigValue_EnforceBoardLimit:
return pretty ? "Enforce Board Limit" : "enforce_board_limit"; return pretty ? "Enforce Board Limit" : "enforce_board_limit";
case HocClkConfigValue_KipEditing:
return pretty ? "Enable KIP Editing" : "kip_editing";
case HocClkConfigValue_KipFileName:
return pretty ? "KIP File Name" : "kip_file_name";
case HorizonOCConfigValue_BatteryChargeCurrent: case HorizonOCConfigValue_BatteryChargeCurrent:
return pretty ? "Battery Charge Current" : "bat_charge_current"; return pretty ? "Battery Charge Current" : "bat_charge_current";
@@ -389,7 +370,10 @@ static inline const char* sysclkFormatConfigValue(SysClkConfigValue val, bool pr
case KipConfigValue_g_volt_e_998400: return pretty ? "Erista GPU Volt 998 MHz" : "g_volt_e_998400"; case KipConfigValue_g_volt_e_998400: return pretty ? "Erista GPU Volt 998 MHz" : "g_volt_e_998400";
case KipConfigValue_g_volt_e_1036800: return pretty ? "Erista GPU Volt 1036 MHz" : "g_volt_e_1036800"; case KipConfigValue_g_volt_e_1036800: return pretty ? "Erista GPU Volt 1036 MHz" : "g_volt_e_1036800";
case KipConfigValue_g_volt_e_1075200: return pretty ? "Erista GPU Volt 1075 MHz" : "g_volt_e_1075200"; case KipConfigValue_g_volt_e_1075200: return pretty ? "Erista GPU Volt 1075 MHz" : "g_volt_e_1075200";
case KipCrc32:
return pretty ? "CRC32" : "crc32";
case HocClkConfigValue_IsFirstLoad:
return pretty ? "Is First Load" : "is_first_load";
default: default:
return pretty ? "[cfg] no enum format string" : "err_no_format_string"; return pretty ? "[cfg] no enum format string" : "err_no_format_string";
} }
@@ -407,37 +391,28 @@ static inline uint64_t sysclkDefaultConfigValue(SysClkConfigValue val)
case SysClkConfigValue_CsvWriteIntervalMs: case SysClkConfigValue_CsvWriteIntervalMs:
case HocClkConfigValue_UncappedClocks: case HocClkConfigValue_UncappedClocks:
case HocClkConfigValue_OverwriteBoostMode: case HocClkConfigValue_OverwriteBoostMode:
case HocClkConfigValue_KipFileName:
case HorizonOCConfigValue_BatteryChargeCurrent: case HorizonOCConfigValue_BatteryChargeCurrent:
case HorizonOCConfigValue_OverwriteRefreshRate: case HorizonOCConfigValue_OverwriteRefreshRate:
case HorizonOCConfigValue_EnableUnsafeDisplayFreqs: case HorizonOCConfigValue_EnableUnsafeDisplayFreqs:
return 0ULL; return 0ULL;
case HocClkConfigValue_EristaMaxCpuClock: case HocClkConfigValue_EristaMaxCpuClock:
return 1785ULL; return 1785ULL;
case HocClkConfigValue_EristaMaxGpuClock:
return 921ULL;
case HocClkConfigValue_EristaMaxMemClock:
return 1600ULL;
case HocClkConfigValue_MarikoMaxCpuClock: case HocClkConfigValue_MarikoMaxCpuClock:
return 1963ULL; return 1963ULL;
case HocClkConfigValue_MarikoMaxGpuClock:
return 1075ULL;
case HocClkConfigValue_MarikoMaxMemClock:
return 1862ULL;
case HocClkConfigValue_ThermalThrottle: case HocClkConfigValue_ThermalThrottle:
case HocClkConfigValue_HandheldTDP: case HocClkConfigValue_HandheldTDP:
case HocClkConfigValue_EnforceBoardLimit: case HocClkConfigValue_EnforceBoardLimit:
case HocClkConfigValue_KipEditing:
case HocClkConfigValue_FixCpuVoltBug: case HocClkConfigValue_FixCpuVoltBug:
case HocClkConfigValue_IsFirstLoad:
return 1ULL; return 1ULL;
case HocClkConfigValue_ThermalThrottleThreshold: case HocClkConfigValue_ThermalThrottleThreshold:
return 70ULL; return 70ULL;
case HocClkConfigValue_HandheldTDPLimit: case HocClkConfigValue_HandheldTDPLimit:
return 8600ULL; return 9600ULL; // 8600mW will trigger on erista stock, so raise it a bit
case HocClkConfigValue_LiteTDPLimit: case HocClkConfigValue_LiteTDPLimit:
return 6400ULL; return 6400ULL; // 0.5C
default: default:
return 0ULL; return 0ULL;
} }
@@ -448,11 +423,7 @@ static inline uint64_t sysclkValidConfigValue(SysClkConfigValue val, uint64_t in
switch(val) switch(val)
{ {
case HocClkConfigValue_EristaMaxCpuClock: case HocClkConfigValue_EristaMaxCpuClock:
case HocClkConfigValue_EristaMaxGpuClock:
case HocClkConfigValue_EristaMaxMemClock:
case HocClkConfigValue_MarikoMaxCpuClock: case HocClkConfigValue_MarikoMaxCpuClock:
case HocClkConfigValue_MarikoMaxGpuClock:
case HocClkConfigValue_MarikoMaxMemClock:
case HocClkConfigValue_ThermalThrottleThreshold: case HocClkConfigValue_ThermalThrottleThreshold:
case HocClkConfigValue_HandheldTDPLimit: case HocClkConfigValue_HandheldTDPLimit:
case HocClkConfigValue_LiteTDPLimit: case HocClkConfigValue_LiteTDPLimit:
@@ -468,11 +439,10 @@ static inline uint64_t sysclkValidConfigValue(SysClkConfigValue val, uint64_t in
case HocClkConfigValue_ThermalThrottle: case HocClkConfigValue_ThermalThrottle:
case HocClkConfigValue_HandheldTDP: case HocClkConfigValue_HandheldTDP:
case HocClkConfigValue_EnforceBoardLimit: case HocClkConfigValue_EnforceBoardLimit:
case HocClkConfigValue_KipEditing:
case HocClkConfigValue_KipFileName:
case HorizonOCConfigValue_OverwriteRefreshRate: case HorizonOCConfigValue_OverwriteRefreshRate:
case HocClkConfigValue_FixCpuVoltBug: case HocClkConfigValue_FixCpuVoltBug:
case HorizonOCConfigValue_EnableUnsafeDisplayFreqs: case HorizonOCConfigValue_EnableUnsafeDisplayFreqs:
case HocClkConfigValue_IsFirstLoad:
return (input & 0x1) == input; return (input & 0x1) == input;
case KipConfigValue_custRev: case KipConfigValue_custRev:
@@ -564,6 +534,7 @@ static inline uint64_t sysclkValidConfigValue(SysClkConfigValue val, uint64_t in
case KipConfigValue_g_volt_e_1075200: case KipConfigValue_g_volt_e_1075200:
case KipConfigValue_eristaCpuVmin: case KipConfigValue_eristaCpuVmin:
case KipConfigValue_eristaCpuUnlock: case KipConfigValue_eristaCpuUnlock:
case KipCrc32:
return true; return true;
case HorizonOCConfigValue_BatteryChargeCurrent: case HorizonOCConfigValue_BatteryChargeCurrent:
return ((input >= 1024) && (input <= 3072)) || !input; return ((input >= 1024) && (input <= 3072)) || !input;

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@@ -31,8 +31,8 @@
#include "board.h" #include "board.h"
#include "clock_manager.h" #include "clock_manager.h"
#define SYSCLK_IPC_API_VERSION 4 #define SYSCLK_IPC_API_VERSION 1
#define SYSCLK_IPC_SERVICE_NAME "sys:clk" #define SYSCLK_IPC_SERVICE_NAME "hoc:clk"
enum SysClkIpcCmd enum SysClkIpcCmd
{ {

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -39,7 +39,7 @@ include ${TOPDIR}/lib/libultrahand/ultrahand.mk
# version control constants # version control constants
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
#TARGET_VERSION := $(shell git describe --dirty --always --tags) #TARGET_VERSION := $(shell git describe --dirty --always --tags)
APP_VERSION := 0.31 APP_VERSION := 0.33
TARGET_VERSION := $(APP_VERSION) TARGET_VERSION := $(APP_VERSION)
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@@ -137,9 +137,9 @@ void FreqChoiceGui::listUI()
this->configList->values[HocClkConfigValue_EristaMaxCpuClock] < mhz) this->configList->values[HocClkConfigValue_EristaMaxCpuClock] < mhz)
continue; continue;
if (moduleName == "gpu" && // if (moduleName == "gpu" &&
this->configList->values[HocClkConfigValue_EristaMaxGpuClock] < mhz) // this->configList->values[HocClkConfigValue_EristaMaxGpuClock] < mhz)
continue; // continue;
// if (moduleName == "mem" && // if (moduleName == "mem" &&
// this->configList->values[HocClkConfigValue_EristaMaxMemClock] < mhz) // this->configList->values[HocClkConfigValue_EristaMaxMemClock] < mhz)

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,6 +1,6 @@
/* /*
* *
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@@ -460,7 +460,7 @@ protected:
addConfigToggle(KipConfigValue_hpMode, "HP Mode"); addConfigToggle(KipConfigValue_hpMode, "HP Mode");
std::vector<NamedValue> marikoMaxEmcClock = { std::vector<NamedValue> marikoMaxEmcClock = {
NamedValue("1600MHz", 1600000), NamedValue("1600MHz (JEDEC.)", 1600000),
NamedValue("1633MHz", 1633000), NamedValue("1633MHz", 1633000),
NamedValue("1666MHz", 1666000), NamedValue("1666MHz", 1666000),
NamedValue("1700MHz", 1700000), NamedValue("1700MHz", 1700000),
@@ -468,17 +468,16 @@ protected:
NamedValue("1766MHz", 1766000), NamedValue("1766MHz", 1766000),
NamedValue("1800MHz", 1800000), NamedValue("1800MHz", 1800000),
NamedValue("1833MHz", 1833000), NamedValue("1833MHz", 1833000),
NamedValue("1862MHz", 1862400), NamedValue("1866MHz (JEDEC.)", 1866000),
NamedValue("1866MHz", 1866000),
NamedValue("1900MHz", 1900000), NamedValue("1900MHz", 1900000),
NamedValue("1933MHz", 1933000), NamedValue("1933MHz", 1933000),
NamedValue("1966MHz", 1966000), NamedValue("1966MHz", 1966000),
NamedValue("1996MHz", 1996800), NamedValue("1996MHz (JEDEC.)", 1996800),
NamedValue("2000MHz", 2000000), NamedValue("2000MHz", 2000000),
NamedValue("2033MHz", 2033000), NamedValue("2033MHz", 2033000),
NamedValue("2066MHz", 2066000), NamedValue("2066MHz", 2066000),
NamedValue("2100MHz", 2100000), NamedValue("2100MHz", 2100000),
NamedValue("2133MHz", 2133000), NamedValue("2133MHz (JEDEC.)", 2133000),
NamedValue("2166MHz", 2166000), NamedValue("2166MHz", 2166000),
NamedValue("2200MHz", 2200000), NamedValue("2200MHz", 2200000),
NamedValue("2233MHz", 2233000), NamedValue("2233MHz", 2233000),
@@ -486,7 +485,7 @@ protected:
NamedValue("2300MHz", 2300000), NamedValue("2300MHz", 2300000),
NamedValue("2333MHz", 2333000), NamedValue("2333MHz", 2333000),
NamedValue("2366MHz", 2366000), NamedValue("2366MHz", 2366000),
NamedValue("2400MHz", 2400000), NamedValue("2400MHz (JEDEC.)", 2400000),
NamedValue("2433MHz", 2433000), NamedValue("2433MHz", 2433000),
NamedValue("2466MHz", 2466000), NamedValue("2466MHz", 2466000),
NamedValue("2500MHz", 2500000), NamedValue("2500MHz", 2500000),
@@ -502,7 +501,7 @@ protected:
NamedValue("2833MHz", 2833000), NamedValue("2833MHz", 2833000),
NamedValue("2866MHz", 2866000), NamedValue("2866MHz", 2866000),
NamedValue("2900MHz", 2900000), NamedValue("2900MHz", 2900000),
NamedValue("2933MHz", 2933000), NamedValue("2933MHz (JEDEC.)", 2933000),
NamedValue("2966MHz", 2966000), NamedValue("2966MHz", 2966000),
NamedValue("3000MHz", 3000000), NamedValue("3000MHz", 3000000),
NamedValue("3033MHz", 3033000), NamedValue("3033MHz", 3033000),
@@ -510,20 +509,20 @@ protected:
NamedValue("3100MHz", 3100000), NamedValue("3100MHz", 3100000),
NamedValue("3133MHz", 3133000), NamedValue("3133MHz", 3133000),
NamedValue("3166MHz", 3166000), NamedValue("3166MHz", 3166000),
NamedValue("3200MHz", 3200000), NamedValue("3200MHz (JEDEC.)", 3200000),
NamedValue("3233MHz (Needs high Speedo/PLL)", 3233000), // NamedValue("3233MHz (Needs high Speedo/PLL)", 3233000),
NamedValue("3266MHz (Needs high Speedo/PLL)", 3266000), // NamedValue("3266MHz (Needs high Speedo/PLL)", 3266000),
NamedValue("3300MHz (Needs high Speedo/PLL)", 3300000), // NamedValue("3300MHz (Needs high Speedo/PLL)", 3300000),
NamedValue("3333MHz (Needs extreme Speedo/PLL)", 3333000), // NamedValue("3333MHz (Needs extreme Speedo/PLL)", 3333000),
NamedValue("3366MHz (Needs extreme Speedo/PLL)", 3366000), // NamedValue("3366MHz (Needs extreme Speedo/PLL)", 3366000),
NamedValue("3400MHz (Needs extreme Speedo/PLL)", 3400000), // NamedValue("3400MHz (Needs extreme Speedo/PLL)", 3400000),
NamedValue("3433MHz (Needs ridiculous Speedo/PLL)", 3433000), // NamedValue("3433MHz (Needs ridiculous Speedo/PLL)", 3433000),
NamedValue("3466MHz (Needs ridiculous Speedo/PLL)", 3466000), // NamedValue("3466MHz (Needs ridiculous Speedo/PLL)", 3466000),
NamedValue("3500MHz (Needs ridiculous Speedo/PLL)", 3500000), // NamedValue("3500MHz (Needs ridiculous Speedo/PLL)", 3500000),
}; };
std::vector<NamedValue> eristaMaxEmcClock = { std::vector<NamedValue> eristaMaxEmcClock = {
NamedValue("1600MHz", 1600000), NamedValue("1600MHz (JEDEC.)", 1600000),
NamedValue("1633MHz", 1633000), NamedValue("1633MHz", 1633000),
NamedValue("1666MHz", 1666000), NamedValue("1666MHz", 1666000),
NamedValue("1700MHz", 1700000), NamedValue("1700MHz", 1700000),
@@ -531,7 +530,7 @@ protected:
NamedValue("1766MHz", 1766000), NamedValue("1766MHz", 1766000),
NamedValue("1800MHz", 1800000), NamedValue("1800MHz", 1800000),
NamedValue("1833MHz", 1833000), NamedValue("1833MHz", 1833000),
NamedValue("1866MHz", 1866000), NamedValue("1866MHz (JEDEC.)", 1866000),
NamedValue("1900MHz", 1900000), NamedValue("1900MHz", 1900000),
NamedValue("1933MHz", 1933000), NamedValue("1933MHz", 1933000),
NamedValue("1966MHz", 1966000), NamedValue("1966MHz", 1966000),
@@ -539,7 +538,7 @@ protected:
NamedValue("2033MHz", 2033000), NamedValue("2033MHz", 2033000),
NamedValue("2066MHz", 2066000), NamedValue("2066MHz", 2066000),
NamedValue("2100MHz", 2100000), NamedValue("2100MHz", 2100000),
NamedValue("2133MHz", 2133000), NamedValue("2133MHz (JEDEC.)", 2133000),
NamedValue("2166MHz", 2166000), NamedValue("2166MHz", 2166000),
NamedValue("2200MHz (high power draw!)", 2200000), NamedValue("2200MHz (high power draw!)", 2200000),
NamedValue("2233MHz (high power draw!)", 2233000), NamedValue("2233MHz (high power draw!)", 2233000),
@@ -547,7 +546,7 @@ protected:
NamedValue("2300MHz (high power draw!)", 2300000), NamedValue("2300MHz (high power draw!)", 2300000),
NamedValue("2333MHz (high power draw!)", 2333000), NamedValue("2333MHz (high power draw!)", 2333000),
NamedValue("2366MHz (high power draw!)", 2366000), NamedValue("2366MHz (high power draw!)", 2366000),
NamedValue("2400MHz (high power draw!)", 2400000), NamedValue("2400MHz (high power draw & JEDEC.)", 2400000),
}; };
if(IsErista()) { if(IsErista()) {
@@ -1054,6 +1053,13 @@ public:
protected: protected:
void listUI() override { void listUI() override {
Result rc = sysclkIpcGetConfigValues(this->configList); // populate config list early otherwise wont work
if (R_FAILED(rc)) [[unlikely]] {
FatalGui::openWithResultCode("sysclkIpcGetConfigValues", rc);
return;
}
this->listElement->addItem(new tsl::elm::CategoryHeader("GPU Custom Table (mV)")); this->listElement->addItem(new tsl::elm::CategoryHeader("GPU Custom Table (mV)"));
ValueThresholds MgpuVmaxThresholds(800, 850); ValueThresholds MgpuVmaxThresholds(800, 850);
@@ -1209,16 +1215,20 @@ protected:
addConfigButton(KipConfigValue_g_volt_921600, "921.6MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts, false); addConfigButton(KipConfigValue_g_volt_921600, "921.6MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts, false);
addConfigButton(KipConfigValue_g_volt_998400, "998.4MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts, false); addConfigButton(KipConfigValue_g_volt_998400, "998.4MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts, false);
addConfigButton(KipConfigValue_g_volt_1075200, "1075.2MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts, false); addConfigButton(KipConfigValue_g_volt_1075200, "1075.2MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts, false);
addConfigButton(KipConfigValue_g_volt_1152000, "1152.0MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts, false); if(this->configList->values[KipConfigValue_marikoGpuUV] >= GPUUVLevel_SLT)
addConfigButton(KipConfigValue_g_volt_1228800, "1228.8MHz (SLT/HiOPT Only)", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts, false); addConfigButton(KipConfigValue_g_volt_1152000, "1152.0MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts, false);
addConfigButton(KipConfigValue_g_volt_1267200, "1267.2MHz (HiOPT Only)", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts, false); if(this->configList->values[KipConfigValue_marikoGpuUV] >= GPUUVLevel_HiOPT) {
addConfigButton(KipConfigValue_g_volt_1305600, "1305.6MHz (HiOPT Only)", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts, false); addConfigButton(KipConfigValue_g_volt_1228800, "1228.8MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts, false);
addConfigButton(KipConfigValue_g_volt_1344000, "1344.0MHz (HiOPT Only)", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts_noAuto, false); addConfigButton(KipConfigValue_g_volt_1267200, "1267.2MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts, false);
addConfigButton(KipConfigValue_g_volt_1382400, "1382.4MHz (HiOPT Only)", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts_noAuto, false); addConfigButton(KipConfigValue_g_volt_1305600, "1305.6MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts, false);
addConfigButton(KipConfigValue_g_volt_1420800, "1420.8MHz (HiOPT Only)", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts_noAuto, false); addConfigButton(KipConfigValue_g_volt_1344000, "1344.0MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts_noAuto, false);
addConfigButton(KipConfigValue_g_volt_1459200, "1459.2MHz (HiOPT Only)", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts_noAuto, false); addConfigButton(KipConfigValue_g_volt_1382400, "1382.4MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts_noAuto, false);
addConfigButton(KipConfigValue_g_volt_1497600, "1497.6MHz (HiOPT Only)", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts_noAuto, false); addConfigButton(KipConfigValue_g_volt_1420800, "1420.8MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts_noAuto, false);
addConfigButton(KipConfigValue_g_volt_1536000, "1536.0MHz (HiOPT Only)", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts_noAuto, false); addConfigButton(KipConfigValue_g_volt_1459200, "1459.2MHz)", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts_noAuto, false);
addConfigButton(KipConfigValue_g_volt_1497600, "1497.6MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts_noAuto, false);
addConfigButton(KipConfigValue_g_volt_1536000, "1536.0MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &MgpuVmaxThresholds, {}, mGpuVolts_noAuto, false);
}
} else { } else {
tsl::elm::CustomDrawer* warningText = new tsl::elm::CustomDrawer([](tsl::gfx::Renderer *renderer, s32 x, s32 y, s32 w, s32 h) { tsl::elm::CustomDrawer* warningText = new tsl::elm::CustomDrawer([](tsl::gfx::Renderer *renderer, s32 x, s32 y, s32 w, s32 h) {
@@ -1254,10 +1264,13 @@ protected:
addConfigButton(KipConfigValue_g_volt_e_844800, "844.8MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &EgpuVmaxThresholds, {}, eGpuVolts, false); addConfigButton(KipConfigValue_g_volt_e_844800, "844.8MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &EgpuVmaxThresholds, {}, eGpuVolts, false);
addConfigButton(KipConfigValue_g_volt_e_883200, "883.2MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &EgpuVmaxThresholds, {}, eGpuVolts, false); addConfigButton(KipConfigValue_g_volt_e_883200, "883.2MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &EgpuVmaxThresholds, {}, eGpuVolts, false);
addConfigButton(KipConfigValue_g_volt_e_921600, "921.6MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &EgpuVmaxThresholds, {}, eGpuVolts, false); addConfigButton(KipConfigValue_g_volt_e_921600, "921.6MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &EgpuVmaxThresholds, {}, eGpuVolts, false);
addConfigButton(KipConfigValue_g_volt_e_960000, "960.0MHz (SLT/HiOPT Only)", ValueRange(0, 0, 0, "0", 1), "Voltage", &EgpuVmaxThresholds, {}, eGpuVolts, false); if(this->configList->values[KipConfigValue_eristaGpuUV] >= GPUUVLevel_SLT)
addConfigButton(KipConfigValue_g_volt_e_998400, "998.4MHz (HiOPT Only)", ValueRange(0, 0, 0, "0", 1), "Voltage", &EgpuVmaxThresholds, {}, eGpuVolts, false); addConfigButton(KipConfigValue_g_volt_e_960000, "960.0MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &EgpuVmaxThresholds, {}, eGpuVolts, false);
addConfigButton(KipConfigValue_g_volt_e_1036800, "1036.8MHz (HiOPT Only)", ValueRange(0, 0, 0, "0", 1), "Voltage", &EgpuVmaxThresholds, {}, eGpuVolts_noAuto, false); if(this->configList->values[KipConfigValue_eristaGpuUV] >= GPUUVLevel_HiOPT) {
addConfigButton(KipConfigValue_g_volt_e_1075200, "1075.2MHz (HiOPT Only)", ValueRange(0, 0, 0, "0", 1), "Voltage", &EgpuVmaxThresholds, {}, eGpuVolts_noAuto, false); addConfigButton(KipConfigValue_g_volt_e_998400, "998.4MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &EgpuVmaxThresholds, {}, eGpuVolts, false);
addConfigButton(KipConfigValue_g_volt_e_1036800, "1036.8MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &EgpuVmaxThresholds, {}, eGpuVolts_noAuto, false);
addConfigButton(KipConfigValue_g_volt_e_1075200, "1075.2MHz", ValueRange(0, 0, 0, "0", 1), "Voltage", &EgpuVmaxThresholds, {}, eGpuVolts_noAuto, false);
}
} }
} }
}; };

View File

@@ -1,7 +1,7 @@
/* /*
* *
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,7 +1,7 @@
/* /*
* *
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,7 +1,7 @@
/* /*
* *
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
{ {
"name": "sys:clk", "name": "hoc:clk",
"title_id": "0x00FF0000636C6BFF", "title_id": "0x00FF0000636C6BFF",
"title_id_range_min": "0x00FF0000636C6BFF", "title_id_range_min": "0x00FF0000636C6BFF",
"title_id_range_max": "0x00FF0000636C6BFF", "title_id_range_max": "0x00FF0000636C6BFF",
@@ -18,7 +18,7 @@
"*" "*"
], ],
"service_host": [ "service_host": [
"sys:clk" "hoc:clk"
], ],
"kernel_capabilities": [ "kernel_capabilities": [
{ {

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@@ -766,7 +766,7 @@ std::uint32_t Board::GetPartLoad(SysClkPartLoad loadSource)
return idletick0; return idletick0;
case HocClkPartLoad_BAT: case HocClkPartLoad_BAT:
batteryInfoGetChargeInfo(&info); batteryInfoGetChargeInfo(&info);
return info.BatteryAge; return info.RawBatteryCharge;
case HocClkPartLoad_FAN: case HocClkPartLoad_FAN:
return fanLevel; return fanLevel;
default: default:

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@@ -38,6 +38,7 @@
#include <display_refresh_rate.h> #include <display_refresh_rate.h>
#include <cstring> #include <cstring>
#include <cstdio> #include <cstdio>
#include <crc32.h>
#define HOSPPC_HAS_BOOST (hosversionAtLeast(7,0,0)) #define HOSPPC_HAS_BOOST (hosversionAtLeast(7,0,0))
bool isGovernorEnabled = false; // to avoid thread messes bool isGovernorEnabled = false; // to avoid thread messes
@@ -46,7 +47,6 @@ bool hasChanged = true;
ClockManager *ClockManager::instance = NULL; ClockManager *ClockManager::instance = NULL;
Thread governorTHREAD; Thread governorTHREAD;
u32 initialConfigValues[SysClkConfigValue_EnumMax]; // initial config. used for safety checks u32 initialConfigValues[SysClkConfigValue_EnumMax]; // initial config. used for safety checks
bool writeBootConfigValues = true; // do we write the initial config values?
bool kipAvailable = false; bool kipAvailable = false;
ClockManager *ClockManager::GetInstance() ClockManager *ClockManager::GetInstance()
@@ -118,7 +118,7 @@ void ClockManager::FixCpuBug() {
u32 maxHz = 0; u32 maxHz = 0;
u32 nearestHz = 0; u32 nearestHz = 0;
ResetToStockClocks(); // ResetToStockClocks();
targetHz = this->context->overrideFreqs[SysClkModule_CPU]; targetHz = this->context->overrideFreqs[SysClkModule_CPU];
if (!targetHz) { if (!targetHz) {
@@ -133,10 +133,11 @@ void ClockManager::FixCpuBug() {
while ((nearestHz = this->GetNearestHz(SysClkModule_CPU, targetHz, maxHz)) != targetHz) { while ((nearestHz = this->GetNearestHz(SysClkModule_CPU, targetHz, maxHz)) != targetHz) {
Board::SetHz(SysClkModule_CPU, 1020000000); Board::SetHz(SysClkModule_CPU, 1020000000);
svcSleepThread(2'500'000); svcSleepThread(1'000'000);
Board::SetHz(SysClkModule_CPU, nearestHz); Board::SetHz(SysClkModule_CPU, maxHz);
this->context->freqs[SysClkModule_CPU] = nearestHz; this->context->freqs[SysClkModule_CPU] = maxHz;
} }
Board::SetHz(SysClkModule_CPU, targetHz);
} }
} }
@@ -181,7 +182,7 @@ bool ClockManager::IsAssignableHz(SysClkModule module, std::uint32_t hz)
switch (module) switch (module)
{ {
case SysClkModule_CPU: case SysClkModule_CPU:
return hz >= 400000000; return hz >= 500000000;
case SysClkModule_MEM: case SysClkModule_MEM:
return hz >= 665600000; return hz >= 665600000;
default: default:
@@ -212,7 +213,14 @@ std::uint32_t ClockManager::GetMaxAllowedHz(SysClkModule module, SysClkProfile p
} }
else if (profile <= SysClkProfile_HandheldChargingUSB) else if (profile <= SysClkProfile_HandheldChargingUSB)
{ {
return 768000000; switch(Board::GetSocType()) {
case SysClkSocType_Erista:
return 768000000;
case SysClkSocType_Mariko:
return 921600000;
default:
return 4294967294;
}
} }
} }
} }
@@ -416,12 +424,12 @@ void ClockManager::Tick()
if(this->config->GetConfigValue(HocClkConfigValue_HandheldTDP) && opMode == AppletOperationMode_Handheld) { if(this->config->GetConfigValue(HocClkConfigValue_HandheldTDP) && opMode == AppletOperationMode_Handheld) {
if(Board::GetConsoleType() == HorizonOCConsoleType_Hoag) { if(Board::GetConsoleType() == HorizonOCConsoleType_Hoag) {
if(Board::GetPowerMw(SysClkPowerSensor_Now) < -(int)this->config->GetConfigValue(HocClkConfigValue_LiteTDPLimit)) { if(Board::GetPowerMw(SysClkPowerSensor_Avg) < -(int)this->config->GetConfigValue(HocClkConfigValue_LiteTDPLimit)) {
ResetToStockClocks(); ResetToStockClocks();
return; return;
} }
} else { } else {
if(Board::GetPowerMw(SysClkPowerSensor_Now) < -(int)this->config->GetConfigValue(HocClkConfigValue_HandheldTDPLimit)) { if(Board::GetPowerMw(SysClkPowerSensor_Avg) < -(int)this->config->GetConfigValue(HocClkConfigValue_HandheldTDPLimit)) {
ResetToStockClocks(); ResetToStockClocks();
return; return;
} }
@@ -678,10 +686,7 @@ bool ClockManager::RefreshContext()
FileUtils::WriteContextToCsv(this->context); FileUtils::WriteContextToCsv(this->context);
} }
if(this->context->profile == SysClkProfile_Docked && Board::GetConsoleType() != HorizonOCConsoleType_Hoag) this->context->maxDisplayFreq = Board::GetHighestDockedDisplayRate();
this->context->maxDisplayFreq = Board::GetHighestDockedDisplayRate();
else
this->context->maxDisplayFreq = 60;
u32 targetHz = this->context->overrideFreqs[HorizonOCModule_Display]; u32 targetHz = this->context->overrideFreqs[HorizonOCModule_Display];
if (!targetHz) if (!targetHz)
@@ -789,6 +794,18 @@ void ClockManager::SetKipData() {
FileUtils::LogLine("[clock_manager] Failed to write KIP file"); FileUtils::LogLine("[clock_manager] Failed to write KIP file");
writeNotification("Horizon OC\nKip write failed"); writeNotification("Horizon OC\nKip write failed");
} }
SysClkConfigValueList configValues;
this->config->GetConfigValues(&configValues);
configValues.values[KipCrc32] = (u64)checksum_file("sdmc:/atmosphere/kips/hoc.kip"); // write checksum
if (this->config->SetConfigValues(&configValues, false)) {
FileUtils::LogLine("[clock_manager] Successfully loaded KIP data into config");
} else {
FileUtils::LogLine("[clock_manager] Warning: Failed to set config values from KIP");
writeNotification("Horizon OC\nKip config set failed");
}
} }
// I know this is very hacky, but the config system in the sysmodule doesn't really support writing // I know this is very hacky, but the config system in the sysmodule doesn't really support writing
@@ -808,6 +825,8 @@ void ClockManager::GetKipData() {
fclose(fp); fclose(fp);
} }
SysClkConfigValueList configValues; SysClkConfigValueList configValues;
this->config->GetConfigValues(&configValues); this->config->GetConfigValues(&configValues);
@@ -819,6 +838,20 @@ void ClockManager::GetKipData() {
return; return;
} }
if((u64)checksum_file("sdmc:/atmosphere/kips/hoc.kip") != this->config->GetConfigValue(KipCrc32) && !this->config->GetConfigValue(HocClkConfigValue_IsFirstLoad)) {
SetKipData();
writeNotification("Horizon OC\nKIP has been updated");
writeNotification("Horizon OC\nPlease reboot your console");
writeNotification("Horizon OC\nto complete the update");
return;
}
if(this->config->GetConfigValue(HocClkConfigValue_IsFirstLoad) == true) {
configValues.values[HocClkConfigValue_IsFirstLoad] = (u64)false;
writeNotification("Horizon OC has been installed");
}
static bool writeBootConfigValues = true;
if(writeBootConfigValues) { if(writeBootConfigValues) {
writeBootConfigValues = false; writeBootConfigValues = false;
@@ -865,14 +898,6 @@ void ClockManager::GetKipData() {
initialConfigValues[KipConfigValue_marikoGpuVmax] = cust_get_mariko_gpu_vmax(&table); initialConfigValues[KipConfigValue_marikoGpuVmax] = cust_get_mariko_gpu_vmax(&table);
initialConfigValues[KipConfigValue_commonGpuVoltOffset] = cust_get_common_gpu_offset(&table); initialConfigValues[KipConfigValue_commonGpuVoltOffset] = cust_get_common_gpu_offset(&table);
initialConfigValues[KipConfigValue_gpuSpeedo] = cust_get_gpu_speedo(&table); initialConfigValues[KipConfigValue_gpuSpeedo] = cust_get_gpu_speedo(&table);
for (int i = 0; i < 24; i++) {
initialConfigValues[KipConfigValue_g_volt_76800 + i] = cust_get_mariko_gpu_volt(&table, i);
}
for (int i = 0; i < 27; i++) {
initialConfigValues[KipConfigValue_g_volt_e_76800 + i] = cust_get_erista_gpu_volt(&table, i);
}
} }
configValues.values[KipConfigValue_mtcConf] = cust_get_mtc_conf(&table); configValues.values[KipConfigValue_mtcConf] = cust_get_mtc_conf(&table);
@@ -921,10 +946,12 @@ void ClockManager::GetKipData() {
for (int i = 0; i < 24; i++) { for (int i = 0; i < 24; i++) {
configValues.values[KipConfigValue_g_volt_76800 + i] = cust_get_mariko_gpu_volt(&table, i); configValues.values[KipConfigValue_g_volt_76800 + i] = cust_get_mariko_gpu_volt(&table, i);
initialConfigValues[KipConfigValue_g_volt_76800 + i] = cust_get_mariko_gpu_volt(&table, i);
} }
for (int i = 0; i < 27; i++) { for (int i = 0; i < 27; i++) {
configValues.values[KipConfigValue_g_volt_e_76800 + i] = cust_get_erista_gpu_volt(&table, i); configValues.values[KipConfigValue_g_volt_e_76800 + i] = cust_get_erista_gpu_volt(&table, i);
initialConfigValues[KipConfigValue_g_volt_e_76800 + i] = cust_get_erista_gpu_volt(&table, i);
} }
// if(cust_get_cust_rev(&table) == KIP_CUST_REV) // if(cust_get_cust_rev(&table) == KIP_CUST_REV)
@@ -948,44 +975,20 @@ void ClockManager::GetKipData() {
} }
void ClockManager::UpdateRamTimings() { void ClockManager::UpdateRamTimings() {
FILE* fp; u32 t1_tRCD = this->config->GetConfigValue(KipConfigValue_t1_tRCD);
fp = fopen("sdmc:/atmosphere/kips/hoc.kip", "r"); u32 t2_tRP = this->config->GetConfigValue(KipConfigValue_t2_tRP);
u32 t3_tRAS = this->config->GetConfigValue(KipConfigValue_t3_tRAS);
u32 t4_tRRD = this->config->GetConfigValue(KipConfigValue_t4_tRRD);
u32 t5_tRFC = this->config->GetConfigValue(KipConfigValue_t5_tRFC);
u32 t6_tRTW = this->config->GetConfigValue(KipConfigValue_t6_tRTW);
u32 t7_tWTR = this->config->GetConfigValue(KipConfigValue_t7_tWTR);
u32 t8_tREFI = this->config->GetConfigValue(KipConfigValue_t8_tREFI);
bool hpMode = (bool)this->config->GetConfigValue(KipConfigValue_hpMode);
if (fp == NULL) {
writeNotification("Horizon OC\nKip opening failed");
kipAvailable = false;
return;
} else {
kipAvailable = true;
fclose(fp);
}
CustomizeTable table;
if (!cust_read_and_cache("sdmc:/atmosphere/kips/hoc.kip", &table)) {
FileUtils::LogLine("[clock_manager] Failed to read KIP file for UpdateRamTimings");
writeNotification("Horizon OC\nKip read failed");
return;
}
// if(this->config->GetConfigValue(KipConfigValue_marikoEmcMaxClock) != initialConfigValues[KipConfigValue_marikoEmcMaxClock] ||
// this->config->GetConfigValue(KipConfigValue_mem_burst_read_latency) != initialConfigValues[KipConfigValue_mem_burst_read_latency] ||
// this->config->GetConfigValue(KipConfigValue_mem_burst_write_latency) != initialConfigValues[KipConfigValue_mem_burst_write_latency]
// ) {
// writeNotification("Horizon OC\nCritical values changed!\nUnable to write timings");
// return;
// }
u32 t1_tRCD = initialConfigValues[KipConfigValue_t1_tRCD];
u32 t2_tRP = initialConfigValues[KipConfigValue_t2_tRP];
u32 t3_tRAS = initialConfigValues[KipConfigValue_t3_tRAS];
u32 t4_tRRD = initialConfigValues[KipConfigValue_t4_tRRD];
u32 t5_tRFC = initialConfigValues[KipConfigValue_t5_tRFC];
u32 t6_tRTW = initialConfigValues[KipConfigValue_t6_tRTW];
u32 t7_tWTR = initialConfigValues[KipConfigValue_t7_tWTR];
u32 t8_tREFI = initialConfigValues[KipConfigValue_t8_tREFI];
u64 ramFreq = initialConfigValues[KipConfigValue_marikoEmcMaxClock]; u64 ramFreq = initialConfigValues[KipConfigValue_marikoEmcMaxClock];
u32 rlAdd = initialConfigValues[KipConfigValue_mem_burst_read_latency]; u32 rlAdd = initialConfigValues[KipConfigValue_mem_burst_read_latency];
u32 wlAdd = initialConfigValues[KipConfigValue_mem_burst_write_latency]; u32 wlAdd = initialConfigValues[KipConfigValue_mem_burst_write_latency];
bool hpMode = (bool)initialConfigValues[KipConfigValue_hpMode];
Board::UpdateShadowRegs(t1_tRCD, t2_tRP, t3_tRAS, t4_tRRD, t5_tRFC, t6_tRTW, t7_tWTR, t8_tREFI, ramFreq, rlAdd, wlAdd, hpMode); Board::UpdateShadowRegs(t1_tRCD, t2_tRP, t3_tRAS, t4_tRRD, t5_tRFC, t6_tRTW, t7_tWTR, t8_tREFI, ramFreq, rlAdd, wlAdd, hpMode);
} }
@@ -1016,7 +1019,7 @@ unsigned int ClockManager::GetGpuVoltage (unsigned int freq, int speedo)
int bracket = GetSpeedoBracket(speedo); int bracket = GetSpeedoBracket(speedo);
if (freq < 1601) if (freq < 1601)
return 0; return 610;
loop = 0; loop = 0;
do do

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) Souldbminer and Horizon OC Contributors * Copyright (c) Souldbminer, Lightos_ and Horizon OC Contributors
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,

View File

@@ -1,6 +1,6 @@
@echo off @echo off
set ROOT=build set ROOT=build
set PATCHES=Atmosphere-Patches set PATCHES=Source/Atmosphere-Patches
copy "%PATCHES%\secmon_memory_layout.hpp" "%ROOT%\libraries\libexosphere/include/exosphere/secmon/" /Y copy "%PATCHES%\secmon_memory_layout.hpp" "%ROOT%\libraries\libexosphere/include/exosphere/secmon/" /Y
copy "%PATCHES%\secmon_emc_access_table_data.inc" "%ROOT%\exosphere/program/source/smc/" /Y copy "%PATCHES%\secmon_emc_access_table_data.inc" "%ROOT%\exosphere/program/source/smc/" /Y
copy "%PATCHES%\secmon_soctherm_access_table_data.inc" "%ROOT%\exosphere/program/source/smc/" /Y copy "%PATCHES%\secmon_soctherm_access_table_data.inc" "%ROOT%\exosphere/program/source/smc/" /Y

View File

@@ -1,52 +0,0 @@
@echo off
setlocal
if not exist dist mkdir dist
set SRC=Source\Atmosphere\stratosphere\loader\source\oc
set DEST=build\stratosphere\loader\source\oc
if not exist dist\atmosphere\kips mkdir dist\atmosphere\kips
if not exist %DEST% mkdir %DEST%
xcopy /E /I /Y "%SRC%\*" "%DEST%\"
cd build\stratosphere\loader || exit /b 1
make -j %NUMBER_OF_PROCESSORS%
hactool -t kip1 out\nintendo_nx_arm64_armv8a\release\loader.kip --uncompress=hoc.kip
cd ..\..\..\
if not exist dist\atmosphere\kips mkdir dist\atmosphere\kips
copy /Y build\stratosphere\loader\hoc.kip dist\atmosphere\kips\hoc.kip
cd Source\sys-clk
if not exist dist mkdir dist
build.bat
xcopy /E /I /Y dist\* ..\..\dist\
cd ..\..
cd Source\Horizon-OC-Monitor
make -j %NUMBER_OF_PROCESSORS%
if not exist ..\..\dist\switch\.overlays mkdir ..\..\dist\switch\.overlays
copy /Y Horizon-OC-Monitor.ovl ..\..\dist\switch\.overlays\Horizon-OC-Monitor.ovl
cd ..\..
set ROOT=build
set PATCHES=Atmosphere-Patches
copy "%PATCHES%\secmon_memory_layout.hpp" "%ROOT%\libraries\libexosphere/include/exosphere/secmon/" /Y
copy "%PATCHES%\secmon_emc_access_table_data.inc" "%ROOT%\exosphere/program/source/smc/" /Y
copy "%PATCHES%\secmon_soctherm_access_table_data.inc" "%ROOT%\exosphere/program/source/smc/" /Y
copy "%PATCHES%\secmon_define_emc_access_table.inc" "%ROOT%\exosphere/program/source/smc/" /Y
copy "%PATCHES%\secmon_define_soctherm_access_table.inc" "%ROOT%\exosphere/program/source/smc/" /Y
copy "%PATCHES%\secmon_smc_register_access.cpp" "%ROOT%\exosphere/program/source/smc/" /Y
cd build\exosphere
make -j %NUMBER_OF_PROCESSORS%
cd out\nintendo_nx_arm64_armv8a\release
if not exist ..\..\..\..\..\dist mkdir ..\..\..\..\..\dist
copy /Y exosphere.bin ..\..\..\..\..\dist\secmon_emc_patch.bin
endlocal

Binary file not shown.

Binary file not shown.

View File

@@ -1,129 +0,0 @@
# Copyright 2023 hanai3Bi
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
# This program is distributed in the hope it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import math
gpu_dvfs_table_0 = [
[ 610000, 0 , 0 , 0 , 0 , 0 ],
[ 610000, 0 , 0 , 0 , 0 , 0 ],
[ 610000, 0 , 0 , 0 , 0 , 0 ],
[ 610000, 0 , 0 , 0 , 0 , 0 ],
[ 610000, 0 , 0 , 0 , 0 , 0 ],
[ 610000, 0 , 0 , 0 , 0 , 0 ],
[ 801688, -10900, -163, 298, -10599, 162 ],
[ 824214, -5743, -452, 238, -6325, 81 ],
[ 848830, -3903, -552, 119, -4030, -2 ],
[ 891575, -4409, -584, 0, -2849, 39 ],
[ 940071, -5367, -602, -60, -63, -93 ],
[ 986765, -6637, -614, -179, 1905, -13 ],
[ 1098475, -13529, -497, -179, 3626, 9 ],
[ 1163644, -12688, -648, 0, 1077, 40 ],
[ 1204812, -9908, -830, 0, 1469, 110 ],
[ 1277303, -11675, -859, 0, 3722, 313 ],
[ 1335531, -12567, -867, 0, 3681, 559 ]
]
gpu_dvfs_table_1 = [
[ 590000, 0 , 0 , 0 , 0 , 0 ],
[ 590000, 0 , 0 , 0 , 0 , 0 ],
[ 590000, 0 , 0 , 0 , 0 , 0 ],
[ 590000, 0 , 0 , 0 , 0 , 0 ],
[ 590000, 0 , 0 , 0 , 0 , 0 ],
[ 795089, -11096, -163, 298, -10421, 162 ],
[ 795089, -11096, -163, 298, -10421, 162 ],
[ 820606, -6285, -452, 238, -6182, 81 ],
[ 846289, -4565, -552, 119, -3958, -2 ],
[ 888720, -5110, -584, 0, -2849, 39 ],
[ 936634, -6089, -602, -60, -99, -93 ],
[ 982562, -7373, -614, -179, 1797, -13 ],
[ 1090179, -14125, -497, -179, 3518, 9 ],
[ 1155798, -13465, -648, 0, 1077, 40 ],
[ 1198568, -10904, -830, 0, 1469, 110 ],
[ 1269988, -12707, -859, 0, 3722, 313 ],
[ 1308155, -13694, -867, 0, 3681, 559 ]
]
gpu_dvfs_table_2 = [
[ 590000, 0 , 0 , 0 , 0 , 0 ],
[ 590000, 0 , 0 , 0 , 0 , 0 ],
[ 590000, 0 , 0 , 0 , 0 , 0 ],
[ 590000, 0 , 0 , 0 , 0 , 0 ],
[ 590000, 0 , 0 , 0 , 0 , 0 ],
[ 590000, 0 , 0 , 0 , 0 , 0 ],
[ 590000, 0 , 0 , 0 , 0 , 0 ],
[ 590000, 0 , 0 , 0 , 0 , 0 ],
[ 838712, -7304, -552, 119, -3750, -2 ],
[ 880210, -7955, -584, 0, -2849, 39 ],
[ 926398, -8892, -602, -60, -384, -93 ],
[ 970060, -10108, -614, -179, 1508, -13 ],
[ 1065665, -16075, -497, -179, 3213, 9 ],
[ 1132576, -16093, -648, 0, 1077, 40 ],
[ 1180029, -14534, -830, 0, 1469, 110 ],
[ 1248293, -16383, -859, 0, 3722, 313 ],
[ 1286399, -17475, -867, 0, 3681, 559 ]
]
gpu_freq_table = [76800, 153600, 230400, 307200, 384000, 460800, 537600, 614400, 691200, 768000, 844800, 921600, 998400, 1075200, 1152000, 1228800, 1267200]
temp_list = [20, 30, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90]
def round_closest(value, scale):
if (value > 0):
return (((value) + ((scale) / 2)) / (scale))
else:
return (((value) - ((scale) / 2)) / (scale))
def round5(number):
return int(math.ceil(number / 5.0)) * 5
speedo = int(input("Enter gpu speedo: "))
table = int(input("Enter gpu table (0~2): "))
if (table == 0):
gpu_dvfs_table = gpu_dvfs_table_0
elif (table == 1):
gpu_dvfs_table = gpu_dvfs_table_1
else:
gpu_dvfs_table = gpu_dvfs_table_2
offset = int(input("Enter gpu offset: "))
for i in range(17):
gpu_dvfs_table[i][0] -= offset*1000
print("\t\t", end="")
for temp in temp_list:
print(temp, "°C\t", end="")
print()
for entry in range(17):
print(float(gpu_freq_table[entry]/1000),end="")
print("\t\t", end="")
mv = round_closest(gpu_dvfs_table[entry][2] * speedo , 100)
mv = round_closest( (mv + gpu_dvfs_table[entry][1]) * speedo , 100) + gpu_dvfs_table[entry][0]
#mv = round5(mv/1000)
for temp in temp_list:
mvt = round_closest(gpu_dvfs_table[entry][3] * speedo , 100) + gpu_dvfs_table[entry][4] + round_closest(gpu_dvfs_table[entry][5] * temp , 10)
mvt = round_closest(mvt * temp , 10)
#mvt = round5(mvt/1000)
final_volt = math.ceil ((mv + mvt) / 1000)
vmin = 610 if table == 0 else 590
final_volt = max(final_volt, vmin)
final_volt = round5(final_volt)
print(final_volt, "\t", end="")
print()
#input("Press enter to exit")

272
guide.md
View File

@@ -1,272 +0,0 @@
# Mariko OC Guide
*Made with love by Dominatorul. Some parts of this guide belong to ChanseyIsTheBest and Lightos_*
---
## Table of Contents
- [Safety Disclaimer](#safety-disclaimer)
- [Mariko Limits](#mariko-limits)
- [Monitoring Your Switch](#monitoring-your-switch)
- [Checking Speedo and RAM Type](#checking-speedo-and-ram-type)
- [RAM Tiers](#ram-tiers-higher-is-better)
- [OC Settings for Horizon OCE](#oc-settings-for-hoc)
- [CPU Settings](#cpu-settings)
- [GPU Settings](#gpu-settings)
- [RAM Settings](#ram-settings)
- [Clock Settings](#clock-settings)
- [Mariko Max Safe on Battery](#mariko-max-safe-on-battery-hac-001-01-heg-001)
- [Switch Lite Max Safe Clocks on Battery](#switch-lite-max-safe-clocks-on-battery-hdh-001)
- [Mariko Max Clocks Docked and Plugged](#mariko-max-clocks-docked-and-plugged-hac-001-01-heg-001)
- [Switch Lite Max Clocks Plugged](#switch-lite-max-clocks-plugged-hdh-001)
- [Troubleshooting](#troubleshooting)
- [How to test stability](https://rentry.co/howtoteststability)
---
# Safety Disclaimer
!!! info ** Overclocking is inherently risky as it pushes the system beyond its original design. The risk level depends on how much you overclock and whether you stay within the limits of the chip and hardware.**
!!! danger **Unstable RAM overclocking can cause SYSNAND/EMUNAND corruption and SD card corruption, particularly if done on SYSNAND. Test the overclock settings on EMUNAND and back it up before installing Horizon OC.**
---
# Mariko Limits
### Mariko PMIC Limits
- Mariko uses a **5A CPU / 10A GPU PMIC** for power delivery.
- Staying within these limits is essential for safe operation.
- Exceeding the **PMIC limit** slightly is possible, but not recommended and should be done with caution.
Reducing the voltage (**undervolting, UV**) decreases power draw, current, heat and helps avoid exceeding pmic limit.
### Charger IC Limit:
- 18W limit restricts overclocking for both Erista and Mariko units (12W on Switch Lite). This is the main limiting factor, but the PMIC current limits for CPU and GPU will be reached first.
### GPU Scheduling
This setting adjusts how much of your GPU can be utilized:
- **On:** Limits GPU usage to ~96.7%
- **Off:** Limits GPU usage to ~99.7% (up to ~5% performance boost)
- **Recommended:** GPU scheduling **off**.
!!! danger ** Warning:** Disabling GPU Scheduling will slightly increase power draw. Use it with caution.
---
# Monitoring Your Switch
- Use status monitor overlay to indicate if you've bypassed the charger IC limit (e.g., -1W displayed while charging).
- To get the best results, be sure your battery is 10-90% to display the real charging
---
# Checking Speedo and RAM Type
1. Boot Hekate.
2. Go to Console Info > HW & Fuses.
3. Note your DRAM ID, CPU Speedo 0, CPU Speedo 2, and SoC Speedo.
- Speedos typically range from 1450 to 1810. A higher speedo means less voltage is needed for the same clock speed. A speedo of 1650 is generally considered good.
**Speedo Brackets**
> - Speedos are divided into **brackets**.
> - **CPU UV mode** depends on the position within your bracket, but the resulting **voltage** depends on your specific speedo.
> - It doesnt matter how high you can set CPU UV mode — what matters is using your **maximum possible** CPU UV mode.
---
# RAM Tiers (Higher is better)
| Tier | RAM ID |
|-------------|------------------|
| GOD-tier | NEI/NEE, WT:B |
| S-tier | WT:F |
| A-tier | AA-MGCR, AA-MGCL |
| B-tier | AM-MGCJ, WT:E |
| C-tier | AB-MGCL |
| D-tier | NME |
---
# OC Settings for Horizon OC
## CPU Setting
- **Voltage Limit:**
- **1120 mV:** Safe — recommended
- **1160 mV:** Use with caution
- **1235 mV:** Dangerous. Only use if you know what you are doing
- **Boost Clock**
- Whatever is within **Voltage Limit**.
- **Undervolt Mode:** 16 (start with 2).
- Increase gradually if stable and find your highest stable value.
- If the console fails to boot, lower the value.
- **Vmin:** 590 mV
- In case you experience issues with low Freq UV, try raising Low Freq Vmin to 610-620mV.
- Going below 590mV is not recommended as it may mess up the cpu table.
> ** Note:** Exceeding the PMIC limit during **Boost Mode** is safe, as it only occurs for short bursts (typically under 30 seconds), preventing long-term hardware stress.
## GPU Settings
- **Undervolt Mode:** 2
- **Auto VMIN:**
- When RAM is overclocked, the minimum gpu voltage requirement is raised.
- Auto vmin automatically adjusts your vmin based on your ram clock.
- When using the base ram clocks (1600 MHz), **Auto VMIN** is not active
- **2 (Hijack method):** Recommended — provides the lowest value possible.
- **1 (Official service method):** Use only if you encounter issues with mode 2.
- **Auto VMIN Offset:** Auto
- **Vmin:** 550620 mV
- Typically not worth adjusting, as you should always use max RAM.
- **Vmax:** 800 mV
- **Voltage Offset:** 0
## RAM Settings
- **DRAM Timing:**
- **0 — AUTO_ADJ:** Auto-adjust MTC table with LPDDR4 3733 Mbps specs, 16Gb density. Change timing with Advanced Config (Default).
- **1 — AUTO_ADJ_HP:** Same as AUTO_ADJ, but with RAM power-down disabled.
> ** Tip:** AUTO_ADJ_HP improves latency, but some RAM modules may not handle it well.
> - First, find your max RAM clocks and timings with **AUTO_ADJ**.
> - Then test AUTO_ADJ_HP. If stable, use it — otherwise, stick to AUTO_ADJ.
- **DVB Shift:** 15
- Boosts SoC voltage to help stabilize RAM, especially at high frequencies (2400 MHz+).
- It's adviced to start of with a DVB shift of 4 and only lower it to 2-3 after finding your max ram speed.
- Higher DVB shift does not increase power draw, but it is going to increase heat slightly.
- Undervolting DVB is pointless.
### RAM Configuration Based on Tier List
| Tier | RAM ID | Ram Clock | VDD2 | VDDQ | Common Timings | Super Tight (ST) Timings |
|------|-----------------|------------|--------|-------|--------------------------|----------------------------|
| GOD | NEI/NEE/x267 | 2900-3500 | 1175 mV| 640 mV| (3-3-2) 2-5-5-4-6 | (4-4-4) 3-7-6-5-6 |
| GOD | WT:B | 2700-3200 | 1175 mV| 600 mV| (4-4-5) 5-2-6-5-6 | (6-6-7) 7-2-6-5-6 |
| S | AA-MGCL/MGCR | 23003100 | 1175 mV| 640 mV| (4-4-5) 5-5-6-7-6 | (4-4-8) 6-5-7-8-6 |
| S | WT:F | 25002800 | 1175 mV| 600 mV| (4-4-2) 5-4-6-3-6 | (5-5-4) 5-5-6-5-6 |
| A | AM-MGCJ | 25002866 | 1175 mV| 640 mV| (3-2-4) 2-4-4-4-6 | (4-3-8) 2-5-4-4-6 |
| A | WT:E | 2300-2800 | 1175 mV| 600 mV| (2-2-2) 2-4-4-4-6 | (3-5-3) 3-5-4-5-6 |
| B | NME | 2600-2800 | 1175 mV| 640 mV| (2-2-1) 0-1-4-3-6 | (3-3-4) 0-1-4-4-6 |
| C | AB-MGCL | 21332500 | 1175 mV| 640 mV| (4-4-4) 4-4-5-6-6 | (4-4-8) 5-5-6-8-6 |
### RAM Tuning Notes
> **💡 Extra Headroom:** For an additional 66100 MHz, try **1212.5 mV**. This can also help with tighter timings.
> ### Manufacturers Safe Limit
> - **1175 mV** is the absolute safe value guaranteed by the manufacturer.
> - Above this level, nothing is guaranteed—silicon quality may vary.
> - No damage from overvolting has been reported, but proceed at your own risk.
> - Undervolting RAM is pointless, at least **1175 mV** should be used.
> **🧪 Testing Method:**
> 1. Set **DVB = 4** using the standard preset.
> 2. Test with **ST (Super Tight)** timings.
> * If ST timings are **unstable**,try **common timings** or **relax** them gradually in the following order:
> `t5 → t4 → t7 → t6 → t3 → t2 → t1 → t8`
> * If ST timings are **stable**, **push beyond ST** for maximum performance by tightening parameters in this order:
> `t8 → t1 → t2 → t3 → t6 → t7 → t4 → t5`
> **⚡ Performance:** ST timings provide enhanced performance over common timings.
> **⚠️ Stability Notes:**
> - Lower **T5** or **T6** if you encounter issues.
> - RAM contributes the most to overall performance — prioritize finding your maximum frequency first.
> - Rarely, some modules may fail even with common timings. If so, lower timings until stable.
## Fine Tuning (GPU)
This section is optional but recommended as it may lower voltages further.
- **Voltage Offset:** 520
- The UV2 table by default is very tight but it is slightly loose in some cases.
- Voltage Offset can be used to tighten it further.
- Test with 5, 10, 15 or 20 when using UV2.
- Some GPUs may require **0** for stability.
- With very rare speedo bracket positions, higher UV offsets may work, test carefully.
- **Auto VMIN Offset:**
- Auto at first, lower it as much as possible once you find your maximum ram frequency.
- Test **Auto VMIN Offset** stability at a medium frequency (``998 MHz`` for instance), otherwise the GPU voltage may dominate over the **Auto VMIN** voltage.
- This helps improving battery in handheld mode with high RAM OC.
- It's possible to add positive offset, but this shouldn't be used unless you have issues.
# Clock Settings (Safe)
### Mariko Max Safe on Battery [HAC-001(-01), HEG-001]
*Switch units available from August 2019 and beyond, includes OLED & requires modchip*
- **CPU:** 1963 MHz
- **GPU:** 998 MHz
- **RAM:** 2133 MHz 2500+ MHz (use whatever is stable; 2400 MHz recommended for best battery life-to-performance ratio)
!!! warning ** Note:** Drawing over 8.6W on battery will cause battery issues. Please avoid doing that for extended periods!
### Switch Lite Max Safe Clocks on Battery [HDH-001]
- **CPU:** 1785 MHz
- **GPU:** 921 MHz
- **RAM:** 2133 MHz 2500+ MHz (use whatever is stable; 2400 MHz recommended for best battery life-to-performance ratio)
!!! warning ** Note:** Drawing over 6.5W on battery will cause battery issues. Please avoid doing that for extended periods!
!!! note Switch Lite limits are lower due to the 12W board power limit, but counts as Mariko for all other purposes.
### Mariko Max Clocks Docked and Plugged [HAC-001(-01), HEG-001]
*Switch units available from
August 2019 and beyond, includes OLED & requires modchip*
- **CPU:**
- 2397 MHz: Safe to use.
- 2500 MHz: May exceed **PMIC limit**, use carefully.
- 2600 MHz: Exceeds pmic limit on most switches unless the voltage is kept low, around **1070 mV**.
> Determining truly safe voltages is difficult; we are only working with estimates.
> However, no damage has been reported from these recommendations.
- **GPU:**
- Sched **off**: 1228 MHz (safe with 1228 MHz voltage < 800 mV, otherwise use 1152 MHz)
- Sched **on**: 1267 MHz (safe with 1228 MHz voltage < 800 mV)
- 1228 MHz sched **off** outperforms 1267 MHz sched **on**, so it's recommended.
- **RAM:**
- 2133 MHz-3000 MHz+ (whatever is stable)
### Switch Lite Max Clocks Plugged [HDH-001]
- **CPU:**
- 2397 MHz: Safe to use.
- 2500 MHz: May exceed **PMIC limit**, use carefully.
- 2600 MHz: Exceeds pmic limit on most switches unless the voltage is kept low, around **1070 mV**.
> Determining truly safe voltages is difficult; we are only working with estimates.
> However, no damage has been reported from these recommendations.
- **GPU:**
- Sched **off**: 1228 MHz (safe with 1228 MHz voltage < 800 mV, otherwise use 1152 MHz)
- Sched **on**: 1267 MHz (safe with 1228 MHz voltage < 800 mV)
- 1228 MHz sched **off** outperforms 1267 MHz sched **on**, so it's recommended.
- **RAM:**
- 2133 MHz-2800 MHz+ (whatever is stable)
!!! note Switch Lite limits are lower due to the 12W board power limit, but counts as Mariko for all other purposes.
---
# Troubleshooting
**My Switch won't boot into EMUNAND after I have installed Horizon OC:**
- Your atmosphere version is likely not up-to-date, update your atmosphere version.
- CPU UV level is too high, lower it or set it to 0.
**My configs are not being applied:**
- Ensure you reboot your console after changing settings in Horizon OC.
**I can't set my clocks above 1785/921/1600:**
- Your kip is not being loaded, check if it is located in `/atmosphere/kips`
- Your hekate_ipl.ini file is not set up correctly:
- Validate that your boot entry contains `kip1=atmosphere/kips/*.kip`
- It has to be below `pkg3=atmosphere/package3` (or fss0)
# Need Help with Setup?
###Follow this [guide](https://rentry.co/howtoget60fps) for a step-by-step setup.

Some files were not shown because too many files have changed in this diff Show More