RE: [PATCH v2 1/1] usb: gadget: f_uac2: finalize wMaxPacketSize according to bandwidth

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 
> 
> > @@ -1176,15 +1188,16 @@ 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_pktsize = min_t(unsigned int, rate / uac2->p_interval,
> > +               uac2->p_interval =  factor / (1 << (ep_desc->bInterval
> > + - 1));
> 
> Your version is correct. b_interval needs to get larger when bInterval decreases
> of course.
> 
> > +               uac2->p_pktsize = min_t(unsigned int, DIV_ROUND_UP(rate,
> > +                                       uac2->p_interval),
> >                                         prm->max_psize);
> 
> This change, however, is not needed. uac2->p_pktsize needs to be rounded
> down, so an extra frame can be added when the residue accumulator
> overflows. The reason is simply that we can only send packets that contain full
> sample frames, so we have to evenly distribute those left-over samples that
> accumulate in one go once we have enough to fill a complete frame.
> 
> Could you put the above change in an extra patch, as it's not directly related to
> your wMaxPacketSize change?
> 

Ok, I will.

Peter

��.n��������+%������w��{.n�����������ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]