meta-fii/meta-kudo: Use virtual sensor

add virtual sensors for DIMMG and CPU power

Signed-off-by: Mohaimen Alsamarai <mohaimen.alsamarai@fii-na.com>
Signed-off-by: Lancelot Kao <lancelot.kao@fii-usa.com>
Change-Id: Id7c8269899caddcb68f11c75e867fa173b0b8ee4
diff --git a/meta-fii/meta-kudo/recipes-phosphor/image/obmc-phosphor-image.bbappend b/meta-fii/meta-kudo/recipes-phosphor/image/obmc-phosphor-image.bbappend
index b73ad82..5ec39cd 100644
--- a/meta-fii/meta-kudo/recipes-phosphor/image/obmc-phosphor-image.bbappend
+++ b/meta-fii/meta-kudo/recipes-phosphor/image/obmc-phosphor-image.bbappend
@@ -9,3 +9,5 @@
 OBMC_IMAGE_EXTRA_INSTALL_append_kudo = " phosphor-sel-logger"
 OBMC_IMAGE_EXTRA_INSTALL_append_kudo = " usb-network"
 OBMC_IMAGE_EXTRA_INSTALL_append_kudo = " entity-manager"
+OBMC_IMAGE_EXTRA_INSTALL_append_kudo = " dbus-sensors"
+OBMC_IMAGE_EXTRA_INSTALL_append_kudo = " phosphor-virtual-sensor"
diff --git a/meta-fii/meta-kudo/recipes-phosphor/sensors/phosphor-virtual-sensor/virtual_sensor_config.json b/meta-fii/meta-kudo/recipes-phosphor/sensors/phosphor-virtual-sensor/virtual_sensor_config.json
index d7b2e44..c353e82 100644
--- a/meta-fii/meta-kudo/recipes-phosphor/sensors/phosphor-virtual-sensor/virtual_sensor_config.json
+++ b/meta-fii/meta-kudo/recipes-phosphor/sensors/phosphor-virtual-sensor/virtual_sensor_config.json
@@ -2,16 +2,16 @@
     {
         "Desc":
         {
-            "Name": "Mobo_NBM1_T",
+            "Name": "CPU0_NBM_T",
             "SensorType": "temperature",
-            "minValue": 0,
-            "maxValue": 160
+            "MinValue": 0,
+            "MaxValue": 160
         },
         "Threshold" :
         {
-            "CriticalHigh": 110,
+            "CriticalHigh": 86,
             "CriticalLow": 0,
-            "WarningHigh": 108,
+            "WarningHigh": 85,
             "WarningLow": 0
         },
         "Params":
@@ -22,7 +22,7 @@
                     "ParamName": "V1",
                     "Desc":
                     {
-                        "Name": "Mobo_NBM1_RAW",
+                        "Name": "CPU0_NBM_V",
                         "SensorType": "voltage"
                     }
                 }
@@ -33,16 +33,16 @@
     {
         "Desc":
         {
-            "Name": "Mobo_NBM2_T",
+            "Name": "CPU1_NBM_T",
             "SensorType": "temperature",
-            "minValue": 0,
-            "maxValue": 160
+            "MinValue": 0,
+            "MaxValue": 160
         },
         "Threshold" :
         {
-            "CriticalHigh": 110,
+            "CriticalHigh": 86,
             "CriticalLow": 0,
-            "WarningHigh": 108,
+            "WarningHigh": 85,
             "WarningLow": 0
         },
         "Params":
@@ -53,12 +53,342 @@
                     "ParamName": "V2",
                     "Desc":
                     {
-                        "Name": "Mobo_NBM2_RAW",
+                        "Name": "CPU1_NBM_V",
                         "SensorType": "voltage"
                     }
                 }
             ]
         },
         "Expression": "(V2 - 2.73) * 100"
