Kconfig 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  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. config USB_F_ACC
  182. tristate
  183. config USB_F_IAP2
  184. tristate
  185. config USB_F_ADB
  186. tristate
  187. # this first set of drivers all depend on bulk-capable hardware.
  188. config USB_CONFIGFS
  189. tristate "USB Gadget functions configurable through configfs"
  190. select USB_LIBCOMPOSITE
  191. help
  192. A Linux USB "gadget" can be set up through configfs.
  193. If this is the case, the USB functions (which from the host's
  194. perspective are seen as interfaces) and configurations are
  195. specified simply by creating appropriate directories in configfs.
  196. Associating functions with configurations is done by creating
  197. appropriate symbolic links.
  198. For more information see Documentation/usb/gadget_configfs.rst.
  199. config USB_CONFIGFS_SERIAL
  200. bool "Generic serial bulk in/out"
  201. depends on USB_CONFIGFS
  202. depends on TTY
  203. select USB_U_SERIAL
  204. select USB_F_SERIAL
  205. help
  206. The function talks to the Linux-USB generic serial driver.
  207. config USB_CONFIGFS_ACM
  208. bool "Abstract Control Model (CDC ACM)"
  209. depends on USB_CONFIGFS
  210. depends on TTY
  211. select USB_U_SERIAL
  212. select USB_F_ACM
  213. help
  214. ACM serial link. This function can be used to interoperate with
  215. MS-Windows hosts or with the Linux-USB "cdc-acm" driver.
  216. config USB_CONFIGFS_OBEX
  217. bool "Object Exchange Model (CDC OBEX)"
  218. depends on USB_CONFIGFS
  219. depends on TTY
  220. select USB_U_SERIAL
  221. select USB_F_OBEX
  222. help
  223. You will need a user space OBEX server talking to /dev/ttyGS*,
  224. since the kernel itself doesn't implement the OBEX protocol.
  225. config USB_CONFIGFS_NCM
  226. bool "Network Control Model (CDC NCM)"
  227. depends on USB_CONFIGFS
  228. depends on NET
  229. select USB_U_ETHER
  230. select USB_F_NCM
  231. select CRC32
  232. help
  233. NCM is an advanced protocol for Ethernet encapsulation, allows
  234. grouping of several ethernet frames into one USB transfer and
  235. different alignment possibilities.
  236. config USB_CONFIGFS_ECM
  237. bool "Ethernet Control Model (CDC ECM)"
  238. depends on USB_CONFIGFS
  239. depends on NET
  240. select USB_U_ETHER
  241. select USB_F_ECM
  242. help
  243. The "Communication Device Class" (CDC) Ethernet Control Model.
  244. That protocol is often avoided with pure Ethernet adapters, in
  245. favor of simpler vendor-specific hardware, but is widely
  246. supported by firmware for smart network devices.
  247. config USB_CONFIGFS_ECM_SUBSET
  248. bool "Ethernet Control Model (CDC ECM) subset"
  249. depends on USB_CONFIGFS
  250. depends on NET
  251. select USB_U_ETHER
  252. select USB_F_SUBSET
  253. help
  254. On hardware that can't implement the full protocol,
  255. a simple CDC subset is used, placing fewer demands on USB.
  256. config USB_CONFIGFS_RNDIS
  257. bool "RNDIS"
  258. depends on USB_CONFIGFS
  259. depends on NET
  260. select USB_U_ETHER
  261. select USB_F_RNDIS
  262. help
  263. Microsoft Windows XP bundles the "Remote NDIS" (RNDIS) protocol,
  264. and Microsoft provides redistributable binary RNDIS drivers for
  265. older versions of Windows.
  266. To make MS-Windows work with this, use Documentation/usb/linux.inf
  267. as the "driver info file". For versions of MS-Windows older than
  268. XP, you'll need to download drivers from Microsoft's website; a URL
  269. is given in comments found in that info file.
  270. config USB_CONFIGFS_EEM
  271. bool "Ethernet Emulation Model (EEM)"
  272. depends on USB_CONFIGFS
  273. depends on NET
  274. select USB_U_ETHER
  275. select USB_F_EEM
  276. select CRC32
  277. help
  278. CDC EEM is a newer USB standard that is somewhat simpler than CDC ECM
  279. and therefore can be supported by more hardware. Technically ECM and
  280. EEM are designed for different applications. The ECM model extends
  281. the network interface to the target (e.g. a USB cable modem), and the
  282. EEM model is for mobile devices to communicate with hosts using
  283. ethernet over USB. For Linux gadgets, however, the interface with
  284. the host is the same (a usbX device), so the differences are minimal.
  285. config USB_CONFIGFS_PHONET
  286. bool "Phonet protocol"
  287. depends on USB_CONFIGFS
  288. depends on NET
  289. depends on PHONET
  290. select USB_U_ETHER
  291. select USB_F_PHONET
  292. help
  293. The Phonet protocol implementation for USB device.
  294. config USB_CONFIGFS_MASS_STORAGE
  295. bool "Mass storage"
  296. depends on USB_CONFIGFS
  297. depends on BLOCK
  298. select USB_F_MASS_STORAGE
  299. help
  300. The Mass Storage Gadget acts as a USB Mass Storage disk drive.
  301. As its storage repository it can use a regular file or a block
  302. device (in much the same way as the "loop" device driver),
  303. specified as a module parameter or sysfs option.
  304. config USB_CONFIGFS_F_LB_SS
  305. bool "Loopback and sourcesink function (for testing)"
  306. depends on USB_CONFIGFS
  307. select USB_F_SS_LB
  308. help
  309. Loopback function loops back a configurable number of transfers.
  310. Sourcesink function either sinks and sources bulk data.
  311. It also implements control requests, for "chapter 9" conformance.
  312. Make this be the first driver you try using on top of any new
  313. USB peripheral controller driver. Then you can use host-side
  314. test software, like the "usbtest" driver, to put your hardware
  315. and its driver through a basic set of functional tests.
  316. config USB_CONFIGFS_F_FS
  317. bool "Function filesystem (FunctionFS)"
  318. depends on USB_CONFIGFS
  319. select USB_F_FS
  320. help
  321. The Function Filesystem (FunctionFS) lets one create USB
  322. composite functions in user space in the same way GadgetFS
  323. lets one create USB gadgets in user space. This allows creation
  324. of composite gadgets such that some of the functions are
  325. implemented in kernel space (for instance Ethernet, serial or
  326. mass storage) and other are implemented in user space.
  327. config USB_CONFIGFS_F_UAC1
  328. bool "Audio Class 1.0"
  329. depends on USB_CONFIGFS
  330. depends on SND
  331. select USB_LIBCOMPOSITE
  332. select SND_PCM
  333. select USB_U_AUDIO
  334. select USB_F_UAC1
  335. help
  336. This Audio function implements 1 AudioControl interface,
  337. 1 AudioStreaming Interface each for USB-OUT and USB-IN.
  338. This driver doesn't expect any real Audio codec to be present
  339. on the device - the audio streams are simply sinked to and
  340. sourced from a virtual ALSA sound card created. The user-space
  341. application may choose to do whatever it wants with the data
  342. received from the USB Host and choose to provide whatever it
  343. wants as audio data to the USB Host.
  344. config USB_CONFIGFS_F_UAC1_LEGACY
  345. bool "Audio Class 1.0 (legacy implementation)"
  346. depends on USB_CONFIGFS
  347. depends on SND
  348. select USB_LIBCOMPOSITE
  349. select SND_PCM
  350. select USB_F_UAC1_LEGACY
  351. help
  352. This Audio function implements 1 AudioControl interface,
  353. 1 AudioStreaming Interface each for USB-OUT and USB-IN.
  354. This is a legacy driver and requires a real Audio codec
  355. to be present on the device.
  356. config USB_CONFIGFS_F_UAC2
  357. bool "Audio Class 2.0"
  358. depends on USB_CONFIGFS
  359. depends on SND
  360. select USB_LIBCOMPOSITE
  361. select SND_PCM
  362. select USB_U_AUDIO
  363. select USB_F_UAC2
  364. help
  365. This Audio function is compatible with USB Audio Class
  366. specification 2.0. It implements 1 AudioControl interface,
  367. 1 AudioStreaming Interface each for USB-OUT and USB-IN.
  368. This driver doesn't expect any real Audio codec to be present
  369. on the device - the audio streams are simply sinked to and
  370. sourced from a virtual ALSA sound card created. The user-space
  371. application may choose to do whatever it wants with the data
  372. received from the USB Host and choose to provide whatever it
  373. wants as audio data to the USB Host.
  374. config USB_CONFIGFS_F_MIDI
  375. bool "MIDI function"
  376. depends on USB_CONFIGFS
  377. depends on SND
  378. select USB_LIBCOMPOSITE
  379. select SND_RAWMIDI
  380. select USB_F_MIDI
  381. help
  382. The MIDI Function acts as a USB Audio device, with one MIDI
  383. input and one MIDI output. These MIDI jacks appear as
  384. a sound "card" in the ALSA sound system. Other MIDI
  385. connections can then be made on the gadget system, using
  386. ALSA's aconnect utility etc.
  387. config USB_CONFIGFS_F_MIDI2
  388. bool "MIDI 2.0 function"
  389. depends on USB_CONFIGFS
  390. depends on SND
  391. select USB_LIBCOMPOSITE
  392. select USB_F_MIDI2
  393. help
  394. The MIDI 2.0 function driver provides the generic emulated
  395. USB MIDI 2.0 interface, looped back to ALSA UMP rawmidi
  396. device on the gadget host. It supports UMP 1.1 spec and
  397. responds UMP Stream messages for UMP Endpoint and Function
  398. Block information / configuration.
  399. config USB_CONFIGFS_F_HID
  400. bool "HID function"
  401. depends on USB_CONFIGFS
  402. select USB_F_HID
  403. help
  404. The HID function driver provides generic emulation of USB
  405. Human Interface Devices (HID).
  406. For more information, see Documentation/usb/gadget_hid.rst.
  407. config USB_CONFIGFS_F_UVC
  408. bool "USB Webcam function"
  409. depends on USB_CONFIGFS
  410. depends on VIDEO_DEV
  411. depends on VIDEO_DEV
  412. select VIDEOBUF2_DMA_SG
  413. select VIDEOBUF2_VMALLOC
  414. select USB_F_UVC
  415. help
  416. The Webcam function acts as a composite USB Audio and Video Class
  417. device. It provides a userspace API to process UVC control requests
  418. and stream video data to the host.
  419. config USB_CONFIGFS_F_PRINTER
  420. bool "Printer function"
  421. select USB_F_PRINTER
  422. depends on USB_CONFIGFS
  423. help
  424. The Printer function channels data between the USB host and a
  425. userspace program driving the print engine. The user space
  426. program reads and writes the device file /dev/g_printer<X> to
  427. receive or send printer data. It can use ioctl calls to
  428. the device file to get or set printer status.
  429. For more information, see Documentation/usb/gadget_printer.rst
  430. which includes sample code for accessing the device file.
  431. config USB_CONFIGFS_F_TCM
  432. bool "USB Gadget Target Fabric"
  433. depends on TARGET_CORE
  434. depends on USB_CONFIGFS
  435. select USB_LIBCOMPOSITE
  436. select USB_F_TCM
  437. help
  438. This fabric is a USB gadget component. Two USB protocols are
  439. supported that is BBB or BOT (Bulk Only Transport) and UAS
  440. (USB Attached SCSI). BOT is advertised on alternative
  441. interface 0 (primary) and UAS is on alternative interface 1.
  442. Both protocols can work on USB2.0 and USB3.0.
  443. UAS utilizes the USB 3.0 feature called streams support.
  444. config USB_CONFIGFS_F_ACC
  445. bool "USB Gadget Target Accessory gadget"
  446. depends on USB_CONFIGFS
  447. select USB_F_ACC
  448. help
  449. USB gadget Accessory support
  450. config USB_CONFIGFS_F_IAP2
  451. bool "USB Gadget Target iap2 gadget"
  452. depends on USB_CONFIGFS
  453. select USB_F_IAP2
  454. help
  455. USB gadget iap support
  456. config USB_CONFIGFS_F_ADB
  457. bool "USB Gadget Target adb gadget"
  458. depends on USB_CONFIGFS
  459. select USB_F_ADB
  460. help
  461. USB gadget adb support
  462. source "drivers/usb/gadget/legacy/Kconfig"
  463. endif # USB_GADGET