Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp268776rwb; Fri, 18 Nov 2022 00:52:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf5uwHqC7Jx3SOeFD24uHFeWljjodDnJozq/ItZ5G2mU9p8Yxxx3TSeFAYsmlCbH2SSv9V/p X-Received: by 2002:a17:906:b08b:b0:78d:e608:f064 with SMTP id x11-20020a170906b08b00b0078de608f064mr5162918ejy.34.1668761565599; Fri, 18 Nov 2022 00:52:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668761565; cv=none; d=google.com; s=arc-20160816; b=K2AoclCr86FCRUmvbYhfmEKxKFdj81ZCHu8FNbDJzdph41X0Gv8uQFQViJfSFGTPAB q9jb/nMryQu6YxvucnjNApgmlTXyXXgE8bJx9c/W8DCOwdzoXCVeTZE1/fQuPzujvX6i nYPZmi0SZacdYMpZ/lNjVJ/H5fvGmLTpgxI7asBeEPYYRa2iVsfyWotBAWth+8r/f4Fc pttivDCTOR5BsDV7NfO9x0zeig9ovZmC0a2TFEPFh2fcpOMyJe3gBn3p136D7z1aMjYb 4sP7dH2mrXZqb7d5k9f8nBm7FycGRHHHxtRWhjucOgdgZOvWV5dtTflkJrRkcnn+8jLW Boug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=iHLUAjf4eP/2wmdRdZ8pbVX5diTV37Cg55kuRCq5aSw=; b=lmgCAOGnGSzyDwV9u/Qq5m7JHE6dW9xyyPeOFQ4pfKA27yNYgrYm1A7M2jIk6vIRh7 nMOP+ZZrqXmEKK9ylDluMMYauCzNQ4O9bjTcE9MCHC3XKWD7wqjYibDmzEvdNwIQC1hn XVPXMnB78TpqOcU6JN4/21GSpd/TksT75gCBO/lTV0NKuWQGszvgHoEDcXH3zn0eG0/2 P1L9e8GPz6qBTzAueGNf0Q5IUG0rVE7Kq8BdfkKKdb/1GbQS9wdgG0kt5t62CDvern9/ zknxTF2b5aCef9jD/nGRw/1Wq4a9GMmilHDNmxI3XlQvcm69nv/jmybvUklaKrE30VFz HQVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=JnqHtTEq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e17-20020a170906c01100b007800ee1b748si2259074ejz.953.2022.11.18.00.52.22; Fri, 18 Nov 2022 00:52:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=JnqHtTEq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241357AbiKRIVB (ORCPT + 90 others); Fri, 18 Nov 2022 03:21:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241211AbiKRIU4 (ORCPT ); Fri, 18 Nov 2022 03:20:56 -0500 Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04F1713D22 for ; Fri, 18 Nov 2022 00:20:56 -0800 (PST) Received: by mail-il1-x12f.google.com with SMTP id bp12so2187202ilb.9 for ; Fri, 18 Nov 2022 00:20:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=iHLUAjf4eP/2wmdRdZ8pbVX5diTV37Cg55kuRCq5aSw=; b=JnqHtTEqE5X+231MLBjSba97Jk60SbU2C+L+6WVXvEhuhQ0tkgif/5sCw6DKMBdO/H eTgvTIDJcxjBsLWCDVMg0aJUqHXx8kcXBshr6VN1D/xihOMJyYEaXk/l4H1dvm6rnRRM Xj78Ki1vme0IDR8N7L6DJxo2woO1LdNgXZ9YM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=iHLUAjf4eP/2wmdRdZ8pbVX5diTV37Cg55kuRCq5aSw=; b=bkKrE8jtpRZLtxapaUOuWGeHQhBdAzGLb5yOwKjxmH+ZBu15L9Ixsl+CUrBvA/urkL i+dGMNVwfhQcTtfwV2emHjqzgWFW0LZlyIsBF6tO80fzQ1LJe5v+uFyqc8jAtOfyWVho hCMiBU90kYae9blvoksWoUSM0s4zhbQRofb1fY6NBBOaaq3uW9ZS4Wax8kXka9BvazDT 0sIJRZ42bvnIi2NcUGnM+K9+aLioGGnSOmMbuRgxp9kAmMa2BzPZ5ISeHMlFBAL9oOLN 46RfXFsuDKdMSrMyEZS+OQTeNvstgPWBebOApeurIIwE1gYAa7o9OyVmKGGzkfj4YGxg OW8Q== X-Gm-Message-State: ANoB5pkAYGZvlMh39msQgyqedNNrvxmONBeu6X1NnfEwtspHAtACPRBY qmps4aUzE5Z243KAnfs8TL4DLwoTxkBRhw== X-Received: by 2002:a92:6e0a:0:b0:302:4d37:9e69 with SMTP id j10-20020a926e0a000000b003024d379e69mr2829744ilc.160.1668759655127; Fri, 18 Nov 2022 00:20:55 -0800 (PST) Received: from mail-io1-f42.google.com (mail-io1-f42.google.com. [209.85.166.42]) by smtp.gmail.com with ESMTPSA id m11-20020a0566022e8b00b0068869b84b02sm1152203iow.21.2022.11.18.00.20.53 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 18 Nov 2022 00:20:54 -0800 (PST) Received: by mail-io1-f42.google.com with SMTP id h206so3297174iof.10 for ; Fri, 18 Nov 2022 00:20:53 -0800 (PST) X-Received: by 2002:a02:9422:0:b0:373:2c18:a37e with SMTP id a31-20020a029422000000b003732c18a37emr2722013jai.51.1668759653340; Fri, 18 Nov 2022 00:20:53 -0800 (PST) MIME-Version: 1.0 References: <20221118022302.112121-1-aichao@kylinos.cn> In-Reply-To: From: Ricardo Ribalda Date: Fri, 18 Nov 2022 09:20:42 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3] media: uvcvideo: Fix bandwidth error for Alcor camera To: Ai Chao Cc: laurent.pinchart@ideasonboard.com, mchehab@kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 18 Nov 2022 at 09:15, Ricardo Ribalda wrote: > > Hi Ai > > Thanks for your patch! > > On Fri, 18 Nov 2022 at 03:23, Ai Chao wrote: > > > > For Alcor Corp. Slave camera(1b17:6684/2017:0011), it support to > > output compressed video data, and it return a wrong > > dwMaxPayloadTransferSize fields. This is a fireware issue, > s/fireware/firmware/ > > but the manufacturer cannot provide a const return fields > > by the fireware. For some device, device requested 2752512 > > B/frame bandwidth. For some device, device requested 3072 > > B/frame bandwidth. so we check the dwMaxPayloadTransferSize > > fields,if it large than 0x1000, reset dwMaxPayloadTransferSize > > to 1024, and the camera preview normally. > > 3072 is smaller than 0x1000. > > It is ok to have values between 1024 and 0x1000 (4096) ? > > Thanks > > > > > Signed-off-by: Ai Chao > > > > --- > > change for v3 > > - Add VID/PID 2017:0011 > > > > change for v2 > > - Used usb_match_one_id to check VID and PID > > --- > > --- > > drivers/media/usb/uvc/uvc_video.c | 11 +++++++++++ > > 1 file changed, 11 insertions(+) > > > > diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c > > index d2eb9066e4dc..1260800ef8bd 100644 > > --- a/drivers/media/usb/uvc/uvc_video.c > > +++ b/drivers/media/usb/uvc/uvc_video.c > > @@ -135,6 +135,10 @@ static void uvc_fixup_video_ctrl(struct uvc_streaming *stream, > > static const struct usb_device_id elgato_cam_link_4k = { > > USB_DEVICE(0x0fd9, 0x0066) > > }; > > + static const struct usb_device_id alcor_corp_slave_cam = { > > + USB_DEVICE(0x1b17, 0x6684), > > + USB_DEVICE(0x2017, 0x0011), > > + }; > > struct uvc_format *format = NULL; > > struct uvc_frame *frame = NULL; > > unsigned int i; > > @@ -234,6 +238,13 @@ 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) && > > + usb_match_one_id(stream->dev->intf, &alcor_corp_slave_cam)) { You cannot use usb_match_one_id when you have multiple ids. Use usb_match_id (add add the sentinel at the end of the list) > > + ctrl->dwMaxPayloadTransferSize = 1024; > > + } > > } > > > > static size_t uvc_video_ctrl_size(struct uvc_streaming *stream) > > -- > > 2.25.1 > > > > > -- > Ricardo Ribalda -- Ricardo Ribalda