regulators: Convert to new SensorType enumeration

There are several types of voltage regulator sensors, such as vout,
iout, and temperature.

The sensor types were previously defined by the enumeration
pmbus_utils::SensorValueType.  This enumeration should not have been
placed in the pmbus_utils namespace because it is not specific to PMBus.

A new enumeration with the simpler name SensorType was created in
sensors.hpp in a previous commit.

Remove the old enumeration from pmbus_utils.  Convert affected files to
use the new enumeration.

Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: I4136b392b104edd3eee41ec29c779ad084c7c4de
diff --git a/phosphor-regulators/src/actions/pmbus_read_sensor_action.cpp b/phosphor-regulators/src/actions/pmbus_read_sensor_action.cpp
index fd58ae2..7ad0cad 100644
--- a/phosphor-regulators/src/actions/pmbus_read_sensor_action.cpp
+++ b/phosphor-regulators/src/actions/pmbus_read_sensor_action.cpp
@@ -74,7 +74,7 @@
 {
     std::ostringstream ss;
     ss << "pmbus_read_sensor: { ";
-    ss << "type: " << pmbus_utils::toString(type) << ", " << std::hex
+    ss << "type: " << sensors::toString(type) << ", " << std::hex
        << std::uppercase;
     ss << "command: 0x" << static_cast<uint16_t>(command) << ", " << std::dec
        << std::nouppercase;
diff --git a/phosphor-regulators/src/actions/pmbus_read_sensor_action.hpp b/phosphor-regulators/src/actions/pmbus_read_sensor_action.hpp
index 620a814..36df590 100644
--- a/phosphor-regulators/src/actions/pmbus_read_sensor_action.hpp
+++ b/phosphor-regulators/src/actions/pmbus_read_sensor_action.hpp
@@ -19,6 +19,7 @@
 #include "i2c_action.hpp"
 #include "i2c_interface.hpp"
 #include "pmbus_utils.hpp"
+#include "sensors.hpp"
 
 #include <cstdint>
 #include <optional>
@@ -57,7 +58,7 @@
     /**
      * Constructor.
      *
-     * @param type Sensor value type.
+     * @param type Sensor type.
      * @param command PMBus command code.
      * @param format Data format of the sensor value returned by the device.
      * @param exponent Exponent value for linear_16 data format.
@@ -65,8 +66,7 @@
      *                 exponent value will be read from VOUT_MODE.
      *                 Should not be specified if the data format is linear_11.
      */
-    explicit PMBusReadSensorAction(pmbus_utils::SensorValueType type,
-                                   uint8_t command,
+    explicit PMBusReadSensorAction(SensorType type, uint8_t command,
                                    pmbus_utils::SensorDataFormat format,
                                    std::optional<int8_t> exponent) :
         type{type},
@@ -79,7 +79,7 @@
      *
      * Reads one sensor using the I2C interface.
      *
-     * The sensor value type is specified in the constructor.
+     * The sensor type is specified in the constructor.
      *
      * The PMBus command code is specified in the constructor.
      * It is the register to read on the device.
@@ -132,11 +132,11 @@
     }
 
     /**
-     * Returns the sensor value type.
+     * Returns the sensor type.
      *
-     * @return sensor value type.
+     * @return sensor type.
      */
-    pmbus_utils::SensorValueType getType() const
+    SensorType getType() const
     {
         return type;
     }
@@ -167,9 +167,9 @@
                             i2c::I2CInterface& interface);
 
     /**
-     * Sensor value type.
+     * Sensor type.
      */
