ams: use R_SUCCEED, R_THROW globally

This commit is contained in:
Michael Scire 2022-03-26 00:14:36 -07:00
parent e5b1739f65
commit dd78ede99f
370 changed files with 2107 additions and 2107 deletions

View file

@ -107,7 +107,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(this->IsEventHandlerEnabled(), powctl::ResultNotAvailable());
*out = device->SafeCastTo<BatteryDevice>().GetSystemEvent();
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::SetDeviceInterruptEnabled(IDevice *device, bool enable) {
@ -117,7 +117,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set the interrupt enable. */
device->SafeCastTo<BatteryDevice>().SetInterruptEnabled(enable);
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::GetDeviceErrorStatus(u32 *out, IDevice *device) {
@ -143,7 +143,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set output. */
*out_percent = percent;
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::GetBatteryVoltageFuelGaugePercentage(float *out_percent, IDevice *device) {
@ -157,7 +157,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set output. */
*out_percent = percent;
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::GetBatteryFullCapacity(int *out_mah, IDevice *device) {
@ -171,7 +171,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set output. */
*out_mah = mah;
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::GetBatteryRemainingCapacity(int *out_mah, IDevice *device) {
@ -185,7 +185,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set output. */
*out_mah = mah;
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::SetBatteryChargePercentageMinimumAlertThreshold(IDevice *device, float percentage) {
@ -194,7 +194,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().SetChargePercentageMinimumAlertThreshold(percentage));
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::SetBatteryChargePercentageMaximumAlertThreshold(IDevice *device, float percentage) {
@ -203,7 +203,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().SetChargePercentageMaximumAlertThreshold(percentage));
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::SetBatteryVoltageFuelGaugePercentageMinimumAlertThreshold(IDevice *device, float percentage) {
@ -212,7 +212,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().SetVoltageFuelGaugePercentageMinimumAlertThreshold(percentage));
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::SetBatteryVoltageFuelGaugePercentageMaximumAlertThreshold(IDevice *device, float percentage) {
@ -221,7 +221,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().SetVoltageFuelGaugePercentageMaximumAlertThreshold(percentage));
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::SetBatteryFullChargeThreshold(IDevice *device, float percentage) {
@ -230,7 +230,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().SetFullChargeThreshold(percentage));
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::GetBatteryAverageCurrent(int *out_ma, IDevice *device) {
@ -244,7 +244,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set output. */
*out_ma = ma;
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::GetBatteryCurrent(int *out_ma, IDevice *device) {
@ -258,7 +258,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set output. */
*out_ma = ma;
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::GetBatteryInternalState(void *dst, size_t *out_size, IDevice *device, size_t dst_size) {
@ -272,7 +272,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().ReadInternalState());
GetMax17050Driver().GetInternalState(static_cast<max17050::InternalState *>(dst));
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::SetBatteryInternalState(IDevice *device, const void *src, size_t src_size) {
@ -285,7 +285,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
GetMax17050Driver().SetInternalState(*static_cast<const max17050::InternalState *>(src));
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().WriteInternalState());
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::GetBatteryNeedToRestoreParameters(bool *out, IDevice *device) {
@ -296,7 +296,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Get the value. */
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().GetNeedToRestoreParameters(out));
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::SetBatteryNeedToRestoreParameters(IDevice *device, bool en) {
@ -306,7 +306,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set the value. */
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().SetNeedToRestoreParameters(en));
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::IsBatteryI2cShutdownEnabled(bool *out, IDevice *device) {
@ -317,7 +317,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Get the value. */
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().IsI2cShutdownEnabled(out));
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::SetBatteryI2cShutdownEnabled(IDevice *device, bool en) {
@ -327,7 +327,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set the value. */
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().SetI2cShutdownEnabled(en));
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::IsBatteryPresent(bool *out, IDevice *device) {
@ -341,7 +341,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set output. */
*out = (status & 0x0008) == 0;
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::GetBatteryCycles(int *out, IDevice *device) {
@ -355,7 +355,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set output. */
*out = cycles;
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::SetBatteryCycles(IDevice *device, int cycles) {
@ -364,7 +364,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().ResetCycles());
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::GetBatteryAge(float *out_percent, IDevice *device) {
@ -378,7 +378,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set output. */
*out_percent = percent;
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::GetBatteryTemperature(float *out_c, IDevice *device) {
@ -392,7 +392,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set output. */
*out_c = temp;
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::GetBatteryMaximumTemperature(float *out_c, IDevice *device) {
@ -406,7 +406,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set output. */
*out_c = static_cast<float>(max_temp);
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::SetBatteryTemperatureMinimumAlertThreshold(IDevice *device, float c) {
@ -415,7 +415,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().SetTemperatureMinimumAlertThreshold(c));
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::SetBatteryTemperatureMaximumAlertThreshold(IDevice *device, float c) {
@ -424,7 +424,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().SetTemperatureMaximumAlertThreshold(c));
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::GetBatteryVCell(int *out_mv, IDevice *device) {
@ -435,7 +435,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Get the value. */
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().GetVCell(out_mv));
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::GetBatteryAverageVCell(int *out_mv, IDevice *device) {
@ -446,7 +446,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Get the value. */
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().GetAverageVCell(out_mv));
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::GetBatteryAverageVCellTime(TimeSpan *out, IDevice *device) {
@ -460,7 +460,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set output. */
*out = TimeSpan::FromMicroSeconds(static_cast<s64>(ms * 1000.0));
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::SetBatteryVoltageMinimumAlertThreshold(IDevice *device, int mv) {
@ -469,7 +469,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().SetVoltageMinimumAlertThreshold(mv));
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::GetBatteryOpenCircuitVoltage(int *out_mv, IDevice *device) {
@ -480,7 +480,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Get the value. */
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().GetOpenCircuitVoltage(out_mv));
return ResultSuccess();
R_SUCCEED();
}
Result BatteryDriver::SetBatteryVoltageMaximumAlertThreshold(IDevice *device, int mv) {
@ -489,7 +489,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetMax17050Driver().SetVoltageMaximumAlertThreshold(mv));
return ResultSuccess();
R_SUCCEED();
}
}

View file

@ -109,40 +109,40 @@ namespace ams::powctl::impl::board::nintendo::nx {
virtual Result SetBatteryVoltageMaximumAlertThreshold(IDevice *device, int mv) override;
/* Unsupported Charger API. */
virtual Result GetChargerChargeCurrentState(ChargeCurrentState *out, IDevice *device) override { AMS_UNUSED(out, device); return powctl::ResultNotSupported(); }
virtual Result SetChargerChargeCurrentState(IDevice *device, ChargeCurrentState state) override { AMS_UNUSED(device, state); return powctl::ResultNotSupported(); }
virtual Result GetChargerChargeCurrentState(ChargeCurrentState *out, IDevice *device) override { AMS_UNUSED(out, device); R_THROW(powctl::ResultNotSupported()); }
virtual Result SetChargerChargeCurrentState(IDevice *device, ChargeCurrentState state) override { AMS_UNUSED(device, state); R_THROW(powctl::ResultNotSupported()); }
virtual Result GetChargerFastChargeCurrentLimit(int *out_ma, IDevice *device) override { AMS_UNUSED(out_ma, device); return powctl::ResultNotSupported(); }
virtual Result SetChargerFastChargeCurrentLimit(IDevice *device, int ma) override { AMS_UNUSED(device, ma); return powctl::ResultNotSupported(); }
virtual Result GetChargerFastChargeCurrentLimit(int *out_ma, IDevice *device) override { AMS_UNUSED(out_ma, device); R_THROW(powctl::ResultNotSupported()); }
virtual Result SetChargerFastChargeCurrentLimit(IDevice *device, int ma) override { AMS_UNUSED(device, ma); R_THROW(powctl::ResultNotSupported()); }
virtual Result GetChargerChargeVoltageLimit(int *out_mv, IDevice *device) override { AMS_UNUSED(out_mv, device); return powctl::ResultNotSupported(); }
virtual Result SetChargerChargeVoltageLimit(IDevice *device, int mv) override { AMS_UNUSED(device, mv); return powctl::ResultNotSupported(); }
virtual Result GetChargerChargeVoltageLimit(int *out_mv, IDevice *device) override { AMS_UNUSED(out_mv, device); R_THROW(powctl::ResultNotSupported()); }
virtual Result SetChargerChargeVoltageLimit(IDevice *device, int mv) override { AMS_UNUSED(device, mv); R_THROW(powctl::ResultNotSupported()); }
virtual Result SetChargerChargerConfiguration(IDevice *device, ChargerConfiguration cfg) override { AMS_UNUSED(device, cfg); return powctl::ResultNotSupported(); }
virtual Result SetChargerChargerConfiguration(IDevice *device, ChargerConfiguration cfg) override { AMS_UNUSED(device, cfg); R_THROW(powctl::ResultNotSupported()); }
virtual Result IsChargerHiZEnabled(bool *out, IDevice *device) override { AMS_UNUSED(out, device); return powctl::ResultNotSupported(); }
virtual Result SetChargerHiZEnabled(IDevice *device, bool en) override { AMS_UNUSED(device, en); return powctl::ResultNotSupported(); }
virtual Result IsChargerHiZEnabled(bool *out, IDevice *device) override { AMS_UNUSED(out, device); R_THROW(powctl::ResultNotSupported()); }
virtual Result SetChargerHiZEnabled(IDevice *device, bool en) override { AMS_UNUSED(device, en); R_THROW(powctl::ResultNotSupported()); }
virtual Result GetChargerInputCurrentLimit(int *out_ma, IDevice *device) override { AMS_UNUSED(out_ma, device); return powctl::ResultNotSupported(); }
virtual Result SetChargerInputCurrentLimit(IDevice *device, int ma) override { AMS_UNUSED(device, ma); return powctl::ResultNotSupported(); }
virtual Result GetChargerInputCurrentLimit(int *out_ma, IDevice *device) override { AMS_UNUSED(out_ma, device); R_THROW(powctl::ResultNotSupported()); }
virtual Result SetChargerInputCurrentLimit(IDevice *device, int ma) override { AMS_UNUSED(device, ma); R_THROW(powctl::ResultNotSupported()); }
virtual Result SetChargerInputVoltageLimit(IDevice *device, int mv) override { AMS_UNUSED(device, mv); return powctl::ResultNotSupported(); }
virtual Result SetChargerInputVoltageLimit(IDevice *device, int mv) override { AMS_UNUSED(device, mv); R_THROW(powctl::ResultNotSupported()); }
virtual Result SetChargerBoostModeCurrentLimit(IDevice *device, int ma) override { AMS_UNUSED(device, ma); return powctl::ResultNotSupported(); }
virtual Result SetChargerBoostModeCurrentLimit(IDevice *device, int ma) override { AMS_UNUSED(device, ma); R_THROW(powctl::ResultNotSupported()); }
virtual Result GetChargerChargerStatus(ChargerStatus *out, IDevice *device) override { AMS_UNUSED(out, device); return powctl::ResultNotSupported(); }
virtual Result GetChargerChargerStatus(ChargerStatus *out, IDevice *device) override { AMS_UNUSED(out, device); R_THROW(powctl::ResultNotSupported()); }
virtual Result IsChargerWatchdogTimerEnabled(bool *out, IDevice *device) override { AMS_UNUSED(out, device); return powctl::ResultNotSupported(); }
virtual Result SetChargerWatchdogTimerEnabled(IDevice *device, bool en) override { AMS_UNUSED(device, en); return powctl::ResultNotSupported(); }
virtual Result IsChargerWatchdogTimerEnabled(bool *out, IDevice *device) override { AMS_UNUSED(out, device); R_THROW(powctl::ResultNotSupported()); }
virtual Result SetChargerWatchdogTimerEnabled(IDevice *device, bool en) override { AMS_UNUSED(device, en); R_THROW(powctl::ResultNotSupported()); }
virtual Result SetChargerWatchdogTimerTimeout(IDevice *device, TimeSpan timeout) override { AMS_UNUSED(device, timeout); return powctl::ResultNotSupported(); }
virtual Result ResetChargerWatchdogTimer(IDevice *device) override { AMS_UNUSED(device); return powctl::ResultNotSupported(); }
virtual Result SetChargerWatchdogTimerTimeout(IDevice *device, TimeSpan timeout) override { AMS_UNUSED(device, timeout); R_THROW(powctl::ResultNotSupported()); }
virtual Result ResetChargerWatchdogTimer(IDevice *device) override { AMS_UNUSED(device); R_THROW(powctl::ResultNotSupported()); }
virtual Result GetChargerBatteryCompensation(int *out_mo, IDevice *device) override { AMS_UNUSED(out_mo, device); return powctl::ResultNotSupported(); }
virtual Result SetChargerBatteryCompensation(IDevice *device, int mo) override { AMS_UNUSED(device, mo); return powctl::ResultNotSupported(); }
virtual Result GetChargerBatteryCompensation(int *out_mo, IDevice *device) override { AMS_UNUSED(out_mo, device); R_THROW(powctl::ResultNotSupported()); }
virtual Result SetChargerBatteryCompensation(IDevice *device, int mo) override { AMS_UNUSED(device, mo); R_THROW(powctl::ResultNotSupported()); }
virtual Result GetChargerVoltageClamp(int *out_mv, IDevice *device) override { AMS_UNUSED(out_mv, device); return powctl::ResultNotSupported(); }
virtual Result SetChargerVoltageClamp(IDevice *device, int mv) override { AMS_UNUSED(device, mv); return powctl::ResultNotSupported(); }
virtual Result GetChargerVoltageClamp(int *out_mv, IDevice *device) override { AMS_UNUSED(out_mv, device); R_THROW(powctl::ResultNotSupported()); }
virtual Result SetChargerVoltageClamp(IDevice *device, int mv) override { AMS_UNUSED(device, mv); R_THROW(powctl::ResultNotSupported()); }
};
}

View file

@ -234,7 +234,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
const u8 new_val = (cur_val & ~mask) | (value & mask);
R_TRY(i2c::WriteSingleRegister(session, address, new_val));
return ResultSuccess();
R_SUCCEED();
}
}
@ -264,7 +264,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Reset the watchdog timer. */
R_TRY(this->ResetWatchdogTimer());
return ResultSuccess();
R_SUCCEED();
}
Result Bq24193Driver::SetPreChargeCurrentLimit(int ma) {
@ -290,7 +290,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Extract the value. */
*out = (val & 0x01) != 0;
return ResultSuccess();
R_SUCCEED();
}
Result Bq24193Driver::SetForce20PercentChargeCurrent(bool en) {
@ -304,7 +304,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Extract the value. */
*out_ma = bq24193::DecodeFastChargeCurrentLimit(val);
return ResultSuccess();
R_SUCCEED();
}
Result Bq24193Driver::SetFastChargeCurrentLimit(int ma) {
@ -318,7 +318,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Extract the value. */
*out_mv = bq24193::DecodeChargeVoltageLimit(val);
return ResultSuccess();
R_SUCCEED();
}
Result Bq24193Driver::SetChargeVoltageLimit(int mv) {
@ -336,7 +336,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Extract the value. */
*out = (val & 0x80) != 0;
return ResultSuccess();
R_SUCCEED();
}
Result Bq24193Driver::SetHiZEnabled(bool en) {
@ -350,7 +350,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Extract the value. */
*out_ma = bq24193::DecodeInputCurrentLimit(val);
return ResultSuccess();
R_SUCCEED();
}
Result Bq24193Driver::SetInputCurrentLimit(int ma) {
@ -372,7 +372,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Extract the value. */
*out = bq24193::DecodeChargerStatus(val);
return ResultSuccess();
R_SUCCEED();
}
Result Bq24193Driver::ResetWatchdogTimer() {
@ -390,7 +390,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Extract the value. */
*out_mo = bq24193::DecodeBatteryCompensation(val);
return ResultSuccess();
R_SUCCEED();
}
Result Bq24193Driver::SetBatteryCompensation(int mo) {
@ -404,7 +404,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Extract the value. */
*out_mv = bq24193::DecodeVoltageClamp(val);
return ResultSuccess();
R_SUCCEED();
}
Result Bq24193Driver::SetVoltageClamp(int mv) {

View file

@ -99,7 +99,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(this->IsEventHandlerEnabled(), powctl::ResultNotAvailable());
*out = device->SafeCastTo<ChargerDevice>().GetSystemEvent();
return ResultSuccess();
R_SUCCEED();
}
Result ChargerDriver::SetDeviceInterruptEnabled(IDevice *device, bool enable) {
@ -109,7 +109,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set the interrupt enable. */
device->SafeCastTo<ChargerDevice>().SetInterruptEnabled(enable);
return ResultSuccess();
R_SUCCEED();
}
Result ChargerDriver::GetDeviceErrorStatus(u32 *out, IDevice *device) {
@ -148,7 +148,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
}
}
return ResultSuccess();
R_SUCCEED();
}
Result ChargerDriver::SetChargerChargeCurrentState(IDevice *device, ChargeCurrentState state) {
@ -167,10 +167,10 @@ namespace ams::powctl::impl::board::nintendo::nx {
AMS_POWCTL_DRIVER_R_TRY_WITH_RETRY(GetBq24193Driver().SetForce20PercentChargeCurrent(state == ChargeCurrentState_ChargingForce20Percent));
break;
case ChargeCurrentState_Unknown:
return powctl::ResultInvalidArgument();
R_THROW(powctl::ResultInvalidArgument());
}
return ResultSuccess();
R_SUCCEED();
}
Result ChargerDriver::GetChargerFastChargeCurrentLimit(int *out_ma, IDevice *device) {
@ -179,7 +179,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(device != nullptr, powctl::ResultInvalidArgument());
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().GetFastChargeCurrentLimit(out_ma));
return ResultSuccess();
R_SUCCEED();
}
Result ChargerDriver::SetChargerFastChargeCurrentLimit(IDevice *device, int ma) {
@ -187,7 +187,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(device != nullptr, powctl::ResultInvalidArgument());
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().SetFastChargeCurrentLimit(ma));
return ResultSuccess();
R_SUCCEED();
}
Result ChargerDriver::GetChargerChargeVoltageLimit(int *out_mv, IDevice *device) {
@ -196,7 +196,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(device != nullptr, powctl::ResultInvalidArgument());
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().GetChargeVoltageLimit(out_mv));
return ResultSuccess();
R_SUCCEED();
}
Result ChargerDriver::SetChargerChargeVoltageLimit(IDevice *device, int mv) {
@ -204,7 +204,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(device != nullptr, powctl::ResultInvalidArgument());
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().SetChargeVoltageLimit(mv));
return ResultSuccess();
R_SUCCEED();
}
Result ChargerDriver::SetChargerChargerConfiguration(IDevice *device, ChargerConfiguration cfg) {
@ -220,7 +220,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
}
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().SetChargerConfiguration(bq_cfg));
return ResultSuccess();
R_SUCCEED();
}
Result ChargerDriver::IsChargerHiZEnabled(bool *out, IDevice *device) {
@ -229,7 +229,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(device != nullptr, powctl::ResultInvalidArgument());
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().IsHiZEnabled(out));
return ResultSuccess();
R_SUCCEED();
}
Result ChargerDriver::SetChargerHiZEnabled(IDevice *device, bool en) {
@ -237,7 +237,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(device != nullptr, powctl::ResultInvalidArgument());
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().SetHiZEnabled(en));
return ResultSuccess();
R_SUCCEED();
}
Result ChargerDriver::GetChargerInputCurrentLimit(int *out_ma, IDevice *device) {
@ -246,7 +246,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(device != nullptr, powctl::ResultInvalidArgument());
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().GetInputCurrentLimit(out_ma));
return ResultSuccess();
R_SUCCEED();
}
Result ChargerDriver::SetChargerInputCurrentLimit(IDevice *device, int ma) {
@ -254,7 +254,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(device != nullptr, powctl::ResultInvalidArgument());
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().SetInputCurrentLimit(ma));
return ResultSuccess();
R_SUCCEED();
}
Result ChargerDriver::SetChargerInputVoltageLimit(IDevice *device, int mv) {
@ -262,7 +262,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(device != nullptr, powctl::ResultInvalidArgument());
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().SetInputVoltageLimit(mv));
return ResultSuccess();
R_SUCCEED();
}
Result ChargerDriver::SetChargerBoostModeCurrentLimit(IDevice *device, int ma) {
@ -270,7 +270,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(device != nullptr, powctl::ResultInvalidArgument());
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().SetBoostModeCurrentLimit(ma));
return ResultSuccess();
R_SUCCEED();
}
Result ChargerDriver::GetChargerChargerStatus(ChargerStatus *out, IDevice *device) {
@ -294,7 +294,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
AMS_UNREACHABLE_DEFAULT_CASE();
}
return ResultSuccess();
R_SUCCEED();
}
Result ChargerDriver::IsChargerWatchdogTimerEnabled(bool *out, IDevice *device) {
@ -303,7 +303,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(device != nullptr, powctl::ResultInvalidArgument());
*out = device->SafeCastTo<ChargerDevice>().IsWatchdogTimerEnabled();
return ResultSuccess();
R_SUCCEED();
}
Result ChargerDriver::SetChargerWatchdogTimerEnabled(IDevice *device, bool en) {
@ -321,7 +321,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
}
charger_device.SetWatchdogTimerEnabled(en);
return ResultSuccess();
R_SUCCEED();
}
Result ChargerDriver::SetChargerWatchdogTimerTimeout(IDevice *device, TimeSpan timeout) {
@ -329,7 +329,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(device != nullptr, powctl::ResultInvalidArgument());
device->SafeCastTo<ChargerDevice>().SetWatchdogTimerTimeout(timeout);
return ResultSuccess();
R_SUCCEED();
}
Result ChargerDriver::ResetChargerWatchdogTimer(IDevice *device) {
@ -337,7 +337,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(device != nullptr, powctl::ResultInvalidArgument());
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().ResetWatchdogTimer());
return ResultSuccess();
R_SUCCEED();
}
Result ChargerDriver::GetChargerBatteryCompensation(int *out_mo, IDevice *device) {
@ -346,7 +346,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(device != nullptr, powctl::ResultInvalidArgument());
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().GetBatteryCompensation(out_mo));
return ResultSuccess();
R_SUCCEED();
}
Result ChargerDriver::SetChargerBatteryCompensation(IDevice *device, int mo) {
@ -354,7 +354,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(device != nullptr, powctl::ResultInvalidArgument());
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().SetBatteryCompensation(mo));
return ResultSuccess();
R_SUCCEED();
}
Result ChargerDriver::GetChargerVoltageClamp(int *out_mv, IDevice *device) {
@ -363,7 +363,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(device != nullptr, powctl::ResultInvalidArgument());
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().GetVoltageClamp(out_mv));
return ResultSuccess();
R_SUCCEED();
}
Result ChargerDriver::SetChargerVoltageClamp(IDevice *device, int mv) {
@ -371,7 +371,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_UNLESS(device != nullptr, powctl::ResultInvalidArgument());
AMS_POWCTL_DRIVER_LOCKED_R_TRY_WITH_RETRY(GetBq24193Driver().SetVoltageClamp(mv));
return ResultSuccess();
R_SUCCEED();
}
}

