From patchwork Wed Dec 13 01:58:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Levin, Alexander \(Sasha Levin\)" X-Patchwork-Id: 121712 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4906329qgn; Tue, 12 Dec 2017 18:27:20 -0800 (PST) X-Google-Smtp-Source: ACJfBosDa+EhvArv+CeeS4FE8kFncc6LzlK7b8XietCxqoOlZ2h+5Oro3k+9aFnUBMntB3A2BKgF X-Received: by 10.98.15.29 with SMTP id x29mr4302483pfi.232.1513132040259; Tue, 12 Dec 2017 18:27:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513132040; cv=none; d=google.com; s=arc-20160816; b=aEg/3Pe22OoguScjDRO77+WfG9H21OY9Jvuh90VzC9293CGzuszol6bcMQ9zX18ZqH 53qBAbYt7mXN3/cJRVg2gpz38khWmdpdZknyJavHXt62mdpjAIPQut51IqGcLmniMkKw U+LgybZV4rLVMFMFRTDpPw2NyVvKRwOF3lK4zADz+N3yfoLN9hZhcqV+CEOnmrvDsrz7 R1xpk58qM3gQuWLzMPfrll3C6tPimYKmmxPOH9Nh3+xMBGQ8XRD7KEm/lw7MeQGEDJz/ DjzrnGPCkA/uEBAKO3A3kxQXoLw8Faj/lzSh8N53YaBJbDzjyPMgavriO5iFyJnaCccT mEBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:to:cc:from:dkim-signature :dkim-signature:dkim-signature:arc-authentication-results; bh=smGfVVaRN5yqe3wQgISFv1wd9lo36MwAmWyBQjYXAes=; b=FvI2AkqlUeq6t6L7J3Pbu5MkaLpYTjEHBIa0sFx212Hh6+5HGPY4wrVKCnFLO5/Yw1 DQjoJi6OE2HV2WcE1j8G+Nn2sZUd/rNNUd3xOryNHeirYM14OeviZgmASzVEzJzC3Ttc N8vtVl7LAtCc2kUbXxdMuLonaDpSODuzRM+7BhbO8gpmvjFrFtnbf9bxVyK61x99gqZZ JHJehtGWVIs4abmMvLJa4fVM4NY25gRunpGGuM/bs4nZXuy5gfh3FoHxZTHgC50BTo1d 8yczYezCflKMHA80g9WpIgRxu4C2sGu1cX/WOxQ4PDAkxmHsx9rAoB85cXuwRfouGnTI hBTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@verizon.com header.s=corp header.b=Y0FwX1SQ; dkim=fail header.i=@verizon.com header.s=corp header.b=CWzqfv0F; dkim=fail header.i=@verizon.com header.s=corp header.b=IF3FmCwJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=verizon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y20si482641pfa.158.2017.12.12.18.27.20; Tue, 12 Dec 2017 18:27:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@verizon.com header.s=corp header.b=Y0FwX1SQ; dkim=fail header.i=@verizon.com header.s=corp header.b=CWzqfv0F; dkim=fail header.i=@verizon.com header.s=corp header.b=IF3FmCwJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=verizon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752752AbdLMC1Q (ORCPT + 11 others); Tue, 12 Dec 2017 21:27:16 -0500 Received: from omzsmtpe01.verizonbusiness.com ([199.249.25.210]:35576 "EHLO omzsmtpe01.verizonbusiness.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752887AbdLMCAX (ORCPT ); Tue, 12 Dec 2017 21:00:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1513130423; x=1544666423; h=from:cc:to:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=BpMT5s1xg91Ju7KkYtSIeZaeeodl64HJm4Vn6V6LbBg=; b=Y0FwX1SQXqgUm7eztGocNzTKFoxTNv3j5NSk5fkqwVbVz4G3+3jEYhYh eoEYh6YbjASWswvIfY8fkNv44/oCzIT9GZx2+sz2phAjTuAK+H1HsnMbe eYBHvAcqwWkXAutI846+0uNnz3DDV+6LXahaq1d3xxtxlkljAqLh6VPSL A=; Received: from unknown (HELO fldsmtpi01.verizon.com) ([166.68.71.143]) by omzsmtpe01.verizonbusiness.com with ESMTP; 13 Dec 2017 02:00:18 +0000 Received: from rogue-10-255-192-101.rogue.vzwcorp.com (HELO atlantis.verizonwireless.com) ([10.255.192.101]) by fldsmtpi01.verizon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Dec 2017 01:59:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1513130385; x=1544666385; h=from:cc:to:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=BpMT5s1xg91Ju7KkYtSIeZaeeodl64HJm4Vn6V6LbBg=; b=CWzqfv0F5oEG7KbvYqgCHZj9Xhq7NoQchYJeGKQKtCDycqJDJ9yw/KQb FuyoYsc9VfrybdXvpOi3HxykPM641gvooyZIuafFizNJ5IE+gGGhVHcz4 NgMFuLMU8DPtRMTUhCt/1juErxDUzZXzE7akf2Z/vPCoYMaKLbTFHCpqP Q=; Received: from mariner.tdc.vzwcorp.com (HELO eris.verizonwireless.com) ([10.254.88.84]) by atlantis.verizonwireless.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 12 Dec 2017 20:59:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=verizon.com; i=@verizon.com; q=dns/txt; s=corp; t=1513130383; x=1544666383; h=to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version:from:cc; bh=BpMT5s1xg91Ju7KkYtSIeZaeeodl64HJm4Vn6V6LbBg=; b=IF3FmCwJY7d5u5FNlXVI99WFxa9bmpqzj/dJ78w/6ATEGj3no/LFfYHM Zkab5vj1r6lo3fs7VAVHkOIsQEDSQs/yHH0AME9ZuSjvV5KC/mtYMhKxS pH1KCfWGd6rNYg7T1D7LxWr4JemhoJ4Qmov2l4e1RvypB/Ao28XEp7drC M=; From: alexander.levin@verizon.com Cc: Roger Quadros , Felipe Balbi , alexander.levin@verizon.com X-Host: mariner.tdc.vzwcorp.com Received: from ohtwi1exh002.uswin.ad.vzwcorp.com ([10.144.218.44]) by eris.verizonwireless.com with ESMTP/TLS/AES128-SHA256; 13 Dec 2017 01:59:24 +0000 Received: from tbwexch01apd.uswin.ad.vzwcorp.com (153.114.162.25) by OHTWI1EXH002.uswin.ad.vzwcorp.com (10.144.218.44) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 12 Dec 2017 20:59:24 -0500 Received: from OMZP1LUMXCA13.uswin.ad.vzwcorp.com (144.8.22.188) by tbwexch01apd.uswin.ad.vzwcorp.com (153.114.162.25) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Tue, 12 Dec 2017 20:59:23 -0500 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com (144.8.22.195) by OMZP1LUMXCA13.uswin.ad.vzwcorp.com (144.8.22.188) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Tue, 12 Dec 2017 19:59:23 -0600 Received: from OMZP1LUMXCA17.uswin.ad.vzwcorp.com ([144.8.22.195]) by OMZP1LUMXCA17.uswin.ad.vzwcorp.com ([144.8.22.195]) with mapi id 15.00.1263.000; Tue, 12 Dec 2017 19:59:23 -0600 To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: [PATCH AUTOSEL for 4.4 11/59] usb: gadget: f_uvc: Sanity check wMaxPacketSize for SuperSpeed Thread-Topic: [PATCH AUTOSEL for 4.4 11/59] usb: gadget: f_uvc: Sanity check wMaxPacketSize for SuperSpeed Thread-Index: AQHTc7XeqJ2SSLCs0Uaqfmx94xZwPA== Date: Wed, 13 Dec 2017 01:58:28 +0000 Message-ID: <20171213015817.6950-11-alexander.levin@verizon.com> References: <20171213015817.6950-1-alexander.levin@verizon.com> In-Reply-To: <20171213015817.6950-1-alexander.levin@verizon.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.144.60.250] MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Roger Quadros [ Upstream commit 16bb05d98c904a4f6c5ce7e2d992299f794acbf2 ] As per USB3.0 Specification "Table 9-20. Standard Endpoint Descriptor", for interrupt and isochronous endpoints, wMaxPacketSize must be set to 1024 if the endpoint defines bMaxBurst to be greater than zero. Reviewed-by: Laurent Pinchart Signed-off-by: Roger Quadros Signed-off-by: Felipe Balbi Signed-off-by: Sasha Levin --- drivers/usb/gadget/function/f_uvc.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.11.0 diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c index c7689d05356c..f8a1881609a2 100644 --- a/drivers/usb/gadget/function/f_uvc.c +++ b/drivers/usb/gadget/function/f_uvc.c @@ -594,6 +594,14 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f) opts->streaming_maxpacket = clamp(opts->streaming_maxpacket, 1U, 3072U); opts->streaming_maxburst = min(opts->streaming_maxburst, 15U); + /* For SS, wMaxPacketSize has to be 1024 if bMaxBurst is not 0 */ + if (opts->streaming_maxburst && + (opts->streaming_maxpacket % 1024) != 0) { + opts->streaming_maxpacket = roundup(opts->streaming_maxpacket, 1024); + INFO(cdev, "overriding streaming_maxpacket to %d\n", + opts->streaming_maxpacket); + } + /* Fill in the FS/HS/SS Video Streaming specific descriptors from the * module parameters. *