Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/56930 )
Change subject: mb/google/dedede/var/sasukette: Add fw_config probe for ALC5682I-VD & VS ......................................................................
mb/google/dedede/var/sasukette: Add fw_config probe for ALC5682I-VD & VS
Update the `_HID` value of device in SSDT depending on the fw_config. According to value of AUDIO_CODEC_SOURCE field in fw_config(SSFC) which stored in CBI: AUDIO_CODEC_ALC5682: _HID = "10EC5682" /* ALC5682I-VD */ AUDIO_CODEC_ALC5682I_VS: _HID = "RTL5682" /* ALC5682I-VS */
BUG=b:193623380 BRANCH=dedede TEST=ALC5682I-VD or VS audio codec can work normally
Signed-off-by: Zhi Li lizhi7@huaqin.corp-partner.google.com Change-Id: Ic8840454e4934162ea59c742634a56f70b153238 Reviewed-on: https://review.coreboot.org/c/coreboot/+/56930 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Karthik Ramasubramanian kramasub@google.com Reviewed-by: Tim Wawrzynczak twawrzynczak@chromium.org Reviewed-by: Weimin Wu wuweimin@huaqin.corp-partner.google.com --- M src/mainboard/google/dedede/variants/sasukette/Makefile.inc M src/mainboard/google/dedede/variants/sasukette/overridetree.cb A src/mainboard/google/dedede/variants/sasukette/ramstage.c 3 files changed, 46 insertions(+), 1 deletion(-)
Approvals: build bot (Jenkins): Verified Karthik Ramasubramanian: Looks good to me, approved Tim Wawrzynczak: Looks good to me, approved Weimin Wu: Looks good to me, but someone else must approve
diff --git a/src/mainboard/google/dedede/variants/sasukette/Makefile.inc b/src/mainboard/google/dedede/variants/sasukette/Makefile.inc index fd60a18..7412194 100644 --- a/src/mainboard/google/dedede/variants/sasukette/Makefile.inc +++ b/src/mainboard/google/dedede/variants/sasukette/Makefile.inc @@ -1,5 +1,6 @@ ## SPDX-License-Identifier: GPL-2.0-or-later
ramstage-y += gpio.c +ramstage-y += ramstage.c
smm-y += variant.c diff --git a/src/mainboard/google/dedede/variants/sasukette/overridetree.cb b/src/mainboard/google/dedede/variants/sasukette/overridetree.cb index 0624a0e..c7636a8 100644 --- a/src/mainboard/google/dedede/variants/sasukette/overridetree.cb +++ b/src/mainboard/google/dedede/variants/sasukette/overridetree.cb @@ -1,3 +1,12 @@ +fw_config + field AUDIO_CODEC_SOURCE 41 43 + option AUDIO_CODEC_UNPROVISIONED 0 + option AUDIO_CODEC_ALC5682 1 + option AUDIO_CODEC_CS42l42 2 + option AUDIO_CODEC_ALC5682I_VS 3 + end +end + chip soc/intel/jasperlake
# Intel Common SoC Config @@ -175,7 +184,7 @@ end #I2C 0 device pci 19.0 on chip drivers/i2c/generic - register "hid" = ""10EC5682"" + # register "hid" is set in ramstage.c because of FW_CONFIG register "name" = ""RT58"" register "desc" = ""Realtek RT5682"" register "irq_gpio" = "ACPI_GPIO_IRQ_EDGE_BOTH(GPP_D16)" diff --git a/src/mainboard/google/dedede/variants/sasukette/ramstage.c b/src/mainboard/google/dedede/variants/sasukette/ramstage.c new file mode 100644 index 0000000..2f714ff --- /dev/null +++ b/src/mainboard/google/dedede/variants/sasukette/ramstage.c @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include <baseboard/variants.h> +#include <device/device.h> +#include <device/path.h> +#include <fw_config.h> +#include <soc/pci_devs.h> +#include <drivers/i2c/generic/chip.h> + +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_I2C4}, + {.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(); +}