usb: gadget: u_audio.c: Adding Playback Pitch ctl for sync playback
authorPavel Hofman <pavel.hofman@ivitera.com>
Wed, 13 Oct 2021 07:39:34 +0000 (09:39 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Oct 2021 11:59:43 +0000 (13:59 +0200)
commit6fec018a7e70d611412dd961e596b0415c6d365c
tree41ae831940a79da648a47a1ebb0d69be9e7a9710
parent68e7c510fdf4f6167404609da52e1979165649f6
usb: gadget: u_audio.c: Adding Playback Pitch ctl for sync playback

EP IN is hard-coded as ASYNC both in f_uac1 and f_uac2 but u_audio sends
steady number of audio frames in each USB packet, without any control.

This patch adds 'Playback Pitch 1000000' ctl analogous to the existing
'Capture Pitch 1000000' ctl. The calculation of playback req->length in
u_audio_iso_complete respects the Playback Pitch ctl value to 1ppm now.

Max. value for Playback Pitch is configured by the existing parameter
uac2_opts->fb_max, used also for the Capture Pitch.

Since the EP IN packet size can be increased by uac2_opts->fb_max now,
maxPacketSize for the playback direction is calculated by the same
algorithm as for the async capture direction in
f_uac2.c:set_ep_max_packet_size.

Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Link: https://lore.kernel.org/r/20211013073934.36476-1-pavel.hofman@ivitera.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/f_uac2.c
drivers/usb/gadget/function/u_audio.c