From e545494f6d74618fb418cd04dab49c7fd557c003 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Sat, 26 Apr 2025 23:57:09 +0530 Subject: [PATCH] mb/google/fatcat/var/fatcat: Conditionally init ALC256 HDA This commit implements `mainboard_is_hda_codec_enabled()` for the Google Fatcat mainboard variant. This overrides the default weak HDA common initialization. Initialization of the High Definition Audio (HDA) controller, managed by `azalia_audio_init()` (which handles HDA verb table loading), is now conditional. It proceeds only if the firmware config `FW_CONFIG(AUDIO, AUDIO_ALC256_HDA)` is set. This value (3) specifically targets the ALC256 HDA codec. This change ensures that HDA verb tables are loaded only when the ALC256 HDA codec is actively configured for the Fatcat variant. Crucially, this prevents attempts to incorrectly load HDA verbs for other audio interfaces, like SoundWire (SNDW) or I2S, which might be present in different Fatcat hardware configurations. The header file `intelblocks/hda.h` added for this. As a minor stylistic update, header inclusions in this file are also alphabetized. BUG=b:413638298 TEST=Verified HDA verb table loading is skipped on Fatcat platforms when configured with non-HDA audio codecs (e.g., SNDW, I2S), and proceeds as expected when ALC256 HDA is configured. Change-Id: Ifc158b7d15c763cc07d28154259b7e64709bea16 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/87462 Tested-by: build bot (Jenkins) Reviewed-by: Kapil Porwal Reviewed-by: Pranava Y N --- .../google/fatcat/variants/fatcat/variant.c | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/mainboard/google/fatcat/variants/fatcat/variant.c b/src/mainboard/google/fatcat/variants/fatcat/variant.c index 3e0ee54505..a3d7e79e65 100644 --- a/src/mainboard/google/fatcat/variants/fatcat/variant.c +++ b/src/mainboard/google/fatcat/variants/fatcat/variant.c @@ -1,12 +1,13 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include +#include #include #include #include +#include #include #include -#include const char *get_wifi_sar_cbfs_filename(void) { @@ -93,3 +94,22 @@ bool variant_is_barrel_charger_present(void) else return false; } + +/* + * HDA verb table loading is supported based on the firmware configuration. + * + * This function determines if the current platform has an HDA codec enabled by + * examining the `FW_CONFIG` value. Specifically, it checks if the + * `FW_CONFIG` includes the `AUDIO_ALC256_HDA` value, which is used to identify + * Fatcat SKUs with HDA codec support. + * + * Return true if the `FW_CONFIG` indicates HDA support (i.e., contains + * `AUDIO_ALC256_HDA`), false otherwise. + */ +bool mainboard_is_hda_codec_enabled(void) +{ + if (fw_config_probe(FW_CONFIG(AUDIO, AUDIO_ALC256_HDA))) + return true; + + return false; +}