summaryrefslogtreecommitdiff
path: root/src/mainboard/google/dedede
diff options
context:
space:
mode:
authorZhi Li <lizhi7@huaqin.corp-partner.google.com>2021-08-12 16:29:52 +0800
committerFelix Held <felix-coreboot@felixheld.de>2021-08-18 14:23:33 +0000
commit1473fc75eb0e7e6b4c55acfa385d76a7cbbbd76c (patch)
tree0e5945758a0095b2daa9ee6b189c00e7095c5a32 /src/mainboard/google/dedede
parent87f20739bbdf8c8bd2195ad7d836721e08d133f3 (diff)
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>
Diffstat (limited to 'src/mainboard/google/dedede')
-rw-r--r--src/mainboard/google/dedede/variants/sasukette/Makefile.inc1
-rw-r--r--src/mainboard/google/dedede/variants/sasukette/overridetree.cb11
-rw-r--r--src/mainboard/google/dedede/variants/sasukette/ramstage.c35
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();
+}