aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@mandriva.com>2005-10-29 01:10:35 -0400
committerArnaldo Carvalho de Melo <acme@mandriva.com>2005-10-29 01:10:35 -0400
commitfc228a04a4c01bbb2f898e180a14f9a976001f79 (patch)
treec6015f399aac7f0566dfadb984d843fe67175329 /include/linux
parent9fcc2e8a752f7d3d889114221b67c459557823e9 (diff)
parent8a212ab6b8a4ccc6f3c3d1beba5f92655c576404 (diff)
Merge branch 'master' of /pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/pci_ids.h3
-rw-r--r--include/linux/pm.h14
-rw-r--r--include/linux/usb.h163
-rw-r--r--include/linux/usb_otg.h13
-rw-r--r--include/linux/usbdevice_fs.h7
5 files changed, 139 insertions, 61 deletions
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 7d300f7469e3..467a096c3b81 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -96,6 +96,9 @@
96#define PCI_CLASS_SERIAL_ACCESS 0x0c01 96#define PCI_CLASS_SERIAL_ACCESS 0x0c01
97#define PCI_CLASS_SERIAL_SSA 0x0c02 97#define PCI_CLASS_SERIAL_SSA 0x0c02
98#define PCI_CLASS_SERIAL_USB 0x0c03 98#define PCI_CLASS_SERIAL_USB 0x0c03
99#define PCI_CLASS_SERIAL_USB_UHCI 0x0c0300
100#define PCI_CLASS_SERIAL_USB_OHCI 0x0c0310
101#define PCI_CLASS_SERIAL_USB_EHCI 0x0c0320
99#define PCI_CLASS_SERIAL_FIBER 0x0c04 102#define PCI_CLASS_SERIAL_FIBER 0x0c04
100#define PCI_CLASS_SERIAL_SMBUS 0x0c05 103#define PCI_CLASS_SERIAL_SMBUS 0x0c05
101 104
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 7897cf500c51..c61d5de837ef 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -224,7 +224,6 @@ struct dev_pm_info {
224 unsigned should_wakeup:1; 224 unsigned should_wakeup:1;
225 pm_message_t prev_state; 225 pm_message_t prev_state;
226 void * saved_state; 226 void * saved_state;
227 atomic_t pm_users;
228 struct device * pm_parent; 227 struct device * pm_parent;
229 struct list_head entry; 228 struct list_head entry;
230#endif 229#endif
@@ -244,6 +243,9 @@ extern int device_suspend(pm_message_t state);
244#define device_may_wakeup(dev) \ 243#define device_may_wakeup(dev) \
245 (device_can_wakeup(dev) && (dev)->power.should_wakeup) 244 (device_can_wakeup(dev) && (dev)->power.should_wakeup)
246 245
246extern int dpm_runtime_suspend(struct device *, pm_message_t);
247extern void dpm_runtime_resume(struct device *);
248
247#else /* !CONFIG_PM */ 249#else /* !CONFIG_PM */
248 250
249static inline int device_suspend(pm_message_t state) 251static inline int device_suspend(pm_message_t state)
@@ -254,6 +256,16 @@ static inline int device_suspend(pm_message_t state)
254#define device_set_wakeup_enable(dev,val) do{}while(0) 256#define device_set_wakeup_enable(dev,val) do{}while(0)
255#define device_may_wakeup(dev) (0) 257#define device_may_wakeup(dev) (0)
256 258
259static inline int dpm_runtime_suspend(struct device * dev, pm_message_t state)
260{
261 return 0;
262}
263
264static inline void dpm_runtime_resume(struct device * dev)
265{
266
267}
268
257#endif 269#endif
258 270
259/* changes to device_may_wakeup take effect on the next pm state change. 271/* changes to device_may_wakeup take effect on the next pm state change.
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 8f731e8f2821..748d04385256 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -57,6 +57,7 @@ struct usb_host_endpoint {
57 struct usb_endpoint_descriptor desc; 57 struct usb_endpoint_descriptor desc;
58 struct list_head urb_list; 58 struct list_head urb_list;
59 void *hcpriv; 59 void *hcpriv;
60 struct kobject *kobj; /* For sysfs info */
60 61
61 unsigned char *extra; /* Extra descriptors */ 62 unsigned char *extra; /* Extra descriptors */
62 int extralen; 63 int extralen;
@@ -136,7 +137,8 @@ struct usb_interface {
136 * active alternate setting */ 137 * active alternate setting */
137 unsigned num_altsetting; /* number of alternate settings */ 138 unsigned num_altsetting; /* number of alternate settings */
138 139
139 int minor; /* minor number this interface is bound to */ 140 int minor; /* minor number this interface is
141 * bound to */
140 enum usb_interface_condition condition; /* state of binding */ 142 enum usb_interface_condition condition; /* state of binding */
141 struct device dev; /* interface specific device info */ 143 struct device dev; /* interface specific device info */
142 struct class_device *class_dev; 144 struct class_device *class_dev;
@@ -229,7 +231,7 @@ struct usb_interface_cache {
229struct usb_host_config { 231struct usb_host_config {
230 struct usb_config_descriptor desc; 232 struct usb_config_descriptor desc;
231 233
232 char *string; 234 char *string; /* iConfiguration string, if present */
233 /* the interfaces associated with this configuration, 235 /* the interfaces associated with this configuration,
234 * stored in no particular order */ 236 * stored in no particular order */
235 struct usb_interface *interface[USB_MAXINTERFACES]; 237 struct usb_interface *interface[USB_MAXINTERFACES];
@@ -248,7 +250,7 @@ int __usb_get_extra_descriptor(char *buffer, unsigned size,
248 __usb_get_extra_descriptor((ifpoint)->extra,(ifpoint)->extralen,\ 250 __usb_get_extra_descriptor((ifpoint)->extra,(ifpoint)->extralen,\
249 type,(void**)ptr) 251 type,(void**)ptr)
250 252
251/* -------------------------------------------------------------------------- */ 253/* ----------------------------------------------------------------------- */
252 254
253struct usb_operations; 255struct usb_operations;
254 256
@@ -268,7 +270,8 @@ struct usb_bus {
268 unsigned is_b_host:1; /* true during some HNP roleswitches */ 270 unsigned is_b_host:1; /* true during some HNP roleswitches */
269 unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */ 271 unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */
270 272
271 int devnum_next; /* Next open device number in round-robin allocation */ 273 int devnum_next; /* Next open device number in
274 * round-robin allocation */
272 275
273 struct usb_devmap devmap; /* device address allocation map */ 276 struct usb_devmap devmap; /* device address allocation map */
274 struct usb_operations *op; /* Operations (specific to the HC) */ 277 struct usb_operations *op; /* Operations (specific to the HC) */
@@ -289,15 +292,16 @@ struct usb_bus {
289 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */ 292 struct dentry *usbfs_dentry; /* usbfs dentry entry for the bus */
290 293
291 struct class_device *class_dev; /* class device for this bus */ 294 struct class_device *class_dev; /* class device for this bus */
292 struct kref kref; /* handles reference counting this bus */ 295 struct kref kref; /* reference counting for this bus */
293 void (*release)(struct usb_bus *bus); /* function to destroy this bus's memory */ 296 void (*release)(struct usb_bus *bus);
297
294#if defined(CONFIG_USB_MON) 298#if defined(CONFIG_USB_MON)
295 struct mon_bus *mon_bus; /* non-null when associated */ 299 struct mon_bus *mon_bus; /* non-null when associated */
296 int monitored; /* non-zero when monitored */ 300 int monitored; /* non-zero when monitored */
297#endif 301#endif
298}; 302};
299 303
300/* -------------------------------------------------------------------------- */ 304/* ----------------------------------------------------------------------- */
301 305
302/* This is arbitrary. 306/* This is arbitrary.
303 * From USB 2.0 spec Table 11-13, offset 7, a hub can 307 * From USB 2.0 spec Table 11-13, offset 7, a hub can
@@ -326,7 +330,8 @@ struct usb_device {
326 330
327 struct semaphore serialize; 331 struct semaphore serialize;
328 332
329 unsigned int toggle[2]; /* one bit for each endpoint ([0] = IN, [1] = OUT) */ 333 unsigned int toggle[2]; /* one bit for each endpoint
334 * ([0] = IN, [1] = OUT) */
330 335
331 struct usb_device *parent; /* our hub, unless we're the root */ 336 struct usb_device *parent; /* our hub, unless we're the root */
332 struct usb_bus *bus; /* Bus we're part of */ 337 struct usb_bus *bus; /* Bus we're part of */
@@ -343,12 +348,14 @@ struct usb_device {
343 348
344 char **rawdescriptors; /* Raw descriptors for each config */ 349 char **rawdescriptors; /* Raw descriptors for each config */
345 350
346 int have_langid; /* whether string_langid is valid yet */ 351 int have_langid; /* whether string_langid is valid */
347 int string_langid; /* language ID for strings */ 352 int string_langid; /* language ID for strings */
348 353
349 char *product; 354 /* static strings from the device */
350 char *manufacturer; 355 char *product; /* iProduct string, if present */
351 char *serial; /* static strings from the device */ 356 char *manufacturer; /* iManufacturer string, if present */
357 char *serial; /* iSerialNumber string, if present */
358
352 struct list_head filelist; 359 struct list_head filelist;
353 struct class_device *class_dev; 360 struct class_device *class_dev;
354 struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */ 361 struct dentry *usbfs_dentry; /* usbfs dentry entry for the device */
@@ -440,22 +447,31 @@ extern struct usb_host_interface *usb_altnum_to_altsetting(
440 * USB 2.0 root hubs (EHCI host controllers) will get one path ID if they are 447 * USB 2.0 root hubs (EHCI host controllers) will get one path ID if they are
441 * high speed, and a different one if they are full or low speed. 448 * high speed, and a different one if they are full or low speed.
442 */ 449 */
443static inline int usb_make_path (struct usb_device *dev, char *buf, size_t size) 450static inline int usb_make_path (struct usb_device *dev, char *buf,
451 size_t size)
444{ 452{
445 int actual; 453 int actual;
446 actual = snprintf (buf, size, "usb-%s-%s", dev->bus->bus_name, dev->devpath); 454 actual = snprintf (buf, size, "usb-%s-%s", dev->bus->bus_name,
455 dev->devpath);
447 return (actual >= (int)size) ? -1 : actual; 456 return (actual >= (int)size) ? -1 : actual;
448} 457}
449 458
450/*-------------------------------------------------------------------------*/ 459/*-------------------------------------------------------------------------*/
451 460
452#define USB_DEVICE_ID_MATCH_DEVICE (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT) 461#define USB_DEVICE_ID_MATCH_DEVICE \
453#define USB_DEVICE_ID_MATCH_DEV_RANGE (USB_DEVICE_ID_MATCH_DEV_LO | USB_DEVICE_ID_MATCH_DEV_HI) 462 (USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT)
454#define USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION (USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_DEV_RANGE) 463#define USB_DEVICE_ID_MATCH_DEV_RANGE \
464 (USB_DEVICE_ID_MATCH_DEV_LO | USB_DEVICE_ID_MATCH_DEV_HI)
465#define USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION \
466 (USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_DEV_RANGE)
455#define USB_DEVICE_ID_MATCH_DEV_INFO \ 467#define USB_DEVICE_ID_MATCH_DEV_INFO \
456 (USB_DEVICE_ID_MATCH_DEV_CLASS | USB_DEVICE_ID_MATCH_DEV_SUBCLASS | USB_DEVICE_ID_MATCH_DEV_PROTOCOL) 468 (USB_DEVICE_ID_MATCH_DEV_CLASS | \
469 USB_DEVICE_ID_MATCH_DEV_SUBCLASS | \
470 USB_DEVICE_ID_MATCH_DEV_PROTOCOL)
457#define USB_DEVICE_ID_MATCH_INT_INFO \ 471#define USB_DEVICE_ID_MATCH_INT_INFO \
458 (USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_SUBCLASS | USB_DEVICE_ID_MATCH_INT_PROTOCOL) 472 (USB_DEVICE_ID_MATCH_INT_CLASS | \
473 USB_DEVICE_ID_MATCH_INT_SUBCLASS | \
474 USB_DEVICE_ID_MATCH_INT_PROTOCOL)
459 475
460/** 476/**
461 * USB_DEVICE - macro used to describe a specific usb device 477 * USB_DEVICE - macro used to describe a specific usb device
@@ -466,9 +482,11 @@ static inline int usb_make_path (struct usb_device *dev, char *buf, size_t size)
466 * specific device. 482 * specific device.
467 */ 483 */
468#define USB_DEVICE(vend,prod) \ 484#define USB_DEVICE(vend,prod) \
469 .match_flags = USB_DEVICE_ID_MATCH_DEVICE, .idVendor = (vend), .idProduct = (prod) 485 .match_flags = USB_DEVICE_ID_MATCH_DEVICE, .idVendor = (vend), \
486 .idProduct = (prod)
470/** 487/**
471 * USB_DEVICE_VER - macro used to describe a specific usb device with a version range 488 * USB_DEVICE_VER - macro used to describe a specific usb device with a
489 * version range
472 * @vend: the 16 bit USB Vendor ID 490 * @vend: the 16 bit USB Vendor ID
473 * @prod: the 16 bit USB Product ID 491 * @prod: the 16 bit USB Product ID
474 * @lo: the bcdDevice_lo value 492 * @lo: the bcdDevice_lo value
@@ -478,7 +496,9 @@ static inline int usb_make_path (struct usb_device *dev, char *buf, size_t size)
478 * specific device, with a version range. 496 * specific device, with a version range.
479 */ 497 */
480#define USB_DEVICE_VER(vend,prod,lo,hi) \ 498#define USB_DEVICE_VER(vend,prod,lo,hi) \
481 .match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION, .idVendor = (vend), .idProduct = (prod), .bcdDevice_lo = (lo), .bcdDevice_hi = (hi) 499 .match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION, \
500 .idVendor = (vend), .idProduct = (prod), \
501 .bcdDevice_lo = (lo), .bcdDevice_hi = (hi)
482 502
483/** 503/**
484 * USB_DEVICE_INFO - macro used to describe a class of usb devices 504 * USB_DEVICE_INFO - macro used to describe a class of usb devices
@@ -490,7 +510,8 @@ static inline int usb_make_path (struct usb_device *dev, char *buf, size_t size)
490 * specific class of devices. 510 * specific class of devices.
491 */ 511 */
492#define USB_DEVICE_INFO(cl,sc,pr) \ 512#define USB_DEVICE_INFO(cl,sc,pr) \
493 .match_flags = USB_DEVICE_ID_MATCH_DEV_INFO, .bDeviceClass = (cl), .bDeviceSubClass = (sc), .bDeviceProtocol = (pr) 513 .match_flags = USB_DEVICE_ID_MATCH_DEV_INFO, .bDeviceClass = (cl), \
514 .bDeviceSubClass = (sc), .bDeviceProtocol = (pr)
494 515
495/** 516/**
496 * USB_INTERFACE_INFO - macro used to describe a class of usb interfaces 517 * USB_INTERFACE_INFO - macro used to describe a class of usb interfaces
@@ -502,9 +523,10 @@ static inline int usb_make_path (struct usb_device *dev, char *buf, size_t size)
502 * specific class of interfaces. 523 * specific class of interfaces.
503 */ 524 */
504#define USB_INTERFACE_INFO(cl,sc,pr) \ 525#define USB_INTERFACE_INFO(cl,sc,pr) \
505 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO, .bInterfaceClass = (cl), .bInterfaceSubClass = (sc), .bInterfaceProtocol = (pr) 526 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO, .bInterfaceClass = (cl), \
527 .bInterfaceSubClass = (sc), .bInterfaceProtocol = (pr)
506 528
507/* -------------------------------------------------------------------------- */ 529/* ----------------------------------------------------------------------- */
508 530
509/** 531/**
510 * struct usb_driver - identifies USB driver to usbcore 532 * struct usb_driver - identifies USB driver to usbcore
@@ -557,7 +579,8 @@ struct usb_driver {
557 579
558 void (*disconnect) (struct usb_interface *intf); 580 void (*disconnect) (struct usb_interface *intf);
559 581
560 int (*ioctl) (struct usb_interface *intf, unsigned int code, void *buf); 582 int (*ioctl) (struct usb_interface *intf, unsigned int code,
583 void *buf);
561 584
562 int (*suspend) (struct usb_interface *intf, pm_message_t message); 585 int (*suspend) (struct usb_interface *intf, pm_message_t message);
563 int (*resume) (struct usb_interface *intf); 586 int (*resume) (struct usb_interface *intf);
@@ -572,10 +595,8 @@ extern struct bus_type usb_bus_type;
572 595
573/** 596/**
574 * struct usb_class_driver - identifies a USB driver that wants to use the USB major number 597 * struct usb_class_driver - identifies a USB driver that wants to use the USB major number
575 * @name: devfs name for this driver. Will also be used by the driver 598 * @name: the usb class device name for this driver. Will show up in sysfs.
576 * class code to create a usb class device.
577 * @fops: pointer to the struct file_operations of this driver. 599 * @fops: pointer to the struct file_operations of this driver.
578 * @mode: the mode for the devfs file to be created for this driver.
579 * @minor_base: the start of the minor range for this driver. 600 * @minor_base: the start of the minor range for this driver.
580 * 601 *
581 * This structure is used for the usb_register_dev() and 602 * This structure is used for the usb_register_dev() and
@@ -585,8 +606,7 @@ extern struct bus_type usb_bus_type;
585struct usb_class_driver { 606struct usb_class_driver {
586 char *name; 607 char *name;
587 struct file_operations *fops; 608 struct file_operations *fops;
588 mode_t mode; 609 int minor_base;
589 int minor_base;
590}; 610};
591 611
592/* 612/*
@@ -603,7 +623,7 @@ extern void usb_deregister_dev(struct usb_interface *intf,
603 623
604extern int usb_disabled(void); 624extern int usb_disabled(void);
605 625
606/* -------------------------------------------------------------------------- */ 626/* ----------------------------------------------------------------------- */
607 627
608/* 628/*
609 * URB support, for asynchronous request completions 629 * URB support, for asynchronous request completions
@@ -613,12 +633,14 @@ extern int usb_disabled(void);
613 * urb->transfer_flags: 633 * urb->transfer_flags:
614 */ 634 */
615#define URB_SHORT_NOT_OK 0x0001 /* report short reads as errors */ 635#define URB_SHORT_NOT_OK 0x0001 /* report short reads as errors */
616#define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame ignored */ 636#define URB_ISO_ASAP 0x0002 /* iso-only, urb->start_frame
637 * ignored */
617#define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */ 638#define URB_NO_TRANSFER_DMA_MAP 0x0004 /* urb->transfer_dma valid on submit */
618#define URB_NO_SETUP_DMA_MAP 0x0008 /* urb->setup_dma valid on submit */ 639#define URB_NO_SETUP_DMA_MAP 0x0008 /* urb->setup_dma valid on submit */
619#define URB_NO_FSBR 0x0020 /* UHCI-specific */ 640#define URB_NO_FSBR 0x0020 /* UHCI-specific */
620#define URB_ZERO_PACKET 0x0040 /* Finish bulk OUTs with short packet */ 641#define URB_ZERO_PACKET 0x0040 /* Finish bulk OUT with short packet */
621#define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt needed */ 642#define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt
643 * needed */
622 644
623struct usb_iso_packet_descriptor { 645struct usb_iso_packet_descriptor {
624 unsigned int offset; 646 unsigned int offset;
@@ -806,7 +828,8 @@ struct urb
806 u8 reject; /* submissions will fail */ 828 u8 reject; /* submissions will fail */
807 829
808 /* public, documented fields in the urb that can be used by drivers */ 830 /* public, documented fields in the urb that can be used by drivers */
809 struct list_head urb_list; /* list head for use by the urb owner */ 831 struct list_head urb_list; /* list head for use by the urb's
832 * current owner */
810 struct usb_device *dev; /* (in) pointer to associated device */ 833 struct usb_device *dev; /* (in) pointer to associated device */
811 unsigned int pipe; /* (in) pipe information */ 834 unsigned int pipe; /* (in) pipe information */
812 int status; /* (return) non-ISO status */ 835 int status; /* (return) non-ISO status */
@@ -819,14 +842,16 @@ struct urb
819 dma_addr_t setup_dma; /* (in) dma addr for setup_packet */ 842 dma_addr_t setup_dma; /* (in) dma addr for setup_packet */
820 int start_frame; /* (modify) start frame (ISO) */ 843 int start_frame; /* (modify) start frame (ISO) */
821 int number_of_packets; /* (in) number of ISO packets */ 844 int number_of_packets; /* (in) number of ISO packets */
822 int interval; /* (modify) transfer interval (INT/ISO) */ 845 int interval; /* (modify) transfer interval
846 * (INT/ISO) */
823 int error_count; /* (return) number of ISO errors */ 847 int error_count; /* (return) number of ISO errors */
824 void *context; /* (in) context for completion */ 848 void *context; /* (in) context for completion */
825 usb_complete_t complete; /* (in) completion routine */ 849 usb_complete_t complete; /* (in) completion routine */
826 struct usb_iso_packet_descriptor iso_frame_desc[0]; /* (in) ISO ONLY */ 850 struct usb_iso_packet_descriptor iso_frame_desc[0];
851 /* (in) ISO ONLY */
827}; 852};
828 853
829/* -------------------------------------------------------------------------- */ 854/* ----------------------------------------------------------------------- */
830 855
831/** 856/**
832 * usb_fill_control_urb - initializes a control urb 857 * usb_fill_control_urb - initializes a control urb
@@ -974,11 +999,6 @@ extern int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe,
974 void *data, int len, int *actual_length, 999 void *data, int len, int *actual_length,
975 int timeout); 1000 int timeout);
976 1001
977/* selective suspend/resume */
978extern int usb_suspend_device(struct usb_device *dev, pm_message_t message);
979extern int usb_resume_device(struct usb_device *dev);
980
981
982/* wrappers around usb_control_msg() for the most common standard requests */ 1002/* wrappers around usb_control_msg() for the most common standard requests */
983extern int usb_get_descriptor(struct usb_device *dev, unsigned char desctype, 1003extern int usb_get_descriptor(struct usb_device *dev, unsigned char desctype,
984 unsigned char descindex, void *buf, int size); 1004 unsigned char descindex, void *buf, int size);
@@ -1056,7 +1076,7 @@ void usb_sg_cancel (struct usb_sg_request *io);
1056void usb_sg_wait (struct usb_sg_request *io); 1076void usb_sg_wait (struct usb_sg_request *io);
1057 1077
1058 1078
1059/* -------------------------------------------------------------------------- */ 1079/* ----------------------------------------------------------------------- */
1060 1080
1061/* 1081/*
1062 * For various legacy reasons, Linux has a small cookie that's paired with 1082 * For various legacy reasons, Linux has a small cookie that's paired with
@@ -1097,23 +1117,34 @@ void usb_sg_wait (struct usb_sg_request *io);
1097/* The D0/D1 toggle bits ... USE WITH CAUTION (they're almost hcd-internal) */ 1117/* The D0/D1 toggle bits ... USE WITH CAUTION (they're almost hcd-internal) */
1098#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> (ep)) & 1) 1118#define usb_gettoggle(dev, ep, out) (((dev)->toggle[out] >> (ep)) & 1)
1099#define usb_dotoggle(dev, ep, out) ((dev)->toggle[out] ^= (1 << (ep))) 1119#define usb_dotoggle(dev, ep, out) ((dev)->toggle[out] ^= (1 << (ep)))
1100#define usb_settoggle(dev, ep, out, bit) ((dev)->toggle[out] = ((dev)->toggle[out] & ~(1 << (ep))) | ((bit) << (ep))) 1120#define usb_settoggle(dev, ep, out, bit) \
1121 ((dev)->toggle[out] = ((dev)->toggle[out] & ~(1 << (ep))) | \
1122 ((bit) << (ep)))
1101 1123
1102 1124
1103static inline unsigned int __create_pipe(struct usb_device *dev, unsigned int endpoint) 1125static inline unsigned int __create_pipe(struct usb_device *dev,
1126 unsigned int endpoint)
1104{ 1127{
1105 return (dev->devnum << 8) | (endpoint << 15); 1128 return (dev->devnum << 8) | (endpoint << 15);
1106} 1129}
1107 1130
1108/* Create various pipes... */ 1131/* Create various pipes... */
1109#define usb_sndctrlpipe(dev,endpoint) ((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint)) 1132#define usb_sndctrlpipe(dev,endpoint) \
1110#define usb_rcvctrlpipe(dev,endpoint) ((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) 1133 ((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint))
1111#define usb_sndisocpipe(dev,endpoint) ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint)) 1134#define usb_rcvctrlpipe(dev,endpoint) \
1112#define usb_rcvisocpipe(dev,endpoint) ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) 1135 ((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)
1113#define usb_sndbulkpipe(dev,endpoint) ((PIPE_BULK << 30) | __create_pipe(dev,endpoint)) 1136#define usb_sndisocpipe(dev,endpoint) \
1114#define usb_rcvbulkpipe(dev,endpoint) ((PIPE_BULK << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) 1137 ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint))
1115#define usb_sndintpipe(dev,endpoint) ((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint)) 1138#define usb_rcvisocpipe(dev,endpoint) \
1116#define usb_rcvintpipe(dev,endpoint) ((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) 1139 ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)
1140#define usb_sndbulkpipe(dev,endpoint) \
1141 ((PIPE_BULK << 30) | __create_pipe(dev,endpoint))
1142#define usb_rcvbulkpipe(dev,endpoint) \
1143 ((PIPE_BULK << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)
1144#define usb_sndintpipe(dev,endpoint) \
1145 ((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint))
1146#define usb_rcvintpipe(dev,endpoint) \
1147 ((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)
1117 1148
1118/*-------------------------------------------------------------------------*/ 1149/*-------------------------------------------------------------------------*/
1119 1150
@@ -1137,17 +1168,29 @@ usb_maxpacket(struct usb_device *udev, int pipe, int is_out)
1137 return le16_to_cpu(ep->desc.wMaxPacketSize); 1168 return le16_to_cpu(ep->desc.wMaxPacketSize);
1138} 1169}
1139 1170
1140/* -------------------------------------------------------------------------- */ 1171/* ----------------------------------------------------------------------- */
1172
1173/* Events from the usb core */
1174#define USB_DEVICE_ADD 0x0001
1175#define USB_DEVICE_REMOVE 0x0002
1176#define USB_BUS_ADD 0x0003
1177#define USB_BUS_REMOVE 0x0004
1178extern void usb_register_notify(struct notifier_block *nb);
1179extern void usb_unregister_notify(struct notifier_block *nb);
1141 1180
1142#ifdef DEBUG 1181#ifdef DEBUG
1143#define dbg(format, arg...) printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , ## arg) 1182#define dbg(format, arg...) printk(KERN_DEBUG "%s: " format "\n" , \
1183 __FILE__ , ## arg)
1144#else 1184#else
1145#define dbg(format, arg...) do {} while (0) 1185#define dbg(format, arg...) do {} while (0)
1146#endif 1186#endif
1147 1187
1148#define err(format, arg...) printk(KERN_ERR "%s: " format "\n" , __FILE__ , ## arg) 1188#define err(format, arg...) printk(KERN_ERR "%s: " format "\n" , \
1149#define info(format, arg...) printk(KERN_INFO "%s: " format "\n" , __FILE__ , ## arg) 1189 __FILE__ , ## arg)
1150#define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n" , __FILE__ , ## arg) 1190#define info(format, arg...) printk(KERN_INFO "%s: " format "\n" , \
1191 __FILE__ , ## arg)
1192#define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n" , \
1193 __FILE__ , ## arg)
1151 1194
1152 1195
1153#endif /* __KERNEL__ */ 1196#endif /* __KERNEL__ */
diff --git a/include/linux/usb_otg.h b/include/linux/usb_otg.h
index c6683146e9b0..f827f6e203c2 100644
--- a/include/linux/usb_otg.h
+++ b/include/linux/usb_otg.h
@@ -63,6 +63,10 @@ struct otg_transceiver {
63 int (*set_power)(struct otg_transceiver *otg, 63 int (*set_power)(struct otg_transceiver *otg,
64 unsigned mA); 64 unsigned mA);
65 65
66 /* for non-OTG B devices: set transceiver into suspend mode */
67 int (*set_suspend)(struct otg_transceiver *otg,
68 int suspend);
69
66 /* for B devices only: start session with A-Host */ 70 /* for B devices only: start session with A-Host */
67 int (*start_srp)(struct otg_transceiver *otg); 71 int (*start_srp)(struct otg_transceiver *otg);
68 72
@@ -108,6 +112,15 @@ otg_set_power(struct otg_transceiver *otg, unsigned mA)
108} 112}
109 113
110static inline int 114static inline int
115otg_set_suspend(struct otg_transceiver *otg, int suspend)
116{
117 if (otg->set_suspend != NULL)
118 return otg->set_suspend(otg, suspend);
119 else
120 return 0;
121}
122
123static inline int
111otg_start_srp(struct otg_transceiver *otg) 124otg_start_srp(struct otg_transceiver *otg)
112{ 125{
113 return otg->start_srp(otg); 126 return otg->start_srp(otg);
diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h
index 9facf733800c..8859f0b41543 100644
--- a/include/linux/usbdevice_fs.h
+++ b/include/linux/usbdevice_fs.h
@@ -140,6 +140,12 @@ struct usbdevfs_urb32 {
140 compat_caddr_t usercontext; /* unused */ 140 compat_caddr_t usercontext; /* unused */
141 struct usbdevfs_iso_packet_desc iso_frame_desc[0]; 141 struct usbdevfs_iso_packet_desc iso_frame_desc[0];
142}; 142};
143
144struct usbdevfs_ioctl32 {
145 s32 ifno;
146 s32 ioctl_code;
147 compat_caddr_t data;
148};
143#endif 149#endif
144 150
145#define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer) 151#define USBDEVFS_CONTROL _IOWR('U', 0, struct usbdevfs_ctrltransfer)
@@ -160,6 +166,7 @@ struct usbdevfs_urb32 {
160#define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int) 166#define USBDEVFS_RELEASEINTERFACE _IOR('U', 16, unsigned int)
161#define USBDEVFS_CONNECTINFO _IOW('U', 17, struct usbdevfs_connectinfo) 167#define USBDEVFS_CONNECTINFO _IOW('U', 17, struct usbdevfs_connectinfo)
162#define USBDEVFS_IOCTL _IOWR('U', 18, struct usbdevfs_ioctl) 168#define USBDEVFS_IOCTL _IOWR('U', 18, struct usbdevfs_ioctl)
169#define USBDEVFS_IOCTL32 _IOWR('U', 18, struct usbdevfs_ioctl32)
163#define USBDEVFS_HUB_PORTINFO _IOR('U', 19, struct usbdevfs_hub_portinfo) 170#define USBDEVFS_HUB_PORTINFO _IOR('U', 19, struct usbdevfs_hub_portinfo)
164#define USBDEVFS_RESET _IO('U', 20) 171#define USBDEVFS_RESET _IO('U', 20)
165#define USBDEVFS_CLEAR_HALT _IOR('U', 21, unsigned int) 172#define USBDEVFS_CLEAR_HALT _IOR('U', 21, unsigned int)