On Wed, Aug 27, 2014 at 3:23 AM, Daniel Mack <zonque@xxxxxxxxx> wrote: > @@ -1099,11 +1139,31 @@ afunc_set_alt(struct usb_function *fn, unsigned intf, unsigned alt) > prm = &uac2->c_prm; > config_ep_by_speed(gadget, fn, ep); > agdev->as_out_alt = alt; > + req_len = prm->max_psize; > } else if (intf == agdev->as_in_intf) { > + struct f_uac2_opts *opts = agdev_to_uac2_opts(agdev); > + unsigned int rate = opts->p_srate * opts->p_ssize * > + num_channels(opts->p_chmask); > + struct usb_endpoint_descriptor *ep_desc; > + unsigned int factor; > + > ep = agdev->in_ep; > prm = &uac2->p_prm; > config_ep_by_speed(gadget, fn, ep); > agdev->as_in_alt = alt; > + > + /* pre-calculate the playback endpoint's interval */ > + if (gadget->speed == USB_SPEED_FULL) { > + ep_desc = &fs_epin_desc; > + factor = 1000; > + } else { > + ep_desc = &hs_epin_desc; > + factor = 125; > + } > + > + uac2->p_interval = (1 << (ep_desc->bInterval - 1)) * factor; > + req_len = rate / uac2->p_interval; > (a) For 44.1/2/S16, req_len = 176 > + uac2->p_residue = 0; > } else { > dev_err(dev, "%s:%d Error!\n", __func__, __LINE__); > return -EINVAL; > @@ -1128,7 +1188,7 @@ afunc_set_alt(struct usb_function *fn, unsigned intf, unsigned alt) > > req->zero = 0; > req->context = &prm->ureq[i]; > - req->length = prm->max_psize; > + req->length = req_len; (b) req->length = req_len or 176 > req->complete = agdev_iso_complete; > req->buf = prm->rbuf + i * req->length; > Here req[0]->buf is req->length, which is 176 bytes from (b). I hope this makes it clear. -jassi > } > -- > 2.1.0 > -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html