mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] ALSA: hda/tas2781: Prevent throwing away custom calibration addresses
@ 2026-11-02 17:40 Antheas Kapenekakis
  2026-11-02 19:13 ` Antheas Kapenekakis
  2026-11-03 14:49 ` Takashi Iwai
  0 siblings, 2 replies; 4+ messages in thread
From: Antheas Kapenekakis @ 2026-11-02 17:40 UTC (permalink / raw)
  To: tiwai
  Cc: Shenghao Ding, perex, baojun.xu, kevin-lu, sen, matthew.schwartz,
	linux-sound, linux-kernel, Antheas Kapenekakis

The V2 UEFI spec for per-device calibration data in TAS allows for
manufacturers to specify up to five custom calibration register
addresses and values to optimize per-device in factory.

A basic description of the spec is found in a comment in function
tas2781_apply_calib(). However, currently, for the condition of
p->dspbin_typ != TASDEV_BASIC, if custom calibration addresses have been
provided by the manufacturer, they are ignored and the ones listed in
firmware are used.

In case the manufacturer chose to change different registers other than
the default ones (r0, invr0, r0_low, pow, tlimit), this causes the
UEFI calibration data to scratch different registers and cause the
firmware to misbehave. This is true in the Xbox ROG Ally X, for one of
the firmwares, where it pops and has audio dropouts after the
calibration data is applied.

Therefore, add a new bool to indicate that UEFI supplied custom
calibration addresses, and if so, use them regardless of dspbin_typ.

Closes: https://lore.kernel.org/all/179122346529.6.9250312386131579603.1671009695@8alias.com/
Co-developed-by: Matthew Schwartz <matthew.schwartz@linux.dev>
Signed-off-by: Matthew Schwartz <matthew.schwartz@linux.dev>
Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>
---
Different laptop this time. This bug was valid, just not present on the
Xbox Ally X. assembledev is not a real name, so assembledev if you want
a reported by provide a legal name and email address. You may test this
patch and add Tested-by: real-name <real-email> or omit it.

Technically the V1:
https://lore.kernel.org/all/20260107093134.583873-1-lkml@antheas.dev/

No functionality change, just the commit message.
---
 sound/hda/codecs/side-codecs/tas2781_hda.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/hda/codecs/side-codecs/tas2781_hda.c b/sound/hda/codecs/side-codecs/tas2781_hda.c
index e0da299df780..70e5118a17a1 100644
--- a/sound/hda/codecs/side-codecs/tas2781_hda.c
+++ b/sound/hda/codecs/side-codecs/tas2781_hda.c
@@ -64,6 +64,7 @@ static void tas2781_apply_calib(struct tasdevice_priv *p)
 		TASDEVICE_REG(0, 0x18, 0x7c),
 	};
 	unsigned int crc, oft, node_num;
+	bool custom_addr = false;
 	unsigned char *buf;
 	int i, j, k, l;
 
