BMC:  Fan control for Idle Power saver

Read IPS active from sysfs and push onto dBus IPS properties
Tested: enable/disable IPS on WEB, occ instrospect ips
Signed-off-by: Sheldon Bailey <baileysh@us.ibm.com>
Change-Id: I12935a4c9f82bf004b1311e477f73ed8b1401a91
diff --git a/occ_device.hpp b/occ_device.hpp
index 3c11d13..5b66bf5 100644
--- a/occ_device.hpp
+++ b/occ_device.hpp
@@ -6,6 +6,7 @@
 #include "occ_events.hpp"
 #include "occ_ffdc.hpp"
 #include "occ_presence.hpp"
+#include "powermode.hpp"
 
 #include <org/open_power/OCC/Device/error.hpp>
 
@@ -45,7 +46,11 @@
      *  @param[in] instance - OCC instance number
      */
     Device(EventPtr& event, const fs::path& path, Manager& manager,
-           Status& status, unsigned int instance = 0) :
+           Status& status,
+#ifdef POWER10
+           std::unique_ptr<powermode::PowerMode>& powerModeRef,
+#endif
+           unsigned int instance = 0) :
         config(getPathBack(path)),
         devPath(path), instance(instance), statusObject(status),
         managerObject(manager),
@@ -78,6 +83,10 @@
         throttleMemTemp(event, path / "occ_mem_throttle",
                         std::bind(std::mem_fn(&Device::throttleMemTempCallback),
                                   this, std::placeholders::_1))
+#ifdef POWER10
+        ,
+        pmode(powerModeRef)
+#endif
     {
         // Nothing to do here
     }
@@ -129,6 +138,13 @@
             throttleProcTemp.addWatch(poll);
         }
 
+#ifdef POWER10
+        if (master())
+        {
+            pmode->addIpsWatch(poll);
+        }
+#endif
+
         throttleProcPower.addWatch(poll);
         throttleMemTemp.addWatch(poll);
 
@@ -164,6 +180,12 @@
         throttleMemTemp.removeWatch();
         throttleProcPower.removeWatch();
         throttleProcTemp.removeWatch();
+#ifdef POWER10
+        if (master())
+        {
+            pmode->removeIpsWatch();
+        }
+#endif
     }
 
     /** @brief Starts to watch how many OCCs are present on the master */
@@ -229,6 +251,11 @@
     Error throttleProcPower;
     Error throttleMemTemp;
 
+#ifdef POWER10
+    /** @brief OCC PowerMode object */
+    std::unique_ptr<powermode::PowerMode>& pmode;
+#endif
+
     /** @brief file writer to achieve bind and unbind
      *
      *  @param[in] filename - Name of file to be written