]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
usb: gadget: uvc: calculate the number of request depending on framesize
authorMichael Grzeschik <m.grzeschik@pengutronix.de>
Sun, 29 May 2022 22:38:46 +0000 (00:38 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Aug 2022 09:45:40 +0000 (11:45 +0200)
commitc2d17078980a3814ba7c502eb29e1839b9b63e45
tree9e379c1379f2ce82560212b9bddfcbdba5530d57
parent6fd50446e7c9a98b4bcf96815f5c9602a16ea472
usb: gadget: uvc: calculate the number of request depending on framesize

[ Upstream commit 87d76b5f1d8eeb49efa16e2018e188864cbb9401 ]

The current limitation of possible number of requests being handled is
dependent on the gadget speed. It makes more sense to depend on the
typical frame size when calculating the number of requests. This patch
is changing this and is using the previous limits as boundaries for
reasonable minimum and maximum number of requests.

For a 1080p jpeg encoded video stream with a maximum imagesize of
e.g. 800kB with a maxburst of 8 and an multiplier of 1 the resulting
number of requests is calculated to 49.

        800768         1
nreqs = ------ * -------------- ~= 49
          2      (1024 * 8 * 1)

Tested-by: Dan Vacura <w36195@motorola.com>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20220529223848.105914-2-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/gadget/function/uvc_queue.c