This project is mirrored from Pull mirroring updated .
  1. 07 Oct, 2013 2 commits
  2. 26 Sep, 2013 1 commit
    • Alan Stern's avatar
      ALSA: improve buffer size computations for USB PCM audio · 976b6c06
      Alan Stern authored
      This patch changes the way URBs are allocated and their sizes are
      determined for PCM playback in the snd-usb-audio driver.  Currently
      the driver allocates too few URBs for endpoints that don't use
      implicit sync, making underruns more likely to occur.  This may be a
      holdover from before I/O delays could be measured accurately; in any
      case, it is no longer necessary.
      The patch allocates as many URBs as possible, subject to four
      	The total number of URBs for the endpoint is not allowed to
      	exceed MAX_URBS (which the patch increases from 8 to 12).
      	The total number of packets per URB is not allowed to exceed
      	MAX_PACKS (or MAX_PACKS_HS for high-speed devices), which is
      	decreased from 20 to 6.
      	The total duration of queued data is not allowed to exceed
      	MAX_QUEUE, which is decreased from 24 ms to 18 ms.
      	The total number of ALSA frames in the output queue is not
      	allowed to exceed the ALSA buffer size.
      The last requirement is the hardest to implement.  Currently the
      number of URBs needed to fill a buffer cannot be determined in
      advance, because a buffer contains a fixed number of frames whereas
      the number of frames in an URB varies to match shifts in the device's
      clock rate.  To solve this problem, the patch changes the logic for
      deciding how many packets an URB should contain.  Rather than using as
      many as possible without exceeding an ALSA period boundary, now the
      driver uses only as many packets as needed to transfer a predetermined
      number of frames.  As a result, unless the device's clock has an
      exceedingly variable rate, the number of URBs making up each period
      (and hence each buffer) will remain constant.
      The overall effect of the patch is that playback works better in
      low-latency settings.  The user can still specify values for
      frames/period and periods/buffer that exceed the capabilities of the
      hardware, of course.  But for values that are within those
      capabilities, the performance will be improved.  For example, testing
      shows that a high-speed device can handle 32 frames/period and 3
      periods/buffer at 48 KHz, whereas the current driver starts to get
      glitchy at 64 frames/period and 2 periods/buffer.
      A side effect of these changes is that the "nrpacks" module parameter
      is no longer used.  The patch removes it.
      Signed-off-by: default avatarAlan Stern <>
      CC: Clemens Ladisch <>
      Tested-by: default avatarDaniel Mack <>
      Tested-by: default avatarEldad Zack <>
      Signed-off-by: default avatarTakashi Iwai <>
  3. 08 Aug, 2013 1 commit
  4. 06 Aug, 2013 1 commit
  5. 29 Apr, 2013 1 commit
  6. 18 Apr, 2013 1 commit
    • Daniel Mack's avatar
      ALSA: snd-usb: add support for DSD DOP stream transport · d24f5061
      Daniel Mack authored
      In order to provide a compatibility way for pushing DSD
      samples through ordinary PCM channels, the "DoP open Standard" was
      invented. See
       for the official document.
      The host is required to stuff DSD marker bytes (0x05, 0xfa,
      alternating) in the MSB of 24 bit wide samples on the bus, in addition
      to the 16 bits of actual DSD sample payload.
      To support this, the hardware and software stride logic in the driver
      has to be tweaked a bit, as we make the userspace believe we're
      operating on 16 bit samples, while we in fact push one more byte per
      channel down to the hardware.
      The DOP runtime information is stored in struct snd_usb_substream, so
      we can keep track of our state across multiple calls to
      Signed-off-by: default avatarDaniel Mack <>
      Signed-off-by: default avatarTakashi Iwai <>
  7. 04 Apr, 2013 2 commits
  8. 29 Nov, 2012 1 commit
    • Eldad Zack's avatar
      ALSA: usb-audio: use sender stride for implicit feedback · 28acb120
      Eldad Zack authored
      For implicit feedback endpoints, the number of bytes for each packet
      is matched by the corresponding synchronizing endpoint.
      The size is calculated by taking the actual size and dividing it by
      the stride - currently by the endpoint's stride, but we should use the
      synchronization source's stride.
      This is evident when the number of channels differ between the
      synchronization source and the implicitly fed-back endpoint, as with
      M-Audio Fast Track C400 - the synchronization source (capture)
      has 4 channels, while the implicit feedback mode endpoint has 6.
      Signed-off-by: default avatarEldad Zack <>
      Signed-off-by: default avatarTakashi Iwai <>
  9. 21 Nov, 2012 4 commits
  10. 17 Nov, 2012 1 commit
  11. 08 Nov, 2012 1 commit
  12. 27 Sep, 2012 1 commit
  13. 19 Sep, 2012 1 commit
  14. 04 Sep, 2012 1 commit
    • Daniel Mack's avatar
      ALSA: snd-usb: Add quirks for Playback Designs devices · 2b58fd5b
      Daniel Mack authored
      Playback Designs' USB devices have some hardware limitations on their
      USB interface. In particular:
       - They need a 20ms delay after each class compliant request as the
         hardware ACKs the USB packets before the device is actually ready
         for the next command. Sending data immediately will result in buffer
         overflows in the hardware.
       - The devices send bogus feedback data at the start of each stream
         which confuse the feedback format auto-detection.
      This patch introduces a new quirks hook that is called after each
      control packet and which adds a delay for all devices that match
      Playback Designs' USB VID for now.
      In addition, it adds a counter to snd_usb_endpoint to drop received
      packets on the floor. Another new quirks function that is called once
      an endpoint is started initializes that counter for these devices on
      their sync endpoint.
      Signed-off-by: default avatarDaniel Mack <>
      Reported-and-tested-by: default avatarAndreas Koch <>
      Supported-by: default avatarDemian Martin <>
      Signed-off-by: default avatarTakashi Iwai <>
  15. 31 Aug, 2012 1 commit
    • Daniel Mack's avatar
      ALSA: snd-usb: fix calls to next_packet_size · 245baf98
      Daniel Mack authored
      In order to support devices with implicit feedback streaming models,
      packet sizes are now stored with each individual urb, and the PCM
      handling code which fills the buffers purely relies on the size fields
      However, calling snd_usb_audio_next_packet_size() for all possible
      packets in an URB at once, prior to letting the PCM code do its job
      does in fact not lead to the same behaviour than what the old code did:
      The PCM code will break its loop once a period boundary is reached,
      consequently using up less packets that it really could.
      As snd_usb_audio_next_packet_size() implements a feedback mechanism to
      the endpoints phase accumulator, the number of calls to that function
      matters, and when called too often, the data rate runs out of bounds.
      Fix this by making the next_packet function public, and call it from the
      PCM code as before if the packet data sizes are not defined.
      Signed-off-by: default avatarDaniel Mack <>
      Cc: [v3.5+]
      Signed-off-by: default avatarTakashi Iwai <>
  16. 30 Aug, 2012 1 commit
    • Daniel Mack's avatar
      ALSA: snd-usb: Fix URB cancellation at stream start · 015618b9
      Daniel Mack authored
      Commit e9ba389c
       ("ALSA: usb-audio: Fix scheduling-while-atomic bug in
      PCM capture stream") fixed a scheduling-while-atomic bug that happened
      when snd_usb_endpoint_start was called from the trigger callback, which
      is an atmic context. However, the patch breaks the idea of the endpoints
      reference counting, which is the reason why the driver has been
      refactored lately.
      Revert that commit and let snd_usb_endpoint_start() take care of the URB
      cancellation again. As this function is called from both atomic and
      non-atomic context, add a flag to denote whether the function may sleep.
      Signed-off-by: default avatarDaniel Mack <>
      Cc: [3.5+]
      Signed-off-by: default avatarTakashi Iwai <>
  17. 16 Aug, 2012 1 commit
  18. 13 Jul, 2012 1 commit
  19. 24 Apr, 2012 2 commits
  20. 13 Apr, 2012 6 commits
  21. 09 Jan, 2012 1 commit
  22. 14 Sep, 2011 2 commits
  23. 04 Aug, 2011 1 commit
  24. 12 Jul, 2011 1 commit
  25. 03 Sep, 2010 1 commit
    • Clemens Ladisch's avatar
      ALSA: usb-audio: fix detection of vendor-specific device protocol settings · a2acad82
      Clemens Ladisch authored
      The Audio Class v2 support code in 2.6.35 added checks for the
      bInterfaceProtocol field.  However, there are devices (usually those
      detected by vendor-specific quirks) that do not have one of the
      predefined values in this field, which made the driver reject them.
      To fix this regression, restore the old behaviour, i.e., assume that
      a device with an unknown bInterfaceProtocol field (other than
      UAC_VERSION_2) has more or less UAC-v1-compatible descriptors.
      [compile warning fixes by tiwai]
      Signed-off-by: default avatarClemens Ladisch <>
      Cc: Daniel Mack <>
      Cc: <>
      Signed-off-by: default avatarTakashi Iwai <>
  26. 02 Sep, 2010 1 commit
  27. 23 Jun, 2010 2 commits