aboutsummaryrefslogtreecommitdiff
path: root/sound/pci/oxygen/virtuoso.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2008-01-16 08:32:08 +0100
committerJaroslav Kysela <perex@perex.cz>2008-01-31 17:30:00 +0100
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 0574fa19dca..bea34f10d44 100644
--- a/sound/pci/oxygen/virtuoso.c
+++ b/sound/pci/oxygen/virtuoso.c
@@ -32,6 +32,8 @@
#include <linux/pci.h>
#include <linux/delay.h>
+#include <linux/mutex.h>
+#include <sound/ac97_codec.h>
#include <sound/control.h>
#include <sound/core.h>
#include <sound/initval.h>
@@ -167,6 +169,16 @@ static void set_cs5381_params(struct oxygen *chip,
oxygen_write16_masked(chip, OXYGEN_GPIO_DATA, value, 0x000c);
}
+static int pcm1796_volume_info(struct snd_kcontrol *ctl,
+ struct snd_ctl_elem_info *info)
+{
+ info->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
+ info->count = 8;
+ info->value.integer.min = 0x0f;
+ info->value.integer.max = 0xff;
+ return 0;
+}
+
static int alt_switch_get(struct snd_kcontrol *ctl,
struct snd_ctl_elem_value *value)
{
@@ -207,6 +219,18 @@ static const struct snd_kcontrol_new alt_switch = {
static const DECLARE_TLV_DB_SCALE(pcm1796_db_scale, -12000, 50, 0);
+static int xonar_control_filter(struct snd_kcontrol_new *template)
+{
+ if (!strcmp(template->name, "Master Playback Volume")) {
+ template->access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ;
+ template->info = pcm1796_volume_info,
+ template->tlv.p = pcm1796_db_scale;
+ } else if (!strncmp(template->name, "CD Capture ", 11)) {
+ template->private_value ^= AC97_CD ^ AC97_VIDEO;
+ }
+ return 0;
+}
+
static int xonar_mixer_init(struct oxygen *chip)
{
return snd_ctl_add(chip->card, snd_ctl_new1(&alt_switch, chip));
@@ -217,19 +241,17 @@ static const struct oxygen_model model_xonar = {
.longname = "Asus Virtuoso 200",
.chip = "AV200",
.init = xonar_init,
+ .control_filter = xonar_control_filter,
.mixer_init = xonar_mixer_init,
.cleanup = xonar_cleanup,
.set_dac_params = set_pcm1796_params,
.set_adc_params = set_cs5381_params,
.update_dac_volume = update_pcm1796_volume,
.update_dac_mute = update_pcm1796_mute,
- .dac_tlv = pcm1796_db_scale,
.used_channels = OXYGEN_CHANNEL_B |
OXYGEN_CHANNEL_C |
OXYGEN_CHANNEL_SPDIF |
OXYGEN_CHANNEL_MULTICH,
- .cd_in_from_video_in = 1,
- .dac_minimum_volume = 15,
.function_flags = OXYGEN_FUNCTION_ENABLE_SPI_4_5,
};