From patchwork Wed Jun 16 07:33:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 461383 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp361944jae; Wed, 16 Jun 2021 00:36:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/Uo84T+wdc34ilK21aqrh7k+/5aegRiNQq7wNOvHKda7DAl/cr6LGiD3FGyAvo6U4JmyR X-Received: by 2002:a25:ab91:: with SMTP id v17mr2591962ybi.512.1623828964903; Wed, 16 Jun 2021 00:36:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623828964; cv=none; d=google.com; s=arc-20160816; b=qYvSAG/ndJ9pwtI3leCZDUQALHYu5puh7JpX3nCkex79fcv7W+RPcwVYMK3ZzHxOm/ 6fVRR8itQZPT+Jky6Ocpq/ZPX97Vbv7cNgrsE81r6D2v3uJ2iHzUicBFcN9VsoG4Jr+I ++L4BcWXsnrlMlamoLhHH0iHrnADw38gG4+ZBSgbBoGo5R2ubBOL1c4+paUTF5GttjCQ dO42C85d85whVGI2CWCHXp2Q9vnrYqi/WySkvqwiSGzwR9FeRBIUNHhR7mYNAe99TDN9 BYTgR6tJ6XfaB7i4wQXmK9Iw4oSPMSD9i998d9fRIKLr6vLVkRSW5CsdHu4Wc0Z+Rdew oB4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=sxnUugt0pnNifM+LZaCU/RKJ5ZxbnvqCEOGFgZqROpY=; b=NceLYLsoFsdCjprL1Uaqqt4sXqs37ZuBQx9afiQQ6xzVowIDarKFKiL1UYsBqQw3pl gU9WeIJlTvOEo6tkbKKOslrLwPjdRhTNUleRiewRe1pv53uBJPeJGfFEFDJhsmgN4fbn P/Ft0sIV+vuTJWQz8eFkE+qjzwnSpwAC1Pxudq2XmuKpAOfBsdaVWpYELYEuzIsAel58 abSWC315a5CmntNLhq2Z9n8bOWcdVXN+7FbxNJen3aN0XiRkPE7LnI6+9fsA//sW0Tf7 6CxTenMbPaZKkmS7/7MWFcF8KWBRMnygLiX6AdOJOqD1xddjgtfIlKnHVeM3MsH3+nMT tKuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=N9DPkkvU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 190si1114644ybd.222.2021.06.16.00.36.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Jun 2021 00:36:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=N9DPkkvU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:51434 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltQ5k-0001sC-9M for patch@linaro.org; Wed, 16 Jun 2021 03:36:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47988) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltQ3x-0001G3-QC; Wed, 16 Jun 2021 03:34:13 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]:38812) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltQ3v-0001Bq-P8; Wed, 16 Jun 2021 03:34:13 -0400 Received: by mail-pg1-x530.google.com with SMTP id t17so1260383pga.5; Wed, 16 Jun 2021 00:34:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sxnUugt0pnNifM+LZaCU/RKJ5ZxbnvqCEOGFgZqROpY=; b=N9DPkkvUmw28SYhxieRYbGPxolxjvDivZ7RLCgk6EgXte55EV2s/kCWgoouEHUItDQ ra+BKl/Xha2VzXJjiZWawy6mvE4kL8+XSlZt2UWG6DWOQJ2Ir+TRqbPjR18TLyYJioIY UEmc95Q+KX1SiinErL6Is0uT5xB+xxWFQhNBcK1VFd+LyPGzazrKSmwHmlbLlVcQbzpI PYr0w1WdwNE9uUNkP6TOegZ4MowiFQwJTJJudlzK50G85B1KusrOwSBp3thcZaaoMIG0 qoHFeY0tpAcbYiv6c2ver/k681i2BXzdiyVx1etFzjcBWhAPImeIeic1+IZQ5Q3OMgER 4Jqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=sxnUugt0pnNifM+LZaCU/RKJ5ZxbnvqCEOGFgZqROpY=; b=JjuTvApvbD3XQxnDqv0CN6PkmPW5tp1kK+M7HbHfaX0XADdiSxKce+BsoFXQ29rVyp yknKlhRB3+ylyzwh8NJBxcQgMpTjjwnHmm3bo3W5R3M5bRFvNm0zK53S5zfVJyt4IFDO Hghd9/H70aziUurweYLNR6uAV5Z8zBUeYE1GQbRWBsppIvXHbznB7qv1ezB8PSe8A2yP lKe7tPgDIth3kRWC4u8nOg95F/p73wy5bEJRimctMUnnG1ySfqsJVlmyT0hEueCvoVDf teUbIF7lYraNEvL+0luZKGndhbeDV41k7Ugt7s3hnM6woqSW85gLDrp/EpH45QAqDFdj uNXw== X-Gm-Message-State: AOAM5306RzxqQt0DFT8fvtuTYelCGh6zWIEwc21I8jj2IF0TAaSB8EFL oa9lL7vFpudx4kNyFSbljLX+5yRDYmw= X-Received: by 2002:aa7:9581:0:b029:2ea:39e:2224 with SMTP id z1-20020aa795810000b02902ea039e2224mr8414673pfj.32.1623828849878; Wed, 16 Jun 2021 00:34:09 -0700 (PDT) Received: from localhost.localdomain ([45.124.203.14]) by smtp.gmail.com with ESMTPSA id a25sm1208420pff.54.2021.06.16.00.34.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Jun 2021 00:34:09 -0700 (PDT) From: Joel Stanley To: =?utf-8?q?C=C3=A9dric_Le_Goater?= Subject: [PATCH v2 1/2] hw/misc: Add Infineon DPS310 sensor model Date: Wed, 16 Jun 2021 17:03:57 +0930 Message-Id: <20210616073358.750472-2-joel@jms.id.au> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210616073358.750472-1-joel@jms.id.au> References: <20210616073358.750472-1-joel@jms.id.au> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=joel.stan@gmail.com; helo=mail-pg1-x530.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jeffery , qemu-arm@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This contains some hardcoded register values that were obtained from the hardware after reading the temperature. It does enough to test the Linux kernel driver. The FIFO mode, IRQs and operation modes other than the default as used by Linux are not modelled. Signed-off-by: Joel Stanley --- v2: - remove unused class - remove use of GENMASK - move reg reset state into an array - remove half implemented get/set callbacks - set NUM_REGISTERS to 0x33, avoid special casing undocumented register - use device_cold_reset - add buildtime assert for array size --- hw/misc/dps310.c | 231 ++++++++++++++++++++++++++++++++++++++++++++ hw/arm/Kconfig | 1 + hw/misc/Kconfig | 4 + hw/misc/meson.build | 1 + 4 files changed, 237 insertions(+) create mode 100644 hw/misc/dps310.c -- 2.32.0 Reviewed-by: Cédric Le Goater diff --git a/hw/misc/dps310.c b/hw/misc/dps310.c new file mode 100644 index 000000000000..82b727ab4287 --- /dev/null +++ b/hw/misc/dps310.c @@ -0,0 +1,231 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright 2017 Joel Stanley , IBM Corporation + * + * Infineon DPS310 temperature and himidity sensor + * + * https://www.infineon.com/cms/en/product/sensor/pressure-sensors/pressure-sensors-for-iot/dps310/ + */ + +#include "qemu/osdep.h" +#include "qemu/log.h" +#include "hw/hw.h" +#include "hw/i2c/i2c.h" +#include "qapi/error.h" +#include "qapi/visitor.h" +#include "migration/vmstate.h" + +#define NUM_REGISTERS 0x33 + +typedef struct DPS310State { + /*< private >*/ + I2CSlave i2c; + + /*< public >*/ + uint8_t regs[NUM_REGISTERS]; + + int16_t pressure, temperature; + + uint8_t len; + uint8_t buf[2]; + uint8_t pointer; + +} DPS310State; + +#define TYPE_DPS310 "dps310" +#define DPS310(obj) OBJECT_CHECK(DPS310State, (obj), TYPE_DPS310) + +#define DPS310_PRS_B2 0x00 +#define DPS310_PRS_B1 0x01 +#define DPS310_PRS_B0 0x02 +#define DPS310_TMP_B2 0x03 +#define DPS310_TMP_B1 0x04 +#define DPS310_TMP_B0 0x05 +#define DPS310_PRS_CFG 0x06 +#define DPS310_TMP_CFG 0x07 +#define DPS310_TMP_RATE_BITS (0x70) +#define DPS310_MEAS_CFG 0x08 +#define DPS310_MEAS_CTRL_BITS (0x07) +#define DPS310_PRESSURE_EN BIT(0) +#define DPS310_TEMP_EN BIT(1) +#define DPS310_BACKGROUND BIT(2) +#define DPS310_PRS_RDY BIT(4) +#define DPS310_TMP_RDY BIT(5) +#define DPS310_SENSOR_RDY BIT(6) +#define DPS310_COEF_RDY BIT(7) +#define DPS310_CFG_REG 0x09 +#define DPS310_RESET 0x0c +#define DPS310_RESET_MAGIC (BIT(0) | BIT(3)) +#define DPS310_COEF_BASE 0x10 +#define DPS310_COEF_LAST 0x21 +#define DPS310_COEF_SRC 0x28 + +static void dps310_reset(DeviceState *dev) +{ + DPS310State *s = DPS310(dev); + + static const uint8_t regs_reset_state[] = { + 0xfe, 0x2f, 0xee, 0x02, 0x69, 0xa6, 0x00, 0x80, 0xc7, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x00, 0x00, 0x0e, 0x1e, 0xdd, 0x13, 0xca, 0x5f, 0x21, 0x52, + 0xf9, 0xc6, 0x04, 0xd1, 0xdb, 0x47, 0x00, 0x5b, 0xfb, 0x3a, 0x00, 0x00, + 0x20, 0x49, 0x4e, 0xa5, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x60, 0x15, 0x02 + }; + + QEMU_BUILD_BUG_ON(sizeof(regs_reset_state) != sizeof(s->regs)); + + memcpy(s->regs, regs_reset_state, sizeof(s->regs)); + s->pointer = 0; + + /* TODO: assert these after some timeout ? */ + s->regs[DPS310_MEAS_CFG] = DPS310_COEF_RDY | DPS310_SENSOR_RDY + | DPS310_TMP_RDY | DPS310_PRS_RDY; +} + +static void dps310_read(DPS310State *s) +{ + if (s->pointer >= sizeof(s->regs)) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: register 0x%02x out of bounds\n", + __func__, s->pointer); + return; + } + + s->len = 0; + + switch (s->pointer) { + case DPS310_PRS_B2: + case DPS310_PRS_B1: + case DPS310_PRS_B0: + case DPS310_TMP_B2: + case DPS310_TMP_B1: + case DPS310_TMP_B0: + case DPS310_PRS_CFG: + case DPS310_TMP_CFG: + case DPS310_MEAS_CFG: + case DPS310_CFG_REG: + case DPS310_COEF_BASE...DPS310_COEF_LAST: + case DPS310_COEF_SRC: + case 0x32: /* Undocumented register to indicate workaround not required */ + s->buf[s->len++] = s->regs[s->pointer]; + break; + default: + qemu_log_mask(LOG_UNIMP, "%s: register 0x%02x unimplemented\n", + __func__, s->pointer); + return; + } +} + +static void dps310_write(DPS310State *s) +{ + if (s->pointer >= sizeof(s->regs)) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: register %d out of bounds\n", + __func__, s->pointer); + return; + } + + switch (s->pointer) { + case DPS310_RESET: + if (s->buf[0] == DPS310_RESET_MAGIC) { + device_cold_reset(DEVICE(s)); + } + break; + case DPS310_PRS_CFG: + case DPS310_TMP_CFG: + case DPS310_MEAS_CFG: + case DPS310_CFG_REG: + s->regs[s->pointer] = s->buf[0]; + break; + default: + qemu_log_mask(LOG_UNIMP, "%s: register 0x%02x unimplemented\n", + __func__, s->pointer); + return; + } +} + +static uint8_t dps310_rx(I2CSlave *i2c) +{ + DPS310State *s = DPS310(i2c); + + if (s->len < 2) { + return s->buf[s->len++]; + } else { + return 0xff; + } +} + +static int dps310_tx(I2CSlave *i2c, uint8_t data) +{ + DPS310State *s = DPS310(i2c); + + if (s->len == 0) { + /* + * first byte is the register pointer for a read or write + * operation + */ + s->pointer = data; + s->len++; + } else if (s->len == 1) { + /* + * second byte is the data to write. The device only supports + * one byte writes + */ + s->buf[0] = data; + dps310_write(s); + } + + return 0; +} + +static int dps310_event(I2CSlave *i2c, enum i2c_event event) +{ + DPS310State *s = DPS310(i2c); + + if (event == I2C_START_RECV) { + dps310_read(s); + } + + s->len = 0; + return 0; +} + +static const VMStateDescription vmstate_dps310 = { + .name = "DPS310", + .version_id = 0, + .minimum_version_id = 0, + .fields = (VMStateField[]) { + VMSTATE_UINT8(len, DPS310State), + VMSTATE_UINT8_ARRAY(buf, DPS310State, 2), + VMSTATE_UINT8_ARRAY(regs, DPS310State, NUM_REGISTERS), + VMSTATE_UINT8(pointer, DPS310State), + VMSTATE_INT16(temperature, DPS310State), + VMSTATE_INT16(pressure, DPS310State), + VMSTATE_I2C_SLAVE(i2c, DPS310State), + VMSTATE_END_OF_LIST() + } +}; + +static void dps310_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + I2CSlaveClass *k = I2C_SLAVE_CLASS(klass); + + k->event = dps310_event; + k->recv = dps310_rx; + k->send = dps310_tx; + dc->reset = dps310_reset; + dc->vmsd = &vmstate_dps310; +} + +static const TypeInfo dps310_info = { + .name = TYPE_DPS310, + .parent = TYPE_I2C_SLAVE, + .instance_size = sizeof(DPS310State), + .class_init = dps310_class_init, +}; + +static void dps310_register_types(void) +{ + type_register_static(&dps310_info); +} + +type_init(dps310_register_types) diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index 67723d9ea6a8..62925845ebc1 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -410,6 +410,7 @@ config ASPEED_SOC select DS1338 select FTGMAC100 select I2C + select DPS310 select PCA9552 select SERIAL select SMBUS_EEPROM diff --git a/hw/misc/Kconfig b/hw/misc/Kconfig index c71ed2582046..016e34790e4f 100644 --- a/hw/misc/Kconfig +++ b/hw/misc/Kconfig @@ -49,6 +49,10 @@ config EDU default y if TEST_DEVICES depends on PCI && MSI_NONBROKEN +config DPS310 + bool + depends on I2C + config PCA9552 bool depends on I2C diff --git a/hw/misc/meson.build b/hw/misc/meson.build index 66e1648533e0..779d8b1582d3 100644 --- a/hw/misc/meson.build +++ b/hw/misc/meson.build @@ -1,4 +1,5 @@ softmmu_ss.add(when: 'CONFIG_APPLESMC', if_true: files('applesmc.c')) +softmmu_ss.add(when: 'CONFIG_DPS310', if_true: files('dps310.c')) softmmu_ss.add(when: 'CONFIG_EDU', if_true: files('edu.c')) softmmu_ss.add(when: 'CONFIG_FW_CFG_DMA', if_true: files('vmcoreinfo.c')) softmmu_ss.add(when: 'CONFIG_ISA_DEBUG', if_true: files('debugexit.c')) From patchwork Wed Jun 16 07:33:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 461381 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp361457jae; Wed, 16 Jun 2021 00:35:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1iv3c4pGDdtIxaqDrJwB41dPvOCyA1hlZGuyNY+qmDzCcZLWk657FztcdZqvhmPDZutn+ X-Received: by 2002:a67:f3d5:: with SMTP id j21mr9305756vsn.20.1623828922295; Wed, 16 Jun 2021 00:35:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623828922; cv=none; d=google.com; s=arc-20160816; b=ytrQIkeWFXT5Ltb8Vp8dS98aQ2ey2r63JrXtofeTMwDAVswHbryVux4PNnQ4mezTct cEI3c4vYcpZWDPS/0MQDZu0nOJo5ok02u2IfnrGyAc3xHkau1idT5nnxyuHNHaY/CsdX IbfQZkZJhh110apfWgBPSLEcbdPYUlyvB74a/28sUnVztoKJD27Z8mfUoXugkdCq06Cv W7HNHBUxP8/4zVYHeXuzUj7speLOggFMSF4M52SIuWOHKmvqJXb6+RsClpwsGXUhA44K LjX4CvY13jpM9yLGEC0FyxvWrSM5U8VpmIB8XRLixGfFhxmVlbvQC5uglezcExmQyxWR kWKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=KDOkWF4XUI7jTzhjg2i6DeBblVKS98WPiTYbEslZQkU=; b=hx2rPiInF1+7iEIO8dCWeBX+fftS5zKjhwYaaxe1fVIP/SnyhsUw7+Ynx89P2HTHRd CauHp9lt23hMlCatMx1J2Y8xzchjyaaCMAt+1PYQ5m8c4P62KPigKBiL/DJvQoOyiuk3 CeaYv25Ijwd3NiSoQxDIvEkkvnH3rdG4/UB9P2HQr3Er9HZ06W7q3lckrmuLpkj4G2HE sd8RjnAVwLacMuh8HYBFXkfX2RdkwC7/r4W9HGBLXg93CxoTPETikBj0/m9mcgnF3jdy /eBoGEsDBeImKPWnalFGhi5xilTtISAdZQpvwvPcy2gqMMYpja/G+zuWfaP4Ly9Fu6pR 0o5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=kdICWa76; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z10si507304vsf.393.2021.06.16.00.35.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Jun 2021 00:35:22 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=kdICWa76; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:50624 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltQ53-0001Jb-JN for patch@linaro.org; Wed, 16 Jun 2021 03:35:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48018) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltQ40-0001I8-Qa; Wed, 16 Jun 2021 03:34:16 -0400 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]:53800) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltQ3y-0001DM-Sa; Wed, 16 Jun 2021 03:34:16 -0400 Received: by mail-pj1-x1030.google.com with SMTP id ei4so1196564pjb.3; Wed, 16 Jun 2021 00:34:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KDOkWF4XUI7jTzhjg2i6DeBblVKS98WPiTYbEslZQkU=; b=kdICWa76O3JFEwqav6GKwPa9I+ryUTu4di/GYPw8qDRvFftzCVkfgdX440O5RNFlDT 3f05s+ZRQYR2YOo1NiurPX4lkU+r0BHOH5yO3FcvGZ9IvGXrrE26XO7zlr4+p9IQ7ACX gnNBTeLBEkCG2+YIEyiUQbcBnUNwT4rSCTFb7mxQWTB2ec1em7mH10gG/DzytPbrIWl8 ft1O04KIHczYQcZv+dgkKXMdov/dEHar/VsMYOrK5nAyQvkw1j4hzZZs0tECr7p1n4sa ryMfKBgEzTD5wVCMsP33BwmlXlOWU1XUGERNunibmrIj6HiQ8AzJE7Ri5QWRqDymeUux FbPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=KDOkWF4XUI7jTzhjg2i6DeBblVKS98WPiTYbEslZQkU=; b=GQOGXZuSZhe4YLPODgI2/0LRx74GzYklDg0X0Jx4pvP/4g6egYnaUOPMok8nNjku/f wWJx6DACLBhvY/puNYTlBrQVpA7HSrj5hywJE4Q/ZJse38xRrPAeHGFBuCcvqmHcxdjc 7Pubjnz2lT1j6IS+tnWJ+cLBxExnIu/ixsxGjb1K5KrrTy1cAcX/N9ymkyDFMspoUkmX XvDsZ9t5e3SvBwCQ1X2AKlsOARUOjLWNZzpyLZkVwv1KhMvsHWu5KcLYTtptC4NOsI+6 a6FYO/DZ56vcbfo9Yk5F6eEbavRNQMauSNEOL44UG2I5nx8yVj197ASJvo95vBEv2WZi udNQ== X-Gm-Message-State: AOAM530H19xEc/hvxqSwJU2ZtWcP9iX+0/iHiOUAwjacSavkVKQrdHq9 /z3HO9O53me5xLgwQ/gP0lA= X-Received: by 2002:a17:90a:2ac7:: with SMTP id i7mr3679137pjg.139.1623828853226; Wed, 16 Jun 2021 00:34:13 -0700 (PDT) Received: from localhost.localdomain ([45.124.203.14]) by smtp.gmail.com with ESMTPSA id a25sm1208420pff.54.2021.06.16.00.34.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Jun 2021 00:34:12 -0700 (PDT) From: Joel Stanley To: =?utf-8?q?C=C3=A9dric_Le_Goater?= Subject: [PATCH v2 2/2] arm/aspeed: Add DPS310 to Witherspoon and Rainier Date: Wed, 16 Jun 2021 17:03:58 +0930 Message-Id: <20210616073358.750472-3-joel@jms.id.au> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210616073358.750472-1-joel@jms.id.au> References: <20210616073358.750472-1-joel@jms.id.au> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=joel.stan@gmail.com; helo=mail-pj1-x1030.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jeffery , qemu-arm@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Witherspoon uses the DPS310 as a temperature sensor. Rainier uses it as a temperature and humidity sensor. Signed-off-by: Joel Stanley --- hw/arm/aspeed.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.32.0 Reviewed-by: Cédric Le Goater diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index 0eafc791540d..619ad869dd71 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -597,7 +597,6 @@ static void witherspoon_bmc_i2c_init(AspeedMachineState *bmc) /* Bus 3: TODO bmp280@77 */ /* Bus 3: TODO max31785@52 */ - /* Bus 3: TODO dps310@76 */ dev = DEVICE(i2c_slave_new(TYPE_PCA9552, 0x60)); qdev_prop_set_string(dev, "description", "pca1"); i2c_slave_realize_and_unref(I2C_SLAVE(dev), @@ -612,6 +611,7 @@ static void witherspoon_bmc_i2c_init(AspeedMachineState *bmc) qdev_connect_gpio_out(dev, pca1_leds[i].gpio_id, qdev_get_gpio_in(DEVICE(led), 0)); } + i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 3), "dps310", 0x76); i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 4), "tmp423", 0x4c); i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 5), "tmp423", 0x4c); @@ -693,9 +693,9 @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc) i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6), TYPE_TMP105, 0x4b); - /* Bus 7: TODO dps310@76 */ /* Bus 7: TODO max31785@52 */ i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 7), "pca9552", 0x61); + i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 7), "dps310", 0x76); /* Bus 7: TODO si7021-a20@20 */ i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 7), TYPE_TMP105, 0x48);