Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH] ALSA: hda: restore MFG widget enumeration after core split
@ 2026-09-01  3:40 raoxu
  2026-09-01 10:38 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: raoxu @ 2026-09-01  3:40 UTC (permalink / raw)
  To: perex; +Cc: tiwai, raoxu, linux-sound, linux-kernel

From: Xu Rao <raoxu@uniontech.com>

Before commit 7639a06c23c7 ("ALSA: hda - Move a part of hda_codec stuff
into hdac_device"), widget enumeration selected the function group with

	codec->afg ? codec->afg : codec->mfg

and read subordinate nodes from that group.

The core split moved this logic into snd_hdac_refresh_widgets(), but
hard-coded codec->afg there. For an MFG-only codec, codec->afg is zero,
so the Root Node is queried and codec->start_nid/num_nodes are populated
from the function-group range instead of the MFG's subordinate nodes.

Restore the pre-split AFG-or-MFG selection.

Fixes: 7639a06c23c7 ("ALSA: hda - Move a part of hda_codec stuff into hdac_device")
Signed-off-by: Xu Rao <raoxu@uniontech.com>
---
 sound/hda/core/device.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sound/hda/core/device.c b/sound/hda/core/device.c
index 160c8d0453b0..ebaa106d0f01 100644
--- a/sound/hda/core/device.c
+++ b/sound/hda/core/device.c
@@ -404,6 +404,7 @@ static void setup_fg_nodes(struct hdac_device *codec)
  */
 int snd_hdac_refresh_widgets(struct hdac_device *codec)
 {
+	hda_nid_t fg = codec->afg ? codec->afg : codec->mfg;
 	hda_nid_t start_nid;
 	int nums, err = 0;
 
@@ -412,10 +413,10 @@ int snd_hdac_refresh_widgets(struct hdac_device *codec)
 	 * widgets array.
 	 */
 	guard(mutex)(&codec->widget_lock);
-	nums = snd_hdac_get_sub_nodes(codec, codec->afg, &start_nid);
+	nums = snd_hdac_get_sub_nodes(codec, fg, &start_nid);
 	if (!start_nid || nums <= 0 || nums >= 0xff) {
 		dev_err(&codec->dev, "cannot read sub nodes for FG 0x%02x\n",
-			codec->afg);
+			fg);
 		return -EINVAL;
 	}
 
-- 
2.50.1



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

* Re: [PATCH] ALSA: hda: restore MFG widget enumeration after core split
  2026-09-01  3:40 [PATCH] ALSA: hda: restore MFG widget enumeration after core split raoxu
@ 2026-09-01 10:38 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2026-09-01 10:38 UTC (permalink / raw)
  To: raoxu; +Cc: perex, tiwai, linux-sound, linux-kernel

On Tue, 01 Sep 2026 05:40:24 +0200,
raoxu wrote:
> 
> From: Xu Rao <raoxu@uniontech.com>
> 
> Before commit 7639a06c23c7 ("ALSA: hda - Move a part of hda_codec stuff
> into hdac_device"), widget enumeration selected the function group with
> 
> 	codec->afg ? codec->afg : codec->mfg
> 
> and read subordinate nodes from that group.
> 
> The core split moved this logic into snd_hdac_refresh_widgets(), but
> hard-coded codec->afg there. For an MFG-only codec, codec->afg is zero,
> so the Root Node is queried and codec->start_nid/num_nodes are populated
> from the function-group range instead of the MFG's subordinate nodes.
> 
> Restore the pre-split AFG-or-MFG selection.
> 
> Fixes: 7639a06c23c7 ("ALSA: hda - Move a part of hda_codec stuff into hdac_device")
> Signed-off-by: Xu Rao <raoxu@uniontech.com>

Thanks, applied now.

(Though, I've never seen an actual hardware with MFG, so it's likely
 no issue in practice :)


Takashi

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

end of thread, other threads:[~2026-09-01 10:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-01  3:40 [PATCH] ALSA: hda: restore MFG widget enumeration after core split raoxu
2026-09-01 10:38 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox