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 1761F12C80F; Sun, 28 Jul 2024 15:48:56 +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=1722181736; cv=none; b=qS729b90y0FqRDEp7DNT/XLOHG1sCz7GRF+KXfmplLkqFmJZlK0l8gv6BtohNOrkkmW06bO2hlHqRd2RPKaWpjY0veYB2a2ZqJW7okr50l1Q0kjM3XuCuLBsLqM4fEPbm55Idw9DiJaBnoeOg5UD/kJxZCeanVc0H7972Vnqt5I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722181736; c=relaxed/simple; bh=wi9gHSgyp0LS1CmYkaVpTbiw+NuDsYSuVUvFcSLTU9E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=J5g7D0XUYXZCVe5XzDdzCGqyx3EkxD3y5qP821ZSt5jFTQpB4jgZPfqT1F5jfosfIHiCUN9vZNPg5P8gEikpveYhaVJu0hbhuDNfHCPGumH/YEoirIhDcWjiVcClM6pOrTCeoZOfSG4/BEycC3pPpNB6+sOXuQQ+38dLsH2akLw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=K70mH8Lf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="K70mH8Lf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6B2DC4AF0F; Sun, 28 Jul 2024 15:48:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722181736; bh=wi9gHSgyp0LS1CmYkaVpTbiw+NuDsYSuVUvFcSLTU9E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K70mH8LfuQEJGbeW/J6xs+OFRSwAg0lo+Ly//i212RXYgy3X5Ieb7Txv9x7fABTIt +rxoRG7g1OC5KtM0eL/e9iPYH59ouaJs2xU/XM2jgG98befvCgRtwRfMF3y21vlcKb GOzyzl0iQvre+/dN54o6zl3TMOXZzJ+PjuRJqWvwuTcN1AuYMjWPIO7YGq2x/Kps7A nPMKZhf5P0N2a3sndXSPvHzzpKNDFhV9YT3JvObTiIqLhOgVpDKct1As1Ict9O5IwT YgVBOGUhfJwwQEIMqT1C9g0vuc+TtMx3x7Pl9AnaNFhKjAMzmiBqmFpYcmFTWwBttm /vtS4MZ2WXerw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Michal Pecio , Ricardo Ribalda , Laurent Pinchart , Sasha Levin , mchehab@kernel.org, linux-media@vger.kernel.org Subject: [PATCH AUTOSEL 6.1 11/17] media: uvcvideo: Fix the bandwdith quirk on USB 3.x Date: Sun, 28 Jul 2024 11:47:21 -0400 Message-ID: <20240728154805.2049226-11-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240728154805.2049226-1-sashal@kernel.org> References: <20240728154805.2049226-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.1.102 Content-Transfer-Encoding: 8bit From: Michal Pecio [ Upstream commit 9e3d55fbd160b3ca376599a68b4cddfdc67d4153 ] The bandwidth fixup quirk doesn't know that SuperSpeed exists and has the same 8 service intervals per millisecond as High Speed, hence its calculations are wrong. Assume that all speeds from HS up use 8 intervals per millisecond. No further changes are needed, updated code has been confirmed to work with all speeds from FS to SS. Signed-off-by: Michal Pecio Reviewed-by: Ricardo Ribalda Reviewed-by: Laurent Pinchart Link: https://lore.kernel.org/r/20240414190040.2255a0bc@foxbook Signed-off-by: Laurent Pinchart Signed-off-by: Sasha Levin --- drivers/media/usb/uvc/uvc_video.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c index 011e09d5e426a..926127a44c7dd 100644 --- a/drivers/media/usb/uvc/uvc_video.c +++ b/drivers/media/usb/uvc/uvc_video.c @@ -212,13 +212,13 @@ static void uvc_fixup_video_ctrl(struct uvc_streaming *stream, * Compute a bandwidth estimation by multiplying the frame * size by the number of video frames per second, divide the * result by the number of USB frames (or micro-frames for - * high-speed devices) per second and add the UVC header size - * (assumed to be 12 bytes long). + * high- and super-speed devices) per second and add the UVC + * header size (assumed to be 12 bytes long). */ bandwidth = frame->wWidth * frame->wHeight / 8 * format->bpp; bandwidth *= 10000000 / interval + 1; bandwidth /= 1000; - if (stream->dev->udev->speed == USB_SPEED_HIGH) + if (stream->dev->udev->speed >= USB_SPEED_HIGH) bandwidth /= 8; bandwidth += 12; -- 2.43.0