From 797bc1b8e4a6a8497be8c5e2d5db57e6071579fb Mon Sep 17 00:00:00 2001 From: Malik_Hsu Date: Wed, 17 Nov 2021 09:47:16 +0800 Subject: mb/google/brya/variants/primus: add fw_config_probe for ALC5682I-VS Added fw_config_probe method to distinguish different audio codecs to facilitate the use of different topology files by the OS. BUG=b:205883511 TEST=emerge-brya coreboot chromeos-bootimage and check audio function Signed-off-by: Malik_Hsu Change-Id: I0d5b95e89154b2cb6b371f24cc1b151c23ff642f Reviewed-on: https://review.coreboot.org/c/coreboot/+/59367 Tested-by: build bot (Jenkins) Reviewed-by: Tim Wawrzynczak --- src/mainboard/google/brya/variants/primus/fw_config.c | 7 +++++++ src/mainboard/google/brya/variants/primus/overridetree.cb | 2 ++ src/mainboard/google/brya/variants/primus/variant.c | 5 +++-- 3 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mainboard/google/brya/variants/primus/fw_config.c b/src/mainboard/google/brya/variants/primus/fw_config.c index 0beedc7941..c9b4a38be5 100644 --- a/src/mainboard/google/brya/variants/primus/fw_config.c +++ b/src/mainboard/google/brya/variants/primus/fw_config.c @@ -80,5 +80,12 @@ static void fw_config_handle(void *unused) gpio_configure_pads(i2s_enable_pads, ARRAY_SIZE(i2s_enable_pads)); gpio_configure_pads(bt_i2s_enable_pads, ARRAY_SIZE(bt_i2s_enable_pads)); } + + if (fw_config_probe(FW_CONFIG(AUDIO, MAX98360_ALC5682I_VS_I2S))) { + printk(BIOS_INFO, "Configure audio over I2S with MAX98360 ALC5682I-VS.\n"); + gpio_configure_pads(dmic_enable_pads, ARRAY_SIZE(dmic_enable_pads)); + gpio_configure_pads(i2s_enable_pads, ARRAY_SIZE(i2s_enable_pads)); + gpio_configure_pads(bt_i2s_enable_pads, ARRAY_SIZE(bt_i2s_enable_pads)); + } } BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE, BS_ON_ENTRY, fw_config_handle, NULL); diff --git a/src/mainboard/google/brya/variants/primus/overridetree.cb b/src/mainboard/google/brya/variants/primus/overridetree.cb index 48319b7f5b..ddb78c0ca7 100644 --- a/src/mainboard/google/brya/variants/primus/overridetree.cb +++ b/src/mainboard/google/brya/variants/primus/overridetree.cb @@ -14,6 +14,7 @@ fw_config field AUDIO 8 10 option AUDIO_UNKNOWN 0 option MAX98360_ALC5682I_I2S 1 + option MAX98360_ALC5682I_VS_I2S 2 end field DB_LTE 11 12 option LTE_ABSENT 0 @@ -184,6 +185,7 @@ chip soc/intel/alderlake register "property_list[0].integer" = "1" device i2c 1a alias audio_codec on probe AUDIO MAX98360_ALC5682I_I2S + probe AUDIO MAX98360_ALC5682I_VS_I2S end end end #I2C0 diff --git a/src/mainboard/google/brya/variants/primus/variant.c b/src/mainboard/google/brya/variants/primus/variant.c index b783ac08e7..e10648d6c3 100644 --- a/src/mainboard/google/brya/variants/primus/variant.c +++ b/src/mainboard/google/brya/variants/primus/variant.c @@ -4,6 +4,7 @@ #include #include #include +#include static void devtree_update_emmc_rtd3(uint32_t board_ver) { @@ -22,8 +23,8 @@ static void devtree_update_audio_codec(uint32_t board_ver) if (board_ver <= 1) return; - config->hid = "RTL5682"; - audio_codec->enabled = 1; + if (fw_config_probe(FW_CONFIG(AUDIO, MAX98360_ALC5682I_VS_I2S))) + config->hid = "RTL5682"; } void variant_devtree_update(void) -- cgit v1.2.3