1. 19 6月, 2017 3 次提交
    • R
      usb: gadget: add f_uac1 variant based on a new u_audio api · 0591bc23
      Ruslan Bilovol 提交于
      This patch adds a new function 'f_uac1'
      (f_uac1 with virtual "ALSA card") that
      uses recently created u_audio API. Comparing
      to legacy f_uac1 function implementation it
      doesn't require any real Audio codec to be
      present on the device. In f_uac1 audio
      streams are simply sinked to and sourced
      from a virtual ALSA sound card created
      using u_audio API.
      
      Legacy f_uac1 approach is to write audio
      samples directly to existing ALSA sound
      card
      
      f_uac1 approach is more generic/flexible
      one - create an ALSA sound card that
      represents USB Audio function and allows to
      be used by userspace application that
      may choose to do whatever it wants with the
      data received from the USB Host and choose
      to provide whatever it wants as audio data
      to the USB Host.
      
      f_uac1 also has capture support (gadget->host)
      thanks to easy implementation via u_audio.
      By default, capture interface has 48000kHz/2ch
      configuration, same as playback channel has.
      
      f_uac1 descriptors naming convention
      uses f_uac2 driver naming convention that
      makes it more common and meaningful.
      
      Comparing to f_uac1_legacy, the f_uac1 doesn't
      have volume/mute functionality. This is because
      the f_uac1 volume/mute feature unit was dummy
      implementation since that driver creation (2009)
      and never had any real volume control or mute
      functionality, so there is no any difference
      here.
      
      Since f_uac1 functionality, exposed
      interface to userspace (virtual ALSA card),
      input parameters are so different comparing
      to f_uac1_legacy, that there is no any
      reason to keep them in the same file/module,
      and separate function was created.
      
      g_audio can be built using one of existing
      UAC functions (f_uac1, f_uac1_legacy or f_uac2)
      Signed-off-by: NRuslan Bilovol <ruslan.bilovol@gmail.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      0591bc23
    • R
      usb: gadget: function: make current f_uac1 implementation legacy · d355339e
      Ruslan Bilovol 提交于
      Before introducing new f_uac1 function (with virtual
      ALSA card) make current implementation legacy.
      
      This includes renaming of existing files, some
      variables, config options and documentation
      Signed-off-by: NRuslan Bilovol <ruslan.bilovol@gmail.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      d355339e
    • R
      usb: gadget: f_uac2: split out audio core · eb9fecb9
      Ruslan Bilovol 提交于
      Abstract the peripheral side ALSA sound card code from
      the f_uac2 function into a component that can be called
      by various functions, so the various flavors can be split
      apart and selectively reused.
      
      Visible changes:
       - add uac_params structure to pass audio paramteres for
         g_audio_setup
       - make ALSA sound card's name configurable
       - add [in/out]_ep_maxpsize
       - allocate snd_uac_chip structure during g_audio_setup
       - add u_audio_[start/stop]_[capture/playback] functions
      Signed-off-by: NRuslan Bilovol <ruslan.bilovol@gmail.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      eb9fecb9
  2. 21 12月, 2015 1 次提交
  3. 11 3月, 2015 1 次提交
  4. 13 1月, 2015 1 次提交
  5. 07 11月, 2014 1 次提交
  6. 06 11月, 2014 1 次提交
  7. 09 9月, 2014 1 次提交
  8. 30 8月, 2014 1 次提交
  9. 21 8月, 2014 3 次提交
    • A
      usb: gadget: f_uac1: convert to new function interface with backward compatibility · f3a3406b
      Andrzej Pietrasiewicz 提交于
      Converting uac1 to the new function interface requires converting
      the USB uac1's function code and its users.
      
      This patch converts the f_uac1.c to the new function interface.
      
      The file is now compiled into a separate usb_f_uac1.ko module.
      
      The old function interface is provided by means of a preprocessor
      conditional directives. After all users are converted, the old interface
      can be removed.
      Tested-by: NSebastian Reimers <sebastian.reimers@googlemail.com>
      Signed-off-by: NAndrzej Pietrasiewicz <andrzej.p@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      f3a3406b
    • A
      usb: gadget: f_uac2: convert to new function interface with backward compatibility · f8f93d24
      Andrzej Pietrasiewicz 提交于
      Converting uac2 to the new function interface requires converting
      the USB uac2's function code and its users.
      
      This patch converts the f_uac2.c to the new function interface.
      
      The file is now compiled into a separate usb_f_uac2.ko module.
      
      The old function interface is provided by means of a preprocessor
      conditional directives. After all users are converted, the old interface
      can be removed.
      Tested-by: NSebastian Reimers <sebastian.reimers@googlemail.com>
      Signed-off-by: NAndrzej Pietrasiewicz <andrzej.p@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      f8f93d24
    • P
      usb: gadget: remove $(PWD) in ccflags-y · 5d197038
      Philippe Reynes 提交于
      The variable $(PWD) is useless, and it may break the compilation.
      For example, it breaks the kernel compilation when it's done with
      buildroot :
      
        /home/trem/Codes/armadeus/armadeus/buildroot/output/host/usr/bin/ccache
      /home/trem/Codes/armadeus/armadeus/buildroot/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-gcc
      -Wp,-MD,drivers/usb/gadget/legacy/.hid.o.d  -nostdinc -isystem
      /home/trem/Codes/armadeus/armadeus/buildroot/output/host/usr/lib/gcc/arm-buildroot-linux-uclibcgnueabi/4.7.3/include
      -I./arch/arm/include -Iarch/arm/include/generated  -Iinclude
      -I./arch/arm/include/uapi -Iarch/arm/include/generated/uapi
      -I./include/uapi -Iinclude/generated/uapi -include
      ./include/linux/kconfig.h -D__KERNEL__ -mlittle-endian -Wall -Wundef
      -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common
      -Werror-implicit-function-declaration -Wno-format-security
      -fno-dwarf2-cfi-asm -mabi=aapcs-linux -mno-thumb-interwork -mfpu=vfp
      -funwind-tables -marm -D__LINUX_ARM_ARCH__=5 -march=armv5te
      -mtune=arm9tdmi -msoft-float -Uarm -fno-delete-null-pointer-checks -O2
      --param=allow-store-data-races=0 -Wframe-larger-than=1024
      -fno-stack-protector -Wno-unused-but-set-variable -fomit-frame-pointer
      -fno-var-tracking-assignments -g -Wdeclaration-after-statement
      -Wno-pointer-sign -fno-strict-overflow -fconserve-stack
      -Werror=implicit-int -Werror=strict-prototypes -DCC_HAVE_ASM_GOTO
      -I/home/trem/Codes/armadeus/armadeus/buildroot/drivers/usb/gadget/
      -I/home/trem/Codes/armadeus/armadeus/buildroot/drivers/usb/gadget/udc/
      -I/home/trem/Codes/armadeus/armadeus/buildroot/drivers/usb/gadget/function/
      -DMODULE  -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(hid)"
      -D"KBUILD_MODNAME=KBUILD_STR(g_hid)" -c -o
      drivers/usb/gadget/legacy/hid.o drivers/usb/gadget/legacy/hid.c
      drivers/usb/gadget/epautoconf.c:23:26: erreur fatale: gadget_chips.h :
      Aucun fichier ou dossier de ce type
      
      This compilation line include :
      ..../buildroot/driver/usb/gadget
      but the real path is :
      ..../buildroot/output/build/linux-3.17-rc1/driver/usb/gadget
      Signed-off-by: NPhilippe Reynes <tremyfr@gmail.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      5d197038
  10. 17 7月, 2014 3 次提交
  11. 25 4月, 2014 1 次提交
  12. 24 12月, 2013 1 次提交
  13. 13 12月, 2013 2 次提交
  14. 27 11月, 2013 1 次提交
  15. 12 10月, 2013 1 次提交
  16. 10 10月, 2013 2 次提交
  17. 01 10月, 2013 1 次提交
    • A
      usb: gadget: create a utility module for mass_storage · 6fdc5dd2
      Andrzej Pietrasiewicz 提交于
      Converting to configfs requires making the f_mass_storage.c a module.
      
      But first we need to get rid of "#include "storage_common.c".
      
      This patch makes storage_common.c a separately compiled file, which is
      built as a utility module named u_ms.ko. After all mass storage users are
      converted to the new function interface this module can be eliminated
      by merging it with the mass storage function's module.
      
      USB descriptors are exported so that they can be accessed from
      f_mass_storage.
      
      FSG_VENDOR_ID and FSG_PRODUCT_ID are moved to their only user.
      
      Handling of CONFIG_USB_GADGET_DEBUG_FILES is moved to f_mass_storage.c.
      The fsg_num_buffers static is moved to FSG_MODULE_PARAMETER users, so
      instead of using a global variable the f_mass_storage introduces
      fsg_num_buffers member in fsg_common (and fsg_config).
      
      fsg_strings and fsg_stringtab are moved to f_mass_storage.c.
      Signed-off-by: NAndrzej Pietrasiewicz <andrzej.p@samsung.com>
      Signed-off-by: NKyungmin Park <kyungmin.park@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      6fdc5dd2
  18. 29 7月, 2013 1 次提交
    • F
      usb: gadget: remove imx_udc · 2b0c4953
      Felipe Balbi 提交于
      That driver hasn't been really maintained for
      a long time. It doesn't compile in any way, it
      includes non-existent headers, has no users,
      and is just plain broken.
      
      The person who used to work with that driver
      has publicly stated that he has no plans to
      touch that driver again and is ok with removal[1].
      
      Due to these factors, imx_udc is now removed from
      the tree, if someone really believe it needs to
      be kept, please fix the bugs in that driver.
      
      [1] http://marc.info/?l=linux-usb&m=136197620417636&w=2Signed-off-by: NFelipe Balbi <balbi@ti.com>
      2b0c4953
  19. 10 6月, 2013 9 次提交
  20. 03 4月, 2013 4 次提交
    • A
      usb: gadget: f_obex: convert to new function interface with backward compatibility · 1d8fc251
      Andrzej Pietrasiewicz 提交于
      Converting f_obex to the new function interface requires converting
      the f_obex's function code and its users.
      
      This patch converts the f_obex.c to the new function interface.
      The file is now compiled into a separate usb_f_obex.ko module.
      
      The old function interface is provided by means of preprocessor
      conditional directives. After all users are converted, the old interface
      can be removed.
      Signed-off-by: NAndrzej Pietrasiewicz <andrzej.p@samsung.com>
      Signed-off-by: NKyungmin Park <kyungmin.park@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      1d8fc251
    • A
      usb: gadget: f_serial: convert to new function interface with backward compatibility · 60540ea2
      Andrzej Pietrasiewicz 提交于
      Converting f_serial to the new function interface requires converting
      the f_serial's function code and its users.
      
      This patch converts the f_serial.c to the new function interface.
      
      The file is now compiled into a separate usb_f_serial.ko module.
      The old function interface is provided by means of preprocessor
      conditional directives. After all users are converted, the old interface
      can be removed.
      Signed-off-by: NAndrzej Pietrasiewicz <andrzej.p@samsung.com>
      Signed-off-by: NKyungmin Park <kyungmin.park@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      60540ea2
    • A
      usb: gadget: use consistent naming scheme for usb function modules · 4f47a1be
      Andrzej Pietrasiewicz 提交于
      In order to convert to configfs the USB functions need to be converted
      to the new interface from Sebastian, which also requires turning them
      into separate modules. Some of these modules will consist of just
      one object file, e.g. f_ncm.o. But some of the modules will eventually
      consist of more than one object file, e.g. for mass storage there
      will be f_mass_storage.o and storage_common.o. The resulting module
      cannot be called f_mass_storage.ko due to cyclic dependency. This patch
      introduces a naming scheme for the said resulting modules:
      
      usb_f_xxxxxx.ko
      
      e.g. usb_f_mass_storage.ko, usb_f_ss_lb.ko, usb_f_rndis.ko etc.
      Signed-off-by: NAndrzej Pietrasiewicz <andrzej.p@samsung.com>
      Signed-off-by: NKyungmin Park <kyungmin.park@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      4f47a1be
    • S
      usb: gadget: the start of the configfs interface · 88af8bbe
      Sebastian Andrzej Siewior 提交于
      |# modprobe dummy_hcd num=2
      |# modprobe libcomposite
      
      |# lsmod
      |Module                  Size  Used by
      |libcomposite           31648  0
      |dummy_hcd              19871  0
      
      |# mkdir /sys/kernel/config/usb_gadget/oha
      |# cd /sys/kernel/config/usb_gadget/oha
      |# mkdir configs/def.1
      |# mkdir configs/def.2
      |# mkdir functions/acm.ttyS1
      |# mkdir strings/0x1
      |mkdir: cannot create directory `strings/0x1': Invalid argument
      |# mkdir strings/0x409
      |# mkdir strings/1033
      |mkdir: cannot create directory `strings/1033': File exists
      |# mkdir strings/1032
      |# mkdir configs/def.1/strings/0x409
      |# mkdir configs/def.2/strings/0x409
      
      |#find . -ls
      |   975    0 drwxr-xr-x   5 root     root            0 Dec 23 17:40 .
      |   978    0 drwxr-xr-x   4 root     root            0 Dec 23 17:43 ./strings
      |  4100    0 drwxr-xr-x   2 root     root            0 Dec 23 17:43 ./strings/1032
      |   995    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./strings/1032/serialnumber
      |   996    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./strings/1032/product
      |   997    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./strings/1032/manufacturer
      |  2002    0 drwxr-xr-x   2 root     root            0 Dec 23 17:41 ./strings/0x409
      |   998    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./strings/0x409/serialnumber
      |   999    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./strings/0x409/product
      |  1000    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./strings/0x409/manufacturer
      |   977    0 drwxr-xr-x   4 root     root            0 Dec 23 17:41 ./configs
      |  4081    0 drwxr-xr-x   3 root     root            0 Dec 23 17:41 ./configs/def.2
      |  4082    0 drwxr-xr-x   3 root     root            0 Dec 23 17:42 ./configs/def.2/strings
      |  2016    0 drwxr-xr-x   2 root     root            0 Dec 23 17:42 ./configs/def.2/strings/0x409
      |  1001    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./configs/def.2/strings/0x409/configuration
      |  1002    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./configs/def.2/bmAttributes
      |  1003    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./configs/def.2/MaxPower
      |   979    0 drwxr-xr-x   3 root     root            0 Dec 23 17:42 ./configs/def.1
      |   980    0 drwxr-xr-x   3 root     root            0 Dec 23 17:42 ./configs/def.1/strings
      |  5122    0 drwxr-xr-x   2 root     root            0 Dec 23 17:42 ./configs/def.1/strings/0x409
      |  1004    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./configs/def.1/strings/0x409/configuration
      |  1005    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./configs/def.1/bmAttributes
      |  1006    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./configs/def.1/MaxPower
      |   976    0 drwxr-xr-x   3 root     root            0 Dec 23 17:41 ./functions
      |   981    0 drwxr-xr-x   2 root     root            0 Dec 23 17:41 ./functions/acm.ttyS1
      |  1007    0 -r--r--r--   1 root     root         4096 Dec 23 17:43 ./functions/acm.ttyS1/port_num
      |  1008    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./UDC
      |  1009    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./bcdUSB
      |  1010    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./bcdDevice
      |  1011    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./idProduct
      |  1012    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./idVendor
      |  1013    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./bMaxPacketSize0
      |  1014    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./bDeviceProtocol
      |  1015    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./bDeviceSubClass
      |  1016    0 -rw-r--r--   1 root     root         4096 Dec 23 17:43 ./bDeviceClass
      
      |# cat functions/acm.ttyS1/port_num
      |0
      |# ls -lah /dev/ttyGS*
      |crw-rw---T 1 root dialout 252, 0 Dec 23 17:41 /dev/ttyGS0
      |
      |# echo 0x1234 > idProduct
      |# echo 0xabcd > idVendor
      |# echo 1122 > strings/0x409/serialnumber
      |# echo "The manufacturer" > strings/0x409/manufacturer
      |# echo 1 > strings/1032/manufacturer
      |# echo 1sa > strings/1032/product
      |# echo tada > strings/1032/serialnumber
      |echo "Primary configuration" > configs/def.1/strings/0x409/configuration
      |# echo "Secondary configuration" > configs/def.2/strings/0x409/configuration
      |# ln -s functions/acm.ttyS1 configs/def.1/
      |# ln -s functions/acm.ttyS1 configs/def.2/
      |find configs/def.1/ -ls
      |   979    0 drwxr-xr-x   3 root     root            0 Dec 23 17:49 configs/def.1/
      |  6264    0 lrwxrwxrwx   1 root     root            0 Dec 23 17:48 configs/def.1/acm.ttyS1 -> ../../../../usb_gadget/oha/functions/acm.ttyS1
      |   980    0 drwxr-xr-x   3 root     root            0 Dec 23 17:42 configs/def.1/strings
      |  5122    0 drwxr-xr-x   2 root     root            0 Dec 23 17:49 configs/def.1/strings/0x409
      |  6284    0 -rw-r--r--   1 root     root         4096 Dec 23 17:47 configs/def.1/strings/0x409/configuration
      |  6285    0 -rw-r--r--   1 root     root         4096 Dec 23 17:49 configs/def.1/bmAttributes
      |  6286    0 -rw-r--r--   1 root     root         4096 Dec 23 17:49 configs/def.1/MaxPower
      |
      |echo 120 > configs/def.1/MaxPower
      |
      |# ls -lh /sys/class/udc/
      |total 0
      |lrwxrwxrwx 1 root root 0 Dec 23 17:50 dummy_udc.0 -> ../../devices/platform/dummy_udc.0/udc/dummy_udc.0
      |lrwxrwxrwx 1 root root 0 Dec 23 17:50 dummy_udc.1 -> ../../devices/platform/dummy_udc.1/udc/dummy_udc.1
      |# echo dummy_udc.0 > UDC
      |# lsusb
      |Bus 001 Device 002: ID abcd:1234 Unknown
      |
      |lsusb -d abcd:1234 -v
      |Device Descriptor:
      …
      |  idVendor           0xabcd Unknown
      |  idProduct          0x1234
      |  bcdDevice            3.06
      |  iManufacturer           1 The manufacturer
      |  iProduct                2
      |  iSerial                 3 1122
      |  bNumConfigurations      2
      …
      |echo "" > UDC
      
      v5…v6
      - wired up strings with usb_gstrings_attach()
      - add UDC attribe. Write "udc-name" will bind the gadget. Write an empty
        string (it should contain \n since 0 bytes write get optimzed away)
        will unbind the UDC from the gadget. The name of available UDCs can be
        obtained from /sys/class/udc/
      
      v4…v5
      - string rework. This will add a strings folder incl. language code like
          strings/409/manufacturer
        as suggested by Alan.
      - rebased ontop reworked functions.c which has usb_function_instance
        which is used prior after "mkdir acm.instance" and can be directly
        used for configuration via configfs.
      
      v3…v4
       - moved functions from the root folde down to the gadget as suggested
         by Michał
       - configs have now their own configs folder as suggested by Michał.
         The folder is still name.bConfigurationValue where name becomes the
         sConfiguration. Is this usefull should we just stilc
         configs/bConfigurationValue/ ?
       - added configfs support to the ACM function. The port_num attribute is
         exported by f_acm. An argument has been added to the USB alloc
         function to distinguish between "old" (use facm_configure() to
         configure and configfs interface (expose a config_node).
         The port_num is currently a dumb counter. It will
         require some function re-work to make it work.
      
      scheduled for v5:
      - sym linking function into config.
      
      v2…v3
      - replaced one ifndef by ifdef as suggested by Micahał
      - strstr()/strchr() function_make as suggested by Micahł
      - replace [iSerialNumber|iProduct|iManufacturer] with
        [sSerialNumber|sProduct|sManufacturer] as suggested by Alan
      - added creation of config descriptors
      
      v1…v2
      - moved gadgets from configfs' root directory into /udcs/ within our
        "usb_gadget" folder. Requested by Andrzej & Michał
      - use a dot as a delimiter between function's name and its instance's name
        as suggested by Michał
      - renamed all config_item_type, configfs_group_operations, make_group,
        drop_item as suggested by suggested by Andrzej to remain consisten
        within this file and within other configfs users
      - Since configfs.c and functions.c are now part of the udc-core module,
        the module itself is now called udc. Also added a tiny ifdef around
        init code becuase udc-core is subsys init and this is too early for
        configfs in the built-in case. In the module case, we can only have
        one init function.
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      88af8bbe
  21. 04 3月, 2013 1 次提交