pseq: Add GPIOs to power control application
Add power control GPIOs for power on / off control and chassis power
good monitoring. Use libgpiod and make neccessary meson changes.
Signed-off-by: Jim Wright <jlwright@us.ibm.com>
Change-Id: I4f44552e855547fea466a98cb71acdb315aa26f5
diff --git a/phosphor-power-sequencer/src/power_control.hpp b/phosphor-power-sequencer/src/power_control.hpp
index 248431a..4359074 100644
--- a/phosphor-power-sequencer/src/power_control.hpp
+++ b/phosphor-power-sequencer/src/power_control.hpp
@@ -2,9 +2,11 @@
#include "power_interface.hpp"
+#include <gpiod.hpp>
#include <sdbusplus/bus.hpp>
#include <sdbusplus/message.hpp>
#include <sdbusplus/server/object.hpp>
+#include <sdeventplus/clock.hpp>
#include <sdeventplus/event.hpp>
#include <sdeventplus/utility/timer.hpp>
@@ -59,23 +61,43 @@
sdbusplus::bus::bus& bus;
/**
+ * Indicates if a state transistion is taking place
+ */
+ bool inStateTransition{false};
+
+ /**
* Power good
*/
int pgood{0};
/**
+ * GPIO line object for chassis power good
+ */
+ gpiod::line pgoodLine;
+
+ /**
* Power good timeout constant
*/
static constexpr std::chrono::seconds pgoodTimeout{
std::chrono::seconds(10)};
/**
+ * Point in time at which power good timeout will take place
+ */
+ std::chrono::time_point<std::chrono::steady_clock> pgoodTimeoutTime;
+
+ /**
* Poll interval constant
*/
static constexpr std::chrono::milliseconds pollInterval{
std::chrono::milliseconds(3000)};
/**
+ * GPIO line object for power-on / power-off control
+ */
+ gpiod::line powerControlLine;
+
+ /**
* Power state
*/
int state{0};
@@ -94,6 +116,11 @@
* Polling method for monitoring the system power good
*/
void pollPgood();
+
+ /**
+ * Set up GPIOs
+ */
+ void setUpGpio();
};
} // namespace phosphor::power::sequencer