mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-27 21:24:11 -04:00
powctl: implement full bq24193 driver
This commit is contained in:
parent
7c58a21c4c
commit
a20f278ede
8 changed files with 330 additions and 80 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue