device/azalia_device: Add function to program a verb table
On some boards, Azalia configuration depends on config settings that are not known at compile-time. Expose a function to program a verb table, to be used in subsequent commits. Change-Id: Ie9607f6e733df66f0ca26a4bb70e0864ce1d4512 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/50387 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Rudolph <siro@das-labor.org>
This commit is contained in:
parent
2e77443e47
commit
44c431e161
|
@ -188,12 +188,33 @@ static int wait_for_valid(u8 *base)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int azalia_write_verb(u8 *base, u32 verb)
|
||||||
|
{
|
||||||
|
if (wait_for_ready(base) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
write32(base + HDA_IC_REG, verb);
|
||||||
|
|
||||||
|
return wait_for_valid(base);
|
||||||
|
}
|
||||||
|
|
||||||
|
int azalia_program_verb_table(u8 *base, const u32 *verbs, u32 verb_size)
|
||||||
|
{
|
||||||
|
if (!verbs)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
for (u32 i = 0; i < verb_size; i++) {
|
||||||
|
if (azalia_write_verb(base, verbs[i]) < 0)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void codec_init(struct device *dev, u8 *base, int addr)
|
static void codec_init(struct device *dev, u8 *base, int addr)
|
||||||
{
|
{
|
||||||
u32 reg32;
|
u32 reg32;
|
||||||
const u32 *verb;
|
const u32 *verb;
|
||||||
u32 verb_size;
|
u32 verb_size;
|
||||||
int i;
|
|
||||||
|
|
||||||
printk(BIOS_DEBUG, "azalia_audio: Initializing codec #%d\n", addr);
|
printk(BIOS_DEBUG, "azalia_audio: Initializing codec #%d\n", addr);
|
||||||
|
|
||||||
|
@ -223,15 +244,7 @@ static void codec_init(struct device *dev, u8 *base, int addr)
|
||||||
printk(BIOS_DEBUG, "azalia_audio: verb_size: %u\n", verb_size);
|
printk(BIOS_DEBUG, "azalia_audio: verb_size: %u\n", verb_size);
|
||||||
|
|
||||||
/* 3 */
|
/* 3 */
|
||||||
for (i = 0; i < verb_size; i++) {
|
azalia_program_verb_table(base, verb, verb_size);
|
||||||
if (wait_for_ready(base) < 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
write32(base + HDA_IC_REG, verb[i]);
|
|
||||||
|
|
||||||
if (wait_for_valid(base) < 0)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
printk(BIOS_DEBUG, "azalia_audio: verb loaded.\n");
|
printk(BIOS_DEBUG, "azalia_audio: verb loaded.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ int azalia_set_bits(void *port, u32 mask, u32 val);
|
||||||
int azalia_enter_reset(u8 *base);
|
int azalia_enter_reset(u8 *base);
|
||||||
int azalia_exit_reset(u8 *base);
|
int azalia_exit_reset(u8 *base);
|
||||||
u32 azalia_find_verb(const u32 *verb_table, u32 verb_table_bytes, u32 viddid, const u32 **verb);
|
u32 azalia_find_verb(const u32 *verb_table, u32 verb_table_bytes, u32 viddid, const u32 **verb);
|
||||||
|
int azalia_program_verb_table(u8 *base, const u32 *verbs, u32 verb_size);
|
||||||
void azalia_audio_init(struct device *dev);
|
void azalia_audio_init(struct device *dev);
|
||||||
extern struct device_operations default_azalia_audio_ops;
|
extern struct device_operations default_azalia_audio_ops;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue