summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrankChu <frank_chu@pegatron.corp-partner.google.com>2022-02-07 16:52:59 +0800
committerFelix Held <felix-coreboot@felixheld.de>2022-02-10 12:51:41 +0000
commita3b79c5063bbc1cc97fb82a90a7d3e19f176dc8f (patch)
tree31cc5c0fbf3b8c6c8be49159f9b1d9e426e94895 /src
parent6e122455bd359686bf2d55193ba10fe2c3d410fa (diff)
mb/google/volteer/var/drobit: 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:204517112 BRANCH=volteer TEST=ALC5682-VD/ALC5682I-VS audio codec can work Signed-off-by: Frank Chu <frank_chu@pegatron.corp-partner.google.com> Change-Id: I5c1c9819af1e0bc2278dadeffb6b19c3f9068f30 Reviewed-on: https://review.coreboot.org/c/coreboot/+/61675 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Diffstat (limited to 'src')
-rw-r--r--src/mainboard/google/volteer/variants/drobit/Makefile.inc2
-rw-r--r--src/mainboard/google/volteer/variants/drobit/overridetree.cb11
-rw-r--r--src/mainboard/google/volteer/variants/drobit/variant.c22
3 files changed, 33 insertions, 2 deletions
diff --git a/src/mainboard/google/volteer/variants/drobit/Makefile.inc b/src/mainboard/google/volteer/variants/drobit/Makefile.inc
index 3454eec965..4919fcd4e1 100644
--- a/src/mainboard/google/volteer/variants/drobit/Makefile.inc
+++ b/src/mainboard/google/volteer/variants/drobit/Makefile.inc
@@ -6,3 +6,5 @@ bootblock-y += gpio.c
ramstage-y += gpio.c
ramstage-y += ramstage.c
+
+ramstage-y += variant.c
diff --git a/src/mainboard/google/volteer/variants/drobit/overridetree.cb b/src/mainboard/google/volteer/variants/drobit/overridetree.cb
index a31017e83d..08b95f85a6 100644
--- a/src/mainboard/google/volteer/variants/drobit/overridetree.cb
+++ b/src/mainboard/google/volteer/variants/drobit/overridetree.cb
@@ -1,3 +1,10 @@
+fw_config
+ field AUDIO_CODEC_SOURCE 41 43
+ option AUDIO_CODEC_UNPROVISIONED 0
+ option AUDIO_CODEC_ALC5682 1
+ option AUDIO_CODEC_ALC5682I_VS 2
+ end
+end
chip soc/intel/tigerlake
register "DdiPort1Hpd" = "0"
register "DdiPort2Hpd" = "0"
@@ -124,7 +131,7 @@ chip soc/intel/tigerlake
device ref i2c0 on
chip drivers/i2c/generic
- register "hid" = ""10EC5682""
+ # register "hid" is set in variant.c because of FW_CONFIG
register "name" = ""RT58""
register "desc" = ""Headset Codec""
register "irq_gpio" = "ACPI_GPIO_IRQ_EDGE_BOTH(GPP_F8)"
@@ -133,7 +140,7 @@ chip soc/intel/tigerlake
register "property_list[0].type" = "ACPI_DP_TYPE_INTEGER"
register "property_list[0].name" = ""realtek,jd-src""
register "property_list[0].integer" = "1"
- device i2c 1a on end
+ device i2c 1a alias audio_codec on end
end
chip drivers/i2c/max98373
register "vmon_slot_no" = "0"
diff --git a/src/mainboard/google/volteer/variants/drobit/variant.c b/src/mainboard/google/volteer/variants/drobit/variant.c
new file mode 100644
index 0000000000..3effcdf4d8
--- /dev/null
+++ b/src/mainboard/google/volteer/variants/drobit/variant.c
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include <baseboard/variants.h>
+#include <fw_config.h>
+#include <drivers/i2c/hid/chip.h>
+#include <device/device.h>
+
+static void audio_codec_update(void)
+{
+ struct device *codec = DEV_PTR(audio_codec);
+ struct drivers_i2c_generic_config *config;
+
+ config = codec->chip_info;
+ if (fw_config_probe(FW_CONFIG(AUDIO_CODEC_SOURCE, AUDIO_CODEC_ALC5682)))
+ config->hid = "10EC5682";
+ else
+ config->hid = "RTL5682";
+}
+void variant_devtree_update(void)
+{
+ audio_codec_update();
+}