summaryrefslogtreecommitdiff
path: root/src/mainboard/google/volteer/variants/delbin/variant.c
diff options
context:
space:
mode:
authorFrankChu <frank_chu@pegatron.corp-partner.google.com>2021-11-23 12:09:49 +0800
committerTim Wawrzynczak <twawrzynczak@chromium.org>2022-01-05 21:41:46 +0000
commitdf1d2b4bb9f0a196ac61ec7cafd16b3428d6f1ac (patch)
tree17a74063c6d21c1b276e4060610583b1f6af4b3d /src/mainboard/google/volteer/variants/delbin/variant.c
parenta265c49eaad2a552ee5b2930573600ecd7accbfa (diff)
mb/google/volteer/var/delbin: 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 41 - 43 (SSFC bits 9 - 11) for codec selection. ALC5682-VD: _HID = "10EC5682" ALC5682I-VS: _HID = "RTL5682" BUG=b:204523176 BRANCH=volteer TEST=ALC5682-VD/ALC5682I-VS audio codec can work Signed-off-by: FrankChu <frank_chu@pegatron.corp-partner.google.com> Change-Id: Ieef638f78edd3428e572a76f06fb9c8757278971 Reviewed-on: https://review.coreboot.org/c/coreboot/+/59557 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Nick Vaccaro <nvaccaro@google.com>
Diffstat (limited to 'src/mainboard/google/volteer/variants/delbin/variant.c')
-rw-r--r--src/mainboard/google/volteer/variants/delbin/variant.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/mainboard/google/volteer/variants/delbin/variant.c b/src/mainboard/google/volteer/variants/delbin/variant.c
new file mode 100644
index 0000000000..f502a1a129
--- /dev/null
+++ b/src/mainboard/google/volteer/variants/delbin/variant.c
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include <baseboard/variants.h>
+#include <fw_config.h>
+#include <drivers/i2c/generic/chip.h>
+#include <soc/pci_devs.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_I2C0},
+ {.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();
+}