aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-03-26 18:23:24 -0400
committerDavid S. Miller <davem@davemloft.net>2009-03-26 18:23:24 -0400
commit08abe18af1f78ee80c3c3a5ac47c3e0ae0beadf6 (patch)
tree2be39bf8942edca1bcec735145e144a682ca9cd3 /include/linux/usb
parentf0de70f8bb56952f6e016a65a8a8d006918f5bf6 (diff)
parent0384e2959127a56d0640505d004d8dd92f9c29f5 (diff)
Merge branch 'master' of /home/davem/src/GIT/linux-2.6/
Conflicts: drivers/net/wimax/i2400m/usb-notif.c
Diffstat (limited to 'include/linux/usb')
-rw-r--r--include/linux/usb/ch9.h183
-rw-r--r--include/linux/usb/composite.h8
-rw-r--r--include/linux/usb/gadget.h6
-rw-r--r--include/linux/usb/otg.h8
-rw-r--r--include/linux/usb/quirks.h3
-rw-r--r--include/linux/usb/serial.h3
6 files changed, 206 insertions, 5 deletions
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index 9b42baed3900..b145119a90da 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -102,7 +102,7 @@
102#define USB_REQ_LOOPBACK_DATA_READ 0x16 102#define USB_REQ_LOOPBACK_DATA_READ 0x16
103#define USB_REQ_SET_INTERFACE_DS 0x17 103#define USB_REQ_SET_INTERFACE_DS 0x17
104 104
105/* The Link Power Mangement (LPM) ECN defines USB_REQ_TEST_AND_SET command, 105/* The Link Power Management (LPM) ECN defines USB_REQ_TEST_AND_SET command,
106 * used by hubs to put ports into a new L1 suspend state, except that it 106 * used by hubs to put ports into a new L1 suspend state, except that it
107 * forgot to define its number ... 107 * forgot to define its number ...
108 */ 108 */
@@ -353,6 +353,185 @@ struct usb_endpoint_descriptor {
353#define USB_ENDPOINT_XFER_INT 3 353#define USB_ENDPOINT_XFER_INT 3
354#define USB_ENDPOINT_MAX_ADJUSTABLE 0x80 354#define USB_ENDPOINT_MAX_ADJUSTABLE 0x80
355 355
356/*-------------------------------------------------------------------------*/
357
358/**
359 * usb_endpoint_num - get the endpoint's number
360 * @epd: endpoint to be checked
361 *
362 * Returns @epd's number: 0 to 15.
363 */
364static inline int usb_endpoint_num(const struct usb_endpoint_descriptor *epd)
365{
366 return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
367}
368
369/**
370 * usb_endpoint_type - get the endpoint's transfer type
371 * @epd: endpoint to be checked
372 *
373 * Returns one of USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT} according
374 * to @epd's transfer type.
375 */
376static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd)
377{
378 return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
379}
380
381/**
382 * usb_endpoint_dir_in - check if the endpoint has IN direction
383 * @epd: endpoint to be checked
384 *
385 * Returns true if the endpoint is of type IN, otherwise it returns false.
386 */
387static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd)
388{
389 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN);
390}
391
392/**
393 * usb_endpoint_dir_out - check if the endpoint has OUT direction
394 * @epd: endpoint to be checked
395 *
396 * Returns true if the endpoint is of type OUT, otherwise it returns false.
397 */
398static inline int usb_endpoint_dir_out(
399 const struct usb_endpoint_descriptor *epd)
400{
401 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);
402}
403
404/**
405 * usb_endpoint_xfer_bulk - check if the endpoint has bulk transfer type
406 * @epd: endpoint to be checked
407 *
408 * Returns true if the endpoint is of type bulk, otherwise it returns false.
409 */
410static inline int usb_endpoint_xfer_bulk(
411 const struct usb_endpoint_descriptor *epd)
412{
413 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
414 USB_ENDPOINT_XFER_BULK);
415}
416
417/**
418 * usb_endpoint_xfer_control - check if the endpoint has control transfer type
419 * @epd: endpoint to be checked
420 *
421 * Returns true if the endpoint is of type control, otherwise it returns false.
422 */
423static inline int usb_endpoint_xfer_control(
424 const struct usb_endpoint_descriptor *epd)
425{
426 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
427 USB_ENDPOINT_XFER_CONTROL);
428}
429
430/**
431 * usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type
432 * @epd: endpoint to be checked
433 *
434 * Returns true if the endpoint is of type interrupt, otherwise it returns
435 * false.
436 */
437static inline int usb_endpoint_xfer_int(
438 const struct usb_endpoint_descriptor *epd)
439{
440 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
441 USB_ENDPOINT_XFER_INT);
442}
443
444/**
445 * usb_endpoint_xfer_isoc - check if the endpoint has isochronous transfer type
446 * @epd: endpoint to be checked
447 *
448 * Returns true if the endpoint is of type isochronous, otherwise it returns
449 * false.
450 */
451static inline int usb_endpoint_xfer_isoc(
452 const struct usb_endpoint_descriptor *epd)
453{
454 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
455 USB_ENDPOINT_XFER_ISOC);
456}
457
458/**
459 * usb_endpoint_is_bulk_in - check if the endpoint is bulk IN
460 * @epd: endpoint to be checked
461 *
462 * Returns true if the endpoint has bulk transfer type and IN direction,
463 * otherwise it returns false.
464 */
465static inline int usb_endpoint_is_bulk_in(
466 const struct usb_endpoint_descriptor *epd)
467{
468 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd));
469}
470
471/**
472 * usb_endpoint_is_bulk_out - check if the endpoint is bulk OUT
473 * @epd: endpoint to be checked
474 *
475 * Returns true if the endpoint has bulk transfer type and OUT direction,
476 * otherwise it returns false.
477 */
478static inline int usb_endpoint_is_bulk_out(
479 const struct usb_endpoint_descriptor *epd)
480{
481 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd));
482}
483
484/**
485 * usb_endpoint_is_int_in - check if the endpoint is interrupt IN
486 * @epd: endpoint to be checked
487 *
488 * Returns true if the endpoint has interrupt transfer type and IN direction,
489 * otherwise it returns false.
490 */
491static inline int usb_endpoint_is_int_in(
492 const struct usb_endpoint_descriptor *epd)
493{
494 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd));
495}
496
497/**
498 * usb_endpoint_is_int_out - check if the endpoint is interrupt OUT
499 * @epd: endpoint to be checked
500 *
501 * Returns true if the endpoint has interrupt transfer type and OUT direction,
502 * otherwise it returns false.
503 */
504static inline int usb_endpoint_is_int_out(
505 const struct usb_endpoint_descriptor *epd)
506{
507 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd));
508}
509
510/**
511 * usb_endpoint_is_isoc_in - check if the endpoint is isochronous IN
512 * @epd: endpoint to be checked
513 *
514 * Returns true if the endpoint has isochronous transfer type and IN direction,
515 * otherwise it returns false.
516 */
517static inline int usb_endpoint_is_isoc_in(
518 const struct usb_endpoint_descriptor *epd)
519{
520 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd));
521}
522
523/**
524 * usb_endpoint_is_isoc_out - check if the endpoint is isochronous OUT
525 * @epd: endpoint to be checked
526 *
527 * Returns true if the endpoint has isochronous transfer type and OUT direction,
528 * otherwise it returns false.
529 */
530static inline int usb_endpoint_is_isoc_out(
531 const struct usb_endpoint_descriptor *epd)
532{
533 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd));
534}
356 535
357/*-------------------------------------------------------------------------*/ 536/*-------------------------------------------------------------------------*/
358 537
@@ -584,8 +763,8 @@ enum usb_device_state {
584 /* chapter 9 and authentication (wireless) device states */ 763 /* chapter 9 and authentication (wireless) device states */
585 USB_STATE_ATTACHED, 764 USB_STATE_ATTACHED,
586 USB_STATE_POWERED, /* wired */ 765 USB_STATE_POWERED, /* wired */
587 USB_STATE_UNAUTHENTICATED, /* auth */
588 USB_STATE_RECONNECTING, /* auth */ 766 USB_STATE_RECONNECTING, /* auth */
767 USB_STATE_UNAUTHENTICATED, /* auth */
589 USB_STATE_DEFAULT, /* limited function */ 768 USB_STATE_DEFAULT, /* limited function */
590 USB_STATE_ADDRESS, 769 USB_STATE_ADDRESS,
591 USB_STATE_CONFIGURED, /* most functions */ 770 USB_STATE_CONFIGURED, /* most functions */
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 935c380ffe47..acd7b0f06c8a 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -244,6 +244,10 @@ int usb_add_config(struct usb_composite_dev *,
244 * value; it should return zero on successful initialization. 244 * value; it should return zero on successful initialization.
245 * @unbind: Reverses @bind(); called as a side effect of unregistering 245 * @unbind: Reverses @bind(); called as a side effect of unregistering
246 * this driver. 246 * this driver.
247 * @suspend: Notifies when the host stops sending USB traffic,
248 * after function notifications
249 * @resume: Notifies configuration when the host restarts USB traffic,
250 * before function notifications
247 * 251 *
248 * Devices default to reporting self powered operation. Devices which rely 252 * Devices default to reporting self powered operation. Devices which rely
249 * on bus powered operation should report this in their @bind() method. 253 * on bus powered operation should report this in their @bind() method.
@@ -268,6 +272,10 @@ struct usb_composite_driver {
268 272
269 int (*bind)(struct usb_composite_dev *); 273 int (*bind)(struct usb_composite_dev *);
270 int (*unbind)(struct usb_composite_dev *); 274 int (*unbind)(struct usb_composite_dev *);
275
276 /* global suspend hooks */
277 void (*suspend)(struct usb_composite_dev *);
278 void (*resume)(struct usb_composite_dev *);
271}; 279};
272 280
273extern int usb_composite_register(struct usb_composite_driver *); 281extern int usb_composite_register(struct usb_composite_driver *);
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 0460a746480c..bbf45d500b6d 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -598,6 +598,7 @@ static inline int usb_gadget_clear_selfpowered(struct usb_gadget *gadget)
598/** 598/**
599 * usb_gadget_vbus_connect - Notify controller that VBUS is powered 599 * usb_gadget_vbus_connect - Notify controller that VBUS is powered
600 * @gadget:The device which now has VBUS power. 600 * @gadget:The device which now has VBUS power.
601 * Context: can sleep
601 * 602 *
602 * This call is used by a driver for an external transceiver (or GPIO) 603 * This call is used by a driver for an external transceiver (or GPIO)
603 * that detects a VBUS power session starting. Common responses include 604 * that detects a VBUS power session starting. Common responses include
@@ -636,6 +637,7 @@ static inline int usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA)
636/** 637/**
637 * usb_gadget_vbus_disconnect - notify controller about VBUS session end 638 * usb_gadget_vbus_disconnect - notify controller about VBUS session end
638 * @gadget:the device whose VBUS supply is being described 639 * @gadget:the device whose VBUS supply is being described
640 * Context: can sleep
639 * 641 *
640 * This call is used by a driver for an external transceiver (or GPIO) 642 * This call is used by a driver for an external transceiver (or GPIO)
641 * that detects a VBUS power session ending. Common responses include 643 * that detects a VBUS power session ending. Common responses include
@@ -792,19 +794,20 @@ struct usb_gadget_driver {
792/** 794/**
793 * usb_gadget_register_driver - register a gadget driver 795 * usb_gadget_register_driver - register a gadget driver
794 * @driver:the driver being registered 796 * @driver:the driver being registered
797 * Context: can sleep
795 * 798 *
796 * Call this in your gadget driver's module initialization function, 799 * Call this in your gadget driver's module initialization function,
797 * to tell the underlying usb controller driver about your driver. 800 * to tell the underlying usb controller driver about your driver.
798 * The driver's bind() function will be called to bind it to a 801 * The driver's bind() function will be called to bind it to a
799 * gadget before this registration call returns. It's expected that 802 * gadget before this registration call returns. It's expected that
800 * the bind() functions will be in init sections. 803 * the bind() functions will be in init sections.
801 * This function must be called in a context that can sleep.
802 */ 804 */
803int usb_gadget_register_driver(struct usb_gadget_driver *driver); 805int usb_gadget_register_driver(struct usb_gadget_driver *driver);
804 806
805/** 807/**
806 * usb_gadget_unregister_driver - unregister a gadget driver 808 * usb_gadget_unregister_driver - unregister a gadget driver
807 * @driver:the driver being unregistered 809 * @driver:the driver being unregistered
810 * Context: can sleep
808 * 811 *
809 * Call this in your gadget driver's module cleanup function, 812 * Call this in your gadget driver's module cleanup function,
810 * to tell the underlying usb controller that your driver is 813 * to tell the underlying usb controller that your driver is
@@ -813,7 +816,6 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver);
813 * to unbind() and clean up any device state, before this procedure 816 * to unbind() and clean up any device state, before this procedure
814 * finally returns. It's expected that the unbind() functions 817 * finally returns. It's expected that the unbind() functions
815 * will in in exit sections, so may not be linked in some kernels. 818 * will in in exit sections, so may not be linked in some kernels.
816 * This function must be called in a context that can sleep.
817 */ 819 */
818int usb_gadget_unregister_driver(struct usb_gadget_driver *driver); 820int usb_gadget_unregister_driver(struct usb_gadget_driver *driver);
819 821
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 94df4fe6c6c0..1aaa826396a1 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -80,12 +80,17 @@ struct otg_transceiver {
80 80
81/* for board-specific init logic */ 81/* for board-specific init logic */
82extern int otg_set_transceiver(struct otg_transceiver *); 82extern int otg_set_transceiver(struct otg_transceiver *);
83#ifdef CONFIG_NOP_USB_XCEIV
84extern void usb_nop_xceiv_register(void);
85extern void usb_nop_xceiv_unregister(void);
86#endif
83 87
84 88
85/* for usb host and peripheral controller drivers */ 89/* for usb host and peripheral controller drivers */
86extern struct otg_transceiver *otg_get_transceiver(void); 90extern struct otg_transceiver *otg_get_transceiver(void);
87extern void otg_put_transceiver(struct otg_transceiver *); 91extern void otg_put_transceiver(struct otg_transceiver *);
88 92
93/* Context: can sleep */
89static inline int 94static inline int
90otg_start_hnp(struct otg_transceiver *otg) 95otg_start_hnp(struct otg_transceiver *otg)
91{ 96{
@@ -102,6 +107,8 @@ otg_set_host(struct otg_transceiver *otg, struct usb_bus *host)
102 107
103 108
104/* for usb peripheral controller drivers */ 109/* for usb peripheral controller drivers */
110
111/* Context: can sleep */
105static inline int 112static inline int
106otg_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *periph) 113otg_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *periph)
107{ 114{
@@ -114,6 +121,7 @@ otg_set_power(struct otg_transceiver *otg, unsigned mA)
114 return otg->set_power(otg, mA); 121 return otg->set_power(otg, mA);
115} 122}
116 123
124/* Context: can sleep */
117static inline int 125static inline int
118otg_set_suspend(struct otg_transceiver *otg, int suspend) 126otg_set_suspend(struct otg_transceiver *otg, int suspend)
119{ 127{
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
index 7f6c603db654..2526f3bbd273 100644
--- a/include/linux/usb/quirks.h
+++ b/include/linux/usb/quirks.h
@@ -16,4 +16,7 @@
16/* device can't handle Set-Interface requests */ 16/* device can't handle Set-Interface requests */
17#define USB_QUIRK_NO_SET_INTF 0x00000004 17#define USB_QUIRK_NO_SET_INTF 0x00000004
18 18
19/* device can't handle its Configuration or Interface strings */
20#define USB_QUIRK_CONFIG_INTF_STRINGS 0x00000008
21
19#endif /* __LINUX_USB_QUIRKS_H */ 22#endif /* __LINUX_USB_QUIRKS_H */
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 0b8617a9176d..b95842542590 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -130,7 +130,8 @@ struct usb_serial {
130 struct usb_device *dev; 130 struct usb_device *dev;
131 struct usb_serial_driver *type; 131 struct usb_serial_driver *type;
132 struct usb_interface *interface; 132 struct usb_interface *interface;
133 unsigned char disconnected; 133 unsigned char disconnected:1;
134 unsigned char suspending:1;
134 unsigned char minor; 135 unsigned char minor;
135 unsigned char num_ports; 136 unsigned char num_ports;
136 unsigned char num_port_pointers; 137 unsigned char num_port_pointers;