Install witherspoon fan watchdog service

This service will start on a power on and uses the busybox
watchdog app to continuously ping the watchdog device.

If other logic that is in place detects that phosphor-fan has
lost control of the fans, it will start the obmc-fan-watchdog-takeover
target, which will stop this service and expire the watchdog, pushing
the fans to high speed.  A power cycle or BMC reboot is
required to recover fan control.

An environment file is used to give the watchdog app the device
and timeout parameters.

Change-Id: I7088d3ea97beaa4922b9ad357f0ce9738e10cb22
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/meta-witherspoon/recipes-phosphor/fans/witherspoon-fan-watchdog/obmc/witherspoon-fan-watchdog/fan-watchdog.conf b/meta-witherspoon/recipes-phosphor/fans/witherspoon-fan-watchdog/obmc/witherspoon-fan-watchdog/fan-watchdog.conf
new file mode 100644
index 0000000..b54faae
--- /dev/null
+++ b/meta-witherspoon/recipes-phosphor/fans/witherspoon-fan-watchdog/obmc/witherspoon-fan-watchdog/fan-watchdog.conf
@@ -0,0 +1,3 @@
+TIMEOUT=3
+INTERVAL=1
+DEVICE=/dev/watchdog0
diff --git a/meta-witherspoon/recipes-phosphor/fans/witherspoon-fan-watchdog/obmc/witherspoon-fan-watchdog/witherspoon-reset-fan-watchdog.conf b/meta-witherspoon/recipes-phosphor/fans/witherspoon-fan-watchdog/obmc/witherspoon-fan-watchdog/reset-fan-watchdog.conf
similarity index 100%
rename from meta-witherspoon/recipes-phosphor/fans/witherspoon-fan-watchdog/obmc/witherspoon-fan-watchdog/witherspoon-reset-fan-watchdog.conf
rename to meta-witherspoon/recipes-phosphor/fans/witherspoon-fan-watchdog/obmc/witherspoon-fan-watchdog/reset-fan-watchdog.conf
diff --git a/meta-witherspoon/recipes-phosphor/fans/witherspoon-fan-watchdog/witherspoon-fan-watchdog.service b/meta-witherspoon/recipes-phosphor/fans/witherspoon-fan-watchdog/witherspoon-fan-watchdog.service
new file mode 100644
index 0000000..902ab6d
--- /dev/null
+++ b/meta-witherspoon/recipes-phosphor/fans/witherspoon-fan-watchdog/witherspoon-fan-watchdog.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Witherspoon Fan Watchdog Daemon
+Wants=phosphor-fan-control-init@%i.service
+Before=phosphor-fan-control-init@%i.service
+Conflicts=obmc-fan-watchdog-takeover.target
+
+[Service]
+EnvironmentFile={envfiledir}/obmc/witherspoon-fan-watchdog/fan-watchdog.conf
+ExecStart=/sbin/watchdog -T ${{TIMEOUT}} -t ${{INTERVAL}} -F ${{DEVICE}}
+KillSignal=SIGKILL
+
+[Install]
+RequiredBy=obmc-chassis-poweron@%i.target
diff --git a/meta-witherspoon/recipes-phosphor/fans/witherspoon-fan-watchdog/witherspoon-reset-fan-watchdog.service b/meta-witherspoon/recipes-phosphor/fans/witherspoon-fan-watchdog/witherspoon-reset-fan-watchdog.service
index 8ac3dd1..23c1fca 100644
--- a/meta-witherspoon/recipes-phosphor/fans/witherspoon-fan-watchdog/witherspoon-reset-fan-watchdog.service
+++ b/meta-witherspoon/recipes-phosphor/fans/witherspoon-fan-watchdog/witherspoon-reset-fan-watchdog.service
@@ -7,5 +7,5 @@
 [Service]
 Type=oneshot
 RemainAfterExit=yes
-EnvironmentFile={envfiledir}/obmc/witherspoon-fan-watchdog/witherspoon-reset-fan-watchdog.conf
+EnvironmentFile={envfiledir}/obmc/witherspoon-fan-watchdog/reset-fan-watchdog.conf
 ExecStart={sbindir}/phosphor-gpio-util -p ${{GPIO_PATH}} -g ${{GPIO}} -a ${{ACTION}} -d ${{DELAY}}