Subrata Banik has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/87461?usp=email )
Change subject: soc/intel/cmn/hda: Introduce mainboard hook for HDA initialization ......................................................................
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_hda_init(struct device *dev)`, is introduced. The `hda_init()` function, when `CONFIG(SOC_INTEL_COMMON_BLOCK_HDA_VERB)` is enabled, now calls this weak function instead of directly invoking `azalia_audio_init()`.
The default (weak) implementation of `mainboard_hda_init()` simply calls `azalia_audio_init()`, 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_hda_init()` to perform custom HDA setup or apply board-specific configurations 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 --- M src/soc/intel/common/block/hda/hda.c A src/soc/intel/common/block/include/intelblocks/hda.h 2 files changed, 22 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/61/87461/1
diff --git a/src/soc/intel/common/block/hda/hda.c b/src/soc/intel/common/block/hda/hda.c index d68c5b6..88d01b0 100644 --- a/src/soc/intel/common/block/hda/hda.c +++ b/src/soc/intel/common/block/hda/hda.c @@ -1,14 +1,21 @@ /* SPDX-License-Identifier: GPL-2.0-only */
-#include <device/device.h> #include <device/azalia_device.h> #include <device/pci.h> #include <device/pci_ids.h> +#include <intelblocks/hda.h> + +/* Mainboard overrides. */ + +__weak void mainboard_hda_init(struct device *dev) +{ + azalia_audio_init(dev); +}
static void hda_init(struct device *dev) { if (CONFIG(SOC_INTEL_COMMON_BLOCK_HDA_VERB)) - azalia_audio_init(dev); + mainboard_hda_init(dev); }
struct device_operations hda_ops = { 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 0000000..61768b6 --- /dev/null +++ b/src/soc/intel/common/block/include/intelblocks/hda.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef SOC_INTEL_COMMON_BLOCK_HDA_H +#define SOC_INTEL_COMMON_BLOCK_HDA_H + +#include <device/device.h> + +/* Mainboard overrides. */ + +/* Mainboard handler for to perform HD-Audio Init */ +void mainboard_hda_init(struct device *dev); + +#endif /* SOC_INTEL_COMMON_BLOCK_HDA_H */