summaryrefslogtreecommitdiffstats
path: root/mainloop.cpp
diff options
context:
space:
mode:
authorMatt Spinler <spinler@us.ibm.com>2017-05-11 10:59:39 -0500
committerMatt Spinler <spinler@us.ibm.com>2017-05-11 15:49:44 -0500
commit0a8de64574891f9e0e6339b6e064e4599dffcb21 (patch)
tree995f8a8aca0bc2be0fb2d045729ab46a4b052c2c /mainloop.cpp
parent05711eb061d7f8a7d3b11a4d7d09d60a6afc2583 (diff)
downloadphosphor-hwmon-0a8de64574891f9e0e6339b6e064e4599dffcb21.tar.gz
phosphor-hwmon-0a8de64574891f9e0e6339b6e064e4599dffcb21.zip
Write pwmX_enable for fans that have a fanX_target
For fans that have a fanX_target hwmon sysfs attribute, write the pwmX_enable on startup to put that fan into RPM mode, which is safe to do because this application requires that the target is written in RPMs. The write will only occur if the pwm_enable file exists. In the future, if fans with a target need to run in pwm mode, this code will need to be updated to convert between RPM and pwm anyway and the pwm_enable value can then be different based on that. Resolves openbmc/openbmc#1584 Change-Id: I4f6f3ac8d6651314367aaf5c51ac176220f1fba6 Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Diffstat (limited to 'mainloop.cpp')
-rw-r--r--mainloop.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/mainloop.cpp b/mainloop.cpp
index 34970b1..9714d0f 100644
--- a/mainloop.cpp
+++ b/mainloop.cpp
@@ -242,7 +242,13 @@ void MainLoop::run()
addThreshold<CriticalObject>(i.first, sensorValue, info);
//TODO openbmc/openbmc#1347
// Handle application restarts to set/refresh fan speed values
- addTarget<hwmon::FanSpeed>(i.first, _hwmonRoot, _instance, info);
+ auto target = addTarget<hwmon::FanSpeed>(
+ i.first, _hwmonRoot, _instance, info);
+
+ if (target)
+ {
+ target->enable();
+ }
// All the interfaces have been created. Go ahead
// and emit InterfacesAdded.
OpenPOWER on IntegriCloud