blob: 83ebc74bb4f46e625f351cd193ddaf74c1b70b02 [file] [log] [blame]
Brandon Wymana0f33ce2019-10-17 18:32:29 -05001#pragma once
2
Brandon Wyman8d195772020-01-27 15:03:51 -06003#include "pmbus.hpp"
Brandon Wymanaed1f752019-11-25 18:10:52 -06004#include "types.hpp"
B. J. Wyman681b2a32021-04-20 22:31:22 +00005#include "util.hpp"
Brandon Wyman3f1242f2020-01-28 13:11:25 -06006#include "utility.hpp"
Brandon Wymanaed1f752019-11-25 18:10:52 -06007
B. J. Wyman681b2a32021-04-20 22:31:22 +00008#include <gpiod.hpp>
Brandon Wymanaed1f752019-11-25 18:10:52 -06009#include <sdbusplus/bus/match.hpp>
10
B. J. Wyman681b2a32021-04-20 22:31:22 +000011#include <filesystem>
Brandon Wyman1d7a7df2020-03-26 10:14:05 -050012#include <stdexcept>
13
Brandon Wymana0f33ce2019-10-17 18:32:29 -050014namespace phosphor::power::psu
15{
Brandon Wyman3f1242f2020-01-28 13:11:25 -060016
Chanh Nguyenc12c53b2021-04-06 17:24:47 +070017#if IBM_VPD
Brandon Wyman1d7a7df2020-03-26 10:14:05 -050018// PMBus device driver "file name" to read for CCIN value.
19constexpr auto CCIN = "ccin";
20constexpr auto PART_NUMBER = "part_number";
21constexpr auto FRU_NUMBER = "fru";
22constexpr auto SERIAL_HEADER = "header";
23constexpr auto SERIAL_NUMBER = "serial_number";
24constexpr auto FW_VERSION = "fw_version";
25
26// The D-Bus property name to update with the CCIN value.
27constexpr auto MODEL_PROP = "Model";
28constexpr auto PN_PROP = "PartNumber";
Brandon Wymana169b0f2021-12-07 20:18:06 +000029constexpr auto SPARE_PN_PROP = "SparePartNumber";
Brandon Wyman1d7a7df2020-03-26 10:14:05 -050030constexpr auto SN_PROP = "SerialNumber";
31constexpr auto VERSION_PROP = "Version";
32
33// ipzVPD Keyword sizes
34static constexpr auto FL_KW_SIZE = 20;
35#endif
36
Brandon Wymanf65c4062020-08-19 13:15:53 -050037constexpr auto LOG_LIMIT = 3;
Brandon Wyman06ca4592021-12-06 22:52:23 +000038constexpr auto DEGLITCH_LIMIT = 3;
Brandon Wymanf65c4062020-08-19 13:15:53 -050039
Brandon Wymana0f33ce2019-10-17 18:32:29 -050040/**
41 * @class PowerSupply
42 * Represents a PMBus power supply device.
43 */
44class PowerSupply
45{
46 public:
Brandon Wymanaed1f752019-11-25 18:10:52 -060047 PowerSupply() = delete;
Brandon Wymana0f33ce2019-10-17 18:32:29 -050048 PowerSupply(const PowerSupply&) = delete;
49 PowerSupply(PowerSupply&&) = delete;
50 PowerSupply& operator=(const PowerSupply&) = delete;
51 PowerSupply& operator=(PowerSupply&&) = delete;
52 ~PowerSupply() = default;
53
54 /**
Brandon Wymanc63941c2020-01-27 16:49:33 -060055 * @param[in] invpath - String for inventory path to use
56 * @param[in] i2cbus - The bus number this power supply is on
57 * @param[in] i2caddr - The 16-bit I2C address of the power supply
B. J. Wyman681b2a32021-04-20 22:31:22 +000058 * @param[in] gpioLineName - The gpio-line-name to read for presence. See
59 * https://github.com/openbmc/docs/blob/master/designs/device-tree-gpio-naming.md
Brandon Wymanaed1f752019-11-25 18:10:52 -060060 */
Brandon Wymanc63941c2020-01-27 16:49:33 -060061 PowerSupply(sdbusplus::bus::bus& bus, const std::string& invpath,
B. J. Wyman681b2a32021-04-20 22:31:22 +000062 std::uint8_t i2cbus, const std::uint16_t i2caddr,
63 const std::string& gpioLineName);
Brandon Wymanaed1f752019-11-25 18:10:52 -060064
Brandon Wyman3f1242f2020-01-28 13:11:25 -060065 phosphor::pmbus::PMBusBase& getPMBus()
66 {
67 return *pmbusIntf;
68 }
69
Adriana Kobylak3ca062a2021-10-20 15:27:23 +000070 GPIOInterfaceBase* getPresenceGPIO()
B. J. Wyman681b2a32021-04-20 22:31:22 +000071 {
72 return presenceGPIO.get();
73 }
74
B. J. Wymand8b8cb12021-07-15 22:03:34 +000075 std::string getPresenceGPIOName() const
76 {
77 if (presenceGPIO != nullptr)
78 {
79 return presenceGPIO->getName();
80 }
81 else
82 {
83 return std::string();
84 }
85 }
86
Brandon Wymanaed1f752019-11-25 18:10:52 -060087 /**
Brandon Wymana0f33ce2019-10-17 18:32:29 -050088 * Power supply specific function to analyze for faults/errors.
89 *
90 * Various PMBus status bits will be checked for fault conditions.
91 * If a certain fault bits are on, the appropriate error will be
92 * committed.
93 */
Brandon Wyman3f1242f2020-01-28 13:11:25 -060094 void analyze();
Brandon Wymana0f33ce2019-10-17 18:32:29 -050095
96 /**
Brandon Wyman59a35792020-06-04 12:37:40 -050097 * Write PMBus ON_OFF_CONFIG
98 *
99 * This function will be called to cause the PMBus device driver to send the
100 * ON_OFF_CONFIG command. Takes one byte of data.
101 *
102 * @param[in] data - The ON_OFF_CONFIG data byte mask.
103 */
104 void onOffConfig(uint8_t data);
105
106 /**
Brandon Wymane3f7ad22021-12-21 20:27:45 +0000107 * Clears all the member variables that indicate if a fault bit was seen as
108 * on in the STATUS_WORD or STATUS_MFR_SPECIFIC response.
109 */
110 void clearFaultFlags()
111 {
112 inputFault = false;
113 mfrFault = false;
114 statusMFR = 0;
115 vinUVFault = false;
116 cmlFault = false;
117 voutOVFault = false;
118 ioutOCFault = false;
119 voutUVFault = false;
120 fanFault = false;
121 tempFault = false;
122 pgoodFault = 0;
123 psKillFault = false;
124 ps12VcsFault = false;
125 psCS12VFault = false;
126 }
127
128 /**
Brandon Wymana0f33ce2019-10-17 18:32:29 -0500129 * Write PMBus CLEAR_FAULTS
130 *
131 * This function will be called in various situations in order to clear
132 * any fault status bits that may have been set, in order to start over
133 * with a clean state. Presence changes and power state changes will
134 * want to clear any faults logged.
135 */
Brandon Wyman3c208462020-05-13 16:25:58 -0500136 void clearFaults();
Brandon Wymana0f33ce2019-10-17 18:32:29 -0500137
138 /**
139 * @brief Adds properties to the inventory.
140 *
141 * Reads the values from the device and writes them to the
142 * associated power supply D-Bus inventory object.
143 *
144 * This needs to be done on startup, and each time the presence
145 * state changes.
146 *
147 * Properties added:
148 * - Serial Number
149 * - Part Number
150 * - CCIN (Customer Card Identification Number) - added as the Model
151 * - Firmware version
152 */
Brandon Wyman1d7a7df2020-03-26 10:14:05 -0500153 void updateInventory();
Brandon Wymana0f33ce2019-10-17 18:32:29 -0500154
Brandon Wymanaed1f752019-11-25 18:10:52 -0600155 /**
156 * @brief Accessor function to indicate present status
157 */
158 bool isPresent() const
159 {
160 return present;
161 }
162
Brandon Wyman3f1242f2020-01-28 13:11:25 -0600163 /**
Brandon Wymanfed0ba22020-09-26 20:02:51 -0500164 * @brief Returns the last read value from STATUS_WORD.
165 */
166 uint64_t getStatusWord() const
167 {
168 return statusWord;
169 }
170
171 /**
Brandon Wymanf07bc792021-10-12 19:00:35 +0000172 * @brief Returns the last read value from STATUS_INPUT.
173 */
174 uint64_t getStatusInput() const
175 {
176 return statusInput;
177 }
178
179 /**
Jay Meyer10d94052020-11-30 14:41:21 -0600180 * @brief Returns the last read value from STATUS_MFR.
181 */
182 uint64_t getMFRFault() const
183 {
184 return statusMFR;
185 }
186
187 /**
Brandon Wyman85c7bf42021-10-19 22:28:48 +0000188 * @brief Returns the last read value from STATUS_CML.
189 */
190 uint64_t getStatusCML() const
191 {
192 return statusCML;
193 }
194
195 /**
Brandon Wyman6710ba22021-10-27 17:39:31 +0000196 * @brief Returns the last read value from STATUS_VOUT.
197 */
198 uint64_t getStatusVout() const
199 {
200 return statusVout;
201 }
202
203 /**
Brandon Wymanb10b3be2021-11-09 22:12:15 +0000204 * @brief Returns the last value read from STATUS_IOUT.
205 */
206 uint64_t getStatusIout() const
207 {
208 return statusIout;
209 }
210
211 /**
Brandon Wyman7ee4d7e2021-11-19 20:48:23 +0000212 * @brief Returns the last value read from STATUS_FANS_1_2.
213 */
214 uint64_t getStatusFans12() const
215 {
216 return statusFans12;
217 }
218
219 /**
Brandon Wyman96893a42021-11-05 19:56:57 +0000220 * @brief Returns the last value read from STATUS_TEMPERATURE.
221 */
222 uint64_t getStatusTemperature() const
223 {
224 return statusTemperature;
225 }
226
227 /**
Brandon Wyman3f1242f2020-01-28 13:11:25 -0600228 * @brief Returns true if a fault was found.
229 */
230 bool isFaulted() const
231 {
Brandon Wyman9ddc6222021-10-28 17:28:01 +0000232 return (hasCommFault() || vinUVFault || inputFault || voutOVFault ||
Brandon Wyman7ee4d7e2021-11-19 20:48:23 +0000233 ioutOCFault || voutUVFault || fanFault || tempFault ||
Brandon Wyman06ca4592021-12-06 22:52:23 +0000234 (pgoodFault >= DEGLITCH_LIMIT) || mfrFault);
Brandon Wyman3f1242f2020-01-28 13:11:25 -0600235 }
236
237 /**
Brandon Wymanb76ab242020-09-16 18:06:06 -0500238 * @brief Return whether a fault has been logged for this power supply
239 */
240 bool isFaultLogged() const
241 {
242 return faultLogged;
243 }
244
245 /**
246 * @brief Called when a fault for this power supply has been logged.
247 */
248 void setFaultLogged()
249 {
250 faultLogged = true;
251 }
252
253 /**
Brandon Wyman3f1242f2020-01-28 13:11:25 -0600254 * @brief Returns true if INPUT fault occurred.
255 */
256 bool hasInputFault() const
257 {
258 return inputFault;
259 }
260
261 /**
262 * @brief Returns true if MFRSPECIFIC occurred.
263 */
264 bool hasMFRFault() const
265 {
266 return mfrFault;
267 }
268
269 /**
270 * @brief Returns true if VIN_UV_FAULT occurred.
271 */
272 bool hasVINUVFault() const
273 {
274 return vinUVFault;
275 }
276
Brandon Wymanc9efe412020-10-09 15:42:50 -0500277 /**
Brandon Wyman6710ba22021-10-27 17:39:31 +0000278 * @brief Returns true if VOUT_OV_FAULT occurred.
279 */
280 bool hasVoutOVFault() const
281 {
282 return voutOVFault;
283 }
284
285 /**
Brandon Wymanb10b3be2021-11-09 22:12:15 +0000286 * @brief Returns true if IOUT_OC fault occurred (bit 4 STATUS_BYTE).
287 */
288 bool hasIoutOCFault() const
289 {
290 return ioutOCFault;
291 }
292
293 /**
Brandon Wyman2cf46942021-10-28 19:09:16 +0000294 * @brief Returns true if VOUT_UV_FAULT occurred.
295 */
296 bool hasVoutUVFault() const
297 {
298 return voutUVFault;
299 }
300
301 /**
Brandon Wyman7ee4d7e2021-11-19 20:48:23 +0000302 *@brief Returns true if fan fault occurred.
303 */
304 bool hasFanFault() const
305 {
306 return fanFault;
307 }
308
309 /**
Brandon Wyman96893a42021-11-05 19:56:57 +0000310 * @brief Returns true if TEMPERATURE fault occurred.
311 */
312 bool hasTempFault() const
313 {
314 return tempFault;
315 }
316
317 /**
Brandon Wyman2916ea52021-11-06 03:31:18 +0000318 * @brief Returns true if there is a PGood fault (PGOOD# inactive, or OFF
319 * bit on).
320 */
321 bool hasPgoodFault() const
322 {
Brandon Wyman06ca4592021-12-06 22:52:23 +0000323 return (pgoodFault >= DEGLITCH_LIMIT);
Brandon Wyman2916ea52021-11-06 03:31:18 +0000324 }
325
326 /**
Brandon Wyman39ea02b2021-11-23 23:22:23 +0000327 * @brief Return true if there is a PS_Kill fault.
328 */
329 bool hasPSKillFault() const
330 {
331 return psKillFault;
332 }
333
334 /**
335 * @brief Returns true if there is a 12Vcs (standy power) fault.
336 */
337 bool hasPS12VcsFault() const
338 {
339 return ps12VcsFault;
340 }
341
342 /**
343 * @brief Returns true if there is a 12V current-share fault.
344 */
345 bool hasPSCS12VFault() const
346 {
347 return psCS12VFault;
348 }
349
350 /**
Brandon Wymanc9efe412020-10-09 15:42:50 -0500351 * @brief Returns the device path
352 *
353 * This can be used for error call outs.
354 * Example: /sys/bus/i2c/devices/3-0068
355 */
Brandon Wyman4176d6b2020-10-07 17:41:06 -0500356 const std::string getDevicePath() const
357 {
358 return pmbusIntf->path();
359 }
360
Brandon Wymanc9efe412020-10-09 15:42:50 -0500361 /**
362 * @brief Returns this power supplies inventory path.
363 *
364 * This can be used for error call outs.
365 * Example:
366 * /xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply1
367 */
Brandon Wyman7e495272020-09-26 19:57:46 -0500368 const std::string& getInventoryPath() const
369 {
370 return inventoryPath;
371 }
372
Brandon Wymanc9efe412020-10-09 15:42:50 -0500373 /**
374 * @brief Returns the firmware revision version read from the power supply
375 */
376 const std::string& getFWVersion() const
377 {
378 return fwVersion;
379 }
380
Adriana Kobylak572a9052021-03-30 15:58:07 +0000381 /**
382 * @brief Returns the model name of the power supply
383 */
384 const std::string& getModelName() const
385 {
386 return modelName;
387 }
388
Brandon Wymanf65c4062020-08-19 13:15:53 -0500389 /** @brief Returns true if the number of failed reads exceeds limit
390 * TODO: or CML bit on.
391 */
392 bool hasCommFault() const
393 {
Brandon Wyman85c7bf42021-10-19 22:28:48 +0000394 return ((readFail >= LOG_LIMIT) || (cmlFault));
Brandon Wymanf65c4062020-08-19 13:15:53 -0500395 }
396
Adriana Kobylak4175ffb2021-08-02 14:51:05 +0000397 /**
398 * @brief Reads the pmbus input voltage and returns that actual voltage
399 * reading and the calculated input voltage based on thresholds.
400 * @param[out] actualInputVoltage - The actual voltage reading, in Volts.
401 * @param[out] inputVoltage - A rounded up/down value of the actual input
402 * voltage based on thresholds, in Volts.
403 */
404 void getInputVoltage(double& actualInputVoltage, int& inputVoltage) const;
405
Brandon Wymana0f33ce2019-10-17 18:32:29 -0500406 private:
Brandon Wymanaed1f752019-11-25 18:10:52 -0600407 /** @brief systemd bus member */
408 sdbusplus::bus::bus& bus;
409
Brandon Wyman9564e942020-11-10 14:01:42 -0600410 /** @brief Will be updated to the latest/lastvalue read from STATUS_WORD.*/
Brandon Wymanfed0ba22020-09-26 20:02:51 -0500411 uint64_t statusWord = 0;
412
Brandon Wymanf07bc792021-10-12 19:00:35 +0000413 /** @brief Will be updated to the latest/lastvalue read from STATUS_INPUT.*/
414 uint64_t statusInput = 0;
415
Jay Meyer10d94052020-11-30 14:41:21 -0600416 /** @brief Will be updated to the latest/lastvalue read from STATUS_MFR.*/
417 uint64_t statusMFR = 0;
418
Brandon Wyman85c7bf42021-10-19 22:28:48 +0000419 /** @brief Will be updated to the latest/last value read from STATUS_CML.*/
420 uint64_t statusCML = 0;
421
Brandon Wyman6710ba22021-10-27 17:39:31 +0000422 /** @brief Will be updated to the latest/last value read from STATUS_VOUT.*/
423 uint64_t statusVout = 0;
424
Brandon Wymanb10b3be2021-11-09 22:12:15 +0000425 /** @brief Will be updated to the latest/last value read from STATUS_IOUT.*/
426 uint64_t statusIout = 0;
427
Brandon Wyman96893a42021-11-05 19:56:57 +0000428 /** @brief Will be updated to the latest/last value read from
Brandon Wyman7ee4d7e2021-11-19 20:48:23 +0000429 * STATUS_FANS_1_2. */
430 uint64_t statusFans12 = 0;
431
432 /** @brief Will be updated to the latest/last value read from
Brandon Wyman96893a42021-11-05 19:56:57 +0000433 * STATUS_TEMPERATURE.*/
434 uint64_t statusTemperature = 0;
435
Brandon Wymanb76ab242020-09-16 18:06:06 -0500436 /** @brief True if an error for a fault has already been logged. */
437 bool faultLogged = false;
438
Brandon Wyman96893a42021-11-05 19:56:57 +0000439 /** @brief True if bit 1 of STATUS_WORD low byte is on. */
Brandon Wyman85c7bf42021-10-19 22:28:48 +0000440 bool cmlFault = false;
441
Brandon Wyman3f1242f2020-01-28 13:11:25 -0600442 /** @brief True if bit 5 of STATUS_WORD high byte is on. */
443 bool inputFault = false;
444
445 /** @brief True if bit 4 of STATUS_WORD high byte is on. */
446 bool mfrFault = false;
447
448 /** @brief True if bit 3 of STATUS_WORD low byte is on. */
449 bool vinUVFault = false;
450
Brandon Wyman6710ba22021-10-27 17:39:31 +0000451 /** @brief True if bit 5 of STATUS_WORD low byte is on. */
452 bool voutOVFault = false;
453
Brandon Wymanb10b3be2021-11-09 22:12:15 +0000454 /** @brief True if bit 4 of STATUS_WORD low byte is on. */
455 bool ioutOCFault = false;
456
Brandon Wyman2cf46942021-10-28 19:09:16 +0000457 /** @brief True if bit 7 of STATUS_WORD high byte is on and bit 5 (VOUT_OV)
458 * of low byte is off. */
459 bool voutUVFault = false;
460
Brandon Wyman7ee4d7e2021-11-19 20:48:23 +0000461 /** @brief True if FANS fault/warn bit on in STATUS_WORD. */
462 bool fanFault = false;
463
Brandon Wyman96893a42021-11-05 19:56:57 +0000464 /** @brief True if bit 2 of STATUS_WORD low byte is on. */
465 bool tempFault = false;
466
Brandon Wyman2cf46942021-10-28 19:09:16 +0000467 /**
Brandon Wyman06ca4592021-12-06 22:52:23 +0000468 * @brief Incremented if bit 11 or 6 of STATUS_WORD is on. PGOOD# is
469 * inactive, or the unit is off.
470 *
471 * Considered faulted if reaches DEGLITCH_LIMIT.
Brandon Wyman2916ea52021-11-06 03:31:18 +0000472 */
Brandon Wyman925c0262021-12-21 20:15:36 +0000473 size_t pgoodFault = 0;
Brandon Wyman2916ea52021-11-06 03:31:18 +0000474
Brandon Wyman39ea02b2021-11-23 23:22:23 +0000475 /**
476 * @brief Power Supply Kill fault.
477 */
478 bool psKillFault = false;
479
480 /**
481 * @brief Power Supply 12Vcs fault (standby power).
482 */
483 bool ps12VcsFault = false;
484
485 /**
486 * @brief Power Supply Current-Share fault in 12V domain.
487 */
488 bool psCS12VFault = false;
489
Brandon Wymanf65c4062020-08-19 13:15:53 -0500490 /** @brief Count of the number of read failures. */
491 size_t readFail = 0;
492
Brandon Wymanaed1f752019-11-25 18:10:52 -0600493 /**
Brandon Wyman39ea02b2021-11-23 23:22:23 +0000494 * @brief Determine possible manufacturer-specific faults from bits in
495 * STATUS_MFR.
496 *
497 * The bits in the STATUS_MFR_SPECIFIC command response have "Manufacturer
498 * Defined" meanings. Determine which faults, if any, are present based on
499 * the power supply (device driver) type.
500 */
501 void determineMFRFault();
502
503 /**
Brandon Wyman6c2ac392021-12-21 22:23:06 +0000504 * @brief Examine STATUS_WORD value read for MFRSPECIFIC bit on.
505 *
506 * "A manufacturer specific fault or warning has occurred."
507 *
508 * If it is on, call the determineMFRFault() helper function to examine the
509 * value read from STATUS_MFR_SPECIFIC.
510 */
511 void analyzeMFRFault();
512
513 /**
Brandon Wymanaed1f752019-11-25 18:10:52 -0600514 * @brief D-Bus path to use for this power supply's inventory status.
515 **/
516 std::string inventoryPath;
517
B. J. Wyman681b2a32021-04-20 22:31:22 +0000518 /**
519 * @brief The libgpiod object for monitoring PSU presence
520 */
Adriana Kobylak3ca062a2021-10-20 15:27:23 +0000521 std::unique_ptr<GPIOInterfaceBase> presenceGPIO = nullptr;
B. J. Wyman681b2a32021-04-20 22:31:22 +0000522
Brandon Wymanaed1f752019-11-25 18:10:52 -0600523 /** @brief True if the power supply is present. */
524 bool present = false;
525
Adriana Kobylak572a9052021-03-30 15:58:07 +0000526 /** @brief Power supply model name. */
527 std::string modelName;
528
Brandon Wymanaed1f752019-11-25 18:10:52 -0600529 /** @brief D-Bus match variable used to subscribe to Present property
530 * changes.
531 **/
532 std::unique_ptr<sdbusplus::bus::match_t> presentMatch;
533
534 /** @brief D-Bus match variable used to subscribe for Present property
535 * interface added.
536 */
537 std::unique_ptr<sdbusplus::bus::match_t> presentAddedMatch;
538
539 /**
Brandon Wyman8d195772020-01-27 15:03:51 -0600540 * @brief Pointer to the PMBus interface
541 *
542 * Used to read or write to/from PMBus power supply devices.
543 */
Brandon Wyman9564e942020-11-10 14:01:42 -0600544 std::unique_ptr<phosphor::pmbus::PMBusBase> pmbusIntf = nullptr;
Brandon Wyman8d195772020-01-27 15:03:51 -0600545
Brandon Wymanc9efe412020-10-09 15:42:50 -0500546 /** @brief Stored copy of the firmware version/revision string */
547 std::string fwVersion;
548
Brandon Wyman8d195772020-01-27 15:03:51 -0600549 /**
B. J. Wyman681b2a32021-04-20 22:31:22 +0000550 * @brief The file system path used for binding the device driver.
551 */
552 const std::filesystem::path bindPath;
553
554 /* @brief The string to pass in for binding the device driver. */
555 std::string bindDevice;
556
557 /**
558 * @brief Binds or unbinds the power supply device driver
559 *
560 * Called when a presence change is detected to either bind the device
561 * driver for the power supply when it is installed, or unbind the device
562 * driver when the power supply is removed.
563 *
564 * Writes <device> to <path>/bind (or unbind)
565 *
566 * @param present - when true, will bind the device driver
567 * when false, will unbind the device driver
568 */
569 void bindOrUnbindDriver(bool present);
570
571 /**
Brandon Wymanaed1f752019-11-25 18:10:52 -0600572 * @brief Updates the presence status by querying D-Bus
573 *
574 * The D-Bus inventory properties for this power supply will be read to
575 * determine if the power supply is present or not and update this
576 * object's present member variable to reflect current status.
577 **/
578 void updatePresence();
579
580 /**
B. J. Wyman681b2a32021-04-20 22:31:22 +0000581 * @brief Updates the power supply presence by reading the GPIO line.
582 */
583 void updatePresenceGPIO();
584
585 /**
Brandon Wymanaed1f752019-11-25 18:10:52 -0600586 * @brief Callback for inventory property changes
587 *
588 * Process change of Present property for power supply.
589 *
B. J. Wyman681b2a32021-04-20 22:31:22 +0000590 * This is used if we are watching the D-Bus properties instead of reading
591 * the GPIO presence line ourselves.
592 *
Brandon Wymanaed1f752019-11-25 18:10:52 -0600593 * @param[in] msg - Data associated with Present change signal
594 **/
595 void inventoryChanged(sdbusplus::message::message& msg);
Brandon Wyman9a507db2021-02-25 16:15:22 -0600596
597 /**
598 * @brief Callback for inventory property added.
599 *
600 * Process add of the interface with the Present property for power supply.
601 *
B. J. Wyman681b2a32021-04-20 22:31:22 +0000602 * This is used if we are watching the D-Bus properties instead of reading
603 * the GPIO presence line ourselves.
604 *
Brandon Wyman9a507db2021-02-25 16:15:22 -0600605 * @param[in] msg - Data associated with Present add signal
606 **/
607 void inventoryAdded(sdbusplus::message::message& msg);
Brandon Wymana0f33ce2019-10-17 18:32:29 -0500608};
609
610} // namespace phosphor::power::psu