1. 02 9月, 2014 5 次提交
    • D
      usb: gadget: f_uac2: send reasonably sized packets · 9bb87f16
      Daniel Mack 提交于
      The UAC2 function driver currently responds to all packets at all times
      with wMaxPacketSize packets. That results in way too fast audio
      playback as the function driver (which is in fact supposed to define
      the audio stream pace) delivers as fast as it can.
      
      Fix this by sizing each packet correctly with the following steps:
      
       a) Set the packet's size by dividing the nominal data rate by the
          playback endpoint's interval.
      
       b) If there is a residual value from the calculation in a), add
          it to a accumulator to keep track of it across packets.
      
       c) If the accumulator has gathered at least the number of bytes
          that are needed for one sample frame, increase the packet size.
      
      This way, the packet size calculation will get rid of any kind of
      imprecision that would otherwise occur with a simple division over
      time.
      
      Some of the variables that are needed while processing each packet
      are pre-computed for performance reasons.
      Signed-off-by: NDaniel Mack <zonque@gmail.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      9bb87f16
    • D
      usb: gadget: f_uac2: handle partial dma area wrap · ec9e4313
      Daniel Mack 提交于
      With packet sizes other than 512, payloads in the packets may wrap
      around the ALSA dma buffer partially, which leads to memory corruption
      and audible clicks and pops in the audio stream at the moment, because
      there is no boundary check before the memcpy().
      
      In preparation to an implementation for smaller and dynamically sized
      packets, we have to address such cases, and copy the payload in two
      steps conditionally.
      
      The 'src' and 'dst' approach doesn't work here anymore, as different
      behavior is necessary in playback and capture cases. Thus, this patch
      open-codes the routine now.
      Signed-off-by: NDaniel Mack <zonque@gmail.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      ec9e4313
    • D
      usb: gadget: f_uac2: introduce agdev_to_uac2_opts · 254b3bf6
      Daniel Mack 提交于
      Add a simple container_of() wrapper to get a struct f_uac2_opts from a
      struct struct audio_dev. Use it in two places where it is currently
      open-coded.
      Signed-off-by: NDaniel Mack <zonque@gmail.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      254b3bf6
    • D
      usb: gadget: f_uac2: add short-hand for 'dev' · a8147dab
      Daniel Mack 提交于
      In afunc_bind() and afunc_set_alt(), &uac2->pdev.dev are used multiple
      times. Adding a short-hand for them makes lines shorter so we can
      remove some line wraps.
      
      No functional change.
      Signed-off-by: NDaniel Mack <zonque@gmail.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      a8147dab
    • D
      usb: gadget: f_uac2: restructure some code in afunc_set_alt() · 430fdbd3
      Daniel Mack 提交于
      Restructure some code to make it easier to read.
      
      While at it, return -ENOMEM instead of -EINVAL if
      usb_ep_alloc_request() fails, and omit the logging in such cases
      (the mm core will complain loud enough).
      Signed-off-by: NDaniel Mack <zonque@gmail.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      430fdbd3
  2. 21 8月, 2014 5 次提交
  3. 17 7月, 2014 2 次提交
  4. 15 5月, 2014 1 次提交
    • A
      usb: gadget: f_uac2: don't queue new requests when shutting down · 1ade5d7e
      Andrzej Pietrasiewicz 提交于
      In some circumstances when g_audio is being unloaded there happens
      an endless loop in udc driver. It has happend on a board with
      s3c-hsotg. If there are requests in endpoint's queue, they are completed
      in a loop. But completing them might cause appending new requests
      to the queue. This patch causes agdev_iso_complete() to return immediately
      if request's status is -ESHUTDOWN. If it does not return immediately,
      then although the current request is removed from the queue, a new one
      is appended to the queue, so the above mentioned loop cannot end.
      Signed-off-by: NAndrzej Pietrasiewicz <andrzej.p@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      1ade5d7e
  5. 14 5月, 2014 1 次提交
  6. 14 2月, 2014 1 次提交
  7. 10 6月, 2013 1 次提交
  8. 15 5月, 2013 1 次提交
  9. 22 1月, 2013 1 次提交
  10. 10 1月, 2013 1 次提交
  11. 22 11月, 2012 1 次提交
  12. 31 10月, 2012 6 次提交
  13. 10 9月, 2012 1 次提交
    • S
      usb: gadget: remove __devexit in f_uac2 · 1e1a27c3
      Sebastian Andrzej Siewior 提交于
      avoids the following section missmatch
      |WARNING: drivers/usb/gadget/g_audio.o(.init.text+0x2e7): Section
      |mismatch in reference from the function afunc_bind() to the function
      |.devexit.text:snd_uac2_remove()
      |The function __init afunc_bind() references
      |a function __devexit snd_uac2_remove().
      |This is often seen when error handling in the init function
      |uses functionality in the exit path.
      |The fix is often to remove the __devexit annotation of
      |snd_uac2_remove() so it may be used outside an exit section.
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      1e1a27c3
  14. 15 2月, 2012 1 次提交
    • J
      usb: gadget: Add Audio Class 2.0 Driver · 132fcb46
      Jassi Brar 提交于
      This is a flexible USB Audio Class 2.0 compliant gadget driver that
      implements a simple topology with a virtual sound card exposed at
      the function side.
      
      The driver doesn't expect any real audio codec to be present on the
      function - the audio streams are simply sinked to and sourced from a
      virtual ALSA sound card created. The user-space application 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.
      
      Capture(USB-Out) and Playback(USB-In) can be run at independent
      configurations specified via module parameters while loading the driver.
      
      Make this new version as the default selection by a new Kconfig choice.
      Signed-off-by: NYadi Brar <yadi.brar01@gmail.com>
      Signed-off-by: NJassi Brar <jaswinder.singh@linaro.org>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      132fcb46