meta-quanta: gsj: Lower fan speed to default duty as booting and rebooting

The fan speed is lowered to 90 duty for thermal issue.

(From meta-quanta rev: 39041e2fa1e5b816c09925411081acc30010f782)

Signed-off-by: Hank Liou <Hank.Liou@quantatw.com>
Change-Id: I5a14320a3687326e710976f8bab9bfa65f3b2865
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/fan-boot-control.service b/meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/fan-boot-control.service
new file mode 100644
index 0000000..2149c3d
--- /dev/null
+++ b/meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/fan-boot-control.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Set Fan to Default Duty as Booting Up
+DefaultDependencies=no
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/fan-default-speed.sh
+
+[Install]
+WantedBy=sysinit.target
diff --git a/meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/fan-default-speed.sh b/meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/fan-default-speed.sh
new file mode 100644
index 0000000..2cd3106
--- /dev/null
+++ b/meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/fan-default-speed.sh
@@ -0,0 +1,5 @@
+#!bin/bash
+
+echo 230 > /sys/class/hwmon/*/pwm1
+echo 230 > /sys/class/hwmon/*/pwm2
+echo 230 > /sys/class/hwmon/*/pwm3
diff --git a/meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/fan-full-speed.sh b/meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/fan-full-speed.sh
deleted file mode 100644
index dd411d2..0000000
--- a/meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/fan-full-speed.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!bin/bash
-
-echo 255 > /sys/class/hwmon/*/pwm1
-echo 255 > /sys/class/hwmon/*/pwm2
-echo 255 > /sys/class/hwmon/*/pwm3
diff --git a/meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/fan-reboot-control.service b/meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/fan-reboot-control.service
index 4396d18..681bdbe 100644
--- a/meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/fan-reboot-control.service
+++ b/meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/fan-reboot-control.service
@@ -1,12 +1,12 @@
 [Unit]
-Description=Set Fan to Full Speed as Rebooting
+Description=Set Fan to Default Duty as Rebooting
 DefaultDependencies=no
 After=shutdown.target
 
 [Service]
 Type=oneshot
 RemainAfterExit=true
-ExecStart=/usr/bin/fan-full-speed.sh
+ExecStart=/usr/bin/fan-default-speed.sh
 
 [Install]
-WantedBy=shutdown.target
\ No newline at end of file
+WantedBy=shutdown.target
diff --git a/meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/phosphor-pid-control.service b/meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/phosphor-pid-control.service
index 135e673..0e18819 100644
--- a/meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/phosphor-pid-control.service
+++ b/meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control/phosphor-pid-control.service
@@ -8,7 +8,7 @@
 Restart=always
 RestartSec=5
 StartLimitInterval=0
-ExecStopPost=/usr/bin/fan-full-speed.sh
+ExecStopPost=/usr/bin/fan-default-speed.sh
 
 [Install]
-WantedBy=basic.target
\ No newline at end of file
+WantedBy=basic.target
diff --git a/meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control_%.bbappend b/meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control_%.bbappend
index 68d6dd4..13d037e 100644
--- a/meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control_%.bbappend
+++ b/meta-quanta/meta-gsj/recipes-phosphor/fans/phosphor-pid-control_%.bbappend
@@ -2,25 +2,27 @@
 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://fan-default-speed.sh"
 SRC_URI_append_gsj = " file://phosphor-pid-control.service"
 SRC_URI_append_gsj = " file://fan-reboot-control.service"
+SRC_URI_append_gsj = " file://fan-boot-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"
+FILES_${PN}_append_gsj = " ${bindir}/fan-default-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"
+SYSTEMD_SERVICE_${PN}_append_gsj = " fan-boot-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 -m 0755 ${WORKDIR}/fan-default-speed.sh ${D}/${bindir}
 
     install -d ${D}${datadir}/swampd
     install -m 0644 -D ${WORKDIR}/config-8ssd.json \
@@ -33,4 +35,6 @@
         ${D}${systemd_unitdir}/system
     install -m 0644 ${WORKDIR}/fan-reboot-control.service \
         ${D}${systemd_unitdir}/system
-}
\ No newline at end of file
+    install -m 0644 ${WORKDIR}/fan-boot-control.service \
+        ${D}${systemd_unitdir}/system
+}