diff options
author | Angel Pons <th3fanbus@gmail.com> | 2021-11-10 16:52:16 +0100 |
---|---|---|
committer | Paul Fagerburg <pfagerburg@chromium.org> | 2021-11-11 22:42:10 +0000 |
commit | d0f053eb9d6f3013788eb3931cbb5b7f433fa954 (patch) | |
tree | 807d485ef8714bc790a00dee237d1bacf61b3a5c /src/southbridge/intel | |
parent | 6db243acd0331e148de83314ba4ae58bfd1174fe (diff) |
sb/intel: Use `azalia_program_verb_table()` function
Use the `azalia_program_verb_table()` function in preparation to
deduplicate Azalia init code.
With this change, the "Azalia: verb loaded." message is now printed when
programming the verbs failed. This will be addressed once `codec_init()`
has been deduplicated.
Change-Id: I5d9e0f19429620166f2a6ef48ec7c963ee64b59c
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/59105
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Diffstat (limited to 'src/southbridge/intel')
-rw-r--r-- | src/southbridge/intel/bd82x6x/azalia.c | 21 | ||||
-rw-r--r-- | src/southbridge/intel/i82801gx/azalia.c | 11 | ||||
-rw-r--r-- | src/southbridge/intel/i82801ix/azalia.c | 21 | ||||
-rw-r--r-- | src/southbridge/intel/i82801jx/azalia.c | 21 | ||||
-rw-r--r-- | src/southbridge/intel/ibexpeak/azalia.c | 21 |
5 files changed, 9 insertions, 86 deletions
diff --git a/src/southbridge/intel/bd82x6x/azalia.c b/src/southbridge/intel/bd82x6x/azalia.c index 1e58dfd319..7bcba024b8 100644 --- a/src/southbridge/intel/bd82x6x/azalia.c +++ b/src/southbridge/intel/bd82x6x/azalia.c @@ -90,7 +90,6 @@ static void codec_init(struct device *dev, u8 *base, int addr) u32 reg32; const u32 *verb; u32 verb_size; - int i; printk(BIOS_DEBUG, "Azalia: Initializing codec #%d\n", addr); @@ -120,15 +119,7 @@ static void codec_init(struct device *dev, u8 *base, int addr) printk(BIOS_DEBUG, "Azalia: verb_size: %d\n", verb_size); /* 3 */ - for (i = 0; i < verb_size; i++) { - if (wait_for_ready(base) < 0) - return; - - write32(base + HDA_IC_REG, verb[i]); - - if (wait_for_valid(base) < 0) - return; - } + azalia_program_verb_table(base, verb, verb_size); printk(BIOS_DEBUG, "Azalia: verb loaded.\n"); } @@ -140,15 +131,7 @@ static void codecs_init(struct device *dev, u8 *base, u32 codec_mask) codec_init(dev, base, i); } - for (i = 0; i < pc_beep_verbs_size; i++) { - if (wait_for_ready(base) < 0) - return; - - write32(base + HDA_IC_REG, pc_beep_verbs[i]); - - if (wait_for_valid(base) < 0) - return; - } + azalia_program_verb_table(base, pc_beep_verbs, pc_beep_verbs_size); } static void azalia_init(struct device *dev) diff --git a/src/southbridge/intel/i82801gx/azalia.c b/src/southbridge/intel/i82801gx/azalia.c index cc5d3455c7..1f12650c1c 100644 --- a/src/southbridge/intel/i82801gx/azalia.c +++ b/src/southbridge/intel/i82801gx/azalia.c @@ -88,7 +88,6 @@ static void codec_init(struct device *dev, u8 *base, int addr) u32 reg32; const u32 *verb; u32 verb_size; - int i; printk(BIOS_DEBUG, "Azalia: Initializing codec #%d\n", addr); @@ -118,15 +117,7 @@ static void codec_init(struct device *dev, u8 *base, int addr) printk(BIOS_DEBUG, "Azalia: verb_size: %d\n", verb_size); /* 3 */ - for (i = 0; i < verb_size; i++) { - if (wait_for_ready(base) < 0) - return; - - write32(base + HDA_IC_REG, verb[i]); - - if (wait_for_valid(base) < 0) - return; - } + azalia_program_verb_table(base, verb, verb_size); printk(BIOS_DEBUG, "Azalia: verb loaded.\n"); } diff --git a/src/southbridge/intel/i82801ix/azalia.c b/src/southbridge/intel/i82801ix/azalia.c index 2646cbc72b..ca1b0b333f 100644 --- a/src/southbridge/intel/i82801ix/azalia.c +++ b/src/southbridge/intel/i82801ix/azalia.c @@ -87,7 +87,6 @@ static void codec_init(struct device *dev, u8 *base, int addr) u32 reg32; const u32 *verb; u32 verb_size; - int i; printk(BIOS_DEBUG, "Azalia: Initializing codec #%d\n", addr); @@ -117,15 +116,7 @@ static void codec_init(struct device *dev, u8 *base, int addr) printk(BIOS_DEBUG, "Azalia: verb_size: %d\n", verb_size); /* 3 */ - for (i = 0; i < verb_size; i++) { - if (wait_for_ready(base) < 0) - return; - - write32(base + HDA_IC_REG, verb[i]); - - if (wait_for_valid(base) < 0) - return; - } + azalia_program_verb_table(base, verb, verb_size); printk(BIOS_DEBUG, "Azalia: verb loaded.\n"); } @@ -138,15 +129,7 @@ static void codecs_init(struct device *dev, u8 *base, u32 codec_mask) codec_init(dev, base, i); } - for (i = 0; i < pc_beep_verbs_size; i++) { - if (wait_for_ready(base) < 0) - return; - - write32(base + HDA_IC_REG, pc_beep_verbs[i]); - - if (wait_for_valid(base) < 0) - return; - } + azalia_program_verb_table(base, pc_beep_verbs, pc_beep_verbs_size); } static void azalia_init(struct device *dev) diff --git a/src/southbridge/intel/i82801jx/azalia.c b/src/southbridge/intel/i82801jx/azalia.c index 500c004ff1..8862628e7c 100644 --- a/src/southbridge/intel/i82801jx/azalia.c +++ b/src/southbridge/intel/i82801jx/azalia.c @@ -87,7 +87,6 @@ static void codec_init(struct device *dev, u8 *base, int addr) u32 reg32; const u32 *verb; u32 verb_size; - int i; printk(BIOS_DEBUG, "Azalia: Initializing codec #%d\n", addr); @@ -117,15 +116,7 @@ static void codec_init(struct device *dev, u8 *base, int addr) printk(BIOS_DEBUG, "Azalia: verb_size: %d\n", verb_size); /* 3 */ - for (i = 0; i < verb_size; i++) { - if (wait_for_ready(base) < 0) - return; - - write32(base + HDA_IC_REG, verb[i]); - - if (wait_for_valid(base) < 0) - return; - } + azalia_program_verb_table(base, verb, verb_size); printk(BIOS_DEBUG, "Azalia: verb loaded.\n"); } @@ -138,15 +129,7 @@ static void codecs_init(struct device *dev, u8 *base, u32 codec_mask) codec_init(dev, base, i); } - for (i = 0; i < pc_beep_verbs_size; i++) { - if (wait_for_ready(base) < 0) - return; - - write32(base + HDA_IC_REG, pc_beep_verbs[i]); - - if (wait_for_valid(base) < 0) - return; - } + azalia_program_verb_table(base, pc_beep_verbs, pc_beep_verbs_size); } static void azalia_init(struct device *dev) diff --git a/src/southbridge/intel/ibexpeak/azalia.c b/src/southbridge/intel/ibexpeak/azalia.c index 5eb1ac3633..54fb3be71c 100644 --- a/src/southbridge/intel/ibexpeak/azalia.c +++ b/src/southbridge/intel/ibexpeak/azalia.c @@ -86,7 +86,6 @@ static void codec_init(struct device *dev, u8 *base, int addr) u32 reg32; const u32 *verb; u32 verb_size; - int i; printk(BIOS_DEBUG, "Azalia: Initializing codec #%d\n", addr); @@ -116,15 +115,7 @@ static void codec_init(struct device *dev, u8 *base, int addr) printk(BIOS_DEBUG, "Azalia: verb_size: %d\n", verb_size); /* 3 */ - for (i = 0; i < verb_size; i++) { - if (wait_for_ready(base) < 0) - return; - - write32(base + HDA_IC_REG, verb[i]); - - if (wait_for_valid(base) < 0) - return; - } + azalia_program_verb_table(base, verb, verb_size); printk(BIOS_DEBUG, "Azalia: verb loaded.\n"); } @@ -137,15 +128,7 @@ static void codecs_init(struct device *dev, u8 *base, u32 codec_mask) codec_init(dev, base, i); } - for (i = 0; i < pc_beep_verbs_size; i++) { - if (wait_for_ready(base) < 0) - return; - - write32(base + HDA_IC_REG, pc_beep_verbs[i]); - - if (wait_for_valid(base) < 0) - return; - } + azalia_program_verb_table(base, pc_beep_verbs, pc_beep_verbs_size); } static void azalia_init(struct device *dev) |