ams: globally prefer R_RETURN to return for ams::Result

This commit is contained in:
Michael Scire
2022-03-26 14:48:33 -07:00
parent dd78ede99f
commit bbf22b4c60
325 changed files with 1955 additions and 1993 deletions

View File

@@ -268,19 +268,19 @@ namespace ams::powctl::impl::board::nintendo::nx {
}
Result Bq24193Driver::SetPreChargeCurrentLimit(int ma) {
return ReadWriteRegister(m_i2c_session, bq24193::PreChargeTerminationCurrentControl, 0xF0, bq24193::EncodePreChargeCurrentLimit(ma));
R_RETURN(ReadWriteRegister(m_i2c_session, bq24193::PreChargeTerminationCurrentControl, 0xF0, bq24193::EncodePreChargeCurrentLimit(ma)));
}
Result Bq24193Driver::SetTerminationCurrentLimit(int ma) {
return ReadWriteRegister(m_i2c_session, bq24193::PreChargeTerminationCurrentControl, 0x0F, bq24193::EncodeTerminationCurrentLimit(ma));
R_RETURN(ReadWriteRegister(m_i2c_session, bq24193::PreChargeTerminationCurrentControl, 0x0F, bq24193::EncodeTerminationCurrentLimit(ma)));
}
Result Bq24193Driver::SetMinimumSystemVoltageLimit(int mv) {
return ReadWriteRegister(m_i2c_session, bq24193::PowerOnConfiguration, 0x0E, bq24193::EncodeMinimumSystemVoltageLimit(mv));
R_RETURN(ReadWriteRegister(m_i2c_session, bq24193::PowerOnConfiguration, 0x0E, bq24193::EncodeMinimumSystemVoltageLimit(mv)));
}
Result Bq24193Driver::SetChargingSafetyTimerEnabled(bool en) {
return ReadWriteRegister(m_i2c_session, bq24193::ChargeTerminationTimerControl, 0x08, en ? 0x08 : 0x00);
R_RETURN(ReadWriteRegister(m_i2c_session, bq24193::ChargeTerminationTimerControl, 0x08, en ? 0x08 : 0x00));
}
Result Bq24193Driver::GetForce20PercentChargeCurrent(bool *out) {
@@ -294,7 +294,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
}
Result Bq24193Driver::SetForce20PercentChargeCurrent(bool en) {
return ReadWriteRegister(m_i2c_session, bq24193::ChargeCurrentControl, 0x01, en ? 0x01 : 0x00);
R_RETURN(ReadWriteRegister(m_i2c_session, bq24193::ChargeCurrentControl, 0x01, en ? 0x01 : 0x00));
}
Result Bq24193Driver::GetFastChargeCurrentLimit(int *out_ma) {
@@ -308,7 +308,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
}
Result Bq24193Driver::SetFastChargeCurrentLimit(int ma) {
return ReadWriteRegister(m_i2c_session, bq24193::ChargeCurrentControl, 0xFC, bq24193::EncodeFastChargeCurrentLimit(ma));
R_RETURN(ReadWriteRegister(m_i2c_session, bq24193::ChargeCurrentControl, 0xFC, bq24193::EncodeFastChargeCurrentLimit(ma)));
}
Result Bq24193Driver::GetChargeVoltageLimit(int *out_mv) {
@@ -322,11 +322,11 @@ namespace ams::powctl::impl::board::nintendo::nx {
}
Result Bq24193Driver::SetChargeVoltageLimit(int mv) {
return ReadWriteRegister(m_i2c_session, bq24193::ChargeVoltageControl, 0xFC, bq24193::EncodeChargeVoltageLimit(mv));
R_RETURN(ReadWriteRegister(m_i2c_session, bq24193::ChargeVoltageControl, 0xFC, bq24193::EncodeChargeVoltageLimit(mv)));
}
Result Bq24193Driver::SetChargerConfiguration(bq24193::ChargerConfiguration cfg) {
return ReadWriteRegister(m_i2c_session, bq24193::PowerOnConfiguration, 0x30, bq24193::EncodeChargerConfiguration(cfg));
R_RETURN(ReadWriteRegister(m_i2c_session, bq24193::PowerOnConfiguration, 0x30, bq24193::EncodeChargerConfiguration(cfg)));
}
Result Bq24193Driver::IsHiZEnabled(bool *out) {
@@ -340,7 +340,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
}
Result Bq24193Driver::SetHiZEnabled(bool en) {
return ReadWriteRegister(m_i2c_session, bq24193::InputSourceControl, 0x80, en ? 0x80 : 0x00);
R_RETURN(ReadWriteRegister(m_i2c_session, bq24193::InputSourceControl, 0x80, en ? 0x80 : 0x00));
}
Result Bq24193Driver::GetInputCurrentLimit(int *out_ma) {
@@ -354,15 +354,15 @@ namespace ams::powctl::impl::board::nintendo::nx {
}
Result Bq24193Driver::SetInputCurrentLimit(int ma) {
return ReadWriteRegister(m_i2c_session, bq24193::InputSourceControl, 0x07, bq24193::EncodeInputCurrentLimit(ma));
R_RETURN(ReadWriteRegister(m_i2c_session, bq24193::InputSourceControl, 0x07, bq24193::EncodeInputCurrentLimit(ma)));
}
Result Bq24193Driver::SetInputVoltageLimit(int mv) {
return ReadWriteRegister(m_i2c_session, bq24193::InputSourceControl, 0x78, bq24193::EncodeInputVoltageLimit(mv));
R_RETURN(ReadWriteRegister(m_i2c_session, bq24193::InputSourceControl, 0x78, bq24193::EncodeInputVoltageLimit(mv)));
}
Result Bq24193Driver::SetBoostModeCurrentLimit(int ma) {
return ReadWriteRegister(m_i2c_session, bq24193::PowerOnConfiguration, 0x01, bq24193::EncodeBoostModeCurrentLimit(ma));
R_RETURN(ReadWriteRegister(m_i2c_session, bq24193::PowerOnConfiguration, 0x01, bq24193::EncodeBoostModeCurrentLimit(ma)));
}
Result Bq24193Driver::GetChargerStatus(bq24193::ChargerStatus *out) {
@@ -376,11 +376,11 @@ namespace ams::powctl::impl::board::nintendo::nx {
}
Result Bq24193Driver::ResetWatchdogTimer() {
return ReadWriteRegister(m_i2c_session, bq24193::PowerOnConfiguration, 0x40, 0x40);
R_RETURN(ReadWriteRegister(m_i2c_session, bq24193::PowerOnConfiguration, 0x40, 0x40));
}
Result Bq24193Driver::SetWatchdogTimerSetting(int seconds) {
return ReadWriteRegister(m_i2c_session, bq24193::ChargeTerminationTimerControl, 0x30, bq24193::EncodeWatchdogTimerSetting(seconds));
R_RETURN(ReadWriteRegister(m_i2c_session, bq24193::ChargeTerminationTimerControl, 0x30, bq24193::EncodeWatchdogTimerSetting(seconds)));
}
Result Bq24193Driver::GetBatteryCompensation(int *out_mo) {
@@ -394,7 +394,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
}
Result Bq24193Driver::SetBatteryCompensation(int mo) {
return ReadWriteRegister(m_i2c_session, bq24193::IrCompensationThermalRegulationControl, 0xE0, bq24193::EncodeBatteryCompensation(mo));
R_RETURN(ReadWriteRegister(m_i2c_session, bq24193::IrCompensationThermalRegulationControl, 0xE0, bq24193::EncodeBatteryCompensation(mo)));
}
Result Bq24193Driver::GetVoltageClamp(int *out_mv) {
@@ -408,7 +408,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
}
Result Bq24193Driver::SetVoltageClamp(int mv) {
return ReadWriteRegister(m_i2c_session, bq24193::IrCompensationThermalRegulationControl, 0x1C, bq24193::EncodeVoltageClamp(mv));
R_RETURN(ReadWriteRegister(m_i2c_session, bq24193::IrCompensationThermalRegulationControl, 0x1C, bq24193::EncodeVoltageClamp(mv)));
}
}

View File

@@ -175,11 +175,11 @@ namespace ams::powctl::impl::board::nintendo::nx {
}
ALWAYS_INLINE Result ReadRegister(const i2c::I2cSession &session, u8 address, u16 *out) {
return i2c::ReadSingleRegister(session, address, out);
R_RETURN(i2c::ReadSingleRegister(session, address, out));
}
ALWAYS_INLINE Result WriteRegister(const i2c::I2cSession &session, u8 address, u16 val) {
return i2c::WriteSingleRegister(session, address, val);
R_RETURN(i2c::WriteSingleRegister(session, address, val));
}
ALWAYS_INLINE bool WriteValidateRegister(const i2c::I2cSession &session, u8 address, u16 val) {
@@ -364,15 +364,15 @@ namespace ams::powctl::impl::board::nintendo::nx {
}
Result Max17050Driver::SetMaximumShutdownTimerThreshold() {
return WriteRegister(m_i2c_session, max17050::ShdnTimer, 0xE000);
R_RETURN(WriteRegister(m_i2c_session, max17050::ShdnTimer, 0xE000));
}
Result Max17050Driver::SetAlertByChargePercentage() {
return ReadWriteRegister(m_i2c_session, max17050::MiscCfg, 0x0003, 0x0000);
R_RETURN(ReadWriteRegister(m_i2c_session, max17050::MiscCfg, 0x0003, 0x0000));
}
Result Max17050Driver::SetAlertByVoltageFuelGaugePercentage() {
return ReadWriteRegister(m_i2c_session, max17050::MiscCfg, 0x0003, 0x0003);
R_RETURN(ReadWriteRegister(m_i2c_session, max17050::MiscCfg, 0x0003, 0x0003));
}
bool Max17050Driver::IsPowerOnReset() {
@@ -385,11 +385,11 @@ namespace ams::powctl::impl::board::nintendo::nx {
}
Result Max17050Driver::LockVoltageFuelGauge() {
return WriteRegister(m_i2c_session, max17050::SocVfAccess, 0x0000);
R_RETURN(WriteRegister(m_i2c_session, max17050::SocVfAccess, 0x0000));
}
Result Max17050Driver::UnlockVoltageFuelGauge() {
return WriteRegister(m_i2c_session, max17050::SocVfAccess, 0x0080);
R_RETURN(WriteRegister(m_i2c_session, max17050::SocVfAccess, 0x0080));
}
Result Max17050Driver::LockModelTable() {
@@ -541,22 +541,22 @@ namespace ams::powctl::impl::board::nintendo::nx {
Result Max17050Driver::SetChargePercentageMinimumAlertThreshold(int percentage) {
R_TRY(this->SetAlertByChargePercentage());
return ReadWriteRegister(m_i2c_session, max17050::SocAlrtThreshold, 0x00FF, static_cast<u8>(percentage));
R_RETURN(ReadWriteRegister(m_i2c_session, max17050::SocAlrtThreshold, 0x00FF, static_cast<u8>(percentage)));
}
Result Max17050Driver::SetChargePercentageMaximumAlertThreshold(int percentage) {
R_TRY(this->SetAlertByChargePercentage());
return ReadWriteRegister(m_i2c_session, max17050::SocAlrtThreshold, 0xFF00, static_cast<u16>(static_cast<u8>(percentage)) << 8);
R_RETURN(ReadWriteRegister(m_i2c_session, max17050::SocAlrtThreshold, 0xFF00, static_cast<u16>(static_cast<u8>(percentage)) << 8));
}
Result Max17050Driver::SetVoltageFuelGaugePercentageMinimumAlertThreshold(int percentage) {
R_TRY(this->SetAlertByVoltageFuelGaugePercentage());
return ReadWriteRegister(m_i2c_session, max17050::SocAlrtThreshold, 0x00FF, static_cast<u8>(percentage));
R_RETURN(ReadWriteRegister(m_i2c_session, max17050::SocAlrtThreshold, 0x00FF, static_cast<u8>(percentage)));
}
Result Max17050Driver::SetVoltageFuelGaugePercentageMaximumAlertThreshold(int percentage) {
R_TRY(this->SetAlertByVoltageFuelGaugePercentage());
return ReadWriteRegister(m_i2c_session, max17050::SocAlrtThreshold, 0xFF00, static_cast<u16>(static_cast<u8>(percentage)) << 8);
R_RETURN(ReadWriteRegister(m_i2c_session, max17050::SocAlrtThreshold, 0xFF00, static_cast<u16>(static_cast<u8>(percentage)) << 8));
}
Result Max17050Driver::SetFullChargeThreshold(double percentage) {
@@ -564,7 +564,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
const u16 val = static_cast<u16>(static_cast<s16>(percentage * (1 << 8)));
/* Set the threshold. */
return WriteRegister(m_i2c_session, max17050::FullSocThr, val);
R_RETURN(WriteRegister(m_i2c_session, max17050::FullSocThr, val));
}
Result Max17050Driver::GetAverageCurrent(double *out, double sense_resistor) {
@@ -610,7 +610,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
}
Result Max17050Driver::SetNeedToRestoreParameters(bool en) {
return ReadWriteRegister(m_i2c_session, max17050::MiscCfg, 0x8000, en ? 0x8000 : 0);
R_RETURN(ReadWriteRegister(m_i2c_session, max17050::MiscCfg, 0x8000, en ? 0x8000 : 0));
}
Result Max17050Driver::IsI2cShutdownEnabled(bool *out) {
@@ -624,14 +624,14 @@ namespace ams::powctl::impl::board::nintendo::nx {
}
Result Max17050Driver::SetI2cShutdownEnabled(bool en) {
return ReadWriteRegister(m_i2c_session, max17050::Config, 0x0040, en ? 0x0040 : 0);
R_RETURN(ReadWriteRegister(m_i2c_session, max17050::Config, 0x0040, en ? 0x0040 : 0));
}
Result Max17050Driver::GetStatus(u16 *out) {
/* Validate parameters. */
AMS_ABORT_UNLESS(out != nullptr);
return ReadRegister(m_i2c_session, max17050::Status, out);
R_RETURN(ReadRegister(m_i2c_session, max17050::Status, out));
}
Result Max17050Driver::GetCycles(u16 *out) {
@@ -645,7 +645,7 @@ namespace ams::powctl::impl::board::nintendo::nx {
}
Result Max17050Driver::ResetCycles() {
return WriteRegister(m_i2c_session, max17050::Cycles, 0x0060);
R_RETURN(WriteRegister(m_i2c_session, max17050::Cycles, 0x0060));
}
Result Max17050Driver::GetAge(double *out) {
@@ -688,11 +688,11 @@ namespace ams::powctl::impl::board::nintendo::nx {
}
Result Max17050Driver::SetTemperatureMinimumAlertThreshold(int c) {
return ReadWriteRegister(m_i2c_session, max17050::TAlrtThreshold, 0x00FF, static_cast<u8>(c));
R_RETURN(ReadWriteRegister(m_i2c_session, max17050::TAlrtThreshold, 0x00FF, static_cast<u8>(c)));
}
Result Max17050Driver::SetTemperatureMaximumAlertThreshold(int c) {
return ReadWriteRegister(m_i2c_session, max17050::TAlrtThreshold, 0xFF00, static_cast<u16>(static_cast<u8>(c)) << 8);
R_RETURN(ReadWriteRegister(m_i2c_session, max17050::TAlrtThreshold, 0xFF00, static_cast<u16>(static_cast<u8>(c)) << 8));
}
Result Max17050Driver::GetVCell(int *out) {
@@ -748,11 +748,11 @@ namespace ams::powctl::impl::board::nintendo::nx {
}
Result Max17050Driver::SetVoltageMinimumAlertThreshold(int mv) {
return ReadWriteRegister(m_i2c_session, max17050::VAlrtThreshold, 0x00FF, static_cast<u8>(util::DivideUp(mv, 20)));
R_RETURN(ReadWriteRegister(m_i2c_session, max17050::VAlrtThreshold, 0x00FF, static_cast<u8>(util::DivideUp(mv, 20))));
}
Result Max17050Driver::SetVoltageMaximumAlertThreshold(int mv) {
return ReadWriteRegister(m_i2c_session, max17050::VAlrtThreshold, 0xFF00, static_cast<u16>(static_cast<u8>(mv / 20)) << 8);
R_RETURN(ReadWriteRegister(m_i2c_session, max17050::VAlrtThreshold, 0xFF00, static_cast<u16>(static_cast<u8>(mv / 20)) << 8));
}
}

View File

@@ -41,7 +41,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryChargePercentage(out_percent, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryChargePercentage(out_percent, std::addressof(device)));
}
Result GetBatteryVoltageFuelGaugePercentage(float *out_percent, Session &session) {
@@ -55,7 +55,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryVoltageFuelGaugePercentage(out_percent, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryVoltageFuelGaugePercentage(out_percent, std::addressof(device)));
}
Result GetBatteryFullCapacity(int *out_mah, Session &session) {
@@ -69,7 +69,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryFullCapacity(out_mah, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryFullCapacity(out_mah, std::addressof(device)));
}
Result GetBatteryRemainingCapacity(int *out_mah, Session &session) {
@@ -83,7 +83,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryRemainingCapacity(out_mah, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryRemainingCapacity(out_mah, std::addressof(device)));
}
Result SetBatteryChargePercentageMinimumAlertThreshold(Session &session, float percentage) {
@@ -97,7 +97,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryChargePercentageMinimumAlertThreshold(std::addressof(device), percentage);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryChargePercentageMinimumAlertThreshold(std::addressof(device), percentage));
}
Result SetBatteryChargePercentageMaximumAlertThreshold(Session &session, float percentage) {
@@ -111,7 +111,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryChargePercentageMaximumAlertThreshold(std::addressof(device), percentage);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryChargePercentageMaximumAlertThreshold(std::addressof(device), percentage));
}
Result SetBatteryVoltageFuelGaugePercentageMinimumAlertThreshold(Session &session, float percentage) {
@@ -125,7 +125,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryVoltageFuelGaugePercentageMinimumAlertThreshold(std::addressof(device), percentage);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryVoltageFuelGaugePercentageMinimumAlertThreshold(std::addressof(device), percentage));
}
Result SetBatteryVoltageFuelGaugePercentageMaximumAlertThreshold(Session &session, float percentage) {
@@ -139,7 +139,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryVoltageFuelGaugePercentageMaximumAlertThreshold(std::addressof(device), percentage);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryVoltageFuelGaugePercentageMaximumAlertThreshold(std::addressof(device), percentage));
}
Result SetBatteryFullChargeThreshold(Session &session, float percentage) {
@@ -153,7 +153,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryFullChargeThreshold(std::addressof(device), percentage);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryFullChargeThreshold(std::addressof(device), percentage));
}
Result GetBatteryAverageCurrent(int *out_ma, Session &session) {
@@ -167,7 +167,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryAverageCurrent(out_ma, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryAverageCurrent(out_ma, std::addressof(device)));
}
Result GetBatteryCurrent(int *out_ma, Session &session) {
@@ -181,7 +181,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryCurrent(out_ma, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryCurrent(out_ma, std::addressof(device)));
}
Result GetBatteryInternalState(void *dst, size_t *out_size, Session &session, size_t dst_size) {
@@ -195,7 +195,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryInternalState(dst, out_size, std::addressof(device), dst_size);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryInternalState(dst, out_size, std::addressof(device), dst_size));
}
Result SetBatteryInternalState(Session &session, const void *src, size_t src_size) {
@@ -209,7 +209,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryInternalState(std::addressof(device), src, src_size);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryInternalState(std::addressof(device), src, src_size));
}
Result GetBatteryNeedToRestoreParameters(bool *out, Session &session) {
@@ -223,7 +223,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryNeedToRestoreParameters(out, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryNeedToRestoreParameters(out, std::addressof(device)));
}
Result SetBatteryNeedToRestoreParameters(Session &session, bool en) {
@@ -237,7 +237,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryNeedToRestoreParameters(std::addressof(device), en);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryNeedToRestoreParameters(std::addressof(device), en));
}
Result IsBatteryI2cShutdownEnabled(bool *out, Session &session) {
@@ -251,7 +251,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().IsBatteryI2cShutdownEnabled(out, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().IsBatteryI2cShutdownEnabled(out, std::addressof(device)));
}
Result SetBatteryI2cShutdownEnabled(Session &session, bool en) {
@@ -265,7 +265,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryI2cShutdownEnabled(std::addressof(device), en);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryI2cShutdownEnabled(std::addressof(device), en));
}
Result IsBatteryPresent(bool *out, Session &session) {
@@ -279,7 +279,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().IsBatteryPresent(out, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().IsBatteryPresent(out, std::addressof(device)));
}
Result GetBatteryCycles(int *out, Session &session) {
@@ -293,7 +293,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryCycles(out, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryCycles(out, std::addressof(device)));
}
Result SetBatteryCycles(Session &session, int cycles) {
@@ -307,7 +307,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryCycles(std::addressof(device), cycles);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryCycles(std::addressof(device), cycles));
}
Result GetBatteryAge(float *out_percent, Session &session) {
@@ -321,7 +321,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryAge(out_percent, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryAge(out_percent, std::addressof(device)));
}
Result GetBatteryTemperature(float *out_c, Session &session) {
@@ -335,7 +335,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryTemperature(out_c, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryTemperature(out_c, std::addressof(device)));
}
Result GetBatteryMaximumTemperature(float *out_c, Session &session) {
@@ -349,7 +349,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryMaximumTemperature(out_c, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryMaximumTemperature(out_c, std::addressof(device)));
}
Result SetBatteryTemperatureMinimumAlertThreshold(Session &session, float c) {
@@ -363,7 +363,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryTemperatureMinimumAlertThreshold(std::addressof(device), c);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryTemperatureMinimumAlertThreshold(std::addressof(device), c));
}
Result SetBatteryTemperatureMaximumAlertThreshold(Session &session, float c) {
@@ -377,7 +377,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryTemperatureMaximumAlertThreshold(std::addressof(device), c);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryTemperatureMaximumAlertThreshold(std::addressof(device), c));
}
Result GetBatteryVCell(int *out_mv, Session &session) {
@@ -391,7 +391,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryVCell(out_mv, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryVCell(out_mv, std::addressof(device)));
}
Result GetBatteryAverageVCell(int *out_mv, Session &session) {
@@ -405,7 +405,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryAverageVCell(out_mv, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryAverageVCell(out_mv, std::addressof(device)));
}
Result GetBatteryAverageVCellTime(TimeSpan *out, Session &session) {
@@ -419,7 +419,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryAverageVCellTime(out, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryAverageVCellTime(out, std::addressof(device)));
}
Result GetBatteryOpenCircuitVoltage(int *out_mv, Session &session) {
@@ -433,7 +433,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryOpenCircuitVoltage(out_mv, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetBatteryOpenCircuitVoltage(out_mv, std::addressof(device)));
}
Result SetBatteryVoltageMinimumAlertThreshold(Session &session, int mv) {
@@ -447,7 +447,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryVoltageMinimumAlertThreshold(std::addressof(device), mv);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryVoltageMinimumAlertThreshold(std::addressof(device), mv));
}
Result SetBatteryVoltageMaximumAlertThreshold(Session &session, int mv) {
@@ -461,7 +461,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryVoltageMaximumAlertThreshold(std::addressof(device), mv);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetBatteryVoltageMaximumAlertThreshold(std::addressof(device), mv));
}
}

