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

Cédric Le Goater clg at kaod.org
Wed Nov 23 03:57:24 AEDT 2016


On 11/18/2016 03:22 PM, Cédric Le Goater wrote:
> Temperatures can be changed from the monitor with :
> 
> 	(qemu) qom-set /machine/unattached/device[2] temperature0 12000


These devices should be defined at the machine level, in palmetto_bmc_init(), 
and not at the SoC level. 

C.

> 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) {
> 



More information about the openbmc mailing list