summaryrefslogtreecommitdiffstats
path: root/control/zone.cpp
diff options
context:
space:
mode:
authorMatthew Barth <msbarth@us.ibm.com>2017-06-22 11:23:30 -0500
committerMatthew Barth <msbarth@us.ibm.com>2017-07-06 17:11:00 -0500
commit240397b9b80437db77d8d01db2b187d02ef415f7 (patch)
treeff16b6ef8983899c02974c3b12454e133e2118b4 /control/zone.cpp
parent246235237c92bd6a55487bdd9fdc6b4b11466a7e (diff)
downloadphosphor-fan-presence-240397b9b80437db77d8d01db2b187d02ef415f7.tar.gz
phosphor-fan-presence-240397b9b80437db77d8d01db2b187d02ef415f7.zip
Process speed increase requests
Speed increases are made providing a target speed delta. The increase is made when the delta is higher than the current increase that may be occurring. When no increase is currently happening, the increase delta requested is accepted. All resulting target increases will not go above a defined ceiling speed. Change-Id: Ia19c71a023cf5b897d5ba92974ff98451f34d5a3 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Diffstat (limited to 'control/zone.cpp')
-rw-r--r--control/zone.cpp33
1 files changed, 28 insertions, 5 deletions
diff --git a/control/zone.cpp b/control/zone.cpp
index d569aa8..5ed0c3a 100644
--- a/control/zone.cpp
+++ b/control/zone.cpp
@@ -110,11 +110,6 @@ 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);
}
}
@@ -136,6 +131,34 @@ void Zone::setActiveAllow(const Group* group, bool isActiveAllow)
}
}
+void Zone::requestSpeedIncrease(uint64_t targetDelta)
+{
+ // Only increase speed when delta is higher than
+ // the current increase delta for the zone and currently under ceiling
+ if (targetDelta > _incSpeedDelta &&
+ _targetSpeed < _ceilingSpeed)
+ {
+ _targetSpeed = (targetDelta - _incSpeedDelta) + _targetSpeed;
+ _incSpeedDelta = targetDelta;
+ //TODO openbmc/openbmc#1625 Cancel current timer countdown
+ //TODO Floor speed above target, update target to floor speed
+ if (_targetSpeed < _floorSpeed)
+ {
+ _targetSpeed = _floorSpeed;
+ }
+ // Target speed can not go above a defined ceiling speed
+ if (_targetSpeed > _ceilingSpeed)
+ {
+ _targetSpeed = _ceilingSpeed;
+ }
+
+ setSpeed(_targetSpeed);
+ //TODO openbmc/openbmc#1625 Start timer countdown for fan speed increase
+ }
+ //TODO openbmc/openbmc#1625 Clear increase delta when timer expires
+ _incSpeedDelta = 0;
+}
+
void Zone::getProperty(sdbusplus::bus::bus& bus,
const std::string& path,
const std::string& iface,
OpenPOWER on IntegriCloud