diff options
author | Jason M. Bills <jason.m.bills@linux.intel.com> | 2021-05-24 22:35:24 +0300 |
---|---|---|
committer | Jason M. Bills <jason.m.bills@linux.intel.com> | 2021-05-24 22:35:24 +0300 |
commit | 0e0df451ae365f09d5c0c766b253f23de26901f2 (patch) | |
tree | db4d7d3ce85e02ee01ad58a86ede02ac876aae77 /meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control | |
parent | e370fd750e2821620ec427f26f8efab0069824ff (diff) | |
parent | 7e10dee74964afa47859704886128dd256acf854 (diff) | |
download | openbmc-0e0df451ae365f09d5c0c766b253f23de26901f2.tar.xz |
Merge tag '0.52' of ssh://git-amr-1.devtools.intel.com:29418/openbmc-openbmc into update
Diffstat (limited to 'meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control')
-rw-r--r-- | meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/0001-Advertise-failSafePercent-on-dbus.patch | 117 | ||||
-rw-r--r-- | meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/config.json.in (renamed from meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/config-sku.json) | 12 | ||||
-rw-r--r-- | meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-default-speed.sh | 6 | ||||
-rw-r--r-- | meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-reboot-control.service | 12 | ||||
-rw-r--r-- | meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh | 17 | ||||
-rw-r--r-- | meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/phosphor-pid-control.service | 2 |
6 files changed, 132 insertions, 34 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/config-sku.json b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/config.json.in index e5040ca1c..21ba368df 100644 --- a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/config-sku.json +++ b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/config.json.in @@ -1,11 +1,11 @@ { - "version": "R04", + "version": "R05", "sensors": [ { "name": "fan0", "type": "fan", "readPath": "/xyz/openbmc_project/sensors/fan_tach/fan0", - "writePath": "/sys/devices/platform/ahb/ahb:apb/f0103000.pwm-fan-controller/hwmon/Fan_0_To_4_Hwmon/pwm1", + "writePath": "/sys/devices/platform/ahb/ahb:apb/f0103000.pwm-fan-controller/hwmon/@Fan_0_To_4_Hwmon@/pwm1", "min": 0, "max": 255 }, @@ -13,7 +13,7 @@ "name": "fan1", "type": "fan", "readPath": "/xyz/openbmc_project/sensors/fan_tach/fan1", - "writePath": "/sys/devices/platform/ahb/ahb:apb/f0103000.pwm-fan-controller/hwmon/Fan_0_To_4_Hwmon/pwm2", + "writePath": "/sys/devices/platform/ahb/ahb:apb/f0103000.pwm-fan-controller/hwmon/@Fan_0_To_4_Hwmon@/pwm2", "min": 0, "max": 255 }, @@ -21,7 +21,7 @@ "name": "fb_fan0", "type": "fan", "readPath": "/xyz/openbmc_project/sensors/fan_tach/fb_fan0", - "writePath": "/sys/devices/platform/ahb/ahb:apb/f0103000.pwm-fan-controller/hwmon/Fan_0_To_4_Hwmon/pwm3", + "writePath": "/sys/devices/platform/ahb/ahb:apb/f0103000.pwm-fan-controller/hwmon/@Fan_0_To_4_Hwmon@/pwm3", "min": 0, "max": 255 }, @@ -29,7 +29,7 @@ "name": "fb_fan1", "type": "fan", "readPath": "/xyz/openbmc_project/sensors/fan_tach/fb_fan1", - "writePath": "/sys/devices/platform/ahb/ahb:apb/f0103000.pwm-fan-controller/hwmon/Fan_0_To_4_Hwmon/pwm4", + "writePath": "/sys/devices/platform/ahb/ahb:apb/f0103000.pwm-fan-controller/hwmon/@Fan_0_To_4_Hwmon@/pwm4", "min": 0, "max": 255 }, @@ -37,7 +37,7 @@ "name": "fb_fan2", "type": "fan", "readPath": "/xyz/openbmc_project/sensors/fan_tach/fb_fan2", - "writePath": "/sys/devices/platform/ahb/ahb:apb/f0103000.pwm-fan-controller/hwmon/Fan_0_To_4_Hwmon/pwm5", + "writePath": "/sys/devices/platform/ahb/ahb:apb/f0103000.pwm-fan-controller/hwmon/@Fan_0_To_4_Hwmon@/pwm5", "min": 0, "max": 255 }, diff --git a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-default-speed.sh b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-default-speed.sh deleted file mode 100644 index 22cfab582..000000000 --- a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-default-speed.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -for i in {1..5}; -do - echo 255 > /sys/class/hwmon/*/pwm${i} -done diff --git a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-reboot-control.service b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-reboot-control.service deleted file mode 100644 index 681bdbe00..000000000 --- a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-reboot-control.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=Set Fan to Default Duty as Rebooting -DefaultDependencies=no -After=shutdown.target - -[Service] -Type=oneshot -RemainAfterExit=true -ExecStart=/usr/bin/fan-default-speed.sh - -[Install] -WantedBy=shutdown.target diff --git a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh index 68b699e0f..9617d0da4 100644 --- a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh +++ b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/fan-table-init.sh @@ -1,10 +1,8 @@ #!/bin/bash -FAN_TABLE_SKU_FILE="/usr/share/swampd/config-sku.json" -FAN_TABLE_FILE="/usr/share/swampd/config.json" - -# determine sku -cp $FAN_TABLE_SKU_FILE $FAN_TABLE_FILE +FAN_TABLE_FILE_IN="/usr/share/swampd/config.json.in" +TEMP_FILE="$(mktemp)" +cp "$FAN_TABLE_FILE_IN" "$TEMP_FILE" # wait for fan dbus mapper wait /xyz/openbmc_project/sensors/fan_tach/fan0 @@ -13,15 +11,16 @@ mapper wait /xyz/openbmc_project/sensors/fan_tach/fb_fan0 mapper wait /xyz/openbmc_project/sensors/fan_tach/fb_fan1 mapper wait /xyz/openbmc_project/sensors/fan_tach/fb_fan2 -/usr/bin/fan-default-speed.sh - # generate fan table writePath -Fan_0_To_4_Hwmon="$(ls -la /sys/class/hwmon |grep pwm | head -n 1| tail -n +1|cut -d '/' -f 9)" +Fan_0_To_4_Hwmon="$(ls /sys/devices/platform/ahb/ahb\:*/*pwm-fan-controller/hwmon/)" if [[ "$Fan_0_To_4_Hwmon" != "" ]]; then - sed -i "s/Fan_0_To_4_Hwmon/$Fan_0_To_4_Hwmon/g" $FAN_TABLE_FILE + sed -i "s/@Fan_0_To_4_Hwmon@/$Fan_0_To_4_Hwmon/g" $TEMP_FILE fi +# Use shell parameter expansion to trim the ".in" suffix +mv "$TEMP_FILE" "${FAN_TABLE_FILE_IN%".in"}" + # start read margin temp wait /usr/bin/read-margin-temp-wait.sh & diff --git a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/phosphor-pid-control.service b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/phosphor-pid-control.service index 33a441928..1c47761f1 100644 --- a/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/phosphor-pid-control.service +++ b/meta-quanta/meta-gbs/recipes-phosphor/fans/phosphor-pid-control/phosphor-pid-control.service @@ -1,6 +1,7 @@ [Unit] Description=Swampd Margin-based Fan Control Daemon After=xyz.openbmc_project.Hwmon@-ahb-apb-pwm\x2dfan\x2dcontroller\x40103000.service +After=xyz.openbmc_project.nvme.manager.service [Service] Type=simple @@ -9,7 +10,6 @@ ExecStart=/usr/bin/swampd Restart=always RestartSec=5 StartLimitInterval=0 -ExecStopPost=/usr/bin/fan-default-speed.sh [Install] WantedBy=basic.target |