<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/drivers/usb/gadget/function/uvc_video.c, branch linux-rolling-stable</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-rolling-stable</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-rolling-stable'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2026-03-19T15:15:05Z</updated>
<entry>
<title>usb: gadget: uvc: fix interval_duration calculation</title>
<updated>2026-03-19T15:15:05Z</updated>
<author>
<name>Junzhong Pan</name>
<email>panjunzhong@linux.spacemit.com</email>
</author>
<published>2026-03-06T03:30:09Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=c586f4bc24c3601b5fb529f7f9166733bae1eb4b'/>
<id>urn:sha1:c586f4bc24c3601b5fb529f7f9166733bae1eb4b</id>
<content type='text'>
commit 56135c0c60b07729401af9d329fa9c0eded845a6 upstream.

To correctly convert bInterval as interval_duration:
  interval_duration = 2^(bInterval-1) * frame_interval

Current code uses a wrong left shift operand, computing 2^bInterval
instead of 2^(bInterval-1).

Fixes: 010dc57cb516 ("usb: gadget: uvc: fix interval_duration calculation")
Cc: stable &lt;stable@kernel.org&gt;
Signed-off-by: Junzhong Pan &lt;panjunzhong@linux.spacemit.com&gt;
Reviewed-by: Xu Yang &lt;xu.yang_2@nxp.com&gt;
Link: https://patch.msgid.link/20260306-fix-uvc-interval-v1-1-9a2df6859859@linux.spacemit.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: uvc: return error from uvcg_queue_init()</title>
<updated>2026-01-14T15:03:18Z</updated>
<author>
<name>Xu Yang</name>
<email>xu.yang_2@nxp.com</email>
</author>
<published>2026-01-13T09:53:09Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=0bce8f19bba16277257a915e4fb94e1cfe99d760'/>
<id>urn:sha1:0bce8f19bba16277257a915e4fb94e1cfe99d760</id>
<content type='text'>
uvcg_queue_init() may fail, but its return value is currently ignored.
Propagate the error code from uvcg_queue_init() to correctly report
initialization failures.

Signed-off-by: Xu Yang &lt;xu.yang_2@nxp.com&gt;
Link: https://patch.msgid.link/20260113-uvc-gadget-fix-patch-v2-3-62950ef5bcb5@nxp.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: uvc: fix interval_duration calculation</title>
<updated>2026-01-14T15:03:17Z</updated>
<author>
<name>Xu Yang</name>
<email>xu.yang_2@nxp.com</email>
</author>
<published>2026-01-13T09:53:08Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=010dc57cb5163e5f4a32430dd5091cc29efd0471'/>
<id>urn:sha1:010dc57cb5163e5f4a32430dd5091cc29efd0471</id>
<content type='text'>
According to USB specification:

  For full-/high-speed isochronous endpoints, the bInterval value is
  used as the exponent for a 2^(bInterval-1) value.

To correctly convert bInterval as interval_duration:
  interval_duration = 2^(bInterval-1) * frame_interval

Because the unit of video-&gt;interval is 100ns, add a comment info to
make it clear.

Fixes: 48dbe731171e ("usb: gadget: uvc: set req_size and n_requests based on the frame interval")
Cc: stable@vger.kernel.org
Reviewed-by: Frank Li &lt;Frank.Li@nxp.com&gt;
Signed-off-by: Xu Yang &lt;xu.yang_2@nxp.com&gt;
Link: https://patch.msgid.link/20260113-uvc-gadget-fix-patch-v2-2-62950ef5bcb5@nxp.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: uvc: fix req_payload_size calculation</title>
<updated>2026-01-14T15:03:17Z</updated>
<author>
<name>Xu Yang</name>
<email>xu.yang_2@nxp.com</email>
</author>
<published>2026-01-13T09:53:07Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=2edc1acb1a2512843425aa19d0c6060a0a924605'/>
<id>urn:sha1:2edc1acb1a2512843425aa19d0c6060a0a924605</id>
<content type='text'>
Current req_payload_size calculation has 2 issue:

(1) When the first time calculate req_payload_size for all the buffers,
    reqs_per_frame = 0 will be the divisor of DIV_ROUND_UP(). So
    the result is undefined.
    This happens because VIDIOC_STREAMON is always executed after
    VIDIOC_QBUF. So video-&gt;reqs_per_frame will be 0 until VIDIOC_STREAMON
    is run.

