Merge drm/drm-fixes into drm-misc-fixes
[linux-2.6-block.git] / include / linux / usb / ch9.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
1da177e4 2/*
672027a3
IPG
3 * This file holds USB constants and structures that are needed for
4 * USB device APIs. These are used by the USB device model, which is
5 * defined in chapter 9 of the USB 2.0 specification and in the
1e4c5742 6 * Wireless USB 1.0 spec (now defunct). Linux has several APIs in C that
672027a3 7 * need these:
1da177e4 8 *
c8d141ce 9 * - the host side Linux-USB kernel driver API;
1da177e4 10 * - the "usbfs" user space API; and
c8d141ce 11 * - the Linux "gadget" device/peripheral side driver API.
1da177e4
LT
12 *
13 * USB 2.0 adds an additional "On The Go" (OTG) mode, which lets systems
c8d141ce
GKH
14 * act either as a USB host or as a USB device. That means the host and
15 * device side APIs benefit from working well together.
5da0106f 16 *
672027a3
IPG
17 * Note all descriptors are declared '__attribute__((packed))' so that:
18 *
19 * [a] they never get padded, either internally (USB spec writers
20 * probably handled that) or externally;
21 *
22 * [b] so that accessing bigger-than-a-bytes fields will never
23 * generate bus errors on any platform, even when the location of
24 * its descriptor inside a bundle isn't "naturally aligned", and
25 *
26 * [c] for consistency, removing all doubt even when it appears to
27 * someone that the two other points are non-issues for that
28 * particular descriptor type.
1da177e4 29 */
1da177e4
LT
30#ifndef __LINUX_USB_CH9_H
31#define __LINUX_USB_CH9_H
32
5e1ddb48 33#include <uapi/linux/usb/ch9.h>
1da177e4 34
f2fc9ff2
TN
35/* USB 3.2 SuperSpeed Plus phy signaling rate generation and lane count */
36
37enum usb_ssp_rate {
38 USB_SSP_GEN_UNKNOWN = 0,
39 USB_SSP_GEN_2x1,
40 USB_SSP_GEN_1x2,
41 USB_SSP_GEN_2x2,
42};
43
01ec4a2e
IM
44struct device;
45
4d537f37 46extern const char *usb_ep_type_string(int ep_type);
e538dfda 47extern const char *usb_speed_string(enum usb_device_speed speed);
63863b98 48extern enum usb_device_speed usb_get_maximum_speed(struct device *dev);
52c2d157 49extern enum usb_ssp_rate usb_get_maximum_ssp_rate(struct device *dev);
d1e3d757 50extern const char *usb_state_string(enum usb_device_state state);
fb95c7cf
CY
51unsigned int usb_decode_interval(const struct usb_endpoint_descriptor *epd,
52 enum usb_device_speed speed);
53
91f255a2 54#ifdef CONFIG_TRACING
91f255a2
PL
55extern const char *usb_decode_ctrl(char *str, size_t size, __u8 bRequestType,
56 __u8 bRequest, __u16 wValue, __u16 wIndex,
57 __u16 wLength);
58#endif
59
dda43a0e 60#endif /* __LINUX_USB_CH9_H */