aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorTitus Rwantare <titusr@google.com>2022-03-07 12:06:05 -0800
committerPhilippe Mathieu-Daudé <f4bug@amsat.org>2022-03-08 18:46:48 +0100
commit5f14cd7032beab6cac8d7ed1b09efc58baddb48c (patch)
treedf6ac9d4eb62125f8fa88bf6000eb793d0e528fa /hw
parent1c0c52f76208c648a70b115fc99ab558008466da (diff)
downloadqemu-5f14cd7032beab6cac8d7ed1b09efc58baddb48c.zip
qemu-5f14cd7032beab6cac8d7ed1b09efc58baddb48c.tar.gz
qemu-5f14cd7032beab6cac8d7ed1b09efc58baddb48c.tar.bz2
hw/sensor: add Renesas raa228000 device
Signed-off-by: Titus Rwantare <titusr@google.com> Reviewed-by: Hao Wu <wuhaotsh@google.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Acked-by: Corey Minyard <cminyard@mvista.com> Message-Id: <20220307200605.4001451-10-titusr@google.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/sensor/isl_pmbus_vr.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/hw/sensor/isl_pmbus_vr.c b/hw/sensor/isl_pmbus_vr.c
index 53187d6..e11e028 100644
--- a/hw/sensor/isl_pmbus_vr.c
+++ b/hw/sensor/isl_pmbus_vr.c
@@ -89,6 +89,24 @@ static void isl_pmbus_vr_exit_reset(Object *obj)
}
}
+/* 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);
@@ -177,6 +195,20 @@ static void raa22xx_init(Object *obj)
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)
{
@@ -195,6 +227,15 @@ static void isl69260_class_init(ObjectClass *klass, void *data)
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);
@@ -220,9 +261,18 @@ static const TypeInfo raa229004_info = {
.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);
}