1 /* 2 * This file is auto-generated. Modifications will be lost. 3 * 4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/ 5 * for more information. 6 */ 7 #ifndef _UAPI__LINUX_USB_CH9_H 8 #define _UAPI__LINUX_USB_CH9_H 9 #include <linux/types.h> 10 #include <asm/byteorder.h> 11 #define USB_DIR_OUT 0 12 #define USB_DIR_IN 0x80 13 #define USB_TYPE_MASK (0x03 << 5) 14 #define USB_TYPE_STANDARD (0x00 << 5) 15 #define USB_TYPE_CLASS (0x01 << 5) 16 #define USB_TYPE_VENDOR (0x02 << 5) 17 #define USB_TYPE_RESERVED (0x03 << 5) 18 #define USB_RECIP_MASK 0x1f 19 #define USB_RECIP_DEVICE 0x00 20 #define USB_RECIP_INTERFACE 0x01 21 #define USB_RECIP_ENDPOINT 0x02 22 #define USB_RECIP_OTHER 0x03 23 #define USB_RECIP_PORT 0x04 24 #define USB_RECIP_RPIPE 0x05 25 #define USB_REQ_GET_STATUS 0x00 26 #define USB_REQ_CLEAR_FEATURE 0x01 27 #define USB_REQ_SET_FEATURE 0x03 28 #define USB_REQ_SET_ADDRESS 0x05 29 #define USB_REQ_GET_DESCRIPTOR 0x06 30 #define USB_REQ_SET_DESCRIPTOR 0x07 31 #define USB_REQ_GET_CONFIGURATION 0x08 32 #define USB_REQ_SET_CONFIGURATION 0x09 33 #define USB_REQ_GET_INTERFACE 0x0A 34 #define USB_REQ_SET_INTERFACE 0x0B 35 #define USB_REQ_SYNCH_FRAME 0x0C 36 #define USB_REQ_SET_SEL 0x30 37 #define USB_REQ_SET_ISOCH_DELAY 0x31 38 #define USB_REQ_SET_ENCRYPTION 0x0D 39 #define USB_REQ_GET_ENCRYPTION 0x0E 40 #define USB_REQ_RPIPE_ABORT 0x0E 41 #define USB_REQ_SET_HANDSHAKE 0x0F 42 #define USB_REQ_RPIPE_RESET 0x0F 43 #define USB_REQ_GET_HANDSHAKE 0x10 44 #define USB_REQ_SET_CONNECTION 0x11 45 #define USB_REQ_SET_SECURITY_DATA 0x12 46 #define USB_REQ_GET_SECURITY_DATA 0x13 47 #define USB_REQ_SET_WUSB_DATA 0x14 48 #define USB_REQ_LOOPBACK_DATA_WRITE 0x15 49 #define USB_REQ_LOOPBACK_DATA_READ 0x16 50 #define USB_REQ_SET_INTERFACE_DS 0x17 51 #define USB_REQ_GET_PARTNER_PDO 20 52 #define USB_REQ_GET_BATTERY_STATUS 21 53 #define USB_REQ_SET_PDO 22 54 #define USB_REQ_GET_VDM 23 55 #define USB_REQ_SEND_VDM 24 56 #define USB_DEVICE_SELF_POWERED 0 57 #define USB_DEVICE_REMOTE_WAKEUP 1 58 #define USB_DEVICE_TEST_MODE 2 59 #define USB_DEVICE_BATTERY 2 60 #define USB_DEVICE_B_HNP_ENABLE 3 61 #define USB_DEVICE_WUSB_DEVICE 3 62 #define USB_DEVICE_A_HNP_SUPPORT 4 63 #define USB_DEVICE_A_ALT_HNP_SUPPORT 5 64 #define USB_DEVICE_DEBUG_MODE 6 65 #define USB_TEST_J 1 66 #define USB_TEST_K 2 67 #define USB_TEST_SE0_NAK 3 68 #define USB_TEST_PACKET 4 69 #define USB_TEST_FORCE_ENABLE 5 70 #define USB_STATUS_TYPE_STANDARD 0 71 #define USB_STATUS_TYPE_PTM 1 72 #define USB_DEVICE_U1_ENABLE 48 73 #define USB_DEVICE_U2_ENABLE 49 74 #define USB_DEVICE_LTM_ENABLE 50 75 #define USB_INTRF_FUNC_SUSPEND 0 76 #define USB_INTR_FUNC_SUSPEND_OPT_MASK 0xFF00 77 #define USB_INTRF_FUNC_SUSPEND_LP (1 << (8 + 0)) 78 #define USB_INTRF_FUNC_SUSPEND_RW (1 << (8 + 1)) 79 #define USB_INTRF_STAT_FUNC_RW_CAP 1 80 #define USB_INTRF_STAT_FUNC_RW 2 81 #define USB_ENDPOINT_HALT 0 82 #define USB_DEV_STAT_U1_ENABLED 2 83 #define USB_DEV_STAT_U2_ENABLED 3 84 #define USB_DEV_STAT_LTM_ENABLED 4 85 #define USB_DEVICE_BATTERY_WAKE_MASK 40 86 #define USB_DEVICE_OS_IS_PD_AWARE 41 87 #define USB_DEVICE_POLICY_MODE 42 88 #define USB_PORT_PR_SWAP 43 89 #define USB_PORT_GOTO_MIN 44 90 #define USB_PORT_RETURN_POWER 45 91 #define USB_PORT_ACCEPT_PD_REQUEST 46 92 #define USB_PORT_REJECT_PD_REQUEST 47 93 #define USB_PORT_PORT_PD_RESET 48 94 #define USB_PORT_C_PORT_PD_CHANGE 49 95 #define USB_PORT_CABLE_PD_RESET 50 96 #define USB_DEVICE_CHARGING_POLICY 54 97 struct usb_ctrlrequest { 98 __u8 bRequestType; 99 __u8 bRequest; 100 __le16 wValue; 101 __le16 wIndex; 102 __le16 wLength; 103 } __attribute__((packed)); 104 #define USB_DT_DEVICE 0x01 105 #define USB_DT_CONFIG 0x02 106 #define USB_DT_STRING 0x03 107 #define USB_DT_INTERFACE 0x04 108 #define USB_DT_ENDPOINT 0x05 109 #define USB_DT_DEVICE_QUALIFIER 0x06 110 #define USB_DT_OTHER_SPEED_CONFIG 0x07 111 #define USB_DT_INTERFACE_POWER 0x08 112 #define USB_DT_OTG 0x09 113 #define USB_DT_DEBUG 0x0a 114 #define USB_DT_INTERFACE_ASSOCIATION 0x0b 115 #define USB_DT_SECURITY 0x0c 116 #define USB_DT_KEY 0x0d 117 #define USB_DT_ENCRYPTION_TYPE 0x0e 118 #define USB_DT_BOS 0x0f 119 #define USB_DT_DEVICE_CAPABILITY 0x10 120 #define USB_DT_WIRELESS_ENDPOINT_COMP 0x11 121 #define USB_DT_WIRE_ADAPTER 0x21 122 #define USB_DT_RPIPE 0x22 123 #define USB_DT_CS_RADIO_CONTROL 0x23 124 #define USB_DT_PIPE_USAGE 0x24 125 #define USB_DT_SS_ENDPOINT_COMP 0x30 126 #define USB_DT_SSP_ISOC_ENDPOINT_COMP 0x31 127 #define USB_DT_CS_DEVICE (USB_TYPE_CLASS | USB_DT_DEVICE) 128 #define USB_DT_CS_CONFIG (USB_TYPE_CLASS | USB_DT_CONFIG) 129 #define USB_DT_CS_STRING (USB_TYPE_CLASS | USB_DT_STRING) 130 #define USB_DT_CS_INTERFACE (USB_TYPE_CLASS | USB_DT_INTERFACE) 131 #define USB_DT_CS_ENDPOINT (USB_TYPE_CLASS | USB_DT_ENDPOINT) 132 struct usb_descriptor_header { 133 __u8 bLength; 134 __u8 bDescriptorType; 135 } __attribute__((packed)); 136 struct usb_device_descriptor { 137 __u8 bLength; 138 __u8 bDescriptorType; 139 __le16 bcdUSB; 140 __u8 bDeviceClass; 141 __u8 bDeviceSubClass; 142 __u8 bDeviceProtocol; 143 __u8 bMaxPacketSize0; 144 __le16 idVendor; 145 __le16 idProduct; 146 __le16 bcdDevice; 147 __u8 iManufacturer; 148 __u8 iProduct; 149 __u8 iSerialNumber; 150 __u8 bNumConfigurations; 151 } __attribute__((packed)); 152 #define USB_DT_DEVICE_SIZE 18 153 #define USB_CLASS_PER_INTERFACE 0 154 #define USB_CLASS_AUDIO 1 155 #define USB_CLASS_COMM 2 156 #define USB_CLASS_HID 3 157 #define USB_CLASS_PHYSICAL 5 158 #define USB_CLASS_STILL_IMAGE 6 159 #define USB_CLASS_PRINTER 7 160 #define USB_CLASS_MASS_STORAGE 8 161 #define USB_CLASS_HUB 9 162 #define USB_CLASS_CDC_DATA 0x0a 163 #define USB_CLASS_CSCID 0x0b 164 #define USB_CLASS_CONTENT_SEC 0x0d 165 #define USB_CLASS_VIDEO 0x0e 166 #define USB_CLASS_WIRELESS_CONTROLLER 0xe0 167 #define USB_CLASS_PERSONAL_HEALTHCARE 0x0f 168 #define USB_CLASS_AUDIO_VIDEO 0x10 169 #define USB_CLASS_BILLBOARD 0x11 170 #define USB_CLASS_USB_TYPE_C_BRIDGE 0x12 171 #define USB_CLASS_MISC 0xef 172 #define USB_CLASS_APP_SPEC 0xfe 173 #define USB_CLASS_VENDOR_SPEC 0xff 174 #define USB_SUBCLASS_VENDOR_SPEC 0xff 175 struct usb_config_descriptor { 176 __u8 bLength; 177 __u8 bDescriptorType; 178 __le16 wTotalLength; 179 __u8 bNumInterfaces; 180 __u8 bConfigurationValue; 181 __u8 iConfiguration; 182 __u8 bmAttributes; 183 __u8 bMaxPower; 184 } __attribute__((packed)); 185 #define USB_DT_CONFIG_SIZE 9 186 #define USB_CONFIG_ATT_ONE (1 << 7) 187 #define USB_CONFIG_ATT_SELFPOWER (1 << 6) 188 #define USB_CONFIG_ATT_WAKEUP (1 << 5) 189 #define USB_CONFIG_ATT_BATTERY (1 << 4) 190 #define USB_MAX_STRING_LEN 126 191 struct usb_string_descriptor { 192 __u8 bLength; 193 __u8 bDescriptorType; 194 union { 195 __le16 legacy_padding; 196 __DECLARE_FLEX_ARRAY(__le16, wData); 197 }; 198 } __attribute__((packed)); 199 struct usb_interface_descriptor { 200 __u8 bLength; 201 __u8 bDescriptorType; 202 __u8 bInterfaceNumber; 203 __u8 bAlternateSetting; 204 __u8 bNumEndpoints; 205 __u8 bInterfaceClass; 206 __u8 bInterfaceSubClass; 207 __u8 bInterfaceProtocol; 208 __u8 iInterface; 209 } __attribute__((packed)); 210 #define USB_DT_INTERFACE_SIZE 9 211 struct usb_endpoint_descriptor { 212 __u8 bLength; 213 __u8 bDescriptorType; 214 __u8 bEndpointAddress; 215 __u8 bmAttributes; 216 __le16 wMaxPacketSize; 217 __u8 bInterval; 218 __u8 bRefresh; 219 __u8 bSynchAddress; 220 } __attribute__((packed)); 221 #define USB_DT_ENDPOINT_SIZE 7 222 #define USB_DT_ENDPOINT_AUDIO_SIZE 9 223 #define USB_ENDPOINT_NUMBER_MASK 0x0f 224 #define USB_ENDPOINT_DIR_MASK 0x80 225 #define USB_ENDPOINT_XFERTYPE_MASK 0x03 226 #define USB_ENDPOINT_XFER_CONTROL 0 227 #define USB_ENDPOINT_XFER_ISOC 1 228 #define USB_ENDPOINT_XFER_BULK 2 229 #define USB_ENDPOINT_XFER_INT 3 230 #define USB_ENDPOINT_MAX_ADJUSTABLE 0x80 231 #define USB_ENDPOINT_MAXP_MASK 0x07ff 232 #define USB_EP_MAXP_MULT_SHIFT 11 233 #define USB_EP_MAXP_MULT_MASK (3 << USB_EP_MAXP_MULT_SHIFT) 234 #define USB_EP_MAXP_MULT(m) (((m) & USB_EP_MAXP_MULT_MASK) >> USB_EP_MAXP_MULT_SHIFT) 235 #define USB_ENDPOINT_INTRTYPE 0x30 236 #define USB_ENDPOINT_INTR_PERIODIC (0 << 4) 237 #define USB_ENDPOINT_INTR_NOTIFICATION (1 << 4) 238 #define USB_ENDPOINT_SYNCTYPE 0x0c 239 #define USB_ENDPOINT_SYNC_NONE (0 << 2) 240 #define USB_ENDPOINT_SYNC_ASYNC (1 << 2) 241 #define USB_ENDPOINT_SYNC_ADAPTIVE (2 << 2) 242 #define USB_ENDPOINT_SYNC_SYNC (3 << 2) 243 #define USB_ENDPOINT_USAGE_MASK 0x30 244 #define USB_ENDPOINT_USAGE_DATA 0x00 245 #define USB_ENDPOINT_USAGE_FEEDBACK 0x10 246 #define USB_ENDPOINT_USAGE_IMPLICIT_FB 0x20 247 struct usb_ssp_isoc_ep_comp_descriptor { 248 __u8 bLength; 249 __u8 bDescriptorType; 250 __le16 wReseved; 251 __le32 dwBytesPerInterval; 252 } __attribute__((packed)); 253 #define USB_DT_SSP_ISOC_EP_COMP_SIZE 8 254 struct usb_ss_ep_comp_descriptor { 255 __u8 bLength; 256 __u8 bDescriptorType; 257 __u8 bMaxBurst; 258 __u8 bmAttributes; 259 __le16 wBytesPerInterval; 260 } __attribute__((packed)); 261 #define USB_DT_SS_EP_COMP_SIZE 6 262 #define USB_SS_MULT(p) (1 + ((p) & 0x3)) 263 #define USB_SS_SSP_ISOC_COMP(p) ((p) & (1 << 7)) 264 struct usb_qualifier_descriptor { 265 __u8 bLength; 266 __u8 bDescriptorType; 267 __le16 bcdUSB; 268 __u8 bDeviceClass; 269 __u8 bDeviceSubClass; 270 __u8 bDeviceProtocol; 271 __u8 bMaxPacketSize0; 272 __u8 bNumConfigurations; 273 __u8 bRESERVED; 274 } __attribute__((packed)); 275 struct usb_otg_descriptor { 276 __u8 bLength; 277 __u8 bDescriptorType; 278 __u8 bmAttributes; 279 } __attribute__((packed)); 280 struct usb_otg20_descriptor { 281 __u8 bLength; 282 __u8 bDescriptorType; 283 __u8 bmAttributes; 284 __le16 bcdOTG; 285 } __attribute__((packed)); 286 #define USB_OTG_SRP (1 << 0) 287 #define USB_OTG_HNP (1 << 1) 288 #define USB_OTG_ADP (1 << 2) 289 #define USB_OTG_RSP (1 << 3) 290 #define OTG_STS_SELECTOR 0xF000 291 struct usb_debug_descriptor { 292 __u8 bLength; 293 __u8 bDescriptorType; 294 __u8 bDebugInEndpoint; 295 __u8 bDebugOutEndpoint; 296 } __attribute__((packed)); 297 struct usb_interface_assoc_descriptor { 298 __u8 bLength; 299 __u8 bDescriptorType; 300 __u8 bFirstInterface; 301 __u8 bInterfaceCount; 302 __u8 bFunctionClass; 303 __u8 bFunctionSubClass; 304 __u8 bFunctionProtocol; 305 __u8 iFunction; 306 } __attribute__((packed)); 307 #define USB_DT_INTERFACE_ASSOCIATION_SIZE 8 308 struct usb_security_descriptor { 309 __u8 bLength; 310 __u8 bDescriptorType; 311 __le16 wTotalLength; 312 __u8 bNumEncryptionTypes; 313 } __attribute__((packed)); 314 struct usb_key_descriptor { 315 __u8 bLength; 316 __u8 bDescriptorType; 317 __u8 tTKID[3]; 318 __u8 bReserved; 319 __u8 bKeyData[]; 320 } __attribute__((packed)); 321 struct usb_encryption_descriptor { 322 __u8 bLength; 323 __u8 bDescriptorType; 324 __u8 bEncryptionType; 325 #define USB_ENC_TYPE_UNSECURE 0 326 #define USB_ENC_TYPE_WIRED 1 327 #define USB_ENC_TYPE_CCM_1 2 328 #define USB_ENC_TYPE_RSA_1 3 329 __u8 bEncryptionValue; 330 __u8 bAuthKeyIndex; 331 } __attribute__((packed)); 332 struct usb_bos_descriptor { 333 __u8 bLength; 334 __u8 bDescriptorType; 335 __le16 wTotalLength; 336 __u8 bNumDeviceCaps; 337 } __attribute__((packed)); 338 #define USB_DT_BOS_SIZE 5 339 struct usb_dev_cap_header { 340 __u8 bLength; 341 __u8 bDescriptorType; 342 __u8 bDevCapabilityType; 343 } __attribute__((packed)); 344 #define USB_CAP_TYPE_WIRELESS_USB 1 345 struct usb_wireless_cap_descriptor { 346 __u8 bLength; 347 __u8 bDescriptorType; 348 __u8 bDevCapabilityType; 349 __u8 bmAttributes; 350 #define USB_WIRELESS_P2P_DRD (1 << 1) 351 #define USB_WIRELESS_BEACON_MASK (3 << 2) 352 #define USB_WIRELESS_BEACON_SELF (1 << 2) 353 #define USB_WIRELESS_BEACON_DIRECTED (2 << 2) 354 #define USB_WIRELESS_BEACON_NONE (3 << 2) 355 __le16 wPHYRates; 356 #define USB_WIRELESS_PHY_53 (1 << 0) 357 #define USB_WIRELESS_PHY_80 (1 << 1) 358 #define USB_WIRELESS_PHY_107 (1 << 2) 359 #define USB_WIRELESS_PHY_160 (1 << 3) 360 #define USB_WIRELESS_PHY_200 (1 << 4) 361 #define USB_WIRELESS_PHY_320 (1 << 5) 362 #define USB_WIRELESS_PHY_400 (1 << 6) 363 #define USB_WIRELESS_PHY_480 (1 << 7) 364 __u8 bmTFITXPowerInfo; 365 __u8 bmFFITXPowerInfo; 366 __le16 bmBandGroup; 367 __u8 bReserved; 368 } __attribute__((packed)); 369 #define USB_DT_USB_WIRELESS_CAP_SIZE 11 370 #define USB_CAP_TYPE_EXT 2 371 struct usb_ext_cap_descriptor { 372 __u8 bLength; 373 __u8 bDescriptorType; 374 __u8 bDevCapabilityType; 375 __le32 bmAttributes; 376 #define USB_LPM_SUPPORT (1 << 1) 377 #define USB_BESL_SUPPORT (1 << 2) 378 #define USB_BESL_BASELINE_VALID (1 << 3) 379 #define USB_BESL_DEEP_VALID (1 << 4) 380 #define USB_SET_BESL_BASELINE(p) (((p) & 0xf) << 8) 381 #define USB_SET_BESL_DEEP(p) (((p) & 0xf) << 12) 382 #define USB_GET_BESL_BASELINE(p) (((p) & (0xf << 8)) >> 8) 383 #define USB_GET_BESL_DEEP(p) (((p) & (0xf << 12)) >> 12) 384 } __attribute__((packed)); 385 #define USB_DT_USB_EXT_CAP_SIZE 7 386 #define USB_SS_CAP_TYPE 3 387 struct usb_ss_cap_descriptor { 388 __u8 bLength; 389 __u8 bDescriptorType; 390 __u8 bDevCapabilityType; 391 __u8 bmAttributes; 392 #define USB_LTM_SUPPORT (1 << 1) 393 __le16 wSpeedSupported; 394 #define USB_LOW_SPEED_OPERATION (1) 395 #define USB_FULL_SPEED_OPERATION (1 << 1) 396 #define USB_HIGH_SPEED_OPERATION (1 << 2) 397 #define USB_5GBPS_OPERATION (1 << 3) 398 __u8 bFunctionalitySupport; 399 __u8 bU1devExitLat; 400 __le16 bU2DevExitLat; 401 } __attribute__((packed)); 402 #define USB_DT_USB_SS_CAP_SIZE 10 403 #define CONTAINER_ID_TYPE 4 404 struct usb_ss_container_id_descriptor { 405 __u8 bLength; 406 __u8 bDescriptorType; 407 __u8 bDevCapabilityType; 408 __u8 bReserved; 409 __u8 ContainerID[16]; 410 } __attribute__((packed)); 411 #define USB_DT_USB_SS_CONTN_ID_SIZE 20 412 #define USB_PLAT_DEV_CAP_TYPE 5 413 struct usb_plat_dev_cap_descriptor { 414 __u8 bLength; 415 __u8 bDescriptorType; 416 __u8 bDevCapabilityType; 417 __u8 bReserved; 418 __u8 UUID[16]; 419 __u8 CapabilityData[]; 420 } __attribute__((packed)); 421 #define USB_DT_USB_PLAT_DEV_CAP_SIZE(capability_data_size) (20 + capability_data_size) 422 #define USB_SSP_CAP_TYPE 0xa 423 struct usb_ssp_cap_descriptor { 424 __u8 bLength; 425 __u8 bDescriptorType; 426 __u8 bDevCapabilityType; 427 __u8 bReserved; 428 __le32 bmAttributes; 429 #define USB_SSP_SUBLINK_SPEED_ATTRIBS (0x1f << 0) 430 #define USB_SSP_SUBLINK_SPEED_IDS (0xf << 5) 431 __le16 wFunctionalitySupport; 432 #define USB_SSP_MIN_SUBLINK_SPEED_ATTRIBUTE_ID (0xf) 433 #define USB_SSP_MIN_RX_LANE_COUNT (0xf << 8) 434 #define USB_SSP_MIN_TX_LANE_COUNT (0xf << 12) 435 __le16 wReserved; 436 union { 437 __le32 legacy_padding; 438 __DECLARE_FLEX_ARRAY(__le32, bmSublinkSpeedAttr); 439 }; 440 #define USB_SSP_SUBLINK_SPEED_SSID (0xf) 441 #define USB_SSP_SUBLINK_SPEED_LSE (0x3 << 4) 442 #define USB_SSP_SUBLINK_SPEED_LSE_BPS 0 443 #define USB_SSP_SUBLINK_SPEED_LSE_KBPS 1 444 #define USB_SSP_SUBLINK_SPEED_LSE_MBPS 2 445 #define USB_SSP_SUBLINK_SPEED_LSE_GBPS 3 446 #define USB_SSP_SUBLINK_SPEED_ST (0x3 << 6) 447 #define USB_SSP_SUBLINK_SPEED_ST_SYM_RX 0 448 #define USB_SSP_SUBLINK_SPEED_ST_ASYM_RX 1 449 #define USB_SSP_SUBLINK_SPEED_ST_SYM_TX 2 450 #define USB_SSP_SUBLINK_SPEED_ST_ASYM_TX 3 451 #define USB_SSP_SUBLINK_SPEED_RSVD (0x3f << 8) 452 #define USB_SSP_SUBLINK_SPEED_LP (0x3 << 14) 453 #define USB_SSP_SUBLINK_SPEED_LP_SS 0 454 #define USB_SSP_SUBLINK_SPEED_LP_SSP 1 455 #define USB_SSP_SUBLINK_SPEED_LSM (0xff << 16) 456 } __attribute__((packed)); 457 #define USB_PD_POWER_DELIVERY_CAPABILITY 0x06 458 #define USB_PD_BATTERY_INFO_CAPABILITY 0x07 459 #define USB_PD_PD_CONSUMER_PORT_CAPABILITY 0x08 460 #define USB_PD_PD_PROVIDER_PORT_CAPABILITY 0x09 461 struct usb_pd_cap_descriptor { 462 __u8 bLength; 463 __u8 bDescriptorType; 464 __u8 bDevCapabilityType; 465 __u8 bReserved; 466 __le32 bmAttributes; 467 #define USB_PD_CAP_BATTERY_CHARGING (1 << 1) 468 #define USB_PD_CAP_USB_PD (1 << 2) 469 #define USB_PD_CAP_PROVIDER (1 << 3) 470 #define USB_PD_CAP_CONSUMER (1 << 4) 471 #define USB_PD_CAP_CHARGING_POLICY (1 << 5) 472 #define USB_PD_CAP_TYPE_C_CURRENT (1 << 6) 473 #define USB_PD_CAP_PWR_AC (1 << 8) 474 #define USB_PD_CAP_PWR_BAT (1 << 9) 475 #define USB_PD_CAP_PWR_USE_V_BUS (1 << 14) 476 __le16 bmProviderPorts; 477 __le16 bmConsumerPorts; 478 __le16 bcdBCVersion; 479 __le16 bcdPDVersion; 480 __le16 bcdUSBTypeCVersion; 481 } __attribute__((packed)); 482 struct usb_pd_cap_battery_info_descriptor { 483 __u8 bLength; 484 __u8 bDescriptorType; 485 __u8 bDevCapabilityType; 486 __u8 iBattery; 487 __u8 iSerial; 488 __u8 iManufacturer; 489 __u8 bBatteryId; 490 __u8 bReserved; 491 __le32 dwChargedThreshold; 492 __le32 dwWeakThreshold; 493 __le32 dwBatteryDesignCapacity; 494 __le32 dwBatteryLastFullchargeCapacity; 495 } __attribute__((packed)); 496 struct usb_pd_cap_consumer_port_descriptor { 497 __u8 bLength; 498 __u8 bDescriptorType; 499 __u8 bDevCapabilityType; 500 __u8 bReserved; 501 __u8 bmCapabilities; 502 #define USB_PD_CAP_CONSUMER_BC (1 << 0) 503 #define USB_PD_CAP_CONSUMER_PD (1 << 1) 504 #define USB_PD_CAP_CONSUMER_TYPE_C (1 << 2) 505 __le16 wMinVoltage; 506 __le16 wMaxVoltage; 507 __u16 wReserved; 508 __le32 dwMaxOperatingPower; 509 __le32 dwMaxPeakPower; 510 __le32 dwMaxPeakPowerTime; 511 #define USB_PD_CAP_CONSUMER_UNKNOWN_PEAK_POWER_TIME 0xffff 512 } __attribute__((packed)); 513 struct usb_pd_cap_provider_port_descriptor { 514 __u8 bLength; 515 __u8 bDescriptorType; 516 __u8 bDevCapabilityType; 517 __u8 bReserved1; 518 __u8 bmCapabilities; 519 #define USB_PD_CAP_PROVIDER_BC (1 << 0) 520 #define USB_PD_CAP_PROVIDER_PD (1 << 1) 521 #define USB_PD_CAP_PROVIDER_TYPE_C (1 << 2) 522 __u8 bNumOfPDObjects; 523 __u8 bReserved2; 524 __le32 wPowerDataObject[]; 525 } __attribute__((packed)); 526 #define USB_PTM_CAP_TYPE 0xb 527 struct usb_ptm_cap_descriptor { 528 __u8 bLength; 529 __u8 bDescriptorType; 530 __u8 bDevCapabilityType; 531 } __attribute__((packed)); 532 #define USB_DT_USB_PTM_ID_SIZE 3 533 #define USB_DT_USB_SSP_CAP_SIZE(ssac) (12 + (ssac + 1) * 4) 534 struct usb_wireless_ep_comp_descriptor { 535 __u8 bLength; 536 __u8 bDescriptorType; 537 __u8 bMaxBurst; 538 __u8 bMaxSequence; 539 __le16 wMaxStreamDelay; 540 __le16 wOverTheAirPacketSize; 541 __u8 bOverTheAirInterval; 542 __u8 bmCompAttributes; 543 #define USB_ENDPOINT_SWITCH_MASK 0x03 544 #define USB_ENDPOINT_SWITCH_NO 0 545 #define USB_ENDPOINT_SWITCH_SWITCH 1 546 #define USB_ENDPOINT_SWITCH_SCALE 2 547 } __attribute__((packed)); 548 struct usb_handshake { 549 __u8 bMessageNumber; 550 __u8 bStatus; 551 __u8 tTKID[3]; 552 __u8 bReserved; 553 __u8 CDID[16]; 554 __u8 nonce[16]; 555 __u8 MIC[8]; 556 } __attribute__((packed)); 557 struct usb_connection_context { 558 __u8 CHID[16]; 559 __u8 CDID[16]; 560 __u8 CK[16]; 561 } __attribute__((packed)); 562 enum usb_device_speed { 563 USB_SPEED_UNKNOWN = 0, 564 USB_SPEED_LOW, 565 USB_SPEED_FULL, 566 USB_SPEED_HIGH, 567 USB_SPEED_WIRELESS, 568 USB_SPEED_SUPER, 569 USB_SPEED_SUPER_PLUS, 570 }; 571 enum usb_device_state { 572 USB_STATE_NOTATTACHED = 0, 573 USB_STATE_ATTACHED, 574 USB_STATE_POWERED, 575 USB_STATE_RECONNECTING, 576 USB_STATE_UNAUTHENTICATED, 577 USB_STATE_DEFAULT, 578 USB_STATE_ADDRESS, 579 USB_STATE_CONFIGURED, 580 USB_STATE_SUSPENDED 581 }; 582 enum usb3_link_state { 583 USB3_LPM_U0 = 0, 584 USB3_LPM_U1, 585 USB3_LPM_U2, 586 USB3_LPM_U3 587 }; 588 #define USB3_LPM_DISABLED 0x0 589 #define USB3_LPM_U1_MAX_TIMEOUT 0x7F 590 #define USB3_LPM_U2_MAX_TIMEOUT 0xFE 591 #define USB3_LPM_DEVICE_INITIATED 0xFF 592 struct usb_set_sel_req { 593 __u8 u1_sel; 594 __u8 u1_pel; 595 __le16 u2_sel; 596 __le16 u2_pel; 597 } __attribute__((packed)); 598 #define USB3_LPM_MAX_U1_SEL_PEL 0xFF 599 #define USB3_LPM_MAX_U2_SEL_PEL 0xFFFF 600 #define USB_SELF_POWER_VBUS_MAX_DRAW 100 601 #endif 602