162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci#
362306a36Sopenharmony_ci# USB Gadget support on a system involves
462306a36Sopenharmony_ci#    (a) a peripheral controller, and
562306a36Sopenharmony_ci#    (b) the gadget driver using it.
662306a36Sopenharmony_ci#
762306a36Sopenharmony_ci# NOTE:  Gadget support ** DOES NOT ** depend on host-side CONFIG_USB !!
862306a36Sopenharmony_ci#
962306a36Sopenharmony_ci#  - Host systems (like PCs) need CONFIG_USB (with "A" jacks).
1062306a36Sopenharmony_ci#  - Peripherals (like PDAs) need CONFIG_USB_GADGET (with "B" jacks).
1162306a36Sopenharmony_ci#  - Some systems have both kinds of controllers.
1262306a36Sopenharmony_ci#
1362306a36Sopenharmony_ci# With help from a special transceiver and a "Mini-AB" jack, systems with
1462306a36Sopenharmony_ci# both kinds of controller can also support "USB On-the-Go" (CONFIG_USB_OTG).
1562306a36Sopenharmony_ci#
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_cimenuconfig USB_GADGET
1862306a36Sopenharmony_ci	tristate "USB Gadget Support"
1962306a36Sopenharmony_ci	select USB_COMMON
2062306a36Sopenharmony_ci	select NLS
2162306a36Sopenharmony_ci	help
2262306a36Sopenharmony_ci	   USB is a host/device protocol, organized with one host (such as a
2362306a36Sopenharmony_ci	   PC) controlling up to 127 peripheral devices.
2462306a36Sopenharmony_ci	   The USB hardware is asymmetric, which makes it easier to set up:
2562306a36Sopenharmony_ci	   you can't connect a "to-the-host" connector to a peripheral.
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci	   Linux can run in the host, or in the peripheral.  In both cases
2862306a36Sopenharmony_ci	   you need a low level bus controller driver, and some software
2962306a36Sopenharmony_ci	   talking to it.  Peripheral controllers are often discrete silicon,
3062306a36Sopenharmony_ci	   or are integrated with the CPU in a microcontroller.  The more
3162306a36Sopenharmony_ci	   familiar host side controllers have names like "EHCI", "OHCI",
3262306a36Sopenharmony_ci	   or "UHCI", and are usually integrated into southbridges on PC
3362306a36Sopenharmony_ci	   motherboards.
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci	   Enable this configuration option if you want to run Linux inside
3662306a36Sopenharmony_ci	   a USB peripheral device.  Configure one hardware driver for your
3762306a36Sopenharmony_ci	   peripheral/device side bus controller, and a "gadget driver" for
3862306a36Sopenharmony_ci	   your peripheral protocol.  (If you use modular gadget drivers,
3962306a36Sopenharmony_ci	   you may configure more than one.)
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci	   If in doubt, say "N" and don't enable these drivers; most people
4262306a36Sopenharmony_ci	   don't have this kind of hardware (except maybe inside Linux PDAs).
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci	   For more information, see <http://www.linux-usb.org/gadget> and
4562306a36Sopenharmony_ci	   the kernel documentation for this API.
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ciif USB_GADGET
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ciconfig USB_GADGET_DEBUG
5062306a36Sopenharmony_ci	bool "Debugging messages (DEVELOPMENT)"
5162306a36Sopenharmony_ci	depends on DEBUG_KERNEL
5262306a36Sopenharmony_ci	help
5362306a36Sopenharmony_ci	   Many controller and gadget drivers will print some debugging
5462306a36Sopenharmony_ci	   messages if you use this option to ask for those messages.
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci	   Avoid enabling these messages, even if you're actively
5762306a36Sopenharmony_ci	   debugging such a driver.  Many drivers will emit so many
5862306a36Sopenharmony_ci	   messages that the driver timings are affected, which will
5962306a36Sopenharmony_ci	   either create new failure modes or remove the one you're
6062306a36Sopenharmony_ci	   trying to track down.  Never enable these messages for a
6162306a36Sopenharmony_ci	   production build.
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ciconfig USB_GADGET_VERBOSE
6462306a36Sopenharmony_ci	bool "Verbose debugging Messages (DEVELOPMENT)"
6562306a36Sopenharmony_ci	depends on USB_GADGET_DEBUG
6662306a36Sopenharmony_ci	help
6762306a36Sopenharmony_ci	   Many controller and gadget drivers will print verbose debugging
6862306a36Sopenharmony_ci	   messages if you use this option to ask for those messages.
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci	   Avoid enabling these messages, even if you're actively
7162306a36Sopenharmony_ci	   debugging such a driver.  Many drivers will emit so many
7262306a36Sopenharmony_ci	   messages that the driver timings are affected, which will
7362306a36Sopenharmony_ci	   either create new failure modes or remove the one you're
7462306a36Sopenharmony_ci	   trying to track down.  Never enable these messages for a
7562306a36Sopenharmony_ci	   production build.
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ciconfig USB_GADGET_DEBUG_FILES
7862306a36Sopenharmony_ci	bool "Debugging information files (DEVELOPMENT)"
7962306a36Sopenharmony_ci	depends on PROC_FS
8062306a36Sopenharmony_ci	help
8162306a36Sopenharmony_ci	   Some of the drivers in the "gadget" framework can expose
8262306a36Sopenharmony_ci	   debugging information in files such as /proc/driver/udc
8362306a36Sopenharmony_ci	   (for a peripheral controller).  The information in these
8462306a36Sopenharmony_ci	   files may help when you're troubleshooting or bringing up a
8562306a36Sopenharmony_ci	   driver on a new board.   Enable these files by choosing "Y"
8662306a36Sopenharmony_ci	   here.  If in doubt, or to conserve kernel memory, say "N".
8762306a36Sopenharmony_ci
8862306a36Sopenharmony_ciconfig USB_GADGET_DEBUG_FS
8962306a36Sopenharmony_ci	bool "Debugging information files in debugfs (DEVELOPMENT)"
9062306a36Sopenharmony_ci	depends on DEBUG_FS
9162306a36Sopenharmony_ci	help
9262306a36Sopenharmony_ci	   Some of the drivers in the "gadget" framework can expose
9362306a36Sopenharmony_ci	   debugging information in files under /sys/kernel/debug/.
9462306a36Sopenharmony_ci	   The information in these files may help when you're
9562306a36Sopenharmony_ci	   troubleshooting or bringing up a driver on a new board.
9662306a36Sopenharmony_ci	   Enable these files by choosing "Y" here.  If in doubt, or
9762306a36Sopenharmony_ci	   to conserve kernel memory, say "N".
9862306a36Sopenharmony_ci
9962306a36Sopenharmony_ciconfig USB_GADGET_VBUS_DRAW
10062306a36Sopenharmony_ci	int "Maximum VBUS Power usage (2-500 mA)"
10162306a36Sopenharmony_ci	range 2 500
10262306a36Sopenharmony_ci	default 2
10362306a36Sopenharmony_ci	help
10462306a36Sopenharmony_ci	   Some devices need to draw power from USB when they are
10562306a36Sopenharmony_ci	   configured, perhaps to operate circuitry or to recharge
10662306a36Sopenharmony_ci	   batteries.  This is in addition to any local power supply,
10762306a36Sopenharmony_ci	   such as an AC adapter or batteries.
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_ci	   Enter the maximum power your device draws through USB, in
11062306a36Sopenharmony_ci	   milliAmperes.  The permitted range of values is 2 - 500 mA;
11162306a36Sopenharmony_ci	   0 mA would be legal, but can make some hosts misbehave.
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_ci	   This value will be used except for system-specific gadget
11462306a36Sopenharmony_ci	   drivers that have more specific information.
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ciconfig USB_GADGET_STORAGE_NUM_BUFFERS
11762306a36Sopenharmony_ci	int "Number of storage pipeline buffers"
11862306a36Sopenharmony_ci	range 2 256
11962306a36Sopenharmony_ci	default 2
12062306a36Sopenharmony_ci	help
12162306a36Sopenharmony_ci	   Usually 2 buffers are enough to establish a good buffering
12262306a36Sopenharmony_ci	   pipeline. The number may be increased in order to compensate
12362306a36Sopenharmony_ci	   for a bursty VFS behaviour. For instance there may be CPU wake up
12462306a36Sopenharmony_ci	   latencies that makes the VFS to appear bursty in a system with
12562306a36Sopenharmony_ci	   an CPU on-demand governor. Especially if DMA is doing IO to
12662306a36Sopenharmony_ci	   offload the CPU. In this case the CPU will go into power
12762306a36Sopenharmony_ci	   save often and spin up occasionally to move data within VFS.
12862306a36Sopenharmony_ci	   If selecting USB_GADGET_DEBUG_FILES this value may be set by
12962306a36Sopenharmony_ci	   a module parameter as well.
13062306a36Sopenharmony_ci	   If unsure, say 2.
13162306a36Sopenharmony_ci
13262306a36Sopenharmony_ciconfig U_SERIAL_CONSOLE
13362306a36Sopenharmony_ci	bool "Serial gadget console support"
13462306a36Sopenharmony_ci	depends on USB_U_SERIAL
13562306a36Sopenharmony_ci	help
13662306a36Sopenharmony_ci	   It supports the serial gadget can be used as a console.
13762306a36Sopenharmony_ci
13862306a36Sopenharmony_cisource "drivers/usb/gadget/udc/Kconfig"
13962306a36Sopenharmony_ci
14062306a36Sopenharmony_ci#
14162306a36Sopenharmony_ci# USB Gadget Drivers
14262306a36Sopenharmony_ci#
14362306a36Sopenharmony_ci
14462306a36Sopenharmony_ci# composite based drivers
14562306a36Sopenharmony_ciconfig USB_LIBCOMPOSITE
14662306a36Sopenharmony_ci	tristate
14762306a36Sopenharmony_ci	select CONFIGFS_FS
14862306a36Sopenharmony_ci	depends on USB_GADGET
14962306a36Sopenharmony_ci
15062306a36Sopenharmony_ciconfig USB_F_ACM
15162306a36Sopenharmony_ci	tristate
15262306a36Sopenharmony_ci
15362306a36Sopenharmony_ciconfig USB_F_SS_LB
15462306a36Sopenharmony_ci	tristate
15562306a36Sopenharmony_ci
15662306a36Sopenharmony_ciconfig USB_U_SERIAL
15762306a36Sopenharmony_ci	tristate
15862306a36Sopenharmony_ci
15962306a36Sopenharmony_ciconfig USB_U_ETHER
16062306a36Sopenharmony_ci	tristate
16162306a36Sopenharmony_ci
16262306a36Sopenharmony_ciconfig USB_U_AUDIO
16362306a36Sopenharmony_ci	tristate
16462306a36Sopenharmony_ci
16562306a36Sopenharmony_ciconfig USB_F_SERIAL
16662306a36Sopenharmony_ci	tristate
16762306a36Sopenharmony_ci
16862306a36Sopenharmony_ciconfig USB_F_OBEX
16962306a36Sopenharmony_ci	tristate
17062306a36Sopenharmony_ci
17162306a36Sopenharmony_ciconfig USB_F_NCM
17262306a36Sopenharmony_ci	tristate
17362306a36Sopenharmony_ci
17462306a36Sopenharmony_ciconfig USB_F_ECM
17562306a36Sopenharmony_ci	tristate
17662306a36Sopenharmony_ci
17762306a36Sopenharmony_ciconfig USB_F_PHONET
17862306a36Sopenharmony_ci	tristate
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ciconfig USB_F_EEM
18162306a36Sopenharmony_ci	tristate
18262306a36Sopenharmony_ci
18362306a36Sopenharmony_ciconfig USB_F_SUBSET
18462306a36Sopenharmony_ci	tristate
18562306a36Sopenharmony_ci
18662306a36Sopenharmony_ciconfig USB_F_RNDIS
18762306a36Sopenharmony_ci	tristate
18862306a36Sopenharmony_ci
18962306a36Sopenharmony_ciconfig USB_F_MASS_STORAGE
19062306a36Sopenharmony_ci	tristate
19162306a36Sopenharmony_ci
19262306a36Sopenharmony_ciconfig USB_F_FS
19362306a36Sopenharmony_ci	tristate
19462306a36Sopenharmony_ci
19562306a36Sopenharmony_ciconfig USB_F_UAC1
19662306a36Sopenharmony_ci	tristate
19762306a36Sopenharmony_ci
19862306a36Sopenharmony_ciconfig USB_F_UAC1_LEGACY
19962306a36Sopenharmony_ci	tristate
20062306a36Sopenharmony_ci
20162306a36Sopenharmony_ciconfig USB_F_UAC2
20262306a36Sopenharmony_ci	tristate
20362306a36Sopenharmony_ci
20462306a36Sopenharmony_ciconfig USB_F_UVC
20562306a36Sopenharmony_ci	tristate
20662306a36Sopenharmony_ci	select UVC_COMMON
20762306a36Sopenharmony_ci
20862306a36Sopenharmony_ciconfig USB_F_MIDI
20962306a36Sopenharmony_ci	tristate
21062306a36Sopenharmony_ci
21162306a36Sopenharmony_ciconfig USB_F_MIDI2
21262306a36Sopenharmony_ci	tristate
21362306a36Sopenharmony_ci
21462306a36Sopenharmony_ciconfig USB_F_HID
21562306a36Sopenharmony_ci	tristate
21662306a36Sopenharmony_ci
21762306a36Sopenharmony_ciconfig USB_F_PRINTER
21862306a36Sopenharmony_ci	tristate
21962306a36Sopenharmony_ci
22062306a36Sopenharmony_ciconfig USB_F_TCM
22162306a36Sopenharmony_ci	tristate
22262306a36Sopenharmony_ci
22362306a36Sopenharmony_ci# this first set of drivers all depend on bulk-capable hardware.
22462306a36Sopenharmony_ci
22562306a36Sopenharmony_ciconfig USB_CONFIGFS
22662306a36Sopenharmony_ci	tristate "USB Gadget functions configurable through configfs"
22762306a36Sopenharmony_ci	select USB_LIBCOMPOSITE
22862306a36Sopenharmony_ci	help
22962306a36Sopenharmony_ci	  A Linux USB "gadget" can be set up through configfs.
23062306a36Sopenharmony_ci	  If this is the case, the USB functions (which from the host's
23162306a36Sopenharmony_ci	  perspective are seen as interfaces) and configurations are
23262306a36Sopenharmony_ci	  specified simply by creating appropriate directories in configfs.
23362306a36Sopenharmony_ci	  Associating functions with configurations is done by creating
23462306a36Sopenharmony_ci	  appropriate symbolic links.
23562306a36Sopenharmony_ci	  For more information see Documentation/usb/gadget_configfs.rst.
23662306a36Sopenharmony_ci
23762306a36Sopenharmony_ciconfig USB_CONFIGFS_SERIAL
23862306a36Sopenharmony_ci	bool "Generic serial bulk in/out"
23962306a36Sopenharmony_ci	depends on USB_CONFIGFS
24062306a36Sopenharmony_ci	depends on TTY
24162306a36Sopenharmony_ci	select USB_U_SERIAL
24262306a36Sopenharmony_ci	select USB_F_SERIAL
24362306a36Sopenharmony_ci	help
24462306a36Sopenharmony_ci	  The function talks to the Linux-USB generic serial driver.
24562306a36Sopenharmony_ci
24662306a36Sopenharmony_ciconfig USB_CONFIGFS_ACM
24762306a36Sopenharmony_ci	bool "Abstract Control Model (CDC ACM)"
24862306a36Sopenharmony_ci	depends on USB_CONFIGFS
24962306a36Sopenharmony_ci	depends on TTY
25062306a36Sopenharmony_ci	select USB_U_SERIAL
25162306a36Sopenharmony_ci	select USB_F_ACM
25262306a36Sopenharmony_ci	help
25362306a36Sopenharmony_ci	  ACM serial link.  This function can be used to interoperate with
25462306a36Sopenharmony_ci	  MS-Windows hosts or with the Linux-USB "cdc-acm" driver.
25562306a36Sopenharmony_ci
25662306a36Sopenharmony_ciconfig USB_CONFIGFS_OBEX
25762306a36Sopenharmony_ci	bool "Object Exchange Model (CDC OBEX)"
25862306a36Sopenharmony_ci	depends on USB_CONFIGFS
25962306a36Sopenharmony_ci	depends on TTY
26062306a36Sopenharmony_ci	select USB_U_SERIAL
26162306a36Sopenharmony_ci	select USB_F_OBEX
26262306a36Sopenharmony_ci	help
26362306a36Sopenharmony_ci	  You will need a user space OBEX server talking to /dev/ttyGS*,
26462306a36Sopenharmony_ci	  since the kernel itself doesn't implement the OBEX protocol.
26562306a36Sopenharmony_ci
26662306a36Sopenharmony_ciconfig USB_CONFIGFS_NCM
26762306a36Sopenharmony_ci	bool "Network Control Model (CDC NCM)"
26862306a36Sopenharmony_ci	depends on USB_CONFIGFS
26962306a36Sopenharmony_ci	depends on NET
27062306a36Sopenharmony_ci	select USB_U_ETHER
27162306a36Sopenharmony_ci	select USB_F_NCM
27262306a36Sopenharmony_ci	select CRC32
27362306a36Sopenharmony_ci	help
27462306a36Sopenharmony_ci	  NCM is an advanced protocol for Ethernet encapsulation, allows
27562306a36Sopenharmony_ci	  grouping of several ethernet frames into one USB transfer and
27662306a36Sopenharmony_ci	  different alignment possibilities.
27762306a36Sopenharmony_ci
27862306a36Sopenharmony_ciconfig USB_CONFIGFS_ECM
27962306a36Sopenharmony_ci	bool "Ethernet Control Model (CDC ECM)"
28062306a36Sopenharmony_ci	depends on USB_CONFIGFS
28162306a36Sopenharmony_ci	depends on NET
28262306a36Sopenharmony_ci	select USB_U_ETHER
28362306a36Sopenharmony_ci	select USB_F_ECM
28462306a36Sopenharmony_ci	help
28562306a36Sopenharmony_ci	  The "Communication Device Class" (CDC) Ethernet Control Model.
28662306a36Sopenharmony_ci	  That protocol is often avoided with pure Ethernet adapters, in
28762306a36Sopenharmony_ci	  favor of simpler vendor-specific hardware, but is widely
28862306a36Sopenharmony_ci	  supported by firmware for smart network devices.
28962306a36Sopenharmony_ci
29062306a36Sopenharmony_ciconfig USB_CONFIGFS_ECM_SUBSET
29162306a36Sopenharmony_ci	bool "Ethernet Control Model (CDC ECM) subset"
29262306a36Sopenharmony_ci	depends on USB_CONFIGFS
29362306a36Sopenharmony_ci	depends on NET
29462306a36Sopenharmony_ci	select USB_U_ETHER
29562306a36Sopenharmony_ci	select USB_F_SUBSET
29662306a36Sopenharmony_ci	help
29762306a36Sopenharmony_ci	  On hardware that can't implement the full protocol,
29862306a36Sopenharmony_ci	  a simple CDC subset is used, placing fewer demands on USB.
29962306a36Sopenharmony_ci
30062306a36Sopenharmony_ciconfig USB_CONFIGFS_RNDIS
30162306a36Sopenharmony_ci	bool "RNDIS"
30262306a36Sopenharmony_ci	depends on USB_CONFIGFS
30362306a36Sopenharmony_ci	depends on NET
30462306a36Sopenharmony_ci	select USB_U_ETHER
30562306a36Sopenharmony_ci	select USB_F_RNDIS
30662306a36Sopenharmony_ci	help
30762306a36Sopenharmony_ci	   Microsoft Windows XP bundles the "Remote NDIS" (RNDIS) protocol,
30862306a36Sopenharmony_ci	   and Microsoft provides redistributable binary RNDIS drivers for
30962306a36Sopenharmony_ci	   older versions of Windows.
31062306a36Sopenharmony_ci
31162306a36Sopenharmony_ci	   To make MS-Windows work with this, use Documentation/usb/linux.inf
31262306a36Sopenharmony_ci	   as the "driver info file".  For versions of MS-Windows older than
31362306a36Sopenharmony_ci	   XP, you'll need to download drivers from Microsoft's website; a URL
31462306a36Sopenharmony_ci	   is given in comments found in that info file.
31562306a36Sopenharmony_ci
31662306a36Sopenharmony_ciconfig USB_CONFIGFS_EEM
31762306a36Sopenharmony_ci	bool "Ethernet Emulation Model (EEM)"
31862306a36Sopenharmony_ci	depends on USB_CONFIGFS
31962306a36Sopenharmony_ci	depends on NET
32062306a36Sopenharmony_ci	select USB_U_ETHER
32162306a36Sopenharmony_ci	select USB_F_EEM
32262306a36Sopenharmony_ci	select CRC32
32362306a36Sopenharmony_ci	help
32462306a36Sopenharmony_ci	  CDC EEM is a newer USB standard that is somewhat simpler than CDC ECM
32562306a36Sopenharmony_ci	  and therefore can be supported by more hardware.  Technically ECM and
32662306a36Sopenharmony_ci	  EEM are designed for different applications.  The ECM model extends
32762306a36Sopenharmony_ci	  the network interface to the target (e.g. a USB cable modem), and the
32862306a36Sopenharmony_ci	  EEM model is for mobile devices to communicate with hosts using
32962306a36Sopenharmony_ci	  ethernet over USB.  For Linux gadgets, however, the interface with
33062306a36Sopenharmony_ci	  the host is the same (a usbX device), so the differences are minimal.
33162306a36Sopenharmony_ci
33262306a36Sopenharmony_ciconfig USB_CONFIGFS_PHONET
33362306a36Sopenharmony_ci	bool "Phonet protocol"
33462306a36Sopenharmony_ci	depends on USB_CONFIGFS
33562306a36Sopenharmony_ci	depends on NET
33662306a36Sopenharmony_ci	depends on PHONET
33762306a36Sopenharmony_ci	select USB_U_ETHER
33862306a36Sopenharmony_ci	select USB_F_PHONET
33962306a36Sopenharmony_ci	help
34062306a36Sopenharmony_ci	  The Phonet protocol implementation for USB device.
34162306a36Sopenharmony_ci
34262306a36Sopenharmony_ciconfig USB_CONFIGFS_MASS_STORAGE
34362306a36Sopenharmony_ci	bool "Mass storage"
34462306a36Sopenharmony_ci	depends on USB_CONFIGFS
34562306a36Sopenharmony_ci	depends on BLOCK
34662306a36Sopenharmony_ci	select USB_F_MASS_STORAGE
34762306a36Sopenharmony_ci	help
34862306a36Sopenharmony_ci	  The Mass Storage Gadget acts as a USB Mass Storage disk drive.
34962306a36Sopenharmony_ci	  As its storage repository it can use a regular file or a block
35062306a36Sopenharmony_ci	  device (in much the same way as the "loop" device driver),
35162306a36Sopenharmony_ci	  specified as a module parameter or sysfs option.
35262306a36Sopenharmony_ci
35362306a36Sopenharmony_ciconfig USB_CONFIGFS_F_LB_SS
35462306a36Sopenharmony_ci	bool "Loopback and sourcesink function (for testing)"
35562306a36Sopenharmony_ci	depends on USB_CONFIGFS
35662306a36Sopenharmony_ci	select USB_F_SS_LB
35762306a36Sopenharmony_ci	help
35862306a36Sopenharmony_ci	  Loopback function loops back a configurable number of transfers.
35962306a36Sopenharmony_ci	  Sourcesink function either sinks and sources bulk data.
36062306a36Sopenharmony_ci	  It also implements control requests, for "chapter 9" conformance.
36162306a36Sopenharmony_ci	  Make this be the first driver you try using on top of any new
36262306a36Sopenharmony_ci	  USB peripheral controller driver.  Then you can use host-side
36362306a36Sopenharmony_ci	  test software, like the "usbtest" driver, to put your hardware
36462306a36Sopenharmony_ci	  and its driver through a basic set of functional tests.
36562306a36Sopenharmony_ci
36662306a36Sopenharmony_ciconfig USB_CONFIGFS_F_FS
36762306a36Sopenharmony_ci	bool "Function filesystem (FunctionFS)"
36862306a36Sopenharmony_ci	depends on USB_CONFIGFS
36962306a36Sopenharmony_ci	select USB_F_FS
37062306a36Sopenharmony_ci	help
37162306a36Sopenharmony_ci	  The Function Filesystem (FunctionFS) lets one create USB
37262306a36Sopenharmony_ci	  composite functions in user space in the same way GadgetFS
37362306a36Sopenharmony_ci	  lets one create USB gadgets in user space.  This allows creation
37462306a36Sopenharmony_ci	  of composite gadgets such that some of the functions are
37562306a36Sopenharmony_ci	  implemented in kernel space (for instance Ethernet, serial or
37662306a36Sopenharmony_ci	  mass storage) and other are implemented in user space.
37762306a36Sopenharmony_ci
37862306a36Sopenharmony_ciconfig USB_CONFIGFS_F_UAC1
37962306a36Sopenharmony_ci	bool "Audio Class 1.0"
38062306a36Sopenharmony_ci	depends on USB_CONFIGFS
38162306a36Sopenharmony_ci	depends on SND
38262306a36Sopenharmony_ci	select USB_LIBCOMPOSITE
38362306a36Sopenharmony_ci	select SND_PCM
38462306a36Sopenharmony_ci	select USB_U_AUDIO
38562306a36Sopenharmony_ci	select USB_F_UAC1
38662306a36Sopenharmony_ci	help
38762306a36Sopenharmony_ci	  This Audio function implements 1 AudioControl interface,
38862306a36Sopenharmony_ci	  1 AudioStreaming Interface each for USB-OUT and USB-IN.
38962306a36Sopenharmony_ci	  This driver doesn't expect any real Audio codec to be present
39062306a36Sopenharmony_ci	  on the device - the audio streams are simply sinked to and
39162306a36Sopenharmony_ci	  sourced from a virtual ALSA sound card created. The user-space
39262306a36Sopenharmony_ci	  application may choose to do whatever it wants with the data
39362306a36Sopenharmony_ci	  received from the USB Host and choose to provide whatever it
39462306a36Sopenharmony_ci	  wants as audio data to the USB Host.
39562306a36Sopenharmony_ci
39662306a36Sopenharmony_ciconfig USB_CONFIGFS_F_UAC1_LEGACY
39762306a36Sopenharmony_ci	bool "Audio Class 1.0 (legacy implementation)"
39862306a36Sopenharmony_ci	depends on USB_CONFIGFS
39962306a36Sopenharmony_ci	depends on SND
40062306a36Sopenharmony_ci	select USB_LIBCOMPOSITE
40162306a36Sopenharmony_ci	select SND_PCM
40262306a36Sopenharmony_ci	select USB_F_UAC1_LEGACY
40362306a36Sopenharmony_ci	help
40462306a36Sopenharmony_ci	  This Audio function implements 1 AudioControl interface,
40562306a36Sopenharmony_ci	  1 AudioStreaming Interface each for USB-OUT and USB-IN.
40662306a36Sopenharmony_ci	  This is a legacy driver and requires a real Audio codec
40762306a36Sopenharmony_ci	  to be present on the device.
40862306a36Sopenharmony_ci
40962306a36Sopenharmony_ciconfig USB_CONFIGFS_F_UAC2
41062306a36Sopenharmony_ci	bool "Audio Class 2.0"
41162306a36Sopenharmony_ci	depends on USB_CONFIGFS
41262306a36Sopenharmony_ci	depends on SND
41362306a36Sopenharmony_ci	select USB_LIBCOMPOSITE
41462306a36Sopenharmony_ci	select SND_PCM
41562306a36Sopenharmony_ci	select USB_U_AUDIO
41662306a36Sopenharmony_ci	select USB_F_UAC2
41762306a36Sopenharmony_ci	help
41862306a36Sopenharmony_ci	  This Audio function is compatible with USB Audio Class
41962306a36Sopenharmony_ci	  specification 2.0. It implements 1 AudioControl interface,
42062306a36Sopenharmony_ci	  1 AudioStreaming Interface each for USB-OUT and USB-IN.
42162306a36Sopenharmony_ci	  This driver doesn't expect any real Audio codec to be present
42262306a36Sopenharmony_ci	  on the device - the audio streams are simply sinked to and
42362306a36Sopenharmony_ci	  sourced from a virtual ALSA sound card created. The user-space
42462306a36Sopenharmony_ci	  application may choose to do whatever it wants with the data
42562306a36Sopenharmony_ci	  received from the USB Host and choose to provide whatever it
42662306a36Sopenharmony_ci	  wants as audio data to the USB Host.
42762306a36Sopenharmony_ci
42862306a36Sopenharmony_ciconfig USB_CONFIGFS_F_MIDI
42962306a36Sopenharmony_ci	bool "MIDI function"
43062306a36Sopenharmony_ci	depends on USB_CONFIGFS
43162306a36Sopenharmony_ci	depends on SND
43262306a36Sopenharmony_ci	select USB_LIBCOMPOSITE
43362306a36Sopenharmony_ci	select SND_RAWMIDI
43462306a36Sopenharmony_ci	select USB_F_MIDI
43562306a36Sopenharmony_ci	help
43662306a36Sopenharmony_ci	  The MIDI Function acts as a USB Audio device, with one MIDI
43762306a36Sopenharmony_ci	  input and one MIDI output. These MIDI jacks appear as
43862306a36Sopenharmony_ci	  a sound "card" in the ALSA sound system. Other MIDI
43962306a36Sopenharmony_ci	  connections can then be made on the gadget system, using
44062306a36Sopenharmony_ci	  ALSA's aconnect utility etc.
44162306a36Sopenharmony_ci
44262306a36Sopenharmony_ciconfig USB_CONFIGFS_F_MIDI2
44362306a36Sopenharmony_ci	bool "MIDI 2.0 function"
44462306a36Sopenharmony_ci	depends on USB_CONFIGFS
44562306a36Sopenharmony_ci	depends on SND
44662306a36Sopenharmony_ci	select USB_LIBCOMPOSITE
44762306a36Sopenharmony_ci	select SND_UMP
44862306a36Sopenharmony_ci	select SND_UMP_LEGACY_RAWMIDI
44962306a36Sopenharmony_ci	select USB_F_MIDI2
45062306a36Sopenharmony_ci	help
45162306a36Sopenharmony_ci	  The MIDI 2.0 function driver provides the generic emulated
45262306a36Sopenharmony_ci	  USB MIDI 2.0 interface, looped back to ALSA UMP rawmidi
45362306a36Sopenharmony_ci	  device on the gadget host. It supports UMP 1.1 spec and
45462306a36Sopenharmony_ci	  responds UMP Stream messages for UMP Endpoint and Function
45562306a36Sopenharmony_ci	  Block information / configuration.
45662306a36Sopenharmony_ci
45762306a36Sopenharmony_ciconfig USB_CONFIGFS_F_HID
45862306a36Sopenharmony_ci	bool "HID function"
45962306a36Sopenharmony_ci	depends on USB_CONFIGFS
46062306a36Sopenharmony_ci	select USB_F_HID
46162306a36Sopenharmony_ci	help
46262306a36Sopenharmony_ci	  The HID function driver provides generic emulation of USB
46362306a36Sopenharmony_ci	  Human Interface Devices (HID).
46462306a36Sopenharmony_ci
46562306a36Sopenharmony_ci	  For more information, see Documentation/usb/gadget_hid.rst.
46662306a36Sopenharmony_ci
46762306a36Sopenharmony_ciconfig USB_CONFIGFS_F_UVC
46862306a36Sopenharmony_ci	bool "USB Webcam function"
46962306a36Sopenharmony_ci	depends on USB_CONFIGFS
47062306a36Sopenharmony_ci	depends on VIDEO_DEV
47162306a36Sopenharmony_ci	depends on VIDEO_DEV
47262306a36Sopenharmony_ci	select VIDEOBUF2_DMA_SG
47362306a36Sopenharmony_ci	select VIDEOBUF2_VMALLOC
47462306a36Sopenharmony_ci	select USB_F_UVC
47562306a36Sopenharmony_ci	help
47662306a36Sopenharmony_ci	  The Webcam function acts as a composite USB Audio and Video Class
47762306a36Sopenharmony_ci	  device. It provides a userspace API to process UVC control requests
47862306a36Sopenharmony_ci	  and stream video data to the host.
47962306a36Sopenharmony_ci
48062306a36Sopenharmony_ciconfig USB_CONFIGFS_F_PRINTER
48162306a36Sopenharmony_ci	bool "Printer function"
48262306a36Sopenharmony_ci	select USB_F_PRINTER
48362306a36Sopenharmony_ci	depends on USB_CONFIGFS
48462306a36Sopenharmony_ci	help
48562306a36Sopenharmony_ci	  The Printer function channels data between the USB host and a
48662306a36Sopenharmony_ci	  userspace program driving the print engine. The user space
48762306a36Sopenharmony_ci	  program reads and writes the device file /dev/g_printer<X> to
48862306a36Sopenharmony_ci	  receive or send printer data. It can use ioctl calls to
48962306a36Sopenharmony_ci	  the device file to get or set printer status.
49062306a36Sopenharmony_ci
49162306a36Sopenharmony_ci	  For more information, see Documentation/usb/gadget_printer.rst
49262306a36Sopenharmony_ci	  which includes sample code for accessing the device file.
49362306a36Sopenharmony_ci
49462306a36Sopenharmony_ciconfig USB_CONFIGFS_F_TCM
49562306a36Sopenharmony_ci	bool "USB Gadget Target Fabric"
49662306a36Sopenharmony_ci	depends on TARGET_CORE
49762306a36Sopenharmony_ci	depends on USB_CONFIGFS
49862306a36Sopenharmony_ci	select USB_LIBCOMPOSITE
49962306a36Sopenharmony_ci	select USB_F_TCM
50062306a36Sopenharmony_ci	help
50162306a36Sopenharmony_ci	  This fabric is a USB gadget component. Two USB protocols are
50262306a36Sopenharmony_ci	  supported that is BBB or BOT (Bulk Only Transport) and UAS
50362306a36Sopenharmony_ci	  (USB Attached SCSI). BOT is advertised on alternative
50462306a36Sopenharmony_ci	  interface 0 (primary) and UAS is on alternative interface 1.
50562306a36Sopenharmony_ci	  Both protocols can work on USB2.0 and USB3.0.
50662306a36Sopenharmony_ci	  UAS utilizes the USB 3.0 feature called streams support.
50762306a36Sopenharmony_ci
50862306a36Sopenharmony_ciconfig DRIVERS_HDF_USB_F_GENERIC
50962306a36Sopenharmony_ci	bool "Enable F_GENERIC driver"
51062306a36Sopenharmony_ci	default y
51162306a36Sopenharmony_ci	depends on DRIVERS_HDF
51262306a36Sopenharmony_ci	help
51362306a36Sopenharmony_ci		Answer Y to choice HDF USB F_GENERIC driver.
51462306a36Sopenharmony_ci
51562306a36Sopenharmony_cisource "drivers/usb/gadget/legacy/Kconfig"
51662306a36Sopenharmony_ci
51762306a36Sopenharmony_ciendif # USB_GADGET
518