hocclk: better aotag
This commit is contained in:
@@ -30,7 +30,7 @@ namespace aotag {
|
||||
#define TEGRA_FUSE_CP_REV_0_3 (3)
|
||||
#define FUSE_CP_REV 0x90
|
||||
u64 fuseVa = 0;
|
||||
|
||||
bool wasInit = false;
|
||||
inline int tegra_fuse_readl(unsigned long base, u32* value) {
|
||||
*value = *reinterpret_cast<volatile u32*>(fuseVa + base);
|
||||
return 0;
|
||||
@@ -133,7 +133,6 @@ namespace aotag {
|
||||
svcCallSecureMonitor(&args);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -304,9 +303,13 @@ namespace aotag {
|
||||
set_bit(CFG_TAG_EN_POS, &r);
|
||||
clear_bit(CFG_DISABLE_CLK_POS, &r);
|
||||
tegra_pmc_writel(r, PMC_AOTAG_CFG);
|
||||
fileUtils::LogLine("[aotag] Init complete!");
|
||||
wasInit = true;
|
||||
}
|
||||
s32 getTemp()
|
||||
{
|
||||
if(!wasInit)
|
||||
return -125;
|
||||
u32 regval = 0, abs = 0, fraction = 0, valid = 0, sign = 0;
|
||||
s32 temp = 0;
|
||||
regval = tegra_pmc_readl(PMC_TSENSOR_STATUS1);
|
||||
@@ -323,4 +326,8 @@ namespace aotag {
|
||||
temp = (-1) * (temp);
|
||||
return temp;
|
||||
}
|
||||
|
||||
bool isInitialized() {
|
||||
return wasInit;
|
||||
}
|
||||
}
|
||||
@@ -224,4 +224,5 @@ namespace aotag {
|
||||
|
||||
void init(bool isMariko);
|
||||
s32 getTemp();
|
||||
bool isInitialized();
|
||||
}
|
||||
@@ -55,6 +55,8 @@ namespace board {
|
||||
PwmChannelSession iCon;
|
||||
|
||||
u32 fd = 0, fd2 = 0;
|
||||
|
||||
#define PMC_BASE 0x7000E400
|
||||
|
||||
void FetchHardwareInfos() {
|
||||
ReadFuses(fuseData);
|
||||
@@ -140,7 +142,16 @@ namespace board {
|
||||
FetchHardwareInfos();
|
||||
|
||||
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;
|
||||
if (hosversionAtLeast(6,0,0) && R_SUCCEEDED(pwmInitialize())) {
|
||||
pwmCheck = pwmOpenSession2(&iCon, 0x3D000001);
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "../soctherm.hpp"
|
||||
#include "bq24193.hpp"
|
||||
#include "../aotag.hpp"
|
||||
|
||||
#include "../config.hpp"
|
||||
namespace board {
|
||||
|
||||
s32 GetTemperatureMilli(HocClkThermalSensor sensor) {
|
||||
@@ -50,8 +50,7 @@ namespace board {
|
||||
break;
|
||||
}
|
||||
case HocClkThermalSensor_PCB: {
|
||||
millis = aotag::getTemp();
|
||||
// = tmp451TempPcb();
|
||||
millis = tmp451TempPcb();
|
||||
break;
|
||||
}
|
||||
case HocClkThermalSensor_Skin: {
|
||||
@@ -80,7 +79,11 @@ namespace board {
|
||||
break;
|
||||
}
|
||||
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;
|
||||
}
|
||||
case HocClkThermalSensor_PLLX: {
|
||||
@@ -91,6 +94,10 @@ namespace board {
|
||||
millis = bq24193::getBQTemp();
|
||||
break;
|
||||
}
|
||||
case HocClkThermalSensor_AO: {
|
||||
millis = aotag::getTemp();
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
ASSERT_ENUM_VALID(HocClkThermalSensor, sensor);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,8 @@ namespace AulaDisplay {
|
||||
}
|
||||
|
||||
void SetDisplayColorMode(AulaColorMode mode) {
|
||||
if(mode == AulaDisplayColorMode_DoNotOverride)
|
||||
return;
|
||||
// send display command to change color mode.
|
||||
_display_dsi_send_cmd(MIPI_DSI_DCS_SHORT_WRITE_PARAM,
|
||||
MIPI_DCS_PRIV_SM_SET_COLOR_MODE | (mode << 8), 0);
|
||||
|
||||
Reference in New Issue
Block a user