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