aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/oxygen/oxygen.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/oxygen.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/oxygen.c')
-rw-r--r--sound/pci/oxygen/oxygen.c14
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 @@
29 */ 29 */
30 30
31#include <linux/pci.h> 31#include <linux/pci.h>
32#include <sound/control.h>
32#include <sound/core.h> 33#include <sound/core.h>
33#include <sound/initval.h> 34#include <sound/initval.h>
34#include <sound/pcm.h> 35#include <sound/pcm.h>
@@ -244,18 +245,27 @@ static void set_ak5385_params(struct oxygen *chip,
244 245
245static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0); 246static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0);
246 247
248static int ak4396_control_filter(struct snd_kcontrol_new *template)
249{
250 if (!strcmp(template->name, "Master Playback Volume")) {
251 template->access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ;
252 template->tlv.p = ak4396_db_scale;
253 }
254 return 0;
255}
256
247static const struct oxygen_model model_generic = { 257static const struct oxygen_model model_generic = {
248 .shortname = "C-Media CMI8788", 258 .shortname = "C-Media CMI8788",
249 .longname = "C-Media Oxygen HD Audio", 259 .longname = "C-Media Oxygen HD Audio",
250 .chip = "CMI8788", 260 .chip = "CMI8788",
251 .owner = THIS_MODULE, 261 .owner = THIS_MODULE,
252 .init = generic_init, 262 .init = generic_init,
263 .control_filter = ak4396_control_filter,
253 .cleanup = generic_cleanup, 264 .cleanup = generic_cleanup,
254 .set_dac_params = set_ak4396_params, 265 .set_dac_params = set_ak4396_params,
255 .set_adc_params = set_wm8785_params, 266 .set_adc_params = set_wm8785_params,
256 .update_dac_volume = update_ak4396_volume, 267 .update_dac_volume = update_ak4396_volume,
257 .update_dac_mute = update_ak4396_mute, 268 .update_dac_mute = update_ak4396_mute,
258 .dac_tlv = ak4396_db_scale,
259 .used_channels = OXYGEN_CHANNEL_A | 269 .used_channels = OXYGEN_CHANNEL_A |
260 OXYGEN_CHANNEL_C | 270 OXYGEN_CHANNEL_C |
261 OXYGEN_CHANNEL_SPDIF | 271 OXYGEN_CHANNEL_SPDIF |
@@ -269,12 +279,12 @@ static const struct oxygen_model model_meridian = {
269 .chip = "CMI8788", 279 .chip = "CMI8788",
270 .owner = THIS_MODULE, 280 .owner = THIS_MODULE,
271 .init = meridian_init, 281 .init = meridian_init,
282 .control_filter = ak4396_control_filter,
272 .cleanup = generic_cleanup, 283 .cleanup = generic_cleanup,
273 .set_dac_params = set_ak4396_params, 284 .set_dac_params = set_ak4396_params,
274 .set_adc_params = set_ak5385_params, 285 .set_adc_params = set_ak5385_params,
275 .update_dac_volume = update_ak4396_volume, 286 .update_dac_volume = update_ak4396_volume,
276 .update_dac_mute = update_ak4396_mute, 287 .update_dac_mute = update_ak4396_mute,
277 .dac_tlv = ak4396_db_scale,
278 .used_channels = OXYGEN_CHANNEL_B | 288 .used_channels = OXYGEN_CHANNEL_B |
279 OXYGEN_CHANNEL_C | 289 OXYGEN_CHANNEL_C |
280 OXYGEN_CHANNEL_SPDIF | 290 OXYGEN_CHANNEL_SPDIF |