xref: /linux/drivers/usb/gadget/legacy/Kconfig (revision f86fd32d)
1# SPDX-License-Identifier: GPL-2.0
2#
3# USB Gadget support on a system involves
4#    (a) a peripheral controller, and
5#    (b) the gadget driver using it.
6#
7# NOTE:  Gadget support ** DOES NOT ** depend on host-side CONFIG_USB !!
8#
9#  - Host systems (like PCs) need CONFIG_USB (with "A" jacks).
10#  - Peripherals (like PDAs) need CONFIG_USB_GADGET (with "B" jacks).
11#  - Some systems have both kinds of controllers.
12#
13# With help from a special transceiver and a "Mini-AB" jack, systems with
14# both kinds of controller can also support "USB On-the-Go" (CONFIG_USB_OTG).
15#
16
17choice
18	tristate "USB Gadget precomposed configurations"
19	default USB_ETH
20	optional
21	help
22	  A Linux "Gadget Driver" talks to the USB Peripheral Controller
23	  driver through the abstract "gadget" API.  Some other operating
24	  systems call these "client" drivers, of which "class drivers"
25	  are a subset (implementing a USB device class specification).
26	  A gadget driver implements one or more USB functions using
27	  the peripheral hardware.
28
29	  Gadget drivers are hardware-neutral, or "platform independent",
30	  except that they sometimes must understand quirks or limitations
31	  of the particular controllers they work with.  For example, when
32	  a controller doesn't support alternate configurations or provide
33	  enough of the right types of endpoints, the gadget driver might
34	  not be able work with that controller, or might need to implement
35	  a less common variant of a device class protocol.
36
37	  The available choices each represent a single precomposed USB
38	  gadget configuration. In the device model, each option contains
39	  both the device instantiation as a child for a USB gadget
40	  controller, and the relevant drivers for each function declared
41	  by the device.
42
43config USB_ZERO
44	tristate "Gadget Zero (DEVELOPMENT)"
45	select USB_LIBCOMPOSITE
46	select USB_F_SS_LB
47	help
48	  Gadget Zero is a two-configuration device.  It either sinks and
49	  sources bulk data; or it loops back a configurable number of
50	  transfers.  It also implements control requests, for "chapter 9"
51	  conformance.  The driver needs only two bulk-capable endpoints, so
52	  it can work on top of most device-side usb controllers.  It's
53	  useful for testing, and is also a working example showing how
54	  USB "gadget drivers" can be written.
55
56	  Make this be the first driver you try using on top of any new
57	  USB peripheral controller driver.  Then you can use host-side
58	  test software, like the "usbtest" driver, to put your hardware
59	  and its driver through a basic set of functional tests.
60
61	  Gadget Zero also works with the host-side "usb-skeleton" driver,
62	  and with many kinds of host-side test software.  You may need
63	  to tweak product and vendor IDs before host software knows about
64	  this device, and arrange to select an appropriate configuration.
65
66	  Say "y" to link the driver statically, or "m" to build a
67	  dynamically linked module called "g_zero".
68
69config USB_ZERO_HNPTEST
70	bool "HNP Test Device"
71	depends on USB_ZERO && USB_OTG
72	help
73	  You can configure this device to enumerate using the device
74	  identifiers of the USB-OTG test device.  That means that when
75	  this gadget connects to another OTG device, with this one using
76	  the "B-Peripheral" role, that device will use HNP to let this
77	  one serve as the USB host instead (in the "B-Host" role).
78
79config USB_AUDIO
80	tristate "Audio Gadget"
81	depends on SND
82	select USB_LIBCOMPOSITE
83	select SND_PCM
84	select USB_F_UAC1 if (GADGET_UAC1 && !GADGET_UAC1_LEGACY)
85	select USB_F_UAC1_LEGACY if (GADGET_UAC1 && GADGET_UAC1_LEGACY)
86	select USB_F_UAC2 if !GADGET_UAC1
87	select USB_U_AUDIO if (USB_F_UAC2 || USB_F_UAC1)
88	help
89	  This Gadget Audio driver is compatible with USB Audio Class
90	  specification 2.0. It implements 1 AudioControl interface,
91	  1 AudioStreaming Interface each for USB-OUT and USB-IN.
92	  Number of channels, sample rate and sample size can be
93	  specified as module parameters.
94	  This driver doesn't expect any real Audio codec to be present
95	  on the device - the audio streams are simply sinked to and
96	  sourced from a virtual ALSA sound card created. The user-space
97	  application may choose to do whatever it wants with the data
98	  received from the USB Host and choose to provide whatever it
99	  wants as audio data to the USB Host.
100
101	  Say "y" to link the driver statically, or "m" to build a
102	  dynamically linked module called "g_audio".
103
104config GADGET_UAC1
105	bool "UAC 1.0"
106	depends on USB_AUDIO
107	help
108	  If you instead want older USB Audio Class specification 1.0 support
109	  with similar driver capabilities.
110
111config GADGET_UAC1_LEGACY
112	bool "UAC 1.0 (Legacy)"
113	depends on GADGET_UAC1
114	help
115	  If you instead want legacy UAC Spec-1.0 driver that also has audio
116	  paths hardwired to the Audio codec chip on-board and doesn't work
117	  without one.
118
119config USB_ETH
120	tristate "Ethernet Gadget (with CDC Ethernet support)"
121	depends on NET
122	select USB_LIBCOMPOSITE
123	select USB_U_ETHER
124	select USB_F_ECM
125	select USB_F_SUBSET
126	select CRC32
127	help
128	  This driver implements Ethernet style communication, in one of
129	  several ways:
130
131	   - The "Communication Device Class" (CDC) Ethernet Control Model.
132	     That protocol is often avoided with pure Ethernet adapters, in
133	     favor of simpler vendor-specific hardware, but is widely
134	     supported by firmware for smart network devices.
135
136	   - On hardware can't implement that protocol, a simple CDC subset
137	     is used, placing fewer demands on USB.
138
139	   - CDC Ethernet Emulation Model (EEM) is a newer standard that has
140	     a simpler interface that can be used by more USB hardware.
141
142	  RNDIS support is an additional option, more demanding than subset.
143
144	  Within the USB device, this gadget driver exposes a network device
145	  "usbX", where X depends on what other networking devices you have.
146	  Treat it like a two-node Ethernet link:  host, and gadget.
147
148	  The Linux-USB host-side "usbnet" driver interoperates with this
149	  driver, so that deep I/O queues can be supported.  On 2.4 kernels,
150	  use "CDCEther" instead, if you're using the CDC option. That CDC
151	  mode should also interoperate with standard CDC Ethernet class
152	  drivers on other host operating systems.
153
154	  Say "y" to link the driver statically, or "m" to build a
155	  dynamically linked module called "g_ether".
156
157config USB_ETH_RNDIS
158	bool "RNDIS support"
159	depends on USB_ETH
160	select USB_LIBCOMPOSITE
161	select USB_F_RNDIS
162	default y
163	help
164	   Microsoft Windows XP bundles the "Remote NDIS" (RNDIS) protocol,
165	   and Microsoft provides redistributable binary RNDIS drivers for
166	   older versions of Windows.
167
168	   If you say "y" here, the Ethernet gadget driver will try to provide
169	   a second device configuration, supporting RNDIS to talk to such
170	   Microsoft USB hosts.
171
172	   To make MS-Windows work with this, use Documentation/usb/linux.inf
173	   as the "driver info file".  For versions of MS-Windows older than
174	   XP, you'll need to download drivers from Microsoft's website; a URL
175	   is given in comments found in that info file.
176
177config USB_ETH_EEM
178	bool "Ethernet Emulation Model (EEM) support"
179	depends on USB_ETH
180	select USB_LIBCOMPOSITE
181	select USB_F_EEM
182	help
183	  CDC EEM is a newer USB standard that is somewhat simpler than CDC ECM
184	  and therefore can be supported by more hardware.  Technically ECM and
185	  EEM are designed for different applications.  The ECM model extends
186	  the network interface to the target (e.g. a USB cable modem), and the
187	  EEM model is for mobile devices to communicate with hosts using
188	  ethernet over USB.  For Linux gadgets, however, the interface with
189	  the host is the same (a usbX device), so the differences are minimal.
190
191	  If you say "y" here, the Ethernet gadget driver will use the EEM
192	  protocol rather than ECM.  If unsure, say "n".
193
194config USB_G_NCM
195	tristate "Network Control Model (NCM) support"
196	depends on NET
197	select USB_LIBCOMPOSITE
198	select USB_U_ETHER
199	select USB_F_NCM
200	select CRC32
201	help
202	  This driver implements USB CDC NCM subclass standard. NCM is
203	  an advanced protocol for Ethernet encapsulation, allows grouping
204	  of several ethernet frames into one USB transfer and different
205	  alignment possibilities.
206
207	  Say "y" to link the driver statically, or "m" to build a
208	  dynamically linked module called "g_ncm".
209
210config USB_GADGETFS
211	tristate "Gadget Filesystem"
212	help
213	  This driver provides a filesystem based API that lets user mode
214	  programs implement a single-configuration USB device, including
215	  endpoint I/O and control requests that don't relate to enumeration.
216	  All endpoints, transfer speeds, and transfer types supported by
217	  the hardware are available, through read() and write() calls.
218
219	  Say "y" to link the driver statically, or "m" to build a
220	  dynamically linked module called "gadgetfs".
221
222config USB_FUNCTIONFS
223	tristate "Function Filesystem"
224	select USB_LIBCOMPOSITE
225	select USB_F_FS
226	select USB_FUNCTIONFS_GENERIC if !(USB_FUNCTIONFS_ETH || USB_FUNCTIONFS_RNDIS)
227	help
228	  The Function Filesystem (FunctionFS) lets one create USB
229	  composite functions in user space in the same way GadgetFS
230	  lets one create USB gadgets in user space.  This allows creation
231	  of composite gadgets such that some of the functions are
232	  implemented in kernel space (for instance Ethernet, serial or
233	  mass storage) and other are implemented in user space.
234
235	  If you say "y" or "m" here you will be able what kind of
236	  configurations the gadget will provide.
237
238	  Say "y" to link the driver statically, or "m" to build
239	  a dynamically linked module called "g_ffs".
240
241config USB_FUNCTIONFS_ETH
242	bool "Include configuration with CDC ECM (Ethernet)"
243	depends on USB_FUNCTIONFS && NET
244	select USB_U_ETHER
245	select USB_F_ECM
246	select USB_F_SUBSET
247	help
248	  Include a configuration with CDC ECM function (Ethernet) and the
249	  Function Filesystem.
250
251config USB_FUNCTIONFS_RNDIS
252	bool "Include configuration with RNDIS (Ethernet)"
253	depends on USB_FUNCTIONFS && NET
254	select USB_U_ETHER
255	select USB_F_RNDIS
256	help
257	  Include a configuration with RNDIS function (Ethernet) and the Filesystem.
258
259config USB_FUNCTIONFS_GENERIC
260	bool "Include 'pure' configuration"
261	depends on USB_FUNCTIONFS
262	help
263	  Include a configuration with the Function Filesystem alone with
264	  no Ethernet interface.
265
266config USB_MASS_STORAGE
267	tristate "Mass Storage Gadget"
268	depends on BLOCK
269	select USB_LIBCOMPOSITE
270	select USB_F_MASS_STORAGE
271	help
272	  The Mass Storage Gadget acts as a USB Mass Storage disk drive.
273	  As its storage repository it can use a regular file or a block
274	  device (in much the same way as the "loop" device driver),
275	  specified as a module parameter or sysfs option.
276
277	  This driver is a replacement for now removed File-backed
278	  Storage Gadget (g_file_storage).
279
280	  Say "y" to link the driver statically, or "m" to build
281	  a dynamically linked module called "g_mass_storage".
282
283config USB_GADGET_TARGET
284	tristate "USB Gadget Target Fabric Module"
285	depends on TARGET_CORE
286	select USB_LIBCOMPOSITE
287	select USB_F_TCM
288	help
289	  This fabric is an USB gadget. Two USB protocols are supported that is
290	  BBB or BOT (Bulk Only Transport) and UAS (USB Attached SCSI). BOT is
291	  advertised on alternative interface 0 (primary) and UAS is on
292	  alternative interface 1. Both protocols can work on USB2.0 and USB3.0.
293	  UAS utilizes the USB 3.0 feature called streams support.
294
295config USB_G_SERIAL
296	tristate "Serial Gadget (with CDC ACM and CDC OBEX support)"
297	depends on TTY
298	select USB_U_SERIAL
299	select USB_F_ACM
300	select USB_F_SERIAL
301	select USB_F_OBEX
302	select USB_LIBCOMPOSITE
303	help
304	  The Serial Gadget talks to the Linux-USB generic serial driver.
305	  This driver supports a CDC-ACM module option, which can be used
306	  to interoperate with MS-Windows hosts or with the Linux-USB
307	  "cdc-acm" driver.
308
309	  This driver also supports a CDC-OBEX option.  You will need a
310	  user space OBEX server talking to /dev/ttyGS*, since the kernel
311	  itself doesn't implement the OBEX protocol.
312
313	  Say "y" to link the driver statically, or "m" to build a
314	  dynamically linked module called "g_serial".
315
316	  For more information, see Documentation/usb/gadget_serial.rst
317	  which includes instructions and a "driver info file" needed to
318	  make MS-Windows work with CDC ACM.
319
320config USB_MIDI_GADGET
321	tristate "MIDI Gadget"
322	depends on SND
323	select USB_LIBCOMPOSITE
324	select SND_RAWMIDI
325	select USB_F_MIDI
326	help
327	  The MIDI Gadget acts as a USB Audio device, with one MIDI
328	  input and one MIDI output. These MIDI jacks appear as
329	  a sound "card" in the ALSA sound system. Other MIDI
330	  connections can then be made on the gadget system, using
331	  ALSA's aconnect utility etc.
332
333	  Say "y" to link the driver statically, or "m" to build a
334	  dynamically linked module called "g_midi".
335
336config USB_G_PRINTER
337	tristate "Printer Gadget"
338	select USB_LIBCOMPOSITE
339	select USB_F_PRINTER
340	help
341	  The Printer Gadget channels data between the USB host and a
342	  userspace program driving the print engine. The user space
343	  program reads and writes the device file /dev/g_printer to
344	  receive or send printer data. It can use ioctl calls to
345	  the device file to get or set printer status.
346
347	  Say "y" to link the driver statically, or "m" to build a
348	  dynamically linked module called "g_printer".
349
350	  For more information, see Documentation/usb/gadget_printer.rst
351	  which includes sample code for accessing the device file.
352
353if TTY
354
355config USB_CDC_COMPOSITE
356	tristate "CDC Composite Device (Ethernet and ACM)"
357	depends on NET
358	select USB_LIBCOMPOSITE
359	select USB_U_SERIAL
360	select USB_U_ETHER
361	select USB_F_ACM
362	select USB_F_ECM
363	help
364	  This driver provides two functions in one configuration:
365	  a CDC Ethernet (ECM) link, and a CDC ACM (serial port) link.
366
367	  This driver requires four bulk and two interrupt endpoints,
368	  plus the ability to handle altsettings.  Not all peripheral
369	  controllers are that capable.
370
371	  Say "y" to link the driver statically, or "m" to build a
372	  dynamically linked module.
373
374config USB_G_NOKIA
375	tristate "Nokia composite gadget"
376	depends on PHONET
377	depends on BLOCK
378	select USB_LIBCOMPOSITE
379	select USB_U_SERIAL
380	select USB_U_ETHER
381	select USB_F_ACM
382	select USB_F_OBEX
383	select USB_F_PHONET
384	select USB_F_ECM
385	select USB_F_MASS_STORAGE
386	help
387	  The Nokia composite gadget provides support for acm, obex
388	  and phonet in only one composite gadget driver.
389
390	  It's only really useful for N900 hardware. If you're building
391	  a kernel for N900, say Y or M here. If unsure, say N.
392
393config USB_G_ACM_MS
394	tristate "CDC Composite Device (ACM and mass storage)"
395	depends on BLOCK
396	select USB_LIBCOMPOSITE
397	select USB_U_SERIAL
398	select USB_F_ACM
399	select USB_F_MASS_STORAGE
400	help
401	  This driver provides two functions in one configuration:
402	  a mass storage, and a CDC ACM (serial port) link.
403
404	  Say "y" to link the driver statically, or "m" to build a
405	  dynamically linked module called "g_acm_ms".
406
407config USB_G_MULTI
408	tristate "Multifunction Composite Gadget"
409	depends on BLOCK && NET
410	select USB_G_MULTI_CDC if !USB_G_MULTI_RNDIS
411	select USB_LIBCOMPOSITE
412	select USB_U_SERIAL
413	select USB_U_ETHER
414	select USB_F_ACM
415	select USB_F_MASS_STORAGE
416	help
417	  The Multifunction Composite Gadget provides Ethernet (RNDIS
418	  and/or CDC Ethernet), mass storage and ACM serial link
419	  interfaces.
420
421	  You will be asked to choose which of the two configurations is
422	  to be available in the gadget.  At least one configuration must
423	  be chosen to make the gadget usable.  Selecting more than one
424	  configuration will prevent Windows from automatically detecting
425	  the gadget as a composite gadget, so an INF file will be needed to
426	  use the gadget.
427
428	  Say "y" to link the driver statically, or "m" to build a
429	  dynamically linked module called "g_multi".
430
431config USB_G_MULTI_RNDIS
432	bool "RNDIS + CDC Serial + Storage configuration"
433	depends on USB_G_MULTI
434	select USB_F_RNDIS
435	default y
436	help
437	  This option enables a configuration with RNDIS, CDC Serial and
438	  Mass Storage functions available in the Multifunction Composite
439	  Gadget.  This is the configuration dedicated for Windows since RNDIS
440	  is Microsoft's protocol.
441
442	  If unsure, say "y".
443
444config USB_G_MULTI_CDC
445	bool "CDC Ethernet + CDC Serial + Storage configuration"
446	depends on USB_G_MULTI
447	select USB_F_ECM
448	help
449	  This option enables a configuration with CDC Ethernet (ECM), CDC
450	  Serial and Mass Storage functions available in the Multifunction
451	  Composite Gadget.
452
453	  If unsure, say "y".
454
455endif # TTY
456
457config USB_G_HID
458	tristate "HID Gadget"
459	select USB_LIBCOMPOSITE
460	select USB_F_HID
461	help
462	  The HID gadget driver provides generic emulation of USB
463	  Human Interface Devices (HID).
464
465	  For more information, see Documentation/usb/gadget_hid.rst which
466	  includes sample code for accessing the device files.
467
468	  Say "y" to link the driver statically, or "m" to build a
469	  dynamically linked module called "g_hid".
470
471# Standalone / single function gadgets
472config USB_G_DBGP
473	tristate "EHCI Debug Device Gadget"
474	depends on TTY
475	select USB_LIBCOMPOSITE
476	help
477	  This gadget emulates an EHCI Debug device. This is useful when you want
478	  to interact with an EHCI Debug Port.
479
480	  Say "y" to link the driver statically, or "m" to build a
481	  dynamically linked module called "g_dbgp".
482
483if USB_G_DBGP
484choice
485	prompt "EHCI Debug Device mode"
486	default USB_G_DBGP_SERIAL
487
488config USB_G_DBGP_PRINTK
489	depends on USB_G_DBGP
490	bool "printk"
491	help
492	  Directly printk() received data. No interaction.
493
494config USB_G_DBGP_SERIAL
495	depends on USB_G_DBGP
496	select USB_U_SERIAL
497	bool "serial"
498	help
499	  Userland can interact using /dev/ttyGSxxx.
500endchoice
501endif
502
503# put drivers that need isochronous transfer support (for audio
504# or video class gadget drivers), or specific hardware, here.
505config USB_G_WEBCAM
506	tristate "USB Webcam Gadget"
507	depends on VIDEO_V4L2
508	select USB_LIBCOMPOSITE
509	select VIDEOBUF2_VMALLOC
510	select USB_F_UVC
511	help
512	  The Webcam Gadget acts as a composite USB Audio and Video Class
513	  device. It provides a userspace API to process UVC control requests
514	  and stream video data to the host.
515
516	  Say "y" to link the driver statically, or "m" to build a
517	  dynamically linked module called "g_webcam".
518
519endchoice
520