All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: f_uac2: fix superspeed transfer
@ 2022-02-14  3:26 3090101217
  2022-02-14 10:36 ` Greg KH
  2022-02-14 14:32 ` [PATCH v2] " 3090101217
  0 siblings, 2 replies; 10+ messages in thread
From: 3090101217 @ 2022-02-14  3:26 UTC (permalink / raw)
  To: balbi, gregkh, ruslan.bilovol, pavel.hofman, jbrunet, jackp,
	colin.king, pawell
  Cc: linux-usb, linux-kernel, Jing Leng

From: Jing Leng <jleng@ambarella.com>

ss_ep_int_desc endpoint doesn't have 'SuperSpeed Endpoint
Companion Descriptor', so we should add it.

Signed-off-by: Jing Leng <jleng@ambarella.com>
---
 drivers/usb/gadget/function/f_uac2.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c
index 097a709549d6..a6fc492f9148 100644
--- a/drivers/usb/gadget/function/f_uac2.c
+++ b/drivers/usb/gadget/function/f_uac2.c
@@ -282,6 +282,14 @@ 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,
+	.bMaxBurst = 0,
+	.bmAttributes = 0,
+	.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 +603,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,
@@ -657,6 +666,7 @@ static int set_ep_max_packet_size(const struct f_uac2_opts *uac2_opts,
 
 	case USB_SPEED_HIGH:
 	case USB_SPEED_SUPER:
+	case USB_SPEED_SUPER_PLUS:
 		max_size_ep = 1024;
 		factor = 8000;
 		break;
@@ -723,6 +733,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 +761,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 +790,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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] usb: gadget: f_uac2: fix superspeed transfer
  2022-02-14  3:26 [PATCH] usb: gadget: f_uac2: fix superspeed transfer 3090101217
@ 2022-02-14 10:36 ` Greg KH
  2022-02-14 14:32 ` [PATCH v2] " 3090101217
  1 sibling, 0 replies; 10+ messages in thread
From: Greg KH @ 2022-02-14 10:36 UTC (permalink / raw)
  To: 3090101217
  Cc: balbi, ruslan.bilovol, pavel.hofman, jbrunet, jackp, colin.king,
	pawell, linux-usb, linux-kernel, Jing Leng

On Mon, Feb 14, 2022 at 11:26:06AM +0800, 3090101217@zju.edu.cn wrote:
> From: Jing Leng <jleng@ambarella.com>
> 
> ss_ep_int_desc endpoint doesn't have 'SuperSpeed Endpoint
> Companion Descriptor', so we should add it.

This is not a "fix" but rather a new feature.

Why does this endpoint need this descriptor?  We need a lot more
description here please.

> 
> Signed-off-by: Jing Leng <jleng@ambarella.com>
> ---
>  drivers/usb/gadget/function/f_uac2.c | 19 +++++++++++++++++--
>  1 file changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c
> index 097a709549d6..a6fc492f9148 100644
> --- a/drivers/usb/gadget/function/f_uac2.c
> +++ b/drivers/usb/gadget/function/f_uac2.c
> @@ -282,6 +282,14 @@ 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,
> +	.bMaxBurst = 0,
> +	.bmAttributes = 0,

0 is the default value if it is not defined.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2] usb: gadget: f_uac2: fix superspeed transfer
  2022-02-14  3:26 [PATCH] usb: gadget: f_uac2: fix superspeed transfer 3090101217
  2022-02-14 10:36 ` Greg KH
@ 2022-02-14 14:32 ` 3090101217
  2022-02-14 14:48   ` Greg KH
  1 sibling, 1 reply; 10+ messages in thread
From: 3090101217 @ 2022-02-14 14:32 UTC (permalink / raw)
  To: balbi, gregkh, ruslan.bilovol, pavel.hofman, jbrunet, jackp,
	colin.king, pawell
  Cc: linux-usb, linux-kernel, Jing Leng

From: Jing Leng <jleng@ambarella.com>

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 we 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 <jleng@ambarella.com>
---
 drivers/usb/gadget/function/f_uac2.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c
index 097a709549d6..a6fc492f9148 100644
--- a/drivers/usb/gadget/function/f_uac2.c
+++ b/drivers/usb/gadget/function/f_uac2.c
@@ -282,6 +282,14 @@ 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,
+	.bMaxBurst = 0,
+	.bmAttributes = 0,
+	.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 +603,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,
@@ -657,6 +666,7 @@ static int set_ep_max_packet_size(const struct f_uac2_opts *uac2_opts,
 
 	case USB_SPEED_HIGH:
 	case USB_SPEED_SUPER:
+	case USB_SPEED_SUPER_PLUS:
 		max_size_ep = 1024;
 		factor = 8000;
 		break;
@@ -723,6 +733,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 +761,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 +790,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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] usb: gadget: f_uac2: fix superspeed transfer
  2022-02-14 14:32 ` [PATCH v2] " 3090101217
