Timer to decrease fan speeds
Create a repeating timer for decreasing fan speeds where the fan speeds
in the zone are decreased when the timer expires and a decrease speed
request exists with no increase request present or active.
Change-Id: I419592f6f50c0ed524f8bf3ebf183854ab5ef2ea
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/zone.hpp b/control/zone.hpp
index f445472..30de150 100644
--- a/control/zone.hpp
+++ b/control/zone.hpp
@@ -5,6 +5,7 @@
#include <sdbusplus/server.hpp>
#include "fan.hpp"
#include "types.hpp"
+#include "timer.hpp"
namespace phosphor
{
@@ -46,10 +47,12 @@
*
* @param[in] mode - mode of fan control
* @param[in] bus - the dbus object
+ * @param[in] events - sd_event pointer
* @param[in] def - the fan zone definition data
*/
Zone(Mode mode,
sdbusplus::bus::bus& bus,
+ phosphor::fan::event::EventPtr& events,
const ZoneDefinition& def);
/**
@@ -204,6 +207,12 @@
*/
void requestSpeedDecrease(uint64_t targetDelta);
+ /**
+ * @brief Callback function for the decrease timer that processes any
+ * requested speed decreases if allowed
+ */
+ void decTimerExpired();
+
private:
/**
@@ -267,6 +276,11 @@
uint64_t _decSpeedDelta = 0;
/**
+ * The decrease timer object
+ */
+ phosphor::fan::util::Timer _decTimer;
+
+ /**
* The vector of fans in this zone
*/
std::vector<std::unique_ptr<Fan>> _fans;