aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-06-22 04:56:54 -0400
committerTakashi Iwai <tiwai@suse.de>2009-06-22 05:06:18 -0400
commit8c927b4acf819ed0170bff991bc9eaec4c85deb8 (patch)
treea0dc21778c8363897dabe0299268caf4a840c97a
parent0169b6b33b2b4d9e66e98afc56272e5fbd350df4 (diff)
ALSA: hda - Add digital-mic support to ALC262 auto model
Add the digital-mic support with ALC262 auto model. The new ALC262 models have the digital mic at NID 0x12. This widget isn't checked in the current alc262_auto_create_analog_input_ctls() since it's under 0x18. So, just reuse the routine for alc269 to fix the behavior. But, it doesn't suffice: the digital mic is supported only with the ADC0, we have to exclude other ADCs when d-mic is detected. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/patch_realtek.c86
1 files changed, 51 insertions, 35 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 28a587353b11..334533197425 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -10901,9 +10901,27 @@ static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10901 return 0; 10901 return 0;
10902} 10902}
10903 10903
10904/* identical with ALC880 */ 10904static int alc262_auto_create_analog_input_ctls(struct alc_spec *spec,
10905#define alc262_auto_create_analog_input_ctls \ 10905 const struct auto_pin_cfg *cfg)
10906 alc880_auto_create_analog_input_ctls 10906{
10907 int err;
10908
10909 err = alc880_auto_create_analog_input_ctls(spec, cfg);
10910 if (err < 0)
10911 return err;
10912 /* digital-mic input pin is excluded in alc880_auto_create..()
10913 * because it's under 0x18
10914 */
10915 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
10916 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
10917 struct hda_input_mux *imux = &spec->private_imux[0];
10918 imux->items[imux->num_items].label = "Int Mic";
10919 imux->items[imux->num_items].index = 0x09;
10920 imux->num_items++;
10921 }
10922 return 0;
10923}
10924
10907 10925
10908/* 10926/*
10909 * generic initialization of ADC, input mixers and output mixers 10927 * generic initialization of ADC, input mixers and output mixers
@@ -11631,19 +11649,35 @@ static int patch_alc262(struct hda_codec *codec)
11631 spec->stream_digital_capture = &alc262_pcm_digital_capture; 11649 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11632 11650
11633 if (!spec->adc_nids && spec->input_mux) { 11651 if (!spec->adc_nids && spec->input_mux) {
11634 /* check whether NID 0x07 is valid */ 11652 int i;
11635 unsigned int wcap = get_wcaps(codec, 0x07); 11653 /* check whether the digital-mic has to be supported */
11636 11654 for (i = 0; i < spec->input_mux->num_items; i++) {
11637 /* get type */ 11655 if (spec->input_mux->items[i].index >= 9)
11638 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; 11656 break;
11639 if (wcap != AC_WID_AUD_IN) { 11657 }
11640 spec->adc_nids = alc262_adc_nids_alt; 11658 if (i < spec->input_mux->num_items) {
11641 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); 11659 /* use only ADC0 */
11642 spec->capsrc_nids = alc262_capsrc_nids_alt; 11660 spec->adc_nids = alc262_dmic_adc_nids;
11661 spec->num_adc_nids = 1;
11662 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11643 } else { 11663 } else {
11644 spec->adc_nids = alc262_adc_nids; 11664 /* all analog inputs */
11645 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); 11665 /* check whether NID 0x07 is valid */
11646 spec->capsrc_nids = alc262_capsrc_nids; 11666 unsigned int wcap = get_wcaps(codec, 0x07);
11667
11668 /* get type */
11669 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11670 if (wcap != AC_WID_AUD_IN) {
11671 spec->adc_nids = alc262_adc_nids_alt;
11672 spec->num_adc_nids =
11673 ARRAY_SIZE(alc262_adc_nids_alt);
11674 spec->capsrc_nids = alc262_capsrc_nids_alt;
11675 } else {
11676 spec->adc_nids = alc262_adc_nids;
11677 spec->num_adc_nids =
11678 ARRAY_SIZE(alc262_adc_nids);
11679 spec->capsrc_nids = alc262_capsrc_nids;
11680 }
11647 } 11681 }
11648 } 11682 }
11649 if (!spec->cap_mixer && !spec->no_analog) 11683 if (!spec->cap_mixer && !spec->no_analog)
@@ -13233,26 +13267,8 @@ static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
13233 return 0; 13267 return 0;
13234} 13268}
13235 13269
13236static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec, 13270#define alc269_auto_create_analog_input_ctls \
13237 const struct auto_pin_cfg *cfg) 13271 alc262_auto_create_analog_input_ctls
13238{
13239 int err;
13240
13241 err = alc880_auto_create_analog_input_ctls(spec, cfg);
13242 if (err < 0)
13243 return err;
13244 /* digital-mic input pin is excluded in alc880_auto_create..()
13245 * because it's under 0x18
13246 */
13247 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
13248 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
13249 struct hda_input_mux *imux = &spec->private_imux[0];
13250 imux->items[imux->num_items].label = "Int Mic";
13251 imux->items[imux->num_items].index = 0x05;
13252 imux->num_items++;
13253 }
13254 return 0;
13255}
13256 13272
13257#ifdef CONFIG_SND_HDA_POWER_SAVE 13273#ifdef CONFIG_SND_HDA_POWER_SAVE
13258#define alc269_loopbacks alc880_loopbacks 13274#define alc269_loopbacks alc880_loopbacks