@samitouri / QOSamiQemu / commits / 15d88540b8

hw/arm: anacapa: add ADC128D818 devices

Wire up the two ADC128D818 instances that appear in the Anacapa DTS: one on i2c8 mux channel 0 and one on i2c13 mux channel 3. Reviewed-by: Cédric Le Goater <clg@redhat.com> Signed-off-by: Emmanuel Blot <emmanuel.blot@free.fr> Link: https://lore.kernel.org/qemu-devel/20260707091609.97759-9-emmanuel.blot@free.fr Signed-off-by: Cédric Le Goater <clg@redhat.com>

Emmanuel Blot committed Jul 7, 2026 at 11:16 UTC 15d88540b83074807a483b35a7a6744571fcd9cb
2 files changed +18 -4
hw/arm/Kconfig
+1
@@ -558,6 +558,7 @@ config ASPEED_SOC
558 select LED
559 select PMBUS
560 select MAX31785
561 + select ADC128D818
562 select FSI_APB2OPB_ASPEED
563 select AT24C
564 select PCI_EXPRESS_ASPEED
hw/arm/aspeed_ast2600_anacapa.c
+17 -4
@@ -1,13 +1,14 @@
1 /*
2 * Facebook Anacapa
3 *
4 - * Copyright (c) Meta Platforms, Inc. and affiliates.
4 + * Copyright (c) 2026 Meta Platforms, Inc. and affiliates.
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
9 #include "qemu/osdep.h"
10 #include "qapi/error.h"
11 +#include "hw/sensor/adc128d818.h"
12 #include "hw/arm/machines-qom.h"
13 #include "hw/arm/aspeed.h"
14 #include "hw/arm/aspeed_soc.h"
@@ -15,7 +16,6 @@
16 #include "hw/gpio/pca9552.h"
17 #include "hw/nvram/eeprom_at24c.h"
18
18 -/* Anacapa hardware value */
19 #define ANACAPA_BMC_HW_STRAP1 0x00002002
20 #define ANACAPA_BMC_HW_STRAP2 0x00000000
21 #define ANACAPA_BMC_RAM_SIZE ASPEED_RAM_SIZE(2 * GiB)
@@ -221,6 +221,17 @@ static const uint8_t hpm_brd_id_eeprom[] = {
221 };
222 static const size_t hpm_brd_id_eeprom_len = sizeof(hpm_brd_id_eeprom);
223
224 +static void anacapa_add_adc128d818(I2CBus *bus, uint8_t addr,
225 + const char *description)
226 +{
227 + DeviceState *dev = DEVICE(i2c_slave_new(TYPE_ADC128D818, addr));
228 + g_autofree char *childname = g_strdup_printf("0x%02x", addr);
229 +
230 + qdev_prop_set_string(dev, "description", description);
231 + object_property_add_child(OBJECT(bus), childname, OBJECT(dev));
232 + i2c_slave_realize_and_unref(I2C_SLAVE(dev), bus, &error_fatal);
233 +}
234 +
235 static void anacapa_bmc_i2c_init(AspeedMachineState *bmc)
236 {
237 /* Reference: aspeed-bmc-facebook-anacapa.dts */
@@ -259,7 +270,8 @@ static void anacapa_bmc_i2c_init(AspeedMachineState *bmc)
270 i2c_mux = i2c_slave_create_simple(i2c[8], TYPE_PCA9546, 0x72);
271
272 /* i2c8mux ch0 */
262 - /* adc128d818@1f - no model */
273 + /* adc128d818@1f - R-PDB ADC (mode 1: 8 voltage channels) */
274 + anacapa_add_adc128d818(pca954x_i2c_get_bus(i2c_mux, 0), 0x1f, "i2c8:0:1f");
275 /* pca9555@22 */
276 i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 0),
277 TYPE_PCA9552, 0x22);
@@ -320,7 +332,8 @@ static void anacapa_bmc_i2c_init(AspeedMachineState *bmc)
332 i2c_mux = i2c_slave_create_simple(i2c[13], TYPE_PCA9548, 0x70);
333
334 /* i2c13mux ch3 */
323 - /* adc128d818@1f - no model */
335 + /* adc128d818@1f - MB ADC (mode 1: 8 voltage channels) */
336 + anacapa_add_adc128d818(pca954x_i2c_get_bus(i2c_mux, 3), 0x1f, "i2c13:3:1f");
337
338 /* i2c13mux ch4 */
339 /* eeprom@51 */