summaryrefslogtreecommitdiff
path: root/meta-quanta/meta-gbs/recipes-phosphor
diff options
context:
space:
mode:
authorGeorge Hung <george.hung@quantatw.com>2021-03-19 16:09:27 +0300
committerBrandon Kim <brandonkim@google.com>2021-04-01 01:52:01 +0300
commit9766963f3f85eaa6e8229033bbe220c7348fbee3 (patch)
treea5a437e27d37d4e3422552ca7774a06b8ca79f67 /meta-quanta/meta-gbs/recipes-phosphor
parentd7541988672748f8029261d39adc95f74deeb67a (diff)
downloadopenbmc-9766963f3f85eaa6e8229033bbe220c7348fbee3.tar.xz
meta-quanta: gbs: add failsafe patch for pid control
- Add the ability to dynamically set the failSafe percent https://gerrit.openbmc-project.xyz/38112 Note: It's already submitted to Gerrit and under review Also, it will be removed until it's merged Signed-off-by: George Hung <george.hung@quantatw.com> Change-Id: I0df3c413f46df880aa585af2c8cbc0fa8a5140a6
Diffstat (limited to 'meta-quanta/meta-gbs/recipes-phosphor')
-rw-r--r--meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/0001-Advertise-failSafePercent-on-dbus.patch117
-rw-r--r--meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control_%.bbappend1
2 files changed, 118 insertions, 0 deletions
diff --git a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/0001-Advertise-failSafePercent-on-dbus.patch b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/0001-Advertise-failSafePercent-on-dbus.patch
new file mode 100644
index 000000000..050c8b43c
--- /dev/null
+++ b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/0001-Advertise-failSafePercent-on-dbus.patch
@@ -0,0 +1,117 @@
+From c9b6d4589620275a625121b0ea9f4cc4c93b608a Mon Sep 17 00:00:00 2001
+From: Ian Goegebuer <goegebuer@google.com>
+Date: Tue, 10 Nov 2020 14:20:47 -0800
+Subject: [PATCH] pid/zone: Add the ability to dynamically set the failSafe
+ percent
+
+This change advertises the failSafe percent as a FanSpeed interface
+added to the the FanCtrl object generated by the config.json file.
+
+The target method added in this case sets the failSafePerecent
+out of 255 with 255 being 100% and 0 being 0%.
+
+Example:
+`busctl set-property xyz.openbmc_project.State.FanCtrl /xyz/openbmc_project/settings/fanctrl/zone1 xyz.openbmc_project.Control.FanSpeed Target t 178`
+Sets the failSafePercent to 69.8% or ~70%
+`busctl set-property xyz.openbmc_project.State.FanCtrl /xyz/openbmc_project/settings/fanctrl/zone1 xyz.openbmc_project.Control.FanSpeed Target t 250`
+Sets the failSafePercent to 98%
+
+Signed-off-by: Ian Goegebuer <goegebuer@google.com>
+Change-Id: Ief538d865dc1c654427ed9792496ab368e8803e2
+---
+ pid/zone.cpp | 11 +++++++++++
+ pid/zone.hpp | 11 +++++++++--
+ pid/zone_interface.hpp | 1 +
+ 3 files changed, 21 insertions(+), 2 deletions(-)
+
+diff --git a/pid/zone.cpp b/pid/zone.cpp
+index 441031a..24f6e84 100644
+--- a/pid/zone.cpp
++++ b/pid/zone.cpp
+@@ -120,6 +120,11 @@ double DbusPidZone::getFailSafePercent(void) const
+ return _failSafePercent;
+ }
+
++void DbusPidZone::setFailSafePercent(double newFailSafe)
++{
++ _failSafePercent = newFailSafe;
++}
++
+ double DbusPidZone::getMinThermalSetpoint(void) const
+ {
+ return _minThermalOutputSetPt;
+@@ -459,4 +464,10 @@ bool DbusPidZone::failSafe() const
+ return getFailSafeMode();
+ }
+
++uint64_t DbusPidZone::target(uint64_t value)
++{
++ setFailSafePercent(((double)value / 255) * 100.0);
++ return ModeObject::target(value);
++}
++
+ } // namespace pid_control
+diff --git a/pid/zone.hpp b/pid/zone.hpp
+index 3bea9c2..c0d1d22 100644
+--- a/pid/zone.hpp
++++ b/pid/zone.hpp
+@@ -10,6 +10,7 @@
+
+ #include <sdbusplus/bus.hpp>
+ #include <sdbusplus/server.hpp>
++#include <xyz/openbmc_project/Control/FanSpeed/server.hpp>
+ #include <xyz/openbmc_project/Control/Mode/server.hpp>
+
+ #include <fstream>
+@@ -22,7 +23,9 @@
+ template <typename... T>
+ using ServerObject = typename sdbusplus::server::object::object<T...>;
+ using ModeInterface = sdbusplus::xyz::openbmc_project::Control::server::Mode;
+-using ModeObject = ServerObject<ModeInterface>;
++using FanSpeedInterface =
++ sdbusplus::xyz::openbmc_project::Control::server::FanSpeed;
++using ModeObject = ServerObject<ModeInterface, FanSpeedInterface>;
+
+ namespace pid_control
+ {
+@@ -63,6 +66,7 @@ class DbusPidZone : public ZoneInterface, public ModeObject
+ void clearSetPoints(void) override;
+ void clearRPMCeilings(void) override;
+ double getFailSafePercent(void) const override;
++ void setFailSafePercent(double) override;
+ double getMinThermalSetpoint(void) const;
+
+ Sensor* getSensor(const std::string& name) override;
+@@ -88,6 +92,9 @@ class DbusPidZone : public ZoneInterface, public ModeObject
+ /* Method for reading whether in fail-safe mode over dbus */
+ bool failSafe() const override;
+
++ /* Method for setting the failSafePercent over dbus */
++ uint64_t target(uint64_t value) override;
++
+ private:
+ std::ofstream _log;
+
+@@ -95,7 +102,7 @@ class DbusPidZone : public ZoneInterface, public ModeObject
+ double _maximumSetPoint = 0;
+ bool _manualMode = false;
+ const double _minThermalOutputSetPt;
+- const double _failSafePercent;
++ double _failSafePercent;
+
+ std::set<std::string> _failSafeSensors;
+
+diff --git a/pid/zone_interface.hpp b/pid/zone_interface.hpp
+index a024c0e..9ea89c1 100644
+--- a/pid/zone_interface.hpp
++++ b/pid/zone_interface.hpp
+@@ -70,6 +70,7 @@ class ZoneInterface
+ * fail safe.
+ */
+ virtual double getFailSafePercent() const = 0;
++ virtual void setFailSafePercent(double newFailSafe) = 0;
+
+ /** Return if the zone is set to manual mode. false equates to automatic
+ * mode (the default).
+--
+2.29.2.222.g5d2a92d10f8-goog
diff --git a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control_%.bbappend b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control_%.bbappend
index e617f8679..7acd44c70 100644
--- a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control_%.bbappend
+++ b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control_%.bbappend
@@ -2,6 +2,7 @@ FILESEXTRAPATHS_prepend_gbs := "${THISDIR}/${PN}:"
SRC_URI_append_gbs = " file://config.json.in \
file://fan-table-init.sh \
file://phosphor-pid-control.service \
+ file://0001-Advertise-failSafePercent-on-dbus.patch \
"
FILES_${PN}_append_gbs = " ${datadir}/swampd/config.json.in"