xref: /openbmc/phosphor-bmc-code-mgmt/i2c-vr/i2cvr_device.hpp (revision ee55117464c86f0fe4483cd86f82da0501e896e1)
17e446a40SChristopher Meis #pragma once
27e446a40SChristopher Meis 
37e446a40SChristopher Meis #include "common/include/device.hpp"
47e446a40SChristopher Meis #include "common/include/software_config.hpp"
57e446a40SChristopher Meis #include "common/include/software_manager.hpp"
67e446a40SChristopher Meis #include "vr.hpp"
77e446a40SChristopher Meis 
87e446a40SChristopher Meis namespace SoftwareInf = phosphor::software;
97e446a40SChristopher Meis namespace ManagerInf = SoftwareInf::manager;
107e446a40SChristopher Meis namespace DeviceInf = SoftwareInf::device;
117e446a40SChristopher Meis namespace ConfigInf = SoftwareInf::config;
127e446a40SChristopher Meis 
137e446a40SChristopher Meis namespace VRInf = SoftwareInf::VR;
147e446a40SChristopher Meis 
157e446a40SChristopher Meis namespace SDBusPlusSoftware = sdbusplus::common::xyz::openbmc_project::software;
167e446a40SChristopher Meis 
177e446a40SChristopher Meis namespace phosphor::software::i2c_vr::device
187e446a40SChristopher Meis {
197e446a40SChristopher Meis 
207e446a40SChristopher Meis class I2CVRDevice : public DeviceInf::Device
217e446a40SChristopher Meis {
227e446a40SChristopher Meis   public:
237e446a40SChristopher Meis     using DeviceInf::Device::softwareCurrent;
I2CVRDevice(sdbusplus::async::context & ctx,enum VRInf::VRType vrType,const uint16_t & bus,const uint8_t & address,ConfigInf::SoftwareConfig & config,ManagerInf::SoftwareManager * parent)247e446a40SChristopher Meis     I2CVRDevice(sdbusplus::async::context& ctx, enum VRInf::VRType vrType,
257e446a40SChristopher Meis                 const uint16_t& bus, const uint8_t& address,
267e446a40SChristopher Meis                 ConfigInf::SoftwareConfig& config,
277e446a40SChristopher Meis                 ManagerInf::SoftwareManager* parent) :
287e446a40SChristopher Meis         DeviceInf::Device(
297e446a40SChristopher Meis             ctx, config, parent,
30*ee551174SKevin Tung             {SDBusPlusSoftware::ApplyTime::RequestedApplyTimes::OnReset}),
317e446a40SChristopher Meis         vrInterface(VRInf::create(ctx, vrType, bus, address))
327e446a40SChristopher Meis     {}
337e446a40SChristopher Meis 
347e446a40SChristopher Meis     std::unique_ptr<VRInf::VoltageRegulator> vrInterface;
357e446a40SChristopher Meis 
367e446a40SChristopher Meis     sdbusplus::async::task<bool> updateDevice(const uint8_t* image,
377e446a40SChristopher Meis                                               size_t image_size) final;
387e446a40SChristopher Meis 
397e446a40SChristopher Meis     sdbusplus::async::task<bool> getVersion(uint32_t* sum) const;
407e446a40SChristopher Meis };
417e446a40SChristopher Meis 
427e446a40SChristopher Meis } // namespace phosphor::software::i2c_vr::device
43