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/test/mock.hpp b/phosphor-power-supply/test/mock.hpp
index c1f8986..2731692 100644
--- a/phosphor-power-supply/test/mock.hpp
+++ b/phosphor-power-supply/test/mock.hpp
@@ -3,6 +3,10 @@
 #include "pmbus.hpp"
 #include "util_base.hpp"
 
+#include <gpiod.hpp>
+
+#include <bitset>
+
 #include <gmock/gmock.h>
 
 namespace phosphor
@@ -40,6 +44,16 @@
     MOCK_METHOD(bool, getPresence,
                 (sdbusplus::bus::bus & bus, const std::string& invpath),
                 (const, override));
+    MOCK_METHOD(void, setPresence,
+                (sdbusplus::bus::bus & bus, const std::string& invpath,
+                 bool present, const std::string& name),
+                (const, override));
+};
+
+class MockedGPIOReader : public GPIOInterface
+{
+  public:
+    MOCK_METHOD(int, read, (), (override));
 };
 
 const UtilBase& getUtils();