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 <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/50795
Reviewed-by: Christian Walter <christian.walter@9elements.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Patrick Rudolph 2021-02-16 10:10:53 +01:00 committed by Felix Held
parent b46ec389bd
commit 985009ad14
2 changed files with 6 additions and 39 deletions

View File

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

View File

@ -1,58 +1,21 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <console/console.h>
#include <device/device.h>
#include <device/azalia_device.h>
#include <device/pci.h>
#include <device/pci_ids.h>
#include <soc/intel/common/hda_verb.h>
#include <soc/ramstage.h>
#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
};