aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/oxygen/oxygen_mixer.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/oxygen/oxygen_mixer.c')
-rw-r--r--sound/pci/oxygen/oxygen_mixer.c202
1 files changed, 104 insertions, 98 deletions
diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c
index 4e77b79b3b6e..6b5ff6e0fadd 100644
--- a/sound/pci/oxygen/oxygen_mixer.c
+++ b/sound/pci/oxygen/oxygen_mixer.c
@@ -737,90 +737,111 @@ static const struct snd_kcontrol_new controls[] = {
737 }, 737 },
738}; 738};
739 739
740static const struct snd_kcontrol_new monitor_a_controls[] = { 740static const struct {
741 unsigned int pcm_dev;
742 struct snd_kcontrol_new controls[2];
743} monitor_controls[] = {
741 { 744 {
742 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 745 .pcm_dev = CAPTURE_0_FROM_I2S_1,
743 .name = "Analog Input Monitor Switch", 746 .controls = {
744 .info = snd_ctl_boolean_mono_info, 747 {
745 .get = monitor_get, 748 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
746 .put = monitor_put, 749 .name = "Analog Input Monitor Switch",
747 .private_value = OXYGEN_ADC_MONITOR_A, 750 .info = snd_ctl_boolean_mono_info,
751 .get = monitor_get,
752 .put = monitor_put,
753 .private_value = OXYGEN_ADC_MONITOR_A,
754 },
755 {
756 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
757 .name = "Analog Input Monitor Volume",
758 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
759 SNDRV_CTL_ELEM_ACCESS_TLV_READ,
760 .info = monitor_volume_info,
761 .get = monitor_get,
762 .put = monitor_put,
763 .private_value = OXYGEN_ADC_MONITOR_A_HALF_VOL
764 | (1 << 8),
765 .tlv = { .p = monitor_db_scale, },
766 },
767 },
748 }, 768 },
749 { 769 {
750 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 770 .pcm_dev = CAPTURE_0_FROM_I2S_2,
751 .name = "Analog Input Monitor Volume", 771 .controls = {
752 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | 772 {
753 SNDRV_CTL_ELEM_ACCESS_TLV_READ, 773 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
754 .info = monitor_volume_info, 774 .name = "Analog Input Monitor Switch",
755 .get = monitor_get, 775 .info = snd_ctl_boolean_mono_info,
756 .put = monitor_put, 776 .get = monitor_get,
757 .private_value = OXYGEN_ADC_MONITOR_A_HALF_VOL | (1 << 8), 777 .put = monitor_put,
758 .tlv = { .p = monitor_db_scale, }, 778 .private_value = OXYGEN_ADC_MONITOR_B,
779 },
780 {
781 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
782 .name = "Analog Input Monitor Volume",
783 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
784 SNDRV_CTL_ELEM_ACCESS_TLV_READ,
785 .info = monitor_volume_info,
786 .get = monitor_get,
787 .put = monitor_put,
788 .private_value = OXYGEN_ADC_MONITOR_B_HALF_VOL
789 | (1 << 8),
790 .tlv = { .p = monitor_db_scale, },
791 },
792 },
759 }, 793 },
760};
761static const struct snd_kcontrol_new monitor_b_controls[] = {
762 { 794 {
763 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 795 .pcm_dev = CAPTURE_2_FROM_I2S_2,
764 .name = "Analog Input Monitor Switch", 796 .controls = {
765 .info = snd_ctl_boolean_mono_info, 797 {
766 .get = monitor_get, 798 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
767 .put = monitor_put, 799 .name = "Analog Input Monitor Switch",
768 .private_value = OXYGEN_ADC_MONITOR_B, 800 .index = 1,
801 .info = snd_ctl_boolean_mono_info,
802 .get = monitor_get,
803 .put = monitor_put,
804 .private_value = OXYGEN_ADC_MONITOR_B,
805 },
806 {
807 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
808 .name = "Analog Input Monitor Volume",
809 .index = 1,
810 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
811 SNDRV_CTL_ELEM_ACCESS_TLV_READ,
812 .info = monitor_volume_info,
813 .get = monitor_get,
814 .put = monitor_put,
815 .private_value = OXYGEN_ADC_MONITOR_B_HALF_VOL
816 | (1 << 8),
817 .tlv = { .p = monitor_db_scale, },
818 },
819 },
769 }, 820 },
770 { 821 {
771 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 822 .pcm_dev = CAPTURE_1_FROM_SPDIF,
772 .name = "Analog Input Monitor Volume", 823 .controls = {
773 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | 824 {
774 SNDRV_CTL_ELEM_ACCESS_TLV_READ, 825 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
775 .info = monitor_volume_info, 826 .name = "Digital Input Monitor Switch",
776 .get = monitor_get, 827 .info = snd_ctl_boolean_mono_info,
777 .put = monitor_put, 828 .get = monitor_get,
778 .private_value = OXYGEN_ADC_MONITOR_B_HALF_VOL | (1 << 8), 829 .put = monitor_put,
779 .tlv = { .p = monitor_db_scale, }, 830 .private_value = OXYGEN_ADC_MONITOR_C,
780 }, 831 },
781}; 832 {
782static const struct snd_kcontrol_new monitor_2nd_b_controls[] = { 833 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
783 { 834 .name = "Digital Input Monitor Volume",
784 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 835 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
785 .name = "Analog Input Monitor Switch", 836 SNDRV_CTL_ELEM_ACCESS_TLV_READ,
786 .index = 1, 837 .info = monitor_volume_info,
787 .info = snd_ctl_boolean_mono_info, 838 .get = monitor_get,
788 .get = monitor_get, 839 .put = monitor_put,
789 .put = monitor_put, 840 .private_value = OXYGEN_ADC_MONITOR_C_HALF_VOL
790 .private_value = OXYGEN_ADC_MONITOR_B, 841 | (1 << 8),
791 }, 842 .tlv = { .p = monitor_db_scale, },
792 { 843 },
793 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 844 },
794 .name = "Analog Input Monitor Volume",
795 .index = 1,
796 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
797 SNDRV_CTL_ELEM_ACCESS_TLV_READ,
798 .info = monitor_volume_info,
799 .get = monitor_get,
800 .put = monitor_put,
801 .private_value = OXYGEN_ADC_MONITOR_B_HALF_VOL | (1 << 8),
802 .tlv = { .p = monitor_db_scale, },
803 },
804};
805static const struct snd_kcontrol_new monitor_c_controls[] = {
806 {
807 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
808 .name = "Digital Input Monitor Switch",
809 .info = snd_ctl_boolean_mono_info,
810 .get = monitor_get,
811 .put = monitor_put,
812 .private_value = OXYGEN_ADC_MONITOR_C,
813 },
814 {
815 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
816 .name = "Digital Input Monitor Volume",
817 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
818 SNDRV_CTL_ELEM_ACCESS_TLV_READ,
819 .info = monitor_volume_info,
820 .get = monitor_get,
821 .put = monitor_put,
822 .private_value = OXYGEN_ADC_MONITOR_C_HALF_VOL | (1 << 8),
823 .tlv = { .p = monitor_db_scale, },
824 }, 845 },
825}; 846};
826 847
@@ -905,32 +926,17 @@ static int add_controls(struct oxygen *chip,
905 926
906int oxygen_mixer_init(struct oxygen *chip) 927int oxygen_mixer_init(struct oxygen *chip)
907{ 928{
929 unsigned int i;
908 int err; 930 int err;
909 931
910 err = add_controls(chip, controls, ARRAY_SIZE(controls)); 932 err = add_controls(chip, controls, ARRAY_SIZE(controls));
911 if (err < 0) 933 if (err < 0)
912 return err; 934 return err;
913 if (chip->model->used_channels & OXYGEN_CHANNEL_A) { 935 for (i = 0; i < ARRAY_SIZE(monitor_controls); ++i) {
914 err = add_controls(chip, monitor_a_controls, 936 if (!(chip->model->pcm_dev_cfg & monitor_controls[i].pcm_dev))
915 ARRAY_SIZE(monitor_a_controls)); 937 continue;
916 if (err < 0) 938 err = add_controls(chip, monitor_controls[i].controls,
917 return err; 939 ARRAY_SIZE(monitor_controls[i].controls));
918 } else if (chip->model->used_channels & OXYGEN_CHANNEL_B) {
919 err = add_controls(chip, monitor_b_controls,
920 ARRAY_SIZE(monitor_b_controls));
921 if (err < 0)
922 return err;
923 }
924 if ((chip->model->used_channels & (OXYGEN_CHANNEL_A | OXYGEN_CHANNEL_B))
925 == (OXYGEN_CHANNEL_A | OXYGEN_CHANNEL_B)) {
926 err = add_controls(chip, monitor_2nd_b_controls,
927 ARRAY_SIZE(monitor_2nd_b_controls));
928 if (err < 0)
929 return err;
930 }
931 if (chip->model->used_channels & OXYGEN_CHANNEL_C) {
932 err = add_controls(chip, monitor_c_controls,
933 ARRAY_SIZE(monitor_c_controls));
934 if (err < 0) 940 if (err < 0)
935 return err; 941 return err;
936 } 942 }