diff options
author | Jaroslav Kysela <perex@perex.cz> | 2009-11-11 07:43:01 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-11-16 05:35:14 -0500 |
commit | 3911a4c19e927738766003839aa447becbdbaa27 (patch) | |
tree | 7a9dc03cfc6776a57a6e459cd4efe5d8e16797cd | |
parent | 2dca0bba70ce3c233be152e384580c134935332d (diff) |
ALSA: hda - proc - introduce Control: lines to show mixer<->NID assignment
This is an initial patch to show universal control<->NID assigment in
proc codec file. The change helps to debug codec related problems.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/hda/hda_codec.c | 32 | ||||
-rw-r--r-- | sound/pci/hda/hda_generic.c | 17 | ||||
-rw-r--r-- | sound/pci/hda/hda_local.h | 11 | ||||
-rw-r--r-- | sound/pci/hda/hda_proc.c | 55 | ||||
-rw-r--r-- | sound/pci/hda/patch_analog.c | 4 | ||||
-rw-r--r-- | sound/pci/hda/patch_ca0110.c | 4 | ||||
-rw-r--r-- | sound/pci/hda/patch_cirrus.c | 12 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 3 | ||||
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 4 |
9 files changed, 92 insertions, 50 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 7fd2abe1129d..1ed1d88e1834 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -946,7 +946,7 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr | |||
946 | mutex_init(&codec->control_mutex); | 946 | mutex_init(&codec->control_mutex); |
947 | init_hda_cache(&codec->amp_cache, sizeof(struct hda_amp_info)); | 947 | init_hda_cache(&codec->amp_cache, sizeof(struct hda_amp_info)); |
948 | init_hda_cache(&codec->cmd_cache, sizeof(struct hda_cache_head)); | 948 | init_hda_cache(&codec->cmd_cache, sizeof(struct hda_cache_head)); |
949 | snd_array_init(&codec->mixers, sizeof(struct snd_kcontrol *), 32); | 949 | snd_array_init(&codec->mixers, sizeof(struct hda_nid_item), 60); |
950 | snd_array_init(&codec->init_pins, sizeof(struct hda_pincfg), 16); | 950 | snd_array_init(&codec->init_pins, sizeof(struct hda_pincfg), 16); |
951 | snd_array_init(&codec->driver_pins, sizeof(struct hda_pincfg), 16); | 951 | snd_array_init(&codec->driver_pins, sizeof(struct hda_pincfg), 16); |
952 | if (codec->bus->modelname) { | 952 | if (codec->bus->modelname) { |
@@ -1517,18 +1517,20 @@ struct snd_kcontrol *snd_hda_find_mixer_ctl(struct hda_codec *codec, | |||
1517 | EXPORT_SYMBOL_HDA(snd_hda_find_mixer_ctl); | 1517 | EXPORT_SYMBOL_HDA(snd_hda_find_mixer_ctl); |
1518 | 1518 | ||
1519 | /* Add a control element and assign to the codec */ | 1519 | /* Add a control element and assign to the codec */ |
1520 | int snd_hda_ctl_add(struct hda_codec *codec, struct snd_kcontrol *kctl) | 1520 | int snd_hda_ctl_add(struct hda_codec *codec, hda_nid_t nid, |
1521 | struct snd_kcontrol *kctl) | ||
1521 | { | 1522 | { |
1522 | int err; | 1523 | int err; |
1523 | struct snd_kcontrol **knewp; | 1524 | struct hda_nid_item *item; |
1524 | 1525 | ||
1525 | err = snd_ctl_add(codec->bus->card, kctl); | 1526 | err = snd_ctl_add(codec->bus->card, kctl); |
1526 | if (err < 0) | 1527 | if (err < 0) |
1527 | return err; | 1528 | return err; |
1528 | knewp = snd_array_new(&codec->mixers); | 1529 | item = snd_array_new(&codec->mixers); |
1529 | if (!knewp) | 1530 | if (!item) |
1530 | return -ENOMEM; | 1531 | return -ENOMEM; |
1531 | *knewp = kctl; | 1532 | item->kctl = kctl; |
1533 | item->nid = nid; | ||
1532 | return 0; | 1534 | return 0; |
1533 | } | 1535 | } |
1534 | EXPORT_SYMBOL_HDA(snd_hda_ctl_add); | 1536 | EXPORT_SYMBOL_HDA(snd_hda_ctl_add); |
@@ -1537,9 +1539,9 @@ EXPORT_SYMBOL_HDA(snd_hda_ctl_add); | |||
1537 | void snd_hda_ctls_clear(struct hda_codec *codec) | 1539 | void snd_hda_ctls_clear(struct hda_codec *codec) |
1538 | { | 1540 | { |
1539 | int i; | 1541 | int i; |
1540 | struct snd_kcontrol **kctls = codec->mixers.list; | 1542 | struct hda_nid_item *items = codec->mixers.list; |
1541 | for (i = 0; i < codec->mixers.used; i++) | 1543 | for (i = 0; i < codec->mixers.used; i++) |
1542 | snd_ctl_remove(codec->bus->card, kctls[i]); | 1544 | snd_ctl_remove(codec->bus->card, items[i].kctl); |
1543 | snd_array_free(&codec->mixers); | 1545 | snd_array_free(&codec->mixers); |
1544 | } | 1546 | } |
1545 | 1547 | ||
@@ -1645,7 +1647,7 @@ int snd_hda_add_vmaster(struct hda_codec *codec, char *name, | |||
1645 | kctl = snd_ctl_make_virtual_master(name, tlv); | 1647 | kctl = snd_ctl_make_virtual_master(name, tlv); |
1646 | if (!kctl) | 1648 | if (!kctl) |
1647 | return -ENOMEM; | 1649 | return -ENOMEM; |
1648 | err = snd_hda_ctl_add(codec, kctl); | 1650 | err = snd_hda_ctl_add(codec, 0, kctl); |
1649 | if (err < 0) | 1651 | if (err < 0) |
1650 | return err; | 1652 | return err; |
1651 | 1653 | ||
@@ -2139,7 +2141,7 @@ int snd_hda_create_spdif_out_ctls(struct hda_codec *codec, hda_nid_t nid) | |||
2139 | return -ENOMEM; | 2141 | return -ENOMEM; |
2140 | kctl->id.index = idx; | 2142 | kctl->id.index = idx; |
2141 | kctl->private_value = nid; | 2143 | kctl->private_value = nid; |
2142 | err = snd_hda_ctl_add(codec, kctl); | 2144 | err = snd_hda_ctl_add(codec, nid, kctl); |
2143 | if (err < 0) | 2145 | if (err < 0) |
2144 | return err; | 2146 | return err; |
2145 | } | 2147 | } |
@@ -2184,8 +2186,8 @@ int snd_hda_create_spdif_share_sw(struct hda_codec *codec, | |||
2184 | if (!mout->dig_out_nid) | 2186 | if (!mout->dig_out_nid) |
2185 | return 0; | 2187 | return 0; |
2186 | /* ATTENTION: here mout is passed as private_data, instead of codec */ | 2188 | /* ATTENTION: here mout is passed as private_data, instead of codec */ |
2187 | return snd_hda_ctl_add(codec, | 2189 | return snd_hda_ctl_add(codec, mout->dig_out_nid, |
2188 | snd_ctl_new1(&spdif_share_sw, mout)); | 2190 | snd_ctl_new1(&spdif_share_sw, mout)); |
2189 | } | 2191 | } |
2190 | EXPORT_SYMBOL_HDA(snd_hda_create_spdif_share_sw); | 2192 | EXPORT_SYMBOL_HDA(snd_hda_create_spdif_share_sw); |
2191 | 2193 | ||
@@ -2289,7 +2291,7 @@ int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid) | |||
2289 | if (!kctl) | 2291 | if (!kctl) |
2290 | return -ENOMEM; | 2292 | return -ENOMEM; |
2291 | kctl->private_value = nid; | 2293 | kctl->private_value = nid; |
2292 | err = snd_hda_ctl_add(codec, kctl); | 2294 | err = snd_hda_ctl_add(codec, nid, kctl); |
2293 | if (err < 0) | 2295 | if (err < 0) |
2294 | return err; | 2296 | return err; |
2295 | } | 2297 | } |
@@ -3165,7 +3167,7 @@ int snd_hda_add_new_ctls(struct hda_codec *codec, struct snd_kcontrol_new *knew) | |||
3165 | kctl = snd_ctl_new1(knew, codec); | 3167 | kctl = snd_ctl_new1(knew, codec); |
3166 | if (!kctl) | 3168 | if (!kctl) |
3167 | return -ENOMEM; | 3169 | return -ENOMEM; |
3168 | err = snd_hda_ctl_add(codec, kctl); | 3170 | err = snd_hda_ctl_add(codec, 0, kctl); |
3169 | if (err < 0) { | 3171 | if (err < 0) { |
3170 | if (!codec->addr) | 3172 | if (!codec->addr) |
3171 | return err; | 3173 | return err; |
@@ -3173,7 +3175,7 @@ int snd_hda_add_new_ctls(struct hda_codec *codec, struct snd_kcontrol_new *knew) | |||
3173 | if (!kctl) | 3175 | if (!kctl) |
3174 | return -ENOMEM; | 3176 | return -ENOMEM; |
3175 | kctl->id.device = codec->addr; | 3177 | kctl->id.device = codec->addr; |
3176 | err = snd_hda_ctl_add(codec, kctl); | 3178 | err = snd_hda_ctl_add(codec, 0, kctl); |
3177 | if (err < 0) | 3179 | if (err < 0) |
3178 | return err; | 3180 | return err; |
3179 | } | 3181 | } |
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index b36f6c5a92df..092c6a7c2ff3 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
@@ -727,7 +727,8 @@ static int create_mixer(struct hda_codec *codec, struct hda_gnode *node, | |||
727 | if (is_loopback) | 727 | if (is_loopback) |
728 | add_input_loopback(codec, node->nid, HDA_INPUT, index); | 728 | add_input_loopback(codec, node->nid, HDA_INPUT, index); |
729 | snd_printdd("[%s] NID=0x%x, DIR=IN, IDX=0x%x\n", name, node->nid, index); | 729 | snd_printdd("[%s] NID=0x%x, DIR=IN, IDX=0x%x\n", name, node->nid, index); |
730 | err = snd_hda_ctl_add(codec, snd_ctl_new1(&knew, codec)); | 730 | err = snd_hda_ctl_add(codec, node->nid, |
731 | snd_ctl_new1(&knew, codec)); | ||
731 | if (err < 0) | 732 | if (err < 0) |
732 | return err; | 733 | return err; |
733 | created = 1; | 734 | created = 1; |
@@ -737,7 +738,8 @@ static int create_mixer(struct hda_codec *codec, struct hda_gnode *node, | |||
737 | if (is_loopback) | 738 | if (is_loopback) |
738 | add_input_loopback(codec, node->nid, HDA_OUTPUT, 0); | 739 | add_input_loopback(codec, node->nid, HDA_OUTPUT, 0); |
739 | snd_printdd("[%s] NID=0x%x, DIR=OUT\n", name, node->nid); | 740 | snd_printdd("[%s] NID=0x%x, DIR=OUT\n", name, node->nid); |
740 | err = snd_hda_ctl_add(codec, snd_ctl_new1(&knew, codec)); | 741 | err = snd_hda_ctl_add(codec, node->nid, |
742 | snd_ctl_new1(&knew, codec)); | ||
741 | if (err < 0) | 743 | if (err < 0) |
742 | return err; | 744 | return err; |
743 | created = 1; | 745 | created = 1; |
@@ -751,7 +753,8 @@ static int create_mixer(struct hda_codec *codec, struct hda_gnode *node, | |||
751 | (node->amp_in_caps & AC_AMPCAP_NUM_STEPS)) { | 753 | (node->amp_in_caps & AC_AMPCAP_NUM_STEPS)) { |
752 | knew = (struct snd_kcontrol_new)HDA_CODEC_VOLUME(name, node->nid, index, HDA_INPUT); | 754 | knew = (struct snd_kcontrol_new)HDA_CODEC_VOLUME(name, node->nid, index, HDA_INPUT); |
753 | snd_printdd("[%s] NID=0x%x, DIR=IN, IDX=0x%x\n", name, node->nid, index); | 755 | snd_printdd("[%s] NID=0x%x, DIR=IN, IDX=0x%x\n", name, node->nid, index); |
754 | err = snd_hda_ctl_add(codec, snd_ctl_new1(&knew, codec)); | 756 | err = snd_hda_ctl_add(codec, node->nid, |
757 | snd_ctl_new1(&knew, codec)); | ||
755 | if (err < 0) | 758 | if (err < 0) |
756 | return err; | 759 | return err; |
757 | created = 1; | 760 | created = 1; |
@@ -759,7 +762,8 @@ static int create_mixer(struct hda_codec *codec, struct hda_gnode *node, | |||
759 | (node->amp_out_caps & AC_AMPCAP_NUM_STEPS)) { | 762 | (node->amp_out_caps & AC_AMPCAP_NUM_STEPS)) { |
760 | knew = (struct snd_kcontrol_new)HDA_CODEC_VOLUME(name, node->nid, 0, HDA_OUTPUT); | 763 | knew = (struct snd_kcontrol_new)HDA_CODEC_VOLUME(name, node->nid, 0, HDA_OUTPUT); |
761 | snd_printdd("[%s] NID=0x%x, DIR=OUT\n", name, node->nid); | 764 | snd_printdd("[%s] NID=0x%x, DIR=OUT\n", name, node->nid); |
762 | err = snd_hda_ctl_add(codec, snd_ctl_new1(&knew, codec)); | 765 | err = snd_hda_ctl_add(codec, node->nid, |
766 | snd_ctl_new1(&knew, codec)); | ||
763 | if (err < 0) | 767 | if (err < 0) |
764 | return err; | 768 | return err; |
765 | created = 1; | 769 | created = 1; |
@@ -857,7 +861,7 @@ static int build_input_controls(struct hda_codec *codec) | |||
857 | } | 861 | } |
858 | 862 | ||
859 | /* create input MUX if multiple sources are available */ | 863 | /* create input MUX if multiple sources are available */ |
860 | err = snd_hda_ctl_add(codec, snd_ctl_new1(&cap_sel, codec)); | 864 | err = snd_hda_ctl_add(codec, 0, snd_ctl_new1(&cap_sel, codec)); |
861 | if (err < 0) | 865 | if (err < 0) |
862 | return err; | 866 | return err; |
863 | 867 | ||
@@ -875,7 +879,8 @@ static int build_input_controls(struct hda_codec *codec) | |||
875 | HDA_CODEC_VOLUME(name, adc_node->nid, | 879 | HDA_CODEC_VOLUME(name, adc_node->nid, |
876 | spec->input_mux.items[i].index, | 880 | spec->input_mux.items[i].index, |
877 | HDA_INPUT); | 881 | HDA_INPUT); |
878 | err = snd_hda_ctl_add(codec, snd_ctl_new1(&knew, codec)); | 882 | err = snd_hda_ctl_add(codec, adc_node->nid, |
883 | snd_ctl_new1(&knew, codec)); | ||
879 | if (err < 0) | 884 | if (err < 0) |
880 | return err; | 885 | return err; |
881 | } | 886 | } |
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 3001794ad291..e6a0918f70d3 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
@@ -440,7 +440,13 @@ int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, | |||
440 | unsigned int caps); | 440 | unsigned int caps); |
441 | u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid); | 441 | u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid); |
442 | 442 | ||
443 | int snd_hda_ctl_add(struct hda_codec *codec, struct snd_kcontrol *kctl); | 443 | struct hda_nid_item { |
444 | struct snd_kcontrol *kctl; | ||
445 | hda_nid_t nid; | ||
446 | }; | ||
447 | |||
448 | int snd_hda_ctl_add(struct hda_codec *codec, hda_nid_t nid, | ||
449 | struct snd_kcontrol *kctl); | ||
444 | void snd_hda_ctls_clear(struct hda_codec *codec); | 450 | void snd_hda_ctls_clear(struct hda_codec *codec); |
445 | 451 | ||
446 | /* | 452 | /* |
@@ -514,7 +520,8 @@ int snd_hda_check_amp_list_power(struct hda_codec *codec, | |||
514 | * AMP control callbacks | 520 | * AMP control callbacks |
515 | */ | 521 | */ |
516 | /* retrieve parameters from private_value */ | 522 | /* retrieve parameters from private_value */ |
517 | #define get_amp_nid(kc) ((kc)->private_value & 0xffff) | 523 | #define get_amp_nid_(pv) ((pv) & 0xffff) |
524 | #define get_amp_nid(kc) get_amp_nid_((kc)->private_value) | ||
518 | #define get_amp_channels(kc) (((kc)->private_value >> 16) & 0x3) | 525 | #define get_amp_channels(kc) (((kc)->private_value >> 16) & 0x3) |
519 | #define get_amp_direction(kc) (((kc)->private_value >> 18) & 0x1) | 526 | #define get_amp_direction(kc) (((kc)->private_value >> 18) & 0x1) |
520 | #define get_amp_index(kc) (((kc)->private_value >> 19) & 0xf) | 527 | #define get_amp_index(kc) (((kc)->private_value >> 19) & 0xf) |
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index f5b783ce450d..f465cff28041 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c | |||
@@ -46,6 +46,41 @@ static const char *get_wid_type_name(unsigned int wid_value) | |||
46 | return "UNKNOWN Widget"; | 46 | return "UNKNOWN Widget"; |
47 | } | 47 | } |
48 | 48 | ||
49 | static void print_nid_mixers(struct snd_info_buffer *buffer, | ||
50 | struct hda_codec *codec, hda_nid_t nid) | ||
51 | { | ||
52 | int i; | ||
53 | struct hda_nid_item *items = codec->mixers.list; | ||
54 | struct snd_kcontrol *kctl; | ||
55 | for (i = 0; i < codec->mixers.used; i++) { | ||
56 | if (items[i].nid == nid) { | ||
57 | kctl = items[i].kctl; | ||
58 | snd_iprintf(buffer, | ||
59 | " Control: name=\"%s\", index=%i, device=%i\n", | ||
60 | kctl->id.name, kctl->id.index, kctl->id.device); | ||
61 | } | ||
62 | } | ||
63 | } | ||
64 | |||
65 | static void print_nid_pcms(struct snd_info_buffer *buffer, | ||
66 | struct hda_codec *codec, hda_nid_t nid) | ||
67 | { | ||
68 | int pcm, type; | ||
69 | struct hda_pcm *cpcm; | ||
70 | for (pcm = 0; pcm < codec->num_pcms; pcm++) { | ||
71 | cpcm = &codec->pcm_info[pcm]; | ||
72 | for (type = 0; type < 2; type++) { | ||
73 | if (cpcm->stream[type].nid != nid || cpcm->pcm == NULL) | ||
74 | continue; | ||
75 | snd_iprintf(buffer, " Device: name=\"%s\", " | ||
76 | "type=\"%s\", device=%i\n", | ||
77 | cpcm->name, | ||
78 | snd_hda_pcm_type_name[cpcm->pcm_type], | ||
79 | cpcm->pcm->device); | ||
80 | } | ||
81 | } | ||
82 | } | ||
83 | |||
49 | static void print_amp_caps(struct snd_info_buffer *buffer, | 84 | static void print_amp_caps(struct snd_info_buffer *buffer, |
50 | struct hda_codec *codec, hda_nid_t nid, int dir) | 85 | struct hda_codec *codec, hda_nid_t nid, int dir) |
51 | { | 86 | { |
@@ -309,21 +344,7 @@ static void print_audio_io(struct snd_info_buffer *buffer, | |||
309 | struct hda_codec *codec, hda_nid_t nid, | 344 | struct hda_codec *codec, hda_nid_t nid, |
310 | unsigned int wid_type) | 345 | unsigned int wid_type) |
311 | { | 346 | { |
312 | int pcm, conv; | 347 | int conv = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0); |
313 | for (pcm = 0; pcm < codec->num_pcms; pcm++) { | ||
314 | int type; | ||
315 | struct hda_pcm *cpcm = &codec->pcm_info[pcm]; | ||
316 | for (type = 0; type < 2; type++) { | ||
317 | if (cpcm->stream[type].nid != nid || cpcm->pcm == NULL) | ||
318 | continue; | ||
319 | snd_iprintf(buffer, " Device: name=\"%s\", " | ||
320 | "type=\"%s\", device=%i\n", | ||
321 | cpcm->name, | ||
322 | snd_hda_pcm_type_name[cpcm->pcm_type], | ||
323 | cpcm->pcm->device); | ||
324 | } | ||
325 | } | ||
326 | conv = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0); | ||
327 | snd_iprintf(buffer, | 348 | snd_iprintf(buffer, |
328 | " Converter: stream=%d, channel=%d\n", | 349 | " Converter: stream=%d, channel=%d\n", |
329 | (conv & AC_CONV_STREAM) >> AC_CONV_STREAM_SHIFT, | 350 | (conv & AC_CONV_STREAM) >> AC_CONV_STREAM_SHIFT, |
@@ -471,6 +492,7 @@ static void print_gpio(struct snd_info_buffer *buffer, | |||
471 | (data & (1<<i)) ? 1 : 0, | 492 | (data & (1<<i)) ? 1 : 0, |
472 | (unsol & (1<<i)) ? 1 : 0); | 493 | (unsol & (1<<i)) ? 1 : 0); |
473 | /* FIXME: add GPO and GPI pin information */ | 494 | /* FIXME: add GPO and GPI pin information */ |
495 | print_nid_mixers(buffer, codec, nid); | ||
474 | } | 496 | } |
475 | 497 | ||
476 | static void print_codec_info(struct snd_info_entry *entry, | 498 | static void print_codec_info(struct snd_info_entry *entry, |
@@ -550,6 +572,9 @@ static void print_codec_info(struct snd_info_entry *entry, | |||
550 | snd_iprintf(buffer, " CP"); | 572 | snd_iprintf(buffer, " CP"); |
551 | snd_iprintf(buffer, "\n"); | 573 | snd_iprintf(buffer, "\n"); |
552 | 574 | ||
575 | print_nid_mixers(buffer, codec, nid); | ||
576 | print_nid_pcms(buffer, codec, nid); | ||
577 | |||
553 | /* volume knob is a special widget that always have connection | 578 | /* volume knob is a special widget that always have connection |
554 | * list | 579 | * list |
555 | */ | 580 | */ |
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index a0293614a0b9..ef3383912b6e 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -202,7 +202,9 @@ static int ad198x_build_controls(struct hda_codec *codec) | |||
202 | if (!kctl) | 202 | if (!kctl) |
203 | return -ENOMEM; | 203 | return -ENOMEM; |
204 | kctl->private_value = spec->beep_amp; | 204 | kctl->private_value = spec->beep_amp; |
205 | err = snd_hda_ctl_add(codec, kctl); | 205 | err = snd_hda_ctl_add(codec, |
206 | get_amp_nid_(spec->beep_amp), | ||
207 | kctl); | ||
206 | if (err < 0) | 208 | if (err < 0) |
207 | return err; | 209 | return err; |
208 | } | 210 | } |
diff --git a/sound/pci/hda/patch_ca0110.c b/sound/pci/hda/patch_ca0110.c index d08353d3bb7f..af478019088e 100644 --- a/sound/pci/hda/patch_ca0110.c +++ b/sound/pci/hda/patch_ca0110.c | |||
@@ -144,7 +144,7 @@ static int _add_switch(struct hda_codec *codec, hda_nid_t nid, const char *pfx, | |||
144 | struct snd_kcontrol_new knew = | 144 | struct snd_kcontrol_new knew = |
145 | HDA_CODEC_MUTE_MONO(namestr, nid, chan, 0, type); | 145 | HDA_CODEC_MUTE_MONO(namestr, nid, chan, 0, type); |
146 | sprintf(namestr, "%s %s Switch", pfx, dirstr[dir]); | 146 | sprintf(namestr, "%s %s Switch", pfx, dirstr[dir]); |
147 | return snd_hda_ctl_add(codec, snd_ctl_new1(&knew, codec)); | 147 | return snd_hda_ctl_add(codec, nid, snd_ctl_new1(&knew, codec)); |
148 | } | 148 | } |
149 | 149 | ||
150 | static int _add_volume(struct hda_codec *codec, hda_nid_t nid, const char *pfx, | 150 | static int _add_volume(struct hda_codec *codec, hda_nid_t nid, const char *pfx, |
@@ -155,7 +155,7 @@ static int _add_volume(struct hda_codec *codec, hda_nid_t nid, const char *pfx, | |||
155 | struct snd_kcontrol_new knew = | 155 | struct snd_kcontrol_new knew = |
156 | HDA_CODEC_VOLUME_MONO(namestr, nid, chan, 0, type); | 156 | HDA_CODEC_VOLUME_MONO(namestr, nid, chan, 0, type); |
157 | sprintf(namestr, "%s %s Volume", pfx, dirstr[dir]); | 157 | sprintf(namestr, "%s %s Volume", pfx, dirstr[dir]); |
158 | return snd_hda_ctl_add(codec, snd_ctl_new1(&knew, codec)); | 158 | return snd_hda_ctl_add(codec, nid, snd_ctl_new1(&knew, codec)); |
159 | } | 159 | } |
160 | 160 | ||
161 | #define add_out_switch(codec, nid, pfx) _add_switch(codec, nid, pfx, 3, 0) | 161 | #define add_out_switch(codec, nid, pfx) _add_switch(codec, nid, pfx, 3, 0) |
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c index 8ba306856d38..9ac09e4568b3 100644 --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c | |||
@@ -500,7 +500,7 @@ static int add_mute(struct hda_codec *codec, const char *name, int index, | |||
500 | knew.private_value = pval; | 500 | knew.private_value = pval; |
501 | snprintf(tmp, sizeof(tmp), "%s %s Switch", name, dir_sfx[dir]); | 501 | snprintf(tmp, sizeof(tmp), "%s %s Switch", name, dir_sfx[dir]); |
502 | *kctlp = snd_ctl_new1(&knew, codec); | 502 | *kctlp = snd_ctl_new1(&knew, codec); |
503 | return snd_hda_ctl_add(codec, *kctlp); | 503 | return snd_hda_ctl_add(codec, get_amp_nid_(pval), *kctlp); |
504 | } | 504 | } |
505 | 505 | ||
506 | static int add_volume(struct hda_codec *codec, const char *name, | 506 | static int add_volume(struct hda_codec *codec, const char *name, |
@@ -513,7 +513,7 @@ static int add_volume(struct hda_codec *codec, const char *name, | |||
513 | knew.private_value = pval; | 513 | knew.private_value = pval; |
514 | snprintf(tmp, sizeof(tmp), "%s %s Volume", name, dir_sfx[dir]); | 514 | snprintf(tmp, sizeof(tmp), "%s %s Volume", name, dir_sfx[dir]); |
515 | *kctlp = snd_ctl_new1(&knew, codec); | 515 | *kctlp = snd_ctl_new1(&knew, codec); |
516 | return snd_hda_ctl_add(codec, *kctlp); | 516 | return snd_hda_ctl_add(codec, get_amp_nid_(pval), *kctlp); |
517 | } | 517 | } |
518 | 518 | ||
519 | static void fix_volume_caps(struct hda_codec *codec, hda_nid_t dac) | 519 | static void fix_volume_caps(struct hda_codec *codec, hda_nid_t dac) |
@@ -536,14 +536,14 @@ static int add_vmaster(struct hda_codec *codec, hda_nid_t dac) | |||
536 | 536 | ||
537 | spec->vmaster_sw = | 537 | spec->vmaster_sw = |
538 | snd_ctl_make_virtual_master("Master Playback Switch", NULL); | 538 | snd_ctl_make_virtual_master("Master Playback Switch", NULL); |
539 | err = snd_hda_ctl_add(codec, spec->vmaster_sw); | 539 | err = snd_hda_ctl_add(codec, dac, spec->vmaster_sw); |
540 | if (err < 0) | 540 | if (err < 0) |
541 | return err; | 541 | return err; |
542 | 542 | ||
543 | snd_hda_set_vmaster_tlv(codec, dac, HDA_OUTPUT, tlv); | 543 | snd_hda_set_vmaster_tlv(codec, dac, HDA_OUTPUT, tlv); |
544 | spec->vmaster_vol = | 544 | spec->vmaster_vol = |
545 | snd_ctl_make_virtual_master("Master Playback Volume", tlv); | 545 | snd_ctl_make_virtual_master("Master Playback Volume", tlv); |
546 | err = snd_hda_ctl_add(codec, spec->vmaster_vol); | 546 | err = snd_hda_ctl_add(codec, dac, spec->vmaster_vol); |
547 | if (err < 0) | 547 | if (err < 0) |
548 | return err; | 548 | return err; |
549 | return 0; | 549 | return 0; |
@@ -756,13 +756,13 @@ static int build_input(struct hda_codec *codec) | |||
756 | if (!kctl) | 756 | if (!kctl) |
757 | return -ENOMEM; | 757 | return -ENOMEM; |
758 | kctl->private_value = (long)spec->capture_bind[i]; | 758 | kctl->private_value = (long)spec->capture_bind[i]; |
759 | err = snd_hda_ctl_add(codec, kctl); | 759 | err = snd_hda_ctl_add(codec, 0, kctl); |
760 | if (err < 0) | 760 | if (err < 0) |
761 | return err; | 761 | return err; |
762 | } | 762 | } |
763 | 763 | ||
764 | if (spec->num_inputs > 1 && !spec->mic_detect) { | 764 | if (spec->num_inputs > 1 && !spec->mic_detect) { |
765 | err = snd_hda_ctl_add(codec, | 765 | err = snd_hda_ctl_add(codec, 0, |
766 | snd_ctl_new1(&cs_capture_source, codec)); | 766 | snd_ctl_new1(&cs_capture_source, codec)); |
767 | if (err < 0) | 767 | if (err < 0) |
768 | return err; | 768 | return err; |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 8c04e0e0f655..fff9de245646 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -2461,7 +2461,8 @@ static int alc_build_controls(struct hda_codec *codec) | |||
2461 | if (!kctl) | 2461 | if (!kctl) |
2462 | return -ENOMEM; | 2462 | return -ENOMEM; |
2463 | kctl->private_value = spec->beep_amp; | 2463 | kctl->private_value = spec->beep_amp; |
2464 | err = snd_hda_ctl_add(codec, kctl); | 2464 | err = snd_hda_ctl_add(codec, |
2465 | get_amp_nid_(spec->beep_amp), kctl); | ||
2465 | if (err < 0) | 2466 | if (err < 0) |
2466 | return err; | 2467 | return err; |
2467 | } | 2468 | } |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 87ba239ff1c9..a3872b90d6ed 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -1085,7 +1085,7 @@ static int stac92xx_build_controls(struct hda_codec *codec) | |||
1085 | if (!spec->auto_mic && spec->num_dmuxes > 0 && | 1085 | if (!spec->auto_mic && spec->num_dmuxes > 0 && |
1086 | snd_hda_get_bool_hint(codec, "separate_dmux") == 1) { | 1086 | snd_hda_get_bool_hint(codec, "separate_dmux") == 1) { |
1087 | stac_dmux_mixer.count = spec->num_dmuxes; | 1087 | stac_dmux_mixer.count = spec->num_dmuxes; |
1088 | err = snd_hda_ctl_add(codec, | 1088 | err = snd_hda_ctl_add(codec, 0, |
1089 | snd_ctl_new1(&stac_dmux_mixer, codec)); | 1089 | snd_ctl_new1(&stac_dmux_mixer, codec)); |
1090 | if (err < 0) | 1090 | if (err < 0) |
1091 | return err; | 1091 | return err; |
@@ -1101,7 +1101,7 @@ static int stac92xx_build_controls(struct hda_codec *codec) | |||
1101 | spec->spdif_mute = 1; | 1101 | spec->spdif_mute = 1; |
1102 | } | 1102 | } |
1103 | stac_smux_mixer.count = spec->num_smuxes; | 1103 | stac_smux_mixer.count = spec->num_smuxes; |
1104 | err = snd_hda_ctl_add(codec, | 1104 | err = snd_hda_ctl_add(codec, 0, |
1105 | snd_ctl_new1(&stac_smux_mixer, codec)); | 1105 | snd_ctl_new1(&stac_smux_mixer, codec)); |
1106 | if (err < 0) | 1106 | if (err < 0) |
1107 | return err; | 1107 | return err; |