-    const pmbus_utils::SensorValueType type{};
+    const SensorType type{};
 
     /**
      * PMBus command code.
diff --git a/phosphor-regulators/src/config_file_parser.cpp b/phosphor-regulators/src/config_file_parser.cpp
index 123cb4d..99abd6c 100644
--- a/phosphor-regulators/src/config_file_parser.cpp
+++ b/phosphor-regulators/src/config_file_parser.cpp
@@ -690,7 +690,7 @@
 
     // Required type property
     const json& typeElement = getRequiredProperty(element, "type");
-    pmbus_utils::SensorValueType type = parseSensorValueType(typeElement);
+    SensorType type = parseSensorType(typeElement);
     ++propertyCount;
 
     // Required command property
@@ -997,54 +997,54 @@
     return std::make_unique<SensorMonitoring>(std::move(actions));
 }
 
-pmbus_utils::SensorValueType parseSensorValueType(const json& element)
+SensorType parseSensorType(const json& element)
 {
     if (!element.is_string())
     {
         throw std::invalid_argument{"Element is not a string"};
     }
     std::string value = element.get<std::string>();
-    pmbus_utils::SensorValueType type{};
+    SensorType type{};
 
     if (value == "iout")
     {
-        type = pmbus_utils::SensorValueType::iout;
+        type = SensorType::iout;
     }
     else if (value == "iout_peak")
     {
-        type = pmbus_utils::SensorValueType::iout_peak;
+        type = SensorType::iout_peak;
     }
     else if (value == "iout_valley")
     {
-        type = pmbus_utils::SensorValueType::iout_valley;
+        type = SensorType::iout_valley;
     }
     else if (value == "pout")
     {
-        type = pmbus_utils::SensorValueType::pout;
+        type = SensorType::pout;
     }
     else if (value == "temperature")
     {
-        type = pmbus_utils::SensorValueType::temperature;
+        type = SensorType::temperature;
     }
     else if (value == "temperature_peak")
     {
-        type = pmbus_utils::SensorValueType::temperature_peak;
+        type = SensorType::temperature_peak;
     }
     else if (value == "vout")
     {
-        type = pmbus_utils::SensorValueType::vout;
+        type = SensorType::vout;
     }
     else if (value == "vout_peak")
     {
-        type = pmbus_utils::SensorValueType::vout_peak;
+        type = SensorType::vout_peak;
     }
     else if (value == "vout_valley")
     {
-        type = pmbus_utils::SensorValueType::vout_valley;
+        type = SensorType::vout_valley;
     }
     else
     {
-        throw std::invalid_argument{"Element is not a sensor value type"};
+        throw std::invalid_argument{"Element is not a sensor type"};
     }
 
     return type;
diff --git a/phosphor-regulators/src/config_file_parser.hpp b/phosphor-regulators/src/config_file_parser.hpp
index 4b39b7e..63dcfd6 100644
--- a/phosphor-regulators/src/config_file_parser.hpp
+++ b/phosphor-regulators/src/config_file_parser.hpp
@@ -39,6 +39,7 @@
 #include "rule.hpp"
 #include "run_rule_action.hpp"
 #include "sensor_monitoring.hpp"
+#include "sensors.hpp"
 #include "set_device_action.hpp"
 
 #include <nlohmann/json.hpp>
@@ -684,17 +685,16 @@
     parseSensorMonitoring(const nlohmann::json& element);
 
 /**
- * Parses a JSON element containing a SensorValueType expressed as a string.
+ * Parses a JSON element containing a SensorType expressed as a string.
  *
- * Returns the corresponding SensorValueType enum value.
+ * Returns the corresponding SensorType enum value.
  *
  * Throws an exception if parsing fails.
  *
  * @param element JSON element
- * @return SensorValueType enum value
+ * @return SensorType enum value
  */
-pmbus_utils::SensorValueType
-    parseSensorValueType(const nlohmann::json& element);
+SensorType parseSensorType(const nlohmann::json& element);
 
 /**
  * Parses a JSON element containing a set_device action.
diff --git a/phosphor-regulators/src/pmbus_utils.cpp b/phosphor-regulators/src/pmbus_utils.cpp
index eb9e117..ed62515 100644
--- a/phosphor-regulators/src/pmbus_utils.cpp
+++ b/phosphor-regulators/src/pmbus_utils.cpp
@@ -73,42 +73,6 @@
     return returnValue;
 }
 
-std::string toString(SensorValueType type)
-{
-    std::string returnValue{};
-    switch (type)
-    {
-        case SensorValueType::iout:
-            returnValue = "iout";
-            break;
-        case SensorValueType::iout_peak:
-            returnValue = "iout_peak";
-            break;
-        case SensorValueType::iout_valley:
-            returnValue = "iout_valley";
-            break;
-        case SensorValueType::pout:
-            returnValue = "pout";
-            break;
-        case SensorValueType::temperature:
-            returnValue = "temperature";
-            break;
-        case SensorValueType::temperature_peak:
-            returnValue = "temperature_peak";
-            break;
-        case SensorValueType::vout:
-            returnValue = "vout";
-            break;
-        case SensorValueType::vout_peak:
-            returnValue = "vout_peak";
-            break;
-        case SensorValueType::vout_valley:
-            returnValue = "vout_valley";
-            break;
-    }
-    return returnValue;
-}
-
 std::string toString(VoutDataFormat format)
 {
     std::string returnValue{};
diff --git a/phosphor-regulators/src/pmbus_utils.hpp b/phosphor-regulators/src/pmbus_utils.hpp
index 438ee46..94e4ef1 100644
--- a/phosphor-regulators/src/pmbus_utils.hpp
+++ b/phosphor-regulators/src/pmbus_utils.hpp
@@ -60,57 +60,6 @@
 };
 
 /**
- * Sensor Value Type.
- */
-enum class SensorValueType
-{
-    /**
-     * Output current.
-     */
-    iout,
-
-    /**
-     * Highest output current.
-     */
-    iout_peak,
-
-    /**
-     * Lowest output current.
-     */
-    iout_valley,
-
-    /**
-     * Output power.
-     */
-    pout,
-
-    /**
-     * Temperature.
-     */
-    temperature,
-
-    /**
-     * Highest temperature.
-     */
-    temperature_peak,
-
-    /**
-     * Output voltage.
-     */
-    vout,
-
-    /**
-     * Highest output voltage.
-     */
-    vout_peak,
-
-    /**
-     * Lowest output voltage.
-     */
-    vout_valley
-};
-
-/**
  * Data formats for output voltage.
  *
  * These formats are used for commanding and reading output voltage and related
@@ -169,14 +118,6 @@
 std::string toString(SensorDataFormat format);
 
 /**
- * Converts the specified SensorValueType value to string.
- *
- * @param type SensorValueType type
- * @return string corresponding to the enum value
- */
-std::string toString(SensorValueType type);
-
-/**
  * Converts the specified VoutDataFormat value to string.
  *
  * @param format VoutDataFormat format