soc/intel/cmn/hda: Introduce mainboard hook for HDA initialization

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 <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/87461
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jamie Ryu <jamie.m.ryu@intel.com>
Reviewed-by: Pranava Y N <pranavayn@google.com>
Reviewed-by: Jérémy Compostella <jeremy.compostella@intel.com>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
This commit is contained in:
Subrata Banik 2025-04-26 23:35:00 +05:30
commit 03d2ef67d7
2 changed files with 21 additions and 2 deletions

View file

@ -1,13 +1,21 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <device/device.h>
#include <device/azalia_device.h>
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ids.h>
#include <intelblocks/hda.h>
/* 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);
}

View file

@ -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 */