Add UCD90160 class

This class represents the UCD90160 power sequencer
chip, and provides the ability to check that chip for
voltage and PGOOD faults.

This commit just adds function stubs.

Change-Id: Iec6e83e9bcddbd476bdd86a887db08f5875f11cd
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/power-sequencer/ucd90160.cpp b/power-sequencer/ucd90160.cpp
new file mode 100644
index 0000000..739cff2
--- /dev/null
+++ b/power-sequencer/ucd90160.cpp
@@ -0,0 +1,116 @@
+/**
+ * Copyright © 2017 IBM Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <map>
+#include <memory>
+#include <phosphor-logging/elog.hpp>
+#include <phosphor-logging/log.hpp>
+#include <elog-errors.hpp>
+#include <xyz/openbmc_project/Sensor/Device/error.hpp>
+#include <xyz/openbmc_project/Control/Device/error.hpp>
+#include <xyz/openbmc_project/Power/Fault/error.hpp>
+#include "ucd90160.hpp"
+
+namespace witherspoon
+{
+namespace power
+{
+
+using namespace std::string_literals;
+
+const auto DEVICE_NAME = "UCD90160"s;
+const auto DRIVER_NAME = "ucd9000"s;
+
+using namespace pmbus;
+using namespace phosphor::logging;
+using namespace sdbusplus::xyz::openbmc_project::Control::Device::Error;
+using namespace sdbusplus::xyz::openbmc_project::Sensor::Device::Error;
+using namespace sdbusplus::xyz::openbmc_project::Power::Fault::Error;
+
+UCD90160::UCD90160(size_t instance) :
+    Device(DEVICE_NAME, instance),
+    interface(std::get<ucd90160::pathField>(
+                      deviceMap.find(instance)->second),
+              DRIVER_NAME,
+              instance)
+{
+}
+
+void UCD90160::onFailure()
+{
+    try
+    {
+        auto voutError = checkVOUTFaults();
+
+        auto pgoodError = checkPGOODFaults(false);
+
+        //Not a voltage or PGOOD fault, but we know something
+        //failed so still create an error log.
+        if (!voutError && !pgoodError)
+        {
+            createPowerFaultLog();
+        }
+    }
+    catch (ReadFailure& e)
+    {
+        if (!accessError)
+        {
+            commit<ReadFailure>();
+            accessError = true;
+        }
+    }
+}
+
+void UCD90160::analyze()
+{
+    try
+    {
+        //Note: Voltage faults are always fatal, so they just
+        //need to be analyzed in onFailure().
+
+        checkPGOODFaults(true);
+    }
+    catch (ReadFailure& e)
+    {
+        if (!accessError)
+        {
+            commit<ReadFailure>();
+            accessError = true;
+        }
+    }
+}
+
+void UCD90160::clearFaults()
+{
+
+}
+
+bool UCD90160::checkVOUTFaults()
+{
+    return false;
+}
+
+bool UCD90160::checkPGOODFaults(bool polling)
+{
+    return false;
+}
+
+void UCD90160::createPowerFaultLog()
+{
+
+}
+
+}
+}