Kconfig 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  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. menuconfig USB_GADGET
  17. tristate "USB Gadget Support"
  18. select USB_COMMON
  19. select NLS
  20. help
  21. USB is a host/device protocol, organized with one host (such as a
  22. PC) controlling up to 127 peripheral devices.
  23. The USB hardware is asymmetric, which makes it easier to set up:
  24. you can't connect a "to-the-host" connector to a peripheral.
  25. Linux can run in the host, or in the peripheral. In both cases
  26. you need a low level bus controller driver, and some software
  27. talking to it. Peripheral controllers are often discrete silicon,
  28. or are integrated with the CPU in a microcontroller. The more
  29. familiar host side controllers have names like "EHCI", "OHCI",
  30. or "UHCI", and are usually integrated into southbridges on PC
  31. motherboards.
  32. Enable this configuration option if you want to run Linux inside
  33. a USB peripheral device. Configure one hardware driver for your
  34. peripheral/device side bus controller, and a "gadget driver" for
  35. your peripheral protocol. (If you use modular gadget drivers,
  36. you may configure more than one.)
  37. If in doubt, say "N" and don't enable these drivers; most people
  38. don't have this kind of hardware (except maybe inside Linux PDAs).
  39. For more information, see <http://www.linux-usb.org/gadget> and
  40. the kernel documentation for this API.
  41. if USB_GADGET
  42. config USB_GADGET_DEBUG
  43. bool "Debugging messages (DEVELOPMENT)"
  44. depends on DEBUG_KERNEL
  45. help
  46. Many controller and gadget drivers will print some debugging
  47. messages if you use this option to ask for those messages.
  48. Avoid enabling these messages, even if you're actively
  49. debugging such a driver. Many drivers will emit so many
  50. messages that the driver timings are affected, which will
  51. either create new failure modes or remove the one you're
  52. trying to track down. Never enable these messages for a
  53. production build.
  54. config USB_GADGET_VERBOSE
  55. bool "Verbose debugging Messages (DEVELOPMENT)"
  56. depends on USB_GADGET_DEBUG
  57. help
  58. Many controller and gadget drivers will print verbose debugging
  59. messages if you use this option to ask for those messages.
  60. Avoid enabling these messages, even if you're actively
  61. debugging such a driver. Many drivers will emit so many
  62. messages that the driver timings are affected, which will
  63. either create new failure modes or remove the one you're
  64. trying to track down. Never enable these messages for a
  65. production build.
  66. config USB_GADGET_DEBUG_FILES
  67. bool "Debugging information files (DEVELOPMENT)"
  68. depends on PROC_FS
  69. help
  70. Some of the drivers in the "gadget" framework can expose
  71. debugging information in files such as /proc/driver/udc
  72. (for a peripheral controller). The information in these
  73. files may help when you're troubleshooting or bringing up a
  74. driver on a new board. Enable these files by choosing "Y"
  75. here. If in doubt, or to conserve kernel memory, say "N".
  76. config USB_GADGET_DEBUG_FS
  77. bool "Debugging information files in debugfs (DEVELOPMENT)"
  78. depends on DEBUG_FS
  79. help
  80. Some of the drivers in the "gadget" framework can expose
  81. debugging information in files under /sys/kernel/debug/.
  82. The information in these files may help when you're
  83. troubleshooting or bringing up a driver on a new board.
  84. Enable these files by choosing "Y" here. If in doubt, or
  85. to conserve kernel memory, say "N".
  86. config USB_GADGET_VBUS_DRAW
  87. int "Maximum VBUS Power usage (2-500 mA)"
  88. range 2 500
  89. default 2
  90. help
  91. Some devices need to draw power from USB when they are
  92. configured, perhaps to operate circuitry or to recharge
  93. batteries. This is in addition to any local power supply,
  94. such as an AC adapter or batteries.
  95. Enter the maximum power your device draws through USB, in
  96. milliAmperes. The permitted range of values is 2 - 500 mA;
  97. 0 mA would be legal, but can make some hosts misbehave.
  98. This value will be used except for system-specific gadget
  99. drivers that have more specific information.
  100. config USB_GADGET_STORAGE_NUM_BUFFERS
  101. int "Number of storage pipeline buffers"
  102. range 2 256
  103. default 2
  104. help
  105. Usually 2 buffers are enough to establish a good buffering
  106. pipeline. The number may be increased in order to compensate
  107. for a bursty VFS behaviour. For instance there may be CPU wake up
  108. latencies that makes the VFS to appear bursty in a system with
  109. an CPU on-demand governor. Especially if DMA is doing IO to
  110. offload the CPU. In this case the CPU will go into power
  111. save often and spin up occasionally to move data within VFS.
  112. If selecting USB_GADGET_DEBUG_FILES this value may be set by
  113. a module parameter as well.
  114. If unsure, say 2.
  115. config U_SERIAL_CONSOLE
  116. bool "Serial gadget console support"
  117. depends on USB_U_SERIAL
  118. help
  119. It supports the serial gadget can be used as a console.
  120. source "drivers/usb/gadget/udc/Kconfig"
  121. #
  122. # USB Gadget Drivers
  123. #
  124. # composite based drivers
  125. config USB_LIBCOMPOSITE
  126. tristate
  127. select CONFIGFS_FS
  128. depends on USB_GADGET
  129. config USB_F_ACM
  130. tristate
  131. config USB_F_SS_LB
  132. tristate
  133. config USB_U_SERIAL
  134. tristate
  135. config USB_U_ETHER
  136. tristate
  137. config USB_U_AUDIO
  138. tristate
  139. config USB_F_SERIAL
  140. tristate
  141. config USB_F_OBEX
  142. tristate
  143. config USB_F_NCM
  144. tristate
  145. config USB_F_ECM
  146. tristate
  147. config USB_F_PHONET
  148. tristate
  149. config USB_F_EEM
  150. tristate
  151. config USB_F_SUBSET
  152. tristate
  153. config USB_F_RNDIS
  154. tristate
  155. config USB_F_MASS_STORAGE
  156. tristate
  157. config USB_F_FS
  158. select DMA_SHARED_BUFFER
  159. tristate
  160. config USB_F_UAC1
  161. tristate
  162. config USB_F_UAC1_LEGACY
  163. tristate
  164. config USB_F_UAC2
  165. tristate
  166. config USB_F_UVC
  167. tristate
  168. select UVC_COMMON
  169. config USB_F_MIDI
  170. tristate
  171. config USB_F_MIDI2
  172. tristate
  173. select SND_UMP
  174. select SND_UMP_LEGACY_RAWMIDI
  175. config USB_F_HID
  176. tristate
  177. config USB_F_PRINTER
  178. tristate
  179. config USB_F_TCM
  180. tristate
  181. # this first set of drivers all depend on bulk-capable hardware.
  182. config USB_CONFIGFS
  183. tristate "USB Gadget functions configurable through configfs"
  184. select USB_LIBCOMPOSITE
  185. help
  186. A Linux USB "gadget" can be set up through configfs.
  187. If this is the case, the USB functions (which from the host's
  188. perspective are seen as interfaces) and configurations are
  189. specified simply by creating appropriate directories in configfs.
  190. Associating functions with configurations is done by creating
  191. appropriate symbolic links.
  192. For more information see Documentation/usb/gadget_configfs.rst.
  193. config USB_CONFIGFS_SERIAL
  194. bool "Generic serial bulk in/out"
  195. depends on USB_CONFIGFS
  196. depends on TTY
  197. select USB_U_SERIAL
  198. select USB_F_SERIAL
  199. help
  200. The function talks to the Linux-USB generic serial driver.
  201. config USB_CONFIGFS_ACM
  202. bool "Abstract Control Model (CDC ACM)"
  203. depends on USB_CONFIGFS
  204. depends on TTY
  205. select USB_U_SERIAL
  206. select USB_F_ACM
  207. help
  208. ACM serial link. This function can be used to interoperate with
  209. MS-Windows hosts or with the Linux-USB "cdc-acm" driver.
  210. config USB_CONFIGFS_OBEX
  211. bool "Object Exchange Model (CDC OBEX)"
  212. depends on USB_CONFIGFS
  213. depends on TTY
  214. select USB_U_SERIAL
  215. select USB_F_OBEX
  216. help
  217. You will need a user space OBEX server talking to /dev/ttyGS*,
  218. since the kernel itself doesn't implement the OBEX protocol.
  219. config USB_CONFIGFS_NCM
  220. bool "Network Control Model (CDC NCM)"
  221. depends on USB_CONFIGFS
  222. depends on NET
  223. select USB_U_ETHER
  224. select USB_F_NCM
  225. select CRC32
  226. help
  227. NCM is an advanced protocol for Ethernet encapsulation, allows
  228. grouping of several ethernet frames into one USB transfer and
  229. different alignment possibilities.
  230. config USB_CONFIGFS_ECM
  231. bool "Ethernet Control Model (CDC ECM)"
  232. depends on USB_CONFIGFS
  233. depends on NET
  234. select USB_U_ETHER
  235. select USB_F_ECM
  236. help
  237. The "Communication Device Class" (CDC) Ethernet Control Model.
  238. That protocol is often avoided with pure Ethernet adapters, in
  239. favor of simpler vendor-specific hardware, but is widely
  240. supported by firmware for smart network devices.
  241. config USB_CONFIGFS_ECM_SUBSET
  242. bool "Ethernet Control Model (CDC ECM) subset"
  243. depends on USB_CONFIGFS
  244. depends on NET
  245. select USB_U_ETHER
  246. select USB_F_SUBSET
  247. help
  248. On hardware that can't implement the full protocol,
  249. a simple CDC subset is used, placing fewer demands on USB.
  250. config USB_CONFIGFS_RNDIS
  251. bool "RNDIS"
  252. depends on USB_CONFIGFS
  253. depends on NET
  254. select USB_U_ETHER
  255. select USB_F_RNDIS
  256. help
  257. Microsoft Windows XP bundles the "Remote NDIS" (RNDIS) protocol,
  258. and Microsoft provides redistributable binary RNDIS drivers for
  259. older versions of Windows.
  260. To make MS-Windows work with this, use Documentation/usb/linux.inf
  261. as the "driver info file". For versions of MS-Windows older than
  262. XP, you'll need to download drivers from Microsoft's website; a URL
  263. is given in comments found in that info file.
  264. config USB_CONFIGFS_EEM
  265. bool "Ethernet Emulation Model (EEM)"
  266. depends on USB_CONFIGFS
  267. depends on NET
  268. select USB_U_ETHER
  269. select USB_F_EEM
  270. select CRC32
  271. help
  272. CDC EEM is a newer USB standard that is somewhat simpler than CDC ECM
  273. and therefore can be supported by more hardware. Technically ECM and
  274. EEM are designed for different applications. The ECM model extends
  275. the network interface to the target (e.g. a USB cable modem), and the
  276. EEM model is for mobile devices to communicate with hosts using
  277. ethernet over USB. For Linux gadgets, however, the interface with
  278. the host is the same (a usbX device), so the differences are minimal.
  279. config USB_CONFIGFS_PHONET
  280. bool "Phonet protocol"
  281. depends on USB_CONFIGFS
  282. depends on NET
  283. depends on PHONET
  284. select USB_U_ETHER
  285. select USB_F_PHONET
  286. help
  287. The Phonet protocol implementation for USB device.
  288. config USB_CONFIGFS_MASS_STORAGE
  289. bool "Mass storage"
  290. depends on USB_CONFIGFS
  291. depends on BLOCK
  292. select USB_F_MASS_STORAGE
  293. help
  294. The Mass Storage Gadget acts as a USB Mass Storage disk drive.
  295. As its storage repository it can use a regular file or a block
  296. device (in much the same way as the "loop" device driver),
  297. specified as a module parameter or sysfs option.
  298. config USB_CONFIGFS_F_LB_SS
  299. bool "Loopback and sourcesink function (for testing)"
  300. depends on USB_CONFIGFS
  301. select USB_F_SS_LB
  302. help
  303. Loopback function loops back a configurable number of transfers.
  304. Sourcesink function either sinks and sources bulk data.
  305. It also implements control requests, for "chapter 9" conformance.
  306. Make this be the first driver you try using on top of any new
  307. USB peripheral controller driver. Then you can use host-side
  308. test software, like the "usbtest" driver, to put your hardware
  309. and its driver through a basic set of functional tests.
  310. config USB_CONFIGFS_F_FS
  311. bool "Function filesystem (FunctionFS)"
  312. depends on USB_CONFIGFS
  313. select USB_F_FS
  314. help
  315. The Function Filesystem (FunctionFS) lets one create USB
  316. composite functions in user space in the same way GadgetFS
  317. lets one create USB gadgets in user space. This allows creation
  318. of composite gadgets such that some of the functions are
  319. implemented in kernel space (for instance Ethernet, serial or
  320. mass storage) and other are implemented in user space.
  321. config USB_CONFIGFS_F_UAC1
  322. bool "Audio Class 1.0"
  323. depends on USB_CONFIGFS
  324. depends on SND
  325. select USB_LIBCOMPOSITE
  326. select SND_PCM
  327. select USB_U_AUDIO
  328. select USB_F_UAC1
  329. help
  330. This Audio function implements 1 AudioControl interface,
  331. 1 AudioStreaming Interface each for USB-OUT and USB-IN.
  332. This driver doesn't expect any real Audio codec to be present
  333. on the device - the audio streams are simply sinked to and
  334. sourced from a virtual ALSA sound card created. The user-space
  335. application may choose to do whatever it wants with the data
  336. received from the USB Host and choose to provide whatever it
  337. wants as audio data to the USB Host.
  338. config USB_CONFIGFS_F_UAC1_LEGACY
  339. bool "Audio Class 1.0 (legacy implementation)"
  340. depends on USB_CONFIGFS
  341. depends on SND
  342. select USB_LIBCOMPOSITE
  343. select SND_PCM
  344. select USB_F_UAC1_LEGACY
  345. help
  346. This Audio function implements 1 AudioControl interface,
  347. 1 AudioStreaming Interface each for USB-OUT and USB-IN.
  348. This is a legacy driver and requires a real Audio codec
  349. to be present on the device.
  350. config USB_CONFIGFS_F_UAC2
  351. bool "Audio Class 2.0"
  352. depends on USB_CONFIGFS
  353. depends on SND
  354. select USB_LIBCOMPOSITE
  355. select SND_PCM
  356. select USB_U_AUDIO
  357. select USB_F_UAC2
  358. help
  359. This Audio function is compatible with USB Audio Class
  360. specification 2.0. It implements 1 AudioControl interface,
  361. 1 AudioStreaming Interface each for USB-OUT and USB-IN.
  362. This driver doesn't expect any real Audio codec to be present
  363. on the device - the audio streams are simply sinked to and
  364. sourced from a virtual ALSA sound card created. The user-space
  365. application may choose to do whatever it wants with the data
  366. received from the USB Host and choose to provide whatever it
  367. wants as audio data to the USB Host.
  368. config USB_CONFIGFS_F_MIDI
  369. bool "MIDI function"
  370. depends on USB_CONFIGFS
  371. depends on SND
  372. select USB_LIBCOMPOSITE
  373. select SND_RAWMIDI
  374. select USB_F_MIDI
  375. help
  376. The MIDI Function acts as a USB Audio device, with one MIDI
  377. input and one MIDI output. These MIDI jacks appear as
  378. a sound "card" in the ALSA sound system. Other MIDI
  379. connections can then be made on the gadget system, using
  380. ALSA's aconnect utility etc.
  381. config USB_CONFIGFS_F_MIDI2
  382. bool "MIDI 2.0 function"
  383. depends on USB_CONFIGFS
  384. depends on SND
  385. select USB_LIBCOMPOSITE
  386. select USB_F_MIDI2
  387. help
  388. The MIDI 2.0 function driver provides the generic emulated
  389. USB MIDI 2.0 interface, looped back to ALSA UMP rawmidi
  390. device on the gadget host. It supports UMP 1.1 spec and
  391. responds UMP Stream messages for UMP Endpoint and Function
  392. Block information / configuration.
  393. config USB_CONFIGFS_F_HID
  394. bool "HID function"
  395. depends on USB_CONFIGFS
  396. select USB_F_HID
  397. help
  398. The HID function driver provides generic emulation of USB
  399. Human Interface Devices (HID).
  400. For more information, see Documentation/usb/gadget_hid.rst.
  401. config USB_CONFIGFS_F_UVC
  402. bool "USB Webcam function"
  403. depends on USB_CONFIGFS
  404. depends on VIDEO_DEV
  405. depends on VIDEO_DEV
  406. select VIDEOBUF2_DMA_SG
  407. select VIDEOBUF2_VMALLOC
  408. select USB_F_UVC
  409. help
  410. The Webcam function acts as a composite USB Audio and Video Class
  411. device. It provides a userspace API to process UVC control requests
  412. and stream video data to the host.
  413. config USB_CONFIGFS_F_PRINTER
  414. bool "Printer function"
  415. select USB_F_PRINTER
  416. depends on USB_CONFIGFS
  417. help
  418. The Printer function channels data between the USB host and a
  419. userspace program driving the print engine. The user space
  420. program reads and writes the device file /dev/g_printer<X> to
  421. receive or send printer data. It can use ioctl calls to
  422. the device file to get or set printer status.
  423. For more information, see Documentation/usb/gadget_printer.rst
  424. which includes sample code for accessing the device file.
  425. config USB_CONFIGFS_F_TCM
  426. bool "USB Gadget Target Fabric"
  427. depends on TARGET_CORE
  428. depends on USB_CONFIGFS
  429. select USB_LIBCOMPOSITE
  430. select USB_F_TCM
  431. help
  432. This fabric is a USB gadget component. Two USB protocols are
  433. supported that is BBB or BOT (Bulk Only Transport) and UAS
  434. (USB Attached SCSI). BOT is advertised on alternative
  435. interface 0 (primary) and UAS is on alternative interface 1.
  436. Both protocols can work on USB2.0 and USB3.0.
  437. UAS utilizes the USB 3.0 feature called streams support.
  438. source "drivers/usb/gadget/legacy/Kconfig"
  439. endif # USB_GADGET