meta-quanta: gbs: failsafe fan speed control dynamically

1. add acpi-power-state daemon to check the ACPI power
   states from BIOS

2. set failsafe fan speed at different states
   - S0_G0_D0: 90%
   - S5_G2: 40%

   Note:
   this item depends on the commit and will
   add as the patches first in another PR
   https://gerrit.openbmc-project.xyz/38112

3. add gbs-check-host-state.sh to monitor the power state
   D-Bus and then trigger to set fan failsafe speed

4. remove gbs-detect-fan-fail service and unused scripts
   from phosphor-pid-control

5. update read-margin-temp srcrev to avoid nvme temperature
   sensor failed due to nvme SSD not-present

Signed-off-by: George Hung <george.hung@quantatw.com>
Change-Id: I496dd7bc59076a2b3690e367877d49533855c9fe
diff --git a/meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon_%.bbappend b/meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon_%.bbappend
new file mode 100644
index 0000000..f833b55
--- /dev/null
+++ b/meta-quanta/meta-gbs/recipes-google/acpi-power-state/acpi-power-state-daemon_%.bbappend
@@ -0,0 +1,43 @@
+FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:"
+
+SRC_URI_append_gbs = " \
+    file://gbs-host-s0-set-failsafe.service \
+    file://gbs-host-s5-set-failsafe.service \
+    file://gbs-host-set-boot-failsafe@.service \
+    file://gbs-check-host-state.service \
+    file://gbs-set-boot-failsafe.sh \
+    file://gbs-set-failsafe.sh \
+    file://gbs-check-host-state.sh \
+    file://gbs-host-ready.target \
+    "
+
+RDEPENDS_${PN}_append_gbs = "bash"
+
+CHASSIS_INSTANCE="0"
+
+SYSTEMD_SERVICE_${PN}_append_gbs = " \
+    gbs-host-s0-set-failsafe.service \
+    gbs-host-s5-set-failsafe.service \
+    gbs-host-set-boot-failsafe@${CHASSIS_INSTANCE}.service \
+    gbs-check-host-state.service \
+    gbs-host-ready.target \
+    "
+
+FILES_${PN}_append_gbs = " \
+    ${systemd_system_unitdir}/gbs-host-set-boot-failsafe@.service \
+    "
+
+do_install_append_gbs() {
+    install -d ${D}${bindir}
+
+    install -m 0755 ${WORKDIR}/gbs-set-failsafe.sh ${D}${bindir}/.
+    install -m 0755 ${WORKDIR}/gbs-set-boot-failsafe.sh ${D}${bindir}/.
+    install -m 0755 ${WORKDIR}/gbs-check-host-state.sh ${D}${bindir}/.
+
+    install -d ${D}${systemd_system_unitdir}
+    install -m 0644 ${WORKDIR}/gbs-host-s0-set-failsafe.service ${D}${systemd_system_unitdir}
+    install -m 0644 ${WORKDIR}/gbs-host-s5-set-failsafe.service ${D}${systemd_system_unitdir}
+    install -m 0644 ${WORKDIR}/gbs-host-set-boot-failsafe@.service ${D}${systemd_system_unitdir}
+    install -m 0644 ${WORKDIR}/gbs-check-host-state.service ${D}${systemd_system_unitdir}
+    install -m 0644 ${WORKDIR}/gbs-host-ready.target ${D}${systemd_system_unitdir}
+}