]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ALSA: oxygen: do not create useless S/PDIF controls
authorClemens Ladisch <clemens@ladisch.de>
Fri, 16 Jan 2015 21:14:18 +0000 (22:14 +0100)
committerTakashi Iwai <tiwai@suse.de>
Fri, 16 Jan 2015 21:43:50 +0000 (22:43 +0100)
Cards without S/PDIF output do not need those controls.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/oxygen/oxygen_mixer.c

index 5988e044c5194e0650ab78c2ec4cf1eff069f8d0..2f698a9a504472d6499b0b22f93bcdb213fdce01 100644 (file)
@@ -786,6 +786,9 @@ static const struct snd_kcontrol_new controls[] = {
                .get = upmix_get,
                .put = upmix_put,
        },
+};
+
+static const struct snd_kcontrol_new spdif_output_controls[] = {
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
                .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, SWITCH),
@@ -1073,6 +1076,12 @@ int oxygen_mixer_init(struct oxygen *chip)
        err = add_controls(chip, controls, ARRAY_SIZE(controls));
        if (err < 0)
                return err;
+       if (chip->model.device_config & PLAYBACK_1_TO_SPDIF) {
+               err = add_controls(chip, spdif_output_controls,
+                                  ARRAY_SIZE(spdif_output_controls));
+               if (err < 0)
+                       return err;
+       }
        if (chip->model.device_config & CAPTURE_1_FROM_SPDIF) {
                err = add_controls(chip, spdif_input_controls,
                                   ARRAY_SIZE(spdif_input_controls));