powctl: implement full bq24193 driver

This commit is contained in:
Michael Scire 2020-11-09 21:50:41 -08:00 committed by SciresM
parent 7c58a21c4c
commit a20f278ede
8 changed files with 330 additions and 80 deletions

View file

@ -184,20 +184,6 @@ namespace ams::powctl {
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetChargerInputCurrentLimit(std::addressof(device), ma);
}
Result GetChargerInputVoltageLimit(int *out_mv, Session &session) {
/* Get the session impl. */
auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Read));
/* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().GetChargerInputVoltageLimit(out_mv, std::addressof(device));
}
Result SetChargerInputVoltageLimit(Session &session, int mv) {
/* Get the session impl. */
auto &impl = GetOpenSessionImpl(session);
@ -212,6 +198,20 @@ namespace ams::powctl {
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetChargerInputVoltageLimit(std::addressof(device), mv);
}
Result SetChargerBoostModeCurrentLimit(Session &session, int ma) {
/* Get the session impl. */
auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Write));
/* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
/* Call into the driver. */
return device.GetDriver().SafeCastTo<impl::IPowerControlDriver>().SetChargerBoostModeCurrentLimit(std::addressof(device), ma);
}
Result GetChargerChargerStatus(ChargerStatus *out, Session &session) {
/* Get the session impl. */
auto &impl = GetOpenSessionImpl(session);