diff --git a/src/mainboard/google/volteer/Kconfig b/src/mainboard/google/volteer/Kconfig index ced8d9dbe5..c4d8e88692 100644 --- a/src/mainboard/google/volteer/Kconfig +++ b/src/mainboard/google/volteer/Kconfig @@ -18,6 +18,7 @@ config BOARD_GOOGLE_BASEBOARD_VOLTEER select DRIVERS_USB_ACPI select EC_GOOGLE_CHROMEEC select EC_GOOGLE_CHROMEEC_BOARDID + select EC_GOOGLE_CHROMEEC_INCLUDE_SSFC_IN_FW_CONFIG select EC_GOOGLE_CHROMEEC_LPC select EC_GOOGLE_CHROMEEC_SKUID select FW_CONFIG diff --git a/src/mainboard/google/volteer/variants/delbin/Makefile.inc b/src/mainboard/google/volteer/variants/delbin/Makefile.inc index 343c7dbb95..2af91aab63 100644 --- a/src/mainboard/google/volteer/variants/delbin/Makefile.inc +++ b/src/mainboard/google/volteer/variants/delbin/Makefile.inc @@ -5,3 +5,5 @@ romstage-y += memory.c bootblock-y += gpio.c ramstage-y += gpio.c + +ramstage-y += variant.c diff --git a/src/mainboard/google/volteer/variants/delbin/overridetree.cb b/src/mainboard/google/volteer/variants/delbin/overridetree.cb index 378d4e2ee4..3ff6bb2737 100644 --- a/src/mainboard/google/volteer/variants/delbin/overridetree.cb +++ b/src/mainboard/google/volteer/variants/delbin/overridetree.cb @@ -1,3 +1,10 @@ +fw_config + field AUDIO_CODEC_SOURCE 41 43 + option AUDIO_CODEC_UNPROVISIONED 0 + option AUDIO_CODEC_ALC5682 1 + option AUDIO_CODEC_ALC5682I_VS 2 + end +end chip soc/intel/tigerlake register "DdiPort1Hpd" = "0" register "DdiPort2Hpd" = "0" @@ -129,7 +136,7 @@ chip soc/intel/tigerlake end # DPTF 0x9A03 device ref i2c0 on chip drivers/i2c/generic - register "hid" = ""10EC5682"" + # register "hid" is set in variant.c because of FW_CONFIG register "name" = ""RT58"" register "desc" = ""Headset Codec"" register "irq_gpio" = "ACPI_GPIO_IRQ_EDGE_BOTH(GPP_F8)" diff --git a/src/mainboard/google/volteer/variants/delbin/variant.c b/src/mainboard/google/volteer/variants/delbin/variant.c new file mode 100644 index 0000000000..f502a1a129 --- /dev/null +++ b/src/mainboard/google/volteer/variants/delbin/variant.c @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include +#include +#include +#include + +extern struct chip_operations drivers_i2c_generic_ops; +static void audio_codec_update(void) +{ + const struct device_path codec_path[] = { + {.type = DEVICE_PATH_PCI, .pci.devfn = PCH_DEVFN_I2C0}, + {.type = DEVICE_PATH_I2C, .i2c.device = 0x1a} + }; + const struct device *codec = + find_dev_nested_path(pci_root_bus(), codec_path, + ARRAY_SIZE(codec_path)); + struct drivers_i2c_generic_config *config; + + if (!codec || (codec->chip_ops != &drivers_i2c_generic_ops) || + !codec->chip_info) + return; + config = codec->chip_info; + + if (fw_config_probe(FW_CONFIG(AUDIO_CODEC_SOURCE, AUDIO_CODEC_ALC5682))) + config->hid = "10EC5682"; + else if (fw_config_probe(FW_CONFIG(AUDIO_CODEC_SOURCE, + AUDIO_CODEC_ALC5682I_VS))) + config->hid = "RTL5682"; +} +void variant_devtree_update(void) +{ + audio_codec_update(); +}