+    },
+    {
+        "Desc":
+        {
+            "Name": "CPU0_DIMMG_T",
+            "SensorType": "temperature",
+            "MinValue": 0,
+            "MaxValue": 255
+        },
+        "Threshold" :
+        {
+            "CriticalHigh": 90,
+            "CriticalLow": 0,
+            "WarningHigh": 85,
+            "WarningLow": 0
+        },
+        "Params":
+        {
+            "DbusParam":
+            [
+                {
+                    "ParamName": "CH0",
+                    "Desc":
+                    {
+                        "Name": "CPU0_CH0DIMM_T",
+                        "SensorType": "temperature"
+                    }
+                },
+                {
+                    "ParamName": "CH1",
+                    "Desc":
+                    {
+                        "Name": "CPU0_CH1DIMM_T",
+                        "SensorType": "temperature"
+                    }
+                },
+                {
+                    "ParamName": "CH2",
+                    "Desc":
+                    {
+                        "Name": "CPU0_CH2DIMM_T",
+                        "SensorType": "temperature"
+                    }
+                },
+                {
+                    "ParamName": "CH3",
+                    "Desc":
+                    {
+                        "Name": "CPU0_CH3DIMM_T",
+                        "SensorType": "temperature"
+                    }
+                },
+                {
+                    "ParamName": "CH4",
+                    "Desc":
+                    {
+                        "Name": "CPU0_CH4DIMM_T",
+                        "SensorType": "temperature"
+                    }
+                },
+                {
+                    "ParamName": "CH5",
+                    "Desc":
+                    {
+                        "Name": "CPU0_CH5DIMM_T",
+                        "SensorType": "temperature"
+                    }
+                },
+                {
+                    "ParamName": "CH6",
+                    "Desc":
+                    {
+                        "Name": "CPU0_CH6DIMM_T",
+                        "SensorType": "temperature"
+                    }
+                },
+                {
+                    "ParamName": "CH7",
+                    "Desc":
+                    {
+                        "Name": "CPU0_CH7DIMM_T",
+                        "SensorType": "temperature"
+                    }
+                }
+            ]
+        },
+        "Expression": "max((CH0 == CH0) ? CH0 : 0,(CH1 == CH1) ? CH1 : 0,(CH2 == CH2) ? CH2 : 0,(CH3 == CH3) ? CH3 : 0,(CH4 == CH4) ? CH4 : 0,(CH5 == CH5) ? CH5 : 0,(CH6 == CH6) ? CH6 : 0,(CH7 == CH7) ? CH7 : 0)"
+    },
+    {
+        "Desc":
+        {
+            "Name": "CPU1_DIMMG_T",
+            "SensorType": "temperature",
+            "MinValue": 0,
+            "MaxValue": 255
+        },
+        "Threshold" :
+        {
+            "CriticalHigh": 90,
+            "CriticalLow": 0,
+            "WarningHigh": 85,
+            "WarningLow": 0
+        },
+        "Params":
+        {
+            "DbusParam":
+            [
+                {
+                    "ParamName": "CH0",
+                    "Desc":
+                    {
+                        "Name": "CPU1_CH0DIMM_T",
+                        "SensorType": "temperature"
+                    }
+                },
+                {
+                    "ParamName": "CH1",
+                    "Desc":
+                    {
+                        "Name": "CPU1_CH1DIMM_T",
+                        "SensorType": "temperature"
+                    }
+                },
+                {
+                    "ParamName": "CH2",
+                    "Desc":
+                    {
+                        "Name": "CPU1_CH2DIMM_T",
+                        "SensorType": "temperature"
+                    }
+                },
+                {
+                    "ParamName": "CH3",
+                    "Desc":
+                    {
+                        "Name": "CPU1_CH3DIMM_T",
+                        "SensorType": "temperature"
+                    }
+                },
+                {
+                    "ParamName": "CH4",
+                    "Desc":
+                    {
+                        "Name": "CPU1_CH4DIMM_T",
+                        "SensorType": "temperature"
+                    }
+                },
+                {
+                    "ParamName": "CH5",
+                    "Desc":
+                    {
+                        "Name": "CPU1_CH5DIMM_T",
+                        "SensorType": "temperature"
+                    }
+                },
+                {
+                    "ParamName": "CH6",
+                    "Desc":
+                    {
+                        "Name": "CPU1_CH6DIMM_T",
+                        "SensorType": "temperature"
+                    }
+                },
+                {
+                    "ParamName": "CH7",
+                    "Desc":
+                    {
+                        "Name": "CPU1_CH7DIMM_T",
+                        "SensorType": "temperature"
+                    }
+                }
+            ]
+        },
+        "Expression": "max((CH0 == CH0) ? CH0 : 0,(CH1 == CH1) ? CH1 : 0,(CH2 == CH2) ? CH2 : 0,(CH3 == CH3) ? CH3 : 0,(CH4 == CH4) ? CH4 : 0,(CH5 == CH5) ? CH5 : 0,(CH6 == CH6) ? CH6 : 0,(CH7 == CH7) ? CH7 : 0)"
+    },
+    {
+        "Desc":
+        {
+            "Name": "CPU0_DIMM_DDR_V",
+            "SensorType": "voltage",
+            "MinValue": 0,
+            "MaxValue": 5
+        },
+        "Threshold" :
+        {
+            "CriticalHigh": 2.999,
+            "CriticalLow": 0,
+            "WarningHigh": 0,
+            "WarningLow": 0
+        },
+        "Params":
+        {
+            "DbusParam":
+            [
+                {
+                    "ParamName": "V1",
+                    "Desc":
+                    {
+                        "Name": "CPU0_DIMM_VR1_V",
+                        "SensorType": "voltage"
+                    }
+                },
+                {
+                    "ParamName": "V2",
+                    "Desc":
+                    {
+                        "Name": "CPU0_DIMM_VR2_V",
+                        "SensorType": "voltage"
+                    }
+                }
+            ]
+        },
+        "Expression": "(V1 + V2) >= 0 ? (V1 + V2) : -1"
+    },
+    {
+        "Desc":
+        {
+            "Name": "CPU1_DIMM_DDR_V",
+            "SensorType": "voltage",
+            "MinValue": 0,
+            "MaxValue": 5
+        },
+        "Threshold" :
+        {
+            "CriticalHigh": 2.999,
+            "CriticalLow": 0,
+            "WarningHigh": 0,
+            "WarningLow": 0
+        },
+        "Params":
+        {
+            "DbusParam":
+            [
+                {
+                    "ParamName": "V1",
+                    "Desc":
+                    {
+                        "Name": "CPU1_DIMM_VR1_V",
+                        "SensorType": "voltage"
+                    }
+                },
+                {
+                    "ParamName": "V2",
+                    "Desc":
+                    {
+                        "Name": "CPU1_DIMM_VR2_V",
+                        "SensorType": "voltage"
+                    }
+                }
+            ]
+        },
+        "Expression": "(V1 + V2) >= 0 ? (V1 + V2) : -1"
+    },
+    {
+        "Desc":
+        {
+            "Name": "CPU0_MEM_PW",
+            "SensorType": "power",
+            "MinValue": 0,
+            "MaxValue": 80
+        },
+        "Threshold" :
+        {
+            "CriticalHigh": 29.987,
+            "CriticalLow": 0,
+            "WarningHigh": 0,
+            "WarningLow": 0
+        },
+        "Params":
+        {
+            "DbusParam":
+            [
+                {
+                    "ParamName": "P1",
+                    "Desc":
+                    {
+                        "Name": "CPU0_DIMM_VR1_PW",
+                        "SensorType": "power"
+                    }
+                },
+                {
+                    "ParamName": "P2",
+                    "Desc":
+                    {
+                        "Name": "CPU0_DIMM_VR2_PW",
+                        "SensorType": "power"
+                    }
+                }
+            ]
+        },
+        "Expression": "(P1 + P2) >= 0 ? (P1 + P2) : -1"
+    },
+    {
+        "Desc":
+        {
+            "Name": "CPU1_MEM_PW",
+            "SensorType": "power",
+            "MinValue": 0,
+            "MaxValue": 80
+        },
+        "Threshold" :
+        {
+            "CriticalHigh": 29.987,
+            "CriticalLow": 0,
+            "WarningHigh": 0,
+            "WarningLow": 0
+        },
+        "Params":
+        {
+            "DbusParam":
+            [
+                {
+                    "ParamName": "P1",
+                    "Desc":
+                    {
+                        "Name": "CPU1_DIMM_VR1_PW",
+                        "SensorType": "power"
+                    }
+                },
+                {
+                    "ParamName": "P2",
+                    "Desc":
+                    {
+                        "Name": "CPU1_DIMM_VR2_PW",
+                        "SensorType": "power"
+                    }
+                }
+            ]
+        },
+        "Expression": "(P1 + P2) >= 0 ? (P1 + P2) : -1"
     }
 ]