Refactor tsensor

This commit is contained in:
Lightos1
2026-05-05 20:43:43 +02:00
parent 9cf901d487
commit 2e39421074
14 changed files with 488 additions and 584 deletions

View File

@@ -39,10 +39,10 @@
#include "board_load.hpp"
#include "board_volt.hpp"
#include "board_misc.hpp"
#include "../soctherm.hpp"
#include "../tsensor/soctherm.hpp"
#include "../tsensor/aotag.hpp"
#include "../integrations.hpp"
#include "../file_utils.hpp"
#include "../aotag.hpp"
namespace board {
u64 clkVirtAddr, dsiVirtAddr, apbVirtAddr;
@@ -55,7 +55,7 @@ namespace board {
PwmChannelSession iCon;
u32 fd = 0, fd2 = 0;
#define PMC_BASE 0x7000E400
void FetchHardwareInfos() {
@@ -141,7 +141,7 @@ namespace board {
batteryInfoInitialize();
FetchHardwareInfos();
soctherm::Initialize(); // SOCTHERM must be init before AOTAG
tsensor::InitializeSoctherm(); // SOCTHERM must be init before AOTAG
// PMC exosphere check
SecmonArgs args = {};
args.X[0] = 0xF0000002;
@@ -149,7 +149,7 @@ namespace board {
svcCallSecureMonitor(&args);
if (args.X[1] != PMC_BASE) { // if param 1 is identical read failed
aotag::init(GetSocType() == HocClkSocType_Mariko);
tsensor::InitializeAotag(GetSocType() == HocClkSocType_Mariko);
}
Result pwmCheck = 1;
@@ -164,7 +164,7 @@ namespace board {
rc = QueryMemoryMapping(&dsiVirtAddr, 0x54300000, 0x40000);
ASSERT_RESULT_OK(rc, "QueryMemoryMapping (dsi)");
rc = QueryMemoryMapping(&apbVirtAddr, 0x70000000, 0x1000);
ASSERT_RESULT_OK(rc, "QueryMemoryMapping (apb)");

View File

@@ -31,18 +31,19 @@
#include <battery.h>
#include <pwm.h>
#include "board.hpp"
#include "../soctherm.hpp"
#include "../tsensor/soctherm.hpp"
#include "../tsensor/aotag.hpp"
#include "bq24193.hpp"
#include "../aotag.hpp"
#include "../config.hpp"
namespace board {
s32 GetTemperatureMilli(HocClkThermalSensor sensor) {
s32 millis = 0;
BatteryChargeInfo info;
soctherm::TSensorTemps temps = {};
soctherm::ReadSensors(temps);
tsensor::TSensorTemps temps = {};
tsensor::ReadTSensors(temps);
switch(sensor) {
case HocClkThermalSensor_SOC: {
@@ -79,8 +80,8 @@ namespace board {
break;
}
case HocClkThermalSensor_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;
if (board::GetSocType() == HocClkSocType_Mariko && tsensor::IsInitialized() && tsensor::ReadAotag() > 0) {
millis = (temps.gpu * 0.45f) + (temps.pllx * 0.30f) + (temps.cpu * 0.15f) + (tsensor::ReadAotag() * 0.10f) + 3000;
} else {
millis = board::GetSocType() == HocClkSocType_Mariko ? temps.pllx : temps.mem;
}
@@ -95,7 +96,7 @@ namespace board {
break;
}
case HocClkThermalSensor_AO: {
millis = aotag::getTemp();
millis = tsensor::ReadAotag();
break;
}
default: {