1. 06 Aug, 2013 1 commit
  2. 27 Jun, 2013 2 commits
  3. 29 Apr, 2013 1 commit
  4. 18 Apr, 2013 3 commits
    • Daniel Mack's avatar
      ALSA: snd-usb: add support for bit-reversed byte formats · 44dcbbb1
      Daniel Mack authored
      There is quite some confusion around the bit-ordering in DSD samples,
      and no general agreement that defines whether hardware is supposed to
      expect the oldest sample in the MSB or the LSB of a byte.
      
      ALSA will hence set the rule that on the software API layer, bytes
      always carry the oldest bit in the most significant bit of a byte, and
      the driver has to translate that at runtime in order to match the
      hardware layout.
      
      This patch adds support for this by adding a boolean flag to the
      audio format struct.
      Signed-off-by: default avatarDaniel Mack <zonque@gmail.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      44dcbbb1
    • 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 http://www.dsd-guide.com 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
      prepare_playback_urb_dsd_dop().
      Signed-off-by: default avatarDaniel Mack <zonque@gmail.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      d24f5061
    • Daniel Mack's avatar
      ALSA: snd-usb: use ep->stride from urb callbacks · 8a2a74d2
      Daniel Mack authored
      For normal PCM transfer, this change has no effect, as the endpoint's
      stride is always frame_bits/8. For DSD DOP streams, however, which is
      added later, the hardware stride differs from the software stride, and
      the endpoint has the correct information in these cases.
      Signed-off-by: default avatarDaniel Mack <zonque@gmail.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      8a2a74d2
  5. 13 Apr, 2013 1 commit
    • Calvin Owens's avatar
      ALSA: usb: Add quirk for 192KHz recording on E-Mu devices · 1539d4f8
      Calvin Owens authored
      When recording at 176.2KHz or 192Khz, the device adds a 32-bit length
      header to the capture packets, which obviously needs to be ignored for
      recording to work properly.
      
      Userspace expected:  L0 L1 L2 R0 R1 R2
      ...but actually got: R2 L0 L1 L2 R0 R1
      
      Also, the last byte of the length header being interpreted as L0 of
      the first sample caused spikes every 0.5ms, resulting in a loud 16KHz
      tone (about the highest 'B' on a piano) being present throughout
      captures.
      
      Tested at all sample rates on an E-Mu 0404USB, and tested for
      regressions on a generic USB headset.
      Signed-off-by: default avatarCalvin Owens <jcalvinowens@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      1539d4f8
  6. 10 Apr, 2013 1 commit
  7. 04 Apr, 2013 2 commits
  8. 18 Mar, 2013 1 commit
  9. 11 Feb, 2013 1 commit
  10. 25 Jan, 2013 1 commit
    • Takashi Iwai's avatar
      ALSA: Make snd_printd() and snd_printdd() inline · 86b27237
      Takashi Iwai authored
      Because currently snd_printd() and snd_printdd() macros are expanded
      to empty when CONFIG_SND_DEBUG=n, a compile warning like below
      appears sometimes, and we had to covert it by ugly ifdefs:
        sound/pci/hda/patch_sigmatel.c: In function ‘stac92hd71bxx_fixup_hp’:
        sound/pci/hda/patch_sigmatel.c:2434:24: warning: unused variable ‘spec’ [-Wunused-variable]
      
      For "fixing" these issues better, this patch replaces snd_printd() and
      snd_printdd() definitions with empty inline functions instead of
      macros.  This should have the same effect but shut up warnings like
      above.
      
      But since we had already put ifdefs, changing to inline functions
      would trigger compile errors.  So, such ifdefs is removed in this
      patch.
      
      In addition, snd_pci_quirk name field is defined only when
      CONFIG_SND_DEBUG_VERBOSE is set, and the reference to it in
      snd_printdd() argument triggers the build errors, too.  For avoiding
      these errors, introduce a new macro snd_pci_quirk_name() that is
      defined no matter how the debug option is set.
      Reported-by: default avatarStratos Karafotis <stratosk@semaphore.gr>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      86b27237
  11. 11 Jan, 2013 1 commit
  12. 24 Dec, 2012 1 commit
  13. 04 Dec, 2012 1 commit
    • Eldad Zack's avatar
      ALSA: usb-audio: sync ep init fix for audioformat mismatch · 0d9741c0
      Eldad Zack authored
      Commit 947d2996 , "ALSA: snd-usb:
      properly initialize the sync endpoint", while correcting the
      initialization of the sync endpoint when opening just the data
      endpoint, prevents devices that has a sync endpoint, with a channel
      number different than that of the data endpoint, from functioning.
      Due to a different channel and period bytes count, attempting to
      initialize the sync endpoint will fail at the usb host driver.
      For example, when using xhci:
      
       cannot submit urb 0, error -90: internal error
      
      With this patch, if a sync endpoint has multiple audioformats, a
      matching audioformat is preferred. An audioformat must be found
      with at least one channel and support the requested sample rate
      and PCM format, otherwise the stream will not be opened.
      
      If the number of channels differ between the selected audioformat
      and the requested format, adjust the period bytes count accordingly.
      It is safe to perform the calculation on the basis of the channel
      count, since the requested PCM audio format and the rate must be
      supported by the selected audioformat.
      
      Cc: Jeffrey Barish <jeff_barish@earthlink.net>
      Cc: Daniel Mack <zonque@gmail.com>
      Signed-off-by: default avatarEldad Zack <eldad@fogrefinery.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      0d9741c0
  14. 29 Nov, 2012 2 commits
  15. 23 Nov, 2012 2 commits
    • Takashi Iwai's avatar
      ALSA: usb-audio: fix delay account during pause · 48779a0b
      Takashi Iwai authored
      When a playback stream is paused, the stream isn't actually stopped,
      thus we still need to take care of the in-flight data amount for the
      delay calculation.  Otherwise the value of subs->last_delay is no
      longer reliable and can give a bogus value after resuming from pause.
      This will result in "delay: estimated XX, actual YY" error messages.
      
      Also, during pause after all in flight data are processed
      (i.e. last_delay = 0), we don't have to calculate the actual delay
      from the current frame.  Give a short path in such a case.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      48779a0b
    • Takashi Iwai's avatar
      ALSA: usb-audio: ignore delay calculation for capture stream · 3f94fad0
      Takashi Iwai authored
      It doesn't make sense to calculate the delay for capture streams in
      the current implementation.  It's always zero, so we should skip the
      computation in snd_usb_pcm_pointer() in the case of capture.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      3f94fad0
  16. 22 Nov, 2012 1 commit
  17. 21 Nov, 2012 3 commits
  18. 08 Nov, 2012 1 commit
  19. 30 Oct, 2012 2 commits
    • Takashi Iwai's avatar
      ALSA: usb-audio: Use rwsem for disconnect protection · 34f3c89f
      Takashi Iwai authored
      Replace mutex with rwsem for codec->shutdown protection so that
      concurrent accesses are allowed.
      
      Also add the protection to snd_usb_autosuspend() and
      snd_usb_autoresume(), too.
      Reported-by: default avatarMatthieu CASTET <matthieu.castet@parrot.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      34f3c89f
    • Takashi Iwai's avatar
      ALSA: usb-audio: Fix races at disconnection · 978520b7
      Takashi Iwai authored
      Close some races at disconnection of a USB audio device by adding the
      chip->shutdown_mutex and chip->shutdown check at appropriate places.
      
      The spots to put bandaids are:
      - PCM prepare, hw_params and hw_free
      - where the usb device is accessed for communication or get speed, in
       mixer.c and others; the device speed is now cached in subs->speed
       instead of accessing to chip->dev
      
      The accesses in PCM open and close don't need the mutex protection
      because these are already handled in the core PCM disconnection code.
      
      The autosuspend/autoresume codes are still uncovered by this patch
      because of possible mutex deadlocks.  They'll be covered by the
      upcoming change to rwsem.
      
      Also the mixer codes are untouched, too.  These will be fixed in
      another patch, too.
      Reported-by: default avatarMatthieu CASTET <matthieu.castet@parrot.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      978520b7
  20. 21 Oct, 2012 1 commit
  21. 19 Sep, 2012 4 commits
  22. 06 Sep, 2012 1 commit
    • Takashi Iwai's avatar
      ALSA: usb-audio: Fix bogus error messages for delay accounting · 1213a205
      Takashi Iwai authored
      The recent fix for the missing fine delayed time adjustment gives
      strange error messages at each start of the playback stream, such as
        delay: estimated 0, actual 352
        delay: estimated 353, actual 705
      
      These come from the sanity check in retire_playback_urb().  Before the
      stream is activated via start_endpoints(), a few silent packets have
      been already sent.  And at this point the delay account is still in
      the state as if the new packets are just queued, so the driver gets
      confused and spews the bogus error messages.
      
      For fixing the issue, we just need to check whether the received
      packet is valid, whether it's zero sized or not.
      Reported-by: default avatarMarkus Trippelsdorf <markus@trippelsdorf.de>
      Cc: <stable@vger.kernel.org> [v3.5+]
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      1213a205
  23. 31 Aug, 2012 3 commits
    • Daniel Mack's avatar
      ALSA: snd-usb: fix cross-interface streaming devices · 2e4a263c
      Daniel Mack authored
      Commit 68e67f40 ("ALSA: snd-usb: move calls to usb_set_interface")
      saved us some unnecessary calls to snd_usb_set_interface() but ignored
      the fact that there is at least one device out there which operates on
      two endpoint in different interfaces simultaniously.
      
      Take care for this by catching the case where data and sync endpoints
      are located on different interfaces and calling snd_usb_set_interface()
      between the start of the two endpoints.
      Signed-off-by: default avatarDaniel Mack <zonque@gmail.com>
      Reported-by: default avatarRobert M. Albrecht <linux@romal.de>
      Cc: stable@kernel.org [v3.5+]
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      2e4a263c
    • 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
      now.
      
      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 <zonque@gmail.com>
      Cc: stable@kernel.org [v3.5+]
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      245baf98
    • Daniel Mack's avatar
      ALSA: snd-usb: restore delay information · fbcfbf5f
      Daniel Mack authored
      Parts of commit 294c4fb8 ("ALSA: usb: refine delay information with USB
      frame counter") were unfortunately lost during the refactoring of the
      snd-usb driver in 3.5.
      
      This patch adds them back, restoring the correct delay information
      behaviour.
      Signed-off-by: default avatarDaniel Mack <zonque@gmail.com>
      Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
      Cc: stable@kernel.org [3.5+]
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      fbcfbf5f
  24. 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 <zonque@gmail.com>
      Cc: stable@kernel.org [3.5+]
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      015618b9
  25. 16 Aug, 2012 1 commit
  26. 13 Jul, 2012 1 commit