Return-Path: Received: from mail-bn1on0144.outbound.protection.outlook.com ([157.56.110.144]:24884 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751440AbbG0IBm (ORCPT ); Mon, 27 Jul 2015 04:01:42 -0400 From: Peter Chen To: CC: , Peter Chen , Daniel Mack , Subject: [PATCH 2/2] usb: gadget: f_uac2: fix calculation of uac2->p_interval Date: Mon, 27 Jul 2015 14:51:47 +0800 Message-ID: <1437979907-29976-2-git-send-email-peter.chen@freescale.com> In-Reply-To: <1437979907-29976-1-git-send-email-peter.chen@freescale.com> References: <1437979907-29976-1-git-send-email-peter.chen@freescale.com> MIME-Version: 1.0 Content-Type: text/plain Sender: stable-owner@vger.kernel.org List-ID: 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 9bb87f16 "usb: gadget: f_uac2: send reasonably sized packets" Cc: Daniel Mack Cc: #v3.18+ Signed-off-by: Peter Chen --- drivers/usb/gadget/function/f_uac2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c index 51ca32d..4bd9a8e 100644 --- a/drivers/usb/gadget/function/f_uac2.c +++ b/drivers/usb/gadget/function/f_uac2.c @@ -1191,14 +1191,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); -- 1.9.1