View File

@@ -41,7 +41,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetChargerChargeCurrentState(out, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetChargerChargeCurrentState(out, std::addressof(device)));
}
Result SetChargerChargeCurrentState(Session &session, ChargeCurrentState state) {
@@ -55,7 +55,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetChargerChargeCurrentState(std::addressof(device), state);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetChargerChargeCurrentState(std::addressof(device), state));
}
Result GetChargerFastChargeCurrentLimit(int *out_ma, Session &session) {
@@ -69,7 +69,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetChargerFastChargeCurrentLimit(out_ma, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetChargerFastChargeCurrentLimit(out_ma, std::addressof(device)));
}
Result SetChargerFastChargeCurrentLimit(Session &session, int ma) {
@@ -83,7 +83,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetChargerFastChargeCurrentLimit(std::addressof(device), ma);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetChargerFastChargeCurrentLimit(std::addressof(device), ma));
}
Result GetChargerChargeVoltageLimit(int *out_mv, Session &session) {
@@ -97,7 +97,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetChargerChargeVoltageLimit(out_mv, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetChargerChargeVoltageLimit(out_mv, std::addressof(device)));
}
Result SetChargerChargeVoltageLimit(Session &session, int mv) {
@@ -111,7 +111,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetChargerChargeVoltageLimit(std::addressof(device), mv);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetChargerChargeVoltageLimit(std::addressof(device), mv));
}
Result SetChargerChargerConfiguration(Session &session, ChargerConfiguration cfg) {
@@ -125,7 +125,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetChargerChargerConfiguration(std::addressof(device), cfg);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetChargerChargerConfiguration(std::addressof(device), cfg));
}
Result IsChargerHiZEnabled(bool *out, Session &session) {
@@ -139,7 +139,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().IsChargerHiZEnabled(out, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().IsChargerHiZEnabled(out, std::addressof(device)));
}
Result SetChargerHiZEnabled(Session &session, bool en) {
@@ -153,7 +153,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetChargerHiZEnabled(std::addressof(device), en);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetChargerHiZEnabled(std::addressof(device), en));
}
Result GetChargerInputCurrentLimit(int *out_ma, Session &session) {
@@ -167,7 +167,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetChargerInputCurrentLimit(out_ma, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetChargerInputCurrentLimit(out_ma, std::addressof(device)));
}
Result SetChargerInputCurrentLimit(Session &session, int ma) {
@@ -181,7 +181,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetChargerInputCurrentLimit(std::addressof(device), ma);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetChargerInputCurrentLimit(std::addressof(device), ma));
}
Result SetChargerInputVoltageLimit(Session &session, int mv) {
@@ -195,7 +195,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetChargerInputVoltageLimit(std::addressof(device), mv);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetChargerInputVoltageLimit(std::addressof(device), mv));
}
Result SetChargerBoostModeCurrentLimit(Session &session, int ma) {
@@ -209,7 +209,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetChargerBoostModeCurrentLimit(std::addressof(device), ma);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetChargerBoostModeCurrentLimit(std::addressof(device), ma));
}
Result GetChargerChargerStatus(ChargerStatus *out, Session &session) {
@@ -223,7 +223,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetChargerChargerStatus(out, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetChargerChargerStatus(out, std::addressof(device)));
}
Result IsChargerWatchdogTimerEnabled(bool *out, Session &session) {
@@ -237,7 +237,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().IsChargerWatchdogTimerEnabled(out, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().IsChargerWatchdogTimerEnabled(out, std::addressof(device)));
}
Result SetChargerWatchdogTimerEnabled(Session &session, bool en) {
@@ -251,7 +251,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetChargerWatchdogTimerEnabled(std::addressof(device), en);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetChargerWatchdogTimerEnabled(std::addressof(device), en));
}
Result SetChargerWatchdogTimerTimeout(Session &session, TimeSpan timeout) {
@@ -265,7 +265,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetChargerWatchdogTimerTimeout(std::addressof(device), timeout);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetChargerWatchdogTimerTimeout(std::addressof(device), timeout));
}
Result ResetChargerWatchdogTimer(Session &session);
@@ -281,7 +281,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetChargerBatteryCompensation(out_mo, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetChargerBatteryCompensation(out_mo, std::addressof(device)));
}
Result SetChargerBatteryCompensation(Session &session, int mo) {
@@ -295,7 +295,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetChargerBatteryCompensation(std::addressof(device), mo);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetChargerBatteryCompensation(std::addressof(device), mo));
}
Result GetChargerVoltageClamp(int *out_mv, Session &session) {
@@ -309,7 +309,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetChargerVoltageClamp(out_mv, std::addressof(device));
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetChargerVoltageClamp(out_mv, std::addressof(device)));
}
Result SetChargerVoltageClamp(Session &session, int mv) {
@@ -323,7 +323,7 @@ namespace ams::powctl {
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetChargerVoltageClamp(std::addressof(device), mv);
R_RETURN(device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetChargerVoltageClamp(std::addressof(device), mv));
}
}