View file

@ -105,56 +105,56 @@ namespace ams::powctl::impl::board::nintendo::nx {
virtual Result SetChargerVoltageClamp(IDevice *device, int mv) override;
/* Unsupported Battery API. */
virtual Result GetBatteryChargePercentage(float *out_percent, IDevice *device) override { AMS_UNUSED(out_percent, device); return powctl::ResultNotSupported(); }
virtual Result GetBatteryChargePercentage(float *out_percent, IDevice *device) override { AMS_UNUSED(out_percent, device); R_THROW(powctl::ResultNotSupported()); }
virtual Result GetBatteryVoltageFuelGaugePercentage(float *out_percent, IDevice *device) override { AMS_UNUSED(out_percent, device); return powctl::ResultNotSupported(); }
virtual Result GetBatteryVoltageFuelGaugePercentage(float *out_percent, IDevice *device) override { AMS_UNUSED(out_percent, device); R_THROW(powctl::ResultNotSupported()); }
virtual Result GetBatteryFullCapacity(int *out_mah, IDevice *device) override { AMS_UNUSED(out_mah, device); return powctl::ResultNotSupported(); }
virtual Result GetBatteryRemainingCapacity(int *out_mah, IDevice *device) override { AMS_UNUSED(out_mah, device); return powctl::ResultNotSupported(); }
virtual Result GetBatteryFullCapacity(int *out_mah, IDevice *device) override { AMS_UNUSED(out_mah, device); R_THROW(powctl::ResultNotSupported()); }
virtual Result GetBatteryRemainingCapacity(int *out_mah, IDevice *device) override { AMS_UNUSED(out_mah, device); R_THROW(powctl::ResultNotSupported()); }
virtual Result SetBatteryChargePercentageMinimumAlertThreshold(IDevice *device, float percentage) override { AMS_UNUSED(device, percentage); return powctl::ResultNotSupported(); }
virtual Result SetBatteryChargePercentageMaximumAlertThreshold(IDevice *device, float percentage) override { AMS_UNUSED(device, percentage); return powctl::ResultNotSupported(); }
virtual Result SetBatteryChargePercentageMinimumAlertThreshold(IDevice *device, float percentage) override { AMS_UNUSED(device, percentage); R_THROW(powctl::ResultNotSupported()); }
virtual Result SetBatteryChargePercentageMaximumAlertThreshold(IDevice *device, float percentage) override { AMS_UNUSED(device, percentage); R_THROW(powctl::ResultNotSupported()); }
virtual Result SetBatteryVoltageFuelGaugePercentageMinimumAlertThreshold(IDevice *device, float percentage) override { AMS_UNUSED(device, percentage); return powctl::ResultNotSupported(); }
virtual Result SetBatteryVoltageFuelGaugePercentageMaximumAlertThreshold(IDevice *device, float percentage) override { AMS_UNUSED(device, percentage); return powctl::ResultNotSupported(); }
virtual Result SetBatteryVoltageFuelGaugePercentageMinimumAlertThreshold(IDevice *device, float percentage) override { AMS_UNUSED(device, percentage); R_THROW(powctl::ResultNotSupported()); }
virtual Result SetBatteryVoltageFuelGaugePercentageMaximumAlertThreshold(IDevice *device, float percentage) override { AMS_UNUSED(device, percentage); R_THROW(powctl::ResultNotSupported()); }
virtual Result SetBatteryFullChargeThreshold(IDevice *device, float percentage) override { AMS_UNUSED(device, percentage); return powctl::ResultNotSupported(); }
virtual Result SetBatteryFullChargeThreshold(IDevice *device, float percentage) override { AMS_UNUSED(device, percentage); R_THROW(powctl::ResultNotSupported()); }
virtual Result GetBatteryAverageCurrent(int *out_ma, IDevice *device) override { AMS_UNUSED(out_ma, device); return powctl::ResultNotSupported(); }
virtual Result GetBatteryCurrent(int *out_ma, IDevice *device) override { AMS_UNUSED(out_ma, device); return powctl::ResultNotSupported(); }
virtual Result GetBatteryAverageCurrent(int *out_ma, IDevice *device) override { AMS_UNUSED(out_ma, device); R_THROW(powctl::ResultNotSupported()); }
virtual Result GetBatteryCurrent(int *out_ma, IDevice *device) override { AMS_UNUSED(out_ma, device); R_THROW(powctl::ResultNotSupported()); }
virtual Result GetBatteryInternalState(void *dst, size_t *out_size, IDevice *device, size_t dst_size) override { AMS_UNUSED(dst, out_size, device, dst_size); return powctl::ResultNotSupported(); }
virtual Result SetBatteryInternalState(IDevice *device, const void *src, size_t src_size) override { AMS_UNUSED(device, src, src_size); return powctl::ResultNotSupported(); }
virtual Result GetBatteryInternalState(void *dst, size_t *out_size, IDevice *device, size_t dst_size) override { AMS_UNUSED(dst, out_size, device, dst_size); R_THROW(powctl::ResultNotSupported()); }
virtual Result SetBatteryInternalState(IDevice *device, const void *src, size_t src_size) override { AMS_UNUSED(device, src, src_size); R_THROW(powctl::ResultNotSupported()); }
virtual Result GetBatteryNeedToRestoreParameters(bool *out, IDevice *device) override { AMS_UNUSED(out, device); return powctl::ResultNotSupported(); }
virtual Result SetBatteryNeedToRestoreParameters(IDevice *device, bool en) override { AMS_UNUSED(device, en); return powctl::ResultNotSupported(); }
virtual Result GetBatteryNeedToRestoreParameters(bool *out, IDevice *device) override { AMS_UNUSED(out, device); R_THROW(powctl::ResultNotSupported()); }
virtual Result SetBatteryNeedToRestoreParameters(IDevice *device, bool en) override { AMS_UNUSED(device, en); R_THROW(powctl::ResultNotSupported()); }
virtual Result IsBatteryI2cShutdownEnabled(bool *out, IDevice *device) override { AMS_UNUSED(out, device); return powctl::ResultNotSupported(); }
virtual Result SetBatteryI2cShutdownEnabled(IDevice *device, bool en) override { AMS_UNUSED(device, en); return powctl::ResultNotSupported(); }
virtual Result IsBatteryI2cShutdownEnabled(bool *out, IDevice *device) override { AMS_UNUSED(out, device); R_THROW(powctl::ResultNotSupported()); }
virtual Result SetBatteryI2cShutdownEnabled(IDevice *device, bool en) override { AMS_UNUSED(device, en); R_THROW(powctl::ResultNotSupported()); }
virtual Result IsBatteryPresent(bool *out, IDevice *device) override { AMS_UNUSED(out, device); return powctl::ResultNotSupported(); }
virtual Result IsBatteryPresent(bool *out, IDevice *device) override { AMS_UNUSED(out, device); R_THROW(powctl::ResultNotSupported()); }
virtual Result GetBatteryCycles(int *out, IDevice *device) override { AMS_UNUSED(out, device); return powctl::ResultNotSupported(); }
virtual Result SetBatteryCycles(IDevice *device, int cycles) override { AMS_UNUSED(device, cycles); return powctl::ResultNotSupported(); }
virtual Result GetBatteryCycles(int *out, IDevice *device) override { AMS_UNUSED(out, device); R_THROW(powctl::ResultNotSupported()); }
virtual Result SetBatteryCycles(IDevice *device, int cycles) override { AMS_UNUSED(device, cycles); R_THROW(powctl::ResultNotSupported()); }
virtual Result GetBatteryAge(float *out_percent, IDevice *device) override { AMS_UNUSED(out_percent, device); return powctl::ResultNotSupported(); }
virtual Result GetBatteryAge(float *out_percent, IDevice *device) override { AMS_UNUSED(out_percent, device); R_THROW(powctl::ResultNotSupported()); }
virtual Result GetBatteryTemperature(float *out_c, IDevice *device) override { AMS_UNUSED(out_c, device); return powctl::ResultNotSupported(); }
virtual Result GetBatteryMaximumTemperature(float *out_c, IDevice *device) override { AMS_UNUSED(out_c, device); return powctl::ResultNotSupported(); }
virtual Result GetBatteryTemperature(float *out_c, IDevice *device) override { AMS_UNUSED(out_c, device); R_THROW(powctl::ResultNotSupported()); }
virtual Result GetBatteryMaximumTemperature(float *out_c, IDevice *device) override { AMS_UNUSED(out_c, device); R_THROW(powctl::ResultNotSupported()); }
virtual Result SetBatteryTemperatureMinimumAlertThreshold(IDevice *device, float c) override { AMS_UNUSED(device, c); return powctl::ResultNotSupported(); }
virtual Result SetBatteryTemperatureMaximumAlertThreshold(IDevice *device, float c) override { AMS_UNUSED(device, c); return powctl::ResultNotSupported(); }
virtual Result SetBatteryTemperatureMinimumAlertThreshold(IDevice *device, float c) override { AMS_UNUSED(device, c); R_THROW(powctl::ResultNotSupported()); }
virtual Result SetBatteryTemperatureMaximumAlertThreshold(IDevice *device, float c) override { AMS_UNUSED(device, c); R_THROW(powctl::ResultNotSupported()); }
virtual Result GetBatteryVCell(int *out_mv, IDevice *device) override { AMS_UNUSED(out_mv, device); return powctl::ResultNotSupported(); }
virtual Result GetBatteryAverageVCell(int *out_mv, IDevice *device) override { AMS_UNUSED(out_mv, device); return powctl::ResultNotSupported(); }
virtual Result GetBatteryVCell(int *out_mv, IDevice *device) override { AMS_UNUSED(out_mv, device); R_THROW(powctl::ResultNotSupported()); }
virtual Result GetBatteryAverageVCell(int *out_mv, IDevice *device) override { AMS_UNUSED(out_mv, device); R_THROW(powctl::ResultNotSupported()); }
virtual Result GetBatteryAverageVCellTime(TimeSpan *out, IDevice *device) override { AMS_UNUSED(out, device); return powctl::ResultNotSupported(); }
virtual Result GetBatteryAverageVCellTime(TimeSpan *out, IDevice *device) override { AMS_UNUSED(out, device); R_THROW(powctl::ResultNotSupported()); }
virtual Result SetBatteryVoltageMinimumAlertThreshold(IDevice *device, int mv) override { AMS_UNUSED(device, mv); return powctl::ResultNotSupported(); }
virtual Result SetBatteryVoltageMinimumAlertThreshold(IDevice *device, int mv) override { AMS_UNUSED(device, mv); R_THROW(powctl::ResultNotSupported()); }
virtual Result GetBatteryOpenCircuitVoltage(int *out_mv, IDevice *device) override { AMS_UNUSED(out_mv, device); return powctl::ResultNotSupported(); }
virtual Result GetBatteryOpenCircuitVoltage(int *out_mv, IDevice *device) override { AMS_UNUSED(out_mv, device); R_THROW(powctl::ResultNotSupported()); }
virtual Result SetBatteryVoltageMaximumAlertThreshold(IDevice *device, int mv) override { AMS_UNUSED(device, mv); return powctl::ResultNotSupported(); }
virtual Result SetBatteryVoltageMaximumAlertThreshold(IDevice *device, int mv) override { AMS_UNUSED(device, mv); R_THROW(powctl::ResultNotSupported()); }
};
}

