From patchwork Wed Mar 8 14:05:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 95041 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp2365832qgd; Wed, 8 Mar 2017 06:08:40 -0800 (PST) X-Received: by 10.84.141.1 with SMTP id 1mr9110652plu.178.1488982120353; Wed, 08 Mar 2017 06:08:40 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k80si3353641pfk.272.2017.03.08.06.08.40; Wed, 08 Mar 2017 06:08:40 -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=pass header.i=@ti.com; 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=pass (p=NONE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753537AbdCHOIj (ORCPT + 25 others); Wed, 8 Mar 2017 09:08:39 -0500 Received: from lelnx194.ext.ti.com ([198.47.27.80]:32730 "EHLO lelnx194.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753030AbdCHOIh (ORCPT ); Wed, 8 Mar 2017 09:08:37 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id v28E5rre024843; Wed, 8 Mar 2017 08:05:53 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1488981953; bh=m8JDznlODhROY9yri/nssOZImXds+RPLb+kaAZaXpaE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=liA7rkxdKz7sOwXRMGqqP7pGA4lg3rGzHBv18Jx0bF7iD79UYi/UsSJuZK6M8fJPb 368w6SuciU4WxuEEQSvXtdx0H6jwQHlmLyU0uqaylxV87KnnpWt/SVcIuqgGQJB1m+ zZdaglQ+XTEOV4aSIWPXTsD2zyu19uHdgsZ/qJ+M= Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v28E5rPO011970; Wed, 8 Mar 2017 08:05:53 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.294.0; Wed, 8 Mar 2017 08:05:52 -0600 Received: from lta0400828d.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id v28E5jhp020527; Wed, 8 Mar 2017 08:05:50 -0600 From: Roger Quadros To: , CC: , , , , Roger Quadros Subject: [PATCH 2/2] usb: gadget: f_uvc: Sanity check wMaxPacketSize for SuperSpeed Date: Wed, 8 Mar 2017 16:05:44 +0200 Message-ID: <1488981944-28915-3-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488981944-28915-1-git-send-email-rogerq@ti.com> References: <1488981944-28915-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Roger Quadros --- drivers/usb/gadget/function/f_uvc.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.7.4 diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c index c7689d0..f8a1881 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. *