psu-ng: Add DEGLITCH_LIMIT, deglitch pgoodFault
While the power supply should not arbitrarily report a PGOOD fault, and
then turn it back off, there is a perception that this is indeed
possible, a glitch of some sort.
To avoid possibly logging an error for an erroneous fault reporting,
make sure the fault is reported more than once before considering it to
be a true fault (deglitch the signal).
Tested:
Real Rainier 2S2U:
Verify tracing PGOOD faults seen and cleared, no error logged
Verify PGOOD/OFF error logged when manually set ON_OFF_CONFIG & OPERATION.
Verify deglitched PGOOD again on restart service (ON_OFF_CONFIG reset).
Change-Id: I54f775004d2e363cff21ff0512bd9283408f1f72
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
diff --git a/phosphor-power-supply/power_supply.hpp b/phosphor-power-supply/power_supply.hpp
index cf4c2bb..320fb65 100644
--- a/phosphor-power-supply/power_supply.hpp
+++ b/phosphor-power-supply/power_supply.hpp
@@ -34,6 +34,7 @@
#endif
constexpr auto LOG_LIMIT = 3;
+constexpr auto DEGLITCH_LIMIT = 3;
/**
* @class PowerSupply
@@ -207,7 +208,7 @@
{
return (hasCommFault() || vinUVFault || inputFault || voutOVFault ||
ioutOCFault || voutUVFault || fanFault || tempFault ||
- pgoodFault || mfrFault);
+ (pgoodFault >= DEGLITCH_LIMIT) || mfrFault);
}
/**
@@ -296,7 +297,7 @@
*/
bool hasPgoodFault() const
{
- return pgoodFault;
+ return (pgoodFault >= DEGLITCH_LIMIT);
}
/**
@@ -417,10 +418,12 @@
bool tempFault = false;
/**
- * @brief True if bit 11 or 6 of STATUS_WORD is on. PGOOD# is inactive, or
- * the unit is off.
+ * @brief Incremented if bit 11 or 6 of STATUS_WORD is on. PGOOD# is
+ * inactive, or the unit is off.
+ *
+ * Considered faulted if reaches DEGLITCH_LIMIT.
*/
- bool pgoodFault = false;
+ int pgoodFault = 0;
/** @brief Count of the number of read failures. */
size_t readFail = 0;