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>
This commit is contained in:
Zhi Li 2021-08-12 16:29:52 +08:00 committed by Felix Held
parent 87f20739bb
commit 1473fc75eb
3 changed files with 46 additions and 1 deletions

View File

@ -1,5 +1,6 @@
## SPDX-License-Identifier: GPL-2.0-or-later ## SPDX-License-Identifier: GPL-2.0-or-later
ramstage-y += gpio.c ramstage-y += gpio.c
ramstage-y += ramstage.c
smm-y += variant.c smm-y += variant.c

View File

@ -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 chip soc/intel/jasperlake
# Intel Common SoC Config # Intel Common SoC Config
@ -175,7 +184,7 @@ chip soc/intel/jasperlake
end #I2C 0 end #I2C 0
device pci 19.0 on device pci 19.0 on
chip drivers/i2c/generic chip drivers/i2c/generic
register "hid" = ""10EC5682"" # register "hid" is set in ramstage.c because of FW_CONFIG
register "name" = ""RT58"" register "name" = ""RT58""
register "desc" = ""Realtek RT5682"" register "desc" = ""Realtek RT5682""
register "irq_gpio" = "ACPI_GPIO_IRQ_EDGE_BOTH(GPP_D16)" register "irq_gpio" = "ACPI_GPIO_IRQ_EDGE_BOTH(GPP_D16)"

View File

@ -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();
}