@ 2022-02-14 14:48   ` Greg KH
  2022-02-17  5:55     ` [PATCH v3] " 3090101217
  0 siblings, 1 reply; 10+ messages in thread
From: Greg KH @ 2022-02-14 14:48 UTC (permalink / raw)
  To: 3090101217
  Cc: balbi, ruslan.bilovol, pavel.hofman, jbrunet, jackp, colin.king,
	pawell, linux-usb, linux-kernel, Jing Leng

On Mon, Feb 14, 2022 at 10:32:23PM +0800, 3090101217@zju.edu.cn wrote:
> From: Jing Leng <jleng@ambarella.com>
> 
> 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 we 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 <jleng@ambarella.com>
> ---
>  drivers/usb/gadget/function/f_uac2.c | 19 +++++++++++++++++--
>  1 file changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c
> index 097a709549d6..a6fc492f9148 100644
> --- a/drivers/usb/gadget/function/f_uac2.c
> +++ b/drivers/usb/gadget/function/f_uac2.c
> @@ -282,6 +282,14 @@ 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,
> +	.bMaxBurst = 0,
> +	.bmAttributes = 0,
> +	.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 +603,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,
> @@ -657,6 +666,7 @@ static int set_ep_max_packet_size(const struct f_uac2_opts *uac2_opts,
>  
>  	case USB_SPEED_HIGH:
>  	case USB_SPEED_SUPER:
> +	case USB_SPEED_SUPER_PLUS:
>  		max_size_ep = 1024;
>  		factor = 8000;
>  		break;
> @@ -723,6 +733,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 +761,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 +790,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
> 

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- You sent multiple patches, yet no indication of which ones should be
  applied in which order.  Greg could just guess, but if you are
  receiving this email, he guessed wrong and the patches didn't apply.
  Please read the section entitled "The canonical patch format" in the
  kernel file, Documentation/SubmittingPatches for a description of how
  to do this so that Greg has a chance to apply these correctly.

- This looks like a new version of a previously submitted patch, but you
  did not list below the --- line any changes from the previous version.
  Please read the section entitled "The canonical patch format" in the
  kernel file, Documentation/SubmittingPatches for what needs to be done
  here to properly describe this.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v3] usb: gadget: f_uac2: fix superspeed transfer
  2022-02-14 14:48   ` Greg KH
@ 2022-02-17  5:55     ` 3090101217
  2022-02-17  6:10       ` Jing Leng
  0 siblings, 1 reply; 10+ messages in thread
From: 3090101217 @ 2022-02-17  5:55 UTC (permalink / raw)
  To: gregkh, balbi, colin.king, jackp, jbrunet, pavel.hofman, pawell,
	ruslan.bilovol
  Cc: linux-kernel, linux-usb, Jing Leng

From: Jing Leng <jleng@ambarella.com>

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 <jleng@ambarella.com>
---
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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v3] usb: gadget: f_uac2: fix superspeed transfer
  2022-02-17  5:55     ` [PATCH v3] " 3090101217
@ 2022-02-17  6:10       ` Jing Leng
  2022-02-17 15:24         ` Greg KH
  0 siblings, 1 reply; 10+ messages in thread
From: Jing Leng @ 2022-02-17  6:10 UTC (permalink / raw)
  To: gregkh
  Cc: linux-kernel, linux-usb, Jing Leng, ruslan.bilovol, jbrunet,
	pavel.hofman, pawell, jackp, balbi, colin.king

Hi Greg KH,

1. Old version kernel can support superspeed transfer, the problem
was introduced by the following modification:
 commit eaf6cbe0992052a46d93047dc122fad5126aa3bd
 Author: Ruslan Bilovol <ruslan.bilovol@gmail.com>
 Date:   Mon Jul 12 14:55:28 2021 +0200
 
     usb: gadget: f_uac2: add volume and mute support

2. Only ss_ep_int_desc endpoint doesn't have 'SuperSpeed Endpoint
Companion Descriptor' followed (All other endpoints have it).

So it is a bugfix rather than a feature.

