Make use of obmc-fan-control-ready@.target
This involves the following:
* Start the fan-control-init@.service on a power on.
* That service will set fans to full speed, delay for a bit, and then
start the obmc-fan-control-ready target.
* This target will start the fan monitor and real fan control services.
* On a power off, the target and these services will be deactivated.
Doing it this way ensures the fans will have had time to ramp up from a
cold start before applications start looking at them.
Currently, on a reboot at runtime the same thing will occur. The watchdog
would have already brought the fans to high speed, so this will extend
that time at full speed by another 20 (or similar, it's configurable)
seconds, ensuring we know what speed the fans are at.
Resolves openbmc/openbmc#1567
Change-Id: I73a1f91f0efaf319df97b59334073116d45f40c3
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/common/recipes-phosphor/fans/phosphor-fan/phosphor-fan-control-init@.service b/common/recipes-phosphor/fans/phosphor-fan/phosphor-fan-control-init@.service
new file mode 100644
index 0000000..96e4ef7
--- /dev/null
+++ b/common/recipes-phosphor/fans/phosphor-fan/phosphor-fan-control-init@.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Phosphor Fan Control Initialization
+Wants=obmc-power-on@%i.target
+After=obmc-power-on@%i.target
+Conflicts=obmc-chassis-poweroff@%i.target
+
+[Service]
+Restart=on-failure
+ExecStart={sbindir}/phosphor-fan-control --init
+
+[Install]
+RequiredBy=obmc-chassis-poweron@%i.target
diff --git a/common/recipes-phosphor/fans/phosphor-fan/phosphor-fan-control@.service b/common/recipes-phosphor/fans/phosphor-fan/phosphor-fan-control@.service
index 568ff1e..773e59e 100644
--- a/common/recipes-phosphor/fans/phosphor-fan/phosphor-fan-control@.service
+++ b/common/recipes-phosphor/fans/phosphor-fan/phosphor-fan-control@.service
@@ -1,12 +1,10 @@
[Unit]
Description=Phosphor Fan Control Daemon
-Wants=obmc-power-on@%i.target
-After=obmc-power-on@%i.target
Conflicts=obmc-chassis-poweroff@%i.target
[Service]
Restart=on-failure
-ExecStart={sbindir}/phosphor-fan-control
+ExecStart={sbindir}/phosphor-fan-control --control
[Install]
-RequiredBy=obmc-chassis-poweron@%i.target
+RequiredBy=obmc-fan-control-ready@%i.target
diff --git a/common/recipes-phosphor/fans/phosphor-fan/phosphor-fan-monitor@.service b/common/recipes-phosphor/fans/phosphor-fan/phosphor-fan-monitor@.service
index 57b01c7..39faf4f 100644
--- a/common/recipes-phosphor/fans/phosphor-fan/phosphor-fan-monitor@.service
+++ b/common/recipes-phosphor/fans/phosphor-fan/phosphor-fan-monitor@.service
@@ -1,7 +1,7 @@
[Unit]
Description=Phosphor Fan Monitor Daemon
-Wants=obmc-power-on@%i.target
-After=obmc-power-on@%i.target
+Wants=phosphor-fan-control@%i.service
+Before=phosphor-fan-control@%i.service
Conflicts=obmc-chassis-poweroff@%i.target
[Service]
@@ -9,4 +9,4 @@
ExecStart={sbindir}/phosphor-fan-monitor
[Install]
-RequiredBy=obmc-chassis-poweron@%i.target
+RequiredBy=obmc-fan-control-ready@%i.target