aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorMaxim Levitsky <maximlevitsky@gmail.com>2007-09-03 09:31:02 -0400
committerJaroslav Kysela <perex@perex.cz>2007-10-16 09:59:50 -0400
commit9e05b7a3d936ac5eb6c10291b69aee0af1ad03fb (patch)
treeadc61eda5a7c4c8358736458abefb7c0b0c110ab /sound
parent6e6b88ffea81d7bc5c5da0b8433b4a21131ae340 (diff)
[ALSA] hda-codec - Fix support for sigmatel codecs that have 2 or more ADCs
1) Create seperate mixer controls for each ADC 2) Make number of substreams of capture PCM device be equal to number of ADCs Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/patch_sigmatel.c97
1 files changed, 57 insertions, 40 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index a2b1dd54e2ef..6dffa54e2da1 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -413,11 +413,11 @@ static struct hda_verb stac9205_core_init[] = {
413 {} 413 {}
414}; 414};
415 415
416#define STAC_INPUT_SOURCE \ 416#define STAC_INPUT_SOURCE(cnt) \
417 { \ 417 { \
418 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ 418 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
419 .name = "Input Source", \ 419 .name = "Input Source", \
420 .count = 1, \ 420 .count = cnt, \
421 .info = stac92xx_mux_enum_info, \ 421 .info = stac92xx_mux_enum_info, \
422 .get = stac92xx_mux_enum_get, \ 422 .get = stac92xx_mux_enum_get, \
423 .put = stac92xx_mux_enum_put, \ 423 .put = stac92xx_mux_enum_put, \
@@ -449,7 +449,7 @@ static struct hda_verb stac9205_core_init[] = {
449static struct snd_kcontrol_new stac9200_mixer[] = { 449static struct snd_kcontrol_new stac9200_mixer[] = {
450 HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT), 450 HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT),
451 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT), 451 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT),
452 STAC_INPUT_SOURCE, 452 STAC_INPUT_SOURCE(1),
453 HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT), 453 HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT),
454 HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT), 454 HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT),
455 HDA_CODEC_VOLUME("Capture Mux Volume", 0x0c, 0, HDA_OUTPUT), 455 HDA_CODEC_VOLUME("Capture Mux Volume", 0x0c, 0, HDA_OUTPUT),
@@ -457,58 +457,68 @@ static struct snd_kcontrol_new stac9200_mixer[] = {
457}; 457};
458 458
459static struct snd_kcontrol_new stac925x_mixer[] = { 459static struct snd_kcontrol_new stac925x_mixer[] = {
460 STAC_INPUT_SOURCE, 460 STAC_INPUT_SOURCE(1),
461 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT), 461 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT),
462 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_OUTPUT), 462 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_OUTPUT),
463 HDA_CODEC_VOLUME("Capture Mux Volume", 0x0f, 0, HDA_OUTPUT), 463 HDA_CODEC_VOLUME("Capture Mux Volume", 0x0f, 0, HDA_OUTPUT),
464 { } /* end */ 464 { } /* end */
465}; 465};
466 466
467/* This needs to be generated dynamically based on sequence */ 467static struct snd_kcontrol_new stac9205_mixer[] = {
468static struct snd_kcontrol_new stac922x_mixer[] = { 468 {
469 STAC_INPUT_SOURCE, 469 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
470 .name = "Digital Input Source",
471 .count = 1,
472 .info = stac92xx_dmux_enum_info,
473 .get = stac92xx_dmux_enum_get,
474 .put = stac92xx_dmux_enum_put,
475 },
476 STAC_INPUT_SOURCE(2),
477 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0),
470 STAC_VOLKNOB, 478 STAC_VOLKNOB,
471 HDA_CODEC_VOLUME("Capture Volume", 0x17, 0x0, HDA_INPUT), 479
472 HDA_CODEC_MUTE("Capture Switch", 0x17, 0x0, HDA_INPUT), 480 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT),
473 HDA_CODEC_VOLUME("Mux Capture Volume", 0x12, 0x0, HDA_OUTPUT), 481 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT),
482 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x19, 0x0, HDA_OUTPUT),
483
484 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1c, 0x0, HDA_INPUT),
485 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1e, 0x0, HDA_OUTPUT),
486 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x1A, 0x0, HDA_OUTPUT),
487
474 { } /* end */ 488 { } /* end */
475}; 489};
476 490
477/* This needs to be generated dynamically based on sequence */ 491/* This needs to be generated dynamically based on sequence */
478static struct snd_kcontrol_new stac9227_mixer[] = { 492static struct snd_kcontrol_new stac922x_mixer[] = {
479 STAC_INPUT_SOURCE, 493 STAC_INPUT_SOURCE(2),
480 STAC_VOLKNOB, 494 STAC_VOLKNOB,
481 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB), 495 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT),
482 HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_OUTPUT), 496 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT),
483 HDA_CODEC_MUTE("Capture Switch", 0x1b, 0x0, HDA_OUTPUT), 497 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x12, 0x0, HDA_OUTPUT),
498
499 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_INPUT),
500 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_INPUT),
501 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x13, 0x0, HDA_OUTPUT),
484 { } /* end */ 502 { } /* end */
485}; 503};
486 504
505
487static struct snd_kcontrol_new stac927x_mixer[] = { 506static struct snd_kcontrol_new stac927x_mixer[] = {
488 STAC_INPUT_SOURCE, 507 STAC_INPUT_SOURCE(3),
489 STAC_VOLKNOB, 508 STAC_VOLKNOB,
490 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB), 509 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB),
491 HDA_CODEC_VOLUME("InMux Capture Volume", 0x15, 0x0, HDA_OUTPUT),
492 HDA_CODEC_VOLUME("InVol Capture Volume", 0x18, 0x0, HDA_INPUT),
493 HDA_CODEC_MUTE("ADCMux Capture Switch", 0x1b, 0x0, HDA_OUTPUT),
494 { } /* end */
495};
496 510
497static struct snd_kcontrol_new stac9205_mixer[] = { 511 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT),
498 { 512 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1b, 0x0, HDA_OUTPUT),
499 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 513 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x0, 0x15, 0x0, HDA_OUTPUT),
500 .name = "Digital Input Source", 514
501 .count = 1, 515 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x19, 0x0, HDA_INPUT),
502 .info = stac92xx_dmux_enum_info, 516 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1c, 0x0, HDA_OUTPUT),
503 .get = stac92xx_dmux_enum_get, 517 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x1, 0x16, 0x0, HDA_OUTPUT),
504 .put = stac92xx_dmux_enum_put, 518
505 }, 519 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x2, 0x1A, 0x0, HDA_INPUT),
506 STAC_INPUT_SOURCE, 520 HDA_CODEC_MUTE_IDX("Capture Switch", 0x2, 0x1d, 0x0, HDA_OUTPUT),
507 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0), 521 HDA_CODEC_VOLUME_IDX("Mux Capture Volume", 0x2, 0x17, 0x0, HDA_OUTPUT),
508 STAC_VOLKNOB,
509 HDA_CODEC_VOLUME("InMux Capture Volume", 0x19, 0x0, HDA_OUTPUT),
510 HDA_CODEC_VOLUME("InVol Capture Volume", 0x1b, 0x0, HDA_INPUT),
511 HDA_CODEC_MUTE("ADCMux Capture Switch", 0x1d, 0x0, HDA_OUTPUT),
512 { } /* end */ 522 { } /* end */
513}; 523};
514 524
@@ -1410,10 +1420,9 @@ static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = {
1410}; 1420};
1411 1421
1412static struct hda_pcm_stream stac92xx_pcm_analog_capture = { 1422static struct hda_pcm_stream stac92xx_pcm_analog_capture = {
1413 .substreams = 2,
1414 .channels_min = 2, 1423 .channels_min = 2,
1415 .channels_max = 2, 1424 .channels_max = 2,
1416 /* NID is set in stac92xx_build_pcms */ 1425 /* NID + .substreams is set in stac92xx_build_pcms */
1417 .ops = { 1426 .ops = {
1418 .prepare = stac92xx_capture_pcm_prepare, 1427 .prepare = stac92xx_capture_pcm_prepare,
1419 .cleanup = stac92xx_capture_pcm_cleanup 1428 .cleanup = stac92xx_capture_pcm_cleanup
@@ -1432,6 +1441,7 @@ static int stac92xx_build_pcms(struct hda_codec *codec)
1432 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback; 1441 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback;
1433 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture; 1442 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture;
1434 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; 1443 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
1444 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs;
1435 1445
1436 if (spec->alt_switch) { 1446 if (spec->alt_switch) {
1437 codec->num_pcms++; 1447 codec->num_pcms++;
@@ -2478,6 +2488,7 @@ static int patch_stac9200(struct hda_codec *codec)
2478 spec->mux_nids = stac9200_mux_nids; 2488 spec->mux_nids = stac9200_mux_nids;
2479 spec->num_muxes = 1; 2489 spec->num_muxes = 1;
2480 spec->num_dmics = 0; 2490 spec->num_dmics = 0;
2491 spec->num_adcs = 1;
2481 2492
2482 spec->init = stac9200_core_init; 2493 spec->init = stac9200_core_init;
2483 spec->mixer = stac9200_mixer; 2494 spec->mixer = stac9200_mixer;
@@ -2529,6 +2540,7 @@ static int patch_stac925x(struct hda_codec *codec)
2529 spec->adc_nids = stac925x_adc_nids; 2540 spec->adc_nids = stac925x_adc_nids;
2530 spec->mux_nids = stac925x_mux_nids; 2541 spec->mux_nids = stac925x_mux_nids;
2531 spec->num_muxes = 1; 2542 spec->num_muxes = 1;
2543 spec->num_adcs = 1;
2532 switch (codec->vendor_id) { 2544 switch (codec->vendor_id) {
2533 case 0x83847632: /* STAC9202 */ 2545 case 0x83847632: /* STAC9202 */
2534 case 0x83847633: /* STAC9202D */ 2546 case 0x83847633: /* STAC9202D */
@@ -2632,6 +2644,7 @@ static int patch_stac922x(struct hda_codec *codec)
2632 spec->adc_nids = stac922x_adc_nids; 2644 spec->adc_nids = stac922x_adc_nids;
2633 spec->mux_nids = stac922x_mux_nids; 2645 spec->mux_nids = stac922x_mux_nids;
2634 spec->num_muxes = ARRAY_SIZE(stac922x_mux_nids); 2646 spec->num_muxes = ARRAY_SIZE(stac922x_mux_nids);
2647 spec->num_adcs = ARRAY_SIZE(stac922x_adc_nids);
2635 spec->num_dmics = 0; 2648 spec->num_dmics = 0;
2636 2649
2637 spec->init = stac922x_core_init; 2650 spec->init = stac922x_core_init;
@@ -2700,22 +2713,25 @@ static int patch_stac927x(struct hda_codec *codec)
2700 spec->adc_nids = stac927x_adc_nids; 2713 spec->adc_nids = stac927x_adc_nids;
2701 spec->mux_nids = stac927x_mux_nids; 2714 spec->mux_nids = stac927x_mux_nids;
2702 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids); 2715 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids);
2716 spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids);
2703 spec->num_dmics = 0; 2717 spec->num_dmics = 0;
2704 spec->init = d965_core_init; 2718 spec->init = d965_core_init;
2705 spec->mixer = stac9227_mixer; 2719 spec->mixer = stac927x_mixer;
2706 break; 2720 break;
2707 case STAC_D965_5ST: 2721 case STAC_D965_5ST:
2708 spec->adc_nids = stac927x_adc_nids; 2722 spec->adc_nids = stac927x_adc_nids;
2709 spec->mux_nids = stac927x_mux_nids; 2723 spec->mux_nids = stac927x_mux_nids;
2710 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids); 2724 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids);
2725 spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids);
2711 spec->num_dmics = 0; 2726 spec->num_dmics = 0;
2712 spec->init = d965_core_init; 2727 spec->init = d965_core_init;
2713 spec->mixer = stac9227_mixer; 2728 spec->mixer = stac927x_mixer;
2714 break; 2729 break;
2715 default: 2730 default:
2716 spec->adc_nids = stac927x_adc_nids; 2731 spec->adc_nids = stac927x_adc_nids;
2717 spec->mux_nids = stac927x_mux_nids; 2732 spec->mux_nids = stac927x_mux_nids;
2718 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids); 2733 spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids);
2734 spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids);
2719 spec->num_dmics = 0; 2735 spec->num_dmics = 0;
2720 spec->init = stac927x_core_init; 2736 spec->init = stac927x_core_init;
2721 spec->mixer = stac927x_mixer; 2737 spec->mixer = stac927x_mixer;
@@ -2776,6 +2792,7 @@ static int patch_stac9205(struct hda_codec *codec)
2776 } 2792 }
2777 2793
2778 spec->adc_nids = stac9205_adc_nids; 2794 spec->adc_nids = stac9205_adc_nids;
2795 spec->num_adcs = ARRAY_SIZE(stac9205_adc_nids);
2779 spec->mux_nids = stac9205_mux_nids; 2796 spec->mux_nids = stac9205_mux_nids;
2780 spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids); 2797 spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids);
2781 spec->dmic_nids = stac9205_dmic_nids; 2798 spec->dmic_nids = stac9205_dmic_nids;