summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNico Huber <nico.h@gmx.de>2024-07-21 12:47:34 +0200
committerMartin L Roth <gaumless@gmail.com>2024-10-16 15:19:49 +0000
commita53b77effb84b7b3781275e7c37ec58e0c0ac148 (patch)
treec934fcb0df36cedc80f286fbaa749977720fd86f
parent9fe0ad0e21fcea6aa1417578794ffbfca58da395 (diff)
device/azalia: Clear busy bit after failed verb command
The spec tells us to clear the busy bit manually after a timeout. Do that and wait immediately, to detect further issues early. Also fix some related comments and prints: Failures shouldn't be debug messa- ges. And we are talking to the PIO interface of the controller, not the codec. So this was never about the codec being ready. Change-Id: I4b737f8259157c01bfcd9e6631cc15d39c653d06 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/83592 Reviewed-by: Nicholas Sudsgaard <devel+coreboot@nsudsgaard.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r--src/device/azalia_device.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/device/azalia_device.c b/src/device/azalia_device.c
index c167373764..dadcda918e 100644
--- a/src/device/azalia_device.c
+++ b/src/device/azalia_device.c
@@ -155,10 +155,8 @@ u32 azalia_find_verb(const u32 *verb_table, u32 verb_table_bytes, u32 viddid, co
}
/*
- * Wait 50usec for the codec to indicate it is ready.
- * No response would imply that the codec is non-operative.
+ * Wait 50usec for the controller to indicate it is ready.
*/
-
static int wait_for_ready(u8 *base)
{
struct stopwatch sw;
@@ -179,7 +177,6 @@ static int wait_for_ready(u8 *base)
* Wait for the codec to indicate that it accepted the previous command.
* No response would imply that the codec is non-operative.
*/
-
static int wait_for_valid(u8 *base)
{
struct stopwatch sw;
@@ -206,6 +203,16 @@ static int wait_for_valid(u8 *base)
udelay(1);
}
+ /*
+ * HDA spec 1.0a "3.4.3 Offset 68h: Immediate Command Status"
+ * tells us to clear the busy bit explicitly, then poll until
+ * the controller is ready.
+ */
+ write32(base + HDA_ICII_REG, 0);
+ if (wait_for_ready(base) < 0) {
+ printk(BIOS_WARNING, "azalia_audio: controller is unresponsive.\n");
+ return -2;
+ }
return -1;
}
@@ -238,7 +245,7 @@ __weak void mainboard_azalia_program_runtime_verbs(u8 *base, u32 viddid)
static bool codec_is_operative(u8 *base, const int addr)
{
if (wait_for_ready(base) < 0) {
- printk(BIOS_DEBUG, "azalia_audio: codec #%d not ready\n", addr);
+ printk(BIOS_WARNING, "azalia_audio: controller not ready\n");
return false;
}
@@ -246,7 +253,7 @@ static bool codec_is_operative(u8 *base, const int addr)
write32(base + HDA_IC_REG, reg32);
if (wait_for_valid(base) < 0) {
- printk(BIOS_DEBUG, "azalia_audio: codec #%d not valid\n", addr);
+ printk(BIOS_NOTICE, "azalia_audio: codec #%d doesn't respond\n", addr);
return false;
}
return true;