blob: 198d1c63e1008b1e448fb19ee574a2aba2d57775 [file] [log] [blame]
Christopher Meis7e446a42024-10-22 09:36:41 +02001#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
8namespace SoftwareInf = phosphor::software;
9namespace ManagerInf = SoftwareInf::manager;
10namespace DeviceInf = SoftwareInf::device;
11namespace ConfigInf = SoftwareInf::config;
12
13namespace VRInf = SoftwareInf::VR;
14
15namespace SDBusPlusSoftware = sdbusplus::common::xyz::openbmc_project::software;
16
17namespace phosphor::software::i2c_vr::device
18{
19
20class 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