diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-07-30 07:09:08 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-07-30 07:09:08 -0400 |
commit | 5207e10ed49c515e7432d0b1a7561ccc7b71f9df (patch) | |
tree | e09b09cc262f505f1bbbc6b9fe9d217d8469e8cd /sound/pci | |
parent | 6732bd0d15893d20359396309adc238e0af10b58 (diff) |
ALSA: hda - Integrate Digital Input Source to Input Source
STAC/IDT codecs provide both "Input Source" and "Digital Input Source"
controls to choose the analog input source and the digital input source.
But this is far user-unfriendly.
This patch merges the input source selections into one "Input Source"
control. To have separate digital and analog input source controls,
you can pass "separate_dmux = 1 " hint string.
At the same time, this patch gets rid of analog mixer stuff that was
already disabled in previous patches.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 168 |
1 files changed, 59 insertions, 109 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 883e2aa10071..3457f619bad1 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -246,6 +246,7 @@ struct sigmatel_spec { | |||
246 | unsigned int num_dmuxes; | 246 | unsigned int num_dmuxes; |
247 | hda_nid_t *smux_nids; | 247 | hda_nid_t *smux_nids; |
248 | unsigned int num_smuxes; | 248 | unsigned int num_smuxes; |
249 | unsigned int num_analog_muxes; | ||
249 | 250 | ||
250 | unsigned long *capvols; /* amp-volume attr: HDA_COMPOSE_AMP_VAL() */ | 251 | unsigned long *capvols; /* amp-volume attr: HDA_COMPOSE_AMP_VAL() */ |
251 | unsigned long *capsws; /* amp-mute attr: HDA_COMPOSE_AMP_VAL() */ | 252 | unsigned long *capsws; /* amp-mute attr: HDA_COMPOSE_AMP_VAL() */ |
@@ -765,9 +766,35 @@ static int stac92xx_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
765 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 766 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
766 | struct sigmatel_spec *spec = codec->spec; | 767 | struct sigmatel_spec *spec = codec->spec; |
767 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | 768 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
768 | 769 | const struct hda_input_mux *imux = spec->input_mux; | |
769 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, | 770 | unsigned int idx, prev_idx; |
770 | spec->mux_nids[adc_idx], &spec->cur_mux[adc_idx]); | 771 | |
772 | idx = ucontrol->value.enumerated.item[0]; | ||
773 | if (idx >= imux->num_items) | ||
774 | idx = imux->num_items - 1; | ||
775 | prev_idx = spec->cur_mux[adc_idx]; | ||
776 | if (prev_idx == idx) | ||
777 | return 0; | ||
778 | if (idx < spec->num_analog_muxes) { | ||
779 | snd_hda_codec_write_cache(codec, spec->mux_nids[adc_idx], 0, | ||
780 | AC_VERB_SET_CONNECT_SEL, | ||
781 | imux->items[idx].index); | ||
782 | if (prev_idx >= spec->num_analog_muxes) { | ||
783 | imux = spec->dinput_mux; | ||
784 | /* 0 = analog */ | ||
785 | snd_hda_codec_write_cache(codec, | ||
786 | spec->dmux_nids[adc_idx], 0, | ||
787 | AC_VERB_SET_CONNECT_SEL, | ||
788 | imux->items[0].index); | ||
789 | } | ||
790 | } else { | ||
791 | imux = spec->dinput_mux; | ||
792 | snd_hda_codec_write_cache(codec, spec->dmux_nids[adc_idx], 0, | ||
793 | AC_VERB_SET_CONNECT_SEL, | ||
794 | imux->items[idx - 1].index); | ||
795 | } | ||
796 | spec->cur_mux[adc_idx] = idx; | ||
797 | return 1; | ||
771 | } | 798 | } |
772 | 799 | ||
773 | static int stac92xx_mono_mux_enum_info(struct snd_kcontrol *kcontrol, | 800 | static int stac92xx_mono_mux_enum_info(struct snd_kcontrol *kcontrol, |
@@ -1204,21 +1231,6 @@ static struct snd_kcontrol_new stac92hd83xxx_mixer[] = { | |||
1204 | { } /* end */ | 1231 | { } /* end */ |
1205 | }; | 1232 | }; |
1206 | 1233 | ||
1207 | static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = { | ||
1208 | HDA_CODEC_MUTE("Import0 Mux Capture Switch", 0x17, 0x0, HDA_INPUT), | ||
1209 | HDA_CODEC_VOLUME("Import0 Mux Capture Volume", 0x17, 0x0, HDA_INPUT), | ||
1210 | |||
1211 | HDA_CODEC_MUTE("Import1 Mux Capture Switch", 0x17, 0x1, HDA_INPUT), | ||
1212 | HDA_CODEC_VOLUME("Import1 Mux Capture Volume", 0x17, 0x1, HDA_INPUT), | ||
1213 | |||
1214 | HDA_CODEC_MUTE("DAC0 Capture Switch", 0x17, 0x3, HDA_INPUT), | ||
1215 | HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x17, 0x3, HDA_INPUT), | ||
1216 | |||
1217 | HDA_CODEC_MUTE("DAC1 Capture Switch", 0x17, 0x4, HDA_INPUT), | ||
1218 | HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x17, 0x4, HDA_INPUT), | ||
1219 | { } /* end */ | ||
1220 | }; | ||
1221 | |||
1222 | static struct snd_kcontrol_new stac92hd71bxx_loopback[] = { | 1234 | static struct snd_kcontrol_new stac92hd71bxx_loopback[] = { |
1223 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2) | 1235 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2) |
1224 | }; | 1236 | }; |
@@ -1302,7 +1314,8 @@ static int stac92xx_build_controls(struct hda_codec *codec) | |||
1302 | if (err < 0) | 1314 | if (err < 0) |
1303 | return err; | 1315 | return err; |
1304 | } | 1316 | } |
1305 | if (!spec->auto_mic && spec->num_dmuxes > 0) { | 1317 | if (!spec->auto_mic && spec->num_dmuxes > 0 && |
1318 | snd_hda_get_bool_hint(codec, "separate_dmux") == 1) { | ||
1306 | stac_dmux_mixer.count = spec->num_dmuxes; | 1319 | stac_dmux_mixer.count = spec->num_dmuxes; |
1307 | err = snd_hda_ctl_add(codec, | 1320 | err = snd_hda_ctl_add(codec, |
1308 | snd_ctl_new1(&stac_dmux_mixer, codec)); | 1321 | snd_ctl_new1(&stac_dmux_mixer, codec)); |
@@ -3575,19 +3588,28 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, | |||
3575 | const struct auto_pin_cfg *cfg) | 3588 | const struct auto_pin_cfg *cfg) |
3576 | { | 3589 | { |
3577 | struct sigmatel_spec *spec = codec->spec; | 3590 | struct sigmatel_spec *spec = codec->spec; |
3591 | struct hda_input_mux *imux = &spec->private_imux; | ||
3578 | struct hda_input_mux *dimux = &spec->private_dimux; | 3592 | struct hda_input_mux *dimux = &spec->private_dimux; |
3579 | int err, i; | 3593 | int err, i, active_mics; |
3594 | unsigned int def_conf; | ||
3580 | char name[32]; | 3595 | char name[32]; |
3581 | 3596 | ||
3582 | dimux->items[dimux->num_items].label = stac92xx_dmic_labels[0]; | 3597 | dimux->items[dimux->num_items].label = stac92xx_dmic_labels[0]; |
3583 | dimux->items[dimux->num_items].index = 0; | 3598 | dimux->items[dimux->num_items].index = 0; |
3584 | dimux->num_items++; | 3599 | dimux->num_items++; |
3585 | 3600 | ||
3601 | active_mics = 0; | ||
3602 | for (i = 0; i < spec->num_dmics; i++) { | ||
3603 | def_conf = snd_hda_codec_get_pincfg(codec, spec->dmic_nids[i]); | ||
3604 | if (get_defcfg_connect(def_conf) != AC_JACK_PORT_NONE) | ||
3605 | active_mics++; | ||
3606 | } | ||
3607 | |||
3586 | for (i = 0; i < spec->num_dmics; i++) { | 3608 | for (i = 0; i < spec->num_dmics; i++) { |
3587 | hda_nid_t nid; | 3609 | hda_nid_t nid; |
3588 | int index; | 3610 | int index; |
3589 | unsigned int wcaps; | 3611 | unsigned int wcaps; |
3590 | unsigned int def_conf; | 3612 | const char *label; |
3591 | 3613 | ||
3592 | def_conf = snd_hda_codec_get_pincfg(codec, spec->dmic_nids[i]); | 3614 | def_conf = snd_hda_codec_get_pincfg(codec, spec->dmic_nids[i]); |
3593 | if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) | 3615 | if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) |
@@ -3598,12 +3620,16 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, | |||
3598 | if (index < 0) | 3620 | if (index < 0) |
3599 | continue; | 3621 | continue; |
3600 | 3622 | ||
3623 | if (active_mics == 1) | ||
3624 | label = "Digital Mic"; | ||
3625 | else | ||
3626 | label = stac92xx_dmic_labels[dimux->num_items]; | ||
3627 | |||
3601 | wcaps = get_wcaps(codec, nid) & | 3628 | wcaps = get_wcaps(codec, nid) & |
3602 | (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP); | 3629 | (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP); |
3603 | 3630 | ||
3604 | if (wcaps) { | 3631 | if (wcaps) { |
3605 | sprintf(name, "%s Capture Volume", | 3632 | sprintf(name, "%s Capture Volume", label); |
3606 | stac92xx_dmic_labels[dimux->num_items]); | ||
3607 | 3633 | ||
3608 | err = stac92xx_add_control(spec, | 3634 | err = stac92xx_add_control(spec, |
3609 | STAC_CTL_WIDGET_VOL, | 3635 | STAC_CTL_WIDGET_VOL, |
@@ -3615,10 +3641,14 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, | |||
3615 | return err; | 3641 | return err; |
3616 | } | 3642 | } |
3617 | 3643 | ||
3618 | dimux->items[dimux->num_items].label = | 3644 | dimux->items[dimux->num_items].label = label; |
3619 | stac92xx_dmic_labels[dimux->num_items]; | ||
3620 | dimux->items[dimux->num_items].index = index; | 3645 | dimux->items[dimux->num_items].index = index; |
3621 | dimux->num_items++; | 3646 | dimux->num_items++; |
3647 | if (snd_hda_get_bool_hint(codec, "separate_dmux") != 1) { | ||
3648 | imux->items[imux->num_items].label = label; | ||
3649 | imux->items[imux->num_items].index = index; | ||
3650 | imux->num_items++; | ||
3651 | } | ||
3622 | } | 3652 | } |
3623 | 3653 | ||
3624 | return 0; | 3654 | return 0; |
@@ -3738,6 +3768,7 @@ static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const | |||
3738 | imux->items[imux->num_items].index = index; | 3768 | imux->items[imux->num_items].index = index; |
3739 | imux->num_items++; | 3769 | imux->num_items++; |
3740 | } | 3770 | } |
3771 | spec->num_analog_muxes = imux->num_items; | ||
3741 | 3772 | ||
3742 | if (imux->num_items) { | 3773 | if (imux->num_items) { |
3743 | /* | 3774 | /* |
@@ -5059,16 +5090,6 @@ static int patch_stac925x(struct hda_codec *codec) | |||
5059 | return 0; | 5090 | return 0; |
5060 | } | 5091 | } |
5061 | 5092 | ||
5062 | static struct hda_input_mux stac92hd73xx_dmux = { | ||
5063 | .num_items = 4, | ||
5064 | .items = { | ||
5065 | { "Analog Inputs", 0x0b }, | ||
5066 | { "Digital Mic 1", 0x09 }, | ||
5067 | { "Digital Mic 2", 0x0a }, | ||
5068 | { "CD", 0x08 }, | ||
5069 | } | ||
5070 | }; | ||
5071 | |||
5072 | static int patch_stac92hd73xx(struct hda_codec *codec) | 5093 | static int patch_stac92hd73xx(struct hda_codec *codec) |
5073 | { | 5094 | { |
5074 | struct sigmatel_spec *spec; | 5095 | struct sigmatel_spec *spec; |
@@ -5138,8 +5159,6 @@ again: | |||
5138 | spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids); | 5159 | spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids); |
5139 | spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids); | 5160 | spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids); |
5140 | spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids); | 5161 | spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids); |
5141 | memcpy(&spec->private_dimux, &stac92hd73xx_dmux, | ||
5142 | sizeof(stac92hd73xx_dmux)); | ||
5143 | 5162 | ||
5144 | spec->num_caps = STAC92HD73XX_NUM_CAPS; | 5163 | spec->num_caps = STAC92HD73XX_NUM_CAPS; |
5145 | spec->capvols = stac92hd73xx_capvols; | 5164 | spec->capvols = stac92hd73xx_capvols; |
@@ -5164,18 +5183,15 @@ again: | |||
5164 | case STAC_DELL_M6_AMIC: /* Analog Mics */ | 5183 | case STAC_DELL_M6_AMIC: /* Analog Mics */ |
5165 | snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170); | 5184 | snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170); |
5166 | spec->num_dmics = 0; | 5185 | spec->num_dmics = 0; |
5167 | spec->private_dimux.num_items = 1; | ||
5168 | break; | 5186 | break; |
5169 | case STAC_DELL_M6_DMIC: /* Digital Mics */ | 5187 | case STAC_DELL_M6_DMIC: /* Digital Mics */ |
5170 | snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160); | 5188 | snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160); |
5171 | spec->num_dmics = 1; | 5189 | spec->num_dmics = 1; |
5172 | spec->private_dimux.num_items = 2; | ||
5173 | break; | 5190 | break; |
5174 | case STAC_DELL_M6_BOTH: /* Both */ | 5191 | case STAC_DELL_M6_BOTH: /* Both */ |
5175 | snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170); | 5192 | snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170); |
5176 | snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160); | 5193 | snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160); |
5177 | spec->num_dmics = 1; | 5194 | spec->num_dmics = 1; |
5178 | spec->private_dimux.num_items = 2; | ||
5179 | break; | 5195 | break; |
5180 | } | 5196 | } |
5181 | break; | 5197 | break; |
@@ -5183,13 +5199,13 @@ again: | |||
5183 | spec->num_dmics = STAC92HD73XX_NUM_DMICS; | 5199 | spec->num_dmics = STAC92HD73XX_NUM_DMICS; |
5184 | spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids); | 5200 | spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids); |
5185 | spec->eapd_switch = 1; | 5201 | spec->eapd_switch = 1; |
5202 | break; | ||
5186 | } | 5203 | } |
5187 | if (spec->board_config > STAC_92HD73XX_REF) { | 5204 | if (spec->board_config > STAC_92HD73XX_REF) { |
5188 | /* GPIO0 High = Enable EAPD */ | 5205 | /* GPIO0 High = Enable EAPD */ |
5189 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; | 5206 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; |
5190 | spec->gpio_data = 0x01; | 5207 | spec->gpio_data = 0x01; |
5191 | } | 5208 | } |
5192 | spec->dinput_mux = &spec->private_dimux; | ||
5193 | 5209 | ||
5194 | spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids); | 5210 | spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids); |
5195 | spec->pwr_nids = stac92hd73xx_pwr_nids; | 5211 | spec->pwr_nids = stac92hd73xx_pwr_nids; |
@@ -5221,15 +5237,6 @@ again: | |||
5221 | return 0; | 5237 | return 0; |
5222 | } | 5238 | } |
5223 | 5239 | ||
5224 | static struct hda_input_mux stac92hd83xxx_dmux = { | ||
5225 | .num_items = 3, | ||
5226 | .items = { | ||
5227 | { "Analog Inputs", 0x03 }, | ||
5228 | { "Digital Mic 1", 0x04 }, | ||
5229 | { "Digital Mic 2", 0x05 }, | ||
5230 | } | ||
5231 | }; | ||
5232 | |||
5233 | static int patch_stac92hd83xxx(struct hda_codec *codec) | 5240 | static int patch_stac92hd83xxx(struct hda_codec *codec) |
5234 | { | 5241 | { |
5235 | struct sigmatel_spec *spec; | 5242 | struct sigmatel_spec *spec; |
@@ -5262,7 +5269,6 @@ static int patch_stac92hd83xxx(struct hda_codec *codec) | |||
5262 | spec->num_adcs = ARRAY_SIZE(stac92hd83xxx_adc_nids); | 5269 | spec->num_adcs = ARRAY_SIZE(stac92hd83xxx_adc_nids); |
5263 | spec->num_amps = ARRAY_SIZE(stac92hd83xxx_amp_nids); | 5270 | spec->num_amps = ARRAY_SIZE(stac92hd83xxx_amp_nids); |
5264 | spec->num_dmics = STAC92HD83XXX_NUM_DMICS; | 5271 | spec->num_dmics = STAC92HD83XXX_NUM_DMICS; |
5265 | spec->dinput_mux = &stac92hd83xxx_dmux; | ||
5266 | spec->pin_nids = stac92hd83xxx_pin_nids; | 5272 | spec->pin_nids = stac92hd83xxx_pin_nids; |
5267 | spec->num_caps = STAC92HD83XXX_NUM_CAPS; | 5273 | spec->num_caps = STAC92HD83XXX_NUM_CAPS; |
5268 | spec->capvols = stac92hd83xxx_capvols; | 5274 | spec->capvols = stac92hd83xxx_capvols; |
@@ -5332,25 +5338,6 @@ again: | |||
5332 | return 0; | 5338 | return 0; |
5333 | } | 5339 | } |
5334 | 5340 | ||
5335 | static struct hda_input_mux stac92hd71bxx_dmux_nomixer = { | ||
5336 | .num_items = 3, | ||
5337 | .items = { | ||
5338 | { "Analog Inputs", 0x00 }, | ||
5339 | { "Digital Mic 1", 0x02 }, | ||
5340 | { "Digital Mic 2", 0x03 }, | ||
5341 | } | ||
5342 | }; | ||
5343 | |||
5344 | static struct hda_input_mux stac92hd71bxx_dmux_amixer = { | ||
5345 | .num_items = 4, | ||
5346 | .items = { | ||
5347 | { "Analog Inputs", 0x00 }, | ||
5348 | { "Mixer", 0x01 }, | ||
5349 | { "Digital Mic 1", 0x02 }, | ||
5350 | { "Digital Mic 2", 0x03 }, | ||
5351 | } | ||
5352 | }; | ||
5353 | |||
5354 | /* get the pin connection (fixed, none, etc) */ | 5341 | /* get the pin connection (fixed, none, etc) */ |
5355 | static unsigned int stac_get_defcfg_connect(struct hda_codec *codec, int idx) | 5342 | static unsigned int stac_get_defcfg_connect(struct hda_codec *codec, int idx) |
5356 | { | 5343 | { |
@@ -5411,7 +5398,6 @@ static int patch_stac92hd71bxx(struct hda_codec *codec) | |||
5411 | struct sigmatel_spec *spec; | 5398 | struct sigmatel_spec *spec; |
5412 | struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init; | 5399 | struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init; |
5413 | int err = 0; | 5400 | int err = 0; |
5414 | unsigned int ndmic_nids = 0; | ||
5415 | 5401 | ||
5416 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 5402 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
5417 | if (spec == NULL) | 5403 | if (spec == NULL) |
@@ -5467,21 +5453,13 @@ again: | |||
5467 | /* fallthru */ | 5453 | /* fallthru */ |
5468 | case 0x111d76b4: /* 6 Port without Analog Mixer */ | 5454 | case 0x111d76b4: /* 6 Port without Analog Mixer */ |
5469 | case 0x111d76b5: | 5455 | case 0x111d76b5: |
5470 | memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_nomixer, | ||
5471 | sizeof(stac92hd71bxx_dmux_nomixer)); | ||
5472 | spec->init = stac92hd71bxx_core_init; | 5456 | spec->init = stac92hd71bxx_core_init; |
5473 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; | 5457 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; |
5474 | spec->num_dmics = stac92hd71bxx_connected_ports(codec, | 5458 | spec->num_dmics = stac92hd71bxx_connected_ports(codec, |
5475 | stac92hd71bxx_dmic_nids, | 5459 | stac92hd71bxx_dmic_nids, |
5476 | STAC92HD71BXX_NUM_DMICS); | 5460 | STAC92HD71BXX_NUM_DMICS); |
5477 | if (spec->num_dmics) { | ||
5478 | spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); | ||
5479 | spec->dinput_mux = &spec->private_dimux; | ||
5480 | ndmic_nids = ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 1; | ||
5481 | } | ||
5482 | break; | 5461 | break; |
5483 | case 0x111d7608: /* 5 Port with Analog Mixer */ | 5462 | case 0x111d7608: /* 5 Port with Analog Mixer */ |
5484 | spec->private_dimux.num_items--; | ||
5485 | switch (spec->board_config) { | 5463 | switch (spec->board_config) { |
5486 | case STAC_HP_M4: | 5464 | case STAC_HP_M4: |
5487 | /* Enable VREF power saving on GPIO1 detect */ | 5465 | /* Enable VREF power saving on GPIO1 detect */ |
@@ -5503,15 +5481,6 @@ again: | |||
5503 | 5481 | ||
5504 | /* no output amps */ | 5482 | /* no output amps */ |
5505 | spec->num_pwrs = 0; | 5483 | spec->num_pwrs = 0; |
5506 | if (snd_hda_get_bool_hint(codec, "analog_mixer") == 1) { | ||
5507 | spec->mixer = stac92hd71bxx_analog_mixer; | ||
5508 | memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_amixer, | ||
5509 | sizeof(stac92hd71bxx_dmux_amixer)); | ||
5510 | } else { | ||
5511 | memcpy(&spec->private_dimux, | ||
5512 | &stac92hd71bxx_dmux_nomixer, | ||
5513 | sizeof(stac92hd71bxx_dmux_nomixer)); | ||
5514 | } | ||
5515 | /* disable VSW */ | 5484 | /* disable VSW */ |
5516 | spec->init = stac92hd71bxx_core_init; | 5485 | spec->init = stac92hd71bxx_core_init; |
5517 | unmute_init++; | 5486 | unmute_init++; |
@@ -5521,11 +5490,6 @@ again: | |||
5521 | spec->num_dmics = stac92hd71bxx_connected_ports(codec, | 5490 | spec->num_dmics = stac92hd71bxx_connected_ports(codec, |
5522 | stac92hd71bxx_dmic_nids, | 5491 | stac92hd71bxx_dmic_nids, |
5523 | STAC92HD71BXX_NUM_DMICS - 1); | 5492 | STAC92HD71BXX_NUM_DMICS - 1); |
5524 | if (spec->num_dmics) { | ||
5525 | spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); | ||
5526 | spec->dinput_mux = &spec->private_dimux; | ||
5527 | ndmic_nids = ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 2; | ||
5528 | } | ||
5529 | break; | 5493 | break; |
5530 | case 0x111d7603: /* 6 Port with Analog Mixer */ | 5494 | case 0x111d7603: /* 6 Port with Analog Mixer */ |
5531 | if ((codec->revision_id & 0xf) == 1) | 5495 | if ((codec->revision_id & 0xf) == 1) |
@@ -5535,25 +5499,12 @@ again: | |||
5535 | spec->num_pwrs = 0; | 5499 | spec->num_pwrs = 0; |
5536 | /* fallthru */ | 5500 | /* fallthru */ |
5537 | default: | 5501 | default: |
5538 | if (snd_hda_get_bool_hint(codec, "analog_mixer") == 1) { | ||
5539 | spec->mixer = stac92hd71bxx_analog_mixer; | ||
5540 | memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_amixer, | ||
5541 | sizeof(stac92hd71bxx_dmux_amixer)); | ||
5542 | } else { | ||
5543 | memcpy(&spec->private_dimux, | ||
5544 | &stac92hd71bxx_dmux_nomixer, | ||
5545 | sizeof(stac92hd71bxx_dmux_nomixer)); | ||
5546 | } | ||
5547 | spec->init = stac92hd71bxx_core_init; | 5502 | spec->init = stac92hd71bxx_core_init; |
5548 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; | 5503 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; |
5549 | spec->num_dmics = stac92hd71bxx_connected_ports(codec, | 5504 | spec->num_dmics = stac92hd71bxx_connected_ports(codec, |
5550 | stac92hd71bxx_dmic_nids, | 5505 | stac92hd71bxx_dmic_nids, |
5551 | STAC92HD71BXX_NUM_DMICS); | 5506 | STAC92HD71BXX_NUM_DMICS); |
5552 | if (spec->num_dmics) { | 5507 | break; |
5553 | spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); | ||
5554 | spec->dinput_mux = &spec->private_dimux; | ||
5555 | ndmic_nids = ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 1; | ||
5556 | } | ||
5557 | } | 5508 | } |
5558 | 5509 | ||
5559 | if (get_wcaps(codec, 0xa) & AC_WCAP_IN_AMP) | 5510 | if (get_wcaps(codec, 0xa) & AC_WCAP_IN_AMP) |
@@ -5581,6 +5532,7 @@ again: | |||
5581 | 5532 | ||
5582 | spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids); | 5533 | spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids); |
5583 | spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids); | 5534 | spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids); |
5535 | spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); | ||
5584 | spec->num_smuxes = stac92hd71bxx_connected_smuxes(codec, 0x1e); | 5536 | spec->num_smuxes = stac92hd71bxx_connected_smuxes(codec, 0x1e); |
5585 | 5537 | ||
5586 | switch (spec->board_config) { | 5538 | switch (spec->board_config) { |
@@ -5635,8 +5587,6 @@ again: | |||
5635 | #endif | 5587 | #endif |
5636 | 5588 | ||
5637 | spec->multiout.dac_nids = spec->dac_nids; | 5589 | spec->multiout.dac_nids = spec->dac_nids; |
5638 | if (spec->dinput_mux) | ||
5639 | spec->private_dimux.num_items += spec->num_dmics - ndmic_nids; | ||
5640 | 5590 | ||
5641 | err = stac92xx_parse_auto_config(codec, 0x21, 0); | 5591 | err = stac92xx_parse_auto_config(codec, 0x21, 0); |
5642 | if (!err) { | 5592 | if (!err) { |