hocclk: better aotag
This commit is contained in:
@@ -92,6 +92,7 @@ typedef enum
|
|||||||
HocClkThermalSensor_GPU, // GPU temperature in millicelcius
|
HocClkThermalSensor_GPU, // GPU temperature in millicelcius
|
||||||
HocClkThermalSensor_MEM, // MEM temperature in millicelcius. Returns the PLLX sensor value on Mariko
|
HocClkThermalSensor_MEM, // MEM temperature in millicelcius. Returns the PLLX sensor value on Mariko
|
||||||
HocClkThermalSensor_PLLX, // PLLX temperature in millicelcius
|
HocClkThermalSensor_PLLX, // PLLX temperature in millicelcius
|
||||||
|
HocClkThermalSensor_AO, // AOTAG
|
||||||
HocClkThermalSensor_BQ24193, // BQ24193 temperature. Refer to BQ24193Temp for returned values
|
HocClkThermalSensor_BQ24193, // BQ24193 temperature. Refer to BQ24193Temp for returned values
|
||||||
HocClkThermalSensor_EnumMax
|
HocClkThermalSensor_EnumMax
|
||||||
} HocClkThermalSensor;
|
} HocClkThermalSensor;
|
||||||
@@ -184,6 +185,7 @@ typedef enum {
|
|||||||
BQ24193Temp_EnumMax
|
BQ24193Temp_EnumMax
|
||||||
} BQ24193Temp;
|
} BQ24193Temp;
|
||||||
typedef enum AulaColorMode {
|
typedef enum AulaColorMode {
|
||||||
|
AulaDisplayColorMode_DoNotOverride = 0xFF,
|
||||||
AulaDisplayColorMode_Saturated = 0x0,
|
AulaDisplayColorMode_Saturated = 0x0,
|
||||||
AulaDisplayColorMode_Washed = 0x45,
|
AulaDisplayColorMode_Washed = 0x45,
|
||||||
AulaDisplayColorMode_Basic = 0x03, // Default
|
AulaDisplayColorMode_Basic = 0x03, // Default
|
||||||
@@ -281,6 +283,10 @@ static inline const char* hocclkFormatThermalSensor(HocClkThermalSensor thermSen
|
|||||||
return pretty ? "MEM" : "mem";
|
return pretty ? "MEM" : "mem";
|
||||||
case HocClkThermalSensor_PLLX:
|
case HocClkThermalSensor_PLLX:
|
||||||
return pretty ? "PLLX" : "pllx";
|
return pretty ? "PLLX" : "pllx";
|
||||||
|
case HocClkThermalSensor_AO:
|
||||||
|
return pretty ? "AO" : "ao";
|
||||||
|
case HocClkThermalSensor_BQ24193:
|
||||||
|
return pretty ? "BQ24193" : "bq24193";
|
||||||
default:
|
default:
|
||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ typedef struct
|
|||||||
u16 resolutionHeight;
|
u16 resolutionHeight;
|
||||||
|
|
||||||
// Reserved for future use
|
// Reserved for future use
|
||||||
u8 reserved[0x424];
|
u8 reserved[0x41C];
|
||||||
} HocClkContext;
|
} HocClkContext;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|||||||
@@ -529,7 +529,7 @@ static inline uint64_t hocclkDefaultConfigValue(HocClkConfigValue val)
|
|||||||
case HocClkConfigValue_DisplayVoltage:
|
case HocClkConfigValue_DisplayVoltage:
|
||||||
return 1200ULL; // Auto
|
return 1200ULL; // Auto
|
||||||
case HocClkConfigValue_AulaDisplayColorPreset:
|
case HocClkConfigValue_AulaDisplayColorPreset:
|
||||||
return AulaDisplayColorMode_Basic;
|
return AulaDisplayColorMode_DoNotOverride;
|
||||||
default:
|
default:
|
||||||
return 0ULL;
|
return 0ULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ tsl::elm::ListItem* ramBWItemCpu = NULL;
|
|||||||
tsl::elm::ListItem* ramBWItemGpu = NULL;
|
tsl::elm::ListItem* ramBWItemGpu = NULL;
|
||||||
tsl::elm::ListItem* ramBWItemMax = NULL;
|
tsl::elm::ListItem* ramBWItemMax = NULL;
|
||||||
tsl::elm::ListItem* bqtempitem = NULL;
|
tsl::elm::ListItem* bqtempitem = NULL;
|
||||||
|
tsl::elm::ListItem* aotagTempItem = NULL;
|
||||||
|
|
||||||
ImageElement* CatImage = NULL;
|
ImageElement* CatImage = NULL;
|
||||||
HideableCategoryHeader* CatHeader = NULL;
|
HideableCategoryHeader* CatHeader = NULL;
|
||||||
@@ -74,6 +75,10 @@ void AboutGui::listUI()
|
|||||||
this->listElement->addItem(eristaPLLXItem);
|
this->listElement->addItem(eristaPLLXItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aotagTempItem =
|
||||||
|
new tsl::elm::ListItem("AOTAG Temp:");
|
||||||
|
this->listElement->addItem(aotagTempItem);
|
||||||
|
|
||||||
bqtempitem =
|
bqtempitem =
|
||||||
new tsl::elm::ListItem("BQ24193 Temp:");
|
new tsl::elm::ListItem("BQ24193 Temp:");
|
||||||
this->listElement->addItem(bqtempitem);
|
this->listElement->addItem(bqtempitem);
|
||||||
@@ -369,6 +374,14 @@ void AboutGui::refresh()
|
|||||||
eristaPLLXItem->setValue(strings[3]);
|
eristaPLLXItem->setValue(strings[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 millis = context->temps[HocClkThermalSensor_AO];
|
||||||
|
if(millis > 0) {
|
||||||
|
sprintf(strings[11], "%u.%u °C", millis / 1000U, (millis % 1000U) / 100U);
|
||||||
|
} else {
|
||||||
|
sprintf(strings[11], "N/A");
|
||||||
|
}
|
||||||
|
aotagTempItem->setValue(strings[11]);
|
||||||
|
|
||||||
sprintf(strings[4], "%u.%u / %u mV", context->voltages[HocClkVoltage_EMCVDD2] / 1000U, (context->voltages[HocClkVoltage_EMCVDD2] % 1000U) / 100U, context->voltages[HocClkVoltage_EMCVDDQ] / 1000);
|
sprintf(strings[4], "%u.%u / %u mV", context->voltages[HocClkVoltage_EMCVDD2] / 1000U, (context->voltages[HocClkVoltage_EMCVDD2] % 1000U) / 100U, context->voltages[HocClkVoltage_EMCVDDQ] / 1000);
|
||||||
ramVoltItem->setValue(strings[4]);
|
ramVoltItem->setValue(strings[4]);
|
||||||
|
|
||||||
|
|||||||
@@ -589,6 +589,7 @@ protected:
|
|||||||
Result rc = hocclkIpcGetConfigValues(this->configList);
|
Result rc = hocclkIpcGetConfigValues(this->configList);
|
||||||
if (R_FAILED(rc)) [[unlikely]] { FatalGui::openWithResultCode("hocclkIpcGetConfigValues", rc); return; }
|
if (R_FAILED(rc)) [[unlikely]] { FatalGui::openWithResultCode("hocclkIpcGetConfigValues", rc); return; }
|
||||||
this->listElement->addItem(new tsl::elm::CategoryHeader("General Settings"));
|
this->listElement->addItem(new tsl::elm::CategoryHeader("General Settings"));
|
||||||
|
|
||||||
ValueThresholds thresholdsDisabled(0, 0);
|
ValueThresholds thresholdsDisabled(0, 0);
|
||||||
std::vector<NamedValue> ramVoltDispModes = {
|
std::vector<NamedValue> ramVoltDispModes = {
|
||||||
NamedValue("VDD2", RamDisplayMode_VDD2),
|
NamedValue("VDD2", RamDisplayMode_VDD2),
|
||||||
@@ -743,6 +744,32 @@ protected:
|
|||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if(IsAula()) {
|
||||||
|
std::vector<NamedValue> displayClrPreset = {
|
||||||
|
NamedValue("Do Not Override", AulaDisplayColorMode_DoNotOverride),
|
||||||
|
NamedValue("Basic", AulaDisplayColorMode_Basic),
|
||||||
|
NamedValue("Saturated", AulaDisplayColorMode_Saturated),
|
||||||
|
NamedValue("Washed", AulaDisplayColorMode_Washed),
|
||||||
|
NamedValue("Natural", AulaDisplayColorMode_Natural),
|
||||||
|
NamedValue("Vivid", AulaDisplayColorMode_Vivid),
|
||||||
|
NamedValue("Washed", AulaDisplayColorMode_Night0, "Night"),
|
||||||
|
NamedValue("Basic", AulaDisplayColorMode_Night1, "Night"),
|
||||||
|
NamedValue("Natural", AulaDisplayColorMode_Night2, "Night"),
|
||||||
|
NamedValue("Vivid", AulaDisplayColorMode_Night3, "Night"),
|
||||||
|
};
|
||||||
|
|
||||||
|
addConfigButton(
|
||||||
|
HocClkConfigValue_AulaDisplayColorPreset,
|
||||||
|
"Display Color Preset",
|
||||||
|
ValueRange(0, 1, 1, "", 0),
|
||||||
|
"Display Color Preset",
|
||||||
|
&thresholdsDisabled,
|
||||||
|
{},
|
||||||
|
displayClrPreset,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -831,32 +858,6 @@ protected:
|
|||||||
{},
|
{},
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
std::vector<NamedValue> displayClrPreset = {
|
|
||||||
NamedValue("Basic", AulaDisplayColorMode_Basic),
|
|
||||||
NamedValue("Saturated", AulaDisplayColorMode_Saturated),
|
|
||||||
NamedValue("Washed", AulaDisplayColorMode_Washed),
|
|
||||||
NamedValue("Natural", AulaDisplayColorMode_Natural),
|
|
||||||
NamedValue("Vivid", AulaDisplayColorMode_Vivid),
|
|
||||||
NamedValue("Washed", AulaDisplayColorMode_Night0, "Night"),
|
|
||||||
NamedValue("Basic", AulaDisplayColorMode_Night1, "Night"),
|
|
||||||
NamedValue("Natural", AulaDisplayColorMode_Night2, "Night"),
|
|
||||||
NamedValue("Vivid", AulaDisplayColorMode_Night3, "Night"),
|
|
||||||
};
|
|
||||||
|
|
||||||
addConfigButton(
|
|
||||||
HocClkConfigValue_AulaDisplayColorPreset,
|
|
||||||
"Display Color Preset",
|
|
||||||
ValueRange(0, 1, 1, "", 0),
|
|
||||||
"Display Color Preset",
|
|
||||||
&thresholdsDisabled,
|
|
||||||
{},
|
|
||||||
displayClrPreset,
|
|
||||||
false,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace aotag {
|
|||||||
#define TEGRA_FUSE_CP_REV_0_3 (3)
|
#define TEGRA_FUSE_CP_REV_0_3 (3)
|
||||||
#define FUSE_CP_REV 0x90
|
#define FUSE_CP_REV 0x90
|
||||||
u64 fuseVa = 0;
|
u64 fuseVa = 0;
|
||||||
|
bool wasInit = false;
|
||||||
inline int tegra_fuse_readl(unsigned long base, u32* value) {
|
inline int tegra_fuse_readl(unsigned long base, u32* value) {
|
||||||
*value = *reinterpret_cast<volatile u32*>(fuseVa + base);
|
*value = *reinterpret_cast<volatile u32*>(fuseVa + base);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -133,7 +133,6 @@ namespace aotag {
|
|||||||
svcCallSecureMonitor(&args);
|
svcCallSecureMonitor(&args);
|
||||||
|
|
||||||
if (args.X[1] == (PMC_BASE + offset)) { // if param 1 is identical read failed
|
if (args.X[1] == (PMC_BASE + offset)) { // if param 1 is identical read failed
|
||||||
notification::writeNotification("Horizon OC\nCannot read AOTAG\nExosphere patch not applied!");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,9 +303,13 @@ namespace aotag {
|
|||||||
set_bit(CFG_TAG_EN_POS, &r);
|
set_bit(CFG_TAG_EN_POS, &r);
|
||||||
clear_bit(CFG_DISABLE_CLK_POS, &r);
|
clear_bit(CFG_DISABLE_CLK_POS, &r);
|
||||||
tegra_pmc_writel(r, PMC_AOTAG_CFG);
|
tegra_pmc_writel(r, PMC_AOTAG_CFG);
|
||||||
|
fileUtils::LogLine("[aotag] Init complete!");
|
||||||
|
wasInit = true;
|
||||||
}
|
}
|
||||||
s32 getTemp()
|
s32 getTemp()
|
||||||
{
|
{
|
||||||
|
if(!wasInit)
|
||||||
|
return -125;
|
||||||
u32 regval = 0, abs = 0, fraction = 0, valid = 0, sign = 0;
|
u32 regval = 0, abs = 0, fraction = 0, valid = 0, sign = 0;
|
||||||
s32 temp = 0;
|
s32 temp = 0;
|
||||||
regval = tegra_pmc_readl(PMC_TSENSOR_STATUS1);
|
regval = tegra_pmc_readl(PMC_TSENSOR_STATUS1);
|
||||||
@@ -323,4 +326,8 @@ namespace aotag {
|
|||||||
temp = (-1) * (temp);
|
temp = (-1) * (temp);
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isInitialized() {
|
||||||
|
return wasInit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -224,4 +224,5 @@ namespace aotag {
|
|||||||
|
|
||||||
void init(bool isMariko);
|
void init(bool isMariko);
|
||||||
s32 getTemp();
|
s32 getTemp();
|
||||||
|
bool isInitialized();
|
||||||
}
|
}
|
||||||
@@ -55,6 +55,8 @@ namespace board {
|
|||||||
PwmChannelSession iCon;
|
PwmChannelSession iCon;
|
||||||
|
|
||||||
u32 fd = 0, fd2 = 0;
|
u32 fd = 0, fd2 = 0;
|
||||||
|
|
||||||
|
#define PMC_BASE 0x7000E400
|
||||||
|
|
||||||
void FetchHardwareInfos() {
|
void FetchHardwareInfos() {
|
||||||
ReadFuses(fuseData);
|
ReadFuses(fuseData);
|
||||||
@@ -140,7 +142,16 @@ namespace board {
|
|||||||
FetchHardwareInfos();
|
FetchHardwareInfos();
|
||||||
|
|
||||||
soctherm::Initialize();
|
soctherm::Initialize();
|
||||||
aotag::init(GetSocType() == HocClkSocType_Mariko);
|
// PMC exosphere check
|
||||||
|
SecmonArgs args = {};
|
||||||
|
args.X[0] = 0xF0000002;
|
||||||
|
args.X[1] = PMC_BASE;
|
||||||
|
svcCallSecureMonitor(&args);
|
||||||
|
|
||||||
|
if (args.X[1] != PMC_BASE) { // if param 1 is identical read failed
|
||||||
|
aotag::init(GetSocType() == HocClkSocType_Mariko);
|
||||||
|
}
|
||||||
|
|
||||||
Result pwmCheck = 1;
|
Result pwmCheck = 1;
|
||||||
if (hosversionAtLeast(6,0,0) && R_SUCCEEDED(pwmInitialize())) {
|
if (hosversionAtLeast(6,0,0) && R_SUCCEEDED(pwmInitialize())) {
|
||||||
pwmCheck = pwmOpenSession2(&iCon, 0x3D000001);
|
pwmCheck = pwmOpenSession2(&iCon, 0x3D000001);
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
#include "../soctherm.hpp"
|
#include "../soctherm.hpp"
|
||||||
#include "bq24193.hpp"
|
#include "bq24193.hpp"
|
||||||
#include "../aotag.hpp"
|
#include "../aotag.hpp"
|
||||||
|
#include "../config.hpp"
|
||||||
namespace board {
|
namespace board {
|
||||||
|
|
||||||
s32 GetTemperatureMilli(HocClkThermalSensor sensor) {
|
s32 GetTemperatureMilli(HocClkThermalSensor sensor) {
|
||||||
@@ -50,8 +50,7 @@ namespace board {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case HocClkThermalSensor_PCB: {
|
case HocClkThermalSensor_PCB: {
|
||||||
millis = aotag::getTemp();
|
millis = tmp451TempPcb();
|
||||||
// = tmp451TempPcb();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case HocClkThermalSensor_Skin: {
|
case HocClkThermalSensor_Skin: {
|
||||||
@@ -80,7 +79,11 @@ namespace board {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case HocClkThermalSensor_MEM: {
|
case HocClkThermalSensor_MEM: {
|
||||||
millis = board::GetSocType() == HocClkSocType_Mariko ? temps.pllx : temps.mem;
|
if(board::GetSocType() == HocClkSocType_Mariko && aotag::isInitialized() && aotag::getTemp() > 0) {
|
||||||
|
millis = (temps.gpu * 0.45f) + (temps.pllx * 0.30f) + (temps.cpu * 0.15f) + (aotag::getTemp() * 0.10f) + 3000;
|
||||||
|
} else {
|
||||||
|
millis = board::GetSocType() == HocClkSocType_Mariko ? temps.pllx : temps.mem;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case HocClkThermalSensor_PLLX: {
|
case HocClkThermalSensor_PLLX: {
|
||||||
@@ -91,6 +94,10 @@ namespace board {
|
|||||||
millis = bq24193::getBQTemp();
|
millis = bq24193::getBQTemp();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case HocClkThermalSensor_AO: {
|
||||||
|
millis = aotag::getTemp();
|
||||||
|
break;
|
||||||
|
}
|
||||||
default: {
|
default: {
|
||||||
ASSERT_ENUM_VALID(HocClkThermalSensor, sensor);
|
ASSERT_ENUM_VALID(HocClkThermalSensor, sensor);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ namespace AulaDisplay {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SetDisplayColorMode(AulaColorMode mode) {
|
void SetDisplayColorMode(AulaColorMode mode) {
|
||||||
|
if(mode == AulaDisplayColorMode_DoNotOverride)
|
||||||
|
return;
|
||||||
// send display command to change color mode.
|
// send display command to change color mode.
|
||||||
_display_dsi_send_cmd(MIPI_DSI_DCS_SHORT_WRITE_PARAM,
|
_display_dsi_send_cmd(MIPI_DSI_DCS_SHORT_WRITE_PARAM,
|
||||||
MIPI_DCS_PRIV_SM_SET_COLOR_MODE | (mode << 8), 0);
|
MIPI_DCS_PRIV_SM_SET_COLOR_MODE | (mode << 8), 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user