diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-12-23 02:31:59 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-12-23 02:38:28 -0500 |
commit | 21949f00a022e090a7e8bc9a01dfca88273c6146 (patch) | |
tree | ea13d6d9cef974da83a7cb5ccacbbd0ca7fbf3b4 /sound/pci | |
parent | 524027916e5763a0c9a7da80aa8dd013a14a0440 (diff) |
ALSA: hda - Fix NID association for capture mixers
Fix the wrong implementation of NID <-> kctl mapping for capture mixers
introduced by the ocmmit 5b0cb1d850c26893b1468b3a519433a1b7a176be.
So far, the driver returns an error at probe.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 26 | ||||
-rw-r--r-- | sound/pci/hda/hda_local.h | 2 | ||||
-rw-r--r-- | sound/pci/hda/patch_analog.c | 3 | ||||
-rw-r--r-- | sound/pci/hda/patch_cirrus.c | 12 | ||||
-rw-r--r-- | sound/pci/hda/patch_cmedia.c | 3 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 3 | ||||
-rw-r--r-- | sound/pci/hda/patch_via.c | 3 |
7 files changed, 12 insertions, 40 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index c848ec0f085e..29c90d748c91 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -3537,32 +3537,6 @@ int snd_hda_add_new_ctls(struct hda_codec *codec, struct snd_kcontrol_new *knew) | |||
3537 | } | 3537 | } |
3538 | EXPORT_SYMBOL_HDA(snd_hda_add_new_ctls); | 3538 | EXPORT_SYMBOL_HDA(snd_hda_add_new_ctls); |
3539 | 3539 | ||
3540 | /** | ||
3541 | * snd_hda_add_nids - assign nids to controls from the array | ||
3542 | * @codec: the HDA codec | ||
3543 | * @kctl: struct snd_kcontrol | ||
3544 | * @index: index to kctl | ||
3545 | * @nids: the array of hda_nid_t | ||
3546 | * @size: count of hda_nid_t items | ||
3547 | * | ||
3548 | * This helper function assigns NIDs in the given array to a control element. | ||
3549 | * | ||
3550 | * Returns 0 if successful, or a negative error code. | ||
3551 | */ | ||
3552 | int snd_hda_add_nids(struct hda_codec *codec, struct snd_kcontrol *kctl, | ||
3553 | unsigned int index, hda_nid_t *nids, unsigned int size) | ||
3554 | { | ||
3555 | int err; | ||
3556 | |||
3557 | for ( ; size > 0; size--, nids++) { | ||
3558 | err = snd_hda_add_nid(codec, kctl, index, *nids); | ||
3559 | if (err < 0) | ||
3560 | return err; | ||
3561 | } | ||
3562 | return 0; | ||
3563 | } | ||
3564 | EXPORT_SYMBOL_HDA(snd_hda_add_nids); | ||
3565 | |||
3566 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 3540 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
3567 | static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, | 3541 | static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, |
3568 | unsigned int power_state); | 3542 | unsigned int power_state); |
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index d505d052972e..7cee364976ff 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
@@ -343,8 +343,6 @@ int snd_hda_check_board_codec_sid_config(struct hda_codec *codec, | |||
343 | const struct snd_pci_quirk *tbl); | 343 | const struct snd_pci_quirk *tbl); |
344 | int snd_hda_add_new_ctls(struct hda_codec *codec, | 344 | int snd_hda_add_new_ctls(struct hda_codec *codec, |
345 | struct snd_kcontrol_new *knew); | 345 | struct snd_kcontrol_new *knew); |
346 | int snd_hda_add_nids(struct hda_codec *codec, struct snd_kcontrol *kctl, | ||
347 | unsigned int index, hda_nid_t *nids, unsigned int size); | ||
348 | 346 | ||
349 | /* | 347 | /* |
350 | * unsolicited event handler | 348 | * unsolicited event handler |
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 92b72d4f3984..45ee352df329 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -244,8 +244,7 @@ static int ad198x_build_controls(struct hda_codec *codec) | |||
244 | if (!kctl) | 244 | if (!kctl) |
245 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); | 245 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
246 | for (i = 0; kctl && i < kctl->count; i++) { | 246 | for (i = 0; kctl && i < kctl->count; i++) { |
247 | err = snd_hda_add_nids(codec, kctl, i, spec->capsrc_nids, | 247 | err = snd_hda_add_nid(codec, kctl, i, spec->capsrc_nids[i]); |
248 | spec->input_mux->num_items); | ||
249 | if (err < 0) | 248 | if (err < 0) |
250 | return err; | 249 | return err; |
251 | } | 250 | } |
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c index 093cfbb55e9e..7de782a5b8f4 100644 --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c | |||
@@ -753,6 +753,7 @@ static int build_input(struct hda_codec *codec) | |||
753 | spec->capture_bind[1] = make_bind_capture(codec, &snd_hda_bind_vol); | 753 | spec->capture_bind[1] = make_bind_capture(codec, &snd_hda_bind_vol); |
754 | for (i = 0; i < 2; i++) { | 754 | for (i = 0; i < 2; i++) { |
755 | struct snd_kcontrol *kctl; | 755 | struct snd_kcontrol *kctl; |
756 | int n; | ||
756 | if (!spec->capture_bind[i]) | 757 | if (!spec->capture_bind[i]) |
757 | return -ENOMEM; | 758 | return -ENOMEM; |
758 | kctl = snd_ctl_new1(&cs_capture_ctls[i], codec); | 759 | kctl = snd_ctl_new1(&cs_capture_ctls[i], codec); |
@@ -762,10 +763,13 @@ static int build_input(struct hda_codec *codec) | |||
762 | err = snd_hda_ctl_add(codec, 0, kctl); | 763 | err = snd_hda_ctl_add(codec, 0, kctl); |
763 | if (err < 0) | 764 | if (err < 0) |
764 | return err; | 765 | return err; |
765 | err = snd_hda_add_nids(codec, kctl, 0, spec->adc_nid, | 766 | for (n = 0; n < AUTO_PIN_LAST; n++) { |
766 | spec->num_inputs); | 767 | if (!spec->adc_nid[n]) |
767 | if (err < 0) | 768 | continue; |
768 | return err; | 769 | err = snd_hda_add_nid(codec, kctl, 0, spec->adc_nid[i]); |
770 | if (err < 0) | ||
771 | return err; | ||
772 | } | ||
769 | } | 773 | } |
770 | 774 | ||
771 | if (spec->num_inputs > 1 && !spec->mic_detect) { | 775 | if (spec->num_inputs > 1 && !spec->mic_detect) { |
diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c index cc1c22370a60..ff60908f4554 100644 --- a/sound/pci/hda/patch_cmedia.c +++ b/sound/pci/hda/patch_cmedia.c | |||
@@ -345,8 +345,7 @@ static int cmi9880_build_controls(struct hda_codec *codec) | |||
345 | /* assign Capture Source enums to NID */ | 345 | /* assign Capture Source enums to NID */ |
346 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); | 346 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); |
347 | for (i = 0; kctl && i < kctl->count; i++) { | 347 | for (i = 0; kctl && i < kctl->count; i++) { |
348 | err = snd_hda_add_nids(codec, kctl, i, spec->adc_nids, | 348 | err = snd_hda_add_nid(codec, kctl, i, spec->adc_nids[i]); |
349 | spec->input_mux->num_items); | ||
350 | if (err < 0) | 349 | if (err < 0) |
351 | return err; | 350 | return err; |
352 | } | 351 | } |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index e7cdc6a7d61d..a45199014986 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -2551,8 +2551,7 @@ static int alc_build_controls(struct hda_codec *codec) | |||
2551 | hda_nid_t *nids = spec->capsrc_nids; | 2551 | hda_nid_t *nids = spec->capsrc_nids; |
2552 | if (!nids) | 2552 | if (!nids) |
2553 | nids = spec->adc_nids; | 2553 | nids = spec->adc_nids; |
2554 | err = snd_hda_add_nids(codec, kctl, i, nids, | 2554 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); |
2555 | spec->input_mux->num_items); | ||
2556 | if (err < 0) | 2555 | if (err < 0) |
2557 | return err; | 2556 | return err; |
2558 | } | 2557 | } |
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index de4839e46762..9ddc37300f6b 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c | |||
@@ -1907,8 +1907,7 @@ static int via_build_controls(struct hda_codec *codec) | |||
1907 | /* assign Capture Source enums to NID */ | 1907 | /* assign Capture Source enums to NID */ |
1908 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); | 1908 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
1909 | for (i = 0; kctl && i < kctl->count; i++) { | 1909 | for (i = 0; kctl && i < kctl->count; i++) { |
1910 | err = snd_hda_add_nids(codec, kctl, i, spec->mux_nids, | 1910 | err = snd_hda_add_nid(codec, kctl, i, spec->mux_nids[i]); |
1911 | spec->input_mux->num_items); | ||
1912 | if (err < 0) | 1911 | if (err < 0) |
1913 | return err; | 1912 | return err; |
1914 | } | 1913 | } |