boot: update for 13.0.0/aula parameter changes (closes #1477)

This commit is contained in:
Michael Scire 2021-10-15 19:03:11 -07:00
parent 990daec3a2
commit d1bc1a5c57
10 changed files with 96 additions and 68 deletions

View file

@ -53,8 +53,8 @@ namespace ams::boot {
return powctl::GetBatteryAverageVCell(out, s_battery_session);
}
Result GetOpenCircuitVoltage(int *out) {
return powctl::GetBatteryOpenCircuitVoltage(out, s_battery_session);
Result GetVoltageFuelGaugePercentage(float *out) {
return powctl::GetBatteryVoltageFuelGaugePercentage(out, s_battery_session);
}
Result GetAverageCurrent(int *out) {

View file

@ -110,8 +110,8 @@ namespace ams::boot {
AMS_UNUSED(raw_charge, voltage, voltage_threshold);
/* Get various battery metrics. */
int avg_current, current, open_circuit_voltage;
float temp;
int avg_current, current;
float temp, voltage_fuel_gauge_percentage;
if (R_FAILED(m_battery_driver.GetAverageCurrent(std::addressof(avg_current)))) {
return;
}
@ -121,12 +121,12 @@ namespace ams::boot {
if (R_FAILED(m_battery_driver.GetTemperature(std::addressof(temp)))) {
return;
}
if (R_FAILED(m_battery_driver.GetOpenCircuitVoltage(std::addressof(open_circuit_voltage)))) {
if (R_FAILED(m_battery_driver.GetVoltageFuelGaugePercentage(std::addressof(voltage_fuel_gauge_percentage)))) {
return;
}
/* TODO: Print the things we just got. */
AMS_UNUSED(avg_current, current, temp, open_circuit_voltage);
AMS_UNUSED(avg_current, current, temp, voltage_fuel_gauge_percentage);
}
bool BatteryChecker::IsChargeDone() {
@ -198,12 +198,12 @@ namespace ams::boot {
}
m_charge_arbiter.SetBatteryAverageVCell(avg_v_cell);
/* Update open circuit voltage. */
int ocv;
if (R_FAILED(m_battery_driver.GetOpenCircuitVoltage(std::addressof(ocv)))) {
/* Update voltage fuel gauge percentage. */
float vfgp;
if (R_FAILED(m_battery_driver.GetVoltageFuelGaugePercentage(std::addressof(vfgp)))) {
boot::ShutdownSystem();
}
m_charge_arbiter.SetBatteryOpenCircuitVoltage(ocv);
m_charge_arbiter.SetBatteryVoltageFuelGaugePercentage(vfgp);
/* Update charge done current. */
this->UpdateChargeDoneCurrent();
@ -450,7 +450,6 @@ namespace ams::boot {
/* Update the charger. */
this->UpdateCharger();
}
}
}
@ -492,7 +491,7 @@ namespace ams::boot {
/* Get the charge voltage limit. */
int charge_voltage_limit_mv;
if (boot_reason != spl::BootReason_RtcAlarm2) {
if (boot_reason != spl::BootReason_RtcAlarm2 || charge_parameters.unknown_x_table == nullptr || charge_parameters.x_table_size == 0) {
charge_voltage_limit_mv = charge_parameters.default_charge_voltage_limit;
} else {
if (R_FAILED(charger_driver.GetChargeVoltageLimit(std::addressof(charge_voltage_limit_mv)))) {

View file

@ -135,11 +135,6 @@ namespace ams {
/* Get the hardware type. */
const auto hw_type = spl::GetHardwareType();
/* TODO: Aula support. */
/* We haven't actually implemented battery configuration for Aula, running on OLED models */
/* is likely not good for the hardware until we do that properly. */
AMS_ABORT_UNLESS(hw_type != spl::HardwareType::Aula);
/* Initialize the power control library without interrupt event handling. */
if (hw_type != spl::HardwareType::Calcio) {
powctl::Initialize(false);