device/pci_ids: Add Intel Panther Lake device IDs for Bluetooth CNVi
[coreboot.git] / src / mainboard / google / kahlee / variants / treeya / audio.c
blobe7a20ea41474e2b52db02a4c893492c2397db800
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>
7 #include <string.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;
20 do {
21 mmio_dev = dev_find_path(mmio_dev, DEVICE_PATH_MMIO);
22 if (!mmio_dev) {
23 printk(BIOS_INFO, "Checking audio codec\n");
24 return;
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)
30 continue;
31 if (child->path.i2c.device != RT58_I2C_ADDRESS)
32 continue;
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"))
36 alc_dev = child;
37 } else if (child->chip_ops == &drivers_i2c_da7219_ops) {
38 da7219_dev = child;
42 switch (google_chromeec_get_sku_id()) {
43 case SKU_TREEYA_ALC5682_AE:
44 case SKU_TREEYA_ALC5682_AF:
45 /* alc5682 only */
46 if (da7219_dev)
47 da7219_dev->enabled = 0;
48 if (alc_dev)
49 alc_dev->enabled = 1;
50 break;
51 default:
52 /* da7219 only */
53 if (da7219_dev)
54 da7219_dev->enabled = 1;
55 if (alc_dev)
56 alc_dev->enabled = 0;
57 break;