meta-ampere: mtjade: add total_power sensor

Add total_power sensor calculated by sum of PSU0_POUTPUT and
PSU1_POUTPUT.

Tested:
1. Check if total_power is present in WebUI and Redfish and its value is
sum of PSU0_POUTPUT and PSU1_POUTPUT.
2. Check total_power from IPMI
  root@mtjade:~# ipmitool sdr list | grep total_power
  total_power      | 648 Watts         | ok

Signed-off-by: Thang Q. Nguyen <thang@os.amperecomputing.com>
Change-Id: I304e7c9328f1f91f6f358f0e8472a107bf5479a0
diff --git a/meta-ampere/meta-jade/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bbappend b/meta-ampere/meta-jade/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bbappend
index f41e5bc..3af7022 100644
--- a/meta-ampere/meta-jade/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bbappend
+++ b/meta-ampere/meta-jade/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bbappend
@@ -1,2 +1,2 @@
-RDEPENDS_${PN}-extras_append_mtjade = " webui-vue phosphor-image-signing"
+RDEPENDS_${PN}-extras_append_mtjade = " webui-vue phosphor-image-signing phosphor-virtual-sensor"
 RDEPENDS_${PN}-inventory_append_mtjade = " fault-monitor id-button psu-hotswap-reset"
diff --git a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-virtual-sensor/virtual_sensor_config.json b/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-virtual-sensor/virtual_sensor_config.json
new file mode 100644
index 0000000..d0dc767
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-virtual-sensor/virtual_sensor_config.json
@@ -0,0 +1,36 @@
+[
+    {
+        "Desc":
+        {
+            "Name": "total_power",
+            "SensorType": "power"
+        },
+        "Threshold" :
+        {
+        },
+        "Params":
+        {
+            "DbusParam":
+            [
+                {
+                    "ParamName": "PSU0_POUTPUT",
+                    "Desc":
+                    {
+                        "Name": "PSU0_POUTPUT",
+                        "SensorType": "power"
+                    }
+                },
+                {
+                    "ParamName": "PSU1_POUTPUT",
+                    "Desc":
+                    {
+                        "Name": "PSU1_POUTPUT",
+                        "SensorType": "power"
+                    }
+                }
+            ]
+        },
+        "Expression": "PSU0_POUTPUT + PSU1_POUTPUT"
+    }
+]
+
diff --git a/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-virtual-sensor_%.bbappend b/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-virtual-sensor_%.bbappend
new file mode 100644
index 0000000..3c68ff5
--- /dev/null
+++ b/meta-ampere/meta-jade/recipes-phosphor/sensors/phosphor-virtual-sensor_%.bbappend
@@ -0,0 +1,10 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+SRC_URI_append_mtjade += " \
+            file://virtual_sensor_config.json \
+           "
+
+do_install_append_mtjade() {
+    install -m 0644 ${WORKDIR}/virtual_sensor_config.json ${D}${datadir}/phosphor-virtual-sensor/
+}
+