View file

@ -171,7 +171,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
const u16 new_val = (cur_val & ~mask) | (value & mask);
R_TRY(i2c::WriteSingleRegister(session, address, new_val));
return ResultSuccess();
R_SUCCEED();
}
ALWAYS_INLINE Result ReadRegister(const i2c::I2cSession &session, u8 address, u16 *out) {
@ -205,7 +205,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
const u16 new_val = (cur_val & ~mask) | (value & mask);
while (!WriteValidateRegister(session, address, new_val)) { /* ... */ }
return ResultSuccess();
R_SUCCEED();
}
double CoerceToDouble(u64 value) {
@ -360,7 +360,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set cgain. */
R_TRY(WriteRegister(m_i2c_session, max17050::CGain, 0x7FFF));
return ResultSuccess();
R_SUCCEED();
}
Result Max17050Driver::SetMaximumShutdownTimerThreshold() {
@ -395,13 +395,13 @@ namespace ams::powctl::impl::board::nintendo::nx {
Result Max17050Driver::LockModelTable() {
R_TRY(WriteRegister(m_i2c_session, max17050::ModelAccess0, 0x0000));
R_TRY(WriteRegister(m_i2c_session, max17050::ModelAccess1, 0x0000));
return ResultSuccess();
R_SUCCEED();
}
Result Max17050Driver::UnlockModelTable() {
R_TRY(WriteRegister(m_i2c_session, max17050::ModelAccess0, 0x0059));
R_TRY(WriteRegister(m_i2c_session, max17050::ModelAccess1, 0x00C4));
return ResultSuccess();
R_SUCCEED();
}
bool Max17050Driver::IsModelTableLocked() {
@ -422,7 +422,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_TRY(WriteRegister(m_i2c_session, max17050::ModelChrTblStart + i, model_table[i]));
}
return ResultSuccess();
R_SUCCEED();
}
bool Max17050Driver::IsModelTableSet(const u16 *model_table) {
@ -449,7 +449,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
R_TRY(ReadRegister(m_i2c_session, max17050::QResidual10, std::addressof(m_internal_state.qresidual10)));
R_TRY(ReadRegister(m_i2c_session, max17050::QResidual20, std::addressof(m_internal_state.qresidual20)));
R_TRY(ReadRegister(m_i2c_session, max17050::QResidual30, std::addressof(m_internal_state.qresidual30)));
return ResultSuccess();
R_SUCCEED();
}
Result Max17050Driver::WriteInternalState() {
@ -480,7 +480,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
while (!WriteValidateRegister(m_i2c_session, max17050::LearnCfg, 0x2673)) { /* ... */ }
}
return ResultSuccess();
R_SUCCEED();
}
Result Max17050Driver::GetChargePercentage(double *out) {
@ -493,7 +493,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set output. */
*out = static_cast<double>(val) * 0.00390625;
return ResultSuccess();
R_SUCCEED();
}
Result Max17050Driver::GetVoltageFuelGaugePercentage(double *out) {
@ -506,7 +506,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set output. */
*out = static_cast<double>(val) * 0.00390625;
return ResultSuccess();
R_SUCCEED();
}
Result Max17050Driver::GetFullCapacity(double *out, double sense_resistor) {
@ -521,7 +521,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set output. */
*out = ((static_cast<double>(fullcap) * 0.005) / sense_resistor) / (static_cast<double>(cgain) * 0.0000610351562);
return ResultSuccess();
R_SUCCEED();
}
Result Max17050Driver::GetRemainingCapacity(double *out, double sense_resistor) {
@ -536,7 +536,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set output. */
*out = ((static_cast<double>(remcap) * 0.005) / sense_resistor) / (static_cast<double>(cgain) * 0.0000610351562);
return ResultSuccess();
R_SUCCEED();
}
Result Max17050Driver::SetChargePercentageMinimumAlertThreshold(int percentage) {
@ -580,7 +580,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set output. */
*out = (((static_cast<double>(avg_current) - (static_cast<double>(coff) + static_cast<double>(coff))) / (static_cast<double>(cgain) * 0.0000610351562)) * 1.5625) / (sense_resistor * 1000.0);
return ResultSuccess();
R_SUCCEED();
}
Result Max17050Driver::GetCurrent(double *out, double sense_resistor) {
@ -596,7 +596,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set output. */
*out = (((static_cast<double>(current) - (static_cast<double>(coff) + static_cast<double>(coff))) / (static_cast<double>(cgain) * 0.0000610351562)) * 1.5625) / (sense_resistor * 1000.0);
return ResultSuccess();
R_SUCCEED();
}
Result Max17050Driver::GetNeedToRestoreParameters(bool *out) {
@ -606,7 +606,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Extract the value. */
*out = (val & 0x8000) != 0;
return ResultSuccess();
R_SUCCEED();
}
Result Max17050Driver::SetNeedToRestoreParameters(bool en) {
@ -620,7 +620,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Extract the value. */
*out = (val & 0x0040) != 0;
return ResultSuccess();
R_SUCCEED();
}
Result Max17050Driver::SetI2cShutdownEnabled(bool en) {
@ -641,7 +641,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Extract the value. */
*out = std::max<u16>(val, 0x60) - 0x60;
return ResultSuccess();
R_SUCCEED();
}
Result Max17050Driver::ResetCycles() {
@ -658,7 +658,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set output. */
*out = static_cast<double>(val) * 0.00390625;
return ResultSuccess();
R_SUCCEED();
}
Result Max17050Driver::GetTemperature(double *out) {
@ -671,7 +671,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set output. */
*out = static_cast<double>(val) * 0.00390625;
return ResultSuccess();
R_SUCCEED();
}
Result Max17050Driver::GetMaximumTemperature(u8 *out) {
@ -684,7 +684,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set output. */
*out = static_cast<u8>(val >> 8);
return ResultSuccess();
R_SUCCEED();
}
Result Max17050Driver::SetTemperatureMinimumAlertThreshold(int c) {
@ -705,7 +705,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set output. */
*out = (625 * (val >> 3)) / 1000;
return ResultSuccess();
R_SUCCEED();
}
Result Max17050Driver::GetAverageVCell(int *out) {
@ -718,7 +718,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set output. */
*out = (625 * (val >> 3)) / 1000;
return ResultSuccess();
R_SUCCEED();
}
Result Max17050Driver::GetAverageVCellTime(double *out) {
@ -731,7 +731,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set output. */
*out = 175.8 * ExponentiateTwoToPower(6 + ((val >> 4) & 7), 1.0);
return ResultSuccess();
R_SUCCEED();
}
Result Max17050Driver::GetOpenCircuitVoltage(int *out) {
@ -744,7 +744,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
/* Set output. */
*out = (1250 * (val >> 4)) / 1000;
return ResultSuccess();
R_SUCCEED();
}
Result Max17050Driver::SetVoltageMinimumAlertThreshold(int mv) {

View file

@ -119,7 +119,7 @@ namespace ams::powctl::impl {
Result RegisterDeviceCode(DeviceCode device_code, IDevice *device) {
AMS_ASSERT(device != nullptr);
R_TRY(GetDeviceCodeEntryManager().Add(device_code, device));
return ResultSuccess();
R_SUCCEED();
}
bool UnregisterDeviceCode(DeviceCode device_code) {
@ -146,7 +146,7 @@ namespace ams::powctl::impl {
/* Set output. */
*out = device->SafeCastToPointer<powctl::impl::IDevice>();
return ResultSuccess();
R_SUCCEED();
}
}