bytedance: g220a: Add virtual-sensor package
Add phosphor-virtual-sensor pakcage and configure it to enable
"total_power" sensor that is the sum of PSU0/1's input power.
Tested: Verify the Total_Power sensor is on DBus and the value is the
sum or PSU0 and PSU1's input power.
Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: Ie8f61800299bef01a8bb74256c24d1f0a90df258
diff --git a/meta-bytedance/meta-g220a/recipes-phosphor/images/obmc-phosphor-image.bbappend b/meta-bytedance/meta-g220a/recipes-phosphor/images/obmc-phosphor-image.bbappend
index 6369a83..038e65e 100644
--- a/meta-bytedance/meta-g220a/recipes-phosphor/images/obmc-phosphor-image.bbappend
+++ b/meta-bytedance/meta-g220a/recipes-phosphor/images/obmc-phosphor-image.bbappend
@@ -3,4 +3,5 @@
me-time-sync \
static-mac-addr \
phosphor-node-manager-proxy \
+ phosphor-virtual-sensor \
"
diff --git a/meta-bytedance/meta-g220a/recipes-phosphor/sensors/phosphor-virtual-sensor/virtual_sensor_config.json b/meta-bytedance/meta-g220a/recipes-phosphor/sensors/phosphor-virtual-sensor/virtual_sensor_config.json
new file mode 100644
index 0000000..0aacc03
--- /dev/null
+++ b/meta-bytedance/meta-g220a/recipes-phosphor/sensors/phosphor-virtual-sensor/virtual_sensor_config.json
@@ -0,0 +1,32 @@
+[
+ {
+ "Desc":
+ {
+ "Name": "total_power",
+ "SensorType": "power"
+ },
+ "Params":
+ {
+ "DbusParam":
+ [
+ {
+ "ParamName": "T0",
+ "Desc":
+ {
+ "Name": "PSU0_Input_Power",
+ "SensorType": "power"
+ }
+ },
+ {
+ "ParamName": "T1",
+ "Desc":
+ {
+ "Name": "PSU1_Input_Power",
+ "SensorType": "power"
+ }
+ }
+ ]
+ },
+ "Expression": "T0 + T1"
+ }
+]
diff --git a/meta-bytedance/meta-g220a/recipes-phosphor/sensors/phosphor-virtual-sensor_%.bbappend b/meta-bytedance/meta-g220a/recipes-phosphor/sensors/phosphor-virtual-sensor_%.bbappend
new file mode 100644
index 0000000..9c85366
--- /dev/null
+++ b/meta-bytedance/meta-g220a/recipes-phosphor/sensors/phosphor-virtual-sensor_%.bbappend
@@ -0,0 +1,8 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
+SRC_URI += " \
+ file://virtual_sensor_config.json \
+"
+
+do_install:append() {
+ install -m 0644 -D ${WORKDIR}/virtual_sensor_config.json ${D}${datadir}/phosphor-virtual-sensor/
+}