aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-01-17 07:09:33 -0500
committerTakashi Iwai <tiwai@suse.de>2010-01-17 07:09:33 -0500
commiteaa9b3a748539651f50e3a234c8854e1b42a839a (patch)
tree832759f8d23ee00bbb3b334c839c1f0372e3d8b9 /sound/pci
parentd38cce7046cfd0011f69d5dcf6a22525438154f6 (diff)
ALSA: hda - Fix capture on Sony VAIO with single input
Sony VAIO VGN-P11G with ALC262 codec has only one input pin, and the recording doesn't work with model=auto because ALC262 parser sets the wrong cap NIDs to choose the route and the default route for the sole input pin wasn't initialized properly. This patch solves these issues. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/patch_realtek.c62
1 files changed, 54 insertions, 8 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index abae1007cea2..3f92def752fd 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1230,6 +1230,8 @@ static void alc_init_auto_mic(struct hda_codec *codec)
1230 return; /* invalid entry */ 1230 return; /* invalid entry */
1231 } 1231 }
1232 } 1232 }
1233 if (!ext || !fixed)
1234 return;
1233 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) 1235 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1234 return; /* no unsol support */ 1236 return; /* no unsol support */
1235 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", 1237 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
@@ -4812,6 +4814,49 @@ static void fixup_automic_adc(struct hda_codec *codec)
4812 spec->auto_mic = 0; /* disable auto-mic to be sure */ 4814 spec->auto_mic = 0; /* disable auto-mic to be sure */
4813} 4815}
4814 4816
4817/* choose the ADC/MUX containing the input pin and initialize the setup */
4818static void fixup_single_adc(struct hda_codec *codec)
4819{
4820 struct alc_spec *spec = codec->spec;
4821 hda_nid_t pin;
4822 int i;
4823
4824 /* search for the input pin; there must be only one */
4825 for (i = 0; i < AUTO_PIN_LAST; i++) {
4826 if (spec->autocfg.input_pins[i]) {
4827 pin = spec->autocfg.input_pins[i];
4828 break;
4829 }
4830 }
4831 if (!pin)
4832 return;
4833
4834 /* set the default connection to that pin */
4835 for (i = 0; i < spec->num_adc_nids; i++) {
4836 hda_nid_t cap = spec->capsrc_nids ?
4837 spec->capsrc_nids[i] : spec->adc_nids[i];
4838 int idx;
4839
4840 idx = get_connection_index(codec, cap, pin);
4841 if (idx < 0)
4842 continue;
4843 /* use only this ADC */
4844 if (spec->capsrc_nids)
4845 spec->capsrc_nids += i;
4846 spec->adc_nids += i;
4847 spec->num_adc_nids = 1;
4848 /* select or unmute this route */
4849 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
4850 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
4851 HDA_AMP_MUTE, 0);
4852 } else {
4853 snd_hda_codec_write_cache(codec, cap, 0,
4854 AC_VERB_SET_CONNECT_SEL, idx);
4855 }
4856 return;
4857 }
4858}
4859
4815static void set_capture_mixer(struct hda_codec *codec) 4860static void set_capture_mixer(struct hda_codec *codec)
4816{ 4861{
4817 struct alc_spec *spec = codec->spec; 4862 struct alc_spec *spec = codec->spec;
@@ -4824,14 +4869,15 @@ static void set_capture_mixer(struct hda_codec *codec)
4824 alc_capture_mixer3 }, 4869 alc_capture_mixer3 },
4825 }; 4870 };
4826 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { 4871 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4827 int mux; 4872 int mux = 0;
4828 if (spec->auto_mic) { 4873 if (spec->auto_mic)
4829 mux = 0;
4830 fixup_automic_adc(codec); 4874 fixup_automic_adc(codec);
4831 } else if (spec->input_mux && spec->input_mux->num_items > 1) 4875 else if (spec->input_mux) {
4832 mux = 1; 4876 if (spec->input_mux->num_items > 1)
4833 else 4877 mux = 1;
4834 mux = 0; 4878 else if (spec->input_mux->num_items == 1)
4879 fixup_single_adc(codec);
4880 }
4835 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; 4881 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4836 } 4882 }
4837} 4883}
@@ -11203,7 +11249,7 @@ static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11203} 11249}
11204 11250
11205#define alc262_auto_create_input_ctls \ 11251#define alc262_auto_create_input_ctls \
11206 alc880_auto_create_input_ctls 11252 alc882_auto_create_input_ctls
11207 11253
11208/* 11254/*
11209 * generic initialization of ADC, input mixers and output mixers 11255 * generic initialization of ADC, input mixers and output mixers