diff mbox series

[2/2] usb: dwc3: gadget: Report isoc scheduled frame number

Message ID 9b885d62d87b297abd9832723d230d9d7f206eff.1541643786.git.thinhn@synopsys.com (mailing list archive)
State New, archived
Headers show
Series [1/2] usb: gadget: Add start_frame to usb_request | expand

Commit Message

Thinh Nguyen Nov. 8, 2018, 2:24 a.m. UTC
Report the scheduled frame number of an isochronous request.

Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
---
 drivers/usb/dwc3/gadget.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Felipe Balbi Nov. 8, 2018, 7:06 a.m. UTC | #1
Hi,

Thinh Nguyen <thinh.nguyen@synopsys.com> writes:
> Report the scheduled frame number of an isochronous request.
>
> Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
> ---
>  drivers/usb/dwc3/gadget.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 679c12e14522..34540b661592 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -2254,6 +2254,10 @@ static int dwc3_gadget_ep_reclaim_completed_trb(struct dwc3_ep *dep,
>  	if (chain && (trb->ctrl & DWC3_TRB_CTRL_HWO))
>  		trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
>  
> +	/* Report scheduled frame number for isoc transfers */
> +	if (usb_endpoint_xfer_isoc(dep->endpoint.desc))
> +		req->request.start_frame = dep->frame_number;

This doesn't work. It'll work fine for the very first TRB. But since we
use Update Transfer to add more intervals, I can see that this could
lead to wrong frame numbers being reported, no?
diff mbox series

Patch

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 679c12e14522..34540b661592 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2254,6 +2254,10 @@  static int dwc3_gadget_ep_reclaim_completed_trb(struct dwc3_ep *dep,
 	if (chain && (trb->ctrl & DWC3_TRB_CTRL_HWO))
 		trb->ctrl &= ~DWC3_TRB_CTRL_HWO;
 
+	/* Report scheduled frame number for isoc transfers */
+	if (usb_endpoint_xfer_isoc(dep->endpoint.desc))
+		req->request.start_frame = dep->frame_number;
+
 	/*
 	 * If we're dealing with unaligned size OUT transfer, we will be left
 	 * with one TRB pending in the ring. We need to manually clear HWO bit