> On Jun 29, 2022, at 1:40 AM, Cédric Le Goater <c...@kaod.org> wrote: > > On 6/29/22 05:36, Peter Delevoryas wrote: >> Signed-off-by: Peter Delevoryas <p...@fb.com> > > This is also adding a "Renesas ISL69259 Digital Multiphase Voltage > Regulator" device. There should be 2 patches.
Hmmmm yes definitely, I’ll fix this. One patch to add IC_DEVICE_ID to pmbus, one to add ISL69259 to isl_pmbus_vr.c > > Thanks, > > C. > > > >> --- >> hw/i2c/pmbus_device.c | 5 +++++ >> hw/sensor/isl_pmbus_vr.c | 31 +++++++++++++++++++++++++++++++ >> include/hw/i2c/pmbus_device.h | 1 + >> include/hw/sensor/isl_pmbus_vr.h | 1 + >> 4 files changed, 38 insertions(+) >> diff --git a/hw/i2c/pmbus_device.c b/hw/i2c/pmbus_device.c >> index efddc36fd9..82131fff85 100644 >> --- a/hw/i2c/pmbus_device.c >> +++ b/hw/i2c/pmbus_device.c >> @@ -984,6 +984,11 @@ static uint8_t pmbus_receive_byte(SMBusDevice *smd) >> } >> break; >> + case PMBUS_IC_DEVICE_ID: >> + pmbus_send(pmdev, pmdev->pages[index].ic_device_id, >> + sizeof(pmdev->pages[index].ic_device_id)); >> + break; >> + >> case PMBUS_CLEAR_FAULTS: /* Send Byte */ >> case PMBUS_PAGE_PLUS_WRITE: /* Block Write-only */ >> case PMBUS_STORE_DEFAULT_ALL: /* Send Byte */ >> diff --git a/hw/sensor/isl_pmbus_vr.c b/hw/sensor/isl_pmbus_vr.c >> index e11e028884..b12c46ab6d 100644 >> --- a/hw/sensor/isl_pmbus_vr.c >> +++ b/hw/sensor/isl_pmbus_vr.c >> @@ -218,6 +218,28 @@ static void isl_pmbus_vr_class_init(ObjectClass *klass, >> void *data, >> k->device_num_pages = pages; >> } >> +static void isl69259_init(Object *obj) >> +{ >> + static const uint8_t ic_device_id[] = {0x04, 0x00, 0x81, 0xD2, 0x49}; >> + PMBusDevice *pmdev = PMBUS_DEVICE(obj); >> + int i; >> + >> + raa22xx_init(obj); >> + for (i = 0; i < pmdev->num_pages; i++) { >> + memcpy(pmdev->pages[i].ic_device_id, ic_device_id, >> + sizeof(ic_device_id)); >> + } >> +} >> + >> +static void isl69259_class_init(ObjectClass *klass, void *data) >> +{ >> + ResettableClass *rc = RESETTABLE_CLASS(klass); >> + DeviceClass *dc = DEVICE_CLASS(klass); >> + dc->desc = "Renesas ISL69259 Digital Multiphase Voltage Regulator"; >> + rc->phases.exit = isl_pmbus_vr_exit_reset; >> + isl_pmbus_vr_class_init(klass, data, 2); >> +} >> + >> static void isl69260_class_init(ObjectClass *klass, void *data) >> { >> ResettableClass *rc = RESETTABLE_CLASS(klass); >> @@ -245,6 +267,14 @@ static void raa229004_class_init(ObjectClass *klass, >> void *data) >> isl_pmbus_vr_class_init(klass, data, 2); >> } >> +static const TypeInfo isl69259_info = { >> + .name = TYPE_ISL69259, >> + .parent = TYPE_PMBUS_DEVICE, >> + .instance_size = sizeof(ISLState), >> + .instance_init = isl69259_init, >> + .class_init = isl69259_class_init, >> +}; >> + >> static const TypeInfo isl69260_info = { >> .name = TYPE_ISL69260, >> .parent = TYPE_PMBUS_DEVICE, >> @@ -271,6 +301,7 @@ static const TypeInfo raa228000_info = { >> static void isl_pmbus_vr_register_types(void) >> { >> + type_register_static(&isl69259_info); >> type_register_static(&isl69260_info); >> type_register_static(&raa228000_info); >> type_register_static(&raa229004_info); >> diff --git a/include/hw/i2c/pmbus_device.h b/include/hw/i2c/pmbus_device.h >> index 0f4d6b3fad..aed7809841 100644 >> --- a/include/hw/i2c/pmbus_device.h >> +++ b/include/hw/i2c/pmbus_device.h >> @@ -407,6 +407,7 @@ typedef struct PMBusPage { >> uint16_t mfr_max_temp_1; /* R/W word */ >> uint16_t mfr_max_temp_2; /* R/W word */ >> uint16_t mfr_max_temp_3; /* R/W word */ >> + uint8_t ic_device_id[16]; /* Read-Only block-read */ >> } PMBusPage; >> /* State */ >> diff --git a/include/hw/sensor/isl_pmbus_vr.h >> b/include/hw/sensor/isl_pmbus_vr.h >> index 3e47ff7e48..d501b3bc82 100644 >> --- a/include/hw/sensor/isl_pmbus_vr.h >> +++ b/include/hw/sensor/isl_pmbus_vr.h >> @@ -12,6 +12,7 @@ >> #include "hw/i2c/pmbus_device.h" >> #include "qom/object.h" >> +#define TYPE_ISL69259 "isl69259" >> #define TYPE_ISL69260 "isl69260" >> #define TYPE_RAA228000 "raa228000" >> #define TYPE_RAA229004 "raa229004" >