]> err.no Git - linux-2.6/blobdiff - sound/pci/oxygen/oxygen_mixer.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
[linux-2.6] / sound / pci / oxygen / oxygen_mixer.c
index d0bef09a6999bfa2cbce9aece2be6b60da1df857..6facac5aed90b3cddcb26bdf444098d84b5e09ad 100644 (file)
@@ -32,8 +32,8 @@ static int dac_volume_info(struct snd_kcontrol *ctl,
 
        info->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
        info->count = chip->model->dac_channels;
-       info->value.integer.min = 0;
-       info->value.integer.max = 0xff;
+       info->value.integer.min = chip->model->dac_volume_min;
+       info->value.integer.max = chip->model->dac_volume_max;
        return 0;
 }
 
@@ -742,6 +742,9 @@ static const struct snd_kcontrol_new controls[] = {
                .get = spdif_pcm_get,
                .put = spdif_pcm_put,
        },
+};
+
+static const struct snd_kcontrol_new spdif_input_controls[] = {
        {
                .iface = SNDRV_CTL_ELEM_IFACE_PCM,
                .device = 1,
@@ -933,11 +936,18 @@ static int add_controls(struct oxygen *chip,
 
        for (i = 0; i < count; ++i) {
                template = controls[i];
-               err = chip->model->control_filter(&template);
-               if (err < 0)
-                       return err;
-               if (err == 1)
-                       continue;
+               if (chip->model->control_filter) {
+                       err = chip->model->control_filter(&template);
+                       if (err < 0)
+                               return err;
+                       if (err == 1)
+                               continue;
+               }
+               if (!strcmp(template.name, "Master Playback Volume") &&
+                   chip->model->dac_tlv) {
+                       template.tlv.p = chip->model->dac_tlv;
+                       template.access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ;
+               }
                ctl = snd_ctl_new1(&template, chip);
                if (!ctl)
                        return -ENOMEM;
@@ -961,6 +971,12 @@ int oxygen_mixer_init(struct oxygen *chip)
        err = add_controls(chip, controls, ARRAY_SIZE(controls));
        if (err < 0)
                return err;
+       if (chip->model->pcm_dev_cfg & CAPTURE_1_FROM_SPDIF) {
+               err = add_controls(chip, spdif_input_controls,
+                                  ARRAY_SIZE(spdif_input_controls));
+               if (err < 0)
+                       return err;
+       }
        for (i = 0; i < ARRAY_SIZE(monitor_controls); ++i) {
                if (!(chip->model->pcm_dev_cfg & monitor_controls[i].pcm_dev))
                        continue;