From 985009ad140698f92dc0fdf47622e2f759f13e6a Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Tue, 16 Feb 2021 10:10:53 +0100 Subject: [PATCH] soc/intel/common/block/hda: Use azalia device code The code is already compiled in on all platforms. Use it as it provides the same functionality. Note that GCAP is no longer R/WO on these platforms. However, select `AZALIA_LOCK_DOWN_R_WO_GCAP` just in case. This will be dropped in a follow-up. Tested on Prodrive Hermes, still detects and initializes both codecs. Change-Id: I75424559b2b4aca63fb23bf4f8d5074aa1e1bb31 Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/c/coreboot/+/50795 Reviewed-by: Christian Walter Reviewed-by: Angel Pons Reviewed-by: Tim Wawrzynczak Tested-by: build bot (Jenkins) --- src/soc/intel/common/block/hda/Kconfig | 4 +++ src/soc/intel/common/block/hda/hda.c | 41 ++------------------------ 2 files changed, 6 insertions(+), 39 deletions(-) diff --git a/src/soc/intel/common/block/hda/Kconfig b/src/soc/intel/common/block/hda/Kconfig index a2209ab3ce..a01ede4ac6 100644 --- a/src/soc/intel/common/block/hda/Kconfig +++ b/src/soc/intel/common/block/hda/Kconfig @@ -6,5 +6,9 @@ config SOC_INTEL_COMMON_BLOCK_HDA config SOC_INTEL_COMMON_BLOCK_HDA_VERB bool depends on SOC_INTEL_COMMON_BLOCK_HDA + select AZALIA_LOCK_DOWN_R_WO_GCAP help Enable initialization of HDA codecs. + +config AZALIA_MAX_CODECS + default 4 if SOC_INTEL_COMMON_BLOCK_HDA_VERB diff --git a/src/soc/intel/common/block/hda/hda.c b/src/soc/intel/common/block/hda/hda.c index ece06caaeb..3aa2ad78bc 100644 --- a/src/soc/intel/common/block/hda/hda.c +++ b/src/soc/intel/common/block/hda/hda.c @@ -1,58 +1,21 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -#include #include #include #include #include -#include -#include - -#if CONFIG(SOC_INTEL_COMMON_BLOCK_HDA_VERB) -static void codecs_init(uint8_t *base, u32 codec_mask) -{ - int i; - - /* Can support up to 4 codecs */ - for (i = 3; i >= 0; i--) { - if (codec_mask & (1 << i)) - hda_codec_init(base, i, - cim_verb_data_size, cim_verb_data); - } - - if (pc_beep_verbs_size) - hda_codec_write(base, pc_beep_verbs_size, pc_beep_verbs); -} static void hda_init(struct device *dev) { - struct resource *res; - int codec_mask; - uint8_t *base; - - res = find_resource(dev, PCI_BASE_ADDRESS_0); - if (!res) - return; - - base = res2mmio(res, 0, 0); - if (!base) - return; - - codec_mask = hda_codec_detect(base); - if (codec_mask) { - printk(BIOS_INFO, "HDA: codec_mask = %02x\n", codec_mask); - codecs_init(base, codec_mask); - } + if (CONFIG(SOC_INTEL_COMMON_BLOCK_HDA_VERB)) + azalia_audio_init(dev); } -#endif static struct device_operations hda_ops = { .read_resources = pci_dev_read_resources, .set_resources = pci_dev_set_resources, .enable_resources = pci_dev_enable_resources, -#if CONFIG(SOC_INTEL_COMMON_BLOCK_HDA_VERB) .init = hda_init, -#endif .ops_pci = &pci_dev_ops_pci, .scan_bus = scan_static_bus };