ALSA: usb-audio: add new quirk type QUIRK_AUDIO_STANDARD_MIXER
authorDaniel Mack <zonque@gmail.com>
Wed, 25 May 2011 07:09:02 +0000 (09:09 +0200)
committerTakashi Iwai <tiwai@suse.de>
Wed, 25 May 2011 07:36:59 +0000 (09:36 +0200)
This quirk type will let the driver assume that there is a standard
mixer on a given interface, or that a specific mixer quirks will handle
the device.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/quirks.c
sound/usb/usbaudio.h

index 2546dc808e43b0e4ca682b46b96145c1c7952c84..2e969cbb393b004af02d37419fccb080ce99e9d6 100644 (file)
@@ -263,6 +263,20 @@ static int create_uaxx_quirk(struct snd_usb_audio *chip,
        return 0;
 }
 
+/*
+ * Create a standard mixer for the specified interface.
+ */
+static int create_standard_mixer_quirk(struct snd_usb_audio *chip,
+                                      struct usb_interface *iface,
+                                      struct usb_driver *driver,
+                                      const struct snd_usb_audio_quirk *quirk)
+{
+       if (quirk->ifnum < 0)
+               return 0;
+
+       return snd_usb_create_mixer(chip, quirk->ifnum, 0);
+}
+
 /*
  * audio-interface quirks
  *
@@ -295,7 +309,8 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip,
                [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk,
                [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk,
                [QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk,
-               [QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk
+               [QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk,
+               [QUIRK_AUDIO_STANDARD_MIXER] = create_standard_mixer_quirk,
        };
 
        if (quirk->type < QUIRK_TYPE_COUNT) {
index 32f2a97f2f14f7494d07d5c4e84f1230aa283797..1e79986b577749ca0ebea31aa7b5c7c46ac750b1 100644 (file)
@@ -84,6 +84,7 @@ enum quirk_type {
        QUIRK_AUDIO_FIXED_ENDPOINT,
        QUIRK_AUDIO_EDIROL_UAXX,
        QUIRK_AUDIO_ALIGN_TRANSFER,
+       QUIRK_AUDIO_STANDARD_MIXER,
 
        QUIRK_TYPE_COUNT
 };