Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5583408pxb; Mon, 14 Feb 2022 02:38:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJxHPBLZmunO8tbH8fWZnLm03iB32m/6u5XyKB9bTLpVTmeJrkT7W5ff3GsBCntS2vckV8eP X-Received: by 2002:a05:6402:1288:: with SMTP id w8mr1067498edv.134.1644835107888; Mon, 14 Feb 2022 02:38:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644835107; cv=none; d=google.com; s=arc-20160816; b=p0atE0XpDAlB5I6MPsqBbarGQ4H2BcCKCPjkuOaolXefq10p34RPgIGVfonMidoK3H R4KpsBIdIVvo+zG5oekadSvd/j5uqIwczmd6exB++eBkI9uKtrpgIkhJax1lUzNTfloI WODIa9FigmG0TibnmyQN1oRdvlU72pTGA6ggKON/FldP8TfAuhh1XVTME1P0+/7hRIPm waL59sFHSjl79AcZxPFoWJoW7tuHLwGUCmAIn3V1DrQjjhZxcSIGHc4BHQcP4OBfjBqP tMl1Rpe6H72pVm28cH4YHUNJRNQICln/jpIpLQlENl7rGeESoFMcC4sleSytI1oEjsmM 2qYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=gw8VxXJYxZDm2LF/DqlxepTlElp0sOwEbMxUMCoLNc4=; b=Pp8PO+j4u5B1OQnyVZ+XZoA+9cnlrz+86I5cpfu09Ok+qvjICqvYQADLzodwjofTp9 ZfhuvSggRp0dUigQOH9m5cSsTBUEMMHJzMJfJnuqcUEWpOVsffr+SexvoC6g3ViJovm7 GuHejJR1KvAVE7/iHanjol58XUzxSA/yPeyB5K1bUpcVAMajtKWQlsHLffTJc7adpWuf 9Sj3CITVoHarGFzkidhaTtPLqBgHqL+6MT9ADw+ujS05rm1CYk4K/Vy6msXxqJbWnq3p c7Gzxbg3b0SVLiB0WzXAleD1O2l47Q0G0S3bMIHEAZC6+6ETYf7jXAW7hTVGSwmM8TAH IRDA== 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 go31si9303302ejc.467.2022.02.14.02.38.05; Mon, 14 Feb 2022 02:38:27 -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 S240549AbiBNFxD (ORCPT + 99 others); Mon, 14 Feb 2022 00:53:03 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231709AbiBNFxC (ORCPT ); Mon, 14 Feb 2022 00:53:02 -0500 X-Greylist: delayed 8768 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sun, 13 Feb 2022 21:52:52 PST Received: from zg8tmty1ljiyny4xntqumjca.icoremail.net (zg8tmty1ljiyny4xntqumjca.icoremail.net [165.227.154.27]) by lindbergh.monkeyblade.net (Postfix) with SMTP id B871C5004F; Sun, 13 Feb 2022 21:52:52 -0800 (PST) Received: from jleng.ambarella.net (unknown [180.169.129.130]) by mail-app3 (Coremail) with SMTP id cC_KCgBXHlAa7gliTn84DQ--.59543S2; Mon, 14 Feb 2022 13:52:30 +0800 (CST) From: 3090101217@zju.edu.cn To: laurent.pinchart@ideasonboard.com, balbi@kernel.org, gregkh@linuxfoundation.org Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Jing Leng Subject: [PATCH] usb: gadget: f_uvc: fix superspeedplus transfer Date: Mon, 14 Feb 2022 13:52:24 +0800 Message-Id: <20220214055224.18075-1-3090101217@zju.edu.cn> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: cC_KCgBXHlAa7gliTn84DQ--.59543S2 X-Coremail-Antispam: 1UD129KBjvJXoW7CFWrGFWrAFy5AryUKrWxZwb_yoW8tF13pa 15A3Z5ArW5JFs5J34UAan5Cry3Xa1Sva1DKFZFq3yY9r4ftas5Ar92yryFga47XF43Zr40 yFs3J3ySkw1jkr7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUBqb7Iv0xC_Cr1lb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rw A2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xII jxv20xvEc7CjxVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwV C2z280aVCY1x0267AKxVW0oVCq3wAac4AC62xK8xCEY4vEwIxC4wAac4AC6xC2jxv24VCS YI8q64vIFxWle2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2 WlYx0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkE bVWUJVW8JwACjcxG0xvY0x0EwIxGrwAKzVCY07xG64k0F24lc2xSY4AK67AK6r4rMxAIw2 8IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4l x2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWUtwCIc40Y0x0EwIxGrw CI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwCI 42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z2 80aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7IU8NTmDUUUUU== X-CM-SenderInfo: qtqziiyqrsilo62m3hxhgxhubq/1tbiAwQRBVNG3FHYyQAJsT X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, 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 UVC driver doesn't set ssp_descriptors in struct usb_function, If we use ssp UDC (e.g. cdnsp), UVC doesn't work. Signed-off-by: Jing Leng --- drivers/usb/gadget/function/f_uvc.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c index 71bb5e477dba..8fc9b035481e 100644 --- a/drivers/usb/gadget/function/f_uvc.c +++ b/drivers/usb/gadget/function/f_uvc.c @@ -478,6 +478,7 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed) void *mem; switch (speed) { + case USB_SPEED_SUPER_PLUS: case USB_SPEED_SUPER: uvc_control_desc = uvc->desc.ss_control; uvc_streaming_cls = uvc->desc.ss_streaming; @@ -521,7 +522,7 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed) + uvc_control_ep.bLength + uvc_control_cs_ep.bLength + uvc_streaming_intf_alt0.bLength; - if (speed == USB_SPEED_SUPER) { + if (speed == USB_SPEED_SUPER || speed == USB_SPEED_SUPER_PLUS) { bytes += uvc_ss_control_comp.bLength; n_desc = 6; } else { @@ -565,7 +566,7 @@ uvc_copy_descriptors(struct uvc_device *uvc, enum usb_device_speed speed) uvc_control_header->baInterfaceNr[0] = uvc->streaming_intf; UVC_COPY_DESCRIPTOR(mem, dst, &uvc_control_ep); - if (speed == USB_SPEED_SUPER) + if (speed == USB_SPEED_SUPER || speed == USB_SPEED_SUPER_PLUS) UVC_COPY_DESCRIPTOR(mem, dst, &uvc_ss_control_comp); UVC_COPY_DESCRIPTOR(mem, dst, &uvc_control_cs_ep); @@ -727,6 +728,15 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f) } } + if (gadget_is_superspeed_plus(c->cdev->gadget)) { + f->ssp_descriptors = uvc_copy_descriptors(uvc, USB_SPEED_SUPER_PLUS); + if (IS_ERR(f->ssp_descriptors)) { + ret = PTR_ERR(f->ssp_descriptors); + f->ssp_descriptors = NULL; + goto error; + } + } + /* Preallocate control endpoint request. */ uvc->control_req = usb_ep_alloc_request(cdev->gadget->ep0, GFP_KERNEL); uvc->control_buf = kmalloc(UVC_MAX_REQUEST_SIZE, GFP_KERNEL); -- 2.17.1