diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2008-01-16 02:32:08 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-01-31 11:30:00 -0500 |
commit | ccc80fb467a88ceb7ce1b68546632b91e5ba6c18 (patch) | |
tree | 097f13a250fa155faeacc1fb127a000cc19ebbb6 /sound/pci/oxygen/oxygen_mixer.c | |
parent | e85e09250ab552fab6925bcde7c77746101b2d40 (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_mixer.c')
-rw-r--r-- | sound/pci/oxygen/oxygen_mixer.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/sound/pci/oxygen/oxygen_mixer.c b/sound/pci/oxygen/oxygen_mixer.c index 8b08e6d02cc9..fae7c0f060a0 100644 --- a/sound/pci/oxygen/oxygen_mixer.c +++ b/sound/pci/oxygen/oxygen_mixer.c | |||
@@ -27,11 +27,9 @@ | |||
27 | static int dac_volume_info(struct snd_kcontrol *ctl, | 27 | static int dac_volume_info(struct snd_kcontrol *ctl, |
28 | struct snd_ctl_elem_info *info) | 28 | struct snd_ctl_elem_info *info) |
29 | { | 29 | { |
30 | struct oxygen *chip = ctl->private_data; | ||
31 | |||
32 | info->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 30 | info->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
33 | info->count = 8; | 31 | info->count = 8; |
34 | info->value.integer.min = chip->model->dac_minimum_volume; | 32 | info->value.integer.min = 0; |
35 | info->value.integer.max = 0xff; | 33 | info->value.integer.max = 0xff; |
36 | return 0; | 34 | return 0; |
37 | } | 35 | } |
@@ -525,14 +523,10 @@ static const struct snd_kcontrol_new controls[] = { | |||
525 | { | 523 | { |
526 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 524 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
527 | .name = "Master Playback Volume", | 525 | .name = "Master Playback Volume", |
528 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | | 526 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, |
529 | SNDRV_CTL_ELEM_ACCESS_TLV_READ, | ||
530 | .info = dac_volume_info, | 527 | .info = dac_volume_info, |
531 | .get = dac_volume_get, | 528 | .get = dac_volume_get, |
532 | .put = dac_volume_put, | 529 | .put = dac_volume_put, |
533 | .tlv = { | ||
534 | .p = NULL, /* set later */ | ||
535 | }, | ||
536 | }, | 530 | }, |
537 | { | 531 | { |
538 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 532 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
@@ -635,18 +629,18 @@ static int add_controls(struct oxygen *chip, | |||
635 | [CONTROL_AUX_CAPTURE_SWITCH] = "Aux Capture Switch", | 629 | [CONTROL_AUX_CAPTURE_SWITCH] = "Aux Capture Switch", |
636 | }; | 630 | }; |
637 | unsigned int i, j; | 631 | unsigned int i, j; |
632 | struct snd_kcontrol_new template; | ||
638 | struct snd_kcontrol *ctl; | 633 | struct snd_kcontrol *ctl; |
639 | int err; | 634 | int err; |
640 | 635 | ||
641 | for (i = 0; i < count; ++i) { | 636 | for (i = 0; i < count; ++i) { |
637 | template = controls[i]; | ||
638 | err = chip->model->control_filter(&template); | ||
639 | if (err < 0) | ||
640 | return err; | ||
642 | ctl = snd_ctl_new1(&controls[i], chip); | 641 | ctl = snd_ctl_new1(&controls[i], chip); |
643 | if (!ctl) | 642 | if (!ctl) |
644 | return -ENOMEM; | 643 | return -ENOMEM; |
645 | if (!strcmp(ctl->id.name, "Master Playback Volume")) | ||
646 | ctl->tlv.p = chip->model->dac_tlv; | ||
647 | else if (chip->model->cd_in_from_video_in && | ||
648 | !strncmp(ctl->id.name, "CD Capture ", 11)) | ||
649 | ctl->private_value ^= AC97_CD ^ AC97_VIDEO; | ||
650 | err = snd_ctl_add(chip->card, ctl); | 644 | err = snd_ctl_add(chip->card, ctl); |
651 | if (err < 0) | 645 | if (err < 0) |
652 | return err; | 646 | return err; |