Matt Spinler | e10416e | 2017-04-10 14:15:53 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Matt Spinler | e10416e | 2017-04-10 14:15:53 -0500 | [diff] [blame] | 3 | #include "types.hpp" |
Matt Spinler | 57352a3 | 2017-04-10 14:48:35 -0500 | [diff] [blame] | 4 | #include "zone.hpp" |
Matt Spinler | e10416e | 2017-04-10 14:15:53 -0500 | [diff] [blame] | 5 | |
Matthew Barth | 3e1bb27 | 2020-05-26 11:09:21 -0500 | [diff] [blame] | 6 | #include <sdbusplus/bus.hpp> |
| 7 | #include <sdeventplus/event.hpp> |
| 8 | |
| 9 | #include <memory> |
| 10 | #include <vector> |
| 11 | |
Matt Spinler | e10416e | 2017-04-10 14:15:53 -0500 | [diff] [blame] | 12 | namespace phosphor |
| 13 | { |
| 14 | namespace fan |
| 15 | { |
| 16 | namespace control |
| 17 | { |
| 18 | |
Matthew Barth | 3e1bb27 | 2020-05-26 11:09:21 -0500 | [diff] [blame] | 19 | using ZoneMap = std::map<unsigned int, std::unique_ptr<Zone>>; |
Matt Spinler | 57352a3 | 2017-04-10 14:48:35 -0500 | [diff] [blame] | 20 | |
Matt Spinler | e10416e | 2017-04-10 14:15:53 -0500 | [diff] [blame] | 21 | /** |
| 22 | * @class Fan control manager |
| 23 | */ |
| 24 | class Manager |
| 25 | { |
Matthew Barth | 3e1bb27 | 2020-05-26 11:09:21 -0500 | [diff] [blame] | 26 | public: |
| 27 | Manager() = delete; |
| 28 | Manager(const Manager&) = delete; |
| 29 | Manager(Manager&&) = default; |
| 30 | Manager& operator=(const Manager&) = delete; |
| 31 | Manager& operator=(Manager&&) = delete; |
| 32 | ~Manager() = default; |
Matt Spinler | e10416e | 2017-04-10 14:15:53 -0500 | [diff] [blame] | 33 | |
Matthew Barth | 3e1bb27 | 2020-05-26 11:09:21 -0500 | [diff] [blame] | 34 | /** |
| 35 | * Constructor |
| 36 | * Creates the Zone objects based on the |
| 37 | * _zoneLayouts data. |
| 38 | * |
| 39 | * @param[in] bus - The dbus object |
| 40 | * @param[in] event - The event loop |
| 41 | * @param[in] mode - The control mode |
| 42 | */ |
Patrick Williams | cb356d4 | 2022-07-22 19:26:53 -0500 | [diff] [blame] | 43 | Manager(sdbusplus::bus_t& bus, const sdeventplus::Event& event, Mode mode); |
Matt Spinler | e10416e | 2017-04-10 14:15:53 -0500 | [diff] [blame] | 44 | |
Matthew Barth | 3e1bb27 | 2020-05-26 11:09:21 -0500 | [diff] [blame] | 45 | /** |
| 46 | * Does the fan control inititialization, which is |
| 47 | * setting fans to full, delaying so they |
| 48 | * can get there, and starting a target. |
| 49 | */ |
Matthew Barth | 0676494 | 2021-03-04 09:28:40 -0600 | [diff] [blame] | 50 | void doInit(const sdeventplus::Event& event); |
Matt Spinler | ee7f642 | 2017-05-09 11:03:14 -0500 | [diff] [blame] | 51 | |
Matthew Barth | 3e1bb27 | 2020-05-26 11:09:21 -0500 | [diff] [blame] | 52 | private: |
| 53 | /** |
| 54 | * The dbus object |
| 55 | */ |
Patrick Williams | cb356d4 | 2022-07-22 19:26:53 -0500 | [diff] [blame] | 56 | sdbusplus::bus_t& _bus; |
Matt Spinler | e10416e | 2017-04-10 14:15:53 -0500 | [diff] [blame] | 57 | |
Matthew Barth | 3e1bb27 | 2020-05-26 11:09:21 -0500 | [diff] [blame] | 58 | /** |
| 59 | * The sdbusplus object manager |
| 60 | */ |
Patrick Williams | cb356d4 | 2022-07-22 19:26:53 -0500 | [diff] [blame] | 61 | sdbusplus::server::manager_t _objMgr; |
Matt Spinler | e10416e | 2017-04-10 14:15:53 -0500 | [diff] [blame] | 62 | |
Matthew Barth | 3e1bb27 | 2020-05-26 11:09:21 -0500 | [diff] [blame] | 63 | /** |
| 64 | * The fan zones in the system |
| 65 | */ |
| 66 | ZoneMap _zones; |
Matthew Barth | f8ae7a5 | 2021-03-05 10:23:43 -0600 | [diff] [blame] | 67 | |
Matthew Barth | 3e1bb27 | 2020-05-26 11:09:21 -0500 | [diff] [blame] | 68 | /** |
| 69 | * The fan zone layout for the system. |
| 70 | * This is generated data. |
| 71 | */ |
| 72 | static const std::vector<ZoneGroup> _zoneLayouts; |
Matthew Barth | 93af419 | 2019-01-18 09:30:57 -0600 | [diff] [blame] | 73 | |
Matthew Barth | 3e1bb27 | 2020-05-26 11:09:21 -0500 | [diff] [blame] | 74 | /** |
| 75 | * The number of seconds to delay after |
| 76 | * fans get set to high speed on a power on |
| 77 | * to give them a chance to get there. |
| 78 | */ |
| 79 | static const unsigned int _powerOnDelay; |
Matt Spinler | e10416e | 2017-04-10 14:15:53 -0500 | [diff] [blame] | 80 | }; |
| 81 | |
Matthew Barth | 3e1bb27 | 2020-05-26 11:09:21 -0500 | [diff] [blame] | 82 | } // namespace control |
| 83 | } // namespace fan |
| 84 | } // namespace phosphor |