From: Andreas Axelsson <andreas.axelsson@androscientia.com>
To: Shenghao Ding <shenghao-ding@ti.com>, Mark Brown <broonie@kernel.org>
Cc: Kevin Lu <kevin-lu@ti.com>, Baojun Xu <baojun.xu@ti.com>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] ASoC: tas2781: Do not report cross-instance writes as errors on SPI
Date: Thu, 11 Jun 2026 10:20:18 +0200 [thread overview]
Message-ID: <f39f2aa8-33f3-4cb6-b2ed-56254ad63f3c@androscientia.com> (raw)
On SPI-based TAS2781 HDA systems (e.g. HP laptops with two amplifiers
on separate SPI chip selects), each tasdevice_priv instance services a
single device. The SPI bus glue intentionally returns -EXDEV for
register access addressed to a channel the instance does not own, and
logs it at debug level as "Not error" (see
tasdevice_spi_change_chn_book()).
The shared firmware library does not handle this convention: firmware
blocks explicitly addressed to another device (dev_idx != 0) and
calibration data for other channels are still processed, and the
resulting -EXDEV returns are reported via dev_err and counted as block
errors, triggering pointless retries. This floods the log on every
boot, resume and profile switch:
tas2781-hda spi1-TXNW2781:00-tas2781-hda.0: tasdevice_process_block:
bulk_write error = -18
tas2781-hda spi1-TXNW2781:00-tas2781-hda.0: process_block: single
write error
tas2781-hda spi1-TXNW2781:00-tas2781-hda.0: chn 1 r0_reg bulk_wr err
= -18
Treat -EXDEV as "block not for this instance": skip it silently in
tasdevice_process_block(), keeping the sub-block parsing intact so
the data offset stays correct, and skip foreign channels entirely in
tasdev_load_calibrated_data().
Tested on an HP laptop (subsystem 103C:8DE8) with two TAS2781 amps on
SPI: the error spam is gone, firmware and calibration still load, and
audio is unaffected.
The root cause analysis and fix were developed by Claude (Anthropic AI
assistant); tested by me on the hardware above.
Fixes: 9fa6a693ad8d ("ALSA: hda/tas2781: Remove tas2781_spi_fwlib.c and
leverage SND_SOC_TAS2781_FMWLIB")
Signed-off-by: Andreas Axelsson <andreas.axelsson@androscientia.com>
---
--- a/sound/soc/codecs/tas2781-fmwlib.c
+++ b/sound/soc/codecs/tas2781-fmwlib.c
@@ -896,6 +896,14 @@
}
}
+ /*
+ * On SPI each instance services a single device, but explicitly
+ * addressed blocks (idx != 0) may target any device. Writes for
+ * a channel this instance does not own return -EXDEV from the
+ * bus glue ("Not error", see tasdevice_spi_change_chn_book);
+ * they are expected and must not be reported as failures. The
+ * block is still parsed so the sub-block offset stays correct.
+ */
for (; chn < chnend; chn++) {
if (tas_priv->tasdevice[chn].is_loading == false)
continue;
@@ -921,7 +929,7 @@
data[subblk_offset + 1],
data[subblk_offset + 2]),
data[subblk_offset + 3]);
- if (rc < 0) {
+ if (rc < 0 && rc != -EXDEV) {
is_err = true;
dev_err(tas_priv->dev,
"process_block: single write error\n");
@@ -953,7 +961,7 @@
data[subblk_offset + 1],
data[subblk_offset + 2]),
&(data[subblk_offset + 4]), len);
- if (rc < 0) {
+ if (rc < 0 && rc != -EXDEV) {
is_err = true;
dev_err(tas_priv->dev,
"%s: bulk_write error = %d\n",
@@ -991,7 +999,7 @@
data[subblk_offset + 4]),
data[subblk_offset + 1],
data[subblk_offset + 5]);
- if (rc < 0) {
+ if (rc < 0 && rc != -EXDEV) {
is_err = true;
dev_err(tas_priv->dev,
"%s: update_bits error = %d\n",
@@ -2552,6 +2560,10 @@
if (!data || !cali_data->total_sz)
return;
+ /* On SPI each instance owns a single device; skip the others. */
+ if (priv->isspi && i != priv->index)
+ return;
+
if (data[k] != i) {
dev_err(priv->dev, "%s: no cal-data for dev %d from usr-spc\n",
__func__, i);
next reply other threads:[~2026-06-11 8:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-11 8:20 Andreas Axelsson [this message]
2026-06-11 12:36 ` Mark Brown
2026-09-29 21:36 ` Andreas Axelsson
2026-09-29 21:45 ` Mark Brown
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=f39f2aa8-33f3-4cb6-b2ed-56254ad63f3c@androscientia.com \
--to=andreas.axelsson@androscientia.com \
--cc=baojun.xu@ti.com \
--cc=broonie@kernel.org \
--cc=kevin-lu@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=shenghao-ding@ti.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
all inboxes | Powered by JetHome®