(2) The buf-&gt;req_payload_size may be bigger than max_req_size.

    Take YUYV pixel format as example:
    If bInterval = 1, video-&gt;interval = 666666, high-speed:
    video-&gt;reqs_per_frame = 666666 / 1250 = 534
     720p: buf-&gt;req_payload_size = 1843200 / 534 = 3452
    1080p: buf-&gt;req_payload_size = 4147200 / 534 = 7766

    Based on such req_payload_size, the controller can't run normally.

To fix above issue, assign max_req_size to buf-&gt;req_payload_size when
video-&gt;reqs_per_frame = 0. And limit buf-&gt;req_payload_size to
video-&gt;req_size if it's large than video-&gt;req_size. Since max_req_size
is used at many place, add it to struct uvc_video and set the value once
endpoint is enabled.

Fixes: 98ad03291560 ("usb: gadget: uvc: set req_length based on payload by nreqs instead of req_size")
Cc: stable@vger.kernel.org
Reviewed-by: Frank Li &lt;Frank.Li@nxp.com&gt;
Signed-off-by: Xu Yang &lt;xu.yang_2@nxp.com&gt;
Link: https://patch.msgid.link/20260113-uvc-gadget-fix-patch-v2-1-62950ef5bcb5@nxp.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: uvc: Fix unstarted kthread worker</title>
<updated>2025-02-14T08:26:00Z</updated>
<author>
<name>Frederic Weisbecker</name>
<email>frederic@kernel.org</email>
</author>
<published>2025-02-12T13:55:14Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=e5644be4079750a0a0a5a7068fd90b97bf6fac55'/>
<id>urn:sha1:e5644be4079750a0a0a5a7068fd90b97bf6fac55</id>
<content type='text'>
The behaviour of kthread_create_worker() was recently changed to align
with the one of kthread_create(). The kthread worker is created but not
awaken by default. This is to allow the use of kthread_affine_preferred()
and kthread_bind[_mask]() with kthread workers. In order to keep the
old behaviour and wake the kthread up, kthread_run_worker() must be
used. All the pre-existing users have been converted, except for UVC
that was introduced in the same merge window as the API change.

This results in hangs:

	INFO: task UVCG:82 blocked for more than 491 seconds.
	Tainted: G                T  6.13.0-rc2-00014-gb04e317b5226 #1
	task:UVCG            state:D stack:0     pid:82
	 Call Trace:
	 __schedule
	 schedule
	 schedule_preempt_disabled
	 kthread
	 ? kthread_flush_work
	 ret_from_fork
	 ret_from_fork_asm
	 entry_INT80_32

Fix this with converting UVCG kworker to the new API.

Reported-by: kernel test robot &lt;oliver.sang@intel.com&gt;
Closes: https://lore.kernel.org/oe-lkp/202502121025.55bfa801-lkp@intel.com
Fixes: f0bbfbd16b3b ("usb: gadget: uvc: rework to enqueue in pump worker from encoded queue")
Cc: stable &lt;stable@kernel.org&gt;
Cc: Michael Grzeschik &lt;m.grzeschik@pengutronix.de&gt;
Signed-off-by: Frederic Weisbecker &lt;frederic@kernel.org&gt;
Link: https://lore.kernel.org/r/20250212135514.30539-1-frederic@kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>drivers/usb/gadget: refactor min with min_t</title>
<updated>2024-11-13T14:09:50Z</updated>
<author>
<name>Sabyrzhan Tasbolatov</name>
<email>snovitoll@gmail.com</email>
</author>
<published>2024-11-12T15:58:10Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=b7d49096d595c3413420b02e7851e8b5524353bf'/>
<id>urn:sha1:b7d49096d595c3413420b02e7851e8b5524353bf</id>
<content type='text'>
Ensure type safety by using min_t() instead of casted min().

