psu-ng: Add in ability to get presence via GPIO

The device tree and entity-manager (D-Bus) properties have the power
supply GPIO presence lines named, so we can use those GPIO line names to
find the GPIO device to read for determining power supply presence.

Some systems have the power supply presence lines in a gpio-keys section
(notably IBM Rainier). To facilitate continued function while running
with a device tree that has not removed those device tree entries, allow
for a fallback to the old inventory D-Bus propertiesChanged or
interfaceAdded matches for presence.

Change-Id: I5002aa62e5b460463cc26328c889a3786b467a3c
Signed-off-by: B. J. Wyman <bjwyman@gmail.com>
diff --git a/phosphor-power-supply/util_base.hpp b/phosphor-power-supply/util_base.hpp
index ab1a962..194ddff 100644
--- a/phosphor-power-supply/util_base.hpp
+++ b/phosphor-power-supply/util_base.hpp
@@ -18,6 +18,10 @@
 
     virtual bool getPresence(sdbusplus::bus::bus& bus,
                              const std::string& invpath) const = 0;
+
+    virtual void setPresence(sdbusplus::bus::bus& bus,
+                             const std::string& invpath, bool present,
+                             const std::string& name) const = 0;
 };
 
 const UtilBase& getUtils();
@@ -27,4 +31,18 @@
     return getUtils().getPresence(bus, invpath);
 }
 
+inline void setPresence(sdbusplus::bus::bus& bus, const std::string& invpath,
+                        bool present, const std::string& name)
+{
+    return getUtils().setPresence(bus, invpath, present, name);
+}
+
+class GPIOInterface
+{
+  public:
+    virtual ~GPIOInterface() = default;
+
+    virtual int read() = 0;
+};
+
 } // namespace phosphor::power::psu