1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <console/console.h>
4 #include <ec/google/chromeec/ec.h>
5 #include <baseboard/variants.h>
6 #include <variant/sku.h>
8 #include <drivers/i2c/hid/chip.h>
10 #define RT58_I2C_ADDRESS 0x1a
12 extern struct chip_operations drivers_i2c_generic_ops
;
13 extern struct chip_operations drivers_i2c_da7219_ops
;
15 void variant_devtree_update(void)
17 struct device
*mmio_dev
= NULL
, *child
= NULL
;
18 struct device
*alc_dev
= NULL
, *da7219_dev
= NULL
;
21 mmio_dev
= dev_find_path(mmio_dev
, DEVICE_PATH_MMIO
);
23 printk(BIOS_INFO
, "Checking audio codec\n");
26 } while (mmio_dev
->path
.mmio
.addr
!= APU_I2C0_BASE
);
28 while ((child
= dev_bus_each_child(mmio_dev
->downstream
, child
)) != NULL
) {
29 if (child
->path
.type
!= DEVICE_PATH_I2C
)
31 if (child
->path
.i2c
.device
!= RT58_I2C_ADDRESS
)
33 if (child
->chip_ops
== &drivers_i2c_generic_ops
) {
34 struct drivers_i2c_generic_config
*config
= child
->chip_info
;
35 if (!strcmp(config
->hid
, "10EC5682"))
37 } else if (child
->chip_ops
== &drivers_i2c_da7219_ops
) {
42 switch (google_chromeec_get_sku_id()) {
43 case SKU_TREEYA_ALC5682_AE
:
44 case SKU_TREEYA_ALC5682_AF
:
47 da7219_dev
->enabled
= 0;
54 da7219_dev
->enabled
= 1;