meta-witherspoon: Use phosphor-power recipe

phosphor-power recipe is added in meta-phosphor, replace
witherspoon-pfault-analysis with phosphor-power.

Add "psuDevices" in psu.json for witherspoon and swift.

Tested: Verify witherspoon build is OK, the phosphor-power related
        binaries and the services are installed correctly.

(From meta-ibm rev: 9422171d261d155b903295cd7c0c5aedbab535a0)

Change-Id: I2706ac9e9bff11b943ae6861bebd67e67d0bee15
Signed-off-by: Lei YU <mine260309@gmail.com>
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis/swift/obmc/power-supply-monitor/power-supply-monitor-0.conf b/meta-ibm/meta-witherspoon/recipes-phosphor/power/phosphor-power/swift/obmc/power-supply-monitor/power-supply-monitor-0.conf
similarity index 100%
rename from meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis/swift/obmc/power-supply-monitor/power-supply-monitor-0.conf
rename to meta-ibm/meta-witherspoon/recipes-phosphor/power/phosphor-power/swift/obmc/power-supply-monitor/power-supply-monitor-0.conf
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis/swift/obmc/power-supply-monitor/power-supply-monitor-1.conf b/meta-ibm/meta-witherspoon/recipes-phosphor/power/phosphor-power/swift/obmc/power-supply-monitor/power-supply-monitor-1.conf
similarity index 100%
rename from meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis/swift/obmc/power-supply-monitor/power-supply-monitor-1.conf
rename to meta-ibm/meta-witherspoon/recipes-phosphor/power/phosphor-power/swift/obmc/power-supply-monitor/power-supply-monitor-1.conf
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis/psu.json b/meta-ibm/meta-witherspoon/recipes-phosphor/power/phosphor-power/swift/psu.json
similarity index 72%
rename from meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis/psu.json
rename to meta-ibm/meta-witherspoon/recipes-phosphor/power/phosphor-power/swift/psu.json
index 2dcefab..94f14dd 100644
--- a/meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis/psu.json
+++ b/meta-ibm/meta-witherspoon/recipes-phosphor/power/phosphor-power/swift/psu.json
@@ -21,5 +21,9 @@
       "fileName": "fw_version",
       "interface": "xyz.openbmc_project.Software.Version"
     }
-  ]
+  ],
+  "psuDevices": {
+    "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0" : "/sys/bus/i2c/devices/3-0068",
+    "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply1" : "/sys/bus/i2c/devices/3-0069"
+  }
 }
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis/witherspoon/obmc/power-supply-monitor/power-supply-monitor-0.conf b/meta-ibm/meta-witherspoon/recipes-phosphor/power/phosphor-power/witherspoon/obmc/power-supply-monitor/power-supply-monitor-0.conf
similarity index 100%
rename from meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis/witherspoon/obmc/power-supply-monitor/power-supply-monitor-0.conf
rename to meta-ibm/meta-witherspoon/recipes-phosphor/power/phosphor-power/witherspoon/obmc/power-supply-monitor/power-supply-monitor-0.conf
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis/witherspoon/obmc/power-supply-monitor/power-supply-monitor-1.conf b/meta-ibm/meta-witherspoon/recipes-phosphor/power/phosphor-power/witherspoon/obmc/power-supply-monitor/power-supply-monitor-1.conf
similarity index 100%
rename from meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis/witherspoon/obmc/power-supply-monitor/power-supply-monitor-1.conf
rename to meta-ibm/meta-witherspoon/recipes-phosphor/power/phosphor-power/witherspoon/obmc/power-supply-monitor/power-supply-monitor-1.conf
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis/witherspoon/pseq-monitor-pgood.service b/meta-ibm/meta-witherspoon/recipes-phosphor/power/phosphor-power/witherspoon/pseq-monitor-pgood.service
similarity index 100%
rename from meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis/witherspoon/pseq-monitor-pgood.service
rename to meta-ibm/meta-witherspoon/recipes-phosphor/power/phosphor-power/witherspoon/pseq-monitor-pgood.service
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis/psu.json b/meta-ibm/meta-witherspoon/recipes-phosphor/power/phosphor-power/witherspoon/psu.json
similarity index 72%
copy from meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis/psu.json
copy to meta-ibm/meta-witherspoon/recipes-phosphor/power/phosphor-power/witherspoon/psu.json
index 2dcefab..cbabc78 100644
--- a/meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis/psu.json
+++ b/meta-ibm/meta-witherspoon/recipes-phosphor/power/phosphor-power/witherspoon/psu.json
@@ -21,5 +21,9 @@
       "fileName": "fw_version",
       "interface": "xyz.openbmc_project.Software.Version"
     }
