ALSA: hda/tas2781: Fix sound abnormal issue on some SPI device
Baojun Xu
maintainerPATCH 1/1 ALSA: hda/tas2781: Fix sound abnormal issue on some SPI device
In the SPI driver probe, the chip ID must be set to TAS2781. Without this initialization, calibration data fails to load correctly, causing audio abnormalities on some devices.
And update the register bulk read API to handle the distinct requirements of SPI and I2C devices.
--- sound/hda/codecs/side-codecs/tas2781_hda_spi.c | 1 + sound/soc/codecs/tas2781-fmwlib.c | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-)
sound/hda/codecs/side-codecs/tas2781_hda_spi.c +1 -0
@@ -788,6 +788,7 @@ static int tas2781_hda_spi_probe(struct spi_device *spi) }if (strstr (dev_name (&spi->dev),"TXNW2781" )) { device_name ="TXNW2781" ; + tas_hda->priv->chip_id =TAS2781 ; }else {dev_err (tas_priv->dev,"Unmatched spi dev %s\n" ,dev_name (&spi->dev));
sound/soc/codecs/tas2781-fmwlib.c +3 -4
@@ -2487,7 +2487,7 @@ static int tas2781_cali_preproc(struct tasdevice_priv *priv, int i)if (spec ==NULL )return -ENOMEM ; priv->tasdevice[i].cali_specific = spec; - rc =tasdevice_dev_bulk_read (priv, i, p->r0_reg, r0_deflt,4 ); + rc = priv->dev_bulk_read (priv, i, p->r0_reg, r0_deflt,4 );if (rc <0 ) {dev_err (priv->dev,"invalid RE from %d = %d\n" , i, rc);return rc;
@@ -2511,9 +2511,8 @@ static int tas2781_cali_preproc(struct tasdevice_priv *priv, int i) TASDEVICE_REG(0, 0x1b, 0x34) :TASDEVICE_REG (0 ,0x18 ,0x1c ); - rc =tasdevice_dev_bulk_read (priv, i, - spec->sin_gni_reg, - spec->sin_gni,4 ); + rc = priv->dev_bulk_read (priv, i, spec->sin_gni_reg, + spec->sin_gni,4 );if (rc <0 ) {dev_err (priv->dev,"wrong sinegaini %d = %d\n" , i, rc);
Signature · 1 line
2.25.1
Quoted 9 lines · Baojun Xu
In the SPI driver probe, the chip ID must be set to TAS2781. Without this initialization, calibration data fails to load correctly, causing audio abnormalities on some devices.
And update the register bulk read API to handle the distinct requirements of SPI and I2C devices.Fixes 05ac3846ffe5 ("ALSA: hda/tas2781: A workaround solution to lower-vol issue among lower calibrated-impedance micro-speaker on TAS2781")Signed-off-by Baojun Xu <[email protected]>
Applied now. Thanks.
Takashi
Quoted 40 lines · Baojun Xu
In the SPI driver probe, the chip ID must be set to TAS2781. Without this initialization, calibration data fails to load correctly, causing audio abnormalities on some devices.
And update the register bulk read API to handle the distinct requirements of SPI and I2C devices.Fixes 05ac3846ffe5 ("ALSA: hda/tas2781: A workaround solution to lower-vol issue among lower calibrated-impedance micro-speaker on TAS2781")Signed-off-by Baojun Xu <[email protected]>--- sound/hda/codecs/side-codecs/tas2781_hda_spi.c | 1 + sound/soc/codecs/tas2781-fmwlib.c | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-)sound/hda/codecs/side-codecs/tas2781_hda_spi.c +1
-0@@ -788,6 +788,7 @@ static int tas2781_hda_spi_probe(struct spi_device *spi) }if (strstr (dev_name (&spi->dev),"TXNW2781" )) { device_name ="TXNW2781" ; + tas_hda->priv->chip_id =TAS2781 ; }else {dev_err (tas_priv->dev,"Unmatched spi dev %s\n" ,dev_name (&spi->dev));sound/soc/codecs/tas2781-fmwlib.c +1
-1@@ -2487,7 +2487,7 @@ static int tas2781_cali_preproc(struct tasdevice_priv *priv, int i)if (spec ==NULL )return -ENOMEM ; priv->tasdevice[i].cali_specific = spec; - rc =tasdevice_dev_bulk_read (priv, i, p->r0_reg, r0_deflt,4 ); + rc = priv->dev_bulk_read (priv, i, p->r0_reg, r0_deflt,4 );if (rc <0 ) {dev_err (priv->dev,"invalid RE from %d = %d\n" , i, rc);return rc;@@ -2511,9 +2511,8 @@ static int tas2781_cali_preproc(struct tasdevice_priv *priv, int i) TASDEVICE_REG(0, 0x1b, 0x34) :
sound/soc/codecs/tas2781-fmwlib.c static int tas2781_cali_preproc(struct tasdevice_priv *priv, int i) · line 2518
Quoted 10 lines
sound/soc/codecs/tas2781-fmwlib.c +2
-3TASDEVICE_REG (0 ,0x18 ,0x1c ); - rc =tasdevice_dev_bulk_read (priv, i, - spec->sin_gni_reg, - spec->sin_gni,4 ); + rc = priv->dev_bulk_read (priv, i, spec->sin_gni_reg, + spec->sin_gni,4 );if (rc <0 ) {dev_err (priv->dev,"wrong sinegaini %d = %d\n" , i, rc);
Hi Baojun, will this fix
https://lore.kernel.org/linux-sound/[email protected]/ ?
Similarly, I noticed that something like the above was merged upstream, commit 0bdf27abaf894.
Signature · 2 lines
Regards, Eric
Xu, Baojun
maintainerHi Eric,
Quoted 15 lines
________________________________________
From: Eric Naim <[email protected]>
Sent: 20 April 2026 14:43
To: Xu, Baojun; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Ding, Shenghao; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [EXTERNAL] Re: [PATCH v1] ALSA: hda/tas2781: Fix sound abnormal issue on some SPI deviceQuoted 6 lines · Baojun Xu
In the SPI driver probe, the chip ID must be set to TAS2781. Without this initialization, calibration data fails to load correctly, causing audio abnormalities on some devices.
And update the register bulk read API to handle the distinct requirements of SPI and I2C devices.
Quoted 9 lines
Quoted 3 lines
Fixes 05ac3846ffe5 ("ALSA: hda/tas2781: A workaround solution to lower-vol issue among lower calibrated-impedance micro-speaker on TAS2781")Signed-off-by Baojun Xu <[email protected]>---
Hi Baojun, will this fix
https://urldefense.com/v3/__https://lore.kernel.org/linux-sound/[email protected]/__;!!G3vK!X-jfopjNDyUV4Zt7eHbLDT79zxX8PrVATeyHGzNtgCNvue6wSwqHWSaaVOuqjRfYbzZ5TQzNVhRq$ ?Similarly, I noticed that something like the above was merged upstream, commit
0bdf27abaf894.
To clarify: The patch mentioned earlier was designed to register the correct project with the codec. My patch specifically resolves the issue where calibration data fails to be applied properly.
Quoted 5 lines
--
Regards,
Eric
Best Regards
Jim