[PATCH] USB: FHCI: upgrade the isochronous API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch attempts to fix the isochronous API in the fhci-hcd
driver.  There are two problems with the current code:

	ed->last_iso is used but not set anywhere.  The patch changes
	its name to ed->next_iso and uses it to store the frame number
	of the next available slot in the isochronous stream.

	urb->start_frame isn't set when the URB_ISO_ASAP flag is off.
	The patch sets it to the next available slot if the stream is
	in use, or the current frame otherwise.

This won't give the right behavior when an underrun occurs, but I
don't know enough about the driver to handle that case.

Unfortunately, I don't have any way to test these changes.

Signed-off-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
CC: Anton Vorontsov <avorontsov@xxxxxxxxxxxxx>
CC: Li Yang <leoli@xxxxxxxxxxxxx>

---

[as1684]

 drivers/usb/host/fhci-sched.c |    8 ++++++--
 drivers/usb/host/fhci.h       |    2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

Index: usb-3.9/drivers/usb/host/fhci-sched.c
===================================================================
--- usb-3.9.orig/drivers/usb/host/fhci-sched.c
+++ usb-3.9/drivers/usb/host/fhci-sched.c
@@ -739,9 +739,13 @@ void fhci_queue_urb(struct fhci_hcd *fhc
 	}
 
 	/* for ISO transfer calculate start frame index */
-	if (ed->mode == FHCI_TF_ISO && urb->transfer_flags & URB_ISO_ASAP)
-		urb->start_frame = ed->td_head ? ed->last_iso + 1 :
+	if (ed->mode == FHCI_TF_ISO) {
+		/* Ignore the possibility of underruns */
+		urb->start_frame = ed->td_head ? ed->next_iso :
 						 get_frame_num(fhci);
+		ed->next_iso = (urb->start_frame + urb->interval *
+				urb->number_of_packets) & 0x07ff;
+	}
 
 	/*
 	 * OHCI handles the DATA toggle itself,we just use the USB
Index: usb-3.9/drivers/usb/host/fhci.h
===================================================================
--- usb-3.9.orig/drivers/usb/host/fhci.h
+++ usb-3.9/drivers/usb/host/fhci.h
@@ -338,7 +338,7 @@ struct ed {
 
 	/* read only parameters, should be cleared upon initialization */
 	u8 toggle_carry;	/* toggle carry from the last TD submitted */
-	u32 last_iso;		/* time stamp of last queued ISO transfer */
+	u16 next_iso;		/* time stamp of next queued ISO transfer */
 	struct td *td_head;	/* a pointer to the current TD handled */
 };
 

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux