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