Christopher Meis | 7e446a4 | 2024-10-22 09:36:41 +0200 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "common/include/device.hpp" |
| 4 | #include "common/include/software_config.hpp" |
| 5 | #include "common/include/software_manager.hpp" |
| 6 | #include "vr.hpp" |
| 7 | |
| 8 | namespace SoftwareInf = phosphor::software; |
| 9 | namespace ManagerInf = SoftwareInf::manager; |
| 10 | namespace DeviceInf = SoftwareInf::device; |
| 11 | namespace ConfigInf = SoftwareInf::config; |
| 12 | |
| 13 | namespace VRInf = SoftwareInf::VR; |
| 14 | |
| 15 | namespace SDBusPlusSoftware = sdbusplus::common::xyz::openbmc_project::software; |
| 16 | |
| 17 | namespace phosphor::software::i2c_vr::device |
| 18 | { |
| 19 | |
| 20 | class I2CVRDevice : public DeviceInf::Device |
| 21 | { |
| 22 | public: |
| 23 | using DeviceInf::Device::softwareCurrent; |
| 24 | I2CVRDevice(sdbusplus::async::context& ctx, enum VRInf::VRType vrType, |
| 25 | const uint16_t& bus, const uint8_t& address, |
| 26 | ConfigInf::SoftwareConfig& config, |
| 27 | ManagerInf::SoftwareManager* parent) : |
| 28 | DeviceInf::Device( |
| 29 | ctx, config, parent, |
| 30 | {SDBusPlusSoftware::ApplyTime::RequestedApplyTimes::Immediate, |
| 31 | SDBusPlusSoftware::ApplyTime::RequestedApplyTimes::OnReset}), |
| 32 | vrInterface(VRInf::create(ctx, vrType, bus, address)) |
| 33 | {} |
| 34 | |
| 35 | std::unique_ptr<VRInf::VoltageRegulator> vrInterface; |
| 36 | |
| 37 | sdbusplus::async::task<bool> updateDevice(const uint8_t* image, |
| 38 | size_t image_size) final; |
| 39 | |
| 40 | sdbusplus::async::task<bool> getVersion(uint32_t* sum) const; |
| 41 | }; |
| 42 | |
| 43 | } // namespace phosphor::software::i2c_vr::device |