linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ai Chao <aichao@kylinos.cn>
To: laurent.pinchart@ideasonboard.com, mchehab@kernel.org
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	aichao@kylinos.cn
Subject: [PATCH] media: uvcvideo: Fix bandwidth error for Alcor camera
Date: Thu, 10 Nov 2022 16:12:59 +0800	[thread overview]
Message-ID: <20221110081259.947269-1-aichao@kylinos.cn> (raw)

For Alcor Corp. Slave camera(1b17:6684), it support to
output compressed video data, and it return a wrong
 dwMaxPayloadTransferSize fields. This is a fireware issue,
but the manufacturer cannot provide a const return fields
by the fireware. so we check the dwMaxPayloadTransferSize fields,
if it large than 0x1000, reset dwMaxPayloadTransferSize to 1024.

Signed-off-by: Ai Chao <aichao@kylinos.cn>
---
 drivers/media/usb/uvc/uvc_video.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
index d2eb9066e4dc..49226c3f423c 100644
--- a/drivers/media/usb/uvc/uvc_video.c
+++ b/drivers/media/usb/uvc/uvc_video.c
@@ -234,6 +234,14 @@ static void uvc_fixup_video_ctrl(struct uvc_streaming *stream,
 
 		ctrl->dwMaxPayloadTransferSize = bandwidth;
 	}
+
+	/*Alcor Corp. Slave camera return wrong dwMaxPayloadTransferSize*/
+	if ((format->flags & UVC_FMT_FLAG_COMPRESSED) &&
+	    (ctrl->dwMaxPayloadTransferSize > 0x1000) &&
+	    (le16_to_cpu(stream->dev->udev->descriptor.idVendor) == 0x1b17) &&
+	    (le16_to_cpu(stream->dev->udev->descriptor.idProduct) == 0x6684)) {
+		ctrl->dwMaxPayloadTransferSize = 1024;
+	}
 }
 
 static size_t uvc_video_ctrl_size(struct uvc_streaming *stream)
-- 
2.25.1


             reply	other threads:[~2022-11-10  8:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-10  8:12 Ai Chao [this message]
2022-11-10 10:41 ` [PATCH] media: uvcvideo: Fix bandwidth error for Alcor camera Ricardo Ribalda
2022-11-12  1:19 Ai Chao
2022-11-13 18:35 ` Ricardo Ribalda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221110081259.947269-1-aichao@kylinos.cn \
    --to=aichao@kylinos.cn \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).