power-supply: don't fail if synch gpio not found
Working on a new system, aptly named system1, I hit issues utilizing the
psu monitor on power on where it was failing and putting the BMC state
into Quiesced.
The reason was that the power-ffs-sync-history GPIO is not defined in
the device tree for system1. The power supply details are still being
worked but they are going to look a lot like the p10bmc supplies so
would like to utilize the psu-monitoring features. With this change I
confirmed that the system1 simulation model powers on and everything
looks good with the d-bus objects for the power supplies.
If the current behavior is desired, then we could look into a meson
config option to define whether the power synch function is wanted.
Tested:
- Confirmed system1 chassis poweron works without psu-monitor service
failing
Change-Id: I3c8f50c6ae3c4ca150762e3828ab8a1935f7773f
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/phosphor-power-supply/psu_manager.cpp b/phosphor-power-supply/psu_manager.cpp
index bc9e35c..3af7e36 100644
--- a/phosphor-power-supply/psu_manager.cpp
+++ b/phosphor-power-supply/psu_manager.cpp
@@ -554,20 +554,31 @@
{
if (!syncHistoryGPIO)
{
- syncHistoryGPIO = createGPIO(INPUT_HISTORY_SYNC_GPIO);
+ try
+ {
+ syncHistoryGPIO = createGPIO(INPUT_HISTORY_SYNC_GPIO);
+ }
+ catch (const std::exception& e)
+ {
+ // Not an error, system just hasn't implemented the synch gpio
+ log<level::INFO>("No synchronization GPIO found");
+ syncHistoryGPIO = nullptr;
+ }
}
if (syncHistoryGPIO)
{
const std::chrono::milliseconds delay{INPUT_HISTORY_SYNC_DELAY};
log<level::INFO>("Synchronize INPUT_HISTORY");
syncHistoryGPIO->toggleLowHigh(delay);
- for (auto& psu : psus)
- {
- psu->clearSyncHistoryRequired();
- }
log<level::INFO>("Synchronize INPUT_HISTORY completed");
}
}
+
+ // Always clear synch history required after calling this function
+ for (auto& psu : psus)
+ {
+ psu->clearSyncHistoryRequired();
+ }
}
void PSUManager::analyze()