stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Chen <peter.chen@freescale.com>
To: <balbi@ti.com>
Cc: <linux-usb@vger.kernel.org>,
	Peter Chen <peter.chen@freescale.com>,
	Daniel Mack <zonque@gmail.com>, <stable@vger.kernel.org>
Subject: [PATCH 2/2] usb: gadget: f_uac2: fix calculation of uac2->p_interval
Date: Mon, 27 Jul 2015 14:51:47 +0800	[thread overview]
Message-ID: <1437979907-29976-2-git-send-email-peter.chen@freescale.com> (raw)
In-Reply-To: <1437979907-29976-1-git-send-email-peter.chen@freescale.com>

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 <zonque@gmail.com>
Cc: <stable@vger.kernel.org> #v3.18+
Signed-off-by: Peter Chen <peter.chen@freescale.com>
---
 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


  reply	other threads:[~2015-07-27  8:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-27  6:51 [PATCH v3 1/2] usb: gadget: f_uac2: finalize wMaxPacketSize according to bandwidth Peter Chen
2015-07-27  6:51 ` Peter Chen [this message]
2015-07-27  8:13   ` [PATCH 2/2] usb: gadget: f_uac2: fix calculation of uac2->p_interval Daniel Mack
2015-07-27  8:13 ` [PATCH v3 1/2] usb: gadget: f_uac2: finalize wMaxPacketSize according to bandwidth Daniel Mack

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1437979907-29976-2-git-send-email-peter.chen@freescale.com \
    --to=peter.chen@freescale.com \
    --cc=balbi@ti.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=zonque@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).