xref: /openbmc/phosphor-pid-control/conf.hpp (revision ca97c83d)
1 #pragma once
2 
3 #include <map>
4 #include <string>
5 #include <vector>
6 
7 #include "pid/ec/pid.hpp"
8 
9 
10 /*
11  * General sensor structure used for configuration.
12  */
13 struct sensor
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 controller_info
30 {
31     std::string type;                // fan or margin or temp?
32     std::vector<std::string> inputs; // one or more sensors.
33     float setpoint;                  // initial setpoint for thermal.
34     ec::pidinfo info;                // pid details
35 };
36 
37 /*
38  * General zone structure used for configuration.  A zone is a list of PIDs
39  * and a set of configuration settings.  This structure gets filled out with
40  * the zone configuration settings and not the PID details.
41  */
42 struct zone
43 {
44     /* The minimum RPM value we would ever want. */
45     float minthermalrpm;
46 
47     /* If the sensors are in fail-safe mode, this is the percentage to use. */
48     float failsafepercent;
49 };
50 
51 using PIDConf = std::map<std::string, struct controller_info>;
52