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>
This commit is contained in:
Takashi Iwai 2009-06-22 10:56:54 +02:00
parent 0169b6b33b
commit 8c927b4acf

View file

@ -10901,9 +10901,27 @@ static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
return 0; return 0;
} }
/* identical with ALC880 */ static int alc262_auto_create_analog_input_ctls(struct alc_spec *spec,
#define alc262_auto_create_analog_input_ctls \ const struct auto_pin_cfg *cfg)
alc880_auto_create_analog_input_ctls {
int err;
err = alc880_auto_create_analog_input_ctls(spec, cfg);
if (err < 0)
return err;
/* digital-mic input pin is excluded in alc880_auto_create..()
* because it's under 0x18
*/
if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
struct hda_input_mux *imux = &spec->private_imux[0];
imux->items[imux->num_items].label = "Int Mic";
imux->items[imux->num_items].index = 0x09;
imux->num_items++;
}
return 0;
}
/* /*
* generic initialization of ADC, input mixers and output mixers * generic initialization of ADC, input mixers and output mixers
@ -11631,19 +11649,35 @@ static int patch_alc262(struct hda_codec *codec)
spec->stream_digital_capture = &alc262_pcm_digital_capture; spec->stream_digital_capture = &alc262_pcm_digital_capture;
if (!spec->adc_nids && spec->input_mux) { if (!spec->adc_nids && spec->input_mux) {
/* check whether NID 0x07 is valid */ int i;
unsigned int wcap = get_wcaps(codec, 0x07); /* check whether the digital-mic has to be supported */
for (i = 0; i < spec->input_mux->num_items; i++) {
/* get type */ if (spec->input_mux->items[i].index >= 9)
wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; break;
if (wcap != AC_WID_AUD_IN) { }
spec->adc_nids = alc262_adc_nids_alt; if (i < spec->input_mux->num_items) {
spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); /* use only ADC0 */
spec->capsrc_nids = alc262_capsrc_nids_alt; spec->adc_nids = alc262_dmic_adc_nids;
spec->num_adc_nids = 1;
spec->capsrc_nids = alc262_dmic_capsrc_nids;
} else { } else {
spec->adc_nids = alc262_adc_nids; /* all analog inputs */
spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); /* check whether NID 0x07 is valid */
spec->capsrc_nids = alc262_capsrc_nids; unsigned int wcap = get_wcaps(codec, 0x07);
/* get type */
wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
if (wcap != AC_WID_AUD_IN) {
spec->adc_nids = alc262_adc_nids_alt;
spec->num_adc_nids =
ARRAY_SIZE(alc262_adc_nids_alt);
spec->capsrc_nids = alc262_capsrc_nids_alt;
} else {
spec->adc_nids = alc262_adc_nids;
spec->num_adc_nids =
ARRAY_SIZE(alc262_adc_nids);
spec->capsrc_nids = alc262_capsrc_nids;
}
} }
} }
if (!spec->cap_mixer && !spec->no_analog) if (!spec->cap_mixer && !spec->no_analog)
@ -13233,26 +13267,8 @@ static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
return 0; return 0;
} }
static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec, #define alc269_auto_create_analog_input_ctls \
const struct auto_pin_cfg *cfg) alc262_auto_create_analog_input_ctls
{
int err;
err = alc880_auto_create_analog_input_ctls(spec, cfg);
if (err < 0)
return err;
/* digital-mic input pin is excluded in alc880_auto_create..()
* because it's under 0x18
*/
if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
struct hda_input_mux *imux = &spec->private_imux[0];
imux->items[imux->num_items].label = "Int Mic";
imux->items[imux->num_items].index = 0x05;
imux->num_items++;
}
return 0;
}
#ifdef CONFIG_SND_HDA_POWER_SAVE #ifdef CONFIG_SND_HDA_POWER_SAVE
#define alc269_loopbacks alc880_loopbacks #define alc269_loopbacks alc880_loopbacks