Kconfig 18 KB

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