mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] ASoC: tas2781: Skip calibration data for other SPI devices
@ 2026-09-29 21:53 Andreas Axelsson
  2026-09-29 22:24 ` Mark Brown
  2026-11-20 21:58 ` Ye Shu
  0 siblings, 2 replies; 4+ messages in thread
From: Andreas Axelsson @ 2026-09-29 21:53 UTC (permalink / raw)
  To: Mark Brown
  Cc: lgirdwood, shenghao-ding, kevin-lu, baojun.xu, sen, tiwai,
	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, 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.
- Resent as a new thread with the patch inline; my earlier reply had
   it as an attachment, sorry for the noise.

  sound/soc/codecs/tas2781-fmwlib.c | 4 ++++
  1 file changed, 4 insertions(+)

diff --git a/sound/soc/codecs/tas2781-fmwlib.c 
b/sound/soc/codecs/tas2781-fmwlib.c
index e8ceeb0..e250d38 100644
--- a/sound/soc/codecs/tas2781-fmwlib.c
+++ b/sound/soc/codecs/tas2781-fmwlib.c
@@ -2631,6 +2631,10 @@ static void tasdev_load_calibrated_data(struct 
tasdevice_priv *priv, int i)
      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);
-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-20 21:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-29 21:53 [PATCH v2] ASoC: tas2781: Skip calibration data for other SPI devices Andreas Axelsson
2026-09-29 22:24 ` Mark Brown
2026-09-29 22:25   ` Mark Brown
2026-11-20 21:58 ` Ye Shu

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®