diff options
Diffstat (limited to 'src/mainboard/google/dedede/variants')
3 files changed, 46 insertions, 1 deletions
diff --git a/src/mainboard/google/dedede/variants/sasukette/Makefile.inc b/src/mainboard/google/dedede/variants/sasukette/Makefile.inc index fd60a18b69..74121943dd 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 0624a0ebbb..c7636a8861 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 @@ chip soc/intel/jasperlake 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 0000000000..2f714ff03e --- /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(); +} |