aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Ranostay <mranostay@embeddedalley.com>2008-01-08 06:10:50 -0500
committerJaroslav Kysela <perex@perex.cz>2008-01-31 11:29:45 -0500
commit0678accd2da33873455ef8d41d847bd550727159 (patch)
tree1b4971bb5766de51756e63a8d8455b8ba50be86a
parent5aba4f8ec72b2b880c694b5ce58e67be508f7b7a (diff)
[ALSA] hda: Dynamically create digital gain mixers
Dynamically create digital gain mixers for dmics that have out-amp support. Also some 92HD73xx's codecs don't have DMIC gains, so this also prevents creating dead mixers. Signed-off-by: Matthew Ranostay <mranostay@embeddedalley.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r--sound/pci/hda/patch_sigmatel.c51
1 files changed, 20 insertions, 31 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 4e71bbaa1954..299e02a26e58 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -463,9 +463,6 @@ static struct hda_verb stac92hd73xx_6ch_core_init[] = {
463 /* setup adcs to point to mixer */ 463 /* setup adcs to point to mixer */
464 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, 464 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
465 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, 465 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
466 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Front Mic */
467 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Mic */
468 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Line In */
469 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 466 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
470 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 467 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
471 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 468 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
@@ -490,9 +487,6 @@ static struct hda_verb stac92hd73xx_8ch_core_init[] = {
490 /* setup adcs to point to mixer */ 487 /* setup adcs to point to mixer */
491 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, 488 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
492 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, 489 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
493 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Front Mic */
494 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Mic */
495 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Line In */
496 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 490 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
497 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 491 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
498 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 492 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
@@ -519,9 +513,6 @@ static struct hda_verb stac92hd73xx_10ch_core_init[] = {
519 /* setup adcs to point to mixer */ 513 /* setup adcs to point to mixer */
520 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, 514 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b},
521 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, 515 { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b},
522 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Front Mic */
523 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Mic */
524 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Line In */
525 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 516 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
526 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 517 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
527 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 518 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
@@ -635,10 +626,6 @@ static struct snd_kcontrol_new stac9200_mixer[] = {
635static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = { 626static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = {
636 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3), 627 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3),
637 628
638 /* hardware gain controls */
639 HDA_CODEC_VOLUME_IDX("Digital Mic Volume", 0x0, 0x13, 0x0, HDA_INPUT),
640 HDA_CODEC_VOLUME_IDX("Digital Mic Volume", 0x1, 0x14, 0x0, HDA_INPUT),
641
642 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), 629 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
643 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), 630 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
644 631
@@ -665,10 +652,6 @@ static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = {
665static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = { 652static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = {
666 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4), 653 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4),
667 654
668 /* hardware gain controls */
669 HDA_CODEC_VOLUME_IDX("Digital Mic Volume", 0x0, 0x13, 0x0, HDA_INPUT),
670 HDA_CODEC_VOLUME_IDX("Digital Mic Volume", 0x1, 0x14, 0x0, HDA_INPUT),
671
672 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), 655 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
673 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), 656 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
674 657
@@ -695,10 +678,6 @@ static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = {
695static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = { 678static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = {
696 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5), 679 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5),
697 680
698 /* hardware gain controls */
699 HDA_CODEC_VOLUME_IDX("Digital Mic Volume", 0x0, 0x13, 0x0, HDA_INPUT),
700 HDA_CODEC_VOLUME_IDX("Digital Mic Volume", 0x1, 0x14, 0x0, HDA_INPUT),
701
702 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), 681 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT),
703 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), 682 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT),
704 683
@@ -725,10 +704,6 @@ static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = {
725static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = { 704static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = {
726 STAC_INPUT_SOURCE(2), 705 STAC_INPUT_SOURCE(2),
727 706
728 /* hardware gain controls */
729 HDA_CODEC_VOLUME_IDX("Digital Mic Volume", 0x0, 0x18, 0x0, HDA_OUTPUT),
730 HDA_CODEC_VOLUME_IDX("Digital Mic Volume", 0x1, 0x19, 0x0, HDA_OUTPUT),
731
732 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), 707 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT),
733 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT), 708 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT),
734 HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x0, 0x1a, 0x0, HDA_OUTPUT), 709 HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x0, 0x1a, 0x0, HDA_OUTPUT),
@@ -746,10 +721,6 @@ static struct snd_kcontrol_new stac92hd71bxx_mixer[] = {
746 STAC_INPUT_SOURCE(2), 721 STAC_INPUT_SOURCE(2),
747 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2), 722 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2),
748 723
749 /* hardware gain controls */
750 HDA_CODEC_VOLUME_IDX("Digital Mic Volume", 0x0, 0x18, 0x0, HDA_OUTPUT),
751 HDA_CODEC_VOLUME_IDX("Digital Mic Volume", 0x1, 0x19, 0x0, HDA_OUTPUT),
752
753 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), 724 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT),
754 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT), 725 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT),
755 HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x0, 0x1a, 0x0, HDA_OUTPUT), 726 HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x0, 0x1a, 0x0, HDA_OUTPUT),
@@ -2313,15 +2284,18 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec,
2313 struct sigmatel_spec *spec = codec->spec; 2284 struct sigmatel_spec *spec = codec->spec;
2314 struct hda_input_mux *dimux = &spec->private_dimux; 2285 struct hda_input_mux *dimux = &spec->private_dimux;
2315 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; 2286 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS];
2316 int i, j; 2287 int err, i, j;
2288 char name[32];
2317 2289
2318 dimux->items[dimux->num_items].label = stac92xx_dmic_labels[0]; 2290 dimux->items[dimux->num_items].label = stac92xx_dmic_labels[0];
2319 dimux->items[dimux->num_items].index = 0; 2291 dimux->items[dimux->num_items].index = 0;
2320 dimux->num_items++; 2292 dimux->num_items++;
2321 2293
2322 for (i = 0; i < spec->num_dmics; i++) { 2294 for (i = 0; i < spec->num_dmics; i++) {
2295 hda_nid_t nid;
2323 int index; 2296 int index;
2324 int num_cons; 2297 int num_cons;
2298 unsigned int wcaps;
2325 unsigned int def_conf; 2299 unsigned int def_conf;
2326 2300
2327 def_conf = snd_hda_codec_read(codec, 2301 def_conf = snd_hda_codec_read(codec,
@@ -2332,17 +2306,32 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec,
2332 if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) 2306 if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE)
2333 continue; 2307 continue;
2334 2308
2309 nid = spec->dmic_nids[i];
2335 num_cons = snd_hda_get_connections(codec, 2310 num_cons = snd_hda_get_connections(codec,
2336 spec->dmux_nids[0], 2311 spec->dmux_nids[0],
2337 con_lst, 2312 con_lst,
2338 HDA_MAX_NUM_INPUTS); 2313 HDA_MAX_NUM_INPUTS);
2339 for (j = 0; j < num_cons; j++) 2314 for (j = 0; j < num_cons; j++)
2340 if (con_lst[j] == spec->dmic_nids[i]) { 2315 if (con_lst[j] == nid) {
2341 index = j; 2316 index = j;
2342 goto found; 2317 goto found;
2343 } 2318 }
2344 continue; 2319 continue;
2345found: 2320found:
2321 wcaps = get_wcaps(codec, nid);
2322
2323 if (wcaps & AC_WCAP_OUT_AMP) {
2324 sprintf(name, "%s Capture Volume",
2325 stac92xx_dmic_labels[dimux->num_items]);
2326
2327 err = stac92xx_add_control(spec,
2328 STAC_CTL_WIDGET_VOL,
2329 name,
2330 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
2331 if (err < 0)
2332 return err;
2333 }
2334
2346 dimux->items[dimux->num_items].label = 2335 dimux->items[dimux->num_items].label =
2347 stac92xx_dmic_labels[dimux->num_items]; 2336 stac92xx_dmic_labels[dimux->num_items];
2348 dimux->items[dimux->num_items].index = index; 2337 dimux->items[dimux->num_items].index = index;