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