psu-ng: Implement gpio write function

Implement a gpio write function to allow writing to gpios via the
libgpiod bindings. The bindings allow to set the desired gpio value by
passing it to the line request call.

Add the ability to pass flags as defined in gpiod.hpp so that the caller
can specify options such as FLAG_OPEN_DRAIN.

Change-Id: Ia7329a17c46f4f1fda0b66f795f123c8524a1be5
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/phosphor-power-supply/util.hpp b/phosphor-power-supply/util.hpp
index ca0bf3c..40fe5ca 100644
--- a/phosphor-power-supply/util.hpp
+++ b/phosphor-power-supply/util.hpp
@@ -10,6 +10,8 @@
 #include <phosphor-logging/elog.hpp>
 #include <phosphor-logging/log.hpp>
 
+#include <bitset>
+
 namespace phosphor::power::psu
 {
 
@@ -122,6 +124,17 @@
     int read() override;
 
     /**
+     * @brief Attempts to set the state of the GPIO line to the specified value.
+     *
+     * Throws an exception if line not found, request line fails, or set_value
+     * to line fails.
+     *
+     * @param[in] value - The value to set the state of the GPIO line, 1 or 0.
+     * @param[in] flags - Additional line request flags as defined in gpiod.hpp.
+     */
+    void write(int value, std::bitset<32> flags) override;
+
+    /**
      * @brief Returns the name of the GPIO, if not empty.
      */
     std::string getName() const override;