linux-stable/drivers/usb
Sarah Sharp 79abb1ab13 USB: Support for bandwidth allocation.
Originally, the USB core had no support for allocating bandwidth when a
particular configuration or alternate setting for an interface was
selected.  Instead, the device driver's URB submission would fail if
there was not enough bandwidth for a periodic endpoint.  Drivers could
work around this, by using the scatter-gather list API to guarantee
bandwidth.

This patch adds host controller API to allow the USB core to allocate or
deallocate bandwidth for an endpoint.  Endpoints are added to or dropped
from a copy of the current schedule by calling add_endpoint() or
drop_endpoint(), and then the schedule is atomically evaluated with a
call to check_bandwidth().  This allows all the endpoints for a new
configuration or alternate setting to be added at the same time that the
endpoints from the old configuration or alt setting are dropped.

Endpoints must be added to the schedule before any URBs are submitted to
them.  The HCD must be allowed to reject a new configuration or alt
setting before the control transfer is sent to the device requesting the
change.  It may reject the change because there is not enough bandwidth,
not enough internal resources (such as memory on an embedded host
controller), or perhaps even for security reasons in a virtualized
environment.

If the call to check_bandwidth() fails, the USB core must call
reset_bandwidth().  This causes the schedule to be reverted back to the
state it was in just after the last successful check_bandwidth() call.

If the call succeeds, the host controller driver (and hardware) will have
changed its internal state to match the new configuration or alternate
setting.  The USB core can then issue a control transfer to the device to
change the configuration or alt setting.  This allows the core to test new
configurations or alternate settings before unbinding drivers bound to
interfaces in the old configuration.

WIP:

The USB core must add endpoints from all interfaces in a configuration
to the schedule, because a driver may claim that interface at any time.
A slight optimization might be to add the endpoints to the schedule once
a driver claims that interface.  FIXME

This patch does not cover changing alternate settings, but it does
handle a configuration change or de-configuration.  FIXME

The code for managing the schedule is currently HCD specific.  A generic
scheduling algorithm could be added for host controllers without
built-in scheduling support.  For now, if a host controller does not
define the check_bandwidth() function, the call to
usb_hcd_check_bandwidth() will always succeed.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-06-15 21:44:49 -07:00
..
atm USB: cxacru: Fix negative dB output 2009-05-08 19:34:56 -07:00
c67x00 usb/c67x00 endianness annotations 2008-06-04 08:06:01 -07:00
class USB: usbtmc: fix switch statment 2009-06-15 21:44:48 -07:00
core USB: Support for bandwidth allocation. 2009-06-15 21:44:49 -07:00
gadget USB: atmel_usba_udc: change way of specifying bias function 2009-06-15 21:44:47 -07:00
host USB: xhci: Control transfer support. 2009-06-15 21:44:49 -07:00
image USB: replace uses of __constant_{endian} 2009-03-24 16:20:33 -07:00
misc USB: usbtest fix endless loop in unlink tests. 2009-06-15 21:44:48 -07:00
mon USB: usbmon: use the new usb debugfs directory 2009-06-15 21:44:43 -07:00
musb usb: musb: disable OTG AUTOIDLE only with omap3430 2009-06-15 21:44:46 -07:00
otg USB: Add Intel Langwell USB OTG Transceiver Drive 2009-06-15 21:44:47 -07:00
serial USB: usb-serial: replace shutdown with disconnect, release 2009-06-15 21:44:47 -07:00
storage USB: usb-storage: add filter to "option_ms" to leave unrecognized devices alone 2009-06-15 21:44:46 -07:00
wusbcore WUSB: correct format of wusb_chid sysfs file 2009-04-17 10:50:29 -07:00
Kconfig usb: return device strings in UTF-8 2009-06-15 21:44:43 -07:00
Makefile Revert "USB: Correct Makefile to make isp1760 buildable" 2009-05-28 13:54:43 -07:00
README
usb-skeleton.c USB: skeleton: Use dev_info instead of info 2009-03-24 16:20:30 -07:00

README

To understand all the Linux-USB framework, you'll use these resources:

    * This source code.  This is necessarily an evolving work, and
      includes kerneldoc that should help you get a current overview.
      ("make pdfdocs", and then look at "usb.pdf" for host side and
      "gadget.pdf" for peripheral side.)  Also, Documentation/usb has
      more information.

    * The USB 2.0 specification (from www.usb.org), with supplements
      such as those for USB OTG and the various device classes.
      The USB specification has a good overview chapter, and USB
      peripherals conform to the widely known "Chapter 9".

    * Chip specifications for USB controllers.  Examples include
      host controllers (on PCs, servers, and more); peripheral
      controllers (in devices with Linux firmware, like printers or
      cell phones); and hard-wired peripherals like Ethernet adapters.

    * Specifications for other protocols implemented by USB peripheral
      functions.  Some are vendor-specific; others are vendor-neutral
      but just standardized outside of the www.usb.org team.

Here is a list of what each subdirectory here is, and what is contained in
them.

core/		- This is for the core USB host code, including the
		  usbfs files and the hub class driver ("khubd").

host/		- This is for USB host controller drivers.  This
		  includes UHCI, OHCI, EHCI, and others that might
		  be used with more specialized "embedded" systems.

gadget/		- This is for USB peripheral controller drivers and
		  the various gadget drivers which talk to them.


Individual USB driver directories.  A new driver should be added to the
first subdirectory in the list below that it fits into.

image/		- This is for still image drivers, like scanners or
		  digital cameras.
../input/	- This is for any driver that uses the input subsystem,
		  like keyboard, mice, touchscreens, tablets, etc.
../media/	- This is for multimedia drivers, like video cameras,
		  radios, and any other drivers that talk to the v4l
		  subsystem.
../net/		- This is for network drivers.
serial/		- This is for USB to serial drivers.
storage/	- This is for USB mass-storage drivers.
class/		- This is for all USB device drivers that do not fit
		  into any of the above categories, and work for a range
		  of USB Class specified devices. 
misc/		- This is for all USB device drivers that do not fit
		  into any of the above categories.