Implement de-glitch for PGOOD and UNIT_IS_OFF
De-glitch the powerOnFault so that a fault is logged only if the
POWER_GOOD Negated or UNIT_IS_OFF bits are in the wrong state three
times in a row.
Resolves openbmc/openbmc#2473
Change-Id: Icbb45010f921bd3e11018f5e7bdc2d155242d464
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
diff --git a/power-supply/power_supply.hpp b/power-supply/power_supply.hpp
index 474ad8d..38e2342 100644
--- a/power-supply/power_supply.hpp
+++ b/power-supply/power_supply.hpp
@@ -14,6 +14,8 @@
namespace sdbusRule = sdbusplus::bus::match::rules;
+constexpr auto FAULT_COUNT = 3;
+
/**
* @class PowerSupply
* Represents a PMBus power supply device.
@@ -97,8 +99,11 @@
/** @brief True if the power is on. */
bool powerOn = false;
- /** @brief True if power on fault has been detected/reported. */
- bool powerOnFault = false;
+ /**
+ * @brief Equal to FAULT_COUNT if power on fault has been
+ * detected.
+ */
+ size_t powerOnFault = 0;
/** @brief The sd_event structure used by the power on timer. */
event::Event& event;