diff options
author | Krzysztof Helt <krzysztof.h1@wp.pl> | 2009-12-13 15:13:44 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-12-14 05:22:25 -0500 |
commit | 74c2b45b714e49b427584b4bd8f44f1a24d82d9c (patch) | |
tree | f40d018a7b77bc49481bf4a1cbf1ce0e61387b51 /sound | |
parent | e9d0a803c127e2e30afb0df780ccb3af4e2adb28 (diff) |
ALSA: sb_mixer: convert pointer tables to mixer control tables
Convert table of pointers to mixer controls into tables
of the mixer controls. It saves about 20% of the snd-sb-common
module size reported by lsmod.
The als4000 uses part of sb16's control table.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/isa/sb/sb_mixer.c | 330 |
1 files changed, 115 insertions, 215 deletions
diff --git a/sound/isa/sb/sb_mixer.c b/sound/isa/sb/sb_mixer.c index 318ff0c823e7..8cfc41fbe368 100644 --- a/sound/isa/sb/sb_mixer.c +++ b/sound/isa/sb/sb_mixer.c | |||
@@ -528,20 +528,11 @@ int snd_sbmixer_add_ctl(struct snd_sb *chip, const char *name, int index, int ty | |||
528 | * SB 2.0 specific mixer elements | 528 | * SB 2.0 specific mixer elements |
529 | */ | 529 | */ |
530 | 530 | ||
531 | static struct sbmix_elem snd_sb20_ctl_master_play_vol = | 531 | static struct sbmix_elem snd_sb20_controls[] = { |
532 | SB_SINGLE("Master Playback Volume", SB_DSP20_MASTER_DEV, 1, 7); | 532 | SB_SINGLE("Master Playback Volume", SB_DSP20_MASTER_DEV, 1, 7), |
533 | static struct sbmix_elem snd_sb20_ctl_pcm_play_vol = | 533 | SB_SINGLE("PCM Playback Volume", SB_DSP20_PCM_DEV, 1, 3), |
534 | SB_SINGLE("PCM Playback Volume", SB_DSP20_PCM_DEV, 1, 3); | 534 | SB_SINGLE("Synth Playback Volume", SB_DSP20_FM_DEV, 1, 7), |
535 | static struct sbmix_elem snd_sb20_ctl_synth_play_vol = | 535 | SB_SINGLE("CD Playback Volume", SB_DSP20_CD_DEV, 1, 7) |
536 | SB_SINGLE("Synth Playback Volume", SB_DSP20_FM_DEV, 1, 7); | ||
537 | static struct sbmix_elem snd_sb20_ctl_cd_play_vol = | ||
538 | SB_SINGLE("CD Playback Volume", SB_DSP20_CD_DEV, 1, 7); | ||
539 | |||
540 | static struct sbmix_elem *snd_sb20_controls[] = { | ||
541 | &snd_sb20_ctl_master_play_vol, | ||
542 | &snd_sb20_ctl_pcm_play_vol, | ||
543 | &snd_sb20_ctl_synth_play_vol, | ||
544 | &snd_sb20_ctl_cd_play_vol | ||
545 | }; | 536 | }; |
546 | 537 | ||
547 | static unsigned char snd_sb20_init_values[][2] = { | 538 | static unsigned char snd_sb20_init_values[][2] = { |
@@ -552,41 +543,24 @@ static unsigned char snd_sb20_init_values[][2] = { | |||
552 | /* | 543 | /* |
553 | * SB Pro specific mixer elements | 544 | * SB Pro specific mixer elements |
554 | */ | 545 | */ |
555 | static struct sbmix_elem snd_sbpro_ctl_master_play_vol = | 546 | static struct sbmix_elem snd_sbpro_controls[] = { |
556 | SB_DOUBLE("Master Playback Volume", SB_DSP_MASTER_DEV, SB_DSP_MASTER_DEV, 5, 1, 7); | 547 | SB_DOUBLE("Master Playback Volume", |
557 | static struct sbmix_elem snd_sbpro_ctl_pcm_play_vol = | 548 | SB_DSP_MASTER_DEV, SB_DSP_MASTER_DEV, 5, 1, 7), |
558 | SB_DOUBLE("PCM Playback Volume", SB_DSP_PCM_DEV, SB_DSP_PCM_DEV, 5, 1, 7); | 549 | SB_DOUBLE("PCM Playback Volume", |
559 | static struct sbmix_elem snd_sbpro_ctl_pcm_play_filter = | 550 | SB_DSP_PCM_DEV, SB_DSP_PCM_DEV, 5, 1, 7), |
560 | SB_SINGLE("PCM Playback Filter", SB_DSP_PLAYBACK_FILT, 5, 1); | 551 | SB_SINGLE("PCM Playback Filter", SB_DSP_PLAYBACK_FILT, 5, 1), |
561 | static struct sbmix_elem snd_sbpro_ctl_synth_play_vol = | 552 | SB_DOUBLE("Synth Playback Volume", |
562 | SB_DOUBLE("Synth Playback Volume", SB_DSP_FM_DEV, SB_DSP_FM_DEV, 5, 1, 7); | 553 | SB_DSP_FM_DEV, SB_DSP_FM_DEV, 5, 1, 7), |
563 | static struct sbmix_elem snd_sbpro_ctl_cd_play_vol = | 554 | SB_DOUBLE("CD Playback Volume", SB_DSP_CD_DEV, SB_DSP_CD_DEV, 5, 1, 7), |
564 | SB_DOUBLE("CD Playback Volume", SB_DSP_CD_DEV, SB_DSP_CD_DEV, 5, 1, 7); | 555 | SB_DOUBLE("Line Playback Volume", |
565 | static struct sbmix_elem snd_sbpro_ctl_line_play_vol = | 556 | SB_DSP_LINE_DEV, SB_DSP_LINE_DEV, 5, 1, 7), |
566 | SB_DOUBLE("Line Playback Volume", SB_DSP_LINE_DEV, SB_DSP_LINE_DEV, 5, 1, 7); | 557 | SB_SINGLE("Mic Playback Volume", SB_DSP_MIC_DEV, 1, 3), |
567 | static struct sbmix_elem snd_sbpro_ctl_mic_play_vol = | ||
568 | SB_SINGLE("Mic Playback Volume", SB_DSP_MIC_DEV, 1, 3); | ||
569 | static struct sbmix_elem snd_sbpro_ctl_capture_source = | ||
570 | { | 558 | { |
571 | .name = "Capture Source", | 559 | .name = "Capture Source", |
572 | .type = SB_MIX_CAPTURE_PRO | 560 | .type = SB_MIX_CAPTURE_PRO |
573 | }; | 561 | }, |
574 | static struct sbmix_elem snd_sbpro_ctl_capture_filter = | 562 | SB_SINGLE("Capture Filter", SB_DSP_CAPTURE_FILT, 5, 1), |
575 | SB_SINGLE("Capture Filter", SB_DSP_CAPTURE_FILT, 5, 1); | 563 | SB_SINGLE("Capture Low-Pass Filter", SB_DSP_CAPTURE_FILT, 3, 1) |
576 | static struct sbmix_elem snd_sbpro_ctl_capture_low_filter = | ||
577 | SB_SINGLE("Capture Low-Pass Filter", SB_DSP_CAPTURE_FILT, 3, 1); | ||
578 | |||
579 | static struct sbmix_elem *snd_sbpro_controls[] = { | ||
580 | &snd_sbpro_ctl_master_play_vol, | ||
581 | &snd_sbpro_ctl_pcm_play_vol, | ||
582 | &snd_sbpro_ctl_pcm_play_filter, | ||
583 | &snd_sbpro_ctl_synth_play_vol, | ||
584 | &snd_sbpro_ctl_cd_play_vol, | ||
585 | &snd_sbpro_ctl_line_play_vol, | ||
586 | &snd_sbpro_ctl_mic_play_vol, | ||
587 | &snd_sbpro_ctl_capture_source, | ||
588 | &snd_sbpro_ctl_capture_filter, | ||
589 | &snd_sbpro_ctl_capture_low_filter | ||
590 | }; | 564 | }; |
591 | 565 | ||
592 | static unsigned char snd_sbpro_init_values[][2] = { | 566 | static unsigned char snd_sbpro_init_values[][2] = { |
@@ -598,68 +572,42 @@ static unsigned char snd_sbpro_init_values[][2] = { | |||
598 | /* | 572 | /* |
599 | * SB16 specific mixer elements | 573 | * SB16 specific mixer elements |
600 | */ | 574 | */ |
601 | static struct sbmix_elem snd_sb16_ctl_master_play_vol = | 575 | static struct sbmix_elem snd_sb16_controls[] = { |
602 | SB_DOUBLE("Master Playback Volume", SB_DSP4_MASTER_DEV, (SB_DSP4_MASTER_DEV + 1), 3, 3, 31); | 576 | SB_DOUBLE("Master Playback Volume", |
603 | static struct sbmix_elem snd_sb16_ctl_3d_enhance_switch = | 577 | SB_DSP4_MASTER_DEV, (SB_DSP4_MASTER_DEV + 1), 3, 3, 31), |
604 | SB_SINGLE("3D Enhancement Switch", SB_DSP4_3DSE, 0, 1); | 578 | SB_DOUBLE("PCM Playback Volume", |
605 | static struct sbmix_elem snd_sb16_ctl_tone_bass = | 579 | SB_DSP4_PCM_DEV, (SB_DSP4_PCM_DEV + 1), 3, 3, 31), |
606 | SB_DOUBLE("Tone Control - Bass", SB_DSP4_BASS_DEV, (SB_DSP4_BASS_DEV + 1), 4, 4, 15); | 580 | SB16_INPUT_SW("Synth Capture Route", |
607 | static struct sbmix_elem snd_sb16_ctl_tone_treble = | 581 | SB_DSP4_INPUT_LEFT, SB_DSP4_INPUT_RIGHT, 6, 5), |
608 | SB_DOUBLE("Tone Control - Treble", SB_DSP4_TREBLE_DEV, (SB_DSP4_TREBLE_DEV + 1), 4, 4, 15); | 582 | SB_DOUBLE("Synth Playback Volume", |
609 | static struct sbmix_elem snd_sb16_ctl_pcm_play_vol = | 583 | SB_DSP4_SYNTH_DEV, (SB_DSP4_SYNTH_DEV + 1), 3, 3, 31), |
610 | SB_DOUBLE("PCM Playback Volume", SB_DSP4_PCM_DEV, (SB_DSP4_PCM_DEV + 1), 3, 3, 31); | 584 | SB16_INPUT_SW("CD Capture Route", |
611 | static struct sbmix_elem snd_sb16_ctl_synth_capture_route = | 585 | SB_DSP4_INPUT_LEFT, SB_DSP4_INPUT_RIGHT, 2, 1), |
612 | SB16_INPUT_SW("Synth Capture Route", SB_DSP4_INPUT_LEFT, SB_DSP4_INPUT_RIGHT, 6, 5); | 586 | SB_DOUBLE("CD Playback Switch", |
613 | static struct sbmix_elem snd_sb16_ctl_synth_play_vol = | 587 | SB_DSP4_OUTPUT_SW, SB_DSP4_OUTPUT_SW, 2, 1, 1), |
614 | SB_DOUBLE("Synth Playback Volume", SB_DSP4_SYNTH_DEV, (SB_DSP4_SYNTH_DEV + 1), 3, 3, 31); | 588 | SB_DOUBLE("CD Playback Volume", |
615 | static struct sbmix_elem snd_sb16_ctl_cd_capture_route = | 589 | SB_DSP4_CD_DEV, (SB_DSP4_CD_DEV + 1), 3, 3, 31), |
616 | SB16_INPUT_SW("CD Capture Route", SB_DSP4_INPUT_LEFT, SB_DSP4_INPUT_RIGHT, 2, 1); | 590 | SB16_INPUT_SW("Mic Capture Route", |
617 | static struct sbmix_elem snd_sb16_ctl_cd_play_switch = | 591 | SB_DSP4_INPUT_LEFT, SB_DSP4_INPUT_RIGHT, 0, 0), |
618 | SB_DOUBLE("CD Playback Switch", SB_DSP4_OUTPUT_SW, SB_DSP4_OUTPUT_SW, 2, 1, 1); | 592 | SB_SINGLE("Mic Playback Switch", SB_DSP4_OUTPUT_SW, 0, 1), |
619 | static struct sbmix_elem snd_sb16_ctl_cd_play_vol = | 593 | SB_SINGLE("Mic Playback Volume", SB_DSP4_MIC_DEV, 3, 31), |
620 | SB_DOUBLE("CD Playback Volume", SB_DSP4_CD_DEV, (SB_DSP4_CD_DEV + 1), 3, 3, 31); | 594 | SB_SINGLE("Beep Volume", SB_DSP4_SPEAKER_DEV, 6, 3), |
621 | static struct sbmix_elem snd_sb16_ctl_line_capture_route = | 595 | SB_DOUBLE("Capture Volume", |
622 | SB16_INPUT_SW("Line Capture Route", SB_DSP4_INPUT_LEFT, SB_DSP4_INPUT_RIGHT, 4, 3); | 596 | SB_DSP4_IGAIN_DEV, (SB_DSP4_IGAIN_DEV + 1), 6, 6, 3), |
623 | static struct sbmix_elem snd_sb16_ctl_line_play_switch = | 597 | SB_DOUBLE("Playback Volume", |
624 | SB_DOUBLE("Line Playback Switch", SB_DSP4_OUTPUT_SW, SB_DSP4_OUTPUT_SW, 4, 3, 1); | 598 | SB_DSP4_OGAIN_DEV, (SB_DSP4_OGAIN_DEV + 1), 6, 6, 3), |
625 | static struct sbmix_elem snd_sb16_ctl_line_play_vol = | 599 | SB16_INPUT_SW("Line Capture Route", |
626 | SB_DOUBLE("Line Playback Volume", SB_DSP4_LINE_DEV, (SB_DSP4_LINE_DEV + 1), 3, 3, 31); | 600 | SB_DSP4_INPUT_LEFT, SB_DSP4_INPUT_RIGHT, 4, 3), |
627 | static struct sbmix_elem snd_sb16_ctl_mic_capture_route = | 601 | SB_DOUBLE("Line Playback Switch", |
628 | SB16_INPUT_SW("Mic Capture Route", SB_DSP4_INPUT_LEFT, SB_DSP4_INPUT_RIGHT, 0, 0); | 602 | SB_DSP4_OUTPUT_SW, SB_DSP4_OUTPUT_SW, 4, 3, 1), |
629 | static struct sbmix_elem snd_sb16_ctl_mic_play_switch = | 603 | SB_DOUBLE("Line Playback Volume", |
630 | SB_SINGLE("Mic Playback Switch", SB_DSP4_OUTPUT_SW, 0, 1); | 604 | SB_DSP4_LINE_DEV, (SB_DSP4_LINE_DEV + 1), 3, 3, 31), |
631 | static struct sbmix_elem snd_sb16_ctl_mic_play_vol = | 605 | SB_SINGLE("Mic Auto Gain", SB_DSP4_MIC_AGC, 0, 1), |
632 | SB_SINGLE("Mic Playback Volume", SB_DSP4_MIC_DEV, 3, 31); | 606 | SB_SINGLE("3D Enhancement Switch", SB_DSP4_3DSE, 0, 1), |
633 | static struct sbmix_elem snd_sb16_ctl_pc_speaker_vol = | 607 | SB_DOUBLE("Tone Control - Bass", |
634 | SB_SINGLE("Beep Volume", SB_DSP4_SPEAKER_DEV, 6, 3); | 608 | SB_DSP4_BASS_DEV, (SB_DSP4_BASS_DEV + 1), 4, 4, 15), |
635 | static struct sbmix_elem snd_sb16_ctl_capture_vol = | 609 | SB_DOUBLE("Tone Control - Treble", |
636 | SB_DOUBLE("Capture Volume", SB_DSP4_IGAIN_DEV, (SB_DSP4_IGAIN_DEV + 1), 6, 6, 3); | 610 | SB_DSP4_TREBLE_DEV, (SB_DSP4_TREBLE_DEV + 1), 4, 4, 15) |
637 | static struct sbmix_elem snd_sb16_ctl_play_vol = | ||
638 | SB_DOUBLE("Playback Volume", SB_DSP4_OGAIN_DEV, (SB_DSP4_OGAIN_DEV + 1), 6, 6, 3); | ||
639 | static struct sbmix_elem snd_sb16_ctl_auto_mic_gain = | ||
640 | SB_SINGLE("Mic Auto Gain", SB_DSP4_MIC_AGC, 0, 1); | ||
641 | |||
642 | static struct sbmix_elem *snd_sb16_controls[] = { | ||
643 | &snd_sb16_ctl_master_play_vol, | ||
644 | &snd_sb16_ctl_3d_enhance_switch, | ||
645 | &snd_sb16_ctl_tone_bass, | ||
646 | &snd_sb16_ctl_tone_treble, | ||
647 | &snd_sb16_ctl_pcm_play_vol, | ||
648 | &snd_sb16_ctl_synth_capture_route, | ||
649 | &snd_sb16_ctl_synth_play_vol, | ||
650 | &snd_sb16_ctl_cd_capture_route, | ||
651 | &snd_sb16_ctl_cd_play_switch, | ||
652 | &snd_sb16_ctl_cd_play_vol, | ||
653 | &snd_sb16_ctl_line_capture_route, | ||
654 | &snd_sb16_ctl_line_play_switch, | ||
655 | &snd_sb16_ctl_line_play_vol, | ||
656 | &snd_sb16_ctl_mic_capture_route, | ||
657 | &snd_sb16_ctl_mic_play_switch, | ||
658 | &snd_sb16_ctl_mic_play_vol, | ||
659 | &snd_sb16_ctl_pc_speaker_vol, | ||
660 | &snd_sb16_ctl_capture_vol, | ||
661 | &snd_sb16_ctl_play_vol, | ||
662 | &snd_sb16_ctl_auto_mic_gain | ||
663 | }; | 611 | }; |
664 | 612 | ||
665 | static unsigned char snd_sb16_init_values[][2] = { | 613 | static unsigned char snd_sb16_init_values[][2] = { |
@@ -678,46 +626,34 @@ static unsigned char snd_sb16_init_values[][2] = { | |||
678 | /* | 626 | /* |
679 | * DT019x specific mixer elements | 627 | * DT019x specific mixer elements |
680 | */ | 628 | */ |
681 | static struct sbmix_elem snd_dt019x_ctl_master_play_vol = | 629 | static struct sbmix_elem snd_dt019x_controls[] = { |
682 | SB_DOUBLE("Master Playback Volume", SB_DT019X_MASTER_DEV, SB_DT019X_MASTER_DEV, 4,0, 15); | 630 | /* ALS4000 below has some parts which we might be lacking, |
683 | static struct sbmix_elem snd_dt019x_ctl_pcm_play_vol = | 631 | * e.g. snd_als4000_ctl_mono_playback_switch - check it! */ |
684 | SB_DOUBLE("PCM Playback Volume", SB_DT019X_PCM_DEV, SB_DT019X_PCM_DEV, 4,0, 15); | 632 | SB_DOUBLE("Master Playback Volume", |
685 | static struct sbmix_elem snd_dt019x_ctl_synth_play_vol = | 633 | SB_DT019X_MASTER_DEV, SB_DT019X_MASTER_DEV, 4, 0, 15), |
686 | SB_DOUBLE("Synth Playback Volume", SB_DT019X_SYNTH_DEV, SB_DT019X_SYNTH_DEV, 4,0, 15); | 634 | SB_DOUBLE("PCM Playback Switch", |
687 | static struct sbmix_elem snd_dt019x_ctl_cd_play_vol = | 635 | SB_DT019X_OUTPUT_SW2, SB_DT019X_OUTPUT_SW2, 2, 1, 1), |
688 | SB_DOUBLE("CD Playback Volume", SB_DT019X_CD_DEV, SB_DT019X_CD_DEV, 4,0, 15); | 636 | SB_DOUBLE("PCM Playback Volume", |
689 | static struct sbmix_elem snd_dt019x_ctl_mic_play_vol = | 637 | SB_DT019X_PCM_DEV, SB_DT019X_PCM_DEV, 4, 0, 15), |
690 | SB_SINGLE("Mic Playback Volume", SB_DT019X_MIC_DEV, 4, 7); | 638 | SB_DOUBLE("Synth Playback Switch", |
691 | static struct sbmix_elem snd_dt019x_ctl_pc_speaker_vol = | 639 | SB_DT019X_OUTPUT_SW2, SB_DT019X_OUTPUT_SW2, 4, 3, 1), |
692 | SB_SINGLE("Beep Volume", SB_DT019X_SPKR_DEV, 0, 7); | 640 | SB_DOUBLE("Synth Playback Volume", |
693 | static struct sbmix_elem snd_dt019x_ctl_line_play_vol = | 641 | SB_DT019X_SYNTH_DEV, SB_DT019X_SYNTH_DEV, 4, 0, 15), |
694 | SB_DOUBLE("Line Playback Volume", SB_DT019X_LINE_DEV, SB_DT019X_LINE_DEV, 4,0, 15); | 642 | SB_DOUBLE("CD Playback Switch", |
695 | static struct sbmix_elem snd_dt019x_ctl_pcm_play_switch = | 643 | SB_DSP4_OUTPUT_SW, SB_DSP4_OUTPUT_SW, 2, 1, 1), |
696 | SB_DOUBLE("PCM Playback Switch", SB_DT019X_OUTPUT_SW2, SB_DT019X_OUTPUT_SW2, 2,1, 1); | 644 | SB_DOUBLE("CD Playback Volume", |
697 | static struct sbmix_elem snd_dt019x_ctl_synth_play_switch = | 645 | SB_DT019X_CD_DEV, SB_DT019X_CD_DEV, 4, 0, 15), |
698 | SB_DOUBLE("Synth Playback Switch", SB_DT019X_OUTPUT_SW2, SB_DT019X_OUTPUT_SW2, 4,3, 1); | 646 | SB_SINGLE("Mic Playback Switch", SB_DSP4_OUTPUT_SW, 0, 1), |
699 | static struct sbmix_elem snd_dt019x_ctl_capture_source = | 647 | SB_SINGLE("Mic Playback Volume", SB_DT019X_MIC_DEV, 4, 7), |
648 | SB_SINGLE("Beep Volume", SB_DT019X_SPKR_DEV, 0, 7), | ||
649 | SB_DOUBLE("Line Playback Switch", | ||
650 | SB_DSP4_OUTPUT_SW, SB_DSP4_OUTPUT_SW, 4, 3, 1), | ||
651 | SB_DOUBLE("Line Playback Volume", | ||
652 | SB_DT019X_LINE_DEV, SB_DT019X_LINE_DEV, 4, 0, 15), | ||
700 | { | 653 | { |
701 | .name = "Capture Source", | 654 | .name = "Capture Source", |
702 | .type = SB_MIX_CAPTURE_DT019X | 655 | .type = SB_MIX_CAPTURE_DT019X |
703 | }; | 656 | } |
704 | |||
705 | static struct sbmix_elem *snd_dt019x_controls[] = { | ||
706 | /* ALS4000 below has some parts which we might be lacking, | ||
707 | * e.g. snd_als4000_ctl_mono_playback_switch - check it! */ | ||
708 | &snd_dt019x_ctl_master_play_vol, | ||
709 | &snd_dt019x_ctl_pcm_play_vol, | ||
710 | &snd_dt019x_ctl_synth_play_vol, | ||
711 | &snd_dt019x_ctl_cd_play_vol, | ||
712 | &snd_dt019x_ctl_mic_play_vol, | ||
713 | &snd_dt019x_ctl_pc_speaker_vol, | ||
714 | &snd_dt019x_ctl_line_play_vol, | ||
715 | &snd_sb16_ctl_mic_play_switch, | ||
716 | &snd_sb16_ctl_cd_play_switch, | ||
717 | &snd_sb16_ctl_line_play_switch, | ||
718 | &snd_dt019x_ctl_pcm_play_switch, | ||
719 | &snd_dt019x_ctl_synth_play_switch, | ||
720 | &snd_dt019x_ctl_capture_source | ||
721 | }; | 657 | }; |
722 | 658 | ||
723 | static unsigned char snd_dt019x_init_values[][2] = { | 659 | static unsigned char snd_dt019x_init_values[][2] = { |
@@ -735,82 +671,37 @@ static unsigned char snd_dt019x_init_values[][2] = { | |||
735 | /* | 671 | /* |
736 | * ALS4000 specific mixer elements | 672 | * ALS4000 specific mixer elements |
737 | */ | 673 | */ |
738 | static struct sbmix_elem snd_als4000_ctl_master_mono_playback_switch = | 674 | static struct sbmix_elem snd_als4000_controls[] = { |
739 | SB_SINGLE("Master Mono Playback Switch", SB_ALS4000_MONO_IO_CTRL, 5, 1); | 675 | SB_DOUBLE("PCM Playback Switch", |
740 | static struct sbmix_elem snd_als4k_ctl_master_mono_capture_route = { | 676 | SB_DT019X_OUTPUT_SW2, SB_DT019X_OUTPUT_SW2, 2, 1, 1), |
677 | SB_DOUBLE("Synth Playback Switch", | ||
678 | SB_DT019X_OUTPUT_SW2, SB_DT019X_OUTPUT_SW2, 4, 3, 1), | ||
679 | SB_SINGLE("Mic Boost (+20dB)", SB_ALS4000_MIC_IN_GAIN, 0, 0x03), | ||
680 | SB_SINGLE("Master Mono Playback Switch", SB_ALS4000_MONO_IO_CTRL, 5, 1), | ||
681 | { | ||
741 | .name = "Master Mono Capture Route", | 682 | .name = "Master Mono Capture Route", |
742 | .type = SB_MIX_MONO_CAPTURE_ALS4K | 683 | .type = SB_MIX_MONO_CAPTURE_ALS4K |
743 | }; | 684 | }, |
744 | static struct sbmix_elem snd_als4000_ctl_mono_playback_switch = | 685 | SB_SINGLE("Mono Playback Switch", SB_DT019X_OUTPUT_SW2, 0, 1), |
745 | SB_SINGLE("Mono Playback Switch", SB_DT019X_OUTPUT_SW2, 0, 1); | 686 | SB_SINGLE("Analog Loopback Switch", SB_ALS4000_MIC_IN_GAIN, 7, 0x01), |
746 | static struct sbmix_elem snd_als4000_ctl_mic_20db_boost = | 687 | SB_SINGLE("3D Control - Switch", SB_ALS4000_3D_SND_FX, 6, 0x01), |
747 | SB_SINGLE("Mic Boost (+20dB)", SB_ALS4000_MIC_IN_GAIN, 0, 0x03); | ||
748 | static struct sbmix_elem snd_als4000_ctl_mixer_analog_loopback = | ||
749 | SB_SINGLE("Analog Loopback Switch", SB_ALS4000_MIC_IN_GAIN, 7, 0x01); | ||
750 | static struct sbmix_elem snd_als4000_ctl_mixer_digital_loopback = | ||
751 | SB_SINGLE("Digital Loopback Switch", | 688 | SB_SINGLE("Digital Loopback Switch", |
752 | SB_ALS4000_CR3_CONFIGURATION, 7, 0x01); | 689 | SB_ALS4000_CR3_CONFIGURATION, 7, 0x01), |
753 | /* FIXME: functionality of 3D controls might be swapped, I didn't find | 690 | /* FIXME: functionality of 3D controls might be swapped, I didn't find |
754 | * a description of how to identify what is supposed to be what */ | 691 | * a description of how to identify what is supposed to be what */ |
755 | static struct sbmix_elem snd_als4000_3d_control_switch = | 692 | SB_SINGLE("3D Control - Level", SB_ALS4000_3D_SND_FX, 0, 0x07), |
756 | SB_SINGLE("3D Control - Switch", SB_ALS4000_3D_SND_FX, 6, 0x01); | ||
757 | static struct sbmix_elem snd_als4000_3d_control_ratio = | ||
758 | SB_SINGLE("3D Control - Level", SB_ALS4000_3D_SND_FX, 0, 0x07); | ||
759 | static struct sbmix_elem snd_als4000_3d_control_freq = | ||
760 | /* FIXME: maybe there's actually some standard 3D ctrl name for it?? */ | 693 | /* FIXME: maybe there's actually some standard 3D ctrl name for it?? */ |
761 | SB_SINGLE("3D Control - Freq", SB_ALS4000_3D_SND_FX, 4, 0x03); | 694 | SB_SINGLE("3D Control - Freq", SB_ALS4000_3D_SND_FX, 4, 0x03), |
762 | static struct sbmix_elem snd_als4000_3d_control_delay = | ||
763 | /* FIXME: ALS4000a.pdf mentions BBD (Bucket Brigade Device) time delay, | 695 | /* FIXME: ALS4000a.pdf mentions BBD (Bucket Brigade Device) time delay, |
764 | * but what ALSA 3D attribute is that actually? "Center", "Depth", | 696 | * but what ALSA 3D attribute is that actually? "Center", "Depth", |
765 | * "Wide" or "Space" or even "Level"? Assuming "Wide" for now... */ | 697 | * "Wide" or "Space" or even "Level"? Assuming "Wide" for now... */ |
766 | SB_SINGLE("3D Control - Wide", SB_ALS4000_3D_TIME_DELAY, 0, 0x0f); | 698 | SB_SINGLE("3D Control - Wide", SB_ALS4000_3D_TIME_DELAY, 0, 0x0f), |
767 | static struct sbmix_elem snd_als4000_3d_control_poweroff_switch = | 699 | SB_SINGLE("3D PowerOff Switch", SB_ALS4000_3D_TIME_DELAY, 4, 0x01), |
768 | SB_SINGLE("3D PowerOff Switch", SB_ALS4000_3D_TIME_DELAY, 4, 0x01); | ||
769 | static struct sbmix_elem snd_als4000_ctl_3db_freq_control_switch = | ||
770 | SB_SINGLE("Master Playback 8kHz / 20kHz LPF Switch", | 700 | SB_SINGLE("Master Playback 8kHz / 20kHz LPF Switch", |
771 | SB_ALS4000_FMDAC, 5, 0x01); | 701 | SB_ALS4000_FMDAC, 5, 0x01), |
772 | #ifdef NOT_AVAILABLE | 702 | #ifdef NOT_AVAILABLE |
773 | static struct sbmix_elem snd_als4000_ctl_fmdac = | 703 | SB_SINGLE("FMDAC Switch (Option ?)", SB_ALS4000_FMDAC, 0, 0x01), |
774 | SB_SINGLE("FMDAC Switch (Option ?)", SB_ALS4000_FMDAC, 0, 0x01); | 704 | SB_SINGLE("QSound Mode", SB_ALS4000_QSOUND, 1, 0x1f), |
775 | static struct sbmix_elem snd_als4000_ctl_qsound = | ||
776 | SB_SINGLE("QSound Mode", SB_ALS4000_QSOUND, 1, 0x1f); | ||
777 | #endif | ||
778 | |||
779 | static struct sbmix_elem *snd_als4000_controls[] = { | ||
780 | /* ALS4000a.PDF regs page */ | ||
781 | &snd_sb16_ctl_master_play_vol, /* MX30/31 12 */ | ||
782 | &snd_dt019x_ctl_pcm_play_switch, /* MX4C 16 */ | ||
783 | &snd_sb16_ctl_pcm_play_vol, /* MX32/33 12 */ | ||
784 | &snd_sb16_ctl_synth_capture_route, /* MX3D/3E 14 */ | ||
785 | &snd_dt019x_ctl_synth_play_switch, /* MX4C 16 */ | ||
786 | &snd_sb16_ctl_synth_play_vol, /* MX34/35 12/13 */ | ||
787 | &snd_sb16_ctl_cd_capture_route, /* MX3D/3E 14 */ | ||
788 | &snd_sb16_ctl_cd_play_switch, /* MX3C 14 */ | ||
789 | &snd_sb16_ctl_cd_play_vol, /* MX36/37 13 */ | ||
790 | &snd_sb16_ctl_line_capture_route, /* MX3D/3E 14 */ | ||
791 | &snd_sb16_ctl_line_play_switch, /* MX3C 14 */ | ||
792 | &snd_sb16_ctl_line_play_vol, /* MX38/39 13 */ | ||
793 | &snd_sb16_ctl_mic_capture_route, /* MX3D/3E 14 */ | ||
794 | &snd_als4000_ctl_mic_20db_boost, /* MX4D 16 */ | ||
795 | &snd_sb16_ctl_mic_play_switch, /* MX3C 14 */ | ||
796 | &snd_sb16_ctl_mic_play_vol, /* MX3A 13 */ | ||
797 | &snd_sb16_ctl_pc_speaker_vol, /* MX3B 14 */ | ||
798 | &snd_sb16_ctl_capture_vol, /* MX3F/40 15 */ | ||
799 | &snd_sb16_ctl_play_vol, /* MX41/42 15 */ | ||
800 | &snd_als4000_ctl_master_mono_playback_switch, /* MX4C 16 */ | ||
801 | &snd_als4k_ctl_master_mono_capture_route, /* MX4B 16 */ | ||
802 | &snd_als4000_ctl_mono_playback_switch, /* MX4C 16 */ | ||
803 | &snd_als4000_ctl_mixer_analog_loopback, /* MX4D 16 */ | ||
804 | &snd_als4000_ctl_mixer_digital_loopback, /* CR3 21 */ | ||
805 | &snd_als4000_3d_control_switch, /* MX50 17 */ | ||
806 | &snd_als4000_3d_control_ratio, /* MX50 17 */ | ||
807 | &snd_als4000_3d_control_freq, /* MX50 17 */ | ||
808 | &snd_als4000_3d_control_delay, /* MX51 18 */ | ||
809 | &snd_als4000_3d_control_poweroff_switch, /* MX51 18 */ | ||
810 | &snd_als4000_ctl_3db_freq_control_switch, /* MX4F 17 */ | ||
811 | #ifdef NOT_AVAILABLE | ||
812 | &snd_als4000_ctl_fmdac, | ||
813 | &snd_als4000_ctl_qsound, | ||
814 | #endif | 705 | #endif |
815 | }; | 706 | }; |
816 | 707 | ||
@@ -829,11 +720,10 @@ static unsigned char snd_als4000_init_values[][2] = { | |||
829 | { SB_ALS4000_MIC_IN_GAIN, 0 }, | 720 | { SB_ALS4000_MIC_IN_GAIN, 0 }, |
830 | }; | 721 | }; |
831 | 722 | ||
832 | |||
833 | /* | 723 | /* |
834 | */ | 724 | */ |
835 | static int snd_sbmixer_init(struct snd_sb *chip, | 725 | static int snd_sbmixer_init(struct snd_sb *chip, |
836 | struct sbmix_elem **controls, | 726 | struct sbmix_elem *controls, |
837 | int controls_count, | 727 | int controls_count, |
838 | unsigned char map[][2], | 728 | unsigned char map[][2], |
839 | int map_count, | 729 | int map_count, |
@@ -856,7 +746,8 @@ static int snd_sbmixer_init(struct snd_sb *chip, | |||
856 | } | 746 | } |
857 | 747 | ||
858 | for (idx = 0; idx < controls_count; idx++) { | 748 | for (idx = 0; idx < controls_count; idx++) { |
859 | if ((err = snd_sbmixer_add_ctl_elem(chip, controls[idx])) < 0) | 749 | err = snd_sbmixer_add_ctl_elem(chip, &controls[idx]); |
750 | if (err < 0) | ||
860 | return err; | 751 | return err; |
861 | } | 752 | } |
862 | snd_component_add(card, name); | 753 | snd_component_add(card, name); |
@@ -908,6 +799,15 @@ int snd_sbmixer_new(struct snd_sb *chip) | |||
908 | return err; | 799 | return err; |
909 | break; | 800 | break; |
910 | case SB_HW_ALS4000: | 801 | case SB_HW_ALS4000: |
802 | /* use only the first 16 controls from SB16 */ | ||
803 | err = snd_sbmixer_init(chip, | ||
804 | snd_sb16_controls, | ||
805 | 16, | ||
806 | snd_sb16_init_values, | ||
807 | ARRAY_SIZE(snd_sb16_init_values), | ||
808 | "ALS4000"); | ||
809 | if (err < 0) | ||
810 | return err; | ||
911 | if ((err = snd_sbmixer_init(chip, | 811 | if ((err = snd_sbmixer_init(chip, |
912 | snd_als4000_controls, | 812 | snd_als4000_controls, |
913 | ARRAY_SIZE(snd_als4000_controls), | 813 | ARRAY_SIZE(snd_als4000_controls), |