Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/51640 )
Change subject: device/azalia_device.c: Introduce AZALIA_MAX_CODECS ......................................................................
device/azalia_device.c: Introduce AZALIA_MAX_CODECS
Add the AZALIA_MAX_CODECS Kconfig option and use it.
Change-Id: Ibb10c2f2992257bc261e6cb35f11cc4b2d956054 Signed-off-by: Angel Pons th3fanbus@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/51640 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Nico Huber nico.h@gmx.de Reviewed-by: Patrick Rudolph siro@das-labor.org --- M src/device/Kconfig M src/device/azalia_device.c 2 files changed, 12 insertions(+), 3 deletions(-)
Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved Patrick Rudolph: Looks good to me, approved
diff --git a/src/device/Kconfig b/src/device/Kconfig index 8dc9ecd..1bfc34a 100644 --- a/src/device/Kconfig +++ b/src/device/Kconfig @@ -519,6 +519,14 @@ bool default n
+config AZALIA_MAX_CODECS + int + depends on AZALIA_PLUGIN_SUPPORT + default 3 + range 1 15 + help + The maximum number of codecs supported on a single HD Audio controller. + config PCIEXP_PLUGIN_SUPPORT bool default y diff --git a/src/device/azalia_device.c b/src/device/azalia_device.c index 1048804..ad0858a 100644 --- a/src/device/azalia_device.c +++ b/src/device/azalia_device.c @@ -50,6 +50,7 @@ static u16 codec_detect(u8 *base) { struct stopwatch sw; + const u16 codec_mask = (1 << CONFIG_AZALIA_MAX_CODECS) - 1; u16 reg16;
if (azalia_exit_reset(base) < 0) @@ -57,7 +58,7 @@
/* clear STATESTS bits (BAR + 0xe)[2:0] */ reg16 = read16(base + HDA_STATESTS_REG); - reg16 |= 7; + reg16 |= codec_mask; write16(base + HDA_STATESTS_REG, reg16);
/* Wait for readback of register to @@ -82,7 +83,7 @@
/* Read in Codec location (BAR + 0xe)[2..0] */ reg16 = read16(base + HDA_STATESTS_REG); - reg16 &= 0x0f; + reg16 &= codec_mask; if (!reg16) goto no_codec;
@@ -265,7 +266,7 @@ { int i;
- for (i = 2; i >= 0; i--) { + for (i = CONFIG_AZALIA_MAX_CODECS - 1; i >= 0; i--) { if (codec_mask & (1 << i)) codec_init(dev, base, i); }