USB: defines for USB "Link Power Management" (LPM) ECN
authorDavid Brownell <david-b@pacbell.net>
Sun, 10 Feb 2008 20:24:00 +0000 (12:24 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 25 Apr 2008 04:16:34 +0000 (21:16 -0700)
There's a new PM-related change notice for the USB 2.0 specification
called "Link Power Management" (LPM).  It defines a new "L1 Suspend"
state which resembles the current (L2) suspend state, except that it
can be entered and exited much more quickly.  It should thus be more
useful for runtime PM, even though it doesn't mandate reduced power
draw from VBUS.

This patch provides the relevant #defines for usbcore.  Actually
implementing these mechanisms requires host silicon that can generate
new USB packets, plus hubs handling some new requests and peripherals
which understand the new packets.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/hcd.h
drivers/usb/core/hub.h
include/linux/usb/ch9.h

index 2d1c3d5..2c086b8 100644 (file)
@@ -28,7 +28,7 @@
 /*
  * USB Packet IDs (PIDs)
  */
-#define USB_PID_UNDEF_0                        0xf0
+#define USB_PID_EXT                    0xf0    /* USB 2.0 LPM ECN */
 #define USB_PID_OUT                    0xe1
 #define USB_PID_ACK                    0xd2
 #define USB_PID_DATA0                  0xc3
index 1551aed..d672cd8 100644 (file)
  */
 #define USB_PORT_FEAT_CONNECTION       0
 #define USB_PORT_FEAT_ENABLE           1
-#define USB_PORT_FEAT_SUSPEND          2
+#define USB_PORT_FEAT_SUSPEND          2       /* L2 suspend */
 #define USB_PORT_FEAT_OVER_CURRENT     3
 #define USB_PORT_FEAT_RESET            4
+#define USB_PORT_FEAT_L1               5       /* L1 suspend */
 #define USB_PORT_FEAT_POWER            8
 #define USB_PORT_FEAT_LOWSPEED         9
 #define USB_PORT_FEAT_HIGHSPEED                10
@@ -54,6 +55,7 @@
 #define USB_PORT_FEAT_C_RESET          20
 #define USB_PORT_FEAT_TEST              21
 #define USB_PORT_FEAT_INDICATOR         22
+#define USB_PORT_FEAT_C_PORT_L1         23
 
 /*
  * Hub Status and Hub Change results
@@ -73,7 +75,8 @@ struct usb_port_status {
 #define USB_PORT_STAT_SUSPEND          0x0004
 #define USB_PORT_STAT_OVERCURRENT      0x0008
 #define USB_PORT_STAT_RESET            0x0010
-/* bits 5 to 7 are reserved */
+#define USB_PORT_STAT_L1               0x0020
+/* bits 6 to 7 are reserved */
 #define USB_PORT_STAT_POWER            0x0100
 #define USB_PORT_STAT_LOW_SPEED                0x0200
 #define USB_PORT_STAT_HIGH_SPEED        0x0400
@@ -91,6 +94,7 @@ struct usb_port_status {
 #define USB_PORT_STAT_C_SUSPEND                0x0004
 #define USB_PORT_STAT_C_OVERCURRENT    0x0008
 #define USB_PORT_STAT_C_RESET          0x0010
+#define USB_PORT_STAT_C_L1             0x0020
 
 /*
  * wHubCharacteristics (masks)
index 7e1da17..61fcbc2 100644 (file)
@@ -66,8 +66,8 @@
 #define USB_RECIP_ENDPOINT             0x02
 #define USB_RECIP_OTHER                        0x03
 /* From Wireless USB 1.0 */
-#define USB_RECIP_PORT                         0x04
-#define USB_RECIP_RPIPE                0x05
+#define USB_RECIP_PORT                 0x04
+#define USB_RECIP_RPIPE                0x05
 
 /*
  * Standard requests, for the bRequest field of a SETUP packet.
 #define USB_REQ_LOOPBACK_DATA_READ     0x16
 #define USB_REQ_SET_INTERFACE_DS       0x17
 
+/* The Link Power Mangement (LPM) ECN defines USB_REQ_TEST_AND_SET command,
+ * used by hubs to put ports into a new L1 suspend state, except that it
+ * forgot to define its number ...
+ */
+
 /*
  * USB feature flags are written using USB_REQ_{CLEAR,SET}_FEATURE, and
  * are read as a bit array returned by USB_REQ_GET_STATUS.  (So there
- * are at most sixteen features of each type.)
+ * are at most sixteen features of each type.)  Hubs may also support a
+ * new USB_REQ_TEST_AND_SET_FEATURE to put ports into L1 suspend.
  */
 #define USB_DEVICE_SELF_POWERED                0       /* (read only) */
 #define USB_DEVICE_REMOTE_WAKEUP       1       /* dev may initiate wakeup */
@@ -575,6 +581,8 @@ enum usb_device_state {
        /* NOTE:  there are actually four different SUSPENDED
         * states, returning to POWERED, DEFAULT, ADDRESS, or
         * CONFIGURED respectively when SOF tokens flow again.
+        * At this level there's no difference between L1 and L2
+        * suspend states.  (L2 being original USB 1.1 suspend.)
         */
 };