Skip to content
Snippets Groups Projects
  1. May 14, 2021
  2. Mar 17, 2021
    • Kai-Heng Feng's avatar
      ALSA: usb-audio: Disable USB autosuspend properly in setup_disable_autosuspend() · e4493974
      Kai-Heng Feng authored
      
      commit 97991108 upstream.
      
      Rear audio on Lenovo ThinkStation P620 stops working after commit
      1965c436 ("ALSA: usb-audio: Disable autosuspend for Lenovo
      ThinkStation P620"):
      [    6.013526] usbcore: registered new interface driver snd-usb-audio
      [    6.023064] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
      [    6.023083] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
      [    6.023090] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
      [    6.023098] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
      [    6.023103] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
      [    6.023110] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
      [    6.045846] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
      [    6.045866] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
      [    6.045877] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
      [    6.045886] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
      [    6.045894] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x0, type = 1
      [    6.045908] usb 3-6: cannot get ctl value: req = 0x81, wValue = 0x202, wIndex = 0x0, type = 4
      
      I overlooked the issue because when I was working on the said commit,
      only the front audio is tested. Apology for that.
      
      Changing supports_autosuspend in driver is too late for disabling
      autosuspend, because it was already used by USB probe routine, so it can
      break the balance on the following code that depends on
      supports_autosuspend.
      
      Fix it by using usb_disable_autosuspend() helper, and balance the
      suspend count in disconnect callback.
      
      Fixes: 1965c436 ("ALSA: usb-audio: Disable autosuspend for Lenovo ThinkStation P620")
      Signed-off-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20210304043419.287191-1-kai.heng.feng@canonical.com
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e4493974
  3. Aug 23, 2020
  4. Aug 20, 2020
    • Takashi Iwai's avatar
      ALSA: usb-audio: Move device rename and profile quirks to an internal table · 5436f59b
      Takashi Iwai authored
      So far we've added the devices that need vendor/product string renames
      or the profile setup into the standard quirk table in quirks-table.h.
      This table is imported into the primary USB audio device entry, hence
      it's all exported for the probing so that udev and co can take a look
      at it.  OTOH, for renaming or profile setup, we don't need to expose
      those explicit entries because the probe itself follows the standard
      way.  That said, we're exposing unnecessarily too many entries.
      
      This patch moves such internal quirk entries into the own table, and
      reduces the exported device table size.  Along with the moving items,
      re-arrange the entries in the proper order.
      
      Link: https://lore.kernel.org/r/20200817082140.20232-2-tiwai@suse.de
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      5436f59b
  5. Jun 08, 2020
  6. Jun 04, 2020
    • Takashi Iwai's avatar
      ALSA: usb-audio: Fix inconsistent card PM state after resume · 862b2509
      Takashi Iwai authored
      
      When a USB-audio interface gets runtime-suspended via auto-pm feature,
      the driver suspends all functionality and increment
      chip->num_suspended_intf.  Later on, when the system gets suspended to
      S3, the driver increments chip->num_suspended_intf again, skips the
      device changes, and sets the card power state to
      SNDRV_CTL_POWER_D3hot.  In return, when the system gets resumed from
      S3, the resume callback decrements chip->num_suspended_intf.  Since
      this refcount is still not zero (it's been runtime-suspended), the
      whole resume is skipped.  But there is a small pitfall here.
      
      The problem is that the driver doesn't restore the card power state
      after this resume call, leaving it as SNDRV_CTL_POWER_D3hot.  So,
      even after the system resume finishes, the card instance still appears
      as if it were system-suspended, and this confuses many ioctl accesses
      that are blocked unexpectedly.
      
      In details, we have two issues behind the scene: one is that the card
      power state is changed only when the refcount becomes zero, and
      another is that the prior auto-suspend check is kept in a boolean
      flag.  Although the latter problem is almost negligible since the
      auto-pm feature is imposed only on the primary interface, but this can
      be a potential problem on the devices with multiple interfaces.
      
      This patch addresses those issues by the following:
      
      - Replace chip->autosuspended boolean flag with chip->system_suspend
        counter
      
      - At the first system-suspend, chip->num_suspended_intf is recorded to
        chip->system_suspend
      
      - At system-resume, the card power state is restored when the
        chip->num_suspended_intf refcount reaches to chip->system_suspend,
        i.e. the state returns to the auto-suspended
      
      Also, the patch fixes yet another hidden problem by the code
      refactoring along with the fixes above: namely, when some resume
      procedure failed, the driver left chip->num_suspended_intf that was
      already decreased, and it might lead to the refcount unbalance.
      In the new code, the refcount decrement is done after the whole resume
      procedure, and the problem is avoided as well.
      
      Fixes: 0662292a ("ALSA: usb-audio: Handle normal and auto-suspend equally")
      Reported-and-tested-by: default avatarMacpaul Lin <macpaul.lin@mediatek.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20200603153709.6293-1-tiwai@suse.de
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      862b2509
  7. Mar 26, 2020
    • Takashi Iwai's avatar
      ALSA: usb-audio: Inform devices that need delayed registration · a4aad563
      Takashi Iwai authored
      The USB-audio driver may call snd_card_register() multiple times as
      its probe function is per USB interface while some USB-audio devices
      may provide multiple interfaces to assign different streams although
      they belong to the same device.  This works in most cases but the
      registration is racy, hence it may miss the device recognition,
      e.g. PA doesn't see certain devices when hotplugged.
      
      The recent addition of the delayed registration quirk allows to sync
      the registration at the last known interface, and the previous commit
      added a new module option to allow the dynamic setup for that
      purpose.
      
      Now, this patch tries to find out and notifies for such devices that
      require the delayed registration.  It shows a message like:
      
        Found post-registration device assignment: 1234abcd:02
      
      If you hit this message, you can pass delayed_register module option
      like:
      
        snd_usb_audio.delayed_register=1234abcd:02
      
      by just copying the last shown entry.  If this works, it can be added
      statically in the quirk list, registration_quirks[] found at the end
      of sound/usb/quirks.c.
      
      Link: https://lore.kernel.org/r/20200325103322.2508-4-tiwai@suse.de
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      a4aad563
  8. Dec 18, 2019
    • Hui Wang's avatar
      ALSA: usb-audio: set the interface format after resume on Dell WD19 · 92adc96f
      Hui Wang authored
      
      Recently we found the headset-mic on the Dell Dock WD19 doesn't work
      anymore after s3 (s2i or deep), this problem could be workarounded by
      closing (pcm_close) the app and then reopening (pcm_open) the app, so
      this bug is not easy to be detected by users.
      
      When problem happens, retire_capture_urb() could still be called
      periodically, but the size of captured data is always 0, it could be
      a firmware bug on the dock. Anyway I found after resuming, the
      snd_usb_pcm_prepare() will be called, and if we forcibly run
      set_format() to set the interface and its endpoint, the capture
      size will be normal again. This problem and workaound also apply to
      playback.
      
      To fix it in the kernel, add a quirk to let set_format() run
      forcibly once after resume.
      
      Signed-off-by: default avatarHui Wang <hui.wang@canonical.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20191218132650.6303-1-hui.wang@canonical.com
      
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      92adc96f
  9. Nov 14, 2019
  10. May 30, 2019
  11. Apr 22, 2019
    • Shuah Khan's avatar
      media: sound/usb: Use Media Controller API to share media resources · 66354f18
      Shuah Khan authored
      
      Media Device Allocator API to allows multiple drivers share a media device.
      This API solves a very common use-case for media devices where one physical
      device (an USB stick) provides both audio and video. When such media device
      exposes a standard USB Audio class, a proprietary Video class, two or more
      independent drivers will share a single physical USB bridge. In such cases,
      it is necessary to coordinate access to the shared resource.
      
      Using this API, drivers can allocate a media device with the shared struct
      device as the key. Once the media device is allocated by a driver, other
      drivers can get a reference to it. The media device is released when all
      the references are released.
      
      Change the ALSA driver to use the Media Controller API to share media
      resources with DVB, and V4L2 drivers on a AU0828 media device.
      
      The Media Controller specific initialization is done after sound card is
      registered. ALSA creates Media interface and entity function graph nodes
      for Control, Mixer, PCM Playback, and PCM Capture devices.
      
      snd_usb_hw_params() will call Media Controller enable source handler
      interface to request the media resource. If resource request is granted,
      it will release it from snd_usb_hw_free(). If resource is busy, -EBUSY is
      returned.
      
      Media specific cleanup is done in usb_audio_disconnect().
      
      Reviewed-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarShuah Khan <shuah@kernel.org>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      66354f18
  12. May 29, 2018
    • Takashi Iwai's avatar
      ALSA: usb-audio: Allow non-vmalloc buffer for PCM buffers · f274baa4
      Takashi Iwai authored
      
      Currently, USB-audio driver allocates the PCM buffer via vmalloc(), as
      this serves merely as an intermediate buffer that is copied to each
      URB transfer buffer.  This works well in general on x86, but on some
      archs this may result in cache coherency issues when mmap is used.
      OTOH, it works also on such arch unless mmap is used.
      
      This patch is a step for mitigating the inconvenience; a new module
      option "use_vmalloc" is provided so that user can choose to allocate
      the DMA coherent buffer instead of the existing vmalloc buffer.
      The drawback is that it'd be the standard dma_alloc_coherent() calls
      and the system would require contiguous pages on non-x86 archs.
      
      Note that it's a global option and not dynamically switchable since
      the buffer is pre-allocated at the probe time.  In theory, it's
      possible to be switchable, but it'd be trickier and racier.
      
      As default use_vmalloc option is set to true, so that the old behavior
      is kept.  For allowing the coherent mmap on ARM or MIPS, pass
      use_vmalloc=0 option explicitly.
      
      Reported-and-tested-by: default avatarDaniel Danzberger <daniel@dd-wrt.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      f274baa4
  13. May 13, 2018
    • Ruslan Bilovol's avatar
      ALSA: usb: add UAC3 BADD profiles support · 17156f23
      Ruslan Bilovol authored
      
      Recently released USB Audio Class 3.0 specification
      contains BADD (Basic Audio Device Definition) document
      which describes pre-defined UAC3 configurations.
      
      BADD support is mandatory for UAC3 devices, it should be
      implemented as a separate USB device configuration.
      As per BADD document, class-specific descriptors
      shall not be included in the Device’s Configuration
      descriptor ("inferred"), but host can guess them
      from BADD profile number, number of endpoints and
      their max packed sizes.
      
      This patch adds support of all BADD profiles from the spec
      
      Signed-off-by: default avatarRuslan Bilovol <ruslan.bilovol@gmail.com>
      Tested-by: default avatarJorge Sanjuan <jorge.sanjuan@codethink.co.uk>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      17156f23
  14. May 02, 2018
    • Takashi Iwai's avatar
      ALSA: usb-audio: Allow to override the longname string · 07eca5fc
      Takashi Iwai authored
      
      Historically USB-audio driver sets the card's longname field with the
      details of the device and the bus information.  It's good per se, but
      not preferable when it's referred as the identifier for UCM profile.
      
      This patch adds a quirk profile_name field to override the card's
      longname string to a pre-defined one, so that one can create a unique
      and consistent ID string for the specific USB device via a quirk table
      to be used as a UCM profile name.
      
      The patch does a slight code refactoring to split out the functions to
      set shortname and longname fields as well.
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      07eca5fc
    • Takashi Iwai's avatar
      ALSA: usb-audio: Add keep_iface flag · 8a463225
      Takashi Iwai authored
      
      Introduce a new flag to struct snd_usb_audio for allowing the device
      to skip usb_set_interface() calls at changing or closing the stream.
      As of this patch, the flag is nowhere set, so it's just a place
      holder.  The dynamic switching will be added in the following patch.
      
      A background information for this change:
      
      Dell WD15 dock with Realtek chip gives a very long pause at each time
      the driver changes the altset, which eventually happens at every PCM
      stream open/close and parameter change.  As the long pause happens in
      each usb_set_interface() call, there is nothing we can do as long as
      it's called.  The workaround is to reduce calling it as much as
      possible, and this flag indicates that behavior.
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      8a463225
  15. Apr 29, 2016
    • Takashi Iwai's avatar
      ALSA: usb-audio: Limit retrying sample rate reads · 57dd5414
      Takashi Iwai authored
      
      There are many USB audio devices with buggy firmware that don't react
      with the sample rate reading properly.  This often results in the
      flood of error messages and slowing down the operation.
      
      The sample rate read back is basically only for confirming the sample
      rate setup, and it's not critically important.  As a compromise, in
      this patch, we stop the sample rate read back once when the device
      gives errors more than tolerance (twice, as of now).  This should
      improve most of error cases while we still can catch the firmware
      bugginess.
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      57dd5414
  16. Mar 31, 2016
  17. Mar 03, 2016
  18. Nov 16, 2015
    • Clemens Ladisch's avatar
      ALSA: usb-audio: prevent CH345 multiport output SysEx corruption · 1ca8b201
      Clemens Ladisch authored
      
      The CH345 USB MIDI chip has two output ports.  However, they are
      multiplexed through one pin, and the number of ports cannot be reduced
      even for hardware that implements only one connector, so for those
      devices, data sent to either port ends up on the same hardware output.
      This becomes a problem when both ports are used at the same time, as
      longer MIDI commands (such as SysEx messages) are likely to be
      interrupted by messages from the other port, and thus to get lost.
      
      It would not be possible for the driver to detect how many ports the
      device actually has, except that in practice, _all_ devices built with
      the CH345 have only one port.  So we can just ignore the device's
      descriptors, and hardcode one output port.
      
      Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      1ca8b201
  19. Oct 19, 2015
    • Ricard Wanderlof's avatar
      ALSA: USB-audio: Add quirk for Zoom R16/24 playback · e0570446
      Ricard Wanderlof authored
      
      The Zoom R16/24 have a nonstandard playback format where each isochronous
      packet contains a length descriptor in the first four bytes. (Curiously,
      capture data does not contain this and requires no quirk.)
      
      The quirk involves adding the extra length descriptor whenever outgoing
      isochronous packets are generated, both in pcm.c (outgoing audio) and
      endpoint.c (silent data).
      
      In order to make the quirk as unintrusive as possible, for
      pcm.c:prepare_playback_urb(), the isochronous packet descriptors are
      initially set up in the same way no matter if the quirk is enabled or not.
      Once it is time to actually copy the data into the outgoing packet buffer
      (together with the added length descriptors) the isochronous descriptors
      are adjusted in order take the increased payload length into account.
      
      For endpoint.c:prepare_silent_urb() it makes more sense to modify the
      actual function, partly because the function is less complex to start with
      and partly because it is not as time-critical as prepare_playback_urb()
      (whose bulk is run with interrupts disabled), so the (minute) additional
      time spent in the non-quirk case is motivated by the simplicity of having
      a single function for all cases.
      
      The quirk is controlled by the new tx_length_quirk member in struct
      snd_usb_substream and struct snd_usb_audio, which is conveyed to pcm.c
      and endpoint.c from quirks.c in a similar manner to the txfr_quirk member
      in the same structs.
      
      In contrast to txfr_quirk however, the quirk is enabled directly in
      quirks.c:create_standard_audio_quirk() by checking the USB ID in that
      function. Another option would be to introduce a new
      QUIRK_AUDIO_ZOOM_INTERFACE or somesuch, which would have made the quirk
      very plain to see in the quirk table, but it was felt that the additional
      code needed to implement it this way would just make the implementation
      more complex with no real gain.
      
      Tested with a Zoom R16, both by doing capture and playback separately
      using arecord and aplay (8 channel capture and 2 channel playback,
      respectively), as well as capture and playback together using Ardour, as
      well as Audacity and Qtractor together with jackd.
      
      The R24 is reportedly compatible with the R16 when used as an audio
      interface. Both devices share the same USB ID and have the same number of
      inputs (8) and outputs (2). Therefore "R16/24" is mentioned throughout the
      patch.
      
      Regression tested using an Edirol UA-5 in both class compliant (16-bit)
      and "advanced" (24 bit, forces the use of quirks) modes.
      
      Signed-off-by: default avatarRicard Wanderlof <ricardw@axis.com>
      Tested-by: default avatarPanu Matilainen <pmatilai@laiskiainen.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      e0570446
  20. Aug 26, 2015
    • Takashi Iwai's avatar
      ALSA: usb-audio: Replace probing flag with active refcount · a6da499b
      Takashi Iwai authored
      
      We can use active refcount for preventing autopm during probe.
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      a6da499b
    • Takashi Iwai's avatar
      ALSA: usb-audio: Avoid nested autoresume calls · 47ab1545
      Takashi Iwai authored
      
      After the recent fix of runtime PM for USB-audio driver, we got a
      lockdep warning like:
      
        =============================================
        [ INFO: possible recursive locking detected ]
        4.2.0-rc8+ #61 Not tainted
        ---------------------------------------------
        pulseaudio/980 is trying to acquire lock:
         (&chip->shutdown_rwsem){.+.+.+}, at: [<ffffffffa0355dac>] snd_usb_autoresume+0x1d/0x52 [snd_usb_audio]
        but task is already holding lock:
         (&chip->shutdown_rwsem){.+.+.+}, at: [<ffffffffa0355dac>] snd_usb_autoresume+0x1d/0x52 [snd_usb_audio]
      
      This comes from snd_usb_autoresume() invoking down_read() and it's
      used in a nested way.  Although it's basically safe, per se (as these
      are read locks), it's better to reduce such spurious warnings.
      
      The read lock is needed to guarantee the execution of "shutdown"
      (cleanup at disconnection) task after all concurrent tasks are
      finished.  This can be implemented in another better way.
      
      Also, the current check of chip->in_pm isn't good enough for
      protecting the racy execution of multiple auto-resumes.
      
      This patch rewrites the logic of snd_usb_autoresume() & co; namely,
      - The recursive call of autopm is avoided by the new refcount,
        chip->active.  The chip->in_pm flag is removed accordingly.
      - Instead of rwsem, another refcount, chip->usage_count, is introduced
        for tracking the period to delay the shutdown procedure.  At
        the last clear of this refcount, wake_up() to the shutdown waiter is
        called.
      - The shutdown flag is replaced with shutdown atomic count; this is
        for reducing the lock.
      - Two new helpers are introduced to simplify the management of these
        refcounts; snd_usb_lock_shutdown() increases the usage_count, checks
        the shutdown state, and does autoresume.  snd_usb_unlock_shutdown()
        does the opposite.  Most of mixer and other codes just need this,
        and simply returns an error if it receives an error from lock.
      
      Fixes: 9003ebb1 ('ALSA: usb-audio: Fix runtime PM unbalance')
      Reported-and-tested-by: default avatarAlexnader Kuleshov <kuleshovmail@gmail.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      47ab1545
  21. May 02, 2014
    • Takashi Iwai's avatar
      ALSA: usb-audio: Fix deadlocks at resuming · 1ee23fe0
      Takashi Iwai authored
      
      The recent addition of the USB audio mixer suspend/resume may lead to
      deadlocks when the driver tries to call usb_autopm_get_interface()
      recursively, since the function tries to sync with the finish of the
      other calls.  For avoiding it, introduce a flag indicating the resume
      operation and avoids the recursive usb_autopm_get_interface() calls
      during the resume.
      
      Reported-and-tested-by: default avatarBryan Quigley <gquigs@gmail.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      1ee23fe0
  22. Feb 26, 2014
    • Takashi Iwai's avatar
      ALSA: usb-audio: Use standard printk helpers · 0ba41d91
      Takashi Iwai authored
      
      Convert with dev_err() and co from snd_printk(), etc.
      As there are too deep indirections (e.g. ep->chip->dev->dev),
      a few new local macros, usb_audio_err() & co, are introduced.
      
      Also, the device numbers in some messages are dropped, as they are
      shown in the prefix automatically.
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      0ba41d91
  23. Sep 26, 2013
    • 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
      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: default avatarAlan Stern <stern@rowland.harvard.edu>
      CC: Clemens Ladisch <clemens@ladisch.de>
      Tested-by: default avatarDaniel Mack <zonque@gmail.com>
      Tested-by: default avatarEldad Zack <eldad@fogrefinery.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      976b6c06
  24. Jun 27, 2013
    • Clemens Ladisch's avatar
      ALSA: usb-audio: add support for many Roland/Yamaha devices · aafe77cc
      Clemens Ladisch authored
      
      Add quirks to detect the various vendor-specific descriptors used by
      Roland and Yamaha in most of their recent USB audio and MIDI devices.
      
      Together with the previous patch, this should add audio/MIDI support for
      the following USB devices:
      - Edirol motion dive .tokyo performance package
      - Roland MC-808 Synthesizer
      - Roland BK-7m Synthesizer
      - Roland VIMA JM-5/8 Synthesizer
      - Roland SP-555 Sequencer
      - Roland V-Synth GT Synthesizer
      - Roland Music Atelier AT-75/100/300/350C/500/800/900/900C Organ
      - Edirol V-Mixer M-200i/300/380/400/480/R-1000
      - BOSS GT-10B Effects Processor
      - Roland Fantom G6/G7/G8 Keyboard
      - Cakewalk Sonar V-Studio 20/100/700 Audio Interface
      - Roland GW-8 Keyboard
      - Roland AX-Synth Keyboard
      - Roland JUNO-Di/STAGE/Gi Keyboard
      - Roland VB-99 Effects Processor
      - Cakewalk UM-2G MIDI Interface
      - Roland A-500S Keyboard
      - Roland SD-50 Synthesizer
      - Roland OCTAPAD SPD-30 Controller
      - Roland Lucina AX-09 Synthesizer
      - BOSS BR-800 Digital Recorder
      - Roland DUO/TRI-CAPTURE (EX) Audio Interface
      - BOSS RC-300 Loop Station
      - Roland JUPITER-50/80 Keyboard
      - Roland R-26 Recorder
      - Roland SPD-SX Controller
      - BOSS JS-10 Audio Player
      - Roland TD-11/15/30 Drum Module
      - Roland A-49/88 Keyboard
      - Roland INTEGRA-7 Synthesizer
      - Roland R-88 Recorder
      
      Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
      aafe77cc
  25. Apr 04, 2013
  26. Jan 04, 2013
  27. Dec 19, 2012
    • Damien Zammit's avatar
      ALSA: usb-audio: Support for Digidesign Mbox 2 USB sound card: · cb99864d
      Damien Zammit authored
      
      This patch is the result of a lot of trial and error, since there are no specs
      available for the device.
      
      Full duplex support is provided, i.e. playback and recording in stereo.
      The format is hardcoded at 48000Hz @ 24 bit, which is the maximum that the
      device supports.  Also, MIDI in and MIDI out both work.
      
      Users will notice that the S/PDIF light also flashes when playback or recording
      is active.  I believe this means that S/PDIF input/output is simultaneously
      activated with the analogue i/o during use.
      But this particular functionality remains untested.
      
      Note that this particular version of the patch is so far untested on the
      physical hardware because I have not compiled a full kernel with the changes.
      However, extensive testing has been done by many users of the hardware
      who believe other versions of my patch have worked since circa 2009.
      
      [Modified to make a function static by tiwai]
      
      Signed-off-by: default avatarDamien Zammit <damien@zamaudio.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      cb99864d
  28. Nov 21, 2012
  29. Oct 30, 2012
  30. Apr 13, 2012
    • Daniel Mack's avatar
      ALSA: snd-usb: implement new endpoint streaming model · 8fdff6a3
      Daniel Mack authored
      
      This patch adds a new generic streaming logic for audio over USB.
      
      It defines a model (snd_usb_endpoint) that handles everything that
      is related to an USB endpoint and its streaming. There are functions to
      activate and deactivate an endpoint (which call usb_set_interface()),
      and to start and stop its URBs. It also has function pointers to be
      called when data was received or is about to be sent, and pointer to
      a sync slave (another snd_usb_endpoint) that is informed when data has
      been received.
      
      A snd_usb_endpoint knows about its state and implements a refcounting,
      so only the first user will actually start the URBs and only the last
      one to stop it will tear them down again.
      
      With this sort of abstraction, the actual streaming is decoupled from
      the pcm handling, which makes the "implicit feedback" mechanisms easy to
      implement.
      
      In order to split changes properly, this patch only adds the new
      implementation but leaves the old one around, so the the driver doesn't
      change its behaviour. The switch to actually use the new code is
      submitted separately.
      
      Signed-off-by: default avatarDaniel Mack <zonque@gmail.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      8fdff6a3
    • Daniel Mack's avatar
      ALSA: snd-usb: add snd_usb_audio-wide mutex · 596580d0
      Daniel Mack authored
      
      This is needed for new card-wide list operations.
      
      Signed-off-by: default avatarDaniel Mack <zonque@gmail.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      596580d0
  31. Aug 26, 2011
  32. May 25, 2011
  33. Mar 11, 2011
  34. Feb 23, 2011
    • Takashi Iwai's avatar
      ALSA: usb-audio: fix oops due to cleanup race when disconnecting · 382225e6
      Takashi Iwai authored
      
      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: default avatarPierre-Louis Bossart <pierre-louis.bossart@intel.com>
      Cc: <stable@kernel.org>
      [CL: also serialize hw_params callback]
      Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      382225e6
  35. Oct 22, 2010
  36. May 31, 2010
    • Daniel Mack's avatar
      ALSA: usb-audio: parse clock topology of UAC2 devices · 79f920fb
      Daniel Mack authored
      
      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: default avatarDaniel Mack <daniel@caiaq.de>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      79f920fb
  37. May 21, 2010
Loading