blob: 8160a1d382080378dacbb5621624228f923e7614 [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,
Kevin Tungee551172025-08-22 16:49:40 +080030 {SDBusPlusSoftware::ApplyTime::RequestedApplyTimes::OnReset}),
Christopher Meis7e446a42024-10-22 09:36:41 +020031 vrInterface(VRInf::create(ctx, vrType, bus, address))
32 {}
33
34 std::unique_ptr<VRInf::VoltageRegulator> vrInterface;
35
36 sdbusplus::async::task<bool> updateDevice(const uint8_t* image,
37 size_t image_size) final;
38
39 sdbusplus::async::task<bool> getVersion(uint32_t* sum) const;
40};
41
42} // namespace phosphor::software::i2c_vr::device