meta-gsj: phosphor-pid-control: Add fan control algorithm

This change adds fan control function with following features.

1) Fans will be at full speed while rebooting or a sensor is not ready.
2) Detect different skus automatically.

Signed-off-by: Hank Liou <Hank.Liou@quantatw.com>
Change-Id: I44b3501bf1991d023957f2906e932d77709d8ab4
diff --git a/meta-gsj/recipes-phosphor/fans/phosphor-pid-control_%.bbappend b/meta-gsj/recipes-phosphor/fans/phosphor-pid-control_%.bbappend
new file mode 100644
index 0000000..68d6dd4
--- /dev/null
+++ b/meta-gsj/recipes-phosphor/fans/phosphor-pid-control_%.bbappend
@@ -0,0 +1,36 @@
+FILESEXTRAPATHS_prepend_gsj := "${THISDIR}/${PN}:"
+SRC_URI_append_gsj = " file://config-8ssd.json"
+SRC_URI_append_gsj = " file://config-2ssd.json"
+SRC_URI_append_gsj = " file://fan-control.sh"
+SRC_URI_append_gsj = " file://fan-full-speed.sh"
+SRC_URI_append_gsj = " file://phosphor-pid-control.service"
+SRC_URI_append_gsj = " file://fan-reboot-control.service"
+
+FILES_${PN}_append_gsj = " ${datadir}/swampd/config-8ssd.json"
+FILES_${PN}_append_gsj = " ${datadir}/swampd/config-2ssd.json"
+FILES_${PN}_append_gsj = " ${bindir}/fan-control.sh"
+FILES_${PN}_append_gsj = " ${bindir}/fan-full-speed.sh"
+
+inherit systemd
+RDEPENDS_${PN} += "bash"
+
+SYSTEMD_SERVICE_${PN}_append_gsj = " phosphor-pid-control.service"
+SYSTEMD_SERVICE_${PN}_append_gsj = " fan-reboot-control.service"
+
+do_install_append_gsj() {
+    install -d ${D}/${bindir}
+    install -m 0755 ${WORKDIR}/fan-control.sh ${D}/${bindir}
+    install -m 0755 ${WORKDIR}/fan-full-speed.sh ${D}/${bindir}
+
+    install -d ${D}${datadir}/swampd
+    install -m 0644 -D ${WORKDIR}/config-8ssd.json \
+        ${D}${datadir}/swampd/config-8ssd.json
+    install -m 0644 -D ${WORKDIR}/config-2ssd.json \
+        ${D}${datadir}/swampd/config-2ssd.json
+
+    install -d ${D}${systemd_unitdir}/system/
+    install -m 0644 ${WORKDIR}/phosphor-pid-control.service \
+        ${D}${systemd_unitdir}/system
+    install -m 0644 ${WORKDIR}/fan-reboot-control.service \
+        ${D}${systemd_unitdir}/system
+}
\ No newline at end of file