diff options
author | Matthew Barth <msbarth@us.ibm.com> | 2017-03-09 14:36:08 -0600 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2017-03-30 02:47:06 +0000 |
commit | 048ac87fa06a2a1c42f51c9f87931271a4f5a401 (patch) | |
tree | 380860360e2c3bd4cfa578e5fb09a6ddcc260b33 /fan_speed.cpp | |
parent | bf7b7b1d252dd976fb9ea288652603d354b934c1 (diff) | |
download | phosphor-hwmon-048ac87fa06a2a1c42f51c9f87931271a4f5a401.tar.gz phosphor-hwmon-048ac87fa06a2a1c42f51c9f87931271a4f5a401.zip |
Update hwmon fan target sysfs entries
Override the default FanSpeed.Target set implementation so when a target
value is written to the FanSpeed interface it is also updated in the
related fan target sysfs file. This sets a particular fan to the given
target speed.
Resolves openbmc/openbmc#962
Resolves openbmc/phosphor-hwmon#1
Change-Id: I867811737269b3f42d2a0dc15b37782a74f147b8
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Diffstat (limited to 'fan_speed.cpp')
-rw-r--r-- | fan_speed.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/fan_speed.cpp b/fan_speed.cpp new file mode 100644 index 0000000..74bbea3 --- /dev/null +++ b/fan_speed.cpp @@ -0,0 +1,26 @@ +#include "fan_speed.hpp" +#include "hwmon.hpp" +#include "sysfs.hpp" + +namespace hwmon +{ + +uint64_t FanSpeed::target(uint64_t value) +{ + auto curValue = FanSpeedObject::target(); + + if (curValue != value) + { + //Write target out to sysfs + curValue = writeSysfsWithCallout(value, + sysfsRoot, + instance, + type, + id, + entry::target); + } + + return FanSpeedObject::target(value); +} + +} // namespace hwmon |