xref: /linux-6.15/include/uapi/linux/usb/functionfs.h (revision 7b07a2a7)
16f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
25e1ddb48SDavid Howells #ifndef _UAPI__LINUX_FUNCTIONFS_H__
35e1ddb48SDavid Howells #define _UAPI__LINUX_FUNCTIONFS_H__
45e1ddb48SDavid Howells 
55e1ddb48SDavid Howells 
65e1ddb48SDavid Howells #include <linux/types.h>
75e1ddb48SDavid Howells #include <linux/ioctl.h>
85e1ddb48SDavid Howells 
95e1ddb48SDavid Howells #include <linux/usb/ch9.h>
105e1ddb48SDavid Howells 
115e1ddb48SDavid Howells 
125e1ddb48SDavid Howells enum {
135e1ddb48SDavid Howells 	FUNCTIONFS_DESCRIPTORS_MAGIC = 1,
14ac8dde11SMichal Nazarewicz 	FUNCTIONFS_STRINGS_MAGIC = 2,
15ac8dde11SMichal Nazarewicz 	FUNCTIONFS_DESCRIPTORS_MAGIC_V2 = 3,
165e1ddb48SDavid Howells };
175e1ddb48SDavid Howells 
18ac8dde11SMichal Nazarewicz enum functionfs_flags {
19ac8dde11SMichal Nazarewicz 	FUNCTIONFS_HAS_FS_DESC = 1,
20ac8dde11SMichal Nazarewicz 	FUNCTIONFS_HAS_HS_DESC = 2,
21ac8dde11SMichal Nazarewicz 	FUNCTIONFS_HAS_SS_DESC = 4,
22f0175ab5SAndrzej Pietrasiewicz 	FUNCTIONFS_HAS_MS_OS_DESC = 8,
231b0bf88fSRobert Baldyga 	FUNCTIONFS_VIRTUAL_ADDR = 16,
245e33f6fdSRobert Baldyga 	FUNCTIONFS_EVENTFD = 32,
2554dfce6dSFelix Hädicke 	FUNCTIONFS_ALL_CTRL_RECIP = 64,
264368c28aSFelix Hädicke 	FUNCTIONFS_CONFIG0_SETUP = 128,
27ac8dde11SMichal Nazarewicz };
285e1ddb48SDavid Howells 
295e1ddb48SDavid Howells /* Descriptor of an non-audio endpoint */
305e1ddb48SDavid Howells struct usb_endpoint_descriptor_no_audio {
315e1ddb48SDavid Howells 	__u8  bLength;
325e1ddb48SDavid Howells 	__u8  bDescriptorType;
335e1ddb48SDavid Howells 
345e1ddb48SDavid Howells 	__u8  bEndpointAddress;
355e1ddb48SDavid Howells 	__u8  bmAttributes;
365e1ddb48SDavid Howells 	__le16 wMaxPacketSize;
375e1ddb48SDavid Howells 	__u8  bInterval;
385e1ddb48SDavid Howells } __attribute__((packed));
395e1ddb48SDavid Howells 
401df22b4eSMichal Nazarewicz struct usb_functionfs_descs_head_v2 {
411df22b4eSMichal Nazarewicz 	__le32 magic;
421df22b4eSMichal Nazarewicz 	__le32 length;
431df22b4eSMichal Nazarewicz 	__le32 flags;
441df22b4eSMichal Nazarewicz 	/*
451df22b4eSMichal Nazarewicz 	 * __le32 fs_count, hs_count, fs_count; must be included manually in
461df22b4eSMichal Nazarewicz 	 * the structure taking flags into consideration.
471df22b4eSMichal Nazarewicz 	 */
481df22b4eSMichal Nazarewicz } __attribute__((packed));
491df22b4eSMichal Nazarewicz 
5009122141SMichal Nazarewicz /* Legacy format, deprecated as of 3.14. */
5109122141SMichal Nazarewicz struct usb_functionfs_descs_head {
5209122141SMichal Nazarewicz 	__le32 magic;
5309122141SMichal Nazarewicz 	__le32 length;
5409122141SMichal Nazarewicz 	__le32 fs_count;
5509122141SMichal Nazarewicz 	__le32 hs_count;
5609122141SMichal Nazarewicz } __attribute__((packed, deprecated));
575e1ddb48SDavid Howells 
58f0175ab5SAndrzej Pietrasiewicz /* MS OS Descriptor header */
59f0175ab5SAndrzej Pietrasiewicz struct usb_os_desc_header {
60f0175ab5SAndrzej Pietrasiewicz 	__u8	interface;
61f0175ab5SAndrzej Pietrasiewicz 	__le32	dwLength;
62f0175ab5SAndrzej Pietrasiewicz 	__le16	bcdVersion;
63f0175ab5SAndrzej Pietrasiewicz 	__le16	wIndex;
64f0175ab5SAndrzej Pietrasiewicz 	union {
65f0175ab5SAndrzej Pietrasiewicz 		struct {
66f0175ab5SAndrzej Pietrasiewicz 			__u8	bCount;
67f0175ab5SAndrzej Pietrasiewicz 			__u8	Reserved;
68f0175ab5SAndrzej Pietrasiewicz 		};
69f0175ab5SAndrzej Pietrasiewicz 		__le16	wCount;
70f0175ab5SAndrzej Pietrasiewicz 	};
71f0175ab5SAndrzej Pietrasiewicz } __attribute__((packed));
72f0175ab5SAndrzej Pietrasiewicz 
73f0175ab5SAndrzej Pietrasiewicz struct usb_ext_compat_desc {
74f0175ab5SAndrzej Pietrasiewicz 	__u8	bFirstInterfaceNumber;
75f0175ab5SAndrzej Pietrasiewicz 	__u8	Reserved1;
7661fbf203SDmitry Antipov 	__struct_group(/* no tag */, IDs, /* no attrs */,
77f0175ab5SAndrzej Pietrasiewicz 		__u8	CompatibleID[8];
78f0175ab5SAndrzej Pietrasiewicz 		__u8	SubCompatibleID[8];
7961fbf203SDmitry Antipov 	);
80f0175ab5SAndrzej Pietrasiewicz 	__u8	Reserved2[6];
81f0175ab5SAndrzej Pietrasiewicz };
82f0175ab5SAndrzej Pietrasiewicz 
83f0175ab5SAndrzej Pietrasiewicz struct usb_ext_prop_desc {
84f0175ab5SAndrzej Pietrasiewicz 	__le32	dwSize;
85f0175ab5SAndrzej Pietrasiewicz 	__le32	dwPropertyDataType;
86f0175ab5SAndrzej Pietrasiewicz 	__le16	wPropertyNameLength;
87f0175ab5SAndrzej Pietrasiewicz } __attribute__((packed));
88f0175ab5SAndrzej Pietrasiewicz 
89*7b07a2a7SPaul Cercueil /* Flags for usb_ffs_dmabuf_transfer_req->flags (none for now) */
90*7b07a2a7SPaul Cercueil #define USB_FFS_DMABUF_TRANSFER_MASK	0x0
91*7b07a2a7SPaul Cercueil 
92*7b07a2a7SPaul Cercueil /**
93*7b07a2a7SPaul Cercueil  * struct usb_ffs_dmabuf_transfer_req - Transfer request for a DMABUF object
94*7b07a2a7SPaul Cercueil  * @fd:		file descriptor of the DMABUF object
95*7b07a2a7SPaul Cercueil  * @flags:	one or more USB_FFS_DMABUF_TRANSFER_* flags
96*7b07a2a7SPaul Cercueil  * @length:	number of bytes used in this DMABUF for the data transfer.
97*7b07a2a7SPaul Cercueil  *		Should generally be set to the DMABUF's size.
98*7b07a2a7SPaul Cercueil  */
99*7b07a2a7SPaul Cercueil struct usb_ffs_dmabuf_transfer_req {
100*7b07a2a7SPaul Cercueil 	int fd;
101*7b07a2a7SPaul Cercueil 	__u32 flags;
102*7b07a2a7SPaul Cercueil 	__u64 length;
103*7b07a2a7SPaul Cercueil } __attribute__((packed));
104*7b07a2a7SPaul Cercueil 
105f0175ab5SAndrzej Pietrasiewicz #ifndef __KERNEL__
1065e1ddb48SDavid Howells 
1075e1ddb48SDavid Howells /*
1085e1ddb48SDavid Howells  * Descriptors format:
1095e1ddb48SDavid Howells  *
1105e1ddb48SDavid Howells  * | off | name      | type         | description                          |
1115e1ddb48SDavid Howells  * |-----+-----------+--------------+--------------------------------------|
112ac8dde11SMichal Nazarewicz  * |   0 | magic     | LE32         | FUNCTIONFS_DESCRIPTORS_MAGIC_V2      |
113ac8dde11SMichal Nazarewicz  * |   4 | length    | LE32         | length of the whole data chunk       |
114ac8dde11SMichal Nazarewicz  * |   8 | flags     | LE32         | combination of functionfs_flags      |
11596a420d2SVincent Pelletier  * |     | eventfd   | LE32         | eventfd file descriptor              |
116ac8dde11SMichal Nazarewicz  * |     | fs_count  | LE32         | number of full-speed descriptors     |
117ac8dde11SMichal Nazarewicz  * |     | hs_count  | LE32         | number of high-speed descriptors     |
118ac8dde11SMichal Nazarewicz  * |     | ss_count  | LE32         | number of super-speed descriptors    |
119f0175ab5SAndrzej Pietrasiewicz  * |     | os_count  | LE32         | number of MS OS descriptors          |
120ac8dde11SMichal Nazarewicz  * |     | fs_descrs | Descriptor[] | list of full-speed descriptors       |
121ac8dde11SMichal Nazarewicz  * |     | hs_descrs | Descriptor[] | list of high-speed descriptors       |
122ac8dde11SMichal Nazarewicz  * |     | ss_descrs | Descriptor[] | list of super-speed descriptors      |
123f0175ab5SAndrzej Pietrasiewicz  * |     | os_descrs | OSDesc[]     | list of MS OS descriptors            |
124ac8dde11SMichal Nazarewicz  *
125ac8dde11SMichal Nazarewicz  * Depending on which flags are set, various fields may be missing in the
126ac8dde11SMichal Nazarewicz  * structure.  Any flags that are not recognised cause the whole block to be
127ac8dde11SMichal Nazarewicz  * rejected with -ENOSYS.
128ac8dde11SMichal Nazarewicz  *
12951c208c7SMichal Nazarewicz  * Legacy descriptors format (deprecated as of 3.14):
130ac8dde11SMichal Nazarewicz  *
131ac8dde11SMichal Nazarewicz  * | off | name      | type         | description                          |
132ac8dde11SMichal Nazarewicz  * |-----+-----------+--------------+--------------------------------------|
133ac8dde11SMichal Nazarewicz  * |   0 | magic     | LE32         | FUNCTIONFS_DESCRIPTORS_MAGIC         |
1345e1ddb48SDavid Howells  * |   4 | length    | LE32         | length of the whole data chunk       |
1355e1ddb48SDavid Howells  * |   8 | fs_count  | LE32         | number of full-speed descriptors     |
1365e1ddb48SDavid Howells  * |  12 | hs_count  | LE32         | number of high-speed descriptors     |
1375e1ddb48SDavid Howells  * |  16 | fs_descrs | Descriptor[] | list of full-speed descriptors       |
1385e1ddb48SDavid Howells  * |     | hs_descrs | Descriptor[] | list of high-speed descriptors       |
1395e1ddb48SDavid Howells  *
140ac8dde11SMichal Nazarewicz  * All numbers must be in little endian order.
141ac8dde11SMichal Nazarewicz  *
142ac8dde11SMichal Nazarewicz  * Descriptor[] is an array of valid USB descriptors which have the following
143ac8dde11SMichal Nazarewicz  * format:
1445e1ddb48SDavid Howells  *
1455e1ddb48SDavid Howells  * | off | name            | type | description              |
1465e1ddb48SDavid Howells  * |-----+-----------------+------+--------------------------|
1475e1ddb48SDavid Howells  * |   0 | bLength         | U8   | length of the descriptor |
1485e1ddb48SDavid Howells  * |   1 | bDescriptorType | U8   | descriptor type          |
1495e1ddb48SDavid Howells  * |   2 | payload         |      | descriptor's payload     |
150f0175ab5SAndrzej Pietrasiewicz  *
151f0175ab5SAndrzej Pietrasiewicz  * OSDesc[] is an array of valid MS OS Feature Descriptors which have one of
152f0175ab5SAndrzej Pietrasiewicz  * the following formats:
153f0175ab5SAndrzej Pietrasiewicz  *
154f0175ab5SAndrzej Pietrasiewicz  * | off | name            | type | description              |
155f0175ab5SAndrzej Pietrasiewicz  * |-----+-----------------+------+--------------------------|
156f0175ab5SAndrzej Pietrasiewicz  * |   0 | inteface        | U8   | related interface number |
157f0175ab5SAndrzej Pietrasiewicz  * |   1 | dwLength        | U32  | length of the descriptor |
158f0175ab5SAndrzej Pietrasiewicz  * |   5 | bcdVersion      | U16  | currently supported: 1   |
159f0175ab5SAndrzej Pietrasiewicz  * |   7 | wIndex          | U16  | currently supported: 4   |
160f0175ab5SAndrzej Pietrasiewicz  * |   9 | bCount          | U8   | number of ext. compat.   |
161f0175ab5SAndrzej Pietrasiewicz  * |  10 | Reserved        | U8   | 0                        |
162f0175ab5SAndrzej Pietrasiewicz  * |  11 | ExtCompat[]     |      | list of ext. compat. d.  |
163f0175ab5SAndrzej Pietrasiewicz  *
164f0175ab5SAndrzej Pietrasiewicz  * | off | name            | type | description              |
165f0175ab5SAndrzej Pietrasiewicz  * |-----+-----------------+------+--------------------------|
166f0175ab5SAndrzej Pietrasiewicz  * |   0 | inteface        | U8   | related interface number |
167f0175ab5SAndrzej Pietrasiewicz  * |   1 | dwLength        | U32  | length of the descriptor |
168f0175ab5SAndrzej Pietrasiewicz  * |   5 | bcdVersion      | U16  | currently supported: 1   |
169f0175ab5SAndrzej Pietrasiewicz  * |   7 | wIndex          | U16  | currently supported: 5   |
170f0175ab5SAndrzej Pietrasiewicz  * |   9 | wCount          | U16  | number of ext. compat.   |
171f0175ab5SAndrzej Pietrasiewicz  * |  11 | ExtProp[]       |      | list of ext. prop. d.    |
172f0175ab5SAndrzej Pietrasiewicz  *
173f0175ab5SAndrzej Pietrasiewicz  * ExtCompat[] is an array of valid Extended Compatiblity descriptors
174f0175ab5SAndrzej Pietrasiewicz  * which have the following format:
175f0175ab5SAndrzej Pietrasiewicz  *
176f0175ab5SAndrzej Pietrasiewicz  * | off | name                  | type | description                         |
177f0175ab5SAndrzej Pietrasiewicz  * |-----+-----------------------+------+-------------------------------------|
178f0175ab5SAndrzej Pietrasiewicz  * |   0 | bFirstInterfaceNumber | U8   | index of the interface or of the 1st|
179f0175ab5SAndrzej Pietrasiewicz  * |     |                       |      | interface in an IAD group           |
1801f7da4f8SVincent Pelletier  * |   1 | Reserved              | U8   | 1                                   |
181f0175ab5SAndrzej Pietrasiewicz  * |   2 | CompatibleID          | U8[8]| compatible ID string                |
182f0175ab5SAndrzej Pietrasiewicz  * |  10 | SubCompatibleID       | U8[8]| subcompatible ID string             |
183f0175ab5SAndrzej Pietrasiewicz  * |  18 | Reserved              | U8[6]| 0                                   |
184f0175ab5SAndrzej Pietrasiewicz  *
185f0175ab5SAndrzej Pietrasiewicz  * ExtProp[] is an array of valid Extended Properties descriptors
186f0175ab5SAndrzej Pietrasiewicz  * which have the following format:
187f0175ab5SAndrzej Pietrasiewicz  *
188f0175ab5SAndrzej Pietrasiewicz  * | off | name                  | type | description                         |
189f0175ab5SAndrzej Pietrasiewicz  * |-----+-----------------------+------+-------------------------------------|
190f0175ab5SAndrzej Pietrasiewicz  * |   0 | dwSize                | U32  | length of the descriptor            |
191f0175ab5SAndrzej Pietrasiewicz  * |   4 | dwPropertyDataType    | U32  | 1..7                                |
192f0175ab5SAndrzej Pietrasiewicz  * |   8 | wPropertyNameLength   | U16  | bPropertyName length (NL)           |
193f0175ab5SAndrzej Pietrasiewicz  * |  10 | bPropertyName         |U8[NL]| name of this property               |
194f0175ab5SAndrzej Pietrasiewicz  * |10+NL| dwPropertyDataLength  | U32  | bPropertyData length (DL)           |
195f0175ab5SAndrzej Pietrasiewicz  * |14+NL| bProperty             |U8[DL]| payload of this property            |
1965e1ddb48SDavid Howells  */
1975e1ddb48SDavid Howells 
1985e1ddb48SDavid Howells struct usb_functionfs_strings_head {
1995e1ddb48SDavid Howells 	__le32 magic;
2005e1ddb48SDavid Howells 	__le32 length;
2015e1ddb48SDavid Howells 	__le32 str_count;
2025e1ddb48SDavid Howells 	__le32 lang_count;
2035e1ddb48SDavid Howells } __attribute__((packed));
2045e1ddb48SDavid Howells 
2055e1ddb48SDavid Howells /*
2065e1ddb48SDavid Howells  * Strings format:
2075e1ddb48SDavid Howells  *
2085e1ddb48SDavid Howells  * | off | name       | type                  | description                |
2095e1ddb48SDavid Howells  * |-----+------------+-----------------------+----------------------------|
2105e1ddb48SDavid Howells  * |   0 | magic      | LE32                  | FUNCTIONFS_STRINGS_MAGIC   |
2115e1ddb48SDavid Howells  * |   4 | length     | LE32                  | length of the data chunk   |
2125e1ddb48SDavid Howells  * |   8 | str_count  | LE32                  | number of strings          |
2135e1ddb48SDavid Howells  * |  12 | lang_count | LE32                  | number of languages        |
2145e1ddb48SDavid Howells  * |  16 | stringtab  | StringTab[lang_count] | table of strings per lang  |
2155e1ddb48SDavid Howells  *
2165e1ddb48SDavid Howells  * For each language there is one stringtab entry (ie. there are lang_count
2175e1ddb48SDavid Howells  * stringtab entires).  Each StringTab has following format:
2185e1ddb48SDavid Howells  *
2195e1ddb48SDavid Howells  * | off | name    | type              | description                        |
2205e1ddb48SDavid Howells  * |-----+---------+-------------------+------------------------------------|
2215e1ddb48SDavid Howells  * |   0 | lang    | LE16              | language code                      |
2225e1ddb48SDavid Howells  * |   2 | strings | String[str_count] | array of strings in given language |
2235e1ddb48SDavid Howells  *
2245e1ddb48SDavid Howells  * For each string there is one strings entry (ie. there are str_count
2255e1ddb48SDavid Howells  * string entries).  Each String is a NUL terminated string encoded in
2265e1ddb48SDavid Howells  * UTF-8.
2275e1ddb48SDavid Howells  */
2285e1ddb48SDavid Howells 
2295e1ddb48SDavid Howells #endif
2305e1ddb48SDavid Howells 
2315e1ddb48SDavid Howells 
2325e1ddb48SDavid Howells /*
2335e1ddb48SDavid Howells  * Events are delivered on the ep0 file descriptor, when the user mode driver
2345e1ddb48SDavid Howells  * reads from this file descriptor after writing the descriptors.  Don't
2355e1ddb48SDavid Howells  * stop polling this descriptor.
2365e1ddb48SDavid Howells  */
2375e1ddb48SDavid Howells 
2385e1ddb48SDavid Howells enum usb_functionfs_event_type {
2395e1ddb48SDavid Howells 	FUNCTIONFS_BIND,
2405e1ddb48SDavid Howells 	FUNCTIONFS_UNBIND,
2415e1ddb48SDavid Howells 
2425e1ddb48SDavid Howells 	FUNCTIONFS_ENABLE,
2435e1ddb48SDavid Howells 	FUNCTIONFS_DISABLE,
2445e1ddb48SDavid Howells 
2455e1ddb48SDavid Howells 	FUNCTIONFS_SETUP,
2465e1ddb48SDavid Howells 
2475e1ddb48SDavid Howells 	FUNCTIONFS_SUSPEND,
2485e1ddb48SDavid Howells 	FUNCTIONFS_RESUME
2495e1ddb48SDavid Howells };
2505e1ddb48SDavid Howells 
2515e1ddb48SDavid Howells /* NOTE:  this structure must stay the same size and layout on
2525e1ddb48SDavid Howells  * both 32-bit and 64-bit kernels.
2535e1ddb48SDavid Howells  */
2545e1ddb48SDavid Howells struct usb_functionfs_event {
2555e1ddb48SDavid Howells 	union {
2565e1ddb48SDavid Howells 		/* SETUP: packet; DATA phase i/o precedes next event
2575e1ddb48SDavid Howells 		 *(setup.bmRequestType & USB_DIR_IN) flags direction */
2585e1ddb48SDavid Howells 		struct usb_ctrlrequest	setup;
2595e1ddb48SDavid Howells 	} __attribute__((packed)) u;
2605e1ddb48SDavid Howells 
2615e1ddb48SDavid Howells 	/* enum usb_functionfs_event_type */
2625e1ddb48SDavid Howells 	__u8				type;
2635e1ddb48SDavid Howells 	__u8				_pad[3];
2645e1ddb48SDavid Howells } __attribute__((packed));
2655e1ddb48SDavid Howells 
2665e1ddb48SDavid Howells 
2675e1ddb48SDavid Howells /* Endpoint ioctls */
2685e1ddb48SDavid Howells /* The same as in gadgetfs */
2695e1ddb48SDavid Howells 
2705e1ddb48SDavid Howells /* IN transfers may be reported to the gadget driver as complete
2715e1ddb48SDavid Howells  *	when the fifo is loaded, before the host reads the data;
2725e1ddb48SDavid Howells  * OUT transfers may be reported to the host's "client" driver as
2735e1ddb48SDavid Howells  *	complete when they're sitting in the FIFO unread.
2745e1ddb48SDavid Howells  * THIS returns how many bytes are "unclaimed" in the endpoint fifo
2755e1ddb48SDavid Howells  * (needed for precise fault handling, when the hardware allows it)
2765e1ddb48SDavid Howells  */
2775e1ddb48SDavid Howells #define	FUNCTIONFS_FIFO_STATUS	_IO('g', 1)
2785e1ddb48SDavid Howells 
2795e1ddb48SDavid Howells /* discards any unclaimed data in the fifo. */
2805e1ddb48SDavid Howells #define	FUNCTIONFS_FIFO_FLUSH	_IO('g', 2)
2815e1ddb48SDavid Howells 
2825e1ddb48SDavid Howells /* resets endpoint halt+toggle; used to implement set_interface.
2835e1ddb48SDavid Howells  * some hardware (like pxa2xx) can't support this.
2845e1ddb48SDavid Howells  */
2855e1ddb48SDavid Howells #define	FUNCTIONFS_CLEAR_HALT	_IO('g', 3)
2865e1ddb48SDavid Howells 
2875e1ddb48SDavid Howells /* Specific for functionfs */
2885e1ddb48SDavid Howells 
2895e1ddb48SDavid Howells /*
2905e1ddb48SDavid Howells  * Returns reverse mapping of an interface.  Called on EP0.  If there
2915e1ddb48SDavid Howells  * is no such interface returns -EDOM.  If function is not active
2925e1ddb48SDavid Howells  * returns -ENODEV.
2935e1ddb48SDavid Howells  */
2945e1ddb48SDavid Howells #define	FUNCTIONFS_INTERFACE_REVMAP	_IO('g', 128)
2955e1ddb48SDavid Howells 
2965e1ddb48SDavid Howells /*
297222155deSJerry Zhang  * Returns real bEndpointAddress of an endpoint. If endpoint shuts down
298222155deSJerry Zhang  * during the call, returns -ESHUTDOWN.
2995e1ddb48SDavid Howells  */
3005e1ddb48SDavid Howells #define	FUNCTIONFS_ENDPOINT_REVMAP	_IO('g', 129)
3015e1ddb48SDavid Howells 
302c559a353SRobert Baldyga /*
303222155deSJerry Zhang  * Returns endpoint descriptor. If endpoint shuts down during the call,
304222155deSJerry Zhang  * returns -ESHUTDOWN.
305c559a353SRobert Baldyga  */
306c559a353SRobert Baldyga #define	FUNCTIONFS_ENDPOINT_DESC	_IOR('g', 130, \
307c559a353SRobert Baldyga 					     struct usb_endpoint_descriptor)
308c559a353SRobert Baldyga 
309*7b07a2a7SPaul Cercueil /*
310*7b07a2a7SPaul Cercueil  * Attach the DMABUF object, identified by its file descriptor, to the
311*7b07a2a7SPaul Cercueil  * data endpoint. Returns zero on success, and a negative errno value
312*7b07a2a7SPaul Cercueil  * on error.
313*7b07a2a7SPaul Cercueil  */
314*7b07a2a7SPaul Cercueil #define FUNCTIONFS_DMABUF_ATTACH	_IOW('g', 131, int)
3155e1ddb48SDavid Howells 
3165e1ddb48SDavid Howells 
317*7b07a2a7SPaul Cercueil /*
318*7b07a2a7SPaul Cercueil  * Detach the given DMABUF object, identified by its file descriptor,
319*7b07a2a7SPaul Cercueil  * from the data endpoint. Returns zero on success, and a negative
320*7b07a2a7SPaul Cercueil  * errno value on error. Note that closing the endpoint's file
321*7b07a2a7SPaul Cercueil  * descriptor will automatically detach all attached DMABUFs.
322*7b07a2a7SPaul Cercueil  */
323*7b07a2a7SPaul Cercueil #define FUNCTIONFS_DMABUF_DETACH	_IOW('g', 132, int)
324*7b07a2a7SPaul Cercueil 
325*7b07a2a7SPaul Cercueil /*
326*7b07a2a7SPaul Cercueil  * Enqueue the previously attached DMABUF to the transfer queue.
327*7b07a2a7SPaul Cercueil  * The argument is a structure that packs the DMABUF's file descriptor,
328*7b07a2a7SPaul Cercueil  * the size in bytes to transfer (which should generally correspond to
329*7b07a2a7SPaul Cercueil  * the size of the DMABUF), and a 'flags' field which is unused
330*7b07a2a7SPaul Cercueil  * for now. Returns zero on success, and a negative errno value on
331*7b07a2a7SPaul Cercueil  * error.
332*7b07a2a7SPaul Cercueil  */
333*7b07a2a7SPaul Cercueil #define FUNCTIONFS_DMABUF_TRANSFER	_IOW('g', 133, \
334*7b07a2a7SPaul Cercueil 					     struct usb_ffs_dmabuf_transfer_req)
335*7b07a2a7SPaul Cercueil 
3365e1ddb48SDavid Howells #endif /* _UAPI__LINUX_FUNCTIONFS_H__ */
337