From: Zeliang Li via B4 Relay <devnull+lizeliang.linux.gmail.com@kernel.org>
To: Shenghao Ding <shenghao-ding@ti.com>, Kevin Lu <kevin-lu@ti.com>,
Baojun Xu <baojun.xu@ti.com>, Sen Wang <sen@ti.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
Zeliang Li <lizeliang.linux@gmail.com>
Subject: [PATCH v2] ALSA: hda/tas2781: Add hardware stabilization delay during firmware load retries
Date: Sat, 15 Aug 2026 03:45:55 +0800 [thread overview]
Message-ID: <20260815-master-v2-1-b4ea03c8b59e@gmail.com> (raw)
From: Zeliang Li <lizeliang.linux@gmail.com>
During runtime resume transitions, loading calibration data blocks
to the tas2781 amplifier may intermittently trigger transmission
failures or block checksum mismatches (-EAGAIN) due to un-stabilized
power rails or I2C bus glitches.
The loop in tasdev_load_blk() decrements block->nr_retry and attempts
an immediate re-transmission upon receiving -EAGAIN. However, without
any inter-retry delay, all available retry slots are exhausted within
less than a microsecond—long before the hardware can physically
settle. This leads to permanent "ERROR_PRAM_CRCCHK" deadlocks and
silent speakers on modern laptops after resuming media.
Fix this cleanly by introducing a 2ms usleep_range() delay directly
inside the tasdev_load_blk() retry paths prior to each 'continue'
statement. This grants the chip sufficient time to stabilize before
the next transmission attempt without introducing unnecessary latency
on final failures.
Signed-off-by: Zeliang Li <lizeliang.linux@gmail.com>
---
sound/soc/codecs/tas2781-fmwlib.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/tas2781-fmwlib.c b/sound/soc/codecs/tas2781-fmwlib.c
index dcbeb9618195..bfabff583d57 100644
--- a/sound/soc/codecs/tas2781-fmwlib.c
+++ b/sound/soc/codecs/tas2781-fmwlib.c
@@ -1849,16 +1849,26 @@ static int tasdev_load_blk(struct tasdevice_priv *tas_priv,
}
}
if (ret == -EAGAIN) {
- if (block->nr_retry > 0)
+ if (block->nr_retry > 0) {
+ /* Give the hardware time to stabilize before
+ * next block re-transmission attempt.
+ */
+ usleep_range(2000, 2500);
continue;
+ }
} else if (ret < 0) /*err in current device, skip it*/
break;
if (block->is_pchksum_present) {
ret = tasdev_block_chksum(tas_priv, block, chn);
if (ret == -EAGAIN) {
- if (block->nr_retry > 0)
+ if (block->nr_retry > 0) {
+ /* Give the bus time to recover after
+ * a checksum mismatch error.
+ */
+ usleep_range(2000, 2500);
continue;
+ }
} else if (ret < 0) /*err in current device, skip it*/
break;
}
---
base-commit: a5161661ae99f497affa83a5b8654e457cda6267
change-id: 20260815-master-a8aeb8653733
Best regards,
--
Zeliang Li <lizeliang.linux@gmail.com>
reply other threads:[~2026-08-14 19:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260815-master-v2-1-b4ea03c8b59e@gmail.com \
--to=devnull+lizeliang.linux.gmail.com@kernel.org \
--cc=baojun.xu@ti.com \
--cc=broonie@kernel.org \
--cc=kevin-lu@ti.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=lizeliang.linux@gmail.com \
--cc=perex@perex.cz \
--cc=sen@ti.com \
--cc=shenghao-ding@ti.com \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox