Skip to contentSkip to conversation

aspeed: add a TMP421 device to the palmetto machine

PATCH Applied Cédric Le Goater 2 participants 4 messages Jun 6, 2017 – Jun 7, 2017 Arm/Aspeed machine support

lore
Share & tools
lore
#0 lore raw

v2 cover aspeed: add a TMP421 device to the palmetto machine

Hello,

This series fixes issues in the TMP421 model previously sent and adds such a device to the palmetto machine.

Thanks,

C.

Cédric Le Goater (2):
hw/misc: add a TMP42{1,2,3} device model
aspeed: add a temp sensor device on I2C bus 3

 default-configs/arm-softmmu.mak |   1 +
 hw/arm/aspeed.c                 |   9 +
 hw/misc/Makefile.objs           |   1 +
 hw/misc/tmp421.c                | 402 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 413 insertions(+)
 create mode 100644 hw/misc/tmp421.c
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/2 hw/misc: add a TMP42{1, 2, 3} device model

Largely inspired by the TMP105 temperature sensor, here is a model for the TMP42{1,2,3} temperature sensors.

Specs can be found here :

	http://www.ti.com/lit/gpn/tmp421

---

Changes since v1:

- made tmp421_info an abstract class.
- added a class size to tmp421_info, which was incorrectly allocated to sizeof(I2CSlaveClass) before
- dropped the class init routine in tmp421_info. It should only be called by the children classes

 default-configs/arm-softmmu.mak |   1 +
 hw/misc/Makefile.objs           |   1 +
 hw/misc/tmp421.c                | 402 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 404 insertions(+)
 create mode 100644 hw/misc/tmp421.c
default-configs/arm-softmmu.mak +1 -0
index 78d7af03a2e8..93e995d31892 100644
@@ -15,6 +15,7 @@ CONFIG_TWL92230=y
 CONFIG_TSC2005=y
 CONFIG_LM832X=y
 CONFIG_TMP105=y
+CONFIG_TMP421=y
 CONFIG_STELLARIS=y
 CONFIG_STELLARIS_INPUT=y
 CONFIG_STELLARIS_ENET=y
hw/misc/Makefile.objs +1 -0
index c8b489390f7e..20198466f070 100644
@@ -1,6 +1,7 @@
 common-obj-$(CONFIG_APPLESMC) += applesmc.o
 common-obj-$(CONFIG_MAX111X) += max111x.o
 common-obj-$(CONFIG_TMP105) += tmp105.o
+common-obj-$(CONFIG_TMP421) += tmp421.o
 common-obj-$(CONFIG_ISA_DEBUG) += debugexit.o
 common-obj-$(CONFIG_SGA) += sga.o
 common-obj-$(CONFIG_ISA_TESTDEV) += pc-testdev.o
hw/misc/tmp421.c new file +402 -0

402 lines not on this page · raw message

Signature · 1 line
2.7.4
#2 lore raw

PATCH v2 2/2 aspeed: add a temp sensor device on I2C bus 3

In reply to Cédric Le Goater

Temperatures can be changed from the monitor with :

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

---
 hw/arm/aspeed.c | 9 +++++++++
 1 file changed, 9 insertions(+)
hw/arm/aspeed.c +9 -0
index e824ea87a9af..155eeb242b8a 100644
@@ -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)
Signature · 1 line
2.7.4
#3 lore raw
In reply to Cédric Le Goater
Quoted 13 lines · Cédric Le Goater

Hello,

This series fixes issues in the TMP421 model previously sent and adds such a device to the palmetto machine.

Thanks,

C.

Cédric Le Goater (2):
hw/misc: add a TMP42{1,2,3} device model
aspeed: add a temp sensor device on I2C bus 3

Quoted 6 lines
 default-configs/arm-softmmu.mak |   1 +
 hw/arm/aspeed.c                 |   9 +
 hw/misc/Makefile.objs           |   1 +
 hw/misc/tmp421.c                | 402 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 413 insertions(+)
 create mode 100644 hw/misc/tmp421.c

Applied to target-arm.next, thanks.

-- PMM