meta-quanta: gbs: add pid controller with config
1. add pid control with fan table config
2. add reboot control service to set fan duty to expected default
value before pid control up
3. initial read-margin-temp with json file and the script waits
related hwmon sensor could monitor
Signed-off-by: George Hung <george.hung@quantatw.com>
Change-Id: I6433078915b7c4df498bcb0f7a271dccaf66fbfa
diff --git a/meta-gbs/recipes-phosphor/fans/phosphor-pid-control_%.bbappend b/meta-gbs/recipes-phosphor/fans/phosphor-pid-control_%.bbappend
new file mode 100644
index 0000000..f87a493
--- /dev/null
+++ b/meta-gbs/recipes-phosphor/fans/phosphor-pid-control_%.bbappend
@@ -0,0 +1,31 @@
+FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:"
+SRC_URI_append_gbs = " file://config.json"
+SRC_URI_append_gbs = " file://fan-table-init.sh"
+SRC_URI_append_gbs = " file://fan-default-speed.sh"
+SRC_URI_append_gbs = " file://phosphor-pid-control.service"
+SRC_URI_append_gbs = " file://fan-reboot-control.service"
+
+FILES_${PN}_append_gbs = " ${datadir}/swampd/config.json"
+FILES_${PN}_append_gbs = " ${bindir}/fan-default-speed.sh"
+FILES_${PN}_append_gbs = " ${bindir}/fan-table-init.sh"
+
+RDEPENDS_${PN} += "bash"
+
+SYSTEMD_SERVICE_${PN}_append_gbs = " phosphor-pid-control.service"
+SYSTEMD_SERVICE_${PN}_append_gbs = " fan-reboot-control.service"
+
+do_install_append_gbs() {
+ install -d ${D}/${bindir}
+ install -m 0755 ${WORKDIR}/fan-default-speed.sh ${D}/${bindir}
+ install -m 0755 ${WORKDIR}/fan-table-init.sh ${D}/${bindir}
+
+ install -d ${D}${datadir}/swampd
+ install -m 0644 -D ${WORKDIR}/config.json \
+ ${D}${datadir}/swampd/config.json
+
+ install -d ${D}${systemd_system_unitdir}
+ install -m 0644 ${WORKDIR}/phosphor-pid-control.service \
+ ${D}${systemd_system_unitdir}
+ install -m 0644 ${WORKDIR}/fan-reboot-control.service \
+ ${D}${systemd_system_unitdir}
+}