[PATCH qemu 3/3] ast2400: add a temp sensor device on I2C bus 3

Cédric Le Goater clg at kaod.org
Wed May 18 05:25:02 AEST 2016


The palmetto platform has a tmp421 device. Qemu has not (yet). Let's
use a tmp105 instead.

The aspeed-bmc-opp-palmetto dts file should to be changed consequently
with :

	i2c2: i2c-bus at c0 {
		tmp423 at 4c {
			compatible = "ti,tmp105";
			reg = <0x4c>;
		};
	};

Temperature can be changed from the monitor with :

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

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

diff --git a/hw/arm/ast2400.c b/hw/arm/ast2400.c
index 41bfc74493fa..d231d98a88e1 100644
--- a/hw/arm/ast2400.c
+++ b/hw/arm/ast2400.c
@@ -161,6 +161,9 @@ static void ast2400_realize(DeviceState *dev, Error **errp)
                        qdev_get_gpio_in(DEVICE(&s->vic), 12));
 
     i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&s->i2c), 0), "ds1338", 0x68);
+    dev = i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&s->i2c), 2),
+                           "tmp105", 0x4c);
+    object_property_set_int(OBJECT(dev), 25000, "temperature", &err);
 }
 
 static void ast2400_class_init(ObjectClass *oc, void *data)
-- 
2.1.4



More information about the openbmc mailing list