Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp73111pxb; Wed, 16 Feb 2022 22:11:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJyEzsBGydQU9gAWdMbydqwcTd6/BUwoBY+2PC1bYs0muOD91m77tXlg+r3d1JVYTAgwX3VA X-Received: by 2002:a17:906:d964:b0:6ca:4019:3928 with SMTP id rp4-20020a170906d96400b006ca40193928mr1169358ejb.762.1645078264473; Wed, 16 Feb 2022 22:11:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645078264; cv=none; d=google.com; s=arc-20160816; b=vrQ6/mqQDEXS4zFaVb1Kbb5prz8fmpR1S8CKmo0TyQw7doSLE22gPhbzT5XSyhyFCO o1Bd3p/nelVV2w4MsL+kEAEUZwKzISv0n064gPt3admdbmTiVu80pyphvrol6Yf5Zdce 3SmNn7hJgc+1i/zhQvxQbxbS5RI2sIcT83y7iK5pQANOv4g8KvuupM5O4q/rVdm2A6uL 5FdQdU/S2df0OT2XPFA/F0ebxEUa5iSURNHdza6mJYZoivLZMQbwhzJDcUCZDVm3wla1 OMybXxaK/sfIB5uta7S8kz5davsr0LtmmfGIiuXUx6gmLCVFb0TiT6l3QtsWNtrqzA/A rHzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=dqAUd4bz9m+WfCsFakOdggYAH4vo44zbqzUVnqUR5WE=; b=ueN/8J2c4T621tnWm26nSWtTmzLJa4wha53LFrWhNu5XjSh81yh+0RhZy/w9Dq9Yzn UTTrls0ailBhW2Uu6u43s6a4RaWkzMELbQ1F+ABt1aAZ113DBbJYeDEQnLwV76IOnUtM T6tievjneKdUtqQjBwUBKk0iegtmouPL73la/TQFt4ZeG6/FtKY316i1vcAfCp94Pyba UzTvfNRYDag0PI+SKVeg+Tl5YdJs9gKkOBuldj/aKfXkWWwKYJxajRpcgT8xB1T6yX9D voEMBXNqhH6Gr+nPb4kGX2C7waVXY73enfBQsDzglFkXTupr7AJQyCoveHJWqPYLPcVa emIQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g17si2687892edr.427.2022.02.16.22.10.41; Wed, 16 Feb 2022 22:11:04 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234584AbiBQF4K (ORCPT + 99 others); Thu, 17 Feb 2022 00:56:10 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:35316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234540AbiBQF4I (ORCPT ); Thu, 17 Feb 2022 00:56:08 -0500 Received: from zg8tmty1ljiyny4xntqumjca.icoremail.net (zg8tmty1ljiyny4xntqumjca.icoremail.net [165.227.154.27]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 669AA295FD0; Wed, 16 Feb 2022 21:55:51 -0800 (PST) Received: from jleng.ambarella.net (unknown [180.169.129.130]) by mail-app3 (Coremail) with SMTP id cC_KCgDX3xs44w1ieUNlDQ--.15061S2; Thu, 17 Feb 2022 13:55:09 +0800 (CST) From: 3090101217@zju.edu.cn To: gregkh@linuxfoundation.org, balbi@kernel.org, colin.king@intel.com, jackp@codeaurora.org, jbrunet@baylibre.com, pavel.hofman@ivitera.com, pawell@cadence.com, ruslan.bilovol@gmail.com Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Jing Leng Subject: [PATCH v3] usb: gadget: f_uac2: fix superspeed transfer Date: Thu, 17 Feb 2022 13:55:03 +0800 Message-Id: <20220217055503.8057-1-3090101217@zju.edu.cn> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-CM-TRANSID: cC_KCgDX3xs44w1ieUNlDQ--.15061S2 X-Coremail-Antispam: 1UD129KBjvJXoWxXw1UWFWxtFykAF1UGryxAFb_yoWrJry7pw 15C39rtrW5Ar1a9a1rAr48Ar43AFWIyayYkr4Ivw1YvF4Sq34ktF1IyryYkFyDAFyjyw10 vF4jyw47u3Zrur7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUPCb7Iv0xC_tr1lb4IE77IF4wAFF20E14v26r4j6ryUM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rw A2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xII jxv20xvEc7CjxVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwV C2z280aVCY1x0267AKxVW0oVCq3wAac4AC62xK8xCEY4vEwIxC4wAac4AC6xC2jxv24VCS YI8q64vIFxWle2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2 WlYx0E2Ix0cI8IcVAFwI0_JrI_JrylYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkE bVWUJVW8JwACjcxG0xvY0x0EwIxGrwACI402YVCY1x02628vn2kIc2xKxwAKzVCY07xG64 k0F24lc2xSY4AK67AK6r4rMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4U MI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67 AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0 cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z2 80aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI 43ZEXa7IU8-txDUUUUU== X-CM-SenderInfo: qtqziiyqrsilo62m3hxhgxhubq/1tbiAwIEBVNG3FjlrQAEsd X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,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 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. Signed-off-by: Jing Leng --- ChangeLog v2->v3: - Remove static variables which are explicitly initialized to 0 - Remove redundant modification "case USB_SPEED_SUPER_PLUS:" ChangeLog v1->v2: - Update more detailed description of the PATCH --- drivers/usb/gadget/function/f_uac2.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c index 097a709549d6..b5baefe14013 100644 --- a/drivers/usb/gadget/function/f_uac2.c +++ b/drivers/usb/gadget/function/f_uac2.c @@ -282,6 +282,12 @@ static struct usb_endpoint_descriptor ss_ep_int_desc = { .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, @@ -595,7 +601,8 @@ static struct usb_descriptor_header *ss_audio_desc[] = { (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, @@ -723,6 +730,7 @@ static void setup_headers(struct f_uac2_opts *opts, 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; @@ -750,6 +758,7 @@ static void setup_headers(struct f_uac2_opts *opts, 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; @@ -778,8 +787,11 @@ static void setup_headers(struct f_uac2_opts *opts, 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); -- 2.17.1