Frank Wu has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/58830 )
Change subject: mb/google/zork/var/vilboz: Add fw_config probe for ALC5682-VD & VS ......................................................................
mb/google/zork/var/vilboz: Add fw_config probe for ALC5682-VD & VS
ALC5682-VD/ALC5682I-VS load different kernel driver by different hid name. Update hid name depending on the AUDIO_CODEC_SOURCE field of fw_config. Define FW_CONFIG bits 36 - 37 (SSFC bits 4 - 5) for codec selection.
ALC5682-VD: _HID = "10EC5682" ALC5682I-VS: _HID = "RTL5682"
BUG=b:200103232, b:195042130 BRANCH=firmware-zork-13434.B TEST=ALC5682-VD/ALC5682I-VS audio codec can work
Signed-off-by: Frank Wu frank_wu@compal.corp-partner.google.com Change-Id: Idf0119edf90a3372c8a34f708a7aac11c0188b76 --- M src/mainboard/google/zork/variants/baseboard/helpers.c M src/mainboard/google/zork/variants/vilboz/overridetree.cb M src/mainboard/google/zork/variants/vilboz/variant.c 3 files changed, 40 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/30/58830/1
diff --git a/src/mainboard/google/zork/variants/baseboard/helpers.c b/src/mainboard/google/zork/variants/baseboard/helpers.c index d6c5e48..7057a48 100644 --- a/src/mainboard/google/zork/variants/baseboard/helpers.c +++ b/src/mainboard/google/zork/variants/baseboard/helpers.c @@ -55,6 +55,9 @@ /* Audio AMP type */ FW_CONFIG_MASK_AUDIO_AMP = 0x1, FW_CONFIG_SHIFT_AUDIO_AMP = 35, + /* Audio codec type */ + FW_CONFIG_MASK_AUDIO_CODEC_SOURCE = 0x3, + FW_CONFIG_SHIFT_AUDIO_CODEC_SOURCE = 36, };
static int get_fw_config(uint64_t *val) diff --git a/src/mainboard/google/zork/variants/vilboz/overridetree.cb b/src/mainboard/google/zork/variants/vilboz/overridetree.cb index 1e83f6f..f9a9a74 100644 --- a/src/mainboard/google/zork/variants/vilboz/overridetree.cb +++ b/src/mainboard/google/zork/variants/vilboz/overridetree.cb @@ -5,6 +5,10 @@ option AUDIO_AMP_I2C_MODE 0 option AUDIO_AMP_AUTO_MODE 1 end + field AUDIO_CODEC_SOURCE 36 37 + option AUDIO_CODEC_ALC5682 0 + option AUDIO_CODEC_ALC5682I_VS 1 + end end
chip soc/amd/picasso diff --git a/src/mainboard/google/zork/variants/vilboz/variant.c b/src/mainboard/google/zork/variants/vilboz/variant.c index 43ca0e5..47b60ac 100644 --- a/src/mainboard/google/zork/variants/vilboz/variant.c +++ b/src/mainboard/google/zork/variants/vilboz/variant.c @@ -5,6 +5,10 @@ #include <fw_config.h> #include <sar.h> #include "chip.h" +#include <drivers/i2c/generic/chip.h> +#include <device/device.h> +#include <device/path.h> +#include <console/console.h>
static const fsp_ddi_descriptor hdmi_ddi_descriptors[] = { { // DDI0, DP0, eDP @@ -35,6 +39,33 @@ *ddi_num = ARRAY_SIZE(hdmi_ddi_descriptors); }
+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 = LPC_DEVFN}, + {.type = DEVICE_PATH_PNP, .pnp.port = 0xc09, .pnp.device = 0}, + {.type = DEVICE_PATH_GENERIC, .generic.id = 0}, + {.type = DEVICE_PATH_I2C, .i2c.device = 0x1a, .i2c.mode_10bit = I2C_MODE_7_BIT } + }; + + 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"; + printk(BIOS_INFO, "Configure audio codec, config->hid %s\n", config->hid); +} + void variant_devtree_update(void) { struct soc_amd_picasso_config *soc_cfg; @@ -57,6 +88,8 @@ soc_cfg->edp_tuningset.deemph_6db4 = 0x00; soc_cfg->edp_tuningset.boostadj = 0x80; } + + audio_codec_update(); }
/*