Kconfig 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  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. tristate
  159. config USB_F_UAC1
  160. tristate
  161. config USB_F_UAC1_LEGACY
  162. tristate
  163. config USB_F_UAC2
  164. tristate
  165. config USB_F_UVC
  166. tristate
  167. config USB_F_MIDI
  168. tristate
  169. config USB_F_HID
  170. tristate
  171. config USB_F_PRINTER
  172. tristate
  173. config USB_F_TCM
  174. tristate
  175. config USB_F_ACC
  176. tristate
  177. config USB_F_AUDIO_SRC
  178. tristate
  179. config USB_F_CDEV
  180. tristate
  181. config USB_F_CCID
  182. tristate
  183. config USB_F_QDSS
  184. tristate
  185. config USB_F_GSI
  186. tristate
  187. config USB_F_DIAG
  188. tristate
  189. config USB_F_FS_IPC_LOGGING
  190. tristate "Enable IPC logging for FunctionFS via f_fs_ipc_log"
  191. depends on IPC_LOGGING
  192. depends on ARM64
  193. help
  194. Enables additional debug messages for FunctionFS driver with the help
  195. of f_fs_ipc_log module and output via IPC Logging mechanism. This can
  196. be useful when troubleshooting transfer stalls or other general
  197. failures and determine if the issue is in the kernel gadget or the
  198. userspace client. Separate IPC log contexts are created for each
  199. function instance at mount time.
  200. config USB_F_CONN_GADGET
  201. tristate
  202. config USB_F_SS_MON_GADGET
  203. tristate
  204. config USB_F_SS_ACM
  205. tristate
  206. # this first set of drivers all depend on bulk-capable hardware.
  207. config USB_CONFIGFS
  208. tristate "USB Gadget functions configurable through configfs"
  209. select USB_LIBCOMPOSITE
  210. help
  211. A Linux USB "gadget" can be set up through configfs.
  212. If this is the case, the USB functions (which from the host's
  213. perspective are seen as interfaces) and configurations are
  214. specified simply by creating appropriate directories in configfs.
  215. Associating functions with configurations is done by creating
  216. appropriate symbolic links.
  217. For more information see Documentation/usb/gadget_configfs.rst.
  218. config USB_CONFIGFS_UEVENT
  219. bool "Uevent notification of Gadget state"
  220. depends on USB_CONFIGFS
  221. help
  222. Enable uevent notifications to userspace when the gadget
  223. state changes. The gadget can be in any of the following
  224. three states: "CONNECTED/DISCONNECTED/CONFIGURED"
  225. config USB_CONFIGFS_SERIAL
  226. bool "Generic serial bulk in/out"
  227. depends on USB_CONFIGFS
  228. depends on TTY
  229. select USB_U_SERIAL
  230. select USB_F_SERIAL
  231. help
  232. The function talks to the Linux-USB generic serial driver.
  233. config USB_CONFIGFS_ACM
  234. bool "Abstract Control Model (CDC ACM)"
  235. depends on USB_CONFIGFS
  236. depends on TTY
  237. select USB_U_SERIAL
  238. select USB_F_ACM
  239. help
  240. ACM serial link. This function can be used to interoperate with
  241. MS-Windows hosts or with the Linux-USB "cdc-acm" driver.
  242. config USB_CONFIGFS_OBEX
  243. bool "Object Exchange Model (CDC OBEX)"
  244. depends on USB_CONFIGFS
  245. depends on TTY
  246. select USB_U_SERIAL
  247. select USB_F_OBEX
  248. help
  249. You will need a user space OBEX server talking to /dev/ttyGS*,
  250. since the kernel itself doesn't implement the OBEX protocol.
  251. config USB_CONFIGFS_NCM
  252. bool "Network Control Model (CDC NCM)"
  253. depends on USB_CONFIGFS
  254. depends on NET
  255. select USB_U_ETHER
  256. select USB_F_NCM
  257. select CRC32
  258. help
  259. NCM is an advanced protocol for Ethernet encapsulation, allows
  260. grouping of several ethernet frames into one USB transfer and
  261. different alignment possibilities.
  262. config USB_CONFIGFS_ECM
  263. bool "Ethernet Control Model (CDC ECM)"
  264. depends on USB_CONFIGFS
  265. depends on NET
  266. select USB_U_ETHER
  267. select USB_F_ECM
  268. help
  269. The "Communication Device Class" (CDC) Ethernet Control Model.
  270. That protocol is often avoided with pure Ethernet adapters, in
  271. favor of simpler vendor-specific hardware, but is widely
  272. supported by firmware for smart network devices.
  273. config USB_CONFIGFS_ECM_SUBSET
  274. bool "Ethernet Control Model (CDC ECM) subset"
  275. depends on USB_CONFIGFS
  276. depends on NET
  277. select USB_U_ETHER
  278. select USB_F_SUBSET
  279. help
  280. On hardware that can't implement the full protocol,
  281. a simple CDC subset is used, placing fewer demands on USB.
  282. config USB_CONFIGFS_RNDIS
  283. bool "RNDIS"
  284. depends on USB_CONFIGFS
  285. depends on NET
  286. select USB_U_ETHER
  287. select USB_F_RNDIS
  288. help
  289. Microsoft Windows XP bundles the "Remote NDIS" (RNDIS) protocol,
  290. and Microsoft provides redistributable binary RNDIS drivers for
  291. older versions of Windows.
  292. To make MS-Windows work with this, use Documentation/usb/linux.inf
  293. as the "driver info file". For versions of MS-Windows older than
  294. XP, you'll need to download drivers from Microsoft's website; a URL
  295. is given in comments found in that info file.
  296. config USB_CONFIGFS_F_CONN_GADGET
  297. tristate "Samsung Sidesync function"
  298. depends on USB_CONFIGFS
  299. select USB_F_CONN_GADGET
  300. help
  301. USB Sidesync function support
  302. config USB_CONFIGFS_F_SS_MON_GADGET
  303. tristate "F_SAMSUNG gadget"
  304. depends on USB_CONFIGFS
  305. select USB_F_SS_MON_GADGET
  306. help
  307. Driver for control to Samsung Usb device layer
  308. For Samung working scenario and saving debug log, etc
  309. config USB_CONFIGFS_F_SS_ACM
  310. tristate "F_SAMSUNG ACM"
  311. depends on USB_CONFIGFS
  312. depends on TTY
  313. select USB_U_SERIAL
  314. select USB_F_SS_ACM
  315. help
  316. Samsung ACM function support
  317. config USB_CONFIGFS_EEM
  318. bool "Ethernet Emulation Model (EEM)"
  319. depends on USB_CONFIGFS
  320. depends on NET
  321. select USB_U_ETHER
  322. select USB_F_EEM
  323. select CRC32
  324. help
  325. CDC EEM is a newer USB standard that is somewhat simpler than CDC ECM
  326. and therefore can be supported by more hardware. Technically ECM and
  327. EEM are designed for different applications. The ECM model extends
  328. the network interface to the target (e.g. a USB cable modem), and the
  329. EEM model is for mobile devices to communicate with hosts using
  330. ethernet over USB. For Linux gadgets, however, the interface with
  331. the host is the same (a usbX device), so the differences are minimal.
  332. config USB_CONFIGFS_PHONET
  333. bool "Phonet protocol"
  334. depends on USB_CONFIGFS
  335. depends on NET
  336. depends on PHONET
  337. select USB_U_ETHER
  338. select USB_F_PHONET
  339. help
  340. The Phonet protocol implementation for USB device.
  341. config USB_CONFIGFS_MASS_STORAGE
  342. bool "Mass storage"
  343. depends on USB_CONFIGFS
  344. depends on BLOCK
  345. select USB_F_MASS_STORAGE
  346. help
  347. The Mass Storage Gadget acts as a USB Mass Storage disk drive.
  348. As its storage repository it can use a regular file or a block
  349. device (in much the same way as the "loop" device driver),
  350. specified as a module parameter or sysfs option.
  351. config USB_CONFIGFS_F_LB_SS
  352. bool "Loopback and sourcesink function (for testing)"
  353. depends on USB_CONFIGFS
  354. select USB_F_SS_LB
  355. help
  356. Loopback function loops back a configurable number of transfers.
  357. Sourcesink function either sinks and sources bulk data.
  358. It also implements control requests, for "chapter 9" conformance.
  359. Make this be the first driver you try using on top of any new
  360. USB peripheral controller driver. Then you can use host-side
  361. test software, like the "usbtest" driver, to put your hardware
  362. and its driver through a basic set of functional tests.
  363. config USB_CONFIGFS_F_FS
  364. bool "Function filesystem (FunctionFS)"
  365. depends on USB_CONFIGFS
  366. select USB_F_FS
  367. help
  368. The Function Filesystem (FunctionFS) lets one create USB
  369. composite functions in user space in the same way GadgetFS
  370. lets one create USB gadgets in user space. This allows creation
  371. of composite gadgets such that some of the functions are
  372. implemented in kernel space (for instance Ethernet, serial or
  373. mass storage) and other are implemented in user space.
  374. config F_CONN_GADGET_DEBUGFS
  375. bool "Conn gadget debugfs"
  376. depends on USB_CONFIGFS_F_CONN_GADGET
  377. default n
  378. help
  379. SydeSync Debugging
  380. config USB_CONFIGFS_F_ACC
  381. bool "Accessory gadget"
  382. depends on USB_CONFIGFS
  383. depends on HID=y
  384. select USB_F_ACC
  385. help
  386. USB gadget Accessory support
  387. config USB_CONFIGFS_F_AUDIO_SRC
  388. bool "Audio Source gadget"
  389. depends on USB_CONFIGFS
  390. depends on SND
  391. select SND_PCM
  392. select USB_F_AUDIO_SRC
  393. help
  394. USB gadget Audio Source support
  395. config USB_CONFIGFS_F_UAC1
  396. bool "Audio Class 1.0"
  397. depends on USB_CONFIGFS
  398. depends on SND
  399. select USB_LIBCOMPOSITE
  400. select SND_PCM
  401. select USB_U_AUDIO
  402. select USB_F_UAC1
  403. help
  404. This Audio function implements 1 AudioControl interface,
  405. 1 AudioStreaming Interface each for USB-OUT and USB-IN.
  406. This driver doesn't expect any real Audio codec to be present
  407. on the device - the audio streams are simply sinked to and
  408. sourced from a virtual ALSA sound card created. The user-space
  409. application may choose to do whatever it wants with the data
  410. received from the USB Host and choose to provide whatever it
  411. wants as audio data to the USB Host.
  412. config USB_CONFIGFS_F_UAC1_LEGACY
  413. bool "Audio Class 1.0 (legacy implementation)"
  414. depends on USB_CONFIGFS
  415. depends on SND
  416. select USB_LIBCOMPOSITE
  417. select SND_PCM
  418. select USB_F_UAC1_LEGACY
  419. help
  420. This Audio function implements 1 AudioControl interface,
  421. 1 AudioStreaming Interface each for USB-OUT and USB-IN.
  422. This is a legacy driver and requires a real Audio codec
  423. to be present on the device.
  424. config USB_CONFIGFS_F_UAC2
  425. bool "Audio Class 2.0"
  426. depends on USB_CONFIGFS
  427. depends on SND
  428. select USB_LIBCOMPOSITE
  429. select SND_PCM
  430. select USB_U_AUDIO
  431. select USB_F_UAC2
  432. help
  433. This Audio function is compatible with USB Audio Class
  434. specification 2.0. It implements 1 AudioControl interface,
  435. 1 AudioStreaming Interface each for USB-OUT and USB-IN.
  436. This driver doesn't expect any real Audio codec to be present
  437. on the device - the audio streams are simply sinked to and
  438. sourced from a virtual ALSA sound card created. The user-space
  439. application may choose to do whatever it wants with the data
  440. received from the USB Host and choose to provide whatever it
  441. wants as audio data to the USB Host.
  442. config USB_CONFIGFS_F_MIDI
  443. bool "MIDI function"
  444. depends on USB_CONFIGFS
  445. depends on SND
  446. select USB_LIBCOMPOSITE
  447. select SND_RAWMIDI
  448. select USB_F_MIDI
  449. help
  450. The MIDI Function acts as a USB Audio device, with one MIDI
  451. input and one MIDI output. These MIDI jacks appear as
  452. a sound "card" in the ALSA sound system. Other MIDI
  453. connections can then be made on the gadget system, using
  454. ALSA's aconnect utility etc.
  455. config USB_CONFIGFS_F_HID
  456. bool "HID function"
  457. depends on USB_CONFIGFS
  458. select USB_F_HID
  459. help
  460. The HID function driver provides generic emulation of USB
  461. Human Interface Devices (HID).
  462. For more information, see Documentation/usb/gadget_hid.rst.
  463. config USB_CONFIGFS_F_UVC
  464. bool "USB Webcam function"
  465. depends on USB_CONFIGFS
  466. depends on VIDEO_DEV
  467. depends on VIDEO_DEV
  468. select VIDEOBUF2_DMA_SG
  469. select VIDEOBUF2_VMALLOC
  470. select USB_F_UVC
  471. help
  472. The Webcam function acts as a composite USB Audio and Video Class
  473. device. It provides a userspace API to process UVC control requests
  474. and stream video data to the host.
  475. config USB_CONFIGFS_F_PRINTER
  476. bool "Printer function"
  477. select USB_F_PRINTER
  478. depends on USB_CONFIGFS
  479. help
  480. The Printer function channels data between the USB host and a
  481. userspace program driving the print engine. The user space
  482. program reads and writes the device file /dev/g_printer<X> to
  483. receive or send printer data. It can use ioctl calls to
  484. the device file to get or set printer status.
  485. For more information, see Documentation/usb/gadget_printer.rst
  486. which includes sample code for accessing the device file.
  487. config USB_CONFIGFS_F_TCM
  488. bool "USB Gadget Target Fabric"
  489. depends on TARGET_CORE
  490. depends on USB_CONFIGFS
  491. select USB_LIBCOMPOSITE
  492. select USB_F_TCM
  493. help
  494. This fabric is a USB gadget component. Two USB protocols are
  495. supported that is BBB or BOT (Bulk Only Transport) and UAS
  496. (USB Attached SCSI). BOT is advertised on alternative
  497. interface 0 (primary) and UAS is on alternative interface 1.
  498. Both protocols can work on USB2.0 and USB3.0.
  499. UAS utilizes the USB 3.0 feature called streams support.
  500. config USB_CONFIGFS_F_CDEV
  501. tristate "USB Serial Character function"
  502. select USB_F_CDEV
  503. depends on USB_CONFIGFS
  504. help
  505. The serial character function is a generic function driver that
  506. exposes a pair of bulk IN and OUT endpoints which are backed by
  507. a character device and mapped to its read/write routines. The
  508. function also supports a single interrupt IN endpoint for
  509. asynchronous notification to the host. This driver is typically
  510. used to support DUN/NMEA functions.
  511. config USB_CONFIGFS_F_CCID
  512. tristate "USB CCID function"
  513. select USB_F_CCID
  514. depends on USB_CONFIGFS
  515. help
  516. The Chip Card Interface Device (CCID) function implements a USB
  517. interface that exposes a standard CSCID class that consists of a
  518. pair of bulk IN and OUT endpoints and a single interrupt IN
  519. endpoint. This driver provides a character device interface
  520. allowing a userspace component to be able to provide the
  521. implementation necessary to interface with the smartcard.
  522. config USB_CONFIGFS_F_QDSS
  523. tristate "USB QDSS function"
  524. select USB_F_QDSS
  525. depends on USB_CONFIGFS
  526. help
  527. USB QDSS function driver to get hwtracing related data over
  528. USB. USB QDSS function driver which allows communication
  529. between USB BAM and QDSS BAM for QDSS debug functionality
  530. over USB.
  531. config USB_CONFIGFS_F_GSI
  532. tristate "USB GSI function"
  533. select USB_F_GSI
  534. depends on USB_CONFIGFS
  535. help
  536. Generic function driver to support h/w acceleration to IPA
  537. over GSI. This driver provides USB RMNET/RNDIS/ECM/MBIM/DPL
  538. related functionalities using GSI hardware accelerated data
  539. path and control path.
  540. config USB_CONFIGFS_F_DIAG
  541. tristate "USB Diag function"
  542. select USB_F_DIAG
  543. depends on USB_CONFIGFS
  544. help
  545. Diag function driver enables support for diagnostics service over USB.
  546. Diagnostics application running on Host receives stream of log data
  547. over USB. Applications can also send commands to diagnostics client
  548. running on device.
  549. source "drivers/usb/gadget/legacy/Kconfig"
  550. endif # USB_GADGET