aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Chen <peter.chen@freescale.com>2015-07-27 02:51:47 -0400
committerFelipe Balbi <balbi@ti.com>2015-07-27 11:18:06 -0400
commitc41b7767673cb76adeb2b5fde220209f717ea13c (patch)
tree7ce3a4dc3d7ff403967deb6b0dabfc81bcae6fab
parent02c3b4c75994888e58a6e6e8176640cde9822597 (diff)
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: <stable@vger.kernel.org> # v3.18+ Fixes: 9bb87f168931 ("usb: gadget: f_uac2: send reasonably sized packets") Acked-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r--drivers/usb/gadget/function/f_uac2.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c
index 6d3eb8b00a48..531861547253 100644
--- a/drivers/usb/gadget/function/f_uac2.c
+++ b/drivers/usb/gadget/function/f_uac2.c
@@ -1162,14 +1162,14 @@ afunc_set_alt(struct usb_function *fn, unsigned intf, unsigned alt)
1162 factor = 1000; 1162 factor = 1000;
1163 } else { 1163 } else {
1164 ep_desc = &hs_epin_desc; 1164 ep_desc = &hs_epin_desc;
1165 factor = 125; 1165 factor = 8000;
1166 } 1166 }
1167 1167
1168 /* pre-compute some values for iso_complete() */ 1168 /* pre-compute some values for iso_complete() */
1169 uac2->p_framesize = opts->p_ssize * 1169 uac2->p_framesize = opts->p_ssize *
1170 num_channels(opts->p_chmask); 1170 num_channels(opts->p_chmask);
1171 rate = opts->p_srate * uac2->p_framesize; 1171 rate = opts->p_srate * uac2->p_framesize;
1172 uac2->p_interval = (1 << (ep_desc->bInterval - 1)) * factor; 1172 uac2->p_interval = factor / (1 << (ep_desc->bInterval - 1));
1173 uac2->p_pktsize = min_t(unsigned int, rate / uac2->p_interval, 1173 uac2->p_pktsize = min_t(unsigned int, rate / uac2->p_interval,
1174 prm->max_psize); 1174 prm->max_psize);
1175 1175