From 2cf88c185a3910f7d37c2e456e78224d2859d6a1 Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Thu, 16 Sep 2021 16:56:40 -0700 Subject: [PATCH] mb/google/dedede/var/sasukette: Drop special codec device handling On sasukette, codec device might be either 10EC5682 or RTL5682 depending upon the provisioned FW_CONFIG value for AUDIO_CODEC_SOURCE. The HID for the device was updated in ramstage.c because sconfig lacked the support for multiple override devices. Commit b9c22e0 ("util/sconfig: Compare probe conditions for override device match") fixed this behavior in sconfig and now we can add multiple override devices using different FW_CONFIG probe statements in override tree. Hence, this change moves the codec device to override tree and drops the special handling in ramstage.c This change also probes for UNPROVISIONED value of FW_CONFIG for "10EC5682" device since some devices might have shipped with UNPROVISIONED value and using "10EC5682" device. Change-Id: I909a29c3df0cbb7ac3c07ca7663a49ad47007232 Signed-off-by: Furquan Shaikh Reviewed-on: https://review.coreboot.org/c/coreboot/+/57741 Tested-by: build bot (Jenkins) Reviewed-by: Karthik Ramasubramanian --- .../dedede/variants/sasukette/overridetree.cb | 20 ++++++++++++-- .../dedede/variants/sasukette/ramstage.c | 27 ------------------- 2 files changed, 18 insertions(+), 29 deletions(-) diff --git a/src/mainboard/google/dedede/variants/sasukette/overridetree.cb b/src/mainboard/google/dedede/variants/sasukette/overridetree.cb index 9959263600..8a87462079 100644 --- a/src/mainboard/google/dedede/variants/sasukette/overridetree.cb +++ b/src/mainboard/google/dedede/variants/sasukette/overridetree.cb @@ -192,7 +192,7 @@ chip soc/intel/jasperlake end #I2C 0 device pci 19.0 on chip drivers/i2c/generic - # register "hid" is set in ramstage.c because of FW_CONFIG + register "hid" = ""10EC5682"" register "name" = ""RT58"" register "desc" = ""Realtek RT5682"" register "irq_gpio" = "ACPI_GPIO_IRQ_EDGE_BOTH(GPP_D16)" @@ -200,7 +200,23 @@ chip soc/intel/jasperlake register "property_list[0].type" = "ACPI_DP_TYPE_INTEGER" register "property_list[0].name" = ""realtek,jd-src"" register "property_list[0].integer" = "1" - device i2c 1a on end + device i2c 1a on + probe AUDIO_CODEC_SOURCE AUDIO_CODEC_ALC5682 + probe AUDIO_CODEC_SOURCE AUDIO_CODEC_UNPROVISIONED + end + end + chip drivers/i2c/generic + register "hid" = ""RTL5682"" + register "name" = ""RT58"" + register "desc" = ""Realtek RT5682"" + register "irq_gpio" = "ACPI_GPIO_IRQ_EDGE_BOTH(GPP_D16)" + register "property_count" = "1" + register "property_list[0].type" = "ACPI_DP_TYPE_INTEGER" + register "property_list[0].name" = ""realtek,jd-src"" + register "property_list[0].integer" = "1" + device i2c 1a on + probe AUDIO_CODEC_SOURCE AUDIO_CODEC_ALC5682I_VS + end end end #I2C 4 device pci 1f.3 on diff --git a/src/mainboard/google/dedede/variants/sasukette/ramstage.c b/src/mainboard/google/dedede/variants/sasukette/ramstage.c index b4ea9cbcfa..580e6bf018 100644 --- a/src/mainboard/google/dedede/variants/sasukette/ramstage.c +++ b/src/mainboard/google/dedede/variants/sasukette/ramstage.c @@ -1,35 +1,9 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ #include -#include -#include #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_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"; -} - static void ext_vr_update(void) { struct soc_intel_jasperlake_config *cfg = config_of_soc(); @@ -40,6 +14,5 @@ static void ext_vr_update(void) void variant_devtree_update(void) { - audio_codec_update(); ext_vr_update(); }