xref: /openbmc/witherspoon-pfault-analysis/power-supply/power_supply.hpp (revision 83e50e993eff1708fc1d77b666d764c73ed509ef)
124e422feSBrandon Wyman #pragma once
282384146SMatt Spinler #include "average.hpp"
31db9a9e2SBrandon Wyman #include "device.hpp"
482384146SMatt Spinler #include "maximum.hpp"
5a1e96347SBrandon Wyman #include "names_values.hpp"
682384146SMatt Spinler #include "pmbus.hpp"
782384146SMatt Spinler #include "record_manager.hpp"
824e422feSBrandon Wyman 
9f0f02b9aSMatt Spinler #include <sdbusplus/bus/match.hpp>
10f0f02b9aSMatt Spinler #include <sdeventplus/clock.hpp>
11f0f02b9aSMatt Spinler #include <sdeventplus/event.hpp>
12f0f02b9aSMatt Spinler #include <sdeventplus/utility/timer.hpp>
13f0f02b9aSMatt Spinler 
141db9a9e2SBrandon Wyman namespace witherspoon
1524e422feSBrandon Wyman {
1624e422feSBrandon Wyman namespace power
1724e422feSBrandon Wyman {
1824e422feSBrandon Wyman namespace psu
1924e422feSBrandon Wyman {
2024e422feSBrandon Wyman 
2110295547SBrandon Wyman namespace sdbusRule = sdbusplus::bus::match::rules;
2210295547SBrandon Wyman 
23593d24f8SBrandon Wyman constexpr auto FAULT_COUNT = 3;
24593d24f8SBrandon Wyman 
2524e422feSBrandon Wyman /**
2624e422feSBrandon Wyman  * @class PowerSupply
271db9a9e2SBrandon Wyman  * Represents a PMBus power supply device.
2824e422feSBrandon Wyman  */
291db9a9e2SBrandon Wyman class PowerSupply : public Device
3024e422feSBrandon Wyman {
3124e422feSBrandon Wyman   public:
3224e422feSBrandon Wyman     PowerSupply() = delete;
3324e422feSBrandon Wyman     PowerSupply(const PowerSupply&) = delete;
3424e422feSBrandon Wyman     PowerSupply(PowerSupply&&) = default;
351db9a9e2SBrandon Wyman     PowerSupply& operator=(const PowerSupply&) = default;
3624e422feSBrandon Wyman     PowerSupply& operator=(PowerSupply&&) = default;
3724e422feSBrandon Wyman     ~PowerSupply() = default;
3824e422feSBrandon Wyman 
391db9a9e2SBrandon Wyman     /**
401db9a9e2SBrandon Wyman      * Constructor
411db9a9e2SBrandon Wyman      *
421db9a9e2SBrandon Wyman      * @param[in] name - the device name
431db9a9e2SBrandon Wyman      * @param[in] inst - the device instance
441db9a9e2SBrandon Wyman      * @param[in] objpath - the path to monitor
451db9a9e2SBrandon Wyman      * @param[in] invpath - the inventory path to use
46442035f0SBrandon Wyman      * @param[in] bus - D-Bus bus object
47431fbe43SBrandon Wyman      * @param[in] e - event object
48431fbe43SBrandon Wyman      * @param[in] t - time to allow power supply to assert PG#
49590fc28aSBrandon Wyman      * @param[in] p - time to allow power supply presence state to
50590fc28aSBrandon Wyman      *                settle/deglitch and allow for application of power
51590fc28aSBrandon Wyman      *                prior to fault checking
521db9a9e2SBrandon Wyman      */
531db9a9e2SBrandon Wyman     PowerSupply(const std::string& name, size_t inst,
54f0f02b9aSMatt Spinler                 const std::string& objpath, const std::string& invpath,
551426a10bSPatrick Williams                 sdbusplus::bus_t& bus, const sdeventplus::Event& e,
56f0f02b9aSMatt Spinler                 std::chrono::seconds& t, std::chrono::seconds& p);
571db9a9e2SBrandon Wyman 
581db9a9e2SBrandon Wyman     /**
591db9a9e2SBrandon Wyman      * Power supply specific function to analyze for faults/errors.
601db9a9e2SBrandon Wyman      *
611db9a9e2SBrandon Wyman      * Various PMBus status bits will be checked for fault conditions.
621db9a9e2SBrandon Wyman      * If a certain fault bits are on, the appropriate error will be
631db9a9e2SBrandon Wyman      * committed.
641db9a9e2SBrandon Wyman      */
651db9a9e2SBrandon Wyman     void analyze() override;
661db9a9e2SBrandon Wyman 
671db9a9e2SBrandon Wyman     /**
681db9a9e2SBrandon Wyman      * Write PMBus CLEAR_FAULTS
691db9a9e2SBrandon Wyman      *
701db9a9e2SBrandon Wyman      * This function will be called in various situations in order to clear
711db9a9e2SBrandon Wyman      * any fault status bits that may have been set, in order to start over
721db9a9e2SBrandon Wyman      * with a clean state. Presence changes and power state changes will
731db9a9e2SBrandon Wyman      * want to clear any faults logged.
741db9a9e2SBrandon Wyman      */
751db9a9e2SBrandon Wyman     void clearFaults() override;
761db9a9e2SBrandon Wyman 
7743ce2089SBrandon Wyman     /**
7843ce2089SBrandon Wyman      * Mark error for specified callout and message as resolved.
7943ce2089SBrandon Wyman      *
8043ce2089SBrandon Wyman      * @param[in] callout - The callout to be resolved (inventory path)
81*83e50e99SManojkiran Eda      * @param[in] message - The message for the fault to be resolved
8243ce2089SBrandon Wyman      */
83f0f02b9aSMatt Spinler     void resolveError(const std::string& callout, const std::string& message);
8443ce2089SBrandon Wyman 
8582384146SMatt Spinler     /**
8682384146SMatt Spinler      * Enables making the input power history available on D-Bus
8782384146SMatt Spinler      *
8882384146SMatt Spinler      * @param[in] objectPath - the D-Bus object path to use
8982384146SMatt Spinler      * @param[in] maxRecords - the number of history records to keep
9082384146SMatt Spinler      * @param[in] syncGPIOPath - The gpiochip device path to use for
9182384146SMatt Spinler      *                           sending the sync command
9282384146SMatt Spinler      * @paramp[in] syncGPIONum - the GPIO number for the sync command
9382384146SMatt Spinler      */
94f0f02b9aSMatt Spinler     void enableHistory(const std::string& objectPath, size_t numRecords,
95f0f02b9aSMatt Spinler                        const std::string& syncGPIOPath, size_t syncGPIONum);
9682384146SMatt Spinler 
971db9a9e2SBrandon Wyman   private:
981db9a9e2SBrandon Wyman     /**
991db9a9e2SBrandon Wyman      * The path to use for reading various PMBus bits/words.
1001db9a9e2SBrandon Wyman      */
1011db9a9e2SBrandon Wyman     std::string monitorPath;
1021db9a9e2SBrandon Wyman 
1031db9a9e2SBrandon Wyman     /**
104442035f0SBrandon Wyman      * @brief Pointer to the PMBus interface
105442035f0SBrandon Wyman      *
106442035f0SBrandon Wyman      * Used to read out of or write to the /sysfs tree(s) containing files
107442035f0SBrandon Wyman      * that a device driver monitors the PMBus interface to the power
108442035f0SBrandon Wyman      * supplies.
109442035f0SBrandon Wyman      */
110442035f0SBrandon Wyman     witherspoon::pmbus::PMBus pmbusIntf;
111442035f0SBrandon Wyman 
112442035f0SBrandon Wyman     /**
113431fbe43SBrandon Wyman      * @brief D-Bus path to use for this power supply's inventory status.
11410295547SBrandon Wyman      */
115431fbe43SBrandon Wyman     std::string inventoryPath;
116431fbe43SBrandon Wyman 
117431fbe43SBrandon Wyman     /** @brief Connection for sdbusplus bus */
1181426a10bSPatrick Williams     sdbusplus::bus_t& bus;
119431fbe43SBrandon Wyman 
120431fbe43SBrandon Wyman     /** @brief True if the power supply is present. */
12110295547SBrandon Wyman     bool present = false;
12210295547SBrandon Wyman 
123875b363cSBrandon Wyman     /** @brief Used to subscribe to D-Bus property changes for Present */
12410295547SBrandon Wyman     std::unique_ptr<sdbusplus::bus::match_t> presentMatch;
12510295547SBrandon Wyman 
126590fc28aSBrandon Wyman     /**
127590fc28aSBrandon Wyman      * @brief Interval for setting present to true.
128590fc28aSBrandon Wyman      *
129590fc28aSBrandon Wyman      * The amount of time to wait from not present to present change before
130590fc28aSBrandon Wyman      * updating the internal present indicator. Allows person servicing
131590fc28aSBrandon Wyman      * the power supply some time to plug in the cable.
132590fc28aSBrandon Wyman      */
133590fc28aSBrandon Wyman     std::chrono::seconds presentInterval;
134590fc28aSBrandon Wyman 
135590fc28aSBrandon Wyman     /**
136590fc28aSBrandon Wyman      * @brief Timer used to delay setting the internal present state.
137590fc28aSBrandon Wyman      *
138590fc28aSBrandon Wyman      * The timer used to do the callback after the present property has
139590fc28aSBrandon Wyman      * changed.
140590fc28aSBrandon Wyman      */
1411a0c9176SWilliam A. Kennington III     sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic> presentTimer;
142590fc28aSBrandon Wyman 
1433343e828SBrandon Wyman     /** @brief True if a fault has already been found and not cleared */
1443343e828SBrandon Wyman     bool faultFound = false;
1453343e828SBrandon Wyman 
146431fbe43SBrandon Wyman     /** @brief True if the power is on. */
147431fbe43SBrandon Wyman     bool powerOn = false;
148431fbe43SBrandon Wyman 
149593d24f8SBrandon Wyman     /**
150593d24f8SBrandon Wyman      * @brief Equal to FAULT_COUNT if power on fault has been
151593d24f8SBrandon Wyman      * detected.
152593d24f8SBrandon Wyman      */
153593d24f8SBrandon Wyman     size_t powerOnFault = 0;
154764c797eSBrandon Wyman 
155431fbe43SBrandon Wyman     /**
156431fbe43SBrandon Wyman      * @brief Interval to setting powerOn to true.
157431fbe43SBrandon Wyman      *
158431fbe43SBrandon Wyman      * The amount of time to wait from power state on to setting the
159431fbe43SBrandon Wyman      * internal powerOn state to true. The amount of time the power supply
160431fbe43SBrandon Wyman      * is allowed to delay setting DGood/PG#.
161431fbe43SBrandon Wyman      */
162431fbe43SBrandon Wyman     std::chrono::seconds powerOnInterval;
163431fbe43SBrandon Wyman 
164431fbe43SBrandon Wyman     /**
165431fbe43SBrandon Wyman      * @brief Timer used to delay setting the internal powerOn state.
166431fbe43SBrandon Wyman      *
167431fbe43SBrandon Wyman      * The timer used to do the callback after the power state has been on
168431fbe43SBrandon Wyman      * long enough.
169431fbe43SBrandon Wyman      */
1701a0c9176SWilliam A. Kennington III     sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic> powerOnTimer;
171431fbe43SBrandon Wyman 
172875b363cSBrandon Wyman     /** @brief Used to subscribe to D-Bus power on state changes */
173431fbe43SBrandon Wyman     std::unique_ptr<sdbusplus::bus::match_t> powerOnMatch;
174431fbe43SBrandon Wyman 
175e4af980fSBrandon Wyman     /** @brief Indicates that a read failure has occurred.
176e4af980fSBrandon Wyman      *
177e4af980fSBrandon Wyman      * @details This will be incremented each time a read failure is
178e4af980fSBrandon Wyman      *          encountered. If it is incremented to FAULT_COUNT, an error
179e4af980fSBrandon Wyman      *          will be logged.
180e4af980fSBrandon Wyman      */
181e4af980fSBrandon Wyman     size_t readFail = 0;
182e4af980fSBrandon Wyman 
183764c797eSBrandon Wyman     /** @brief Has a PMBus read failure already been logged? */
184442035f0SBrandon Wyman     bool readFailLogged = false;
185442035f0SBrandon Wyman 
186442035f0SBrandon Wyman     /**
187a3c675c1SBrandon Wyman      * @brief Indicates an input fault or warning if equal to FAULT_COUNT.
188442035f0SBrandon Wyman      *
189a3c675c1SBrandon Wyman      * @details This is the "INPUT FAULT OR WARNING" bit in the high byte,
190a3c675c1SBrandon Wyman      *          or the VIN_UV_FAULT bit in the low byte in the STATUS_WORD
191a3c675c1SBrandon Wyman      *          command response. If either of those bits are on, this will
192a3c675c1SBrandon Wyman      *          be incremented.
193442035f0SBrandon Wyman      */
194a3c675c1SBrandon Wyman     size_t inputFault = 0;
19510295547SBrandon Wyman 
196764c797eSBrandon Wyman     /**
197dd61be48SBrandon Wyman      * @brief Indicates output over current fault if equal to FAULT_COUNT
198b165c251SBrandon Wyman      *
199dd61be48SBrandon Wyman      * @details This is incremented when the "IOUT_OC_FAULT" bit in the low
200dd61be48SBrandon Wyman      *          byte from the STATUS_WORD command response is on.
201b165c251SBrandon Wyman      */
202dd61be48SBrandon Wyman     size_t outputOCFault = 0;
203b165c251SBrandon Wyman 
204b165c251SBrandon Wyman     /**
2052ab319b0SBrandon Wyman      * @brief Indicates output overvoltage fault if equal to FAULT_COUNT.
2062ab319b0SBrandon Wyman      *
2072ab319b0SBrandon Wyman      * @details This is incremented when the "VOUT_OV_FAULT" bit in the
2082ab319b0SBrandon Wyman      *          STATUS_WORD command response is on.
209ab05c079SBrandon Wyman      */
2102ab319b0SBrandon Wyman     size_t outputOVFault = 0;
211ab05c079SBrandon Wyman 
212ab05c079SBrandon Wyman     /**
213ba25553bSBrandon Wyman      * @brief Indicates a fan fault or warning condition was detected if
214ba25553bSBrandon Wyman      *        equal to FAULT_COUNT.
215ba25553bSBrandon Wyman      *
216ba25553bSBrandon Wyman      * @details This is incremented when the 'FAN_FAULT' bit in the
217ba25553bSBrandon Wyman      *          STATUS_WORD command response is on.
21812661f1eSBrandon Wyman      */
219ba25553bSBrandon Wyman     size_t fanFault = 0;
22012661f1eSBrandon Wyman 
22112661f1eSBrandon Wyman     /**
22250044ea7SBrandon Wyman      * @brief Indicates a temperature fault or warn condition was detected
22350044ea7SBrandon Wyman      *        if equal to FAULT_COUNT.
22450044ea7SBrandon Wyman      *
22550044ea7SBrandon Wyman      * @details This is incremented when the 'TEMPERATURE_FAULT_WARN' bit
22650044ea7SBrandon Wyman      *          in the STATUS_WORD command response is on, or if the
22750044ea7SBrandon Wyman      *          'OT_FAULT' bit in the STATUS_TEMPERATURE command response
22850044ea7SBrandon Wyman      *          is on.
229875b363cSBrandon Wyman      */
23050044ea7SBrandon Wyman     size_t temperatureFault = 0;
231875b363cSBrandon Wyman 
232875b363cSBrandon Wyman     /**
23382384146SMatt Spinler      * @brief Class that manages the input power history records.
23482384146SMatt Spinler      */
23582384146SMatt Spinler     std::unique_ptr<history::RecordManager> recordManager;
23682384146SMatt Spinler 
23782384146SMatt Spinler     /**
23882384146SMatt Spinler      * @brief The D-Bus object for the average input power history
23982384146SMatt Spinler      */
24082384146SMatt Spinler     std::unique_ptr<history::Average> average;
24182384146SMatt Spinler 
24282384146SMatt Spinler     /**
24382384146SMatt Spinler      * @brief The D-Bus object for the maximum input power history
24482384146SMatt Spinler      */
24582384146SMatt Spinler     std::unique_ptr<history::Maximum> maximum;
24682384146SMatt Spinler 
24782384146SMatt Spinler     /**
24882384146SMatt Spinler      * @brief The base D-Bus object path to use for the average
24982384146SMatt Spinler      *        and maximum objects.
25082384146SMatt Spinler      */
25182384146SMatt Spinler     std::string historyObjectPath;
25282384146SMatt Spinler 
25382384146SMatt Spinler     /**
25482384146SMatt Spinler      * @brief The GPIO device path to use for sending the 'sync'
25582384146SMatt Spinler      *        command to the PS.
25682384146SMatt Spinler      */
25782384146SMatt Spinler     std::string syncGPIODevPath;
25882384146SMatt Spinler 
25982384146SMatt Spinler     /**
26082384146SMatt Spinler      * @brief The GPIO number to use for sending the 'sync'
26182384146SMatt Spinler      *        command to the PS.
26282384146SMatt Spinler      */
26382384146SMatt Spinler     size_t syncGPIONumber = 0;
26482384146SMatt Spinler 
26582384146SMatt Spinler     /**
266764c797eSBrandon Wyman      * @brief Callback for inventory property changes
26710295547SBrandon Wyman      *
26810295547SBrandon Wyman      * Process change of Present property for power supply.
26910295547SBrandon Wyman      *
27010295547SBrandon Wyman      * @param[in]  msg - Data associated with Present change signal
27110295547SBrandon Wyman      *
27210295547SBrandon Wyman      */
2731426a10bSPatrick Williams     void inventoryChanged(sdbusplus::message_t& msg);
27410295547SBrandon Wyman 
27510295547SBrandon Wyman     /**
27610295547SBrandon Wyman      * Updates the presence status by querying D-Bus
27710295547SBrandon Wyman      *
27810295547SBrandon Wyman      * The D-Bus inventory properties for this power supply will be read to
27910295547SBrandon Wyman      * determine if the power supply is present or not and update this
28010295547SBrandon Wyman      * objects present member variable to reflect current status.
28110295547SBrandon Wyman      */
28210295547SBrandon Wyman     void updatePresence();
283431fbe43SBrandon Wyman 
284431fbe43SBrandon Wyman     /**
285431fbe43SBrandon Wyman      * @brief Updates the poweredOn status by querying D-Bus
286431fbe43SBrandon Wyman      *
287875b363cSBrandon Wyman      * The D-Bus property for the system power state will be read to
288431fbe43SBrandon Wyman      * determine if the system is powered on or not.
289431fbe43SBrandon Wyman      */
290431fbe43SBrandon Wyman     void updatePowerState();
291431fbe43SBrandon Wyman 
292764c797eSBrandon Wyman     /**
293764c797eSBrandon Wyman      * @brief Callback for power state property changes
294764c797eSBrandon Wyman      *
295431fbe43SBrandon Wyman      * Process changes to the powered on stat property for the system.
296431fbe43SBrandon Wyman      *
297431fbe43SBrandon Wyman      * @param[in] msg - Data associated with the power state signal
298431fbe43SBrandon Wyman      */
2991426a10bSPatrick Williams     void powerStateChanged(sdbusplus::message_t& msg);
300431fbe43SBrandon Wyman 
301603cc00fSBrandon Wyman     /**
302a1e96347SBrandon Wyman      * @brief Wrapper for PMBus::read() and adding metadata
303a1e96347SBrandon Wyman      *
304a1e96347SBrandon Wyman      * @param[out] nv - NamesValues instance to store cmd string and value
305a1e96347SBrandon Wyman      * @param[in] cmd - String for the command to read data from.
306a1e96347SBrandon Wyman      * @param[in] type - The type of file to read the command from.
307a1e96347SBrandon Wyman      */
308a1e96347SBrandon Wyman     void captureCmd(util::NamesValues& nv, const std::string& cmd,
309a1e96347SBrandon Wyman                     witherspoon::pmbus::Type type);
310a1e96347SBrandon Wyman 
311a1e96347SBrandon Wyman     /**
312603cc00fSBrandon Wyman      * @brief Checks for input voltage faults and logs error if needed.
313603cc00fSBrandon Wyman      *
314603cc00fSBrandon Wyman      * Check for voltage input under voltage fault (VIN_UV_FAULT) and/or
315603cc00fSBrandon Wyman      * input fault or warning (INPUT_FAULT), and logs appropriate error(s).
316603cc00fSBrandon Wyman      *
317603cc00fSBrandon Wyman      * @param[in] statusWord  - 2 byte STATUS_WORD value read from sysfs
318603cc00fSBrandon Wyman      */
319603cc00fSBrandon Wyman     void checkInputFault(const uint16_t statusWord);
320603cc00fSBrandon Wyman 
321603cc00fSBrandon Wyman     /**
322603cc00fSBrandon Wyman      * @brief Checks for power good negated or unit is off in wrong state
323603cc00fSBrandon Wyman      *
324603cc00fSBrandon Wyman      * @param[in] statusWord  - 2 byte STATUS_WORD value read from sysfs
325603cc00fSBrandon Wyman      */
326603cc00fSBrandon Wyman     void checkPGOrUnitOffFault(const uint16_t statusWord);
327603cc00fSBrandon Wyman 
328603cc00fSBrandon Wyman     /**
329603cc00fSBrandon Wyman      * @brief Checks for output current over current fault.
330603cc00fSBrandon Wyman      *
331603cc00fSBrandon Wyman      * IOUT_OC_FAULT is checked, if on, appropriate error is logged.
332603cc00fSBrandon Wyman      *
333603cc00fSBrandon Wyman      * @param[in] statusWord  - 2 byte STATUS_WORD value read from sysfs
334603cc00fSBrandon Wyman      */
335603cc00fSBrandon Wyman     void checkCurrentOutOverCurrentFault(const uint16_t statusWord);
336603cc00fSBrandon Wyman 
337ab05c079SBrandon Wyman     /**
338ab05c079SBrandon Wyman      * @brief Checks for output overvoltage fault.
339ab05c079SBrandon Wyman      *
340ab05c079SBrandon Wyman      * VOUT_OV_FAULT is checked, if on, appropriate error is logged.
341ab05c079SBrandon Wyman      *
342ab05c079SBrandon Wyman      * @param[in] statusWord  - 2 byte STATUS_WORD value read from sysfs
343ab05c079SBrandon Wyman      */
344ab05c079SBrandon Wyman     void checkOutputOvervoltageFault(const uint16_t statusWord);
345ab05c079SBrandon Wyman 
34612661f1eSBrandon Wyman     /**
34712661f1eSBrandon Wyman      * @brief Checks for a fan fault or warning condition.
34812661f1eSBrandon Wyman      *
34912661f1eSBrandon Wyman      * The high byte of STATUS_WORD is checked to see if the "FAN FAULT OR
35012661f1eSBrandon Wyman      * WARNING" bit is turned on. If it is on, log an error.
35112661f1eSBrandon Wyman      *
35212661f1eSBrandon Wyman      * @param[in] statusWord - 2 byte STATUS_WORD value read from sysfs
35312661f1eSBrandon Wyman      */
35412661f1eSBrandon Wyman     void checkFanFault(const uint16_t statusWord);
35512661f1eSBrandon Wyman 
356875b363cSBrandon Wyman     /**
357875b363cSBrandon Wyman      * @brief Checks for a temperature fault or warning condition.
358875b363cSBrandon Wyman      *
359875b363cSBrandon Wyman      * The low byte of STATUS_WORD is checked to see if the "TEMPERATURE
360875b363cSBrandon Wyman      * FAULT OR WARNING" bit is turned on. If it is on, log an error,
361875b363cSBrandon Wyman      * call out the power supply indicating the fault/warning condition.
362875b363cSBrandon Wyman      *
363*83e50e99SManojkiran Eda      * @param[in] statusWord - 2 byte STATUS_WORD value read from sysfs
364875b363cSBrandon Wyman      */
365875b363cSBrandon Wyman     void checkTemperatureFault(const uint16_t statusWord);
366875b363cSBrandon Wyman 
367234ce0d2SMatt Spinler     /**
368234ce0d2SMatt Spinler      * @brief Adds properties to the inventory.
369234ce0d2SMatt Spinler      *
370234ce0d2SMatt Spinler      * Reads the values from the device and writes them to the
371234ce0d2SMatt Spinler      * associated power supply D-Bus inventory object.
372234ce0d2SMatt Spinler      *
373234ce0d2SMatt Spinler      * This needs to be done on startup, and each time the presence
374234ce0d2SMatt Spinler      * state changes.
375234ce0d2SMatt Spinler      *
376234ce0d2SMatt Spinler      * Properties added:
377234ce0d2SMatt Spinler      * - Serial Number
378234ce0d2SMatt Spinler      * - Part Number
379234ce0d2SMatt Spinler      * - CCIN (Customer Card Identification Number) - added as the Model
380234ce0d2SMatt Spinler      * - Firmware version
381234ce0d2SMatt Spinler      */
382234ce0d2SMatt Spinler     void updateInventory();
383234ce0d2SMatt Spinler 
384eb169fd9SMatt Spinler     /**
385d734e65fSMatt Spinler      * @brief Toggles the GPIO to sync power supply input history readings
386d734e65fSMatt Spinler      *
387d734e65fSMatt Spinler      * This GPIO is connected to all supplies.  This will clear the
388d734e65fSMatt Spinler      * previous readings out of the supplies and restart them both at the
389d734e65fSMatt Spinler      * same time zero and at record ID 0.  The supplies will return 0
390d734e65fSMatt Spinler      * bytes of data for the input history command right after this until
391d734e65fSMatt Spinler      * a new entry shows up.
392d734e65fSMatt Spinler      *
393d734e65fSMatt Spinler      * This will cause the code to delete all previous history data and
394d734e65fSMatt Spinler      * start fresh.
395d734e65fSMatt Spinler      */
396d734e65fSMatt Spinler     void syncHistory();
397d734e65fSMatt Spinler 
398d734e65fSMatt Spinler     /**
399eb169fd9SMatt Spinler      * @brief Reads the most recent input history record from the power
400eb169fd9SMatt Spinler      *        supply and updates the average and maximum properties in
401eb169fd9SMatt Spinler      *        D-Bus if there is a new reading available.
402eb169fd9SMatt Spinler      *
403eb169fd9SMatt Spinler      * This will still run every time analyze() is called so code can
404eb169fd9SMatt Spinler      * post new data as soon as possible and the timestamp will more
405eb169fd9SMatt Spinler      * accurately reflect the correct time.
406eb169fd9SMatt Spinler      *
407eb169fd9SMatt Spinler      * D-Bus is only updated if there is a change and the oldest record
408eb169fd9SMatt Spinler      * will be pruned if the property already contains the max number of
409eb169fd9SMatt Spinler      * records.
410eb169fd9SMatt Spinler      */
411eb169fd9SMatt Spinler     void updateHistory();
41224e422feSBrandon Wyman };
41324e422feSBrandon Wyman 
414f0f02b9aSMatt Spinler } // namespace psu
415f0f02b9aSMatt Spinler } // namespace power
416f0f02b9aSMatt Spinler } // namespace witherspoon
417