Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp412339pxj; Thu, 20 May 2021 12:12:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxS91HucwNb9QQxftCOp61W3fmAf0KqBeL0i52fbMicdWfdBF30IchPd+hGVstxsuionlwe X-Received: by 2002:a17:906:4b19:: with SMTP id y25mr6408197eju.49.1621537978627; Thu, 20 May 2021 12:12:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621537978; cv=none; d=google.com; s=arc-20160816; b=AsbT+W1aBYnJ5uTm6Jr7yfXcUoDOEcOyNni/DXONhpM6wlyxGRgChDgb2WDTaeABAx r13zebFyDKSsD7wsRWx8qlthc5Gi8Mk3PTqpI/MugFPh0QYGtmNwJxrvSAuJZEsLPRvB yRCw7oRQYE/igatYFp83erqV9cP+oYq/cHs9lnSqqQO1VL/j2zeJhw8ulQPSgxl8dfmo cNCMkEEoFcLBbNIknpzuENwFWzx0fBEPprqAwL8NbjhzyLkfx7O50rXeu/xBHIs8wG6Q 33cLhtFhb/SCGzMbZ3aQBRHJjZzU2KcpQmfwtKDA2lRaM7WFd6mFKLfGPXvYm5hcjwvm BtRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GFylTfmBPact3IkCqQBeGGTceWtxC/S+asTqIhljESI=; b=DU9xgMM97LF+eW0/LFyhi8j/SeYC4gv0+P0dhHs9UZVSdC0leo7LrRUVTJNhyXvQ33 xNwkia7ndBS1oKCQWqzxGmwtQ2GcR5OFFksfiunIAcpvHT//PrXwI/ofJM8d8ZSKmR+9 H9oVVfbkEgtvlWd8BKlWEk/8xBi3LmU3mE/0x97mzxFyrAggHMQ009tD8OqVsHL3V/zy 8Yrhugdz9e2BgbRVQ//O5I3Y3EzicVw8pwkUWJ7lXWh6bE89rDTuR8ZW7AQ3WWgWFd/s EOhOn/ugtPAAHmCnoZA2kzkvwN6kvnyZE4/06i2uLLqKMl/+8DKUVjPVViBcR7+Y9PKg q08g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=h8Kzpban; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z26si3222305eje.396.2021.05.20.12.12.33; Thu, 20 May 2021 12:12:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=h8Kzpban; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237014AbhETK3Y (ORCPT + 99 others); Thu, 20 May 2021 06:29:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:48918 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235418AbhETKQS (ORCPT ); Thu, 20 May 2021 06:16:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D233761998; Thu, 20 May 2021 09:46:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503961; bh=TsBqVVyyjxdC9PHa8Ph95yHSL6/Vd2/seeImbmewB/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h8KzpbantkLM40TsoUPJm6ORUEW/WNbJP+6oyLY5c32KJT56h/r1G7BamwPkIvrSd wXNOo+VkhoFUjtx2oCc6yIcd0RXy1hNncqEl82RpIjcE2jE9CklEQKGG3b9cCRwjTJ GEKY/4Po2YruuZG2vyveY/n5cD+eJHL7eHLMeffc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Chen , Laurent Pinchart , Pawel Laszczak , Sasha Levin Subject: [PATCH 4.14 032/323] usb: gadget: uvc: add bInterval checking for HS mode Date: Thu, 20 May 2021 11:18:44 +0200 Message-Id: <20210520092121.217331237@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pawel Laszczak [ Upstream commit 26adde04acdff14a1f28d4a5dce46a8513a3038b ] Patch adds extra checking for bInterval passed by configfs. The 5.6.4 chapter of USB Specification (rev. 2.0) say: "A high-bandwidth endpoint must specify a period of 1x125 µs (i.e., a bInterval value of 1)." The issue was observed during testing UVC class on CV. I treat this change as improvement because we can control bInterval by configfs. Reviewed-by: Peter Chen Reviewed-by: Laurent Pinchart Signed-off-by: Pawel Laszczak Link: https://lore.kernel.org/r/20210308125338.4824-1-pawell@gli-login.cadence.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/gadget/function/f_uvc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c index f8a1881609a2..89da34ef7b3f 100644 --- a/drivers/usb/gadget/function/f_uvc.c +++ b/drivers/usb/gadget/function/f_uvc.c @@ -625,7 +625,12 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f) uvc_hs_streaming_ep.wMaxPacketSize = cpu_to_le16(max_packet_size | ((max_packet_mult - 1) << 11)); - uvc_hs_streaming_ep.bInterval = opts->streaming_interval; + + /* A high-bandwidth endpoint must specify a bInterval value of 1 */ + if (max_packet_mult > 1) + uvc_hs_streaming_ep.bInterval = 1; + else + uvc_hs_streaming_ep.bInterval = opts->streaming_interval; uvc_ss_streaming_ep.wMaxPacketSize = cpu_to_le16(max_packet_size); uvc_ss_streaming_ep.bInterval = opts->streaming_interval; -- 2.30.2