Skip to content

Commit

Permalink
usb: gadget: f_uac2: fix calculation of uac2->p_interval
Browse files Browse the repository at this point in the history
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 9bb87f1 ("usb: gadget: f_uac2: send
reasonably sized packets")

Cc: <stable@vger.kernel.org> # v3.18+
Fixes: 9bb87f1 ("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>
  • Loading branch information
Peter Chen authored and Felipe Balbi committed Jul 27, 2015
1 parent 02c3b4c commit c41b776
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/usb/gadget/function/f_uac2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit c41b776

Please sign in to comment.