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>
diff --git a/hwmon.hpp b/hwmon.hpp
index 6ae1885..cc24266 100644
--- a/hwmon.hpp
+++ b/hwmon.hpp
@@ -9,10 +9,17 @@
static constexpr auto cinput = "input";
static constexpr auto clabel = "label";
static constexpr auto ctarget = "target";
+static constexpr auto cenable = "enable";
static const std::string input = cinput;
static const std::string label = clabel;
static const std::string target = ctarget;
+static const std::string enable = cenable;
+}
+
+namespace enable
+{
+static const auto rpmMode = 2;
}
namespace type
@@ -23,6 +30,8 @@
static constexpr auto ccurr = "current";
static constexpr auto cenergy = "energy";
static constexpr auto cpower = "power";
+static constexpr auto cpwm = "pwm";
+
static const std::string fan = cfan;
static const std::string temp = ctemp;
@@ -30,6 +39,7 @@
static const std::string curr = ccurr;
static const std::string energy = cenergy;
static const std::string power = cpower;
+static const std::string pwm = cpwm;
}
}