Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4521435rwb; Tue, 6 Sep 2022 08:38:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR43wEgOZ7S9uMmOavYz47oWx+qpAzOReiKfPfQPtQdtf5mN3slgxehwNqE26XZ1dVuf67Ah X-Received: by 2002:a17:902:8d8a:b0:16f:21fb:b97a with SMTP id v10-20020a1709028d8a00b0016f21fbb97amr54136886plo.160.1662478690556; Tue, 06 Sep 2022 08:38:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662478690; cv=none; d=google.com; s=arc-20160816; b=qCgEGzTKRjMWe/UVuZ9hf/GSN6Xa6tqOQvBFLGsGIcZdMAMk0px9t2keNGY1SDmO3J m+qFJSUWg6lMJh9DSLcB+iR5K5NLvpgNE7aINwnR2y+iqEDCuvUQ7BlzqqT6F4OQIxDY SYLK4uBFPlReAzGYfdj3Dc6hblMQ6wB6jkbgww9HQXnOth8banGjNF6VfK0TRKjN7KHk BFpCk3M412nccVvdag3i90JwLItIaTcOzXARVZ4chdi+tqMqd3x6krR3467RFY04ngj1 Duh9cM3KiP+Uumml5FXsDIIK6ZYlgFb7L7XnOjRW2CbYvT2Kw7QIWxnxClECQQtaQoOG essA== 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=b5MyDjboPjfwrFkbBl10JacCgG+oyi8GZgRYQEzERBE=; b=yVIPK/iaDRuSpQ/f+O0G1nCyPMUAfYgrSJJ5dus0dVw1D71+AwveLVQWYr3EEVQOZo /0tjCeoSYgRXNQNUZ3r/f/l+gCWshQTcRZdOSItTpMLwaVjEh8VsMuIIhv5sicb3lmWX F5vrzBobGqubgo0AkBGUUE4aXLOQib+FBtYGg2GfF61pvNFtFSFZq2jna+aYn6PMjATL GsEml2H7B52z+lUhh1GIxrvr8UC6nhyp2FernyVi3vfiSUrm1z/3YmvakcNVqhmAB1oR rTwXz+HwWR9lJ9mjw5sPaUVMKSsr5kDWY6wcfhxxGg+0QiRqTl+7Ej6kZMSIgBLfmIip XfCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tMmuPuQz; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f8-20020a636a08000000b00431588a5120si13086952pgc.183.2022.09.06.08.37.59; Tue, 06 Sep 2022 08:38:10 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=tMmuPuQz; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241612AbiIFOQ1 (ORCPT + 99 others); Tue, 6 Sep 2022 10:16:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241440AbiIFOND (ORCPT ); Tue, 6 Sep 2022 10:13:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 351B986B7E; Tue, 6 Sep 2022 06:48:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CE44861548; Tue, 6 Sep 2022 13:47:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE321C433C1; Tue, 6 Sep 2022 13:47:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662472079; bh=Gfywe9qxq7daSu4zk1d5hkH3EOrwQyHSFDW+d/FZwBY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tMmuPuQz+UyrGtg2FoXZWzp8fajFL4P//gDBbNzD6K0Leyg/mxUiqzwGt6ZDleukd XvOAF9DkC+uCmL5iHcaJ/9eavA1sliqGxZdRSm3mffxqkt4ZhesfRUcLvVj/GBDuF0 Jsa4xhvsJbHojdDNMpzMjGtR7T/XFslSweugg1yM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Jing Leng , Jack Pham Subject: [PATCH 5.19 133/155] usb: gadget: f_uac2: fix superspeed transfer Date: Tue, 6 Sep 2022 15:31:21 +0200 Message-Id: <20220906132835.085790305@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220906132829.417117002@linuxfoundation.org> References: <20220906132829.417117002@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 From: Jing Leng commit f511aef2ebe5377d4c263842f2e0c0b8e274e8e5 upstream. On page 362 of the USB3.2 specification ( https://usb.org/sites/default/files/usb_32_20210125.zip), The 'SuperSpeed Endpoint Companion Descriptor' shall only be returned by Enhanced SuperSpeed devices that are operating at Gen X speed. Each endpoint described in an interface is followed by a 'SuperSpeed Endpoint Companion Descriptor'. If users use SuperSpeed UDC, host can't recognize the device if endpoint doesn't have 'SuperSpeed Endpoint Companion Descriptor' followed. Currently in the uac2 driver code: 1. ss_epout_desc_comp follows ss_epout_desc; 2. ss_epin_fback_desc_comp follows ss_epin_fback_desc; 3. ss_epin_desc_comp follows ss_epin_desc; 4. Only ss_ep_int_desc endpoint doesn't have 'SuperSpeed Endpoint Companion Descriptor' followed, so we should add it. Fixes: eaf6cbe09920 ("usb: gadget: f_uac2: add volume and mute support") Cc: stable Signed-off-by: Jing Leng Signed-off-by: Jack Pham Link: https://lore.kernel.org/r/20220721014815.14453-1-quic_jackp@quicinc.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/function/f_uac2.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) --- a/drivers/usb/gadget/function/f_uac2.c +++ b/drivers/usb/gadget/function/f_uac2.c @@ -291,6 +291,12 @@ static struct usb_endpoint_descriptor ss .bInterval = 4, }; +static struct usb_ss_ep_comp_descriptor ss_ep_int_desc_comp = { + .bLength = sizeof(ss_ep_int_desc_comp), + .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, + .wBytesPerInterval = cpu_to_le16(6), +}; + /* Audio Streaming OUT Interface - Alt0 */ static struct usb_interface_descriptor std_as_out_if0_desc = { .bLength = sizeof std_as_out_if0_desc, @@ -604,7 +610,8 @@ static struct usb_descriptor_header *ss_ (struct usb_descriptor_header *)&in_feature_unit_desc, (struct usb_descriptor_header *)&io_out_ot_desc, - (struct usb_descriptor_header *)&ss_ep_int_desc, + (struct usb_descriptor_header *)&ss_ep_int_desc, + (struct usb_descriptor_header *)&ss_ep_int_desc_comp, (struct usb_descriptor_header *)&std_as_out_if0_desc, (struct usb_descriptor_header *)&std_as_out_if1_desc, @@ -800,6 +807,7 @@ static void setup_headers(struct f_uac2_ struct usb_ss_ep_comp_descriptor *epout_desc_comp = NULL; struct usb_ss_ep_comp_descriptor *epin_desc_comp = NULL; struct usb_ss_ep_comp_descriptor *epin_fback_desc_comp = NULL; + struct usb_ss_ep_comp_descriptor *ep_int_desc_comp = NULL; struct usb_endpoint_descriptor *epout_desc; struct usb_endpoint_descriptor *epin_desc; struct usb_endpoint_descriptor *epin_fback_desc; @@ -827,6 +835,7 @@ static void setup_headers(struct f_uac2_ epin_fback_desc = &ss_epin_fback_desc; epin_fback_desc_comp = &ss_epin_fback_desc_comp; ep_int_desc = &ss_ep_int_desc; + ep_int_desc_comp = &ss_ep_int_desc_comp; } i = 0; @@ -855,8 +864,11 @@ static void setup_headers(struct f_uac2_ if (EPOUT_EN(opts)) headers[i++] = USBDHDR(&io_out_ot_desc); - if (FUOUT_EN(opts) || FUIN_EN(opts)) + if (FUOUT_EN(opts) || FUIN_EN(opts)) { headers[i++] = USBDHDR(ep_int_desc); + if (ep_int_desc_comp) + headers[i++] = USBDHDR(ep_int_desc_comp); + } if (EPOUT_EN(opts)) { headers[i++] = USBDHDR(&std_as_out_if0_desc);