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