meta-ibm: sbp1: phosphor-virtual-sensor: Add sensor

The regulator PVCCD_HV_CPU* only has sensors to measure output
power and input voltage.

Calculate input power and input current for PVCCD_HV_CPU* based
on output power and input voltage considering 90% efficiency.

TEST: webui shows newly added PVCCD_HV_CPU* sensors.

Change-Id: I3ae49beaca4453595116b640177fde822d195ab6
Signed-off-by: Naresh Solanki <naresh.solanki@9elements.com>
diff --git a/meta-ibm/recipes-phosphor/sensors/phosphor-virtual-sensor/sbp1/virtual_sensor_config.json b/meta-ibm/recipes-phosphor/sensors/phosphor-virtual-sensor/sbp1/virtual_sensor_config.json
index 82f65a1..4386501 100644
--- a/meta-ibm/recipes-phosphor/sensors/phosphor-virtual-sensor/sbp1/virtual_sensor_config.json
+++ b/meta-ibm/recipes-phosphor/sensors/phosphor-virtual-sensor/sbp1/virtual_sensor_config.json
@@ -169,5 +169,273 @@
       ]
     },
     "Expression": "ifNan(T0, 0)"
+  },
+  {
+    "Desc": {
+      "Name": "PVCCD_HV_CPU0_Input_Power",
+      "SensorType": "power"
+    },
+    "Associations": [
+      [
+        "chassis",
+        "all_sensors",
+        "/xyz/openbmc_project/inventory/system/board/IBM_SBP1_Baseboard"
+      ],
+      [
+        "inventory",
+        "sensors",
+        "/xyz/openbmc_project/inventory/system/board/IBM_SBP1_Baseboard"
+      ]
+    ],
+    "Params": {
+      "DbusParam": [
+        {
+          "ParamName": "P0",
+          "Desc": {
+            "Name": "PVCCD_HV_CPU0_Output_Power",
+            "SensorType": "power"
+          }
+        }
+      ]
+    },
+    "Expression": "ifNan(P0 / 0.9, 0)"
+  },
+  {
+    "Desc": {
+      "Name": "PVCCD_HV_CPU0_Input_Current",
+      "SensorType": "current"
+    },
+    "Associations": [
+      [
+        "chassis",
+        "all_sensors",
+        "/xyz/openbmc_project/inventory/system/board/IBM_SBP1_Baseboard"
+      ],
+      [
+        "inventory",
+        "sensors",
+        "/xyz/openbmc_project/inventory/system/board/IBM_SBP1_Baseboard"
+      ]
+    ],
+    "Params": {
+      "DbusParam": [
+        {
+          "ParamName": "P0",
+          "Desc": {
+            "Name": "PVCCD_HV_CPU0_Output_Power",
+            "SensorType": "power"
+          }
+        },
+        {
+          "ParamName": "V0",
+          "Desc": {
+            "Name": "PVCCD_HV_CPU0_Input_Voltage",
+            "SensorType": "voltage"
+          }
+        }
+      ]
+    },
+    "Expression": "ifNan(P0 / (V0 * 0.9), 0)"
+  },
+  {
+    "Desc": {
+      "Name": "PVCCD_HV_CPU1_Input_Power",
+      "SensorType": "power"
+    },
+    "Associations": [
+      [
+        "chassis",
+        "all_sensors",
+        "/xyz/openbmc_project/inventory/system/board/IBM_SBP1_Baseboard"
+      ],
+      [
+        "inventory",
+        "sensors",
+        "/xyz/openbmc_project/inventory/system/board/IBM_SBP1_Baseboard"
+      ]
+    ],
+    "Params": {
+      "DbusParam": [
+        {
+          "ParamName": "P0",
+          "Desc": {
+            "Name": "PVCCD_HV_CPU1_Output_Power",
+            "SensorType": "power"
+          }
+        }
+      ]
+    },
+    "Expression": "ifNan(P0 / 0.9, 0)"
+  },
+  {
+    "Desc": {
+      "Name": "PVCCD_HV_CPU1_Input_Current",
+      "SensorType": "current"
+    },
+    "Associations": [
+      [
+        "chassis",
+        "all_sensors",
+        "/xyz/openbmc_project/inventory/system/board/IBM_SBP1_Baseboard"
+      ],
+      [
+        "inventory",
+        "sensors",
+        "/xyz/openbmc_project/inventory/system/board/IBM_SBP1_Baseboard"
+      ]
+    ],
+    "Params": {
+      "DbusParam": [
+        {
+          "ParamName": "P0",
+          "Desc": {
+            "Name": "PVCCD_HV_CPU1_Output_Power",
+            "SensorType": "power"
+          }
+        },
+        {
+          "ParamName": "V0",
+          "Desc": {
+            "Name": "PVCCD_HV_CPU1_Input_Voltage",
+            "SensorType": "voltage"
+          }
+        }
+      ]
+    },
+    "Expression": "ifNan(P0 / (V0 * 0.9), 0)"
+  },
+  {
+    "Desc": {
+      "Name": "PVCCD_HV_CPU2_Input_Power",
+      "SensorType": "power"
+    },
+    "Associations": [
+      [
+        "chassis",
+        "all_sensors",
+        "/xyz/openbmc_project/inventory/system/board/IBM_SBP1_Baseboard"
+      ],
+      [
+        "inventory",
+        "sensors",
+        "/xyz/openbmc_project/inventory/system/board/IBM_SBP1_Baseboard"
+      ]
+    ],
+    "Params": {
+      "DbusParam": [
+        {
+          "ParamName": "P0",
+          "Desc": {
+            "Name": "PVCCD_HV_CPU2_Output_Power",
+            "SensorType": "power"
+          }
+        }
+      ]
+    },
+    "Expression": "ifNan(P0 / 0.9, 0)"
+  },
+  {
+    "Desc": {
+      "Name": "PVCCD_HV_CPU2_Input_Current",
+      "SensorType": "current"
+    },
+    "Associations": [
+      [
+        "chassis",
+        "all_sensors",
+        "/xyz/openbmc_project/inventory/system/board/IBM_SBP1_Baseboard"
+      ],
+      [
+        "inventory",
+        "sensors",
+        "/xyz/openbmc_project/inventory/system/board/IBM_SBP1_Baseboard"
+      ]
+    ],
+    "Params": {
+      "DbusParam": [
+        {
+          "ParamName": "P0",
+          "Desc": {
+            "Name": "PVCCD_HV_CPU2_Output_Power",
+            "SensorType": "power"
+          }
+        },
+        {
+          "ParamName": "V0",
+          "Desc": {
+            "Name": "PVCCD_HV_CPU2_Input_Voltage",
+            "SensorType": "voltage"
+          }
+        }
+      ]
+    },
+    "Expression": "ifNan(P0 / (V0 * 0.9), 0)"
+  },
+  {
+    "Desc": {
+      "Name": "PVCCD_HV_CPU3_Input_Power",
+      "SensorType": "power"
+    },
+    "Associations": [
+      [
+        "chassis",
+        "all_sensors",
+        "/xyz/openbmc_project/inventory/system/board/IBM_SBP1_Baseboard"
+      ],
+      [
+        "inventory",
+        "sensors",
+        "/xyz/openbmc_project/inventory/system/board/IBM_SBP1_Baseboard"
+      ]
+    ],
+    "Params": {
+      "DbusParam": [
+        {
+          "ParamName": "P0",
+          "Desc": {
+            "Name": "PVCCD_HV_CPU3_Output_Power",
+            "SensorType": "power"
+          }
+        }
+      ]
+    },
+    "Expression": "ifNan(P0 / 0.9, 0)"
+  },
+  {
+    "Desc": {
+      "Name": "PVCCD_HV_CPU3_Input_Current",
+      "SensorType": "current"
+    },
+    "Associations": [
+      [
+        "chassis",
+        "all_sensors",
+        "/xyz/openbmc_project/inventory/system/board/IBM_SBP1_Baseboard"
+      ],
+      [
+        "inventory",
+        "sensors",
+        "/xyz/openbmc_project/inventory/system/board/IBM_SBP1_Baseboard"
+      ]
+    ],
+    "Params": {
+      "DbusParam": [
+        {
+          "ParamName": "P0",
+          "Desc": {
+            "Name": "PVCCD_HV_CPU3_Output_Power",
+            "SensorType": "power"
+          }
+        },
+        {
+          "ParamName": "V0",
+          "Desc": {
+            "Name": "PVCCD_HV_CPU3_Input_Voltage",
+            "SensorType": "voltage"
+          }
+        }
+      ]
+    },
+    "Expression": "ifNan(P0 / (V0 * 0.9), 0)"
   }
 ]