meta-fii: meta-kudo: Remove the 2p sensor support

Removed the 2p sensor support from the phosphor-virtual-sensor
and modified the recipe accordingly to support the new config.

Signed-off-by: Avenash Asai Thambi <avenash.thambi@fii-usa.com>
Change-Id: Ie9896ed6473844f54ba0fb3e422de946bec52892
diff --git a/meta-fii/meta-kudo/recipes-phosphor/sensors/phosphor-virtual-sensor/cpu_detect_virtual.service b/meta-fii/meta-kudo/recipes-phosphor/sensors/phosphor-virtual-sensor/cpu_detect_virtual.service
deleted file mode 100644
index 0f8cefe..0000000
--- a/meta-fii/meta-kudo/recipes-phosphor/sensors/phosphor-virtual-sensor/cpu_detect_virtual.service
+++ /dev/null
@@ -1,12 +0,0 @@
-[Unit]
-Description=Detect CPUs to change config
-Requires=xyz.openbmc_project.adcsensor.service
-After=xyz.openbmc_project.adcsensor.service
-Before=phosphor-virtual-sensor.service
-
-[Service]
-Type=oneshot
-ExecStart=/usr/libexec/phosphor-virtual-sensor/cpu_detect_virtual.sh
-
-[Install]
-WantedBy=multi-user.target
diff --git a/meta-fii/meta-kudo/recipes-phosphor/sensors/phosphor-virtual-sensor/cpu_detect_virtual.sh b/meta-fii/meta-kudo/recipes-phosphor/sensors/phosphor-virtual-sensor/cpu_detect_virtual.sh
deleted file mode 100644
index 0cdde03..0000000
--- a/meta-fii/meta-kudo/recipes-phosphor/sensors/phosphor-virtual-sensor/cpu_detect_virtual.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/bash
-#Prototype CPU detection script
-
-# Provide source directive to shellcheck.
-# shellcheck source=meta-fii/meta-kudo/recipes-kudo/kudo-fw-utility/kudo-fw/kudo-lib.sh
-source /usr/libexec/kudo-fw/kudo-lib.sh
-
-CPU1_STATUS_N=$(get_gpio_ctrl S1_STATUS_N)
-sleep 60
-if [[ $CPU1_STATUS_N == 1 ]]; then
-    cp -f /etc/virtual-sensor/configurations/virtual_sensor_config1p.json /usr/share/phosphor-virtual-sensor/virtual_sensor_config.json
-        else
-    cp -f /etc/virtual-sensor/configurations/virtual_sensor_config2p.json /usr/share/phosphor-virtual-sensor/virtual_sensor_config.json
-        fi
diff --git a/meta-fii/meta-kudo/recipes-phosphor/sensors/phosphor-virtual-sensor/virtual_sensor_config1p.json b/meta-fii/meta-kudo/recipes-phosphor/sensors/phosphor-virtual-sensor/virtual_sensor_config.json
similarity index 100%
rename from meta-fii/meta-kudo/recipes-phosphor/sensors/phosphor-virtual-sensor/virtual_sensor_config1p.json
rename to meta-fii/meta-kudo/recipes-phosphor/sensors/phosphor-virtual-sensor/virtual_sensor_config.json
diff --git a/meta-fii/meta-kudo/recipes-phosphor/sensors/phosphor-virtual-sensor/virtual_sensor_config2p.json b/meta-fii/meta-kudo/recipes-phosphor/sensors/phosphor-virtual-sensor/virtual_sensor_config2p.json
deleted file mode 100644
index d7a5d1b..0000000
--- a/meta-fii/meta-kudo/recipes-phosphor/sensors/phosphor-virtual-sensor/virtual_sensor_config2p.json
+++ /dev/null
@@ -1,588 +0,0 @@
-[
-    {
-       "Desc":{
-          "Name":"CPU0_NBM_T",
-          "SensorType":"temperature",
-          "MinValue":0,
-          "MaxValue":160
-       },
-       "Threshold":
-       {
-          "CriticalHigh":110,
-          "WarningHigh":108
-       },
-       "Associations":[
-          [
-             "chassis",
-             "all_sensors",
-             "/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
-          ],
-          [
-             "inventory",
-             "sensors",
-             "/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
-          ]
-       ],
-       "Params":{
-          "DbusParam":[
-             {
-                "ParamName":"CPU0_NBM2G_TMP_V",
-                "Desc":{
-                   "Name":"CPU0_NBM2G_TMP_V",
-                   "SensorType":"voltage"
-                }
-             }
-          ]
-       },
-       "Expression":"(CPU0_NBM2G_TMP_V == CPU0_NBM2G_TMP_V) ? (CPU0_NBM2G_TMP_V - 2.73) * 100 : NULL"
-    },
-    {
-       "Desc":{
-          "Name":"CPU1_NBM_T",
-          "SensorType":"temperature",
-          "MinValue":0,
-          "MaxValue":160
-       },
-       "Threshold":
-       {
-          "CriticalHigh":110,
-          "WarningHigh":108
-       },
-       "Associations":[
-          [
-             "chassis",
-             "all_sensors",
-             "/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
-          ],
-          [
-             "inventory",
-             "sensors",
-             "/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
-          ]
-       ],
-       "Params":{
-          "DbusParam":[
-             {
-                "ParamName":"CPU1_NBM2G_TMP_V",
-                "Desc":{
-                   "Name":"CPU1_NBM2G_TMP_V",
-                   "SensorType":"voltage"
-                }
-             }
-          ]
-       },
-       "Expression":"(CPU1_NBM2G_TMP_V == CPU1_NBM2G_TMP_V) ? (CPU1_NBM2G_TMP_V - 2.73) * 100 : NULL"
-    },
-    {
-       "Desc":{
-          "Name":"CPU0_DIMMG_T",
-          "SensorType":"temperature",
-          "MinValue":0,
-          "MaxValue":255
-       },
-       "Threshold":
-       {
-          "CriticalHigh":90,
-          "WarningHigh":85
-       },
-       "Associations":[
-          [
-             "chassis",
-             "all_sensors",
-             "/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
-          ],
-          [
-             "inventory",
-             "sensors",
-             "/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
-          ]
-       ],
-       "Params":{
-          "DbusParam":[
-             {
-                "ParamName":"CPU0_CH0",
-                "Desc":{
-                   "Name":"CPU0_CH0DIMM_T",
-                   "SensorType":"temperature"
-                }
-             },
-             {
-                "ParamName":"CPU0_CH1",
-                "Desc":{
-                   "Name":"CPU0_CH1DIMM_T",
-                   "SensorType":"temperature"
-                }
-             },
-             {
-                "ParamName":"CPU0_CH2",
-                "Desc":{
-                   "Name":"CPU0_CH2DIMM_T",
-                   "SensorType":"temperature"
-                }
-             },
-             {
-                "ParamName":"CPU0_CH3",
-                "Desc":{
-                   "Name":"CPU0_CH3DIMM_T",
-                   "SensorType":"temperature"
-                }
-             },
-             {
-                "ParamName":"CPU0_CH4",
-                "Desc":{
-                   "Name":"CPU0_CH4DIMM_T",
-                   "SensorType":"temperature"
-                }
-             },
-             {
-                "ParamName":"CPU0_CH5",
-                "Desc":{
-                   "Name":"CPU0_CH5DIMM_T",
-                   "SensorType":"temperature"
-                }
-             },
-             {
-                "ParamName":"CPU0_CH6",
-                "Desc":{
-                   "Name":"CPU0_CH6DIMM_T",
-                   "SensorType":"temperature"
-                }
-             },
-             {
-                "ParamName":"CPU0_CH7",
-                "Desc":{
-                   "Name":"CPU0_CH7DIMM_T",
-                   "SensorType":"temperature"
-                }
-             }
-          ]
-       },
-       "Expression":"var x := max((CPU0_CH0 == CPU0_CH0) ? CPU0_CH0 : 0,(CPU0_CH1 == CPU0_CH1) ? CPU0_CH1 : 0,(CPU0_CH2 == CPU0_CH2) ? CPU0_CH2 : 0,(CPU0_CH3 == CPU0_CH3) ? CPU0_CH3 : 0,(CPU0_CH4 == CPU0_CH4) ? CPU0_CH4 : 0,(CPU0_CH5 == CPU0_CH5) ? CPU0_CH5 : 0,(CPU0_CH6 == CPU0_CH6) ? CPU0_CH6 : 0,(CPU0_CH7 == CPU0_CH7) ? CPU0_CH7 : 0); x == 0 ? NULL : x"
-    },
-    {
-       "Desc":{
-          "Name":"CPU1_DIMMG_T",
-          "SensorType":"temperature",
-          "MinValue":0,
-          "MaxValue":255
-       },
-       "Threshold":
-       {
-          "CriticalHigh":90,
-          "WarningHigh":85
-       },
-       "Associations":[
-          [
-             "chassis",
-             "all_sensors",
-             "/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
-          ],
-          [
-             "inventory",
-             "sensors",
-             "/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
-          ]
-       ],
-       "Params":{
-          "DbusParam":[
-             {
-                "ParamName":"CPU1_CH0",
-                "Desc":{
-                   "Name":"CPU1_CH0DIMM_T",
-                   "SensorType":"temperature"
-                }
-             },
-             {
-                "ParamName":"CPU1_CH1",
-                "Desc":{
-                   "Name":"CPU1_CH1DIMM_T",
-                   "SensorType":"temperature"
-                }
-             },
-             {
-                "ParamName":"CPU1_CH2",
-                "Desc":{
-                   "Name":"CPU1_CH2DIMM_T",
-                   "SensorType":"temperature"
-                }
-             },
-             {
-                "ParamName":"CPU1_CH3",
-                "Desc":{
-                   "Name":"CPU1_CH3DIMM_T",
-                   "SensorType":"temperature"
-                }
-             },
-             {
-                "ParamName":"CPU1_CH4",
-                "Desc":{
-                   "Name":"CPU1_CH4DIMM_T",
-                   "SensorType":"temperature"
-                }
-             },
-             {
-                "ParamName":"CPU1_CH5",
-                "Desc":{
-                   "Name":"CPU1_CH5DIMM_T",
-                   "SensorType":"temperature"
-                }
-             },
-             {
-                "ParamName":"CPU1_CH6",
-                "Desc":{
-                   "Name":"CPU1_CH6DIMM_T",
-                   "SensorType":"temperature"
-                }
-             },
-             {
-                "ParamName":"CPU1_CH7",
-                "Desc":{
-                   "Name":"CPU1_CH7DIMM_T",
-                   "SensorType":"temperature"
-                }
-             }
-          ]
-       },
-       "Expression":"var x := max((CPU1_CH0 == CPU1_CH0) ? CPU1_CH0 : 0,(CPU1_CH1 == CPU1_CH1) ? CPU1_CH1 : 0,(CPU1_CH2 == CPU1_CH2) ? CPU1_CH2 : 0,(CPU1_CH3 == CPU1_CH3) ? CPU1_CH3 : 0,(CPU1_CH4 == CPU1_CH4) ? CPU1_CH4 : 0,(CPU1_CH5 == CPU1_CH5) ? CPU1_CH5 : 0,(CPU1_CH6 == CPU1_CH6) ? CPU1_CH6 : 0,(CPU1_CH7 == CPU1_CH7) ? CPU1_CH7 : 0); x == 0 ? NULL : x"
-    },
-    {
-       "Desc":{
-          "Name":"CPU0_DIMM_DDR_V",
-          "SensorType":"voltage",
-          "MinValue":0,
-          "MaxValue":5
-       },
-       "Threshold":
-       {
-          "CriticalHigh":2.999
-       },
-       "Associations":[
-          [
-             "chassis",
-             "all_sensors",
-             "/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
-          ],
-          [
-             "inventory",
-             "sensors",
-             "/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
-          ]
-       ],
-       "Params":{
-          "DbusParam":[
-             {
-                "ParamName":"CPU0_DIMM_VR1_V",
-                "Desc":{
-                   "Name":"CPU0_DIMM_VR1_V",
-                   "SensorType":"voltage"
-                }
-             },
-             {
-                "ParamName":"CPU0_DIMM_VR2_V",
-                "Desc":{
-                   "Name":"CPU0_DIMM_VR2_V",
-                   "SensorType":"voltage"
-                }
-             }
-          ]
-       },
-       "Expression":"(CPU0_DIMM_VR1_V + CPU0_DIMM_VR2_V) >= 0 ? (CPU0_DIMM_VR1_V + CPU0_DIMM_VR2_V) : NULL"
-    },
-    {
-       "Desc":{
-          "Name":"CPU1_DIMM_DDR_V",
-          "SensorType":"voltage",
-          "MinValue":0,
-          "MaxValue":5
-       },
-       "Threshold":
-       {
-          "CriticalHigh":2.999
-       },
-       "Associations":[
-          [
-             "chassis",
-             "all_sensors",
-             "/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
-          ],
-          [
-             "inventory",
-             "sensors",
-             "/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
-          ]
-       ],
-       "Params":{
-          "DbusParam":[
-             {
-                "ParamName":"CPU1_DIMM_VR1_V",
-                "Desc":{
-                   "Name":"CPU1_DIMM_VR1_V",
-                   "SensorType":"voltage"
-                }
-             },
-             {
-                "ParamName":"CPU1_DIMM_VR2_V",
-                "Desc":{
-                   "Name":"CPU1_DIMM_VR2_V",
-                   "SensorType":"voltage"
-                }
-             }
-          ]
-       },
-       "Expression":"(CPU1_DIMM_VR1_V + CPU1_DIMM_VR2_V) >= 0 ? (CPU1_DIMM_VR1_V + CPU1_DIMM_VR2_V) : NULL"
-    },
-    {
-       "Desc":{
-          "Name":"CPU0_MEM_PW",
-          "SensorType":"power",
-          "MinValue":0,
-          "MaxValue":80
-       },
-       "Threshold":
-       {
-          "CriticalHigh":29.987
-       },
-       "Associations":[
-          [
-             "chassis",
-             "all_sensors",
-             "/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
-          ],
-          [
-             "inventory",
-             "sensors",
-             "/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
-          ]
-       ],
-       "Params":{
-          "DbusParam":[
-             {
-                "ParamName":"CPU0_DIMM_VR1_PW",
-                "Desc":{
-                   "Name":"CPU0_DIMM_VR1_PW",
-                   "SensorType":"power"
-                }
-             },
-             {
-                "ParamName":"CPU0_DIMM_VR2_PW",
-                "Desc":{
-                   "Name":"CPU0_DIMM_VR2_PW",
-                   "SensorType":"power"
-                }
-             }
-          ]
-       },
-       "Expression":"(CPU0_DIMM_VR1_PW + CPU0_DIMM_VR2_PW) >= 0 ? (CPU0_DIMM_VR1_PW + CPU0_DIMM_VR2_PW) : NULL"
-    },
-    {
-       "Desc":{
-          "Name":"CPU1_MEM_PW",
-          "SensorType":"power",
-          "MinValue":0,
-          "MaxValue":255
-       },
-       "Threshold":
-       {
-          "CriticalHigh":29.987
-       },
-       "Associations":[
-          [
-             "chassis",
-             "all_sensors",
-             "/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
-          ],
-          [
-             "inventory",
-             "sensors",
-             "/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
-          ]
-       ],
-       "Params":{
-          "DbusParam":[
-             {
-                "ParamName":"CPU1_DIMM_VR1_PW",
-                "Desc":{
-                   "Name":"CPU1_DIMM_VR1_PW",
-                   "SensorType":"power"
-                }
-             },
-             {
-                "ParamName":"CPU1_DIMM_VR2_PW",
-                "Desc":{
-                   "Name":"CPU1_DIMM_VR2_PW",
-                   "SensorType":"power"
-                }
-             }
-          ]
-       },
-       "Expression":"(CPU1_DIMM_VR1_PW + CPU1_DIMM_VR2_PW) >= 0 ? (CPU1_DIMM_VR1_PW + CPU1_DIMM_VR2_PW) : NULL"
-    },
-    {
-       "Desc":{
-          "Name":"CPU0_CPU_PW",
-          "SensorType":"power",
-          "MinValue":0,
-          "MaxValue":550
-       },
-       "Threshold":
-       {
-          "CriticalHigh":500
-       },
-       "Associations":[
-          [
-             "chassis",
-             "all_sensors",
-             "/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
-          ],
-          [
-             "inventory",
-             "sensors",
-             "/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
-          ]
-       ],
-       "Params":{
-          "DbusParam":[
-             {
-                "ParamName":"CPU0_Core_VRD_PW",
-                "Desc":{
-                   "Name":"CPU0_Core_VRD_PW",
-                   "SensorType":"power"
-                }
-             },
-             {
-                "ParamName":"CPU0_SOC_PW",
-                "Desc":{
-                   "Name":"CPU0_SOC_PW",
-                   "SensorType":"power"
-                }
-             }
-          ]
-       },
-       "Expression":"(CPU0_Core_VRD_PW + CPU0_SOC_PW) >= 0 ? (CPU0_Core_VRD_PW + CPU0_SOC_PW) : NULL"
-    },
-    {
-       "Desc":{
-          "Name":"CPU1_CPU_PW",
-          "SensorType":"power",
-          "MinValue":0,
-          "MaxValue":550
-       },
-       "Threshold":
-       {
-          "CriticalHigh":500
-       },
-       "Associations":[
-          [
-             "chassis",
-             "all_sensors",
-             "/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
-          ],
-          [
-             "inventory",
-             "sensors",
-             "/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
-          ]
-       ],
-       "Params":{
-          "DbusParam":[
-             {
-                "ParamName":"CPU1_Core_VRD_PW",
-                "Desc":{
-                   "Name":"CPU1_Core_VRD_PW",
-                   "SensorType":"power"
-                }
-             },
-             {
-                "ParamName":"CPU1_SOC_PW",
-                "Desc":{
-                   "Name":"CPU1_SOC_PW",
-                   "SensorType":"power"
-                }
-             }
-          ]
-       },
-       "Expression":"(CPU1_Core_VRD_PW + CPU1_SOC_PW) >= 0 ? (CPU1_Core_VRD_PW + CPU1_SOC_PW) : NULL"
-    },
-    {
-        "Desc":
-        {
-            "Name": "zone0_temp",
-            "SensorType": "temperature",
-            "MinValue": 0,
-            "MaxValue": 300
-        },
-        "Threshold" :
-        {
-            "CriticalHigh": 200,
-            "WarningHigh": 198
-        },
-        "Associations":[
-         [
-            "chassis",
-            "all_sensors",
-            "/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
-         ],
-         [
-            "inventory",
-            "sensors",
-            "/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
-         ]
-      ],
-        "Params":
-        {
-            "DbusParam":
-            [
-                {
-                    "ParamName": "margin0",
-                    "Desc":
-                    {
-                        "Name": "thermal_zone0",
-                        "SensorType": "temperature"
-                    }
-                }
-            ]
-        },
-        "Expression": "(200 - margin0)"
-    },
-    {
-        "Desc":
-        {
-            "Name": "zone1_temp",
-            "SensorType": "temperature",
-            "MinValue": 0,
-            "MaxValue": 300
-        },
-        "Threshold" :
-        {
-            "CriticalHigh": 200,
-            "WarningHigh": 198
-        },
-        "Associations":[
-         [
-            "chassis",
-            "all_sensors",
-            "/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
-         ],
-         [
-            "inventory",
-            "sensors",
-            "/xyz/openbmc_project/inventory/system/board/Kudo_Motherboard"
-         ]
-      ],
-        "Params":
-        {
-            "DbusParam":
-            [
-                {
-                    "ParamName": "margin1",
-                    "Desc":
-                    {
-                        "Name": "thermal_zone1",
-                        "SensorType": "temperature"
-                    }
-                }
-            ]
-        },
-        "Expression": "(200 - margin1)"
-         }
- ]
diff --git a/meta-fii/meta-kudo/recipes-phosphor/sensors/phosphor-virtual-sensor_%.bbappend b/meta-fii/meta-kudo/recipes-phosphor/sensors/phosphor-virtual-sensor_%.bbappend
index 45f224b..72dbde2 100644
--- a/meta-fii/meta-kudo/recipes-phosphor/sensors/phosphor-virtual-sensor_%.bbappend
+++ b/meta-fii/meta-kudo/recipes-phosphor/sensors/phosphor-virtual-sensor_%.bbappend
@@ -2,22 +2,12 @@
 
 inherit systemd
 RDEPENDS:${PN} += "bash"
