1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <ec/google/chromeec/ec.h>
4 #include <baseboard/variants.h>
5 #include <variant/sku.h>
7 #include <drivers/i2c/hid/chip.h>
9 extern struct chip_operations drivers_i2c_generic_ops
;
10 extern struct chip_operations drivers_i2c_da7219_ops
;
12 void variant_devtree_update(void)
14 uint32_t sku
= google_chromeec_get_sku_id();
15 struct device
*mmio_dev
= NULL
, *child
= NULL
;
16 struct device
*alc_dev
= NULL
, *da7219_dev
= NULL
;
19 mmio_dev
= dev_find_path(mmio_dev
, DEVICE_PATH_MMIO
);
22 if (mmio_dev
->path
.mmio
.addr
== 0xfedc2000)
29 while ((child
= dev_bus_each_child(mmio_dev
->downstream
, child
)) != NULL
) {
30 if (child
->path
.type
!= DEVICE_PATH_I2C
)
32 if (child
->path
.i2c
.device
!= 0x1a)
34 if (child
->chip_ops
== &drivers_i2c_generic_ops
) {
35 struct drivers_i2c_generic_config
*config
= child
->chip_info
;
36 if (!strcmp(config
->hid
, "10EC5682"))
38 } else if (child
->chip_ops
== &drivers_i2c_da7219_ops
) {
47 da7219_dev
->enabled
= 1;
51 case SKU_BARLA_ALC5682_44
:
52 case SKU_BARLA_ALC5682_45
:
53 case SKU_BARLA_ALC5682_46
:
54 case SKU_BARLA_ALC5682_47
:
57 da7219_dev
->enabled
= 0;