psu-ng: Clear fault bits in STATUS_WORD
Allow for clearing the fault bits in STATUS_WORD (and STATUS_BYTE) by
having the clearFaults() function read from the in1_crit file in the
hwmon directory.
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
Change-Id: I1a3ad5c2402a61ff1172428085c4d707dc6166e4
diff --git a/phosphor-power-supply/power_supply.hpp b/phosphor-power-supply/power_supply.hpp
index 30fbf74..fdbb94f 100644
--- a/phosphor-power-supply/power_supply.hpp
+++ b/phosphor-power-supply/power_supply.hpp
@@ -78,6 +78,15 @@
inputFault = false;
mfrFault = false;
vinUVFault = false;
+
+ // The PMBus device driver does not allow for writing CLEAR_FAULTS
+ // directly. However, the pmbus hwmon device driver code will send a
+ // CLEAR_FAULTS after reading from any of the hwmon "files" in sysfs, so
+ // reading in1_crit should result in clearing the fault bits in
+ // STATUS_BYTE/STATUS_WORD.
+ // I do not care what the return value is.
+ static_cast<void>(
+ pmbusIntf->read("in1_crit", phosphor::pmbus::Type::Hwmon));
}
/**