meta-ieisystems: fp5280g3: add phosphor-virtual-sensor

Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: I6878afb1f2dc2e332cbb5de4a611d6322adbc15c
diff --git a/meta-ieisystems/meta-fp5280g3/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bbappend b/meta-ieisystems/meta-fp5280g3/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bbappend
index 2807675..4c5e8e6 100644
--- a/meta-ieisystems/meta-fp5280g3/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bbappend
+++ b/meta-ieisystems/meta-fp5280g3/recipes-phosphor/packagegroups/packagegroup-obmc-apps.bbappend
@@ -10,6 +10,7 @@
         srvcfg-manager \
         biosconfig-manager \
         phosphor-host-postd \
+        phosphor-virtual-sensor \
         libmctp \
         pldm \
         tzdata-core \
diff --git a/meta-ieisystems/meta-fp5280g3/recipes-phosphor/sensors/phosphor-virtual-sensor/virtual_sensor_config.json b/meta-ieisystems/meta-fp5280g3/recipes-phosphor/sensors/phosphor-virtual-sensor/virtual_sensor_config.json
new file mode 100644
index 0000000..e790c63
--- /dev/null
+++ b/meta-ieisystems/meta-fp5280g3/recipes-phosphor/sensors/phosphor-virtual-sensor/virtual_sensor_config.json
@@ -0,0 +1,157 @@
+[
+    {
+        "Desc": {
+            "Config": "D-Bus",
+            "Type": "Maximum"
+        }
+    },
+    {
+        "Desc": {
+            "Name": "total_power",
+            "SensorType": "power"
+        },
+        "Associations": [
+            [
+                "chassis",
+                "all_sensors",
+                "/xyz/openbmc_project/inventory/system/chassis"
+            ]
+        ],
+        "Params": {
+            "DbusParam": [
+                {
+                    "ParamName": "P1",
+                    "Desc": {
+                        "Name": "PSU0_PIN",
+                        "SensorType": "power"
+                    }
+                },
+                {
+                    "ParamName": "P2",
+                    "Desc": {
+                        "Name": "PSU1_PIN",
+                        "SensorType": "power"
+                    }
+                }
+            ]
+        },
+        "Expression": "(P1 > 0 ? P1:0) + (P2 > 0 ? P2:0)"
+    },
+    {
+        "Desc": {
+            "Name": "CPU0_Power",
+            "SensorType": "power"
+        },
+        "Associations": [
+            [
+                "chassis",
+                "all_sensors",
+                "/xyz/openbmc_project/inventory/system/chassis"
+            ]
+        ],
+        "Params": {
+            "DbusParam": [
+                {
+                    "ParamName": "P1",
+                    "Desc": {
+                        "Name": "p0_power",
+                        "SensorType": "power"
+                    }
+                },
+                {
+                    "ParamName": "P2",
+                    "Desc": {
+                        "Name": "p0_cache_power",
+                        "SensorType": "power"
+                    }
+                }
+            ]
+        },
+        "Expression": "(P1 > 0 ? P1:0) + (P2 > 0 ? P2:0)"
+    },
+    {
+        "Desc": {
+            "Name": "CPU1_Power",
+            "SensorType": "power"
+        },
+        "Associations": [
+            [
+                "chassis",
+                "all_sensors",
+                "/xyz/openbmc_project/inventory/system/chassis"
+            ]
+        ],
+        "Params": {
+            "DbusParam": [
+                {
+                    "ParamName": "P1",
+                    "Desc": {
+                        "Name": "p1_power",
+                        "SensorType": "power"
+                    }
+                },
+                {
+                    "ParamName": "P2",
+                    "Desc": {
+                        "Name": "p1_cache_power",
+                        "SensorType": "power"
+                    }
+                }
+            ]
+        },
+        "Expression": "(P1 > 0 ? P1:0) + (P2 > 0 ? P2:0)"
+    },
+    {
+        "Desc": {
+            "Name": "Altitude",
+            "SensorType": "altitude"
+        },
+        "Threshold": {
+            "WarningHigh": 3050
+        },
+        "Params": {
+            "ConstParam": [
+                {
+                    "ParamName": "P1",
+                    "Value": 227.933
+                }
+            ]
+        },
+        "Expression": "P1"
+    },
+    {
+        "Desc": {
+            "Name": "Ambient Virtual Temp",
+            "SensorType": "temperature"
+        },
+        "Threshold": {
+            "WarningHigh": 45,
+            "HardShutdownHigh": 58,
+            "SoftShutdownHigh": 53
+        },
+        "Params": {
+            "ConstParam": [
+                {
+                    "ParamName": "P1",
+                    "Value": 16
+                }
+            ]
+        },
+        "Expression": "P1"
+    },
+    {
+        "Desc": {
+            "Name": "Fan Rated Speed",
+            "SensorType": "fan_tach"
+        },
+        "Params": {
+            "ConstParam": [
+                {
+                    "ParamName": "P1",
+                    "Value": 24000
+                }
+            ]
+        },
+        "Expression": "P1"
+    }
+]
diff --git a/meta-ieisystems/meta-fp5280g3/recipes-phosphor/sensors/phosphor-virtual-sensor_%.bbappend b/meta-ieisystems/meta-fp5280g3/recipes-phosphor/sensors/phosphor-virtual-sensor_%.bbappend
new file mode 100644
index 0000000..9bfbdcb
--- /dev/null
+++ b/meta-ieisystems/meta-fp5280g3/recipes-phosphor/sensors/phosphor-virtual-sensor_%.bbappend
@@ -0,0 +1,7 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
+
+SRC_URI:append = " file://virtual_sensor_config.json"
+
+do_install:append() {
+    install -m 0644 ${WORKDIR}/virtual_sensor_config.json ${D}${datadir}/phosphor-virtual-sensor/
+}