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