All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: usb: use multiple packets per urb for Wireless USB inbound audio
@ 2013-11-26 19:58 Thomas Pugliese
  2013-11-27 10:56 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Pugliese @ 2013-11-26 19:58 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, Thomas Pugliese

For Wireless USB audio devices, use multiple isoc packets per URB for
inbound endpoints with a datainterval < 5.  This allows the WUSB host
controller to take advantage of bursting to service endpoints whose
logical polling interval is less than the 4ms minimum polling interval
limit in WUSB.

Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
---
 sound/usb/endpoint.c |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index b9ba0fc..83aabea2 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -636,8 +636,22 @@ static int data_ep_set_params(struct snd_usb_endpoint *ep,
 	if (usb_pipein(ep->pipe) ||
 			snd_usb_endpoint_implicit_feedback_sink(ep)) {
 
+		urb_packs = packs_per_ms;
+		/*
+		 * Wireless devices can poll at a max rate of once per 4ms.
+		 * For dataintervals less than 5, increase the packet count to
+		 * allow the host controller to use bursting to fill in the
+		 * gaps.
+		 */
+		if (snd_usb_get_speed(ep->chip->dev) == USB_SPEED_WIRELESS) {
+			int interval = ep->datainterval;
+			while (interval < 5) {
+				urb_packs <<= 1;
+				++interval;
+			}
+		}
 		/* make capture URBs <= 1 ms and smaller than a period */
-		urb_packs = min(max_packs_per_urb, packs_per_ms);
+		urb_packs = min(max_packs_per_urb, urb_packs);
 		while (urb_packs > 1 && urb_packs * maxsize >= period_bytes)
 			urb_packs >>= 1;
 		ep->nurbs = MAX_URBS;
-- 
1.7.10.4

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

* Re: [PATCH] ALSA: usb: use multiple packets per urb for Wireless USB inbound audio
  2013-11-26 19:58 [PATCH] ALSA: usb: use multiple packets per urb for Wireless USB inbound audio Thomas Pugliese
@ 2013-11-27 10:56 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2013-11-27 10:56 UTC (permalink / raw)
  To: Thomas Pugliese; +Cc: alsa-devel

At Tue, 26 Nov 2013 13:58:15 -0600,
Thomas Pugliese wrote:
> 
> For Wireless USB audio devices, use multiple isoc packets per URB for
> inbound endpoints with a datainterval < 5.  This allows the WUSB host
> controller to take advantage of bursting to service endpoints whose
> logical polling interval is less than the 4ms minimum polling interval
> limit in WUSB.
> 
> Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>

Thanks, applied now.


Takashi

> ---
>  sound/usb/endpoint.c |   16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
> index b9ba0fc..83aabea2 100644
> --- a/sound/usb/endpoint.c
> +++ b/sound/usb/endpoint.c
> @@ -636,8 +636,22 @@ static int data_ep_set_params(struct snd_usb_endpoint *ep,
>  	if (usb_pipein(ep->pipe) ||
>  			snd_usb_endpoint_implicit_feedback_sink(ep)) {
>  
> +		urb_packs = packs_per_ms;
> +		/*
> +		 * Wireless devices can poll at a max rate of once per 4ms.
> +		 * For dataintervals less than 5, increase the packet count to
> +		 * allow the host controller to use bursting to fill in the
> +		 * gaps.
> +		 */
> +		if (snd_usb_get_speed(ep->chip->dev) == USB_SPEED_WIRELESS) {
> +			int interval = ep->datainterval;
> +			while (interval < 5) {
> +				urb_packs <<= 1;
> +				++interval;
> +			}
> +		}
>  		/* make capture URBs <= 1 ms and smaller than a period */
> -		urb_packs = min(max_packs_per_urb, packs_per_ms);
> +		urb_packs = min(max_packs_per_urb, urb_packs);
>  		while (urb_packs > 1 && urb_packs * maxsize >= period_bytes)
>  			urb_packs >>= 1;
>  		ep->nurbs = MAX_URBS;
> -- 
> 1.7.10.4
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 

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

end of thread, other threads:[~2013-11-27 10:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-26 19:58 [PATCH] ALSA: usb: use multiple packets per urb for Wireless USB inbound audio Thomas Pugliese
2013-11-27 10:56 ` 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.