Thanks,
Jing Leng

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v3] usb: gadget: f_uac2: fix superspeed transfer
  2022-02-17  6:10       ` Jing Leng
@ 2022-02-17 15:24         ` Greg KH
  2022-02-18  9:59           ` [PATCH v4] " 3090101217
  0 siblings, 1 reply; 10+ messages in thread
From: Greg KH @ 2022-02-17 15:24 UTC (permalink / raw)
  To: Jing Leng
  Cc: linux-kernel, linux-usb, Jing Leng, ruslan.bilovol, jbrunet,
	pavel.hofman, pawell, jackp, balbi, colin.king

On Thu, Feb 17, 2022 at 02:10:10PM +0800, Jing Leng wrote:
> Hi Greg KH,
> 
> 1. Old version kernel can support superspeed transfer, the problem
> was introduced by the following modification:
>  commit eaf6cbe0992052a46d93047dc122fad5126aa3bd
>  Author: Ruslan Bilovol <ruslan.bilovol@gmail.com>
>  Date:   Mon Jul 12 14:55:28 2021 +0200
>  
>      usb: gadget: f_uac2: add volume and mute support

Then put this as a Fixes: tag in the changelog text like the
documentation asks to.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v4] usb: gadget: f_uac2: fix superspeed transfer
  2022-02-17 15:24         ` Greg KH
@ 2022-02-18  9:59           ` 3090101217
  2022-07-21  0:26             ` Jack Pham
  0 siblings, 1 reply; 10+ messages in thread
From: 3090101217 @ 2022-02-18  9:59 UTC (permalink / raw)
  To: gregkh
  Cc: balbi, colin.king, jackp, jbrunet, jleng, pavel.hofman, pawell,
	ruslan.bilovol, linux-kernel, linux-usb

From: Jing Leng <jleng@ambarella.com>

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")
Signed-off-by: Jing Leng <jleng@ambarella.com>
---
ChangeLog v3->v4:
- Add "Fixes:" tag in the changelog area
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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v4] usb: gadget: f_uac2: fix superspeed transfer
  2022-02-18  9:59           ` [PATCH v4] " 3090101217
@ 2022-07-21  0:26             ` Jack Pham
  2022-07-27 12:14               ` Greg KH
  0 siblings, 1 reply; 10+ messages in thread
From: Jack Pham @ 2022-07-21  0:26 UTC (permalink / raw)
  To: 3090101217
  Cc: gregkh, balbi, colin.king, jbrunet, jleng, pavel.hofman, pawell,
	ruslan.bilovol, linux-kernel, linux-usb

Hi Greg,

On Fri, Feb 18, 2022 at 05:59:48PM +0800, 3090101217@zju.edu.cn wrote:
> From: Jing Leng <jleng@ambarella.com>
> 
> 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")
> Signed-off-by: Jing Leng <jleng@ambarella.com>
> ---
> ChangeLog v3->v4:
> - Add "Fixes:" tag in the changelog area
> 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

I don't see this patch in any of your trees, so I'm assuming it must not
have made it into your inbox.  If that's the case I would like to
resubmit on Jing's behalf as it does fix a legitimate issue with
enabling the UAC2 gadget in SuperSpeed.

Jack

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v4] usb: gadget: f_uac2: fix superspeed transfer
  2022-07-21  0:26             ` Jack Pham
@ 2022-07-27 12:14               ` Greg KH
  0 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2022-07-27 12:14 UTC (permalink / raw)
  To: Jack Pham
  Cc: 3090101217, balbi, colin.king, jbrunet, jleng, pavel.hofman,
	pawell, ruslan.bilovol, linux-kernel, linux-usb

On Wed, Jul 20, 2022 at 05:26:59PM -0700, Jack Pham wrote:
> Hi Greg,
> 
> On Fri, Feb 18, 2022 at 05:59:48PM +0800, 3090101217@zju.edu.cn wrote:
> > From: Jing Leng <jleng@ambarella.com>
> > 
> > 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")
> > Signed-off-by: Jing Leng <jleng@ambarella.com>
> > ---
> > ChangeLog v3->v4:
> > - Add "Fixes:" tag in the changelog area
> > 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
> 
> I don't see this patch in any of your trees, so I'm assuming it must not
> have made it into your inbox.  If that's the case I would like to
> resubmit on Jing's behalf as it does fix a legitimate issue with
> enabling the UAC2 gadget in SuperSpeed.

Thank you.  Reviewing the other patches sent by this author would also
be greatly appreciated as I have not accepted them due to them no one
else speaking up.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-07-27 12:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-14  3:26 [PATCH] usb: gadget: f_uac2: fix superspeed transfer 3090101217
2022-02-14 10:36 ` Greg KH
2022-02-14 14:32 ` [PATCH v2] " 3090101217
2022-02-14 14:48   ` Greg KH
2022-02-17  5:55     ` [PATCH v3] " 3090101217
2022-02-17  6:10       ` Jing Leng
2022-02-17 15:24         ` Greg KH
2022-02-18  9:59           ` [PATCH v4] " 3090101217
2022-07-21  0:26             ` Jack Pham
2022-07-27 12:14               ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.