* [PATCH] ALSA: hda: Fix cached processing coefficient verbs
@ 2026-07-07 13:24 raoxu
2026-07-07 14:42 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: raoxu @ 2026-07-07 13:24 UTC (permalink / raw)
To: perex; +Cc: tiwai, raoxu, linux-sound, linux-kernel, stable
From: Xu Rao <raoxu@uniontech.com>
Intel HD Audio defines Coefficient Index and Processing Coefficient as
separate audio widget controls in the Audio Widget Verb Definitions:
Coefficient Index selects the coefficient slot, while Processing
Coefficient accesses the value at the selected slot.
hda_reg_read_coef() selects the slot with AC_VERB_SET_COEF_INDEX, but
then uses AC_VERB_GET_COEF_INDEX for the value read. That reads back the
selected index instead of the coefficient value. hda_reg_write_coef()
has the same issue and builds the value write from AC_VERB_GET_COEF_INDEX
instead of AC_VERB_SET_PROC_COEF.
This only affects the regmap coefficient cache path used by codecs that
set codec->cache_coef. Direct coefficient helpers already use the normal
SET_COEF_INDEX followed by GET_PROC_COEF or SET_PROC_COEF sequence, which
is likely why this has not been noticed widely.
Use AC_VERB_GET_PROC_COEF for cached coefficient reads and
AC_VERB_SET_PROC_COEF for cached coefficient writes.
Fixes: 40ba66a702b8 ("ALSA: hda - Add cache support for COEF read/write")
Cc: stable@vger.kernel.org
Signed-off-by: Xu Rao <raoxu@uniontech.com>
---
sound/hda/core/regmap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/hda/core/regmap.c b/sound/hda/core/regmap.c
index e7b866fc52c1..d6eb17aa9e08 100644
--- a/sound/hda/core/regmap.c
+++ b/sound/hda/core/regmap.c
@@ -214,7 +214,7 @@ static int hda_reg_read_coef(struct hdac_device *codec, unsigned int reg,
err = snd_hdac_exec_verb(codec, verb, 0, NULL);
if (err < 0)
return err;
- verb = (reg & ~0xfffff) | (AC_VERB_GET_COEF_INDEX << 8);
+ verb = (reg & ~0xfffff) | (AC_VERB_GET_PROC_COEF << 8);
return snd_hdac_exec_verb(codec, verb, 0, val);
}
@@ -232,7 +232,7 @@ static int hda_reg_write_coef(struct hdac_device *codec, unsigned int reg,
err = snd_hdac_exec_verb(codec, verb, 0, NULL);
if (err < 0)
return err;
- verb = (reg & ~0xfffff) | (AC_VERB_GET_COEF_INDEX << 8) |
+ verb = (reg & ~0xfffff) | (AC_VERB_SET_PROC_COEF << 8) |
(val & 0xffff);
return snd_hdac_exec_verb(codec, verb, 0, NULL);
}
--
2.50.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ALSA: hda: Fix cached processing coefficient verbs
2026-07-07 13:24 [PATCH] ALSA: hda: Fix cached processing coefficient verbs raoxu
@ 2026-07-07 14:42 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2026-07-07 14:42 UTC (permalink / raw)
To: raoxu; +Cc: perex, tiwai, linux-sound, linux-kernel, stable
On Tue, 07 Jul 2026 15:24:19 +0200,
raoxu wrote:
>
> From: Xu Rao <raoxu@uniontech.com>
>
> Intel HD Audio defines Coefficient Index and Processing Coefficient as
> separate audio widget controls in the Audio Widget Verb Definitions:
> Coefficient Index selects the coefficient slot, while Processing
> Coefficient accesses the value at the selected slot.
>
> hda_reg_read_coef() selects the slot with AC_VERB_SET_COEF_INDEX, but
> then uses AC_VERB_GET_COEF_INDEX for the value read. That reads back the
> selected index instead of the coefficient value. hda_reg_write_coef()
> has the same issue and builds the value write from AC_VERB_GET_COEF_INDEX
> instead of AC_VERB_SET_PROC_COEF.
>
> This only affects the regmap coefficient cache path used by codecs that
> set codec->cache_coef. Direct coefficient helpers already use the normal
> SET_COEF_INDEX followed by GET_PROC_COEF or SET_PROC_COEF sequence, which
> is likely why this has not been noticed widely.
>
> Use AC_VERB_GET_PROC_COEF for cached coefficient reads and
> AC_VERB_SET_PROC_COEF for cached coefficient writes.
>
> Fixes: 40ba66a702b8 ("ALSA: hda - Add cache support for COEF read/write")
> Cc: stable@vger.kernel.org
> Signed-off-by: Xu Rao <raoxu@uniontech.com>
Ouch, this is a brown-paper-bag bug.
Applied now. Thanks!
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-07 14:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-07 13:24 [PATCH] ALSA: hda: Fix cached processing coefficient verbs raoxu
2026-07-07 14:42 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox