hocclk: read voltage from i2c instead of rgltr
This commit is contained in:
@@ -22,13 +22,12 @@
|
||||
#include <memmem.h>
|
||||
#include <registers.h>
|
||||
#include <cstring>
|
||||
#include <rgltr.h>
|
||||
#include <battery.h>
|
||||
#include "board.hpp"
|
||||
#include "board_freq.hpp"
|
||||
#include "board_volt.hpp"
|
||||
#include "../file/file_utils.hpp"
|
||||
|
||||
#include "../i2c/i2cDrv.h"
|
||||
namespace board {
|
||||
|
||||
GpuVoltData voltData = {};
|
||||
@@ -215,59 +214,39 @@ namespace board {
|
||||
} PowerDomainId;
|
||||
*/
|
||||
u32 GetVoltage(HocClkVoltage voltage) {
|
||||
RgltrSession session;
|
||||
Result rc = 0;
|
||||
u32 out = 0;
|
||||
BatteryChargeInfo info;
|
||||
|
||||
switch (voltage) {
|
||||
case HocClkVoltage_SOC:
|
||||
rc = rgltrOpenSession(&session, PcvPowerDomainId_Max77620_Sd0);
|
||||
ASSERT_RESULT_OK(rc, "rgltrOpenSession")
|
||||
rgltrGetVoltage(&session, &out);
|
||||
rgltrCloseSession(&session);
|
||||
out = I2c_BuckConverter_GetUvOut(&I2c_SOC);
|
||||
break;
|
||||
case HocClkVoltage_EMCVDD2:
|
||||
rc = rgltrOpenSession(&session, PcvPowerDomainId_Max77620_Sd1);
|
||||
ASSERT_RESULT_OK(rc, "rgltrOpenSession")
|
||||
rgltrGetVoltage(&session, &out);
|
||||
rgltrCloseSession(&session);
|
||||
out = I2c_BuckConverter_GetUvOut(&I2c_VDD2);
|
||||
break;
|
||||
case HocClkVoltage_CPU:
|
||||
if (GetSocType() == HocClkSocType_Mariko) {
|
||||
rc = rgltrOpenSession(&session, PcvPowerDomainId_Max77621_Cpu);
|
||||
if(GetSocType() == HocClkSocType_Mariko) {
|
||||
out = I2c_BuckConverter_GetUvOut(&I2c_Mariko_CPU);
|
||||
} else {
|
||||
rc = rgltrOpenSession(&session, PcvPowerDomainId_Max77812_Cpu);
|
||||
out = I2c_BuckConverter_GetUvOut(&I2c_Erista_CPU);
|
||||
}
|
||||
ASSERT_RESULT_OK(rc, "rgltrOpenSession")
|
||||
rgltrGetVoltage(&session, &out);
|
||||
rgltrCloseSession(&session);
|
||||
break;
|
||||
case HocClkVoltage_GPU:
|
||||
if (GetSocType() == HocClkSocType_Mariko) {
|
||||
rc = rgltrOpenSession(&session, PcvPowerDomainId_Max77621_Gpu);
|
||||
if(GetSocType() == HocClkSocType_Mariko) {
|
||||
out = I2c_BuckConverter_GetUvOut(&I2c_Mariko_GPU);
|
||||
} else {
|
||||
rc = rgltrOpenSession(&session, PcvPowerDomainId_Max77812_Gpu);
|
||||
}
|
||||
ASSERT_RESULT_OK(rc, "rgltrOpenSession")
|
||||
rgltrGetVoltage(&session, &out);
|
||||
rgltrCloseSession(&session);
|
||||
out = I2c_BuckConverter_GetUvOut(&I2c_Erista_GPU);
|
||||
}
|
||||
break;
|
||||
case HocClkVoltage_EMCVDDQ:
|
||||
if (GetSocType() == HocClkSocType_Mariko) {
|
||||
rc = rgltrOpenSession(&session, PcvPowerDomainId_Max77812_Dram);
|
||||
ASSERT_RESULT_OK(rc, "rgltrOpenSession")
|
||||
rgltrGetVoltage(&session, &out);
|
||||
rgltrCloseSession(&session);
|
||||
if(GetSocType() == HocClkSocType_Mariko) {
|
||||
out = I2c_BuckConverter_GetUvOut(&I2c_Mariko_DRAM_VDDQ);
|
||||
} else {
|
||||
out = GetVoltage(HocClkVoltage_EMCVDD2); // VDD2 and VDDQ are always connected to the same rail on Erista
|
||||
out = I2c_BuckConverter_GetUvOut(&I2c_VDD2);
|
||||
}
|
||||
break;
|
||||
case HocClkVoltage_Display:
|
||||
rc = rgltrOpenSession(&session, PcvPowerDomainId_Max77620_Ldo0);
|
||||
ASSERT_RESULT_OK(rc, "rgltrOpenSession")
|
||||
rgltrGetVoltage(&session, &out);
|
||||
rgltrCloseSession(&session);
|
||||
out = I2c_BuckConverter_GetUvOut(&I2c_Display);
|
||||
break;
|
||||
case HocClkVoltage_Battery:
|
||||
batteryInfoGetChargeInfo(&info);
|
||||
|
||||
Reference in New Issue
Block a user