[PATCH 0/4] hw/sensor: Add new device emulation for TI ADC128D818

Emmanuel Blot posted 4 patches 1 month, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260612-i2c-adc128d818-anacapa-v1-0-9e4640cd164b@meta.com
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, "Cédric Le Goater" <clg@kaod.org>, Steven Lee <steven_lee@aspeedtech.com>, Troy Lee <leetroy@gmail.com>, Jamin Lin <jamin_lin@aspeedtech.com>, Kane Chen <kane_chen@aspeedtech.com>, Andrew Jeffery <andrew@codeconstruct.com.au>, Joel Stanley <joel@jms.id.au>, "Philippe Mathieu-Daudé" <philmd@mailo.com>, Fabiano Rosas <farosas@suse.de>, Laurent Vivier <lvivier@redhat.com>
There is a newer version of this series
hw/arm/Kconfig                              |   1 +
hw/arm/aspeed_ast2600_anacapa.c             |  19 +-
hw/sensor/Kconfig                           |   4 +
hw/sensor/adc128d818.c                      | 703 +++++++++++++++++++++++
hw/sensor/meson.build                       |   1 +
hw/sensor/trace-events                      |   8 +
include/hw/sensor/adc128d818.h              |  12 +
tests/functional/arm/test_aspeed_anacapa.py |  92 ++-
tests/qtest/adc128d818-test.c               | 855 ++++++++++++++++++++++++++++
tests/qtest/meson.build                     |   1 +
10 files changed, 1688 insertions(+), 8 deletions(-)
[PATCH 0/4] hw/sensor: Add new device emulation for TI ADC128D818
Posted by Emmanuel Blot 1 month, 1 week ago
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 <eblot@meta.com>
---
Emmanuel Blot (4):
      hw/sensor: adc128d818: add 12-bit 8-channel ADC device
      tests/qtest: adc128d818: add test suite
      hw/arm: anacapa: add ADC128D818 devices
      test/functional: anacapa: test ADC128D818

 hw/arm/Kconfig                              |   1 +
 hw/arm/aspeed_ast2600_anacapa.c             |  19 +-
 hw/sensor/Kconfig                           |   4 +
 hw/sensor/adc128d818.c                      | 703 +++++++++++++++++++++++
 hw/sensor/meson.build                       |   1 +
 hw/sensor/trace-events                      |   8 +
 include/hw/sensor/adc128d818.h              |  12 +
 tests/functional/arm/test_aspeed_anacapa.py |  92 ++-
 tests/qtest/adc128d818-test.c               | 855 ++++++++++++++++++++++++++++
 tests/qtest/meson.build                     |   1 +
 10 files changed, 1688 insertions(+), 8 deletions(-)
---
base-commit: 193963218accbcf65f28ab1efa773ac6d1cc634c
change-id: 20260612-i2c-adc128d818-anacapa-13c63e97fbd0

Best regards,
--  
Emmanuel Blot <eblot@meta.com>
Re: [PATCH 0/4] hw/sensor: Add new device emulation for TI ADC128D818
Posted by Cédric Le Goater 1 month, 1 week ago
On 6/12/26 18:46, Emmanuel Blot wrote:
> 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 <eblot@meta.com>
> ---
> Emmanuel Blot (4):
>        hw/sensor: adc128d818: add 12-bit 8-channel ADC device
>        tests/qtest: adc128d818: add test suite
>        hw/arm: anacapa: add ADC128D818 devices
>        test/functional: anacapa: test ADC128D818
> 
>   hw/arm/Kconfig                              |   1 +
>   hw/arm/aspeed_ast2600_anacapa.c             |  19 +-
>   hw/sensor/Kconfig                           |   4 +
>   hw/sensor/adc128d818.c                      | 703 +++++++++++++++++++++++
>   hw/sensor/meson.build                       |   1 +
>   hw/sensor/trace-events                      |   8 +
>   include/hw/sensor/adc128d818.h              |  12 +
>   tests/functional/arm/test_aspeed_anacapa.py |  92 ++-
>   tests/qtest/adc128d818-test.c               | 855 ++++++++++++++++++++++++++++
>   tests/qtest/meson.build                     |   1 +
>   10 files changed, 1688 insertions(+), 8 deletions(-)
> ---
> base-commit: 193963218accbcf65f28ab1efa773ac6d1cc634c
> change-id: 20260612-i2c-adc128d818-anacapa-13c63e97fbd0
> 
> Best regards,
> --
> Emmanuel Blot <eblot@meta.com>
Alexander,

This proposal offers significant advantages over your v6.

  - instead of adc128d818_init_with_values, it uses QOM properties for
    run time values.
  - reset is better
  - unit tests

This implementation seems a better foundation. If you agree, could
you please take some time to review it ? Given your expertise, you
seem to be the best person for it.


Thanks,

C.
Re: [PATCH 0/4] hw/sensor: Add new device emulation for TI ADC128D818
Posted by Alexander Hansen 1 month, 1 week ago
Hi Cedric,

I would agree that Emmanuel has the better version for ADC128D818 and we
should go ahead with that one.
Will not push my version anymore so it should not appear in the next
patchset..

I did find some time to test his version on anacapa qemu today and also
tested it from the hmp side to modify the properties.
Overall I could not find any functional gaps and the tests are looking
quite good too.

Alexander

Am Sa., 13. Juni 2026 um 19:07 Uhr schrieb Cédric Le Goater <clg@kaod.org>:

> On 6/12/26 18:46, Emmanuel Blot wrote:
> > 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 <eblot@meta.com>
> > ---
> > Emmanuel Blot (4):
> >        hw/sensor: adc128d818: add 12-bit 8-channel ADC device
> >        tests/qtest: adc128d818: add test suite
> >        hw/arm: anacapa: add ADC128D818 devices
> >        test/functional: anacapa: test ADC128D818
> >
> >   hw/arm/Kconfig                              |   1 +
> >   hw/arm/aspeed_ast2600_anacapa.c             |  19 +-
> >   hw/sensor/Kconfig                           |   4 +
> >   hw/sensor/adc128d818.c                      | 703
> +++++++++++++++++++++++
> >   hw/sensor/meson.build                       |   1 +
> >   hw/sensor/trace-events                      |   8 +
> >   include/hw/sensor/adc128d818.h              |  12 +
> >   tests/functional/arm/test_aspeed_anacapa.py |  92 ++-
> >   tests/qtest/adc128d818-test.c               | 855
> ++++++++++++++++++++++++++++
> >   tests/qtest/meson.build                     |   1 +
> >   10 files changed, 1688 insertions(+), 8 deletions(-)
> > ---
> > base-commit: 193963218accbcf65f28ab1efa773ac6d1cc634c
> > change-id: 20260612-i2c-adc128d818-anacapa-13c63e97fbd0
> >
> > Best regards,
> > --
> > Emmanuel Blot <eblot@meta.com>
> Alexander,
>
> This proposal offers significant advantages over your v6.
>
>   - instead of adc128d818_init_with_values, it uses QOM properties for
>     run time values.
>   - reset is better
>   - unit tests
>
> This implementation seems a better foundation. If you agree, could
> you please take some time to review it ? Given your expertise, you
> seem to be the best person for it.
>
>
> Thanks,
>
> C.
>
>