summaryrefslogtreecommitdiffstats
path: root/control/zone.cpp
diff options
context:
space:
mode:
authorMatthew Barth <msbarth@us.ibm.com>2017-06-22 15:07:29 -0500
committerMatthew Barth <msbarth@us.ibm.com>2017-07-06 17:25:01 -0500
commit0ce99d8b377e68b5286c37e7e644301051972083 (patch)
treef2d6fbafaf744dbc2cbe960e9609c5872f703cae /control/zone.cpp
parent240397b9b80437db77d8d01db2b187d02ef415f7 (diff)
downloadphosphor-fan-presence-0ce99d8b377e68b5286c37e7e644301051972083.tar.gz
phosphor-fan-presence-0ce99d8b377e68b5286c37e7e644301051972083.zip
Support speed decrease events
A net decrease speed action determines the net decrease delta from each group member's property value and requests a speed decrease of that delta from the current target speed. From all the requests for a speed decrease on a zone, only the lowest net decrease is used from all the groups subscribed to decrease a zone's speed. The new target speed is only decreased when no increase requests exist and the resulting target is above the zone's floor speed, otherwise the floor speed is set as the new target. Resolves openbmc/openbmc#1626 Change-Id: Iaefa7b25c3f44691dd3ca4084bfddd3c1a504de9 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Diffstat (limited to 'control/zone.cpp')
-rw-r--r--control/zone.cpp35
1 files changed, 30 insertions, 5 deletions
diff --git a/control/zone.cpp b/control/zone.cpp
index 5ed0c3a..1ca0b81 100644
--- a/control/zone.cpp
+++ b/control/zone.cpp
@@ -97,6 +97,7 @@ Zone::Zone(Mode mode,
std::get<actionPos>(event)(*this,
std::get<groupPos>(event));
}
+ //TODO openbmc/openbmc#1625 Start timer for fan speed decreases
}
}
@@ -105,11 +106,6 @@ void Zone::setSpeed(uint64_t speed)
{
for (auto& fan : _fans)
{
- //TODO openbmc/openbmc#1626 Move to control algorithm function
- if (speed < _floorSpeed)
- {
- speed = _floorSpeed;
- }
fan->setSpeed(speed);
}
}
@@ -159,6 +155,35 @@ void Zone::requestSpeedIncrease(uint64_t targetDelta)
_incSpeedDelta = 0;
}
+void Zone::requestSpeedDecrease(uint64_t targetDelta)
+{
+ // Only decrease the lowest target delta requested
+ if (_decSpeedDelta == 0 || targetDelta < _decSpeedDelta)
+ {
+ _decSpeedDelta = targetDelta;
+ }
+
+ //TODO openbmc/openbmc#1625 Set decrease target speed when timer expires
+ // Only decrease speeds when no requested increases exist
+ if (_incSpeedDelta == 0)
+ {
+ // Target speed can not go below the defined floor speed
+ if ((_targetSpeed < _decSpeedDelta) ||
+ (_targetSpeed - _decSpeedDelta < _floorSpeed))
+ {
+ _targetSpeed = _floorSpeed;
+ }
+ else
+ {
+ _targetSpeed = _targetSpeed - _decSpeedDelta;
+ }
+ setSpeed(_targetSpeed);
+ }
+ // Clear decrease delta when timer expires
+ _decSpeedDelta = 0;
+ //TODO openbmc/openbmc#1625 Restart decrease timer
+}
+
void Zone::getProperty(sdbusplus::bus::bus& bus,
const std::string& path,
const std::string& iface,
OpenPOWER on IntegriCloud