PF1550 Driver 0.1.0
API reference
Loading...
Searching...
No Matches
pf1550_types.hpp
Go to the documentation of this file.
1
13#ifndef PF1550_TYPES_HPP
14#define PF1550_TYPES_HPP
15
16#include <array>
17#include <cstddef>
18#include <cstdint>
19
20#include "pf1550_detail.hpp"
21#include "pf1550_version.h"
22
24namespace pf1550 {
25
38enum class [[nodiscard]] Error : uint8_t {
39 // Base set: the same names and values in every driver of the org (standards/driver.md).
40 Ok = 0,
41 NotInitialized = 1,
42 InvalidArgument = 2,
44 Bus = 3,
45 Timeout = 4,
47 Crc = 6,
48 Busy = 7,
49 DeviceFault = 8,
50 Unsupported = 9,
51 // Chip-specific values start at 16; each one is returned by some call (tests/test_errors.cpp).
52 OutOfLimits = 16,
53 ReadOnlyRail = 17,
54 Unsafe = 18,
55 Refused = 19,
56 ChargerFault = 20,
57 VerifyFailed = 21,
58 NoDevice = 22,
59 DeviceReset = 23,
61};
62
68constexpr const char* ToString(Error error) noexcept {
69 switch (error) {
70 case Error::Ok:
71 return "Ok";
73 return "NotInitialized";
75 return "InvalidArgument";
76 case Error::Bus:
77 return "Bus";
78 case Error::Timeout:
79 return "Timeout";
81 return "DeviceIdMismatch";
82 case Error::Crc:
83 return "Crc";
84 case Error::Busy:
85 return "Busy";
87 return "DeviceFault";
89 return "Unsupported";
91 return "OutOfLimits";
93 return "ReadOnlyRail";
94 case Error::Unsafe:
95 return "Unsafe";
96 case Error::Refused:
97 return "Refused";
99 return "ChargerFault";
101 return "VerifyFailed";
102 case Error::NoDevice:
103 return "NoDevice";
105 return "DeviceReset";
106 default:
107 break;
108 }
109 return "Unknown";
110}
111
122template <typename T>
123struct [[nodiscard]] Result {
124 T value{};
125 Error error{Error::Ok};
126
128 [[nodiscard]] constexpr bool ok() const noexcept {
129 return error == Error::Ok;
130 }
132 constexpr explicit operator bool() const noexcept {
133 return ok();
134 }
135
141 static constexpr Result Success(T v) noexcept {
142 return {v, Error::Ok};
143 }
149 static constexpr Result Failure(Error e) noexcept {
150 return {T{}, e};
151 }
152};
153
155template <>
156struct [[nodiscard]] Result<void> {
157 Error error{Error::Ok};
158
160 [[nodiscard]] constexpr bool ok() const noexcept {
161 return error == Error::Ok;
162 }
164 constexpr explicit operator bool() const noexcept {
165 return ok();
166 }
167
169 static constexpr Result Success() noexcept {
170 return {Error::Ok};
171 }
177 static constexpr Result Failure(Error e) noexcept {
178 return {e};
179 }
180};
181
183enum class LogLevel : uint8_t {
184 Error = 0,
185 Warning,
186 Info,
187 Debug,
188};
189
192 uint32_t value{0};
193};
194
200constexpr Microvolts FromMillivolts(uint32_t mv) noexcept {
201 return Microvolts{mv * 1000U};
202}
203
205inline constexpr uint8_t kDefaultAddress = 0x08;
207inline constexpr uint32_t kDvsWaitMaxUs = 256;
210inline constexpr uint32_t kWatchdogServiceMaxS = 16;
212inline constexpr std::size_t kIrqGroups = 8;
213
215enum class Option : uint8_t {
216 A0 = 0,
217 A1 = 1,
218 A2 = 2,
219 A3 = 3,
220 A4 = 4,
221 A5 = 5,
222 A6 = 6,
223 A7 = 7,
224 A8 = 8,
225 A9 = 9,
226 Unknown = 10,
227};
228
237
239enum class PowerState : uint8_t {
240 Wait = 0,
241 Run = 1,
242 Standby = 2,
243 Sleep = 3,
244 RegsDisable = 4,
245 Unknown = 5,
246};
247
249enum class Rail : uint8_t {
250 Sw1 = 0,
251 Sw2 = 1,
252 Sw3 = 2,
253 Ldo1 = 3,
254 Ldo2 = 4,
255 Ldo3 = 5,
256 VrefDdr = 6,
257};
259inline constexpr std::size_t kRailCount = 7;
260
262enum class Dvs : uint8_t {
263 Disabled = 0,
264 Enabled = 1,
265};
266
268enum class SwCurrentLimit : uint8_t {
269 A1p0 = 0,
270 A1p2 = 1,
271 A1p5 = 2,
272 A2p0 = 3,
273};
274
276enum class DvsSpeed : uint8_t {
277 Us2 = 0,
278 Us4 = 1,
279};
280
282enum class ChargerMode : uint8_t {
283 Off = 0,
284 LinearOnly = 1,
285 Charge = 2,
286};
287
289enum class FastChargeTimer : uint8_t {
290 Disabled = 0,
291 Hours2 = 1,
292 Hours4 = 2,
293 Hours6 = 3,
294 Hours8 = 4,
295 Hours10 = 5,
296 Hours12 = 6,
297 Hours14 = 7,
298};
299
301enum class EocTimer : uint8_t {
302 Debounce16s = 0,
303 Min10 = 1,
304 Min20 = 2,
305 Min30 = 3,
306 Min40 = 4,
307 Min50 = 5,
308 Min60 = 6,
309 Min70 = 7,
310};
311
313enum class PrechargeTimer : uint8_t {
314 Min30 = 0,
315 Min45 = 1,
316};
317
319enum class Restart : uint8_t {
320 Mv100 = 0,
321 Mv150 = 1,
322 Mv200 = 2,
323 Disabled = 3,
324};
325
327enum class SystemMin : uint8_t {
328 Mv3500 = 0,
329 Mv3700 = 1,
330 Mv4300 = 2,
331};
332
334enum class Thermistor : uint8_t {
335 Ignore = 0,
336 Suspend = 1,
337 Jeita1 = 2,
338 Jeita2 = 3,
339};
340
342enum class ThermalRegTemp : uint8_t {
343 C80 = 0,
344 C95 = 1,
345 C110 = 2,
346};
347
349enum class WatchdogTime : uint8_t {
350 S80 = 0,
351 S32 = 1,
352};
353
355enum class BatfetOc : uint8_t {
356 Disabled = 0,
357 A2p2 = 1,
358 A2p8 = 2,
359 A3p2 = 3,
360};
361
363enum class Cold : uint8_t { C0 = 0, CMinus10 = 1 };
365enum class Hot : uint8_t { C60 = 0, C55 = 1 };
367enum class Cool : uint8_t { C15 = 0, C10 = 1 };
369enum class Warm : uint8_t { C45 = 0, C50 = 1 };
370
372enum class CvAdjust : uint8_t { Mv60 = 0, Mv100 = 1, Mv160 = 2, Mv200 = 3 };
374enum class CcAdjust : uint8_t { Pct25 = 0, Pct50 = 1, Pct75 = 2, Pct100 = 3 };
375
377enum class DpmVoltage : uint8_t {
378 Mv3900 = 0,
379 Mv4000 = 1,
380 Mv4100 = 2,
381 Mv4200 = 3,
382 Mv4300 = 4,
383 Mv4400 = 5,
384 Mv4500 = 6,
385 Mv4600 = 7,
386};
387
389enum class DpmStop : uint8_t { Mv200 = 0, Mv250 = 1 };
390
392enum class ShortDebounce : uint8_t {
393 Us100 = 0,
394 Ms1 = 1,
395 Ms10 = 2,
396};
397
399enum class WakeupDelay : uint8_t { Ms8 = 0, Ms16 = 1, Ms32 = 2, Ms100 = 3 };
400
402enum class Vbus2SysThreshold : uint8_t { Mv50 = 0, Mv175 = 1 };
403
405enum class UsbPhyVoltage : uint8_t { V3p3 = 0, V4p9 = 1 };
406
408enum class LedFrequency : uint8_t { Hz1 = 0, Hz0p5 = 1, Hz256 = 2, Hz8 = 3 };
409
411enum class LedMode : uint8_t {
412 OnWhileCharging = 0,
414};
415
417enum class StandbyDelay : uint8_t { None = 0, Cycles1 = 1, Cycles2 = 2, Cycles3 = 3 };
418
420enum class Debounce : uint8_t {
421 Ms31 = 0,
422 Ms125 = 1,
423 Ms750 = 2,
424};
425
427enum class GlobalReset : uint8_t { S4 = 0, S8 = 1, S12 = 2, S16 = 3 };
428
430enum class Uvdet : uint8_t { Mv2650 = 0, Mv2800 = 1, Mv3000 = 2, Mv3100 = 3 };
431
433enum class LowSysWarn : uint8_t { Mv3300 = 0, Mv3500 = 1, Mv3700 = 2, Mv3900 = 3 };
434
436enum class AsFoundPolicy : uint8_t {
437 Report = 0,
438 MakeSafe = 1,
439};
440
442enum class ChargerState : uint8_t {
443 Precharge = 0,
444 FastChargeCc = 1,
445 FastChargeCv = 2,
446 EndOfCharge = 3,
447 Done = 4,
448 TimerFault = 6,
450 Off = 8,
452 ThermalShutdown = 10,
453 LinearOnly = 12,
454 Unknown = 255,
455};
456
458enum class BatteryState : uint8_t {
459 NoValidVbus = 0,
460 BelowPrecharge = 1,
462 AbovePrecharge = 4,
463 Overvoltage = 5,
464 NotDetected = 6,
465 Unknown = 255,
466};
467
469enum class Fault : uint8_t {
470 None = 0,
471 TimerFault = 1,
473 ThermalShutdown = 3,
476 WatchdogExpired = 6,
477 BatteryMissing = 7,
478 UnknownState = 8,
479};
480
482struct VbusFlags {
483 bool valid{false};
484 bool ovlo{false};
485 bool uvlo{false};
486 bool in2sys{false};
487 bool dpm{false};
488};
489
502
504enum class IrqGroup : uint8_t {
505 Charger = 0,
506 SwLowSide = 1,
507 SwHighSide = 2,
508 SwDvs = 3,
509 Ldo = 4,
510 Temp = 5,
511 Onkey = 6,
512 Misc = 7,
513};
514
550inline constexpr std::size_t kIrqSourceCount = 31;
551
556struct IrqMask {
557 std::array<uint8_t, kIrqGroups> masked{0xFF, 0xFF, 0xFF, 0xFF,
558 0xFF, 0xFF, 0xFF, 0xFF};
559};
560
563 std::array<uint8_t, kIrqGroups> status{};
564 uint8_t categories{0};
565 uint8_t passes{0};
566 bool fault_class{false};
567};
568
571 bool charger{false};
572 bool sw1{false};
573 bool sw2{false};
574 bool sw3{false};
575 bool ldo{false};
576 bool onkey{false};
577 bool temp{false};
578 bool misc{false};
579};
580
585 std::array<uint8_t, kRailCount> order{};
586};
587
590 bool enabled_run{false};
591 bool enabled_standby{false};
592 bool enabled_sleep{false};
593 bool low_power{false};
594 bool load_switch{false};
596};
597
611
613struct Snapshot {
617 std::array<uint8_t, kIrqGroups> sense{};
618 std::array<RailReadout, kRailCount> rails{};
620 uint8_t por_delay_code{0};
621};
622
625 bool identity_ok{false};
626 bool state_run{false};
628 bool no_latched_fault{false};
629 bool input_limit_ok{false};
630};
631
633struct ShipConfirm {};
642 uint32_t input_mv{0};
643};
644
645namespace detail {
647template <>
648struct EnumLast<Option> {
649 static constexpr Option kValue = Option::Unknown;
650};
652template <>
653struct EnumLast<Rail> {
654 static constexpr Rail kValue = Rail::VrefDdr;
655};
657template <>
658struct EnumLast<Dvs> {
659 static constexpr Dvs kValue = Dvs::Enabled;
660};
662template <>
663struct EnumLast<SwCurrentLimit> {
664 static constexpr SwCurrentLimit kValue = SwCurrentLimit::A2p0;
665};
667template <>
668struct EnumLast<DvsSpeed> {
669 static constexpr DvsSpeed kValue = DvsSpeed::Us4;
670};
672template <>
673struct EnumLast<ChargerMode> {
674 static constexpr ChargerMode kValue = ChargerMode::Charge;
675};
677template <>
678struct EnumLast<FastChargeTimer> {
679 static constexpr FastChargeTimer kValue = FastChargeTimer::Hours14;
680};
682template <>
683struct EnumLast<EocTimer> {
684 static constexpr EocTimer kValue = EocTimer::Min70;
685};
687template <>
688struct EnumLast<PrechargeTimer> {
689 static constexpr PrechargeTimer kValue = PrechargeTimer::Min45;
690};
692template <>
693struct EnumLast<Restart> {
694 static constexpr Restart kValue = Restart::Disabled;
695};
697template <>
698struct EnumLast<SystemMin> {
699 static constexpr SystemMin kValue = SystemMin::Mv4300;
700};
702template <>
703struct EnumLast<Thermistor> {
704 static constexpr Thermistor kValue = Thermistor::Jeita2;
705};
707template <>
708struct EnumLast<ThermalRegTemp> {
709 static constexpr ThermalRegTemp kValue = ThermalRegTemp::C110;
710};
712template <>
713struct EnumLast<WatchdogTime> {
714 static constexpr WatchdogTime kValue = WatchdogTime::S32;
715};
717template <>
718struct EnumLast<BatfetOc> {
719 static constexpr BatfetOc kValue = BatfetOc::A3p2;
720};
722template <>
723struct EnumLast<Cold> {
724 static constexpr Cold kValue = Cold::CMinus10;
725};
727template <>
728struct EnumLast<Hot> {
729 static constexpr Hot kValue = Hot::C55;
730};
732template <>
733struct EnumLast<Cool> {
734 static constexpr Cool kValue = Cool::C10;
735};
737template <>
738struct EnumLast<Warm> {
739 static constexpr Warm kValue = Warm::C50;
740};
742template <>
743struct EnumLast<CvAdjust> {
744 static constexpr CvAdjust kValue = CvAdjust::Mv200;
745};
747template <>
748struct EnumLast<CcAdjust> {
749 static constexpr CcAdjust kValue = CcAdjust::Pct100;
750};
752template <>
753struct EnumLast<DpmVoltage> {
754 static constexpr DpmVoltage kValue = DpmVoltage::Mv4600;
755};
757template <>
758struct EnumLast<DpmStop> {
759 static constexpr DpmStop kValue = DpmStop::Mv250;
760};
762template <>
763struct EnumLast<ShortDebounce> {
764 static constexpr ShortDebounce kValue = ShortDebounce::Ms10;
765};
767template <>
768struct EnumLast<WakeupDelay> {
769 static constexpr WakeupDelay kValue = WakeupDelay::Ms100;
770};
772template <>
773struct EnumLast<Vbus2SysThreshold> {
774 static constexpr Vbus2SysThreshold kValue = Vbus2SysThreshold::Mv175;
775};
777template <>
778struct EnumLast<UsbPhyVoltage> {
779 static constexpr UsbPhyVoltage kValue = UsbPhyVoltage::V4p9;
780};
782template <>
783struct EnumLast<LedFrequency> {
784 static constexpr LedFrequency kValue = LedFrequency::Hz8;
785};
787template <>
788struct EnumLast<LedMode> {
789 static constexpr LedMode kValue = LedMode::FlashWhileCharging;
790};
792template <>
793struct EnumLast<StandbyDelay> {
794 static constexpr StandbyDelay kValue = StandbyDelay::Cycles3;
795};
797template <>
798struct EnumLast<Debounce> {
799 static constexpr Debounce kValue = Debounce::Ms750;
800};
802template <>
803struct EnumLast<GlobalReset> {
804 static constexpr GlobalReset kValue = GlobalReset::S16;
805};
807template <>
808struct EnumLast<Uvdet> {
809 static constexpr Uvdet kValue = Uvdet::Mv3100;
810};
812template <>
813struct EnumLast<LowSysWarn> {
814 static constexpr LowSysWarn kValue = LowSysWarn::Mv3900;
815};
817template <>
818struct EnumLast<IrqGroup> {
819 static constexpr IrqGroup kValue = IrqGroup::Misc;
820};
822template <>
823struct EnumLast<AsFoundPolicy> {
824 static constexpr AsFoundPolicy kValue = AsFoundPolicy::MakeSafe;
825};
826} // namespace detail
827
829constexpr const char* GetDriverVersion() noexcept {
830 return PF1550_VERSION_STRING;
831}
833constexpr uint32_t GetDriverVersionMajor() noexcept {
834 return PF1550_VERSION_MAJOR;
835}
837constexpr uint32_t GetDriverVersionMinor() noexcept {
838 return PF1550_VERSION_MINOR;
839}
841constexpr uint32_t GetDriverVersionPatch() noexcept {
842 return PF1550_VERSION_PATCH;
843}
844
847} // namespace pf1550
848
849#endif // PF1550_TYPES_HPP
Error
Why a call failed. Every call of the driver returns one of these in its Result.
Definition pf1550_types.hpp:38
Uvdet
VSYS undervoltage detect, rising threshold (UVDET, Table 137).
Definition pf1550_types.hpp:430
Vbus2SysThreshold
VBUS to VSYS comparator threshold (VBUS2SYS_THRSH).
Definition pf1550_types.hpp:402
ThermalRegTemp
Junction temperature where charge current folds back (REGTEMP, Table 162).
Definition pf1550_types.hpp:342
BatteryState
Battery state (BATT_SNS[2:0], Table 155).
Definition pf1550_types.hpp:458
UsbPhyVoltage
USBPHY LDO voltage (USBPHY, Table 165).
Definition pf1550_types.hpp:405
constexpr uint32_t GetDriverVersionMinor() noexcept
Definition pf1550_types.hpp:837
BatfetOc
Battery discharge overcurrent threshold (BATFET_OC, Table 161).
Definition pf1550_types.hpp:355
Debounce
Button debounce (PWRONDBNC, ONKEYDBNC; codes 00 and 01 are equal, ambiguity C41).
Definition pf1550_types.hpp:420
constexpr std::size_t kRailCount
Number of rails.
Definition pf1550_types.hpp:259
ShortDebounce
Short debounce times (VBUS_OV_TDB, VBUS2SYS_TDB; code 0 is reserved and not offered).
Definition pf1550_types.hpp:392
ChargerMode
Charger operating mode (CHG_OPER, Table 156).
Definition pf1550_types.hpp:282
Option
The start-up option of the part (OTP_FLAVOR, Table 87; ordering codes A0 to A9).
Definition pf1550_types.hpp:215
constexpr uint8_t kDefaultAddress
Default 7-bit I2C address (section 9.7.1); OTP selects 0x08 to 0x0F.
Definition pf1550_types.hpp:205
LedMode
LED mode (LED_CFG).
Definition pf1550_types.hpp:411
StandbyDelay
STANDBY pin delay in 32 kHz cycles (STANDBYDLY, Table 135).
Definition pf1550_types.hpp:417
Restart
Charge restart threshold below CHGCV (CHG_RESTART, Table 158).
Definition pf1550_types.hpp:319
CvAdjust
JEITA charge voltage reduction (CV_ADJ, Table 168).
Definition pf1550_types.hpp:372
GlobalReset
ONKEY hold time for a global reset (TGRESET, Table 135).
Definition pf1550_types.hpp:427
Fault
The fault the charger reports, classified from the state and flag registers.
Definition pf1550_types.hpp:469
SwCurrentLimit
Buck current limit, typical (SWx_ILIM, Tables 116, 121, 126).
Definition pf1550_types.hpp:268
Warm
Warm threshold (THM_WARM).
Definition pf1550_types.hpp:369
WatchdogTime
Charger watchdog period (WD_TIME, Table 161; the table prints 0 twice, ambiguity C8).
Definition pf1550_types.hpp:349
AsFoundPolicy
What to do when the charger is found on and unsafe at start-up.
Definition pf1550_types.hpp:436
FastChargeTimer
Fast-charge timer (FCHGTIME, Table 157).
Definition pf1550_types.hpp:289
Dvs
Whether the OTP configured a buck for dynamic voltage scaling (OTP_SWx_DVS_SEL).
Definition pf1550_types.hpp:262
Thermistor
Thermistor behaviour (THM_CNFG, Table 162).
Definition pf1550_types.hpp:334
constexpr std::size_t kIrqSourceCount
Number of interrupt sources.
Definition pf1550_types.hpp:550
Cold
Cold threshold (THM_COLD).
Definition pf1550_types.hpp:363
constexpr uint32_t kWatchdogServiceMaxS
Definition pf1550_types.hpp:210
LowSysWarn
Low system voltage warning, rising threshold (LOW_SYS_WARN, Table 137).
Definition pf1550_types.hpp:433
DvsSpeed
DVS slew rate (SWx_DVSSPEED).
Definition pf1550_types.hpp:276
constexpr uint32_t GetDriverVersionMajor() noexcept
Definition pf1550_types.hpp:833
Rail
The power rails the driver configures.
Definition pf1550_types.hpp:249
constexpr const char * ToString(Error error) noexcept
The name of an error, for logs.
Definition pf1550_types.hpp:68
LedFrequency
LED PWM frequency (LED_FREQ, Table 172).
Definition pf1550_types.hpp:408
CcAdjust
JEITA charge current as a share of IFC (CC_ADJ, Table 168).
Definition pf1550_types.hpp:374
constexpr uint32_t kDvsWaitMaxUs
The longest the driver waits for one DVS step sequence, in microseconds (64 steps x 4 us).
Definition pf1550_types.hpp:207
constexpr uint32_t GetDriverVersionPatch() noexcept
Definition pf1550_types.hpp:841
IrqGroup
Interrupt groups, one status/mask/sense register triple each.
Definition pf1550_types.hpp:504
ChargerState
Charger state (CHG_SNS[3:0], Table 154).
Definition pf1550_types.hpp:442
EocTimer
End-of-charge timer (EOCTIME, Table 157): 0 is a 16 s debounce, then 10 min steps.
Definition pf1550_types.hpp:301
SystemMin
Minimum system voltage (VSYSMIN, Table 160).
Definition pf1550_types.hpp:327
PowerState
STATE_INFO decoded (Table 146).
Definition pf1550_types.hpp:239
constexpr Microvolts FromMillivolts(uint32_t mv) noexcept
Microvolts from millivolts.
Definition pf1550_types.hpp:200
Hot
Hot threshold (THM_HOT).
Definition pf1550_types.hpp:365
WakeupDelay
System wake-up delay (SYS_WKUP_DLY, Table 166).
Definition pf1550_types.hpp:399
DpmVoltage
VBUS input regulation (DPM) voltage (VBUS_DPM_REG, Table 164): 3.9 V + 100 mV x code.
Definition pf1550_types.hpp:377
IrqSource
Every interrupt source of Tables 90 to 110 and 150 (31 sources).
Definition pf1550_types.hpp:516
LogLevel
Severity passed to the optional Log() hook.
Definition pf1550_types.hpp:183
constexpr std::size_t kIrqGroups
Number of interrupt groups.
Definition pf1550_types.hpp:212
Cool
Cool threshold (THM_COOL).
Definition pf1550_types.hpp:367
PrechargeTimer
Precharge timer (TPRECHG, Table 157).
Definition pf1550_types.hpp:313
DpmStop
DPM panic stop threshold (VIN_DPM_STOP).
Definition pf1550_types.hpp:389
constexpr const char * GetDriverVersion() noexcept
Definition pf1550_types.hpp:829
@ NoDevice
Nothing acknowledged the address: no chip, or it is unpowered.
@ OutOfLimits
A valid value outside the caller's Limits; nothing was sent.
@ DeviceIdMismatch
DEVICE_ID did not read 0x7C: wrong chip, no chip or a wiring fault.
@ ReadOnlyRail
SW3, or SW1 or SW2 not declared in DVS mode: its voltage is not written.
@ Crc
Not returned by this driver (I2C transfers carry no CRC).
@ Bus
A port hook returned false.
@ VerifyFailed
A register read back differently from what was just written.
@ ChargerFault
The charger reports a fault state; charging is not enabled.
@ DeviceFault
Not returned by this driver (faults are reported as ChargerFault).
@ NotInitialized
EnsureInitialized() has not succeeded yet.
@ Ok
The call succeeded.
@ Unsupported
The optional port hook this call needs is absent.
@ Timeout
A wait for the chip (a DVS step) did not end in the allowed time.
@ Unsafe
A safety downgrade without its acknowledgement; nothing was sent.
@ Busy
Not returned by this driver (the chip has no busy state).
@ Refused
A precondition of a dangerous call is not met (state, VBUS, ONKEY).
@ C95
95 degC (reset value).
@ CannotChargePastPrecharge
Timer fault in precharge.
@ BelowPrecharge
VBATT below VPRECHG.LB.
@ Unknown
A reserved code.
@ NotDetected
No battery with a valid input after wake-up.
@ Overvoltage
Battery overvoltage with a valid input.
@ AbovePrecharge
Above the precharge threshold.
@ NoValidVbus
No valid input.
@ A2p8
2.8 A typical.
@ A2p2
2.2 A typical.
@ Disabled
No protection: needs the acknowledgement allow_batfet_oc_off.
@ A3p2
3.2 A typical (reset value).
@ Ms31
31.25 ms falling, 31.25 ms rising (register code 0).
@ Ms750
750 ms falling (register code 3).
@ Ms125
125 ms falling (register code 2).
@ Ms1
1 ms (register code 2).
@ Us100
100 us (register code 1).
@ Ms10
10 ms (register code 3).
@ LinearOnly
Linear regulator on, no battery charging (reset value).
@ Off
Charger and linear regulator off.
@ A6
Option A6.
@ A4
Option A4.
@ A1
Default option.
@ A3
Option A3.
@ A9
Option A9.
@ Unknown
A flavour byte the data sheet does not list (ambiguity C10).
@ A7
Option A7.
@ A2
Option A2.
@ A5
Option A5.
@ A0
Not programmed: internal validation only; nothing is assumed about it.
@ A8
Option A8 (edge-sensitive PWRON).
@ FlashWhileCharging
Flashing while charging, on on a fault, off when done.
@ OnWhileCharging
On while charging, flashing on a fault, off when done.
@ Disabled
No restart.
@ Mv150
150 mV (reset value).
@ BatteryMissing
BATT_SNS 6.
@ BatteryOvercurrent
BATTOC_SNS.
@ UnknownState
A reserved CHG_SNS or BATT_SNS code.
@ WatchdogExpired
WDT_SNS.
@ S80
80 s (reset value).
@ Report
Return the error and write nothing (default).
@ MakeSafe
Write CHG_OPER = linear only, then verify.
@ Disabled
No timer: needs the acknowledgement allow_untimed_charge.
@ Hours4
4 hours (reset value).
@ Enabled
DVS: voltage is 0.6 V + 12.5 mV x code.
@ Disabled
Non-DVS: the voltage registers are read only and hold the fixed table.
@ Jeita1
Current and voltage reduced in cool and warm.
@ Jeita2
Current reduced in cool and warm.
@ Suspend
Charging stops outside cold and hot (reset value).
@ Ignore
Not in control: needs the acknowledgement battery_has_own_ntc_protection.
@ Us2
12.5 mV every 2 us.
@ Us4
12.5 mV every 4 us.
@ Ldo3
LDO3, 300 mA, load switch capable.
@ Sw2
Buck 2, 1.0 A, DVS.
@ VrefDdr
DDR reference, 10 mA, fixed voltage.
@ Sw3
Buck 3, 1.0 A, voltage read only.
@ Ldo2
LDO2, 400 mA.
@ Sw1
Buck 1, 1.0 A, DVS.
@ Ldo1
LDO1, 300 mA, load switch capable.
@ Onkey
ONKEY_INT_STAT0.
@ SwLowSide
SW_INT_STAT0.
@ SwHighSide
SW_INT_STAT1.
@ Ldo
LDO_INT_STAT0.
@ Misc
MISC_INT_STAT0.
@ SwDvs
SW_INT_STAT2.
@ Temp
TEMP_INT_STAT0.
@ Charger
CHG_INT (0x80).
@ ThermalShutdown
Junction above TSHDN.
@ Precharge
Battery below VPRECHG.LB.
@ ThermistorSuspend
Battery temperature outside the window.
@ Unknown
A reserved code: reported as a fault, never as charging.
@ BatteryOvervoltage
Battery overvoltage.
@ FastChargeCv
Constant voltage.
@ EndOfCharge
Current below IEOC, tEOC running.
@ TimerFault
Timer fault: only off then on exits it.
@ Done
Charge complete.
@ FastChargeCc
Constant current.
@ Min10
10 min (reset value).
@ Mv4300
4.3 V (recommended, section 8.1).
@ Mv3500
3.5 V (reset value).
@ Unknown
Any other code.
@ Mv3900
3.9 V (reset value).
@ ChgVbusDpm
VBUS_DPM_I.
@ Sw3LowSideLimit
SW3_LS_I.
@ PowerDown
PWRDN_I.
@ Sw1LowSideLimit
SW1_LS_I.
@ PwronChange
PWRON_I.
@ Ldo2Fault
LDO2_FAULTI.
@ Sw2LowSideLimit
SW2_LS_I.
@ Sw1DvsDone
SW1_DVS_DONE_I.
@ Sw1HighSideLimit
SW1_HS_I.
@ ChgBat2Soc
BAT2SOC_I.
@ Temp125
THERM125I.
@ Sw2DvsDone
SW2_DVS_DONE_I.
@ Temp110
THERM110I.
@ Sw3HighSideLimit
SW3_HS_I.
@ Ldo3Fault
LDO3_FAULTI.
@ LowSysWarning
LOW_SYS_WARN_I.
@ SysOvervoltage
SYS_OVLO_I.
@ Ldo1Fault
LDO1_FAULTI.
@ Sw2HighSideLimit
SW2_HS_I.
@ Warning
Something unexpected that the driver recovered from.
@ Info
Lifecycle events.
@ Debug
Detail for bring-up.
The PF1550 driver: everything it declares lives here; internals in detail.
Definition pf1550.hpp:39
@ None
The last transfer succeeded.
@ Bus
Arbitration lost, a stuck line or a timeout.
Compile-time helpers of the PF1550 driver: typed integer literals, exact hook matching,...
Which category-summary bits are set in INT_CATEGORY (Table 89).
Definition pf1550_types.hpp:570
bool ldo
LDO_INT.
Definition pf1550_types.hpp:575
bool sw1
SW1_INT.
Definition pf1550_types.hpp:572
bool charger
CHG_INT.
Definition pf1550_types.hpp:571
bool misc
MISC_INT.
Definition pf1550_types.hpp:578
bool sw3
SW3_INT.
Definition pf1550_types.hpp:574
bool temp
TEMP_INT.
Definition pf1550_types.hpp:577
bool sw2
SW2_INT.
Definition pf1550_types.hpp:573
bool onkey
ONKEY_INT.
Definition pf1550_types.hpp:576
Charger registers as found at start-up (the as-found check).
Definition pf1550_types.hpp:599
BatfetOc batfet_oc
BATFET_OC.
Definition pf1550_types.hpp:607
uint32_t charge_voltage_mv
CHGCV decoded.
Definition pf1550_types.hpp:602
uint8_t chg_oper
CHG_OPER raw.
Definition pf1550_types.hpp:600
Thermistor thermistor
THM_CNFG.
Definition pf1550_types.hpp:606
bool safe
Within limits and acknowledged.
Definition pf1550_types.hpp:609
uint32_t input_limit_ma
VBUS_LIN_ILIM decoded (0 for a reserved code).
Definition pf1550_types.hpp:604
ChargerMode mode
Decoded mode.
Definition pf1550_types.hpp:601
uint32_t charge_current_ma
CHG_CC decoded (0 for a reserved code).
Definition pf1550_types.hpp:603
bool disbatfet
DISBATFET: the battery path is off.
Definition pf1550_types.hpp:608
FastChargeTimer fast_timer
FCHGTIME.
Definition pf1550_types.hpp:605
The charger status of one ReadChargerStatus() pass (separate reads, not atomic).
Definition pf1550_types.hpp:491
bool consistent
CHG_SNS read twice with equal values.
Definition pf1550_types.hpp:500
Fault fault
The classified fault.
Definition pf1550_types.hpp:499
ChargerState state
CHG_SNS[3:0].
Definition pf1550_types.hpp:492
BatteryState battery
BATT_SNS[2:0].
Definition pf1550_types.hpp:493
bool thermal_regulation
TREG_SNS: charge current is folded back.
Definition pf1550_types.hpp:496
VbusFlags vbus
VBUS_SNS.
Definition pf1550_types.hpp:498
bool battery_overcurrent
BATTOC_SNS.
Definition pf1550_types.hpp:497
bool thermistor_outside
THM_SNS.
Definition pf1550_types.hpp:495
bool watchdog_expired
WDT_SNS.
Definition pf1550_types.hpp:494
Token: the caller confirms that EnterCoreOff() turns the PMIC core off.
Definition pf1550_types.hpp:635
Interrupt events returned by ServiceInterrupts(), one status byte per group.
Definition pf1550_types.hpp:562
uint8_t categories
INT_CATEGORY as read first.
Definition pf1550_types.hpp:564
uint8_t passes
Passes made (at most 3).
Definition pf1550_types.hpp:565
std::array< uint8_t, kIrqGroups > status
The status bytes as read, before any clear.
Definition pf1550_types.hpp:563
bool fault_class
A fault-class source is set (see HasFault()).
Definition pf1550_types.hpp:566
Interrupt masks, one byte per group; a set bit masks the source. The default masks every source,...
Definition pf1550_types.hpp:556
std::array< uint8_t, kIrqGroups > masked
Per group.
Definition pf1550_types.hpp:557
Token: the caller confirms that a load switch has no current limit and cannot go back,...
Definition pf1550_types.hpp:641
uint32_t input_mv
The input rail voltage of the LDO, millivolts.
Definition pf1550_types.hpp:642
A voltage in microvolts, so that grids such as 12.5 mV steps stay exact.
Definition pf1550_types.hpp:191
uint32_t value
The voltage in microvolts; 0 means "leave as it is" in a configuration.
Definition pf1550_types.hpp:192
The registers of the power-down sequence (Tables 139 to 145).
Definition pf1550_types.hpp:582
std::array< uint8_t, kRailCount > order
Definition pf1550_types.hpp:585
One rail as the chip holds it.
Definition pf1550_types.hpp:589
bool enabled_sleep
OMODE.
Definition pf1550_types.hpp:592
bool enabled_run
EN.
Definition pf1550_types.hpp:590
Microvolts volt
The run-mode voltage; 0 for VREFDDR or a non-DVS buck of unknown mode.
Definition pf1550_types.hpp:595
bool enabled_standby
STBY_EN.
Definition pf1550_types.hpp:591
bool load_switch
LS_EN (LDO1 and LDO3).
Definition pf1550_types.hpp:594
bool low_power
LPWR.
Definition pf1550_types.hpp:593
static constexpr Result Failure(Error e) noexcept
A failed result.
Definition pf1550_types.hpp:177
constexpr bool ok() const noexcept
Definition pf1550_types.hpp:160
static constexpr Result Success() noexcept
Definition pf1550_types.hpp:169
The value of a call, or why there is none.
Definition pf1550_types.hpp:123
static constexpr Result Failure(Error e) noexcept
A failed result.
Definition pf1550_types.hpp:149
static constexpr Result Success(T v) noexcept
A successful result.
Definition pf1550_types.hpp:141
constexpr bool ok() const noexcept
Definition pf1550_types.hpp:128
Result of SelfCheck(): what is wrong, if anything.
Definition pf1550_types.hpp:624
bool rails_as_configured
Every configured rail reads enabled as configured.
Definition pf1550_types.hpp:627
bool no_latched_fault
No fault-class interrupt status and the charger reports none.
Definition pf1550_types.hpp:628
bool input_limit_ok
VBUS_LIN_ILIM is valid, within Limits and as configured.
Definition pf1550_types.hpp:629
bool state_run
STATE_INFO is Run.
Definition pf1550_types.hpp:626
bool identity_ok
DEVICE_ID read 0x7C.
Definition pf1550_types.hpp:625
Token: the caller confirms that EnterShip() cuts all supplies, VSNVS included.
Definition pf1550_types.hpp:633
A read-only view of the chip for diagnostics (ReadSnapshot()).
Definition pf1550_types.hpp:613
PowerState state
STATE_INFO.
Definition pf1550_types.hpp:615
std::array< uint8_t, kIrqGroups > sense
SENSE registers (live, not latched).
Definition pf1550_types.hpp:617
PowerDownSequence power_down
PWRDN_SEQ registers.
Definition pf1550_types.hpp:619
std::array< RailReadout, kRailCount > rails
The rails.
Definition pf1550_types.hpp:618
uint8_t por_delay_code
PWRCTRL0.POR_DLY (RESETBMCU delay).
Definition pf1550_types.hpp:620
ChargerStatus charger
Charger status.
Definition pf1550_types.hpp:616
VariantInfo variant
Identity.
Definition pf1550_types.hpp:614
What ReadVariant() reports.
Definition pf1550_types.hpp:230
uint8_t flavor_raw
OTP_FLAVOR as read.
Definition pf1550_types.hpp:232
uint8_t device_id
DEVICE_ID (0x7C).
Definition pf1550_types.hpp:231
uint8_t i2c_slave_addr_code
I2C_ADDR[2:0]: the address is 0x08 plus this.
Definition pf1550_types.hpp:235
uint8_t silicon_rev_raw
SILICON_REV as read; no decision is made on it (C22).
Definition pf1550_types.hpp:234
Option option
The named option for listed values.
Definition pf1550_types.hpp:233
VBUS flags of VBUS_SNS (Table 153).
Definition pf1550_types.hpp:482
bool dpm
VBUS_DPM_SNS.
Definition pf1550_types.hpp:487
bool in2sys
VBUS_IN2SYS_SNS.
Definition pf1550_types.hpp:486
bool ovlo
VBUS_OVLO_SNS.
Definition pf1550_types.hpp:484
bool uvlo
VBUS_UVLO_SNS.
Definition pf1550_types.hpp:485
bool valid
VBUS_VALID.
Definition pf1550_types.hpp:483