-  ]
+  ],
+  "psuDevices": {
+    "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0" : "/sys/bus/i2c/devices/3-0069",
+    "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply1" : "/sys/bus/i2c/devices/3-0068"
+  }
 }
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/power/phosphor-power_%.bbappend b/meta-ibm/meta-witherspoon/recipes-phosphor/power/phosphor-power_%.bbappend
new file mode 100644
index 0000000..b90dc9b
--- /dev/null
+++ b/meta-ibm/meta-witherspoon/recipes-phosphor/power/phosphor-power_%.bbappend
@@ -0,0 +1,15 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+SRC_URI += "file://psu.json"
+
+EXTRA_OEMESON += "-Ducd90160-yaml=${STAGING_DIR_HOST}${datadir}/power-sequencer/ucd90160.yaml"
+
+DEPENDS += " power-sequencer"
+
+do_install_append(){
+    install -D ${WORKDIR}/psu.json ${D}${datadir}/phosphor-power/psu.json
+}
+FILES_${PN} += "${datadir}/phosphor-power/psu.json"
+
+PSU_MONITOR_ENV_FMT = "obmc/power-supply-monitor/power-supply-monitor-{0}.conf"
+SYSTEMD_ENVIRONMENT_FILE_${PN} += "${@compose_list(d, 'PSU_MONITOR_ENV_FMT', 'OBMC_POWER_SUPPLY_INSTANCES')}"
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis-error-native_git.bb b/meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis-error-native_git.bb
index 76781cb..3c174c3 100644
--- a/meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis-error-native_git.bb
+++ b/meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis-error-native_git.bb
@@ -5,7 +5,7 @@
 inherit native
 inherit phosphor-dbus-yaml
 
