Commit f467ff4c7dd736b4a3c7e715efed763c0b021838

Authored by Alan Stern
Committed by Greg Kroah-Hartman
1 parent 9db33f3174

USB: FHCI: upgrade the isochronous API

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@rowland.harvard.edu>
CC: Anton Vorontsov <avorontsov@ru.mvista.com>
CC: Li Yang <leoli@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 2 changed files with 7 additions and 3 deletions Side-by-side Diff

drivers/usb/host/fhci-sched.c
... ... @@ -739,9 +739,13 @@
739 739 }
740 740  
741 741 /* for ISO transfer calculate start frame index */
742   - if (ed->mode == FHCI_TF_ISO && urb->transfer_flags & URB_ISO_ASAP)
743   - urb->start_frame = ed->td_head ? ed->last_iso + 1 :
  742 + if (ed->mode == FHCI_TF_ISO) {
  743 + /* Ignore the possibility of underruns */
  744 + urb->start_frame = ed->td_head ? ed->next_iso :
744 745 get_frame_num(fhci);
  746 + ed->next_iso = (urb->start_frame + urb->interval *
  747 + urb->number_of_packets) & 0x07ff;
  748 + }
745 749  
746 750 /*
747 751 * OHCI handles the DATA toggle itself,we just use the USB
drivers/usb/host/fhci.h
... ... @@ -338,7 +338,7 @@
338 338  
339 339 /* read only parameters, should be cleared upon initialization */
340 340 u8 toggle_carry; /* toggle carry from the last TD submitted */
341   - u32 last_iso; /* time stamp of last queued ISO transfer */
  341 + u16 next_iso; /* time stamp of next queued ISO transfer */
342 342 struct td *td_head; /* a pointer to the current TD handled */
343 343 };
344 344