aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/oxygen/virtuoso.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2008-01-16 02:32:08 -0500
committerJaroslav Kysela <perex@perex.cz>2008-01-31 11:30:00 -0500
commitccc80fb467a88ceb7ce1b68546632b91e5ba6c18 (patch)
tree097f13a250fa155faeacc1fb127a000cc19ebbb6 /sound/pci/oxygen/virtuoso.c
parente85e09250ab552fab6925bcde7c77746101b2d40 (diff)
[ALSA] oxygen: add control filter to model struct
Allow the models to modify mixer controls before they are added to the card. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci/oxygen/virtuoso.c')
-rw-r--r--sound/pci/oxygen/virtuoso.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c
index 0574fa19dca6..bea34f10d447 100644
--- a/sound/pci/oxygen/virtuoso.c
+++ b/sound/pci/oxygen/virtuoso.c
@@ -32,6 +32,8 @@
32 32
33#include <linux/pci.h> 33#include <linux/pci.h>
34#include <linux/delay.h> 34#include <linux/delay.h>
35#include <linux/mutex.h>
36#include <sound/ac97_codec.h>
35#include <sound/control.h> 37#include <sound/control.h>
36#include <sound/core.h> 38#include <sound/core.h>
37#include <sound/initval.h> 39#include <sound/initval.h>
@@ -167,6 +169,16 @@ static void set_cs5381_params(struct oxygen *chip,
167 oxygen_write16_masked(chip, OXYGEN_GPIO_DATA, value, 0x000c); 169 oxygen_write16_masked(chip, OXYGEN_GPIO_DATA, value, 0x000c);
168} 170}
169 171
172static int pcm1796_volume_info(struct snd_kcontrol *ctl,
173 struct snd_ctl_elem_info *info)
174{
175 info->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
176 info->count = 8;
177 info->value.integer.min = 0x0f;
178 info->value.integer.max = 0xff;
179 return 0;
180}
181
170static int alt_switch_get(struct snd_kcontrol *ctl, 182static int alt_switch_get(struct snd_kcontrol *ctl,
171 struct snd_ctl_elem_value *value) 183 struct snd_ctl_elem_value *value)
172{ 184{
@@ -207,6 +219,18 @@ static const struct snd_kcontrol_new alt_switch = {
207 219
208static const DECLARE_TLV_DB_SCALE(pcm1796_db_scale, -12000, 50, 0); 220static const DECLARE_TLV_DB_SCALE(pcm1796_db_scale, -12000, 50, 0);
209 221
222static int xonar_control_filter(struct snd_kcontrol_new *template)
223{
224 if (!strcmp(template->name, "Master Playback Volume")) {
225 template->access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ;
226 template->info = pcm1796_volume_info,
227 template->tlv.p = pcm1796_db_scale;
228 } else if (!strncmp(template->name, "CD Capture ", 11)) {
229 template->private_value ^= AC97_CD ^ AC97_VIDEO;
230 }
231 return 0;
232}
233
210static int xonar_mixer_init(struct oxygen *chip) 234static int xonar_mixer_init(struct oxygen *chip)
211{ 235{
212 return snd_ctl_add(chip->card, snd_ctl_new1(&alt_switch, chip)); 236 return snd_ctl_add(chip->card, snd_ctl_new1(&alt_switch, chip));
@@ -217,19 +241,17 @@ static const struct oxygen_model model_xonar = {
217 .longname = "Asus Virtuoso 200", 241 .longname = "Asus Virtuoso 200",
218 .chip = "AV200", 242 .chip = "AV200",
219 .init = xonar_init, 243 .init = xonar_init,
244 .control_filter = xonar_control_filter,
220 .mixer_init = xonar_mixer_init, 245 .mixer_init = xonar_mixer_init,
221 .cleanup = xonar_cleanup, 246 .cleanup = xonar_cleanup,
222 .set_dac_params = set_pcm1796_params, 247 .set_dac_params = set_pcm1796_params,
223 .set_adc_params = set_cs5381_params, 248 .set_adc_params = set_cs5381_params,
224 .update_dac_volume = update_pcm1796_volume, 249 .update_dac_volume = update_pcm1796_volume,
225 .update_dac_mute = update_pcm1796_mute, 250 .update_dac_mute = update_pcm1796_mute,
226 .dac_tlv = pcm1796_db_scale,
227 .used_channels = OXYGEN_CHANNEL_B | 251 .used_channels = OXYGEN_CHANNEL_B |
228 OXYGEN_CHANNEL_C | 252 OXYGEN_CHANNEL_C |
229 OXYGEN_CHANNEL_SPDIF | 253 OXYGEN_CHANNEL_SPDIF |
230 OXYGEN_CHANNEL_MULTICH, 254 OXYGEN_CHANNEL_MULTICH,
231 .cd_in_from_video_in = 1,
232 .dac_minimum_volume = 15,
233 .function_flags = OXYGEN_FUNCTION_ENABLE_SPI_4_5, 255 .function_flags = OXYGEN_FUNCTION_ENABLE_SPI_4_5,
234}; 256};
235 257