-require witherspoon-pfault-analysis.inc
+require recipes-phosphor/power/phosphor-power.inc
 
 S = "${WORKDIR}/git"
 
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis.inc b/meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis.inc
deleted file mode 100644
index b731e94..0000000
--- a/meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis.inc
+++ /dev/null
@@ -1,5 +0,0 @@
-HOMEPAGE = "https://github.com/openbmc/phosphor-power"
-LICENSE = "Apache-2.0"
-LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e"
-SRC_URI += "git://github.com/openbmc/phosphor-power"
-SRCREV = "5ea8b552fabe9bebb873307a4ab570a7cec8d9fb"
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis/power-supply-monitor@.service b/meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis/power-supply-monitor@.service
deleted file mode 100644
index bf02758..0000000
--- a/meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis/power-supply-monitor@.service
+++ /dev/null
@@ -1,15 +0,0 @@
-[Unit]
-Description=Power Supply %I Monitor
-Wants=mapper-wait@-xyz-openbmc_project-inventory-system-chassis-motherboard-powersupply%i.service
-After=mapper-wait@-xyz-openbmc_project-inventory-system-chassis-motherboard-powersupply%i.service
-Wants=mapper-wait@-org-openbmc-control-power0.service
-After=mapper-wait@-org-openbmc-control-power0.service
-ConditionPathExists={envfiledir}/obmc/power-supply-monitor/power-supply-monitor-%i.conf
-
-[Service]
-EnvironmentFile={envfiledir}/obmc/power-supply-monitor/power-supply-monitor-%i.conf
-ExecStart=/usr/bin/env psu-monitor --path=${{DEVPATH}} --instance=${{INSTANCE}} --inventory=${{INVENTORY}} --num-history-records=${{NUM_HISTORY_RECORDS}} --sync-gpio-path=${{SYNC_GPIO_PATH}} --sync-gpio-num=${{SYNC_GPIO_NUM}}
-SyslogIdentifier=psu-monitor
-
-[Install]
-RequiredBy=multi-user.target
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis/pseq-monitor.service b/meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis/pseq-monitor.service
deleted file mode 100644
index 8ce3b37..0000000
--- a/meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis/pseq-monitor.service
+++ /dev/null
@@ -1,10 +0,0 @@
-[Unit]
-Description=Power Sequencer Runtime Monitor
-Wants=obmc-host-start-pre@0.target
-Before=obmc-host-start-pre@0.target
-After=obmc-power-on@0.target
-Conflicts=obmc-chassis-poweroff@0.target
-
-[Service]
-ExecStart=/usr/bin/env pseq-monitor -a runtime-monitor -i 500
-SyslogIdentifier=pseq-monitor
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis/swift/pseq-monitor-pgood.service b/meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis/swift/pseq-monitor-pgood.service
deleted file mode 100644
index 206fc66..0000000
--- a/meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis/swift/pseq-monitor-pgood.service
+++ /dev/null
@@ -1,11 +0,0 @@
-[Unit]
-Description=Power Sequencer Power-on Monitor
-Wants=op-power-start@0.service
-After=op-power-start@0.service
-Conflicts=obmc-chassis-poweroff@0.target
-ConditionPathExists=!/run/openbmc/chassis@0-on
-
-[Service]
-Type=oneshot
-ExecStart=/usr/bin/env pseq-monitor -a pgood-monitor -i 5000
-SyslogIdentifier=pseq-monitor
diff --git a/meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis_git.bb b/meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis_git.bb
deleted file mode 100644
index 2625bfc..0000000
--- a/meta-ibm/meta-witherspoon/recipes-phosphor/power/witherspoon-pfault-analysis_git.bb
+++ /dev/null
@@ -1,53 +0,0 @@
-SUMMARY = "Witherspoon Power Fault Analysis"
-DESCRIPTION = "Analyzes power devices for faults"
-PR = "r1"
-PV = "1.0+git${SRCPV}"
-
-inherit meson
-inherit pkgconfig
-inherit obmc-phosphor-systemd
-inherit pythonnative
-
-require ${PN}.inc
-
-S = "${WORKDIR}/git"
-SRC_URI += "file://psu.json"
-
-DEPENDS += " \
-         phosphor-logging \
-         autoconf-archive-native \
-         openpower-dbus-interfaces \
-         sdbus++-native \
-         sdeventplus \
-         power-sequencer \
-         nlohmann-json \
-         "
-
-EXTRA_OEMESON += "-Ducd90160-yaml=${STAGING_DIR_HOST}${datadir}/power-sequencer/ucd90160.yaml"
-
-do_install_append(){
-    install -D ${WORKDIR}/psu.json ${D}${datadir}/phosphor-power/psu.json
-}
-FILES_${PN} += "${datadir}/phosphor-power/psu.json"
-
-CHASSIS_ON_TGT = "obmc-chassis-poweron@0.target"
-SEQ_MONITOR_SVC = "pseq-monitor.service"
-SEQ_MONITOR_FMT = "../${SEQ_MONITOR_SVC}:${CHASSIS_ON_TGT}.wants/${SEQ_MONITOR_SVC}"
-
-SEQ_PGOOD_SVC = "pseq-monitor-pgood.service"
-SEQ_PGOOD_FMT = "../${SEQ_PGOOD_SVC}:${CHASSIS_ON_TGT}.wants/${SEQ_PGOOD_SVC}"
-
-SYSTEMD_SERVICE_${PN} += "${SEQ_MONITOR_SVC} ${SEQ_PGOOD_SVC}"
-SYSTEMD_LINK_${PN} += "${SEQ_MONITOR_FMT} ${SEQ_PGOOD_FMT}"
-
-PSU_MONITOR_TMPL = "power-supply-monitor@.service"
-PSU_MONITOR_INSTFMT = "power-supply-monitor@{0}.service"
-PSU_MONITOR_TGT = "multi-user.target"
-PSU_MONITOR_FMT = "../${PSU_MONITOR_TMPL}:${PSU_MONITOR_TGT}.requires/${PSU_MONITOR_INSTFMT}"
-
-FILES_psu-monitor = "${bindir}/psu-monitor"
-SYSTEMD_SERVICE_${PN} += "${PSU_MONITOR_TMPL}"
-SYSTEMD_LINK_${PN} += "${@compose_list(d, 'PSU_MONITOR_FMT', 'OBMC_POWER_SUPPLY_INSTANCES')}"
-
-PSU_MONITOR_ENV_FMT = "obmc/power-supply-monitor/power-supply-monitor-{0}.conf"
-SYSTEMD_ENVIRONMENT_FILE_${PN} += "${@compose_list(d, 'PSU_MONITOR_ENV_FMT', 'OBMC_POWER_SUPPLY_INSTANCES')}"