diff options
Diffstat (limited to 'sound/pci/oxygen/oxygen_mixer.c')
-rw-r--r-- | sound/pci/oxygen/oxygen_mixer.c | 52 |
1 files changed, 35 insertions, 17 deletions
diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c index 5401c547c4e3..f375b8a27862 100644 --- a/sound/pci/oxygen/oxygen_mixer.c +++ b/sound/pci/oxygen/oxygen_mixer.c | |||
@@ -99,11 +99,15 @@ static int dac_mute_put(struct snd_kcontrol *ctl, | |||
99 | 99 | ||
100 | static int upmix_info(struct snd_kcontrol *ctl, struct snd_ctl_elem_info *info) | 100 | static int upmix_info(struct snd_kcontrol *ctl, struct snd_ctl_elem_info *info) |
101 | { | 101 | { |
102 | static const char *const names[3] = { | 102 | static const char *const names[5] = { |
103 | "Front", "Front+Surround", "Front+Surround+Back" | 103 | "Front", |
104 | "Front+Surround", | ||
105 | "Front+Surround+Back", | ||
106 | "Front+Surround+Center/LFE", | ||
107 | "Front+Surround+Center/LFE+Back", | ||
104 | }; | 108 | }; |
105 | struct oxygen *chip = ctl->private_data; | 109 | struct oxygen *chip = ctl->private_data; |
106 | unsigned int count = 2 + (chip->model.dac_channels == 8); | 110 | unsigned int count = chip->model.update_center_lfe_mix ? 5 : 3; |
107 | 111 | ||
108 | info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 112 | info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
109 | info->count = 1; | 113 | info->count = 1; |
@@ -127,7 +131,7 @@ static int upmix_get(struct snd_kcontrol *ctl, struct snd_ctl_elem_value *value) | |||
127 | void oxygen_update_dac_routing(struct oxygen *chip) | 131 | void oxygen_update_dac_routing(struct oxygen *chip) |
128 | { | 132 | { |
129 | /* DAC 0: front, DAC 1: surround, DAC 2: center/LFE, DAC 3: back */ | 133 | /* DAC 0: front, DAC 1: surround, DAC 2: center/LFE, DAC 3: back */ |
130 | static const unsigned int reg_values[3] = { | 134 | static const unsigned int reg_values[5] = { |
131 | /* stereo -> front */ | 135 | /* stereo -> front */ |
132 | (0 << OXYGEN_PLAY_DAC0_SOURCE_SHIFT) | | 136 | (0 << OXYGEN_PLAY_DAC0_SOURCE_SHIFT) | |
133 | (1 << OXYGEN_PLAY_DAC1_SOURCE_SHIFT) | | 137 | (1 << OXYGEN_PLAY_DAC1_SOURCE_SHIFT) | |
@@ -143,6 +147,16 @@ void oxygen_update_dac_routing(struct oxygen *chip) | |||
143 | (0 << OXYGEN_PLAY_DAC1_SOURCE_SHIFT) | | 147 | (0 << OXYGEN_PLAY_DAC1_SOURCE_SHIFT) | |
144 | (2 << OXYGEN_PLAY_DAC2_SOURCE_SHIFT) | | 148 | (2 << OXYGEN_PLAY_DAC2_SOURCE_SHIFT) | |
145 | (0 << OXYGEN_PLAY_DAC3_SOURCE_SHIFT), | 149 | (0 << OXYGEN_PLAY_DAC3_SOURCE_SHIFT), |
150 | /* stereo -> front+surround+center/LFE */ | ||
151 | (0 << OXYGEN_PLAY_DAC0_SOURCE_SHIFT) | | ||
152 | (0 << OXYGEN_PLAY_DAC1_SOURCE_SHIFT) | | ||
153 | (0 << OXYGEN_PLAY_DAC2_SOURCE_SHIFT) | | ||
154 | (3 << OXYGEN_PLAY_DAC3_SOURCE_SHIFT), | ||
155 | /* stereo -> front+surround+center/LFE+back */ | ||
156 | (0 << OXYGEN_PLAY_DAC0_SOURCE_SHIFT) | | ||
157 | (0 << OXYGEN_PLAY_DAC1_SOURCE_SHIFT) | | ||
158 | (0 << OXYGEN_PLAY_DAC2_SOURCE_SHIFT) | | ||
159 | (0 << OXYGEN_PLAY_DAC3_SOURCE_SHIFT), | ||
146 | }; | 160 | }; |
147 | u8 channels; | 161 | u8 channels; |
148 | unsigned int reg_value; | 162 | unsigned int reg_value; |
@@ -167,22 +181,23 @@ void oxygen_update_dac_routing(struct oxygen *chip) | |||
167 | OXYGEN_PLAY_DAC1_SOURCE_MASK | | 181 | OXYGEN_PLAY_DAC1_SOURCE_MASK | |
168 | OXYGEN_PLAY_DAC2_SOURCE_MASK | | 182 | OXYGEN_PLAY_DAC2_SOURCE_MASK | |
169 | OXYGEN_PLAY_DAC3_SOURCE_MASK); | 183 | OXYGEN_PLAY_DAC3_SOURCE_MASK); |
184 | if (chip->model.update_center_lfe_mix) | ||
185 | chip->model.update_center_lfe_mix(chip, chip->dac_routing > 2); | ||
170 | } | 186 | } |
171 | 187 | ||
172 | static int upmix_put(struct snd_kcontrol *ctl, struct snd_ctl_elem_value *value) | 188 | static int upmix_put(struct snd_kcontrol *ctl, struct snd_ctl_elem_value *value) |
173 | { | 189 | { |
174 | struct oxygen *chip = ctl->private_data; | 190 | struct oxygen *chip = ctl->private_data; |
175 | unsigned int count = 2 + (chip->model.dac_channels == 8); | 191 | unsigned int count = chip->model.update_center_lfe_mix ? 5 : 3; |
176 | int changed; | 192 | int changed; |
177 | 193 | ||
194 | if (value->value.enumerated.item[0] >= count) | ||
195 | return -EINVAL; | ||
178 | mutex_lock(&chip->mutex); | 196 | mutex_lock(&chip->mutex); |
179 | changed = value->value.enumerated.item[0] != chip->dac_routing; | 197 | changed = value->value.enumerated.item[0] != chip->dac_routing; |
180 | if (changed) { | 198 | if (changed) { |
181 | chip->dac_routing = min(value->value.enumerated.item[0], | 199 | chip->dac_routing = value->value.enumerated.item[0]; |
182 | count - 1); | ||
183 | spin_lock_irq(&chip->reg_lock); | ||
184 | oxygen_update_dac_routing(chip); | 200 | oxygen_update_dac_routing(chip); |
185 | spin_unlock_irq(&chip->reg_lock); | ||
186 | } | 201 | } |
187 | mutex_unlock(&chip->mutex); | 202 | mutex_unlock(&chip->mutex); |
188 | return changed; | 203 | return changed; |
@@ -790,7 +805,7 @@ static const struct { | |||
790 | .controls = { | 805 | .controls = { |
791 | { | 806 | { |
792 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 807 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
793 | .name = "Analog Input Monitor Switch", | 808 | .name = "Analog Input Monitor Playback Switch", |
794 | .info = snd_ctl_boolean_mono_info, | 809 | .info = snd_ctl_boolean_mono_info, |
795 | .get = monitor_get, | 810 | .get = monitor_get, |
796 | .put = monitor_put, | 811 | .put = monitor_put, |
@@ -798,7 +813,7 @@ static const struct { | |||
798 | }, | 813 | }, |
799 | { | 814 | { |
800 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 815 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
801 | .name = "Analog Input Monitor Volume", | 816 | .name = "Analog Input Monitor Playback Volume", |
802 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | | 817 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | |
803 | SNDRV_CTL_ELEM_ACCESS_TLV_READ, | 818 | SNDRV_CTL_ELEM_ACCESS_TLV_READ, |
804 | .info = monitor_volume_info, | 819 | .info = monitor_volume_info, |
@@ -815,7 +830,7 @@ static const struct { | |||
815 | .controls = { | 830 | .controls = { |
816 | { | 831 | { |
817 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 832 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
818 | .name = "Analog Input Monitor Switch", | 833 | .name = "Analog Input Monitor Playback Switch", |
819 | .info = snd_ctl_boolean_mono_info, | 834 | .info = snd_ctl_boolean_mono_info, |
820 | .get = monitor_get, | 835 | .get = monitor_get, |
821 | .put = monitor_put, | 836 | .put = monitor_put, |
@@ -823,7 +838,7 @@ static const struct { | |||
823 | }, | 838 | }, |
824 | { | 839 | { |
825 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 840 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
826 | .name = "Analog Input Monitor Volume", | 841 | .name = "Analog Input Monitor Playback Volume", |
827 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | | 842 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | |
828 | SNDRV_CTL_ELEM_ACCESS_TLV_READ, | 843 | SNDRV_CTL_ELEM_ACCESS_TLV_READ, |
829 | .info = monitor_volume_info, | 844 | .info = monitor_volume_info, |
@@ -840,7 +855,7 @@ static const struct { | |||
840 | .controls = { | 855 | .controls = { |
841 | { | 856 | { |
842 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 857 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
843 | .name = "Analog Input Monitor Switch", | 858 | .name = "Analog Input Monitor Playback Switch", |
844 | .index = 1, | 859 | .index = 1, |
845 | .info = snd_ctl_boolean_mono_info, | 860 | .info = snd_ctl_boolean_mono_info, |
846 | .get = monitor_get, | 861 | .get = monitor_get, |
@@ -849,7 +864,7 @@ static const struct { | |||
849 | }, | 864 | }, |
850 | { | 865 | { |
851 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 866 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
852 | .name = "Analog Input Monitor Volume", | 867 | .name = "Analog Input Monitor Playback Volume", |
853 | .index = 1, | 868 | .index = 1, |
854 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | | 869 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | |
855 | SNDRV_CTL_ELEM_ACCESS_TLV_READ, | 870 | SNDRV_CTL_ELEM_ACCESS_TLV_READ, |
@@ -867,7 +882,7 @@ static const struct { | |||
867 | .controls = { | 882 | .controls = { |
868 | { | 883 | { |
869 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 884 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
870 | .name = "Digital Input Monitor Switch", | 885 | .name = "Digital Input Monitor Playback Switch", |
871 | .info = snd_ctl_boolean_mono_info, | 886 | .info = snd_ctl_boolean_mono_info, |
872 | .get = monitor_get, | 887 | .get = monitor_get, |
873 | .put = monitor_put, | 888 | .put = monitor_put, |
@@ -875,7 +890,7 @@ static const struct { | |||
875 | }, | 890 | }, |
876 | { | 891 | { |
877 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 892 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
878 | .name = "Digital Input Monitor Volume", | 893 | .name = "Digital Input Monitor Playback Volume", |
879 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | | 894 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | |
880 | SNDRV_CTL_ELEM_ACCESS_TLV_READ, | 895 | SNDRV_CTL_ELEM_ACCESS_TLV_READ, |
881 | .info = monitor_volume_info, | 896 | .info = monitor_volume_info, |
@@ -954,6 +969,9 @@ static int add_controls(struct oxygen *chip, | |||
954 | if (err == 1) | 969 | if (err == 1) |
955 | continue; | 970 | continue; |
956 | } | 971 | } |
972 | if (!strcmp(template.name, "Stereo Upmixing") && | ||
973 | chip->model.dac_channels == 2) | ||
974 | continue; | ||
957 | if (!strcmp(template.name, "Master Playback Volume") && | 975 | if (!strcmp(template.name, "Master Playback Volume") && |
958 | chip->model.dac_tlv) { | 976 | chip->model.dac_tlv) { |
959 | template.tlv.p = chip->model.dac_tlv; | 977 | template.tlv.p = chip->model.dac_tlv; |