• Ruslan Bilovol's avatar
    usb: gadget: u_audio: add real feedback implementation · e89bb428
    Ruslan Bilovol authored
    This adds interface between userspace and feedback endpoint to report real
    feedback frequency to the Host.
    
    Current implementation adds new userspace interface ALSA mixer control
    "Capture Pitch 1000000" (similar to aloop driver's "PCM Rate Shift 100000"
    mixer control)
    
    Value in PPM is chosen to have correction value agnostic of the actual HW
    rate, which the application is not necessarily dealing with, while still
    retaining a good enough precision to allow smooth clock correction on the
    playback side, if necessary.
    
    Similar to sound/usb/endpoint.c, a slow down is allowed up to 25%. This
    has no impact on the required bandwidth. Speedup correction has an impact
    on the bandwidth reserved for the isochronous endpoint. The default
    allowed speedup is 500ppm. This seems to be more than enough but, if
    necessary, this is configurable through a module parameter. The reserved
    bandwidth is rounded up to the next packet size.
    
    Usage of this new control is easy to implement in existing userspace tools
    like alsaloop from alsa-utils.
    Signed-off-by: default avatarRuslan Bilovol <ruslan.bilovol@gmail.com>
    Signed-off-by: default avatarJerome Brunet <jbrunet@baylibre.com>
    Link: https://lore.kernel.org/r/20210603220104.1216001-4-jbrunet@baylibre.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    e89bb428
u_audio.c 19.6 KB