aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2022-03-09 21:16:27 +0000
committerPeter Maydell <peter.maydell@linaro.org>2022-03-09 21:16:27 +0000
commit2048c4eba2b40c850e58616c7033f88a2607b89d (patch)
tree3c0378ecf720b9874a26856a5e09eb3b2fa2b305 /hw
parentd9ccf33f9479201e5add8db0af68ca9ca8da358b (diff)
parent5f14cd7032beab6cac8d7ed1b09efc58baddb48c (diff)
Merge remote-tracking branch 'remotes/philmd/tags/pmbus-20220308' into staging
I²C / SMBus / PMBus patches - Add some Renesas models - Add Titus Rwantare to MAINTAINERS # gpg: Signature made Tue 08 Mar 2022 18:11:46 GMT # gpg: using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE # gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: FAAB E75E 1291 7221 DCFD 6BB2 E3E3 2C2C DEAD C0DE * remotes/philmd/tags/pmbus-20220308: hw/sensor: add Renesas raa228000 device hw/sensor: add Renesas raa229004 PMBus device hw/sensor: add Intersil ISL69260 device model hw/i2c: Added linear mode translation for pmbus devices hw/i2c: pmbus: update MAINTAINERS hw/i2c: pmbus: refactor uint handling hw/i2c: pmbus: add PEC unsupported warning hw/i2c: pmbus: fix error returns and guard against out of range accesses hw/i2c: pmbus: add registers Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/arm/Kconfig1
-rw-r--r--hw/i2c/pmbus_device.c112
-rw-r--r--hw/sensor/Kconfig4
-rw-r--r--hw/sensor/isl_pmbus_vr.c279
-rw-r--r--hw/sensor/meson.build1
5 files changed, 384 insertions, 13 deletions
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
index 6945330030..97f3b38019 100644
--- a/hw/arm/Kconfig
+++ b/hw/arm/Kconfig
@@ -400,6 +400,7 @@ config NPCM7XX
select SMBUS
select AT24C # EEPROM
select MAX34451
+ select ISL_PMBUS_VR
select PL310 # cache controller
select PMBUS
select SERIAL
diff --git a/hw/i2c/pmbus_device.c b/hw/i2c/pmbus_device.c
index 24f8f522d9..62885fa6a1 100644
--- a/hw/i2c/pmbus_device.c
+++ b/hw/i2c/pmbus_device.c
@@ -28,6 +28,24 @@ uint32_t pmbus_direct_mode2data(PMBusCoefficients c, uint16_t value)
return x;
}
+uint16_t pmbus_data2linear_mode(uint16_t value, int exp)
+{
+ /* L = D * 2^(-e) */
+ if (exp < 0) {
+ return value << (-exp);
+ }
+ return value >> exp;
+}
+
+uint16_t pmbus_linear_mode2data(uint16_t value, int exp)
+{
+ /* D = L * 2^e */
+ if (exp < 0) {
+ return value >> (-exp);
+ }
+ return value << exp;
+}
+
void pmbus_send(PMBusDevice *pmdev, const uint8_t *data, uint16_t len)
{
if (pmdev->out_buf_len + len > SMBUS_DATA_MAX_LEN) {
@@ -89,16 +107,16 @@ void pmbus_send_string(PMBusDevice *pmdev, const char *data)
}
-static uint64_t pmbus_receive_uint(const uint8_t *buf, uint8_t len)
+static uint64_t pmbus_receive_uint(PMBusDevice *pmdev)
{
uint64_t ret = 0;
/* Exclude command code from return value */
- buf++;
- len--;
+ pmdev->in_buf++;
+ pmdev->in_buf_len--;
- for (int i = len - 1; i >= 0; i--) {
- ret = ret << 8 | buf[i];
+ for (int i = pmdev->in_buf_len - 1; i >= 0; i--) {
+ ret = ret << 8 | pmdev->in_buf[i];
}
return ret;
}
@@ -110,7 +128,7 @@ uint8_t pmbus_receive8(PMBusDevice *pmdev)
"%s: length mismatch. Expected 1 byte, got %d bytes\n",
__func__, pmdev->in_buf_len - 1);
}
- return pmbus_receive_uint(pmdev->in_buf, pmdev->in_buf_len);
+ return pmbus_receive_uint(pmdev);
}
uint16_t pmbus_receive16(PMBusDevice *pmdev)
@@ -120,7 +138,7 @@ uint16_t pmbus_receive16(PMBusDevice *pmdev)
"%s: length mismatch. Expected 2 bytes, got %d bytes\n",
__func__, pmdev->in_buf_len - 1);
}
- return pmbus_receive_uint(pmdev->in_buf, pmdev->in_buf_len);
+ return pmbus_receive_uint(pmdev);
}
uint32_t pmbus_receive32(PMBusDevice *pmdev)
@@ -130,7 +148,7 @@ uint32_t pmbus_receive32(PMBusDevice *pmdev)
"%s: length mismatch. Expected 4 bytes, got %d bytes\n",
__func__, pmdev->in_buf_len - 1);
}
- return pmbus_receive_uint(pmdev->in_buf, pmdev->in_buf_len);
+ return pmbus_receive_uint(pmdev);
}
uint64_t pmbus_receive64(PMBusDevice *pmdev)
@@ -140,7 +158,7 @@ uint64_t pmbus_receive64(PMBusDevice *pmdev)
"%s: length mismatch. Expected 8 bytes, got %d bytes\n",
__func__, pmdev->in_buf_len - 1);
}
- return pmbus_receive_uint(pmdev->in_buf, pmdev->in_buf_len);
+ return pmbus_receive_uint(pmdev);
}
static uint8_t pmbus_out_buf_pop(PMBusDevice *pmdev)
@@ -149,7 +167,7 @@ static uint8_t pmbus_out_buf_pop(PMBusDevice *pmdev)
qemu_log_mask(LOG_GUEST_ERROR,
"%s: tried to read from empty buffer",
__func__);
- return 0xFF;
+ return PMBUS_ERR_BYTE;
}
uint8_t data = pmdev->out_buf[pmdev->out_buf_len - 1];
pmdev->out_buf_len--;
@@ -243,18 +261,47 @@ void pmbus_check_limits(PMBusDevice *pmdev)
}
}
+/* assert the status_cml error upon receipt of malformed command */
+static void pmbus_cml_error(PMBusDevice *pmdev)
+{
+ for (int i = 0; i < pmdev->num_pages; i++) {
+ pmdev->pages[i].status_word |= PMBUS_STATUS_CML;
+ pmdev->pages[i].status_cml |= PB_CML_FAULT_INVALID_CMD;
+ }
+}
+
static uint8_t pmbus_receive_byte(SMBusDevice *smd)
{
PMBusDevice *pmdev = PMBUS_DEVICE(smd);
PMBusDeviceClass *pmdc = PMBUS_DEVICE_GET_CLASS(pmdev);
- uint8_t ret = 0xFF;
- uint8_t index = pmdev->page;
+ uint8_t ret = PMBUS_ERR_BYTE;
+ uint8_t index;
if (pmdev->out_buf_len != 0) {
ret = pmbus_out_buf_pop(pmdev);
return ret;
}
+ /*
+ * Reading from all pages will return the value from page 0,
+ * this is unspecified behaviour in general.
+ */
+ if (pmdev->page == PB_ALL_PAGES) {
+ index = 0;
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "%s: tried to read from all pages\n",
+ __func__);
+ pmbus_cml_error(pmdev);
+ } else if (pmdev->page > pmdev->num_pages - 1) {
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "%s: page %d is out of range\n",
+ __func__, pmdev->page);
+ pmbus_cml_error(pmdev);
+ return PMBUS_ERR_BYTE;
+ } else {
+ index = pmdev->page;
+ }
+
switch (pmdev->code) {
case PMBUS_PAGE:
pmbus_send8(pmdev, pmdev->page);
@@ -278,6 +325,11 @@ static uint8_t pmbus_receive_byte(SMBusDevice *smd)
case PMBUS_CAPABILITY:
pmbus_send8(pmdev, pmdev->capability);
+ if (pmdev->capability & BIT(7)) {
+ qemu_log_mask(LOG_UNIMP,
+ "%s: PEC is enabled but not yet supported.\n",
+ __func__);
+ }
break;
case PMBUS_VOUT_MODE: /* R/W byte */
@@ -368,6 +420,14 @@ static uint8_t pmbus_receive_byte(SMBusDevice *smd)
}
break;
+ case PMBUS_VOUT_MIN: /* R/W word */
+ if (pmdev->pages[index].page_flags & PB_HAS_VOUT_RATING) {
+ pmbus_send16(pmdev, pmdev->pages[index].vout_min);
+ } else {
+ goto passthough;
+ }
+ break;
+
/* TODO: implement coefficients support */
case PMBUS_POUT_MAX: /* R/W word */
@@ -708,6 +768,10 @@ static uint8_t pmbus_receive_byte(SMBusDevice *smd)
pmbus_send8(pmdev, pmdev->pages[index].status_other);
break;
+ case PMBUS_STATUS_MFR_SPECIFIC: /* R/W byte */
+ pmbus_send8(pmdev, pmdev->pages[index].status_mfr_specific);
+ break;
+
case PMBUS_READ_EIN: /* Read-Only block 5 bytes */
if (pmdev->pages[index].page_flags & PB_HAS_EIN) {
pmbus_send(pmdev, pmdev->pages[index].read_ein, 5);
@@ -1007,7 +1071,7 @@ static int pmbus_write_data(SMBusDevice *smd, uint8_t *buf, uint8_t len)
if (len == 0) {
qemu_log_mask(LOG_GUEST_ERROR, "%s: writing empty data\n", __func__);
- return -1;
+ return PMBUS_ERR_BYTE;
}
if (!pmdev->pages) { /* allocate memory for pages on first use */
@@ -1026,6 +1090,7 @@ static int pmbus_write_data(SMBusDevice *smd, uint8_t *buf, uint8_t len)
pmdev->page = pmbus_receive8(pmdev);
return 0;
}
+
/* loop through all the pages when 0xFF is received */
if (pmdev->page == PB_ALL_PAGES) {
for (int i = 0; i < pmdev->num_pages; i++) {
@@ -1036,6 +1101,15 @@ static int pmbus_write_data(SMBusDevice *smd, uint8_t *buf, uint8_t len)
return 0;
}
+ if (pmdev->page > pmdev->num_pages - 1) {
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "%s: page %u is out of range\n",
+ __func__, pmdev->page);
+ pmdev->page = 0; /* undefined behaviour - reset to page 0 */
+ pmbus_cml_error(pmdev);
+ return PMBUS_ERR_BYTE;
+ }
+
index = pmdev->page;
switch (pmdev->code) {
@@ -1149,6 +1223,14 @@ static int pmbus_write_data(SMBusDevice *smd, uint8_t *buf, uint8_t len)
}
break;
+ case PMBUS_VOUT_MIN: /* R/W word */
+ if (pmdev->pages[index].page_flags & PB_HAS_VOUT_RATING) {
+ pmdev->pages[index].vout_min = pmbus_receive16(pmdev);
+ } else {
+ goto passthrough;
+ }
+ break;
+
case PMBUS_POUT_MAX: /* R/W word */
if (pmdev->pages[index].page_flags & PB_HAS_VOUT) {
pmdev->pages[index].pout_max = pmbus_receive16(pmdev);
@@ -1482,6 +1564,10 @@ static int pmbus_write_data(SMBusDevice *smd, uint8_t *buf, uint8_t len)
pmdev->pages[index].status_other = pmbus_receive8(pmdev);
break;
+ case PMBUS_STATUS_MFR_SPECIFIC: /* R/W byte */
+ pmdev->pages[index].status_mfr_specific = pmbus_receive8(pmdev);
+ break;
+
case PMBUS_PAGE_PLUS_READ: /* Block Read-only */
case PMBUS_CAPABILITY: /* Read-Only byte */
case PMBUS_COEFFICIENTS: /* Read-only block 5 bytes */
diff --git a/hw/sensor/Kconfig b/hw/sensor/Kconfig
index 215944decc..df392e7869 100644
--- a/hw/sensor/Kconfig
+++ b/hw/sensor/Kconfig
@@ -30,3 +30,7 @@ config LSM303DLHC_MAG
bool
depends on I2C
default y if I2C_DEVICES
+
+config ISL_PMBUS_VR
+ bool
+ depends on PMBUS
diff --git a/hw/sensor/isl_pmbus_vr.c b/hw/sensor/isl_pmbus_vr.c
new file mode 100644
index 0000000000..e11e028884
--- /dev/null
+++ b/hw/sensor/isl_pmbus_vr.c
@@ -0,0 +1,279 @@
+/*
+ * PMBus device for Renesas Digital Multiphase Voltage Regulators
+ *
+ * Copyright 2021 Google LLC
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "hw/sensor/isl_pmbus_vr.h"
+#include "hw/qdev-properties.h"
+#include "qapi/visitor.h"
+#include "qemu/log.h"
+#include "qemu/module.h"
+
+static uint8_t isl_pmbus_vr_read_byte(PMBusDevice *pmdev)
+{
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "%s: reading from unsupported register: 0x%02x\n",
+ __func__, pmdev->code);
+ return PMBUS_ERR_BYTE;
+}
+
+static int isl_pmbus_vr_write_data(PMBusDevice *pmdev, const uint8_t *buf,
+ uint8_t len)
+{
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "%s: write to unsupported register: 0x%02x\n",
+ __func__, pmdev->code);
+ return PMBUS_ERR_BYTE;
+}
+
+/* TODO: Implement coefficients support in pmbus_device.c for qmp */
+static void isl_pmbus_vr_get(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
+{
+ visit_type_uint16(v, name, (uint16_t *)opaque, errp);
+}
+
+static void isl_pmbus_vr_set(Object *obj, Visitor *v, const char *name,
+ void *opaque, Error **errp)
+{
+ PMBusDevice *pmdev = PMBUS_DEVICE(obj);
+ uint16_t *internal = opaque;
+ uint16_t value;
+ if (!visit_type_uint16(v, name, &value, errp)) {
+ return;
+ }
+
+ *internal = value;
+ pmbus_check_limits(pmdev);
+}
+
+static void isl_pmbus_vr_exit_reset(Object *obj)
+{
+ PMBusDevice *pmdev = PMBUS_DEVICE(obj);
+
+ pmdev->page = 0;
+ pmdev->capability = ISL_CAPABILITY_DEFAULT;
+ for (int i = 0; i < pmdev->num_pages; i++) {
+ pmdev->pages[i].operation = ISL_OPERATION_DEFAULT;
+ pmdev->pages[i].on_off_config = ISL_ON_OFF_CONFIG_DEFAULT;
+ pmdev->pages[i].vout_mode = ISL_VOUT_MODE_DEFAULT;
+ pmdev->pages[i].vout_command = ISL_VOUT_COMMAND_DEFAULT;
+ pmdev->pages[i].vout_max = ISL_VOUT_MAX_DEFAULT;
+ pmdev->pages[i].vout_margin_high = ISL_VOUT_MARGIN_HIGH_DEFAULT;
+ pmdev->pages[i].vout_margin_low = ISL_VOUT_MARGIN_LOW_DEFAULT;
+ pmdev->pages[i].vout_transition_rate = ISL_VOUT_TRANSITION_RATE_DEFAULT;
+ pmdev->pages[i].vout_ov_fault_limit = ISL_VOUT_OV_FAULT_LIMIT_DEFAULT;
+ pmdev->pages[i].ot_fault_limit = ISL_OT_FAULT_LIMIT_DEFAULT;
+ pmdev->pages[i].ot_warn_limit = ISL_OT_WARN_LIMIT_DEFAULT;
+ pmdev->pages[i].vin_ov_warn_limit = ISL_VIN_OV_WARN_LIMIT_DEFAULT;
+ pmdev->pages[i].vin_uv_warn_limit = ISL_VIN_UV_WARN_LIMIT_DEFAULT;
+ pmdev->pages[i].iin_oc_fault_limit = ISL_IIN_OC_FAULT_LIMIT_DEFAULT;
+ pmdev->pages[i].ton_delay = ISL_TON_DELAY_DEFAULT;
+ pmdev->pages[i].ton_rise = ISL_TON_RISE_DEFAULT;
+ pmdev->pages[i].toff_fall = ISL_TOFF_FALL_DEFAULT;
+ pmdev->pages[i].revision = ISL_REVISION_DEFAULT;
+
+ pmdev->pages[i].read_vout = ISL_READ_VOUT_DEFAULT;
+ pmdev->pages[i].read_iout = ISL_READ_IOUT_DEFAULT;
+ pmdev->pages[i].read_pout = ISL_READ_POUT_DEFAULT;
+ pmdev->pages[i].read_vin = ISL_READ_VIN_DEFAULT;
+ pmdev->pages[i].read_iin = ISL_READ_IIN_DEFAULT;
+ pmdev->pages[i].read_pin = ISL_READ_PIN_DEFAULT;
+ pmdev->pages[i].read_temperature_1 = ISL_READ_TEMP_DEFAULT;
+ pmdev->pages[i].read_temperature_2 = ISL_READ_TEMP_DEFAULT;
+ pmdev->pages[i].read_temperature_3 = ISL_READ_TEMP_DEFAULT;
+ }
+}
+
+/* The raa228000 uses different direct mode coefficents from most isl devices */
+static void raa228000_exit_reset(Object *obj)
+{
+ PMBusDevice *pmdev = PMBUS_DEVICE(obj);
+
+ isl_pmbus_vr_exit_reset(obj);
+
+ pmdev->pages[0].read_iout = 0;
+ pmdev->pages[0].read_pout = 0;
+ pmdev->pages[0].read_vout = 0;
+ pmdev->pages[0].read_vin = 0;
+ pmdev->pages[0].read_iin = 0;
+ pmdev->pages[0].read_pin = 0;
+ pmdev->pages[0].read_temperature_1 = 0;
+ pmdev->pages[0].read_temperature_2 = 0;
+ pmdev->pages[0].read_temperature_3 = 0;
+}
+
+static void isl_pmbus_vr_add_props(Object *obj, uint64_t *flags, uint8_t pages)
+{
+ PMBusDevice *pmdev = PMBUS_DEVICE(obj);
+ for (int i = 0; i < pages; i++) {
+ if (flags[i] & PB_HAS_VIN) {
+ object_property_add(obj, "vin[*]", "uint16",
+ isl_pmbus_vr_get,
+ isl_pmbus_vr_set,
+ NULL, &pmdev->pages[i].read_vin);
+ }
+
+ if (flags[i] & PB_HAS_VOUT) {
+ object_property_add(obj, "vout[*]", "uint16",
+ isl_pmbus_vr_get,
+ isl_pmbus_vr_set,
+ NULL, &pmdev->pages[i].read_vout);
+ }
+
+ if (flags[i] & PB_HAS_IIN) {
+ object_property_add(obj, "iin[*]", "uint16",
+ isl_pmbus_vr_get,
+ isl_pmbus_vr_set,
+ NULL, &pmdev->pages[i].read_iin);
+ }
+
+ if (flags[i] & PB_HAS_IOUT) {
+ object_property_add(obj, "iout[*]", "uint16",
+ isl_pmbus_vr_get,
+ isl_pmbus_vr_set,
+ NULL, &pmdev->pages[i].read_iout);
+ }
+
+ if (flags[i] & PB_HAS_PIN) {
+ object_property_add(obj, "pin[*]", "uint16",
+ isl_pmbus_vr_get,
+ isl_pmbus_vr_set,
+ NULL, &pmdev->pages[i].read_pin);
+ }
+
+ if (flags[i] & PB_HAS_POUT) {
+ object_property_add(obj, "pout[*]", "uint16",
+ isl_pmbus_vr_get,
+ isl_pmbus_vr_set,
+ NULL, &pmdev->pages[i].read_pout);
+ }
+
+ if (flags[i] & PB_HAS_TEMPERATURE) {
+ object_property_add(obj, "temp1[*]", "uint16",
+ isl_pmbus_vr_get,
+ isl_pmbus_vr_set,
+ NULL, &pmdev->pages[i].read_temperature_1);
+ }
+
+ if (flags[i] & PB_HAS_TEMP2) {
+ object_property_add(obj, "temp2[*]", "uint16",
+ isl_pmbus_vr_get,
+ isl_pmbus_vr_set,
+ NULL, &pmdev->pages[i].read_temperature_2);
+ }
+
+ if (flags[i] & PB_HAS_TEMP3) {
+ object_property_add(obj, "temp3[*]", "uint16",
+ isl_pmbus_vr_get,
+ isl_pmbus_vr_set,
+ NULL, &pmdev->pages[i].read_temperature_3);
+ }
+ }
+}
+
+static void raa22xx_init(Object *obj)
+{
+ PMBusDevice *pmdev = PMBUS_DEVICE(obj);
+ uint64_t flags[2];
+
+ flags[0] = PB_HAS_VIN | PB_HAS_VOUT | PB_HAS_VOUT_MODE |
+ PB_HAS_VOUT_RATING | PB_HAS_VOUT_MARGIN | PB_HAS_IIN |
+ PB_HAS_IOUT | PB_HAS_PIN | PB_HAS_POUT | PB_HAS_TEMPERATURE |
+ PB_HAS_TEMP2 | PB_HAS_TEMP3 | PB_HAS_STATUS_MFR_SPECIFIC;
+ flags[1] = PB_HAS_IIN | PB_HAS_PIN | PB_HAS_TEMPERATURE | PB_HAS_TEMP3 |
+ PB_HAS_VOUT | PB_HAS_VOUT_MODE | PB_HAS_VOUT_MARGIN |
+ PB_HAS_VOUT_RATING | PB_HAS_IOUT | PB_HAS_POUT |
+ PB_HAS_STATUS_MFR_SPECIFIC;
+
+ pmbus_page_config(pmdev, 0, flags[0]);
+ pmbus_page_config(pmdev, 1, flags[1]);
+ isl_pmbus_vr_add_props(obj, flags, ARRAY_SIZE(flags));
+}
+
+static void raa228000_init(Object *obj)
+{
+ PMBusDevice *pmdev = PMBUS_DEVICE(obj);
+ uint64_t flags[1];
+
+ flags[0] = PB_HAS_VIN | PB_HAS_VOUT | PB_HAS_VOUT_MODE |
+ PB_HAS_VOUT_RATING | PB_HAS_VOUT_MARGIN | PB_HAS_IIN |
+ PB_HAS_IOUT | PB_HAS_PIN | PB_HAS_POUT | PB_HAS_TEMPERATURE |
+ PB_HAS_TEMP2 | PB_HAS_TEMP3 | PB_HAS_STATUS_MFR_SPECIFIC;
+
+ pmbus_page_config(pmdev, 0, flags[0]);
+ isl_pmbus_vr_add_props(obj, flags, 1);
+}
+
+static void isl_pmbus_vr_class_init(ObjectClass *klass, void *data,
+ uint8_t pages)
+{
+ PMBusDeviceClass *k = PMBUS_DEVICE_CLASS(klass);
+ k->write_data = isl_pmbus_vr_write_data;
+ k->receive_byte = isl_pmbus_vr_read_byte;
+ k->device_num_pages = pages;
+}
+
+static void isl69260_class_init(ObjectClass *klass, void *data)
+{
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
+ dc->desc = "Renesas ISL69260 Digital Multiphase Voltage Regulator";
+ rc->phases.exit = isl_pmbus_vr_exit_reset;
+ isl_pmbus_vr_class_init(klass, data, 2);
+}
+
+static void raa228000_class_init(ObjectClass *klass, void *data)
+{
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
+ dc->desc = "Renesas 228000 Digital Multiphase Voltage Regulator";
+ rc->phases.exit = raa228000_exit_reset;
+ isl_pmbus_vr_class_init(klass, data, 1);
+}
+
+static void raa229004_class_init(ObjectClass *klass, void *data)
+{
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
+ dc->desc = "Renesas 229004 Digital Multiphase Voltage Regulator";
+ rc->phases.exit = isl_pmbus_vr_exit_reset;
+ isl_pmbus_vr_class_init(klass, data, 2);
+}
+
+static const TypeInfo isl69260_info = {
+ .name = TYPE_ISL69260,
+ .parent = TYPE_PMBUS_DEVICE,
+ .instance_size = sizeof(ISLState),
+ .instance_init = raa22xx_init,
+ .class_init = isl69260_class_init,
+};
+
+static const TypeInfo raa229004_info = {
+ .name = TYPE_RAA229004,
+ .parent = TYPE_PMBUS_DEVICE,
+ .instance_size = sizeof(ISLState),
+ .instance_init = raa22xx_init,
+ .class_init = raa229004_class_init,
+};
+
+static const TypeInfo raa228000_info = {
+ .name = TYPE_RAA228000,
+ .parent = TYPE_PMBUS_DEVICE,
+ .instance_size = sizeof(ISLState),
+ .instance_init = raa228000_init,
+ .class_init = raa228000_class_init,
+};
+
+static void isl_pmbus_vr_register_types(void)
+{
+ type_register_static(&isl69260_info);
+ type_register_static(&raa228000_info);
+ type_register_static(&raa229004_info);
+}
+
+type_init(isl_pmbus_vr_register_types)
diff --git a/hw/sensor/meson.build b/hw/sensor/meson.build
index d1bba290da..12b6992bc8 100644
--- a/hw/sensor/meson.build
+++ b/hw/sensor/meson.build
@@ -5,3 +5,4 @@ softmmu_ss.add(when: 'CONFIG_EMC141X', if_true: files('emc141x.c'))
softmmu_ss.add(when: 'CONFIG_ADM1272', if_true: files('adm1272.c'))
softmmu_ss.add(when: 'CONFIG_MAX34451', if_true: files('max34451.c'))
softmmu_ss.add(when: 'CONFIG_LSM303DLHC_MAG', if_true: files('lsm303dlhc_mag.c'))
+softmmu_ss.add(when: 'CONFIG_ISL_PMBUS_VR', if_true: files('isl_pmbus_vr.c'))