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