xref: /openbmc/phosphor-pid-control/conf.hpp (revision 6d31049a)
1 #pragma once
2 
3 #include "pid/ec/pid.hpp"
4 #include "pid/ec/stepwise.hpp"
5 
6 #include <map>
7 #include <string>
8 #include <vector>
9 
10 namespace conf
11 {
12 
13 constexpr int64_t inheritValueFromDbus = std::numeric_limits<int64_t>::lowest();
14 
15 /*
16  * General sensor structure used for configuration.
17  */
18 struct SensorConfig
19 {
20     /* Used for listen if readPath is passive. */
21     std::string type;
22     /* Can be a sensor path or a dbus path. */
23     std::string readPath;
24     std::string writePath;
25     /* min/max values for writing a percentage or error checking. */
26     int64_t min;
27     int64_t max;
28     int64_t timeout;
29 };
30 
31 /*
32  * Structure for holding the configuration of a PID.
33  */
34 struct ControllerInfo
35 {
36     std::string type;                // fan or margin or temp?
37     std::vector<std::string> inputs; // one or more sensors.
38     double setpoint;                 // initial setpoint for thermal.
39     union
40     {
41         ec::pidinfo pidInfo; // pid details
42         ec::StepwiseInfo stepwiseInfo;
43     };
44 };
45 
46 /*
47  * General zone structure used for configuration.  A zone is a list of PIDs
48  * and a set of configuration settings.  This structure gets filled out with
49  * the zone configuration settings and not the PID details.
50  */
51 struct ZoneConfig
52 {
53     /* The minimum RPM value we would ever want. */
54     double minThermalOutput;
55 
56     /* If the sensors are in fail-safe mode, this is the percentage to use. */
57     double failsafePercent;
58 };
59 
60 using PIDConf = std::map<std::string, struct ControllerInfo>;
61 
62 } // namespace conf
63