diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2008-01-16 08:32:08 +0100 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-01-31 17:30:00 +0100 |
commit | ccc80fb467a88ceb7ce1b68546632b91e5ba6c18 (patch) | |
tree | 097f13a250fa155faeacc1fb127a000cc19ebbb6 /sound/pci/oxygen/oxygen.c | |
parent | e85e09250ab552fab6925bcde7c77746101b2d40 (diff) | |
download | blackbird-op-linux-ccc80fb467a88ceb7ce1b68546632b91e5ba6c18.tar.gz blackbird-op-linux-ccc80fb467a88ceb7ce1b68546632b91e5ba6c18.zip |
[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/oxygen.c')
-rw-r--r-- | sound/pci/oxygen/oxygen.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c index e2dda16d5dcc..adf91cc3e1ae 100644 --- a/sound/pci/oxygen/oxygen.c +++ b/sound/pci/oxygen/oxygen.c @@ -29,6 +29,7 @@ */ #include <linux/pci.h> +#include <sound/control.h> #include <sound/core.h> #include <sound/initval.h> #include <sound/pcm.h> @@ -244,18 +245,27 @@ static void set_ak5385_params(struct oxygen *chip, static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0); +static int ak4396_control_filter(struct snd_kcontrol_new *template) +{ + if (!strcmp(template->name, "Master Playback Volume")) { + template->access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ; + template->tlv.p = ak4396_db_scale; + } + return 0; +} + static const struct oxygen_model model_generic = { .shortname = "C-Media CMI8788", .longname = "C-Media Oxygen HD Audio", .chip = "CMI8788", .owner = THIS_MODULE, .init = generic_init, + .control_filter = ak4396_control_filter, .cleanup = generic_cleanup, .set_dac_params = set_ak4396_params, .set_adc_params = set_wm8785_params, .update_dac_volume = update_ak4396_volume, .update_dac_mute = update_ak4396_mute, - .dac_tlv = ak4396_db_scale, .used_channels = OXYGEN_CHANNEL_A | OXYGEN_CHANNEL_C | OXYGEN_CHANNEL_SPDIF | @@ -269,12 +279,12 @@ static const struct oxygen_model model_meridian = { .chip = "CMI8788", .owner = THIS_MODULE, .init = meridian_init, + .control_filter = ak4396_control_filter, .cleanup = generic_cleanup, .set_dac_params = set_ak4396_params, .set_adc_params = set_ak5385_params, .update_dac_volume = update_ak4396_volume, .update_dac_mute = update_ak4396_mute, - .dac_tlv = ak4396_db_scale, .used_channels = OXYGEN_CHANNEL_B | OXYGEN_CHANNEL_C | OXYGEN_CHANNEL_SPDIF | |