From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 93774321F43; Mon, 18 Aug 2025 14:07:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755526066; cv=none; b=HDL0BuKGFh/FC7g7FNBTJ0/Gm0Vm4HyQ8FNlffJaN7JFEdPJi7/VbUbHMsC6VcZheOTh2l1QKlZIDRCPIhxtACIZuTSCvH5aGgosPdGaE5SpgEIssuu1syyaPTcS+L/KJYDsHzdl0pKMfAQW2H6pf4aLjKC9uUhch4XrPpWse+U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755526066; c=relaxed/simple; bh=37M2+k6NXjw7hAkQRXRDQhv+jl22n8xkcb66m0tg918=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dxOPBl83dXpRqdd3DLn2574IZmpJnBe5vd7Qdcjz6cJ3kVmamGG9cjDbnmVg3xKfrNt7V3pCfDuZFe4dmYCOI6005s6ZoXGU80NLDdjLzRiW5nwEB1usfalXDWev9p/H1BPtG4lGdh5NTsxlaNbghWOwSuISbbBWLosphZa1qK0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=L0m6jHQU; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="L0m6jHQU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B04E5C4CEEB; Mon, 18 Aug 2025 14:07:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1755526066; bh=37M2+k6NXjw7hAkQRXRDQhv+jl22n8xkcb66m0tg918=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L0m6jHQUHHD7YKd/gg1+PwYat59cB6rnC29hX+Yh03zbLl2Fo1nf1uzchD6hFSovf XBeTovLStHubQFpv6V4ZfLvKvAIIUR2XgtiJILeBPxqGlNk+HcHGJYfcHKqYaw5xoP lV6Ozpe9lgyq02F1LNeSaNCrSQYbQbVfD2/FKuSI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, chenchangcheng , Ricardo Ribalda , Laurent Pinchart , Hans Verkuil , Sasha Levin Subject: [PATCH 6.16 416/570] media: uvcvideo: Fix bandwidth issue for Alcor camera Date: Mon, 18 Aug 2025 14:46:43 +0200 Message-ID: <20250818124521.870515953@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250818124505.781598737@linuxfoundation.org> References: <20250818124505.781598737@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: chenchangcheng [ Upstream commit 9764401bf6f8a20eb11c2e78470f20fee91a9ea7 ] Some broken device return wrong dwMaxPayloadTransferSize fields as follows: [ 218.632537] uvcvideo: Device requested 2752512 B/frame bandwidth. [ 218.632598] uvcvideo: No fast enough alt setting for requested bandwidth. When dwMaxPayloadTransferSize is greater than maxpsize, it will prevent the camera from starting. So use the bandwidth of maxpsize. Signed-off-by: chenchangcheng Reviewed-by: Ricardo Ribalda Reviewed-by: Laurent Pinchart Link: https://lore.kernel.org/r/20250510061803.811433-1-ccc194101@163.com Signed-off-by: Laurent Pinchart Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin --- drivers/media/usb/uvc/uvc_video.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c index e3567aeb0007..11769a1832d2 100644 --- a/drivers/media/usb/uvc/uvc_video.c +++ b/drivers/media/usb/uvc/uvc_video.c @@ -262,6 +262,15 @@ static void uvc_fixup_video_ctrl(struct uvc_streaming *stream, ctrl->dwMaxPayloadTransferSize = bandwidth; } + + if (stream->intf->num_altsetting > 1 && + ctrl->dwMaxPayloadTransferSize > stream->maxpsize) { + dev_warn_ratelimited(&stream->intf->dev, + "UVC non compliance: the max payload transmission size (%u) exceeds the size of the ep max packet (%u). Using the max size.\n", + ctrl->dwMaxPayloadTransferSize, + stream->maxpsize); + ctrl->dwMaxPayloadTransferSize = stream->maxpsize; + } } static size_t uvc_video_ctrl_size(struct uvc_streaming *stream) -- 2.39.5