[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-arm] [PATCH 6/6] aspeed: add a temp sensor device on I2C bus 3
From: |
Cédric Le Goater |
Subject: |
[Qemu-arm] [PATCH 6/6] aspeed: add a temp sensor device on I2C bus 3 |
Date: |
Mon, 15 May 2017 07:51:16 +0200 |
Temperatures can be changed from the monitor with :
(qemu) qom-set /machine/unattached/device[2] temperature0 12000
Signed-off-by: Cédric Le Goater <address@hidden>
---
hw/arm/aspeed.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index e824ea87a9af..155eeb242b8a 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -239,10 +239,19 @@ static void aspeed_board_init(MachineState *machine,
static void palmetto_bmc_i2c_init(AspeedBoardState *bmc)
{
AspeedSoCState *soc = &bmc->soc;
+ DeviceState *dev;
/* The palmetto platform expects a ds3231 RTC but a ds1338 is
* enough to provide basic RTC features. Alarms will be missing */
i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 0), "ds1338", 0x68);
+
+ /* add a TMP423 temperature sensor */
+ dev = i2c_create_slave(aspeed_i2c_get_bus(DEVICE(&soc->i2c), 2),
+ "tmp423", 0x4c);
+ object_property_set_int(OBJECT(dev), 31000, "temperature0", &error_abort);
+ object_property_set_int(OBJECT(dev), 28000, "temperature1", &error_abort);
+ object_property_set_int(OBJECT(dev), 20000, "temperature2", &error_abort);
+ object_property_set_int(OBJECT(dev), 110000, "temperature3", &error_abort);
}
static void palmetto_bmc_init(MachineState *machine)
--
2.7.4
- [Qemu-arm] [PATCH 0/6] aspeed: I2C controller fixes, Cédric Le Goater, 2017/05/15
- [Qemu-arm] [PATCH 2/6] aspeed/i2c: handle LAST command under the RX command, Cédric Le Goater, 2017/05/15
- [Qemu-arm] [PATCH 1/6] aspeed/i2c: improve command handling, Cédric Le Goater, 2017/05/15
- [Qemu-arm] [PATCH 3/6] aspeed/i2c: introduce a state machine, Cédric Le Goater, 2017/05/15
- [Qemu-arm] [PATCH 4/6] aspeed: add some I2C devices to the Aspeed machines, Cédric Le Goater, 2017/05/15
- [Qemu-arm] [PATCH 5/6] hw/misc: add a TMP42{1,2,3} device model, Cédric Le Goater, 2017/05/15
- [Qemu-arm] [PATCH 6/6] aspeed: add a temp sensor device on I2C bus 3,
Cédric Le Goater <=