diff options
author | Michael Grzeschik <m.grzeschik@pengutronix.de> | 2022-10-18 00:11:41 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-10-25 19:06:13 +0200 |
commit | 19905240aef0181d1e6944070eb85fce75f75bcd (patch) | |
tree | 92e1fa478b6de86f64ef793d68d957e63ccebb0a /drivers/usb/gadget/function/uvc_video.c | |
parent | fb8f60dd1b67520e0e0d7978ef17d015690acfc1 (diff) | |
download | linux-19905240aef0181d1e6944070eb85fce75f75bcd.tar.gz linux-19905240aef0181d1e6944070eb85fce75f75bcd.tar.bz2 linux-19905240aef0181d1e6944070eb85fce75f75bcd.zip |
usb: gadget: uvc: limit isoc_sg to super speed gadgets
The overhead of preparing sg data is high for transfers with limited
payload. When transferring isoc over high-speed usb the maximum payload
is rather small which is a good argument no to use sg. This patch is
changing the uvc_video_encode_isoc_sg encode function only to be used
for super speed gadgets.
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Cc: stable <stable@kernel.org>
Link: https://lore.kernel.org/r/20221017221141.3134818-1-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/gadget/function/uvc_video.c')
-rw-r--r-- | drivers/usb/gadget/function/uvc_video.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c index dd1c6b2ca7c6..b6ea600b0111 100644 --- a/drivers/usb/gadget/function/uvc_video.c +++ b/drivers/usb/gadget/function/uvc_video.c @@ -459,6 +459,9 @@ static void uvcg_video_pump(struct work_struct *work) */ int uvcg_video_enable(struct uvc_video *video, int enable) { + struct uvc_device *uvc = video->uvc; + struct usb_composite_dev *cdev = uvc->func.config->cdev; + struct usb_gadget *gadget = cdev->gadget; unsigned int i; int ret; @@ -490,9 +493,11 @@ int uvcg_video_enable(struct uvc_video *video, int enable) if (video->max_payload_size) { video->encode = uvc_video_encode_bulk; video->payload_size = 0; - } else - video->encode = video->queue.use_sg ? + } else { + video->encode = (video->queue.use_sg && + !(gadget->speed <= USB_SPEED_HIGH)) ? uvc_video_encode_isoc_sg : uvc_video_encode_isoc; + } video->req_int_count = 0; |