diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-12-02 09:31:16 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-12-02 09:31:16 +0100 |
commit | 16950e09cf07b54abb78dd09f8ef3c85c6bdc9de (patch) | |
tree | f02b650550c1d0bd4c05c55a57714a0bf8ed63c6 /sound/pci | |
parent | 13d428afc007fcfcd6deeb215618f54cf9c0cae6 (diff) | |
download | linux-16950e09cf07b54abb78dd09f8ef3c85c6bdc9de.tar.gz linux-16950e09cf07b54abb78dd09f8ef3c85c6bdc9de.tar.bz2 linux-16950e09cf07b54abb78dd09f8ef3c85c6bdc9de.zip |
ALSA: emu10k1 - Add capture boost mixer switch for Audigy
Due to the conversion (drop) from 24bit in the DSP to 16bit in AC97,
the maximum capture level on Audigy seems lower than it could be.
This patch adds a workaround to enable the artificial capture boost
switch. When this switch is on, the whole analog capature level is
boost up. However, this results in the lower capture resolution.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/emu10k1/emumixer.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c index f34bbfb705f5..b0fb6c917c38 100644 --- a/sound/pci/emu10k1/emumixer.c +++ b/sound/pci/emu10k1/emumixer.c @@ -1639,6 +1639,45 @@ static struct snd_kcontrol_new snd_audigy_shared_spdif __devinitdata = .put = snd_emu10k1_shared_spdif_put }; +/* workaround for too low volume on Audigy due to 16bit/24bit conversion */ + +#define snd_audigy_capture_boost_info snd_ctl_boolean_mono_info + +static int snd_audigy_capture_boost_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); + unsigned int val; + + /* FIXME: better to use a cached version */ + val = snd_ac97_read(emu->ac97, AC97_REC_GAIN); + ucontrol->value.integer.value[0] = !!val; + return 0; +} + +static int snd_audigy_capture_boost_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); + unsigned int val; + + if (ucontrol->value.integer.value[0]) + val = 0x0f0f; + else + val = 0; + return snd_ac97_update(emu->ac97, AC97_REC_GAIN, val); +} + +static struct snd_kcontrol_new snd_audigy_capture_boost __devinitdata = +{ + .iface = SNDRV_CTL_ELEM_IFACE_MIXER, + .name = "Analog Capture Boost", + .info = snd_audigy_capture_boost_info, + .get = snd_audigy_capture_boost_get, + .put = snd_audigy_capture_boost_put +}; + + /* */ static void snd_emu10k1_mixer_free_ac97(struct snd_ac97 *ac97) @@ -2087,5 +2126,12 @@ int __devinit snd_emu10k1_mixer(struct snd_emu10k1 *emu, } } + if (emu->card_capabilities->ac97_chip && emu->audigy) { + err = snd_ctl_add(card, snd_ctl_new1(&snd_audigy_capture_boost, + emu)); + if (err < 0) + return err; + } + return 0; } |