Skip to contentSkip to conversation

usb: dwc3: gadget: Report isoc transfer frame number

PATCH New Felipe Balbi 1 participant 1 message Dec 7, 2018 USB

lore
Share & tools
lore
#0 lore raw

PATCH v3 2/2 usb: dwc3: gadget: Report isoc transfer frame number

Hi,

Quoted 23 lines · Thinh Nguyen
Quoted 8 lines
Quoted 8 lines
drivers/usb/dwc3/gadget.c +0 -0
index 679c12e14522..2de563124fc1 100644
@@ -2254,6 +2254,19 @@ 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;
 
Quoted 14 lines

drivers/usb/dwc3/gadget.c static int dwc3_gadget_ep_reclaim_completed_trb(struct dwc3_ep *dep, · line 2268

Quoted 12 lines
drivers/usb/dwc3/gadget.c +12 -0
+	/*
+	 * For isochronous transfers, the first TRB in a service interval must
+	 * have the Isoc-First type. Track and report its interval frame number.
+	 */
+	if (usb_endpoint_xfer_isoc(dep->endpoint.desc) &&
+	    (trb->ctrl & DWC3_TRBCTL_ISOCHRONOUS_FIRST)) {
+		unsigned int frame_number;
+
+		frame_number = DWC3_TRB_CTRL_GET_SID_SOFN(trb->ctrl);
+		frame_number &= ~(dep->interval - 1);
+		req->request.frame_number = frame_number;
+	}

could you refresh my memory on how this is going to be used?

Quoted 3 lines

Sure. This informs the upper layer driver what interval the isoc request went out. The users can use this information for applications that require synchronization with the host.

Thanks. Do you have an example of a gadget that would use it? Perhaps g_webcam can rely on this to improve its scheduling? I have this in my testing/next already, just looking for an actual user :-)