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/fan-table-init.sh b/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh
new file mode 100644
index 0000000..06914af
--- /dev/null
+++ b/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# wait for fan dbus
+mapper wait /xyz/openbmc_project/sensors/fan_tach/fan0
+mapper wait /xyz/openbmc_project/sensors/fan_tach/fan1
+mapper wait /xyz/openbmc_project/sensors/fan_tach/fan2
+mapper wait /xyz/openbmc_project/sensors/fan_tach/fan3
+mapper wait /xyz/openbmc_project/sensors/fan_tach/fan4
+
+/usr/bin/fan-default-speed.sh
+
+# generate fan table writePath
+Fan_0_To_4_Hwmon="$(ls -la /sys/class/hwmon |grep pwm |  head -n 1| tail -n +1|cut -d '/' -f 9)"
+
+if [[ "$Fan_0_To_4_Hwmon" != "" ]]
+then
+     sed -i "s/Fan_0_To_4_Hwmon/$Fan_0_To_4_Hwmon/g" /usr/share/swampd/config.json
+fi
+
+# start read margin temp wait
+/usr/bin/read-margin-temp-wait.sh &
+
+exit 0