All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: snd-usb: Playback Design: use usb_set_inferface quirk from more locations
@ 2013-04-09 16:56 Daniel Mack
  2013-04-10  7:23 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Mack @ 2013-04-09 16:56 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, clemens, Daniel Mack

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>
---
 sound/usb/clock.c  |    3 +++
 sound/usb/pcm.c    |    7 +------
 sound/usb/quirks.c |   10 ++++++++++
 sound/usb/quirks.h |    1 +
 4 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/sound/usb/clock.c b/sound/usb/clock.c
index ae35e7d..b0ec364 100644
--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -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;
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index 754cb5b..815a37d 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -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,
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 7882a82..551ae1a 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -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)
diff --git a/sound/usb/quirks.h b/sound/usb/quirks.h
index f10d00e..665e972 100644
--- a/sound/usb/quirks.h
+++ b/sound/usb/quirks.h
@@ -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);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ALSA: snd-usb: Playback Design: use usb_set_inferface quirk from more locations
  2013-04-09 16:56 [PATCH] ALSA: snd-usb: Playback Design: use usb_set_inferface quirk from more locations Daniel Mack
@ 2013-04-10  7:23 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2013-04-10  7:23 UTC (permalink / raw)
  To: Daniel Mack; +Cc: alsa-devel, clemens

At Wed, 10 Apr 2013 00:56:03 +0800,
Daniel Mack wrote:
> 
> 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>

Thanks, applied.


Takashi

> ---
>  sound/usb/clock.c  |    3 +++
>  sound/usb/pcm.c    |    7 +------
>  sound/usb/quirks.c |   10 ++++++++++
>  sound/usb/quirks.h |    1 +
>  4 files changed, 15 insertions(+), 6 deletions(-)
> 
> diff --git a/sound/usb/clock.c b/sound/usb/clock.c
> index ae35e7d..b0ec364 100644
> --- a/sound/usb/clock.c
> +++ b/sound/usb/clock.c
> @@ -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;
> diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
> index 754cb5b..815a37d 100644
> --- a/sound/usb/pcm.c
> +++ b/sound/usb/pcm.c
> @@ -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,
> diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
> index 7882a82..551ae1a 100644
> --- a/sound/usb/quirks.c
> +++ b/sound/usb/quirks.c
> @@ -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)
> diff --git a/sound/usb/quirks.h b/sound/usb/quirks.h
> index f10d00e..665e972 100644
> --- a/sound/usb/quirks.h
> +++ b/sound/usb/quirks.h
> @@ -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);
> -- 
> 1.7.10.4
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-10  7:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-09 16:56 [PATCH] ALSA: snd-usb: Playback Design: use usb_set_inferface quirk from more locations Daniel Mack
2013-04-10  7:23 ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.