This is a 12-bit, 8-channel ADC I2C device, which is used on several
OpenBMC platforms.
QOM properties can be used to change input ADC values and external VREF at
run time.
Add it to AST2600-based Anacapa machine, along with some functional tests
that use QOM properties to inject voltage values into analog inputs.
Datasheet: https://www.ti.com/lit/gpn/ADC128D818
Signed-off-by: Emmanuel Blot <emmanuel.blot@free.fr>
---
Changes in v5:
- Change author/committer/signed-off-by address to circumvent SMTP issues
- Link to v4: https://lore.kernel.org/qemu-devel/20260701-i2c-adc128d818-anacapa-v4-0-89d6a2febb26@meta.com
Changes in v4:
- Better follow QEMU coding style (lowercase hex number, signed integer
constants, parent object variable name in Device)
- Split adc128d818 test large commit into smaller ones
- Link to v3: https://lore.kernel.org/qemu-devel/20260627-i2c-adc128d818-anacapa-v3-0-cfb94270a980@meta.com
Changes in v3:
- Update anacapa test image with proper DTB
- Make I2C device in i2c_slave_create_simple a child of the I2C bus
- Simplify tests/functional/arm/test_aspeed_anacapa.py
- Use g_test_message rather than fprintf
- Keep review trailers
- Link to v2: https://lore.kernel.org/qemu-devel/20260617-i2c-adc128d818-anacapa-v2-0-fd38764f0465@meta.com
Changes in v2:
- Remove clang-format useless comment sections
- Link to v1: https://lore.kernel.org/qemu-devel/20260612-i2c-adc128d818-anacapa-v1-0-9e4640cd164b@meta.com
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Philippe Mathieu-Daudé <philmd@mailo.com>
Cc: Fabiano Rosas <farosas@suse.de>
Cc: Laurent Vivier <lvivier@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Cédric Le Goater <clg@kaod.org>
Cc: Steven Lee <steven_lee@aspeedtech.com>
Cc: Troy Lee <leetroy@gmail.com>
Cc: Jamin Lin <jamin_lin@aspeedtech.com>
Cc: Kane Chen <kane_chen@aspeedtech.com>
Cc: Andrew Jeffery <andrew@codeconstruct.com.au>
Cc: Joel Stanley <joel@jms.id.au>
Cc: qemu-arm@nongnu.org
Cc: Corey Minyard <cminyard@mvista.com>
---
Emmanuel Blot (8):
hw/sensor: adc128d818: add 12-bit 8-channel ADC device
tests/qtest: adc128d818: add test harness and register access
tests/qtest: adc128d818: test voltage and temperature conversion
tests/qtest: adc128d818: test limit interrupts
tests/qtest: adc128d818: test operating modes and power control
hw/i2c: parent slaves created with i2c_slave_create_simple
hw/arm: anacapa: add ADC128D818 devices
test/functional: anacapa: test ADC128D818
hw/arm/Kconfig | 1 +
hw/arm/aspeed_ast2600_anacapa.c | 21 +-
hw/i2c/core.c | 3 +
hw/sensor/Kconfig | 4 +
hw/sensor/adc128d818.c | 696 ++++++++++++++++++++++
hw/sensor/meson.build | 1 +
hw/sensor/trace-events | 8 +
include/hw/i2c/i2c.h | 7 +-
include/hw/sensor/adc128d818.h | 14 +
tests/functional/arm/test_aspeed_anacapa.py | 69 ++-
tests/qtest/adc128d818-test.c | 856 ++++++++++++++++++++++++++++
tests/qtest/meson.build | 1 +
12 files changed, 1669 insertions(+), 12 deletions(-)
---
base-commit: c682d7d73adfddbbcfb2613942d7c96fb43534af
change-id: 20260612-i2c-adc128d818-anacapa-13c63e97fbd0
Best regards,
--
Emmanuel Blot <emmanuel.blot@free.fr>