@@ -104,6 +105,7 @@ static void tas2781_apply_calib(struct tasdevice_priv *p)
 		for (j = 0, k = 0; j < node_num; j++) {
 			oft = j * 6 + 3;
 			if (tmp_val[oft] == TASDEV_UEFI_CALI_REG_ADDR_FLG) {
+				custom_addr = true;
 				for (i = 0; i < TASDEV_CALIB_N; i++) {
 					buf = &data[(oft + i + 1) * 4];
 					cali_reg[i] = TASDEVICE_REG(buf[1],
@@ -163,7 +165,7 @@ static void tas2781_apply_calib(struct tasdevice_priv *p)
 		}
 	}
 
-	if (p->dspbin_typ == TASDEV_BASIC) {
+	if (custom_addr || p->dspbin_typ == TASDEV_BASIC) {
 		r->r0_reg = cali_reg[0];
 		r->invr0_reg = cali_reg[1];
 		r->r0_low_reg = cali_reg[2];

base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
-- 
2.56.0



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

* Re: [PATCH v2] ALSA: hda/tas2781: Prevent throwing away custom calibration addresses
  2026-11-02 17:40 [PATCH v2] ALSA: hda/tas2781: Prevent throwing away custom calibration addresses Antheas Kapenekakis
@ 2026-11-02 19:13 ` Antheas Kapenekakis
  2026-11-02 19:41   ` linux-kernel.supreme403
  2026-11-03 14:49 ` Takashi Iwai
  1 sibling, 1 reply; 4+ messages in thread
From: Antheas Kapenekakis @ 2026-11-02 19:13 UTC (permalink / raw)
  To: linux-kernel.supreme403
  Cc: Shenghao Ding, tiwai, perex, baojun.xu, kevin-lu, sen,
	matthew.schwartz, linux-sound, linux-kernel

Apologies, I forgot to cc you.

Test and report back.

Antheas


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

* Re: [PATCH v2] ALSA: hda/tas2781: Prevent throwing away custom calibration addresses
  2026-11-02 19:13 ` Antheas Kapenekakis
@ 2026-11-02 19:41   ` linux-kernel.supreme403
  0 siblings, 0 replies; 4+ messages in thread
From: linux-kernel.supreme403 @ 2026-11-02 19:41 UTC (permalink / raw)
  To: Antheas Kapenekakis
  Cc: Shenghao Ding, tiwai, perex, baojun.xu, kevin-lu, sen,
	matthew.schwartz, linux-sound, linux-kernel


Hi Antheas,


Confirmed working on ASUS TP3407SA with Linux 6.18.59. The speakers work fine with the patch.


I’d prefer to keep using assembledev for privacy. If that isn’t acceptable for Reported-by or Tested-by, please leave those tags out.



Thanks,
assembledev




Nov 2, 2026, 19:13 by lkml_at_antheas_dev_itvnlo@simplelogin.co:

> Apologies, I forgot to cc you.
>
> Test and report back.
>
> Antheas
>
>



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

* Re: [PATCH v2] ALSA: hda/tas2781: Prevent throwing away custom calibration addresses
  2026-11-02 17:40 [PATCH v2] ALSA: hda/tas2781: Prevent throwing away custom calibration addresses Antheas Kapenekakis
  2026-11-02 19:13 ` Antheas Kapenekakis
@ 2026-11-03 14:49 ` Takashi Iwai
  1 sibling, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2026-11-03 14:49 UTC (permalink / raw)
  To: Antheas Kapenekakis
  Cc: tiwai, Shenghao Ding, perex, baojun.xu, kevin-lu, sen,
	matthew.schwartz, linux-sound, linux-kernel

On Mon, 02 Nov 2026 18:40:52 +0100,
Antheas Kapenekakis wrote:
> 
> The V2 UEFI spec for per-device calibration data in TAS allows for
> manufacturers to specify up to five custom calibration register
> addresses and values to optimize per-device in factory.
> 
> A basic description of the spec is found in a comment in function
> tas2781_apply_calib(). However, currently, for the condition of
> p->dspbin_typ != TASDEV_BASIC, if custom calibration addresses have been
> provided by the manufacturer, they are ignored and the ones listed in
> firmware are used.
> 
> In case the manufacturer chose to change different registers other than
> the default ones (r0, invr0, r0_low, pow, tlimit), this causes the
> UEFI calibration data to scratch different registers and cause the
> firmware to misbehave. This is true in the Xbox ROG Ally X, for one of
> the firmwares, where it pops and has audio dropouts after the
> calibration data is applied.
> 
> Therefore, add a new bool to indicate that UEFI supplied custom
> calibration addresses, and if so, use them regardless of dspbin_typ.
> 
> Closes: https://lore.kernel.org/all/179122346529.6.9250312386131579603.1671009695@8alias.com/
> Co-developed-by: Matthew Schwartz <matthew.schwartz@linux.dev>
> Signed-off-by: Matthew Schwartz <matthew.schwartz@linux.dev>
> Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>

Applied now.  Thanks.


Takashi

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

end of thread, other threads:[~2026-11-03 14:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-02 17:40 [PATCH v2] ALSA: hda/tas2781: Prevent throwing away custom calibration addresses Antheas Kapenekakis
2026-11-02 19:13 ` Antheas Kapenekakis
2026-11-02 19:41   ` linux-kernel.supreme403
2026-11-03 14:49 ` Takashi Iwai

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®