9#include "../sf/service.h"
10#include "../kernel/event.h"
22 PsmVdd50State_Unknown = 0,
23 PsmVdd50State_Vdd50AOffVdd50BOff = 1,
24 PsmVdd50State_Vdd50AOnVdd50BOff = 2,
25 PsmVdd50State_Vdd50AOffVdd50BOn = 3,
38 u32 input_current_limit;
39 u32 boost_mode_current_limit;
40 u32 fast_charge_current_limit;
41 u32 charge_voltage_limit;
44 bool battery_charging;
47 u32 temperature_celcius;
48 u32 battery_charge_percentage;
49 u32 battery_charge_milli_voltage;
50 u32 battery_age_percentage;
53 u32 charger_input_voltage_limit;
54 u32 charger_input_current_limit;
55 bool fast_battery_charging;
56 bool controller_power_supply;
69 bool battery_charging;
80 bool fast_battery_charging;
81 bool controller_power_supply;
Service * psmGetServiceSession(void)
Gets the Service object for the actual psm service session.
Result psmGetBatteryChargeInfoFields(PsmBatteryChargeInfoFields *out_fields)
GetBatteryChargeInfoFields.
PsmBatteryVoltageState
BatteryVoltageState.
Definition psm.h:29
@ PsmBatteryVoltageState_NeedsShutdown
Power state should transition to shutdown.
Definition psm.h:30
@ PsmBatteryVoltageState_NeedsSleep
Power state should transition to sleep.
Definition psm.h:31
@ PsmBatteryVoltageState_Normal
Everything is normal.
Definition psm.h:33
@ PsmBatteryVoltageState_NoPerformanceBoost
Performance boost modes cannot be entered.
Definition psm.h:32
Result psmGetBatteryChargePercentage(u32 *out)
GetBatteryChargePercentage.
Result psmGetBatteryChargeCalibratedEvent(Event *out_event, bool autoclear)
GetBatteryChargeCalibratedEvent.
Result psmEnableEnoughPowerChargeEmulation(void)
EnableEnoughPowerChargeEmulation.
Result psmEnableBatteryCharging(void)
EnableBatteryCharging.
Result psmIsBatteryChargingEnabled(bool *out)
IsBatteryChargingEnabled.
Result psmGetBatteryChargeInfoEvent(Event *out_event, bool autoclear)
GetBatteryChargeInfoEvent.
Result psmGetRawBatteryChargePercentage(double *out)
GetRawBatteryChargePercentage.
Result psmDisableBatteryCharging(void)
DisableBatteryCharging.
Result psmDisableFastBatteryCharging(void)
DisableFastBatteryCharging.
Result psmUnbindStateChangeEvent(PsmSession *s)
Cleanup version of psmBindStateChangeEvent. Must be called by the user once the PsmSession is done be...
PsmVdd50State
Vdd50State.
Definition psm.h:21
Result psmIsEnoughPowerSupplied(bool *out)
IsEnoughPowerSupplied.
void psmExit(void)
Exit psm.
Result psmDisableEnoughPowerChargeEmulation(void)
DisableEnoughPowerChargeEmulation.
Result psmEnableFastBatteryCharging(void)
EnableFastBatteryCharging.
PsmChargerType
ChargerType.
Definition psm.h:13
@ PsmChargerType_NotSupported
No common supported USB-PD modes.
Definition psm.h:17
@ PsmChargerType_LowPower
Lower power supported USB-PD mode.
Definition psm.h:16
@ PsmChargerType_Unconnected
No charger.
Definition psm.h:14
@ PsmChargerType_EnoughPower
Full supported power.
Definition psm.h:15
Result psmGetBatteryAgePercentage(double *out)
GetBatteryAgePercentage.
Result psmReleaseControllerPowerSupply(void)
ReleaseControllerPowerSupply.
Result psmWaitStateChangeEvent(PsmSession *s, u64 timeout)
Wait on the Event setup by psmBindStateChangeEvent.
Result psmAcquireControllerPowerSupply(void)
AcquireControllerPowerSupply.
Result psmInitialize(void)
Initialize psm.
Result psmGetBatteryVoltageState(PsmBatteryVoltageState *out)
GetBatteryVoltageState.
Result psmBindStateChangeEvent(PsmSession *s, bool ChargerType, bool PowerSupply, bool BatteryVoltage)
Wrapper func which opens a PsmSession and handles event setup.
Result psmGetChargerType(PsmChargerType *out)
GetChargerType.
Kernel-mode event structure.
Definition event.h:13
BatteryChargeInfoFieldsOld [1.0.0-16.1.0].
Definition psm.h:37
BatteryChargeInfoFields [17.0.0+].
Definition psm.h:62
u32 input_current_limit
Input (Sink) current limit in mA.
Definition psm.h:63
u32 charger_input_current_limit
Charger and external device current limit in mA.
Definition psm.h:79
u32 boost_mode_current_limit
Output (Source/VBUS/OTG) current limit in mA.
Definition psm.h:64
u32 battery_age_percentage
Battery age per cent-mille.
Definition psm.h:75
u32 battery_charge_percentage
Raw battery charged capacity per cent-mille.
Definition psm.h:73
PsmVdd50State vdd50_state
Power Delivery Controller State.
Definition psm.h:71
u32 battery_charge_milli_voltage
Voltage average in mV.
Definition psm.h:74
u32 fast_charge_current_limit
Battery charging current limit in mA.
Definition psm.h:65
u32 charger_input_voltage_limit
Charger and external device voltage limit in mV.
Definition psm.h:78
u32 charge_voltage_limit
Battery charging voltage limit in mV.
Definition psm.h:66
u32 temperature_celcius
Battery temperature in milli C.
Definition psm.h:72
IPsmSession.
Definition psm.h:88
Event StateChangeEvent
autoclear=false
Definition psm.h:90
Service object structure.
Definition service.h:14
uint64_t u64
64-bit unsigned integer.
Definition types.h:22
uint8_t u8
8-bit unsigned integer.
Definition types.h:19
u32 Result
Function error code result type.
Definition types.h:44
uint32_t u32
32-bit unsigned integer.
Definition types.h:21