Prevent updating power cap sysfs file when OCC not active

The power cap can be updated at any time, but occ-control should only
update the sysfs files when the OCCs are active.
Also prevent sending pass through commands when OCC is not
active.

Change-Id: I7e5d5ad0b897b55a00e4d07c62b917aa62b7f9ef
Signed-off-by: Chris Cain <cjcain@us.ibm.com>
diff --git a/occ_manager.cpp b/occ_manager.cpp
index e621a21..f0c59bb 100644
--- a/occ_manager.cpp
+++ b/occ_manager.cpp
@@ -283,8 +283,6 @@
 #ifdef POWER10
         // Set the master OCC on the PowerMode object
         pmode->setMasterOcc(path);
-        // Update power cap bounds
-        pcap->updatePcapBounds();
 #endif
     }
 
diff --git a/occ_pass_through.cpp b/occ_pass_through.cpp
index c826983..6291828 100644
--- a/occ_pass_through.cpp
+++ b/occ_pass_through.cpp
@@ -75,6 +75,16 @@
 {
     std::vector<uint8_t> response{};
 
+    if (!occActive)
+    {
+        log<level::ERR>(
+            fmt::format(
+                "PassThrough::send() - OCC{} not active, command not sent",
+                occInstance)
+                .c_str());
+        return response;
+    }
+
     log<level::INFO>(
         fmt::format("PassThrough::send() Sending 0x{:02X} command to OCC{}",
                     command.front(), occInstance)
diff --git a/powercap.cpp b/powercap.cpp
index cac7465..65d8998 100644
--- a/powercap.cpp
+++ b/powercap.cpp
@@ -172,6 +172,12 @@
 // This will trigger the driver to send the cap to the OCC
 void PowerCap::writeOcc(uint32_t pcapValue)
 {
+    if (!occStatus.occActive())
+    {
+        // OCC not running, skip update
+        return;
+    }
+
     // Build the hwmon string to write the user power cap
     fs::path fileName = getPcapFilename(std::regex{"power\\d+_cap_user$"});
     if (fileName.empty())