• John Keeping's avatar
    usb: gadget: u_audio: Fix high-speed max packet size · 904967c6
    John Keeping authored
    Prior to commit eb9fecb9 ("usb: gadget: f_uac2: split out audio
    core") the maximum packet size was calculated only from the high-speed
    descriptor but now we use the largest of the full-speed and high-speed
    descriptors.
    
    This is correct, but the full-speed value is likely to be higher than
    that for high-speed and this leads to submitting requests for OUT
    transfers (received by the gadget) which are larger than the endpoint's
    maximum packet size.  These are rightly rejected by the gadget core.
    
    config_ep_by_speed() already sets up the correct maximum packet size for
    the enumerated speed in the usb_ep structure, so we can simply use this
    instead of the overall value that has been used to allocate buffers for
    requests.
    
    Note that the minimum period for ALSA is still set from the largest
    value, and this is unavoidable because it's possible to open the audio
    device before the gadget has been enumerated.
    Tested-by: default avatarPavel Hofman  <pavel.hofman@ivitera.com>
    Signed-off-by: default avatarJohn Keeping <john@metanate.com>
    Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
    904967c6
u_audio.c 14.6 KB