Signed-off-by: Sabyrzhan Tasbolatov &lt;snovitoll@gmail.com&gt;
Link: https://lore.kernel.org/r/20241112155817.3512577-2-snovitoll@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: uvc: add trace of enqueued and completed requests</title>
<updated>2024-10-17T06:42:23Z</updated>
<author>
<name>Michael Grzeschik</name>
<email>m.grzeschik@pengutronix.de</email>
</author>
<published>2024-10-16T13:58:13Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=757f5d0b61dea4d16eaf2c3fa860bd458a4d3ec6'/>
<id>urn:sha1:757f5d0b61dea4d16eaf2c3fa860bd458a4d3ec6</id>
<content type='text'>
This patch is adding trace events for each request that is being
enqueued into the hw and will be completed. This way it is possible
to track the fill status of the gadget hardware and find potential
issues.

Signed-off-by: Michael Grzeschik &lt;m.grzeschik@pengutronix.de&gt;
Link: https://lore.kernel.org/r/20240403-uvc_request_length_by_interval-v7-8-e224bb1035f0@pengutronix.de
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: uvc: set req_length based on payload by nreqs instead of req_size</title>
<updated>2024-10-17T06:42:22Z</updated>
<author>
<name>Michael Grzeschik</name>
<email>m.grzeschik@pengutronix.de</email>
</author>
<published>2024-10-16T13:58:11Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=98ad0329156094a63c5191bb0f57b7bae9659f18'/>
<id>urn:sha1:98ad0329156094a63c5191bb0f57b7bae9659f18</id>
<content type='text'>
Compressed formats generate content depending amount of data that is set
in the vb2 buffer by the payload_size. When streaming those formats it
is better to scatter that smaller data over all requests. This patch is
doing that by introducing the calculated req_payload_size which is
updated by each frame. It the uses this amount of data to fill the
isoc requests instead of the video-&gt;req_size.

For uncompressed formats it will not make a difference since the payload
size will be equal to the imagesize. Therefore the code will have no
effecta as req_payload_size will be equal to req_size.

Signed-off-by: Michael Grzeschik &lt;m.grzeschik@pengutronix.de&gt;
Link: https://lore.kernel.org/r/20240403-uvc_request_length_by_interval-v7-6-e224bb1035f0@pengutronix.de
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: uvc: set req_size and n_requests based on the frame interval</title>
<updated>2024-10-17T06:42:22Z</updated>
<author>
<name>Michael Grzeschik</name>
<email>m.grzeschik@pengutronix.de</email>
</author>
<published>2024-10-16T13:58:10Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=48dbe731171e425611290f5b6d3058f86efb16bd'/>
<id>urn:sha1:48dbe731171e425611290f5b6d3058f86efb16bd</id>
<content type='text'>
This patch is removing the initial imprecise and limited calculation of
requests needed to be used from the queue_setup callback. It instead
introduces the uvc_video_prep_requests function which is called
immediately before the request allocation.

With the information of the usb frame interval length it is possible to
calculate the number of requests needed during one frame duration.

Based on the calculated number of requests and the imagesize we
calculate the actual size per request. This calculation has the benefit
that the frame data is equally distributed over all allocated requests.

When the req_size is not in the range for the actually configured
max_req_size configured for the overall bandwidth we fallback
to use the max_req_size instead.

Since this calculations are only important for isoc transfers we just
use max_request_size for bulk and skip it.

As video-&gt;req_size will be recalculated on every video_enable resetting
it to 0 is not necessary anymore.

Signed-off-by: Michael Grzeschik &lt;m.grzeschik@pengutronix.de&gt;
Link: https://lore.kernel.org/r/20240403-uvc_request_length_by_interval-v7-5-e224bb1035f0@pengutronix.de
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: gadget: uvc: add g_parm and s_parm for frame interval</title>
<updated>2024-10-17T06:42:22Z</updated>
<author>
<name>Michael Grzeschik</name>
<email>m.grzeschik@pengutronix.de</email>
</author>
<published>2024-10-16T13:58:09Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=2fe7c94dcd0903160e00045f420181351c6ccd80'/>
<id>urn:sha1:2fe7c94dcd0903160e00045f420181351c6ccd80</id>
<content type='text'>
The uvc gadget driver is lacking the information which frame interval
was set by the host. We add this information by implementing the g_parm
and s_parm callbacks.

Signed-off-by: Michael Grzeschik &lt;m.grzeschik@pengutronix.de&gt;
Link: https://lore.kernel.org/r/20240403-uvc_request_length_by_interval-v7-4-e224bb1035f0@pengutronix.de
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