-SYSTEMD_SERVICE:${PN}:append:kudo = " cpu_detect_virtual.service \
-                                    "
 
 SRC_URI:append:kudo = " \
-    file://virtual_sensor_config1p.json \
-    file://virtual_sensor_config2p.json \
-    file://cpu_detect_virtual.sh \
-    file://cpu_detect_virtual.service \
+    file://virtual_sensor_config.json \
     "
 do_install:append:kudo() {
-    install -d ${D}${libexecdir}/${PN}
-    install -m 0755 ${WORKDIR}/cpu_detect_virtual.sh ${D}${libexecdir}/${PN}/cpu_detect_virtual.sh
-    install -d ${D}${sysconfdir}/virtual-sensor/configurations/
-    install -m 0644 ${WORKDIR}/virtual_sensor_config1p.json ${D}${sysconfdir}/virtual-sensor/configurations/virtual_sensor_config1p.json
-    install -m 0644 ${WORKDIR}/virtual_sensor_config2p.json ${D}${sysconfdir}/virtual-sensor/configurations/virtual_sensor_config2p.json
-    install -d ${D}${systemd_system_unitdir}
-    install -m 0644 ${WORKDIR}/cpu_detect_virtual.service ${D}${systemd_system_unitdir}/cpu_detect_virtual.service
+    install -d ${D}/usr/share
+    install -m 0644 ${WORKDIR}/virtual_sensor_config.json ${D}/usr/share/phosphor-virtual-sensor/virtual_sensor_config.json
 }