From patchwork Sun Jan 14 20:35:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Pecio X-Patchwork-Id: 98615 X-Patchwork-Delegate: laurent.pinchart@ideasonboard.com Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Sun, 14 Jan 2024 20:36:06 +0000 Received: from bombadil.infradead.org [198.137.202.133] by coco.lan with IMAP (fetchmail-6.4.37) for (single-drop); Sun, 14 Jan 2024 21:36:45 +0100 (CET) Received: from am.mirrors.kernel.org ([147.75.80.249]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rP7DB-007Imv-0k for mchehab@infradead.org; Sun, 14 Jan 2024 20:36:06 +0000 Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D0E2E1F213C5 for ; Sun, 14 Jan 2024 20:35:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CB74B12E5E; Sun, 14 Jan 2024 20:35:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TFQTgoC6" X-Original-To: linux-media@vger.kernel.org Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF7EE134C2 for ; Sun, 14 Jan 2024 20:35:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-2cdae52d355so8410091fa.2 for ; Sun, 14 Jan 2024 12:35:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705264523; x=1705869323; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:subject:cc:to :from:date:from:to:cc:subject:date:message-id:reply-to; bh=fa1LVXxsDL6Dp3KB5B0+Jg/uiEcGcSlK9r/uw/MVq5Q=; b=TFQTgoC6YUzZue9GxnTPXqlnBmVkriGIT8H93P5z3d/DjVRVRAWJVPqH7Lay886+sp QwKWScYTGLW5aNo4ZGxjgglYQGtqvF9mhvkSXsZn/wKxjMIIXQD/j/sjw+ODQwpfwyOj FDQekTr3NQ/2YywuyiaOrPKpQDVCm3FHKKZSVhFywh95cD1Z0xiMVffUgo3sIXM/8znZ GKuSl4DZK9YzMJKBKMXM2+la2ytdcuH0K38vmPI/M2+/rzRYEeKEvBIuB1pwLZ4B+IPd Vya/E3Je+z/lkGfPecb3q9WtuCT+OIvCtt2hQGB1LfKzMjbmqFSV8OC2WHWgLoii9ePQ 6GlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705264523; x=1705869323; h=content-transfer-encoding:mime-version:message-id:subject:cc:to :from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fa1LVXxsDL6Dp3KB5B0+Jg/uiEcGcSlK9r/uw/MVq5Q=; b=XAujiI4qJW3DWfF31II2FdYpLgNJFyVzuQn9rSGc+1ktSo/K8QoaOH4lvuP74RnF1v cLqPn+P+SaNeTtFT133+icg6KlXBlC4JBHTwb0RlxWjwd0Mi4d/r0rlG/rYV1tz9nPCz Ad9fuEP1a5IbnQX7Zmtm4qiunhxRRCNzXFHgAXIYvc/Y3qweuNQCJ4DMLCsR0vYviJKa iX5hfXEnanaoQq/b5cdM+IjkzK2ufuYt+PSTcBSQ7NoeiKaTiFFWxmJjvZjC6l4LbA3n DcKEek9Us3Sbt21jMPQI3NNAAFmujE5uncBd7FKNtw6Qw9Xge9mAV935v3vKUWbTgbDW XN+g== X-Gm-Message-State: AOJu0YzD/kZjoZ7mjPycogr4kO0coG+sui9nxch/07qnJYi8c2lD7FqV jDLk1mUfmU+QpBf/DCQ/tRsY4XB9/VfgmQ== X-Google-Smtp-Source: AGHT+IESi58968eu0lS8tH/DOBhaLHm79JxP3GrirgyFzczuS4tbWjcHQf1HH/UX7kDnPbbQIIuMeQ== X-Received: by 2002:a2e:b742:0:b0:2cd:4ead:9103 with SMTP id k2-20020a2eb742000000b002cd4ead9103mr1844780ljo.97.1705264522569; Sun, 14 Jan 2024 12:35:22 -0800 (PST) Received: from foxbook (bff170.neoplus.adsl.tpnet.pl. [83.28.43.170]) by smtp.gmail.com with ESMTPSA id s29-20020a05651c201d00b002cd95030f93sm996064ljo.1.2024.01.14.12.35.21 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Sun, 14 Jan 2024 12:35:22 -0800 (PST) Date: Sun, 14 Jan 2024 21:35:18 +0100 From: Michal Pecio To: Laurent Pinchart Cc: linux-media@vger.kernel.org Subject: [PATCH] media: uvcvideo: extend the bandwdith quirk to USB 3.x Message-ID: <20240114213518.03e22698@foxbook> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240114_123605_617032_D60C49C0 X-CRM114-Status: GOOD ( 14.17 ) X-Spam-Score: -2.9 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: The bandwidth fixup quirk which is needed to run certain buggy cameras doesn't know that SuperSpeed exists and has the same 8 service intervals per millisecond as High Speed; hence its calculations ar [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [147.75.80.249 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [michal.pecio[at]gmail.com] 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager The bandwidth fixup quirk which is needed to run certain buggy cameras doesn't know that SuperSpeed exists and has the same 8 service intervals per millisecond as High Speed; hence its calculations are badly wrong. Assume that all speeds from HS up use 8 intervals per millisecond. No further changes are required. Updated code has been confirmed to work properly with a SuperSpeed camera, as well as some High Speed ones. Signed-off-by: Michal Pecio Reviewed-by: Ricardo Ribalda --- 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 28dde08ec6c5..4b86bef06a52 100644 --- a/drivers/media/usb/uvc/uvc_video.c +++ b/drivers/media/usb/uvc/uvc_video.c @@ -214,13 +214,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;