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