From e0ca13eb5b2feba044505e3234c8381d3ab03187 Mon Sep 17 00:00:00 2001 From: Matthew Barth Date: Tue, 13 Jun 2017 16:29:09 -0500 Subject: Enable setting/adjusting fan ceiling speed Set the default ceiling to be what's given as full speed and adjust the ceiling speed based on an average of a given set of sensor values. The ceiling is chosen from a given map's key transition values. The map consists of key, value pairs where each key is the sensor value transition point and the value is the ceiling speed for when that transition occurs. The previous key value is needed to determine the direction in which to chose the appropriate ceiling speed allowing a buffer zone between ceiling changes if defined to. Resolves openbmc/openbmc#1628 Change-Id: I7c9c553b5d0c3219c51b563aec7dd5d5f090916b Signed-off-by: Matthew Barth --- control/zone.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'control/zone.cpp') diff --git a/control/zone.cpp b/control/zone.cpp index 67e22d9..d569aa8 100644 --- a/control/zone.cpp +++ b/control/zone.cpp @@ -37,7 +37,8 @@ Zone::Zone(Mode mode, _bus(bus), _fullSpeed(std::get(def)), _zoneNum(std::get(def)), - _defFloorSpeed(std::get(def)) + _defFloorSpeed(std::get(def)), + _defCeilingSpeed(std::get(def)) { auto& fanDefs = std::get(def); @@ -109,6 +110,11 @@ void Zone::setSpeed(uint64_t speed) { speed = _floorSpeed; } + //TODO openbmc/openbmc#1626 Move to control algorithm function + if (speed > _ceilingSpeed) + { + speed = _ceilingSpeed; + } fan->setSpeed(speed); } } -- cgit v1.2.1