Kconfig.orig 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. config USB_F_HID
  174. tristate
  175. config USB_F_PRINTER
  176. tristate
  177. config USB_F_TCM
  178. tristate
  179. config USB_F_ACC
  180. tristate
  181. config USB_F_IAP2
  182. tristate
  183. config USB_F_ADB
  184. tristate
  185. # this first set of drivers all depend on bulk-capable hardware.
  186. config USB_CONFIGFS
  187. tristate "USB Gadget functions configurable through configfs"
  188. select USB_LIBCOMPOSITE
  189. help
  190. A Linux USB "gadget" can be set up through configfs.
  191. If this is the case, the USB functions (which from the host's
  192. perspective are seen as interfaces) and configurations are
  193. specified simply by creating appropriate directories in configfs.
  194. Associating functions with configurations is done by creating
  195. appropriate symbolic links.
  196. For more information see Documentation/usb/gadget_configfs.rst.
  197. config USB_CONFIGFS_SERIAL
  198. bool "Generic serial bulk in/out"
  199. depends on USB_CONFIGFS
  200. depends on TTY
  201. select USB_U_SERIAL
  202. select USB_F_SERIAL
  203. help
  204. The function talks to the Linux-USB generic serial driver.
  205. config USB_CONFIGFS_ACM
  206. bool "Abstract Control Model (CDC ACM)"
  207. depends on USB_CONFIGFS
  208. depends on TTY
  209. select USB_U_SERIAL
  210. select USB_F_ACM
  211. help
  212. ACM serial link. This function can be used to interoperate with
  213. MS-Windows hosts or with the Linux-USB "cdc-acm" driver.
  214. config USB_CONFIGFS_OBEX
  215. bool "Object Exchange Model (CDC OBEX)"
  216. depends on USB_CONFIGFS
  217. depends on TTY
  218. select USB_U_SERIAL
  219. select USB_F_OBEX
  220. help
  221. You will need a user space OBEX server talking to /dev/ttyGS*,
  222. since the kernel itself doesn't implement the OBEX protocol.
  223. config USB_CONFIGFS_NCM
  224. bool "Network Control Model (CDC NCM)"
  225. depends on USB_CONFIGFS
  226. depends on NET
  227. select USB_U_ETHER
  228. select USB_F_NCM
  229. select CRC32
  230. help
  231. NCM is an advanced protocol for Ethernet encapsulation, allows
  232. grouping of several ethernet frames into one USB transfer and
  233. different alignment possibilities.
  234. config USB_CONFIGFS_ECM
  235. bool "Ethernet Control Model (CDC ECM)"
  236. depends on USB_CONFIGFS
  237. depends on NET
  238. select USB_U_ETHER
  239. select USB_F_ECM
  240. help
  241. The "Communication Device Class" (CDC) Ethernet Control Model.
  242. That protocol is often avoided with pure Ethernet adapters, in
  243. favor of simpler vendor-specific hardware, but is widely
  244. supported by firmware for smart network devices.
  245. config USB_CONFIGFS_ECM_SUBSET
  246. bool "Ethernet Control Model (CDC ECM) subset"
  247. depends on USB_CONFIGFS
  248. depends on NET
  249. select USB_U_ETHER
  250. select USB_F_SUBSET
  251. help
  252. On hardware that can't implement the full protocol,
  253. a simple CDC subset is used, placing fewer demands on USB.
  254. config USB_CONFIGFS_RNDIS
  255. bool "RNDIS"
  256. depends on USB_CONFIGFS
  257. depends on NET
  258. select USB_U_ETHER
  259. select USB_F_RNDIS
  260. help
  261. Microsoft Windows XP bundles the "Remote NDIS" (RNDIS) protocol,
  262. and Microsoft provides redistributable binary RNDIS drivers for
  263. older versions of Windows.
  264. To make MS-Windows work with this, use Documentation/usb/linux.inf
  265. as the "driver info file". For versions of MS-Windows older than
  266. XP, you'll need to download drivers from Microsoft's website; a URL
  267. is given in comments found in that info file.
  268. config USB_CONFIGFS_EEM
  269. bool "Ethernet Emulation Model (EEM)"
  270. depends on USB_CONFIGFS
  271. depends on NET
  272. select USB_U_ETHER
  273. select USB_F_EEM
  274. select CRC32
  275. help
  276. CDC EEM is a newer USB standard that is somewhat simpler than CDC ECM
  277. and therefore can be supported by more hardware. Technically ECM and
  278. EEM are designed for different applications. The ECM model extends
  279. the network interface to the target (e.g. a USB cable modem), and the
  280. EEM model is for mobile devices to communicate with hosts using
  281. ethernet over USB. For Linux gadgets, however, the interface with
  282. the host is the same (a usbX device), so the differences are minimal.
  283. config USB_CONFIGFS_PHONET
  284. bool "Phonet protocol"
  285. depends on USB_CONFIGFS
  286. depends on NET
  287. depends on PHONET
  288. select USB_U_ETHER
  289. select USB_F_PHONET
  290. help
  291. The Phonet protocol implementation for USB device.
  292. config USB_CONFIGFS_MASS_STORAGE
  293. bool "Mass storage"
  294. depends on USB_CONFIGFS
  295. depends on BLOCK
  296. select USB_F_MASS_STORAGE
  297. help
  298. The Mass Storage Gadget acts as a USB Mass Storage disk drive.
  299. As its storage repository it can use a regular file or a block
  300. device (in much the same way as the "loop" device driver),
  301. specified as a module parameter or sysfs option.
  302. config USB_CONFIGFS_F_LB_SS
  303. bool "Loopback and sourcesink function (for testing)"
  304. depends on USB_CONFIGFS
  305. select USB_F_SS_LB
  306. help
  307. Loopback function loops back a configurable number of transfers.
  308. Sourcesink function either sinks and sources bulk data.
  309. It also implements control requests, for "chapter 9" conformance.
  310. Make this be the first driver you try using on top of any new
  311. USB peripheral controller driver. Then you can use host-side
  312. test software, like the "usbtest" driver, to put your hardware
  313. and its driver through a basic set of functional tests.
  314. config USB_CONFIGFS_F_FS
  315. bool "Function filesystem (FunctionFS)"
  316. depends on USB_CONFIGFS
  317. select USB_F_FS
  318. help
  319. The Function Filesystem (FunctionFS) lets one create USB
  320. composite functions in user space in the same way GadgetFS
  321. lets one create USB gadgets in user space. This allows creation
  322. of composite gadgets such that some of the functions are
  323. implemented in kernel space (for instance Ethernet, serial or
  324. mass storage) and other are implemented in user space.
  325. config USB_CONFIGFS_F_UAC1
  326. bool "Audio Class 1.0"
  327. depends on USB_CONFIGFS
  328. depends on SND
  329. select USB_LIBCOMPOSITE
  330. select SND_PCM
  331. select USB_U_AUDIO
  332. select USB_F_UAC1
  333. help
  334. This Audio function implements 1 AudioControl interface,
  335. 1 AudioStreaming Interface each for USB-OUT and USB-IN.
  336. This driver doesn't expect any real Audio codec to be present
  337. on the device - the audio streams are simply sinked to and
  338. sourced from a virtual ALSA sound card created. The user-space
  339. application may choose to do whatever it wants with the data
  340. received from the USB Host and choose to provide whatever it
  341. wants as audio data to the USB Host.
  342. config USB_CONFIGFS_F_UAC1_LEGACY
  343. bool "Audio Class 1.0 (legacy implementation)"
  344. depends on USB_CONFIGFS
  345. depends on SND
  346. select USB_LIBCOMPOSITE
  347. select SND_PCM
  348. select USB_F_UAC1_LEGACY
  349. help
  350. This Audio function implements 1 AudioControl interface,
  351. 1 AudioStreaming Interface each for USB-OUT and USB-IN.
  352. This is a legacy driver and requires a real Audio codec
  353. to be present on the device.
  354. config USB_CONFIGFS_F_UAC2
  355. bool "Audio Class 2.0"
  356. depends on USB_CONFIGFS
  357. depends on SND
  358. select USB_LIBCOMPOSITE
  359. select SND_PCM
  360. select USB_U_AUDIO
  361. select USB_F_UAC2
  362. help
  363. This Audio function is compatible with USB Audio Class
  364. specification 2.0. It implements 1 AudioControl interface,
  365. 1 AudioStreaming Interface each for USB-OUT and USB-IN.
  366. This driver doesn't expect any real Audio codec to be present
  367. on the device - the audio streams are simply sinked to and
  368. sourced from a virtual ALSA sound card created. The user-space
  369. application may choose to do whatever it wants with the data
  370. received from the USB Host and choose to provide whatever it
  371. wants as audio data to the USB Host.
  372. config USB_CONFIGFS_F_MIDI
  373. bool "MIDI function"
  374. depends on USB_CONFIGFS
  375. depends on SND
  376. select USB_LIBCOMPOSITE
  377. select SND_RAWMIDI
  378. select USB_F_MIDI
  379. help
  380. The MIDI Function acts as a USB Audio device, with one MIDI
  381. input and one MIDI output. These MIDI jacks appear as
  382. a sound "card" in the ALSA sound system. Other MIDI
  383. connections can then be made on the gadget system, using
  384. ALSA's aconnect utility etc.
  385. config USB_CONFIGFS_F_MIDI2
  386. bool "MIDI 2.0 function"
  387. depends on USB_CONFIGFS
  388. depends on SND
  389. select USB_LIBCOMPOSITE
  390. select SND_UMP
  391. select SND_UMP_LEGACY_RAWMIDI
  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