From 03d2ef67d7ca2018785b2ac20403adc8377aa400 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Sat, 26 Apr 2025 23:35:00 +0530 Subject: [PATCH] soc/intel/cmn/hda: Introduce mainboard hook for HDA initialization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit refactors the HDA initialization within the common Intel SoC block to provide mainboard-level customization. A new weak function, mainboard_is_hda_codec_enabled(), is introduced. The `hda_init()` function invokes `azalia_audio_init()` when `CONFIG(SOC_INTEL_COMMON_BLOCK_HDA_VERB)` is enabled and `mainboard_is_hda_codec_enabled()` is also true. The default (weak) implementation of `mainboard_is_hda_codec_enabled()` simply returns `true`, ensuring that the original behavior is maintained for mainboards that do not provide an override. This change allows specific mainboards to implement their own `mainboard_is_hda_codec_enabled()` to specify if hardware design has support for HDA codec depending upon the firmware config (FW_CONFIG) for the audio subsystem. BUG=b:413638298 TEST=Able to build and boot google/fatcat. Change-Id: Ided1413e828f6bc3421e538a969c38e15b5f3116 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/87461 Tested-by: build bot (Jenkins) Reviewed-by: Jamie Ryu Reviewed-by: Pranava Y N Reviewed-by: Jérémy Compostella Reviewed-by: Kapil Porwal --- src/soc/intel/common/block/hda/hda.c | 12 ++++++++++-- src/soc/intel/common/block/include/intelblocks/hda.h | 11 +++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 src/soc/intel/common/block/include/intelblocks/hda.h diff --git a/src/soc/intel/common/block/hda/hda.c b/src/soc/intel/common/block/hda/hda.c index d68c5b6998..028b9eaacf 100644 --- a/src/soc/intel/common/block/hda/hda.c +++ b/src/soc/intel/common/block/hda/hda.c @@ -1,13 +1,21 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -#include #include +#include #include #include +#include + +/* Mainboard overrides. */ + +__weak bool mainboard_is_hda_codec_enabled(void) +{ + return true; +} static void hda_init(struct device *dev) { - if (CONFIG(SOC_INTEL_COMMON_BLOCK_HDA_VERB)) + if (CONFIG(SOC_INTEL_COMMON_BLOCK_HDA_VERB) && mainboard_is_hda_codec_enabled()) azalia_audio_init(dev); } diff --git a/src/soc/intel/common/block/include/intelblocks/hda.h b/src/soc/intel/common/block/include/intelblocks/hda.h new file mode 100644 index 0000000000..2cbaf206cb --- /dev/null +++ b/src/soc/intel/common/block/include/intelblocks/hda.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef SOC_INTEL_COMMON_BLOCK_HDA_H +#define SOC_INTEL_COMMON_BLOCK_HDA_H + +/* Mainboard overrides. */ + +/* Mainboard hooks to convey if HD-Audio codec is supported */ +bool mainboard_is_hda_codec_enabled(void); + +#endif /* SOC_INTEL_COMMON_BLOCK_HDA_H */