aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-11-02 16:30:51 -0400
committerTakashi Iwai <tiwai@suse.de>2011-11-02 16:30:51 -0400
commit1fa1757366783fb52e6e85c2d735db49b818d382 (patch)
treea52f76fa88814741ca293837c9ff8f6e96a4a539 /sound/pci
parentad5d8755116b431f0709c745ee17cb567a478d43 (diff)
ALSA: hda/realtek - Don't create alt-stream for capture when unnecessary
When the driver finds multiple ADCs, it tries to create an alternative capture PCM stream. However, these secondary ADCs might be useless or in uncontrolled paths in some cases, e.g. when auto-mic or dynamic ADC-switching is enabled. Also, when only a single capture source is available, the multi-streams don't make sense, too. With this patch, the driver checks such condition and skips the alt stream appropriately. Cc: <stable@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/patch_realtek.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 8f93b97559a5..4468cb7ea688 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2270,6 +2270,7 @@ static int alc_build_pcms(struct hda_codec *codec)
2270 struct alc_spec *spec = codec->spec; 2270 struct alc_spec *spec = codec->spec;
2271 struct hda_pcm *info = spec->pcm_rec; 2271 struct hda_pcm *info = spec->pcm_rec;
2272 const struct hda_pcm_stream *p; 2272 const struct hda_pcm_stream *p;
2273 bool have_multi_adcs;
2273 int i; 2274 int i;
2274 2275
2275 codec->num_pcms = 1; 2276 codec->num_pcms = 1;
@@ -2348,8 +2349,11 @@ static int alc_build_pcms(struct hda_codec *codec)
2348 /* If the use of more than one ADC is requested for the current 2349 /* If the use of more than one ADC is requested for the current
2349 * model, configure a second analog capture-only PCM. 2350 * model, configure a second analog capture-only PCM.
2350 */ 2351 */
2352 have_multi_adcs = (spec->num_adc_nids > 1) &&
2353 !spec->dyn_adc_switch && !spec->auto_mic &&
2354 (!spec->input_mux || spec->input_mux->num_items > 1);
2351 /* Additional Analaog capture for index #2 */ 2355 /* Additional Analaog capture for index #2 */
2352 if (spec->alt_dac_nid || spec->num_adc_nids > 1) { 2356 if (spec->alt_dac_nid || have_multi_adcs) {
2353 codec->num_pcms = 3; 2357 codec->num_pcms = 3;
2354 info = spec->pcm_rec + 2; 2358 info = spec->pcm_rec + 2;
2355 info->name = spec->stream_name_analog; 2359 info->name = spec->stream_name_analog;
@@ -2365,7 +2369,7 @@ static int alc_build_pcms(struct hda_codec *codec)
2365 alc_pcm_null_stream; 2369 alc_pcm_null_stream;
2366 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; 2370 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
2367 } 2371 }
2368 if (spec->num_adc_nids > 1) { 2372 if (have_multi_adcs) {
2369 p = spec->stream_analog_alt_capture; 2373 p = spec->stream_analog_alt_capture;
2370 if (!p) 2374 if (!p)
2371 p = &alc_pcm_analog_alt_capture; 2375 p = &alc_pcm_analog_alt_capture;