[PATCH qemu 28/38] aspeed: add a temp sensor device on I2C bus 3

Cédric Le Goater clg at kaod.org
Sat Nov 19 01:22:08 AEDT 2016


Temperatures can be changed from the monitor with :

	(qemu) qom-set /machine/unattached/device[2] temperature0 12000

Signed-off-by: Cédric Le Goater <clg at kaod.org>
---
 hw/arm/aspeed_soc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
index 24354f700115..2aa15d90cc31 100644
--- a/hw/arm/aspeed_soc.c
+++ b/hw/arm/aspeed_soc.c
@@ -268,6 +268,14 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
     sysbus_connect_irq(SYS_BUS_DEVICE(&s->i2c), 0,
                        qdev_get_gpio_in(DEVICE(&s->vic), 12));
 
+    /* add a TMP423 temperature sensor */
+    dev = i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&s->i2c), 2),
+                           "tmp423", 0x4c);
+    object_property_set_int(OBJECT(dev), 31000, "temperature0", &err);
+    object_property_set_int(OBJECT(dev), 28000, "temperature1", &err);
+    object_property_set_int(OBJECT(dev), 20000, "temperature2", &err);
+    object_property_set_int(OBJECT(dev), 110000, "temperature3", &err);
+
     /* FMC */
     fmc_num_cs = aspeed_fmc_get_cs(s, &err);
     if (err) {
-- 
2.7.4



More information about the openbmc mailing list