ALSA: snd-usb: Playback Design: use usb_set_inferface quirk from more locations
authorDaniel Mack <zonque@gmail.com>
Tue, 9 Apr 2013 16:56:03 +0000 (00:56 +0800)
committerTakashi Iwai <tiwai@suse.de>
Wed, 10 Apr 2013 07:21:43 +0000 (09:21 +0200)
It turns out the devices from Playback Design need the delay quirk
after usb_set_interface from clocks.c as well. Make it a proper
quirks function and factor out the code to quirks.c.

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

index ae35e7d22e736faf1baab0aa22539c74cf69dabb..b0ec3643eb62906abedd192a4eaad35b90a898c8 100644 (file)
@@ -32,6 +32,7 @@
 #include "card.h"
 #include "helper.h"
 #include "clock.h"
+#include "quirks.h"
 
 static struct uac_clock_source_descriptor *
        snd_usb_find_clock_source(struct usb_host_interface *ctrl_iface,
@@ -392,7 +393,9 @@ static int set_sample_rate_v2(struct snd_usb_audio *chip, int iface,
         * interface is active. */
        if (rate != prev_rate) {
                usb_set_interface(dev, iface, 0);
+               snd_usb_set_interface_quirk(dev);
                usb_set_interface(dev, iface, fmt->altsetting);
+               snd_usb_set_interface_quirk(dev);
        }
 
        return 0;
index 754cb5bb1f796a60d142725a6a4704e5aede1319..815a37d2e3e0a7747627d1362f2d1044829999ad 100644 (file)
@@ -349,12 +349,7 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
                subs->interface = fmt->iface;
                subs->altset_idx = fmt->altset_idx;
 
-               /*
-                * "Playback Design" products need a 50ms delay after setting the
-                * USB interface.
-                */
-               if (le16_to_cpu(dev->descriptor.idVendor) == 0x23ba)
-                       mdelay(50);
+               snd_usb_set_interface_quirk(dev);
        }
 
        subs->data_endpoint = snd_usb_add_endpoint(subs->stream->chip,
index a2ac004bbd9a3bd689e047d61cc8937407b0e1b7..292798185afc76db2c812ab796afd857ab8d5c62 100644 (file)
@@ -892,6 +892,16 @@ void snd_usb_endpoint_start_quirk(struct snd_usb_endpoint *ep)
                ep->skip_packets = 16;
 }
 
+void snd_usb_set_interface_quirk(struct usb_device *dev)
+{
+       /*
+        * "Playback Design" products need a 50ms delay after setting the
+        * USB interface.
+        */
+       if (le16_to_cpu(dev->descriptor.idVendor) == 0x23ba)
+               mdelay(50);
+}
+
 void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe,
                           __u8 request, __u8 requesttype, __u16 value,
                           __u16 index, void *data, __u16 size)
index 0ca9e91067a664e6544f22161cf026c118469860..7c3681fd1c3cdce22acb9190b310803a28f72cb3 100644 (file)
@@ -26,6 +26,7 @@ int snd_usb_is_big_endian_format(struct snd_usb_audio *chip,
 
 void snd_usb_endpoint_start_quirk(struct snd_usb_endpoint *ep);
 
+void snd_usb_set_interface_quirk(struct usb_device *dev);
 void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe,
                           __u8 request, __u8 requesttype, __u16 value,
                           __u16 index, void *data, __u16 size);