ALSA: hda - Set function_id only on FG nodes

(Re)set function_id only from the value on FG nodes.
The current code overrides the value with the last widget.

Signed-off-by: Takashi Iwai <tiwai@suse.de>

+5 -3
+5 -3
sound/pci/hda/hda_codec.c
··· 642 642 */ 643 643 static void /*__devinit*/ setup_fg_nodes(struct hda_codec *codec) 644 644 { 645 - int i, total_nodes; 645 + int i, total_nodes, function_id; 646 646 hda_nid_t nid; 647 647 648 648 total_nodes = snd_hda_get_sub_nodes(codec, AC_NODE_ROOT, &nid); 649 649 for (i = 0; i < total_nodes; i++, nid++) { 650 - codec->function_id = snd_hda_param_read(codec, nid, 650 + function_id = snd_hda_param_read(codec, nid, 651 651 AC_PAR_FUNCTION_TYPE) & 0xff; 652 - switch (codec->function_id) { 652 + switch (function_id) { 653 653 case AC_GRP_AUDIO_FUNCTION: 654 654 codec->afg = nid; 655 + codec->function_id = function_id; 655 656 break; 656 657 case AC_GRP_MODEM_FUNCTION: 657 658 codec->mfg = nid; 659 + codec->function_id = function_id; 658 660 break; 659 661 default: 660 662 break;