1 /**
2  * Copyright © 2024 IBM Corporation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #pragma once
17 
18 #include "rail.hpp"
19 #include "services.hpp"
20 #include "ucd90x_device.hpp"
21 
22 #include <cstdint>
23 #include <map>
24 #include <memory>
25 #include <string>
26 #include <utility>
27 #include <vector>
28 
29 namespace phosphor::power::sequencer
30 {
31 
32 /**
33  * @class UCD90160Device
34  *
35  * Class representing the UCD90160 power sequencer device.
36  */
37 class UCD90160Device : public UCD90xDevice
38 {
39   public:
40     // Specify which compiler-generated methods we want
41     UCD90160Device() = delete;
42     UCD90160Device(const UCD90160Device&) = delete;
43     UCD90160Device(UCD90160Device&&) = delete;
44     UCD90160Device& operator=(const UCD90160Device&) = delete;
45     UCD90160Device& operator=(UCD90160Device&&) = delete;
46     virtual ~UCD90160Device() = default;
47 
48     /**
49      * Constructor.
50      *
51      * @param rails Voltage rails that are enabled and monitored by this device
52      * @param services System services like hardware presence and the journal
53      * @param bus I2C bus for the device
54      * @param address I2C address for the device
55      */
56     explicit UCD90160Device(std::vector<std::unique_ptr<Rail>> rails,
57                             Services& services, uint8_t bus, uint16_t address) :
58         UCD90xDevice(deviceName, std::move(rails), services, bus, address)
59     {}
60 
61     constexpr static std::string deviceName{"UCD90160"};
62 
63   protected:
64     /** @copydoc UCD90xDevice::storeGPIOValues() */
65     virtual void storeGPIOValues(
66         Services& services, const std::vector<int>& values,
67         std::map<std::string, std::string>& additionalData) override;
68 };
69 
70 } // namespace phosphor::power::sequencer
71