Skip to contentSkip to conversation

patch "usb: gadget: f_uac2: fix calculation of uac2->p_interval" added to usb-linus

PATCH [email protected] 1 participant 1 message Jul 27, 2015

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

    usb: gadget: f_uac2: fix calculation of uac2->p_interval

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-linus branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.

If you have any questions about this process, please let me know.

Quoted 1 line

From c41b7767673cb76adeb2b5fde220209f717ea13c Mon Sep 17 00:00:00 2001

From: Peter Chen <[email protected]>
Date: Mon, 27 Jul 2015 14:51:47 +0800
Subject: usb: gadget: f_uac2: fix calculation of uac2->p_interval

The p_interval should be less if the 'bInterval' at the descriptor is larger, eg, if 'bInterval' is 5 for HS, the p_interval should be 8000 / 16 = 500.

It fixes the patch 9bb87f168931 ("usb: gadget: f_uac2: send reasonably sized packets")

Cc <[email protected]> # v3.18+
Fixes 9bb87f168931 ("usb: gadget: f_uac2: send reasonably sized packets")
---
 drivers/usb/gadget/function/f_uac2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/gadget/function/f_uac2.c +2 -2
index 6d3eb8b00a48..531861547253 100644
@@ -1162,14 +1162,14 @@ afunc_set_alt(struct usb_function *fn, unsigned intf, unsigned alt)
 			factor = 1000;
 		} else {
 			ep_desc = &hs_epin_desc;
-			factor = 125;
+			factor = 8000;
 		}
 
 		/* pre-compute some values for iso_complete() */
 		uac2->p_framesize = opts->p_ssize *
 				    num_channels(opts->p_chmask);
 		rate = opts->p_srate * uac2->p_framesize;
-		uac2->p_interval = (1 << (ep_desc->bInterval - 1)) * factor;
+		uac2->p_interval = factor / (1 << (ep_desc->bInterval - 1));
 		uac2->p_pktsize = min_t(unsigned int, rate / uac2->p_interval,
 					prm->max_psize);
 
Signature · 1 line
2.4.6