1. 03 2月, 2014 1 次提交
  2. 09 10月, 2013 1 次提交
  3. 07 10月, 2013 1 次提交
  4. 26 9月, 2013 1 次提交
    • A
      ALSA: improve buffer size computations for USB PCM audio · 976b6c06
      Alan Stern 提交于
      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
      limitations:
      
      	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: NAlan Stern <stern@rowland.harvard.edu>
      CC: Clemens Ladisch <clemens@ladisch.de>
      Tested-by: NDaniel Mack <zonque@gmail.com>
      Tested-by: NEldad Zack <eldad@fogrefinery.com>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      976b6c06
  5. 17 6月, 2013 1 次提交
  6. 25 4月, 2013 1 次提交
    • T
      ALSA: usb-audio: Fix autopm error during probing · 60af3d03
      Takashi Iwai 提交于
      We've got strange errors in get_ctl_value() in mixer.c during
      probing, e.g. on Hercules RMX2 DJ Controller:
      
        ALSA mixer.c:352 cannot get ctl value: req = 0x83, wValue = 0x201, wIndex = 0xa00, type = 4
        ALSA mixer.c:352 cannot get ctl value: req = 0x83, wValue = 0x200, wIndex = 0xa00, type = 4
        ....
      
      It turned out that the culprit is autopm: snd_usb_autoresume() returns
      -ENODEV when called during card->probing = 1.
      
      Since the call itself during card->probing = 1 is valid, let's fix the
      return value of snd_usb_autoresume() as success.
      Reported-and-tested-by: NDaniel Schürmann <daschuer@mixxx.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      60af3d03
  7. 04 4月, 2013 3 次提交
  8. 12 3月, 2013 1 次提交
  9. 29 1月, 2013 1 次提交
  10. 21 11月, 2012 1 次提交
  11. 14 11月, 2012 1 次提交
    • T
      ALSA: usb-audio: Fix mutex deadlock at disconnection · 10e44239
      Takashi Iwai 提交于
      The recent change for USB-audio disconnection race fixes introduced a
      mutex deadlock again.  There is a circular dependency between
      chip->shutdown_rwsem and pcm->open_mutex, depicted like below, when a
      device is opened during the disconnection operation:
      
      A. snd_usb_audio_disconnect() ->
           card.c::register_mutex ->
             chip->shutdown_rwsem (write) ->
               snd_card_disconnect() ->
                 pcm.c::register_mutex ->
                   pcm->open_mutex
      
      B. snd_pcm_open() ->
           pcm->open_mutex ->
             snd_usb_pcm_open() ->
               chip->shutdown_rwsem (read)
      
      Since the chip->shutdown_rwsem protection in the case A is required
      only for turning on the chip->shutdown flag and it doesn't have to be
      taken for the whole operation, we can reduce its window in
      snd_usb_audio_disconnect().
      Reported-by: NJiri Slaby <jslaby@suse.cz>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      10e44239
  12. 30 10月, 2012 1 次提交
  13. 19 9月, 2012 1 次提交
    • T
      ALSA: usb-audio: Avoid unnecessary EP setups in prepare · 384dc085
      Takashi Iwai 提交于
      The recent fix for USB suspend breakage moved the code to set up EP
      from hw_params to prepare, but it means also the EP setup might be
      called multiple times unnecessarily because the prepare callback can
      be called multiple times without starting the stream (e.g. OSS
      emulation).
      
      This patch adds a new flag to struct snd_usb_substream indicating
      whether the setup of EP is required, and do it only when necessary,
      i.e. right after hw_params or suspend.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      384dc085
  14. 01 9月, 2012 1 次提交
  15. 13 4月, 2012 2 次提交
  16. 19 12月, 2011 1 次提交
  17. 01 11月, 2011 1 次提交
  18. 26 9月, 2011 1 次提交
  19. 23 9月, 2011 1 次提交
    • T
      ALSA: usb-audio - clear chip->probing on error exit · 362e4e49
      Thomas Pfaff 提交于
      The Terratec Aureon 5.1 USB sound card support is broken since kernel
      2.6.39.
      2.6.39 introduced power management support for USB sound cards that added
      a probing flag in struct snd_usb_audio.
      
      During the probe of the card it gives following error message :
      
      usb 7-2: new full speed USB device number 2 using uhci_hcd
      cannot find UAC_HEADER
      snd-usb-audio: probe of 7-2:1.3 failed with error -5
      input: USB Audio as
      /devices/pci0000:00/0000:00:1d.1/usb7/7-2/7-2:1.3/input/input6
      generic-usb 0003:0CCD:0028.0001: input: USB HID v1.00 Device [USB Audio]
      on usb-0000:00:1d.1-2/input3
      
      I can not comment about that "cannot find UAC_HEADER" error, but until
      2.6.38 the card worked anyway.
      With 2.6.39 chip->probing remains 1 on error exit, and any later ioctl
      stops in snd_usb_autoresume with -ENODEV.
      Signed-off-by: NThomas Pfaff <tpfaff@gmx.net>
      Cc: <stable@kernel.org> [2.6.39+]
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      362e4e49
  20. 14 9月, 2011 2 次提交
  21. 20 8月, 2011 1 次提交
  22. 08 7月, 2011 1 次提交
  23. 25 5月, 2011 2 次提交
  24. 21 3月, 2011 1 次提交
  25. 11 3月, 2011 2 次提交
  26. 23 2月, 2011 1 次提交
    • T
      ALSA: usb-audio: fix oops due to cleanup race when disconnecting · 382225e6
      Takashi Iwai 提交于
      When a USB audio device is disconnected, snd_usb_audio_disconnect()
      kills all audio URBs.  At the same time, the application, after being
      notified of the disconnection, might close the device, in which case
      ALSA calls the .hw_free callback, which should free the URBs too.
      
      Commit de1b8b93 "[ALSA] Fix hang-up at disconnection of usb-audio"
      prevented snd_usb_hw_free() from freeing the URBs to avoid a hang that
      resulted from this race, but this introduced another race because the
      URB callbacks could now be executed after snd_usb_hw_free() has
      returned, and try to access already freed data.
      
      Fix the first race by introducing a mutex to serialize the disconnect
      callback and all PCM callbacks that manage URBs (hw_free and hw_params).
      Reported-and-tested-by: NPierre-Louis Bossart <pierre-louis.bossart@intel.com>
      Cc: <stable@kernel.org>
      [CL: also serialize hw_params callback]
      Signed-off-by: NClemens Ladisch <clemens@ladisch.de>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      382225e6
  27. 08 9月, 2010 1 次提交
  28. 04 9月, 2010 1 次提交
    • C
      ALSA: usb-audio: fix detection of vendor-specific device protocol settings · a2acad82
      Clemens Ladisch 提交于
      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: NClemens Ladisch <clemens@ladisch.de>
      Cc: Daniel Mack <daniel@caiaq.de>
      Cc: <stable@kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      a2acad82
  29. 02 9月, 2010 1 次提交
    • D
      ALSA: usb-audio: Assume first control interface is for audio · 7b6717e1
      Daniel Mack 提交于
      For devices with more than one control interface, let's assume the first
      one contains the audio controls. Unfortunately, there is no field in any
      of the descriptors to tell us whether a control interface is for audio
      or MIDI controls, so a better check is not easy to implement.
      
      On a composite device with audio and MIDI functions, for example, the
      code currently overwrites chip->ctrl_intf, causing operations on the
      control interface to fail if they are issued after the device probe.
      Signed-off-by: NDaniel Mack <daniel@caiaq.de>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      7b6717e1
  30. 14 8月, 2010 1 次提交
    • P
      ALSA: usb: USB3 SuperSpeed sound support · 4f4e8f69
      Paul Zimmerman 提交于
      This is V2 of the patch, after feedback from Clemens and Daniel.
      
      This patch adds SuperSpeed support to the USB drivers under sound/. It adds
      tests for USB_SPEED_SUPER to the appropriate places that check for the USB
      speed.
      
      This patch has been tested with our SS USB3 device emulating a set of Yamaha
      speakers and a Logitech microphone, but with the descriptors modified to add
      USB3 support. It has also been tested with the real speakers and microphone,
      to make sure that USB2 devices still work.
      Signed-off-by: NPaul Zimmerman <paulz@synopsys.com>
      Cc: Clemens Ladisch <clemens@ladisch.de>
      Cc: Daniel Mack <daniel@caiaq.de>
      Cc: Greg Kroah-Hartman <gregkh@suse.de>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      4f4e8f69
  31. 23 6月, 2010 1 次提交
  32. 01 6月, 2010 1 次提交
    • D
      ALSA: usb-audio: parse clock topology of UAC2 devices · 79f920fb
      Daniel Mack 提交于
      Audio devices which comply to the UAC2 standard can export complex clock
      topologies in its descriptors and set up links between them.
      
      The entities that are defined are
      
       - clock sources, which define the end-leafs.
       - clock selectors, which act as switch to select one out of many
         possible clocks sources.
       - clock multipliers, which have an input clock source, and act as clock
         source again. They can be used to derive one clock from another.
      
      All sample rate changes, clock validity queries and the like must go to
      clock source elements, while clock selectors and multipliers can be used
      as terminal clock source.
      
      The following patch adds a parser for these elements and functions to
      iterate over the tree and find the leaf nodes (clock sources).
      
      The samplerate set functions were moved to the new clock.c file.
      Signed-off-by: NDaniel Mack <daniel@caiaq.de>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      79f920fb
  33. 23 3月, 2010 1 次提交
  34. 12 3月, 2010 1 次提交