summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <greg@kroah.com>2004-03-15 18:14:07 -0800
committerGreg Kroah-Hartman <greg@kroah.com>2004-03-15 18:14:07 -0800
commitdd471fb21291f0f302d2a8524b4bed7f36bdbdca (patch)
treec639163e4c22a581cf58727423ea1320ab978c66 /include/linux
parent1b2ed5b74904b6d1540efdd0bd08022765dc292a (diff)
parent731ea3e983eff5a364bc2c81bc91d3c4eb6d8f51 (diff)
Merge kroah.com:/home/linux/BK/bleed-2.6
into kroah.com:/home/linux/BK/usb-2.6
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/brlvger.h54
-rw-r--r--include/linux/usb.h103
-rw-r--r--include/linux/usb_gadget.h16
3 files changed, 84 insertions, 89 deletions
diff --git a/include/linux/brlvger.h b/include/linux/brlvger.h
deleted file mode 100644
index 388f3fdb6cc9..000000000000
--- a/include/linux/brlvger.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Tieman Voyager braille display USB driver.
- *
- * Copyright 2001-2002 Stephane Dalton <sdalton@videotron.ca>
- * and Stéphane Doyon <s.doyon@videotron.ca>
- * Maintained by Stéphane Doyon <s.doyon@videotron.ca>.
- */
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef _LINUX_BRLVGER_H
-#define _LINUX_BRLVGER_H
-
-/* Ioctl request codes */
-#define BRLVGER_GET_INFO 0
-#define BRLVGER_DISPLAY_ON 2
-#define BRLVGER_DISPLAY_OFF 3
-#define BRLVGER_BUZZ 4
-
-/* Base minor for the char devices */
-#define BRLVGER_MINOR 128
-
-/* Size of some fields */
-#define BRLVGER_HWVER_SIZE 2
-#define BRLVGER_FWVER_SIZE 200 /* arbitrary, a long string */
-#define BRLVGER_SERIAL_BIN_SIZE 8
-#define BRLVGER_SERIAL_SIZE ((2*BRLVGER_SERIAL_BIN_SIZE)+1)
-
-struct brlvger_info {
- __u8 driver_version[12];
- __u8 driver_banner[200];
-
- __u32 display_length;
- /* All other char[] fields are strings except this one.
- Hardware version: first byte is major, second byte is minor. */
- __u8 hwver[BRLVGER_HWVER_SIZE];
- __u8 fwver[BRLVGER_FWVER_SIZE];
- __u8 serialnum[BRLVGER_SERIAL_SIZE];
-};
-
-#endif
diff --git a/include/linux/usb.h b/include/linux/usb.h
index bbed847a9165..e4b60511fc46 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -72,14 +72,11 @@ struct usb_host_interface {
/**
* struct usb_interface - what usb device drivers talk to
- * @altsetting: array of interface descriptors, one for each alternate
+ * @altsetting: array of interface structures, one for each alternate
* setting that may be selected. Each one includes a set of
- * endpoint configurations and will be in numberic order,
- * 0..num_altsetting.
+ * endpoint configurations. They will be in no particular order.
* @num_altsetting: number of altsettings defined.
- * @act_altsetting: index of current altsetting. this number is always
- * less than num_altsetting. after the device is configured, each
- * interface uses its default setting of zero.
+ * @cur_altsetting: the current altsetting.
* @driver: the USB driver that is bound to this interface.
* @minor: the minor number assigned to this interface, if this
* interface is bound to a driver that uses the USB major number.
@@ -89,6 +86,8 @@ struct usb_host_interface {
* number from the USB core by calling usb_register_dev().
* @dev: driver model's view of this device
* @class_dev: driver model's class view of this device.
+ * @released: wait for the interface to be released when changing
+ * configurations.
*
* USB device drivers attach to interfaces on a physical device. Each
* interface encapsulates a single high level function, such as feeding
@@ -102,26 +101,33 @@ struct usb_host_interface {
* calls such as dev_get_drvdata() on the dev member of this structure.
*
* Each interface may have alternate settings. The initial configuration
- * of a device sets the first of these, but the device driver can change
+ * of a device sets altsetting 0, but the device driver can change
* that setting using usb_set_interface(). Alternate settings are often
* used to control the the use of periodic endpoints, such as by having
* different endpoints use different amounts of reserved USB bandwidth.
* All standards-conformant USB devices that use isochronous endpoints
* will use them in non-default settings.
+ *
+ * The USB specification says that alternate setting numbers must run from
+ * 0 to one less than the total number of alternate settings. But some
+ * devices manage to mess this up, and the structures aren't necessarily
+ * stored in numerical order anyhow. Use usb_altnum_to_altsetting() to
+ * look up an alternate setting in the altsetting array based on its number.
*/
struct usb_interface {
- /* array of alternate settings for this interface.
- * these will be in numeric order, 0..num_altsettting
- */
+ /* array of alternate settings for this interface,
+ * stored in no particular order */
struct usb_host_interface *altsetting;
- unsigned act_altsetting; /* active alternate setting */
+ struct usb_host_interface *cur_altsetting; /* the currently
+ * active alternate setting */
unsigned num_altsetting; /* number of alternate settings */
struct usb_driver *driver; /* driver */
int minor; /* minor number this interface is bound to */
struct device dev; /* interface specific device info */
struct class_device *class_dev;
+ struct completion *released; /* wait for release */
};
#define to_usb_interface(d) container_of(d, struct usb_interface, dev)
#define interface_to_usbdev(intf) \
@@ -140,19 +146,43 @@ static inline void usb_set_intfdata (struct usb_interface *intf, void *data)
/* this maximum is arbitrary */
#define USB_MAXINTERFACES 32
-/* USB_DT_CONFIG: Configuration descriptor information.
+/**
+ * struct usb_host_config - representation of a device's configuration
+ * @desc: the device's configuration descriptor.
+ * @interface: array of usb_interface structures, one for each interface
+ * in the configuration. The number of interfaces is stored in
+ * desc.bNumInterfaces.
+ * @extra: pointer to buffer containing all extra descriptors associated
+ * with this configuration (those preceding the first interface
+ * descriptor).
+ * @extralen: length of the extra descriptors buffer.
*
- * USB_DT_OTHER_SPEED_CONFIG is the same descriptor, except that the
- * descriptor type is different. Highspeed-capable devices can look
- * different depending on what speed they're currently running. Only
- * devices with a USB_DT_DEVICE_QUALIFIER have an OTHER_SPEED_CONFIG.
+ * USB devices may have multiple configurations, but only one can be active
+ * at any time. Each encapsulates a different operational environment;
+ * for example, a dual-speed device would have separate configurations for
+ * full-speed and high-speed operation. The number of configurations
+ * available is stored in the device descriptor as bNumConfigurations.
+ *
+ * A configuration can contain multiple interfaces. Each corresponds to
+ * a different function of the USB device, and all are available whenever
+ * the configuration is active. The USB standard says that interfaces
+ * are supposed to be numbered from 0 to desc.bNumInterfaces-1, but a lot
+ * of devices get this wrong. In addition, the interface array is not
+ * guaranteed to be sorted in numerical order. Use usb_ifnum_to_if() to
+ * look up an interface entry based on its number.
+ *
+ * Device drivers should not attempt to activate configurations. The choice
+ * of which configuration to install is a policy decision based on such
+ * considerations as available power, functionality provided, and the user's
+ * desires (expressed through hotplug scripts). However, drivers can call
+ * usb_reset_configuration() to reinitialize the current configuration and
+ * all its interfaces.
*/
struct usb_host_config {
struct usb_config_descriptor desc;
- /* the interfaces associated with this configuration
- * these will be in numeric order, 0..desc.bNumInterfaces
- */
+ /* the interfaces associated with this configuration,
+ * stored in no particular order */
struct usb_interface *interface[USB_MAXINTERFACES];
unsigned char *extra; /* Extra descriptors */
@@ -294,8 +324,12 @@ extern void usb_driver_release_interface(struct usb_driver *driver,
const struct usb_device_id *usb_match_id(struct usb_interface *interface,
const struct usb_device_id *id);
-extern struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor);
-extern struct usb_interface *usb_ifnum_to_if(struct usb_device *dev, unsigned ifnum);
+extern struct usb_interface *usb_find_interface(struct usb_driver *drv,
+ int minor);
+extern struct usb_interface *usb_ifnum_to_if(struct usb_device *dev,
+ unsigned ifnum);
+extern struct usb_host_interface *usb_altnum_to_altsetting(
+ struct usb_interface *intf, unsigned int altnum);
/**
@@ -461,8 +495,8 @@ extern struct bus_type usb_bus_type;
* @minor_base: the start of the minor range for this driver.
*
* This structure is used for the usb_register_dev() and
- * usb_unregister_dev() functions, to consolodate a number of the
- * paramaters used for them.
+ * usb_unregister_dev() functions, to consolidate a number of the
+ * parameters used for them.
*/
struct usb_class_driver {
char *name;
@@ -520,7 +554,7 @@ typedef void (*usb_complete_t)(struct urb *, struct pt_regs *);
* @urb_list: For use by current owner of the URB.
* @pipe: Holds endpoint number, direction, type, and more.
* Create these values with the eight macros available;
- * usb_{snd,rcv}TYPEpipe(dev,endpoint), where the type is "ctrl"
+ * usb_{snd,rcv}TYPEpipe(dev,endpoint), where the TYPE is "ctrl"
* (control), "bulk", "int" (interrupt), or "iso" (isochronous).
* For example usb_sndbulkpipe() or usb_rcvintpipe(). Endpoint
* numbers range from zero to fifteen. Note that "in" endpoint two
@@ -539,8 +573,8 @@ typedef void (*usb_complete_t)(struct urb *, struct pt_regs *);
* the I/O request will be performed (unless URB_NO_TRANSFER_DMA_MAP
* is set). This buffer must be suitable for DMA; allocate it with
* kmalloc() or equivalent. For transfers to "in" endpoints, contents
- * of this buffer will be modified. This buffer is used for data
- * phases of control transfers.
+ * of this buffer will be modified. This buffer is used for the data
+ * stage of control transfers.
* @transfer_dma: When transfer_flags includes URB_NO_TRANSFER_DMA_MAP,
* the device driver is saying that it provided this DMA address,
* which the host controller driver should use in preference to the
@@ -563,8 +597,7 @@ typedef void (*usb_complete_t)(struct urb *, struct pt_regs *);
* device driver has provided this DMA address for the setup packet.
* The host controller driver should use this in preference to
* setup_packet.
- * @start_frame: Returns the initial frame for interrupt or isochronous
- * transfers.
+ * @start_frame: Returns the initial frame for isochronous transfers.
* @number_of_packets: Lists the number of ISO transfer buffers.
* @interval: Specifies the polling interval for interrupt or isochronous
* transfers. The units are frames (milliseconds) for for full and low
@@ -632,13 +665,14 @@ typedef void (*usb_complete_t)(struct urb *, struct pt_regs *);
* Interrupt UBS must provide an interval, saying how often (in milliseconds
* or, for highspeed devices, 125 microsecond units)
* to poll for transfers. After the URB has been submitted, the interval
- * and start_frame fields reflect how the transfer was actually scheduled.
+ * field reflects how the transfer was actually scheduled.
* The polling interval may be more frequent than requested.
* For example, some controllers have a maximum interval of 32 microseconds,
* while others support intervals of up to 1024 microseconds.
* Isochronous URBs also have transfer intervals. (Note that for isochronous
* endpoints, as well as high speed interrupt endpoints, the encoding of
- * the transfer interval in the endpoint descriptor is logarithmic.)
+ * the transfer interval in the endpoint descriptor is logarithmic.
+ * Device drivers must convert that value to linear units themselves.)
*
* Isochronous URBs normally use the URB_ISO_ASAP transfer flag, telling
* the host controller to schedule the transfer as soon as bandwidth
@@ -671,8 +705,9 @@ typedef void (*usb_complete_t)(struct urb *, struct pt_regs *);
* The context field is normally used to link URBs back to the relevant
* driver or request state.
*
- * When completion callback is invoked for non-isochronous URBs, the
- * actual_length field tells how many bytes were transferred.
+ * When the completion callback is invoked for non-isochronous URBs, the
+ * actual_length field tells how many bytes were transferred. This field
+ * is updated even when the URB terminated with an error or was unlinked.
*
* ISO transfer status is reported in the status and actual_length fields
* of the iso_frame_desc array, and the number of errors is reported in
@@ -699,9 +734,9 @@ struct urb
int actual_length; /* (return) actual transfer length */
unsigned char *setup_packet; /* (in) setup packet (control only) */
dma_addr_t setup_dma; /* (in) dma addr for setup_packet */
- int start_frame; /* (modify) start frame (INT/ISO) */
+ int start_frame; /* (modify) start frame (ISO) */
int number_of_packets; /* (in) number of ISO packets */
- int interval; /* (in) transfer interval (INT/ISO) */
+ int interval; /* (modify) transfer interval (INT/ISO) */
int error_count; /* (return) number of ISO errors */
int timeout; /* (in) timeout, in jiffies */
void *context; /* (in) context for completion */
diff --git a/include/linux/usb_gadget.h b/include/linux/usb_gadget.h
index 9bb39b8b16aa..503abfe9a9aa 100644
--- a/include/linux/usb_gadget.h
+++ b/include/linux/usb_gadget.h
@@ -465,6 +465,8 @@ struct usb_gadget_ops {
* driver setup() requests
* @ep_list: List of other endpoints supported by the device.
* @speed: Speed of current connection to USB host.
+ * @is_dualspeed: True if the controller supports both high and full speed
+ * operation. If it does, the gadget driver must also support both.
* @name: Identifies the controller hardware type. Used in diagnostics
* and sometimes configuration.
* @dev: Driver model state for this abstract device.
@@ -488,6 +490,7 @@ struct usb_gadget {
struct usb_ep *ep0;
struct list_head ep_list; /* of usb_ep */
enum usb_device_speed speed;
+ unsigned is_dualspeed:1;
const char *name;
struct device dev;
};
@@ -690,7 +693,7 @@ int usb_gadget_unregister_driver (struct usb_gadget_driver *driver);
/**
* struct usb_string - wraps a C string and its USB id
* @id:the (nonzero) ID for this string
- * @s:the string, in ISO-8859/1 characters
+ * @s:the string, in UTF-8 encoding
*
* If you're using usb_gadget_get_string(), use this to wrap a string
* together with its ID.
@@ -716,6 +719,17 @@ struct usb_gadget_strings {
/* put descriptor for string with that id into buf (buflen >= 256) */
int usb_gadget_get_string (struct usb_gadget_strings *table, int id, u8 *buf);
+/*-------------------------------------------------------------------------*/
+
+/* utility to simplify managing config descriptors */
+
+/* write vector of descriptors into buffer */
+int usb_descriptor_fillbuf(void *, unsigned,
+ const struct usb_descriptor_header **);
+
+/* build config descriptor from single descriptor vector */
+int usb_gadget_config_buf(const struct usb_config_descriptor *config,
+ void *buf, unsigned buflen, const struct usb_descriptor_header **desc);
#endif /* __KERNEL__ */