* [PATCH] ASoC: tas2781: Do not report cross-instance writes as errors on SPI
@ 2026-06-11 8:20 Andreas Axelsson
2026-06-11 12:36 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Andreas Axelsson @ 2026-06-11 8:20 UTC (permalink / raw)
To: Shenghao Ding, Mark Brown; +Cc: Kevin Lu, Baojun Xu, linux-sound, linux-kernel
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);
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] ASoC: tas2781: Do not report cross-instance writes as errors on SPI
2026-06-11 8:20 [PATCH] ASoC: tas2781: Do not report cross-instance writes as errors on SPI Andreas Axelsson
@ 2026-06-11 12:36 ` Mark Brown
2026-09-29 21:36 ` Andreas Axelsson
0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2026-06-11 12:36 UTC (permalink / raw)
To: Andreas Axelsson
Cc: Shenghao Ding, Kevin Lu, Baojun Xu, linux-sound, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 498 bytes --]
On Thu, Jun 11, 2026 at 10:20:18AM +0200, Andreas Axelsson wrote:
> 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()).
This doesn't apply against current code, please check and resend.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ASoC: tas2781: Do not report cross-instance writes as errors on SPI
2026-06-11 12:36 ` Mark Brown
@ 2026-09-29 21:36 ` Andreas Axelsson
2026-09-29 21:45 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Andreas Axelsson @ 2026-09-29 21:36 UTC (permalink / raw)
To: Mark Brown; +Cc: Shenghao Ding, Kevin Lu, Baojun Xu, linux-sound, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 603 bytes --]
Attached is the updated patch.
Best regards,
Andreas
On 11/06/2026 2.36 pm, Mark Brown wrote:
> On Thu, Jun 11, 2026 at 10:20:18AM +0200, Andreas Axelsson wrote:
>> 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()).
> This doesn't apply against current code, please check and resend.
[-- Attachment #2: v2-0001-ASoC-tas2781-Skip-calibration-data-for-other-SPI-devices.patch --]
[-- Type: text/x-patch, Size: 1813 bytes --]
From: Andreas Axelsson <andreas.axelsson@androscientia.com>
Subject: [PATCH v2] ASoC: tas2781: Skip calibration data for other SPI devices
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, and the SPI bus glue returns -EXDEV for register access
addressed to a channel the instance does not own (see
tasdevice_spi_change_chn_book()).
Commit 513480da5e9c ("ALSA: hda/tas2781: Fix device-0 reset issue and
handle -EXDEV in block data processing") taught
tasdevice_process_block() to ignore -EXDEV on SPI, but
tasdev_load_calibrated_data() still tries to write calibration data
for every channel. On each instance the write for the other amplifier
fails and is logged as an error on every boot, resume and profile
switch:
tas2781-hda spi1-TXNW2781:00-tas2781-hda.1: chn 0 r0_reg bulk_wr err = -18
The owning instance loads that channel's calibration data itself, so
skip channels other than priv->index on SPI.
Tested on an HP ZBook Fury G1i (subsystem 103C:8DE8) with two TAS2781
amps on SPI.
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>
---
v2:
- Rebased on current code. The tasdevice_process_block() part of v1
is superseded by commit 513480da5e9c; only the calibration part
remains.
--- a/sound/soc/codecs/tas2781-fmwlib.c
+++ b/sound/soc/codecs/tas2781-fmwlib.c
@@ -2631,6 +2631,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);
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] ASoC: tas2781: Do not report cross-instance writes as errors on SPI
2026-09-29 21:36 ` Andreas Axelsson
@ 2026-09-29 21:45 ` Mark Brown
0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2026-09-29 21:45 UTC (permalink / raw)
To: Andreas Axelsson
Cc: Shenghao Ding, Kevin Lu, Baojun Xu, linux-sound, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 204 bytes --]
On Tue, Sep 29, 2026 at 11:36:11PM +0200, Andreas Axelsson wrote:
> Attached is the updated patch.
Please submit patches in the manner described in submitting-patches.rst
- tooling is all based on that.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-09-29 21:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-11 8:20 [PATCH] ASoC: tas2781: Do not report cross-instance writes as errors on SPI Andreas Axelsson
2026-06-11 12:36 ` Mark Brown
2026-09-29 21:36 ` Andreas Axelsson
2026-09-29 21:45 ` Mark Brown
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®