Add new PID Class types "power" and "powersum"

Implements this feature:
https://github.com/openbmc/phosphor-pid-control/issues/24

In addition to the existing "temp" and "margin" classes, adding
new "power" and "powersum" Class types.

The "power" class is the same as "temp", but expects D-Bus power
sensors, instead of D-Bus temperature sensors.

The "powersum" class is the same as "power", but sums together all of
the given inputs, instead of finding the maximum.

Signed-off-by: Josh Lehan <krellan@google.com>
Change-Id: I11d8ad8385632658ed061671134be87a560cd02a
diff --git a/dbus/dbusconfiguration.cpp b/dbus/dbusconfiguration.cpp
index 460e9e3..29f0ccb 100644
--- a/dbus/dbusconfiguration.cpp
+++ b/dbus/dbusconfiguration.cpp
@@ -646,7 +646,8 @@
                     // All non-fan PID classes should be initialized this way.
                     // As for why a fan should not use this code path, see
                     // the ed1dafdf168def37c65bfb7a5efd18d9dbe04727 commit.
-                    if ((pidClass == "temp") || (pidClass == "margin"))
+                    if ((pidClass == "temp") || (pidClass == "margin") ||
+                        (pidClass == "power") || (pidClass == "powersum"))
                     {
                         std::string inputSensorName =
                             getSensorNameFromPath(inputSensorPath);
diff --git a/dbus/dbusutil.cpp b/dbus/dbusutil.cpp
index 03cf41e..31526ca 100644
--- a/dbus/dbusutil.cpp
+++ b/dbus/dbusutil.cpp
@@ -103,6 +103,14 @@
     {
         layer = "temperature";
     }
+    else if (type == "power")
+    {
+        layer = "power";
+    }
+    else if (type == "powersum")
+    {
+        layer = "power";
+    }
     else
     {
         layer = "unknown"; // TODO(venture): Need to handle.
@@ -122,7 +130,8 @@
 
 bool validType(const std::string& type)
 {
-    static std::set<std::string> valid = {"fan", "temp", "margin"};
+    static std::set<std::string> valid = {"fan", "temp", "margin", "power",
+                                          "powersum"};
     return (valid.find(type) != valid.end());
 }