zone: Add debug thermal/power interface
- Add xyz.openbmc_project.Debug.Pid.ThermalPower interface to
fanctrl/zoneX/pid dbus to record some datas in thermal/power
PID loop.
Tested:
```
busctl introspect xyz.openbmc_project.State.FanCtrl /xyz/openbmc_project/settings/fanctrl/zone0/CPU0_PID xyz.openbmc_project.Debug.Pid.ThermalPower
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
.ClassType property s "Temperature" emits-change
.Input property d 36.594 emits-change
.Leader property s "Die_CPU0" emits-change
.Output property d 4200 emits-change
.Setpoint property d 70 emits-change
```
Signed-off-by: Harvey Wu <Harvey.Wu@quantatw.com>
Change-Id: I6846c3878c2ca5eaeeb6eaf48aaf0f604a2beccf
diff --git a/pid/zone.cpp b/pid/zone.cpp
index 995b2aa..0b46841 100644
--- a/pid/zone.cpp
+++ b/pid/zone.cpp
@@ -470,7 +470,8 @@
return getFailSafeMode();
}
-void DbusPidZone::addPidControlProcess(std::string name, sdbusplus::bus_t& bus,
+void DbusPidZone::addPidControlProcess(std::string name, std::string type,
+ double setpoint, sdbusplus::bus_t& bus,
std::string objPath, bool defer)
{
_pidsControlProcess[name] = std::make_unique<ProcessObject>(
@@ -479,6 +480,24 @@
: ProcessObject::action::emit_object_added);
// Default enable setting = true
_pidsControlProcess[name]->enabled(true);
+ _pidsControlProcess[name]->setpoint(setpoint);
+
+ if (type == "temp")
+ {
+ _pidsControlProcess[name]->classType("Temperature");
+ }
+ else if (type == "margin")
+ {
+ _pidsControlProcess[name]->classType("Margin");
+ }
+ else if (type == "power")
+ {
+ _pidsControlProcess[name]->classType("Power");
+ }
+ else if (type == "powersum")
+ {
+ _pidsControlProcess[name]->classType("PowerSum");
+ }
}
bool DbusPidZone::isPidProcessEnabled(std::string name)
@@ -521,4 +540,19 @@
return _maximumSetPointName;
}
+void DbusPidZone::updateThermalPowerDebugInterface(std::string pidName,
+ std::string leader,
+ double input, double output)
+{
+ if (leader.empty())
+ {
+ _pidsControlProcess[pidName]->output(output);
+ }
+ else
+ {
+ _pidsControlProcess[pidName]->leader(leader);
+ _pidsControlProcess[pidName]->input(input);
+ }
+}
+
} // namespace pid_control