1
0
Fork 0
Commit Graph

1432 Commits (62be257e986dab439537b3e1c19ef746a13e1860)

Author SHA1 Message Date
Aditya Pakki a2c6433ee5 ALSA: usx2y: Fix potential NULL pointer dereference
usb_alloc_urb() can fail due to kmalloc failure and push the error
upstream. Further this can cause a NULL pointer dereference in
init_pipe_urbs(). This patch avoids such a scenario.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-03-13 11:27:06 +01:00
Manuel Reinhardt a634090a0f ALSA: usb-audio: Add quirk for MOTU MicroBook II
Add an entry to the quirks-table to for usb-audio to recognize the
Microbook II (although it only exposes vendor interfaces). A simple boot
quirk is also implemented to set up the sample rate and  make sure that
no audio urbs are sent before the device is ready.

This patch only provides audio playback and capture at 96kHz sample
rate. Notice the following shortcomings:

- The sample rate is currently hardcoded to 96k although the device also
  supports 48k and 44.1k.

- The various mixer controls of the MicroBook are not made available.

- The keep-iface control should be on by default because the device
  shuts down whenever the altsetting is reset which is usually unwanted.
  (I don't know the best way to do this)

- The communication format used by the MicroBook for sample rate setting
  and also other setup has been reverse engineered by looking at the
  usbmon output while running the windows driver through virtualbox. In
  this patch the first byte of every message is set to \0 while in the
  observed communications the first byte acts as a "message-counter"
  increasing its value with every message sent. Leaving it at \0 does
  not seem to affect the device.

Signed-off-by: Manuel Reinhardt <manuel.rhdt@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-02-28 22:23:11 +01:00
Jussi Laako c7a1326491 ALSA: usb-audio: Expose sample resolution through proc interface
At least some USB devices use (MSB-aligned) audio format larger
than the actual resolution of the device. In order to expose the
actual device resolution (bBitResolution), add extra field to the
procfs stream info interface.

Signed-off-by: Jussi Laako <jussi@sonarnerd.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-02-18 09:36:09 +01:00
Takashi Iwai 7b48b3b226 Merge branch 'for-linus' into for-next
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-02-08 14:22:57 +01:00
Takashi Iwai 36e4617c01 Merge branch 'topic/memory-device-fixes-2' into for-next
Pull further device memory allocation cleanups (but no API change yet).

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-02-08 14:12:15 +01:00
Manuel Reinhardt 2bc16b9f32 ALSA: usb-audio: Fix implicit fb endpoint setup by quirk
The commit a60945fd08 ("ALSA: usb-audio: move implicit fb quirks to
separate function") introduced an error in the handling of quirks for
implicit feedback endpoints. This commit fixes this.

If a quirk successfully sets up an implicit feedback endpoint, usb-audio
no longer tries to find the implicit fb endpoint itself.

Fixes: a60945fd08 ("ALSA: usb-audio: move implicit fb quirks to separate function")
Signed-off-by: Manuel Reinhardt <manuel.rhdt@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-02-07 20:04:43 +01:00
Takashi Iwai 7449054af0 ALSA: usb: Clean up with new procfs helpers
Simplify the proc fs creation code with new helper functions,
snd_card_ro_proc_new() and snd_card_rw_proc_new().
Just a code refactoring and no functional changes.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-02-06 18:11:57 +01:00
Takashi Iwai 4d1b53034d ALSA: usb: Drop superfluous PCM preallocation error checks
snd_pcm_lib_preallocate_pages() and co always succeed, so the error
check is simply redundant.  Drop it.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-02-06 10:29:42 +01:00
Udo Eberhardt 3bff2407fb ALSA: usb-audio: Add support for new T+A USB DAC
This patch adds the T+A VID to the generic check in order to enable
native DSD support for T+A devices. This works with the new T+A USB
DAC model SD3100HV and will also work with future devices which
support the XMOS/Thesycon style DSD format.

Signed-off-by: Udo Eberhardt <udo.eberhardt@thesycon.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-02-05 17:21:55 +01:00
Jussi Laako 202e69e645 ALSA: usb-audio: Cleanup DSD whitelist
XMOS/Thesycon family of USB Audio Class firmware flags DSD altsetting
separate from the PCM ones. Thus the DSD altsetting can be auto-detected
based on the flag and doesn't need maintaining specific altsetting
whitelist.

In addition, static VID:PID-to-altsetting whitelisting causes problems
when firmware update changes the altsetting, or same VID:PID is reused
for another device that has different kind of firmware.

This patch removes existing explicit whitelist mappings for XMOS VID
(0x20b1) and Thesycon VID (0x152a).

Also corrects placement of Hegel HD12 and NuPrime DAC-10 to keep list
sorted based on VID.

Signed-off-by: Jussi Laako <jussi@sonarnerd.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-29 11:07:53 +01:00
Takashi Iwai 286406c2e1 Merge branch 'for-linus' into for-next
Pull 5.0 branch for further development of USB-audio quirks

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-29 11:07:48 +01:00
Olek Poplavsky 9e6966646b ALSA: usb-audio: Add Opus #3 to quirks for native DSD support
This patch adds quirk VID/PID IDs for the Opus #3 DAP (made by 'The Bit')
in order to enable Native DSD support.

[ NOTE: this could be handled in the generic way with fp->dvd_raw if
  we add 0x10cb to the vendor whitelist, but since 0x10cb shows a
  different vendor name (Erantech), put to the individual entry at
  this time -- tiwai ]

Signed-off-by: Olek Poplavsky <woodenbits@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-25 19:45:42 +01:00
Takashi Iwai 436ec40e0c Merge branch 'topic/pcm-device-suspend' into for-next
Pull the PCM suspend improvement / cleanup.
This moves the most of snd_pcm_suspend*() calls into PCM's own device
PM ops.  There should be no change from the functionality POV.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-18 17:37:21 +01:00
Takashi Iwai 2c76706843 ALSA: usb: Remove superfluous snd_pcm_suspend*() calls
The call of snd_pcm_suspend_all() & co became superfluous since we
call it in the PCM PM ops.  Let's remove them.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-15 17:47:32 +01:00
YueHaibing 36c346e1c5 ALSA: usb-audio: Remove set but not used variable 'first_ch_bits'
Fixes gcc '-Wunused-but-set-variable' warning:

sound/usb/mixer.c: In function 'parse_audio_feature_unit':
sound/usb/mixer.c:1838:28: warning:
 variable 'first_ch_bits' set but not used [-Wunused-but-set-variable]

It never used since 2.6

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-09 10:32:18 +01:00
Amadeusz Sławiński f5c9571e22 ALSA: usb-audio: fix CM6206 register definitions
fix typo after a recent commit causing headphones to have no sound

Fixes: ad43d528a7 (ALSA: usb-audio: Define registers for CM6206)
Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-08 22:51:44 +01:00
Aditya Pakki 02cc53e223 ALSA: line6: fix check on snd_card_register
The fix checks if snd_card_register() fails, and if so logs the error
via dev_err() consistent with other patches.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-07 11:58:30 +01:00
Hui Peng cbb2ebf70d ALSA: usb-audio: Fix an out-of-bound read in create_composite_quirks
In `create_composite_quirk`, the terminating condition of for loops is
`quirk->ifnum < 0`. So any composite quirks should end with `struct
snd_usb_audio_quirk` object with ifnum < 0.

    for (quirk = quirk_comp->data; quirk->ifnum >= 0; ++quirk) {

    	.....
    }

the data field of Bower's & Wilkins PX headphones usb device device quirks
do not end with {.ifnum = -1}, wihch may result in out-of-bound read.

This Patch fix the bug by adding an ending quirk object.

Fixes: 240a8af929 ("ALSA: usb-audio: Add a quirck for B&W PX headphones")
Signed-off-by: Hui Peng <benquike@163.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-07 11:10:31 +01:00
Takashi Iwai 3e96d7280f ALSA: usb-audio: Always check descriptor sizes in parser code
There are a few places where we access the data without checking the
actual object size from the USB audio descriptor.  This may result in
OOB access, as recently reported.

This patch addresses these missing checks.  Most of added codes are
simple bLength checks in the caller side.  For the input and output
terminal parsers, we put the length check in the parser functions.
For the input terminal, a new argument is added to distinguish between
UAC1 and the rest, as they treat different objects.

Reported-by: Mathias Payer <mathias.payer@nebelwelt.net>
Reported-by: Hui Peng <benquike@163.com>
Tested-by: Hui Peng <benquike@163.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-07 11:10:17 +01:00
Takashi Iwai 0bfe5e434e ALSA: usb-audio: Check mixer unit descriptors more strictly
We've had some sanity checks of the mixer unit descriptors but they
are too loose and some corner cases are overlooked.  Add more strict
checks in uac_mixer_unit_get_channels() for avoiding possible OOB
accesses by malformed descriptors.

This also changes the semantics of uac_mixer_unit_get_channels()
slightly.  Now it returns zero for the cases where the descriptor
lacks of bmControls instead of -EINVAL.  Then the caller side skips
the mixer creation for such unit while it keeps parsing it.
This corresponds to the case like Maya44.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-07 10:46:27 +01:00
Takashi Iwai f4351a199c ALSA: usb-audio: Avoid access before bLength check in build_audio_procunit()
The parser for the processing unit reads bNrInPins field before the
bLength sanity check, which may lead to an out-of-bound access when a
malformed descriptor is given.  Fix it by assignment after the bLength
check.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-01-07 10:46:26 +01:00
Takashi Iwai 2bff7e97eb Merge branch 'for-linus' into for-next
Back-merge for applying the more HD-audio quirks on top of the latest
code.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-12-07 11:40:04 +01:00
Hui Peng 5f8cf71258 ALSA: usb-audio: Fix UAF decrement if card has no live interfaces in card.c
If a USB sound card reports 0 interfaces, an error condition is triggered
and the function usb_audio_probe errors out. In the error path, there was a
use-after-free vulnerability where the memory object of the card was first
freed, followed by a decrement of the number of active chips. Moving the
decrement above the atomic_dec fixes the UAF.

[ The original problem was introduced in 3.1 kernel, while it was
  developed in a different form.  The Fixes tag below indicates the
  original commit but it doesn't mean that the patch is applicable
  cleanly. -- tiwai ]

Fixes: 362e4e49ab ("ALSA: usb-audio - clear chip->probing on error exit")
Reported-by: Hui Peng <benquike@gmail.com>
Reported-by: Mathias Payer <mathias.payer@nebelwelt.net>
Signed-off-by: Hui Peng <benquike@gmail.com>
Signed-off-by: Mathias Payer <mathias.payer@nebelwelt.net>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-12-03 16:09:38 +01:00
Tony Das 44ff57e685 ALSA: usb-audio: Add SMSL D1 to quirks for native DSD support
This patch adds quirk VID/PID IDs for the SMSL D1 in order to enable
Native DSD support.

[ Moved the added entry in numerical order -- tiwai ]

Signed-off-by: Tony Das <tdas444@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-11-29 08:49:24 +01:00
Hui Wang 8159a6a4a7 ALSA: usb-audio: Add vendor and product name for Dell WD19 Dock
Like the Dell WD15 Dock, the WD19 Dock (0bda:402e) doens't provide
useful string for the vendor and product names too. In order to share
the UCM with WD15, here we keep the profile_name same as the WD15.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-11-28 10:59:49 +01:00
Linus Walleij ad43d528a7 ALSA: usb-audio: Define registers for CM6206
The register map for CM6206 is known and we can define what
the values written to the different registers actually mean.

I tested to print the hex values before/after this change,
there is no functional change.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-11-06 16:34:25 +01:00
Takashi Iwai 590b516e25 ALSA: caiaq: Add fall-through annotation
As a preparatory patch for the upcoming -Wimplicit-fallthrough
compiler checks, add the "fall through" annotation in caiaq driver.
Note that this seems necessary to be put exactly before the next
label, so it's outside the ifdef block.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-10-12 09:31:26 +02:00
Jussi Laako d39f1d68fe ALSA: usb-audio: Add custom mixer status quirks for RME CC devices
Adds several vendor specific mixer quirks for RME's Class Compliant
USB devices. These provide extra status information from the device
otherwise not available.

These include AES/SPDIF rate and status information, current system
sampling rate and measured frequency. This information is especially
useful in cases where device's clock is slaved to external clock
source.

Signed-off-by: Jussi Laako <jussi@sonarnerd.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-10-05 10:18:59 +02:00
Nicolas Huaman c369c8db15 ALSA: usb-audio: update quirk for B&W PX to remove microphone
A quirk in snd-usb-audio was added to automate setting sample rate to
4800k and remove the previously exposed nonfunctional microphone for
the Bowers & Wilkins PX:
commit 240a8af929
https://lore.kernel.org/patchwork/patch/919689/

However the headphones where updated shortly after that to remove the
unintentional microphone functionality. I guess because of this the
headphones now crash when connecting them via USB while the quirk is
active. Dmesg:

snd-usb-audio: probe of 2-3:1.0 failed with error -22
usb 2-3: 2:1: cannot get min/max values for control 2 (id 2)

This patch removes the microfone and allows the headphones to connect
and work out of the box. It is based on the current mainline kernel
 and successfully applied an tested on my machine (4.18.10.arch1-1).

Fixes: 240a8af929 ("ALSA: usb-audio: Add a quirck for B&W PX headphones")
Signed-off-by: Nicolas Huaman <nicolas@herochao.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-10-04 22:52:40 +02:00
Takashi Iwai 6aea5702e2 ALSA: rawmidi: A lightweight function to discard pending bytes
For discarding the pending bytes on rawmidi, we process with a loop of
snd_rawmidi_transmit() which is just a waste of CPU power.
Implement a lightweight API function to discard the pending bytes and
the proceed the ring buffer instantly, and use it instead of open
codes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-10-04 20:13:17 +02:00
Gustavo A. R. Silva 91c6e15efc ALSA: usb-audio: Mark expected switch fall-through
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 1357413 ("Missing break in switch")
Addresses-Coverity-ID: 114917 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-08-09 08:52:33 +02:00
Wei Yongjun 11175556ee ALSA: usb-audio: Fix invalid use of sizeof in parse_uac_endpoint_attributes()
sizeof() when applied to a pointer typed expression gives the
size of the pointer, not that of the pointed data.

Fixes: 7edf3b5e6a ("ALSA: usb-audio: AudioStreaming Power Domain parsing")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-08-02 07:26:37 +02:00
Gustavo A. R. Silva d5e77fca87 ALSA: usb: Mark expected switch fall-through
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 115084 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-08-01 20:32:06 +02:00
Colin Ian King d36455a38e ALSA: usb-audio: remove redundant pointer 'urb'
Pointer 'urb' is being assigned but is never used hence it is
redundant and can be removed.

Cleans up clang warning:
warning: variable 'urb' set but not used [-Wunused-but-set-variable]

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-08-01 14:00:32 +02:00
Jorge Sanjuan a0a4959eb4 ALSA: usb-audio: Operate UAC3 Power Domains in PCM callbacks
Make use of UAC3 Power Domains associated to an Audio Streaming
path within the PCM's logic. This means, when there is no audio
being transferred (pcm is closed), the host will set the Power Domain
associated to that substream to state D1. When audio is being transferred
(from hw_params onwards), the Power Domain will be set to D0 state.

This is the way the host lets the device know which Terminal
is going to be actively used and it is for the device to
manage its own internal resources on that UAC3 Power Domain.

Note the resume method now sets the Power Domain to D1 state as
resuming the device doesn't mean audio streaming will occur.

Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-31 15:01:45 +02:00
Jorge Sanjuan 3f59aa11c6 ALSA: usb-audio: Add UAC3 Power Domains to suspend/resume
Set the UAC3 Power Domain state for an Audio Streaming interface
to D2 state before suspending the device (usb_driver callback).
This lets the device know there is no intention to use any of the
Units in the Audio Function and that the host is not going to
even listen for wake-up events (interrupts) on the units.

When the usb_driver gets resumed, the state D0 (fully powered) will
be set. This ties up the UAC3 Power Domains to the runtime PM.

Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-31 15:01:36 +02:00
Jorge Sanjuan 7edf3b5e6a ALSA: usb-audio: AudioStreaming Power Domain parsing
Power Domains in the UAC3 spec are mainly intended to be
associated to an Input or Output Terminal so the host
changes the power state of the entire capture or playback
path within the topology.

This patch adds support for finding Power Domains associated
to an Audio Streaming Interface (bTerminalLink) and adds a
reference to them in the usb audio substreams (snd_usb_substream).

Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-31 15:01:30 +02:00
Jorge Sanjuan 11785ef532 ALSA: usb-audio: Initial Power Domain support
Thee USB Audio Class 3 (UAC3) introduces Power Domains as a new
feature to let a host turn individual parts of an audio function
to different power states via USB requests. This lets the device
get to know a bit amore about what the host is up to in order to
optimize power consumption efficiently.

The Power Domains are optional for UAC3 configuration but all
UAC3 devices shall include at least one BADD configuration where
the support for Power Domains is compulsory.

This patch adds a set of features/helpers to parse these power
domains and change their status.

Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-31 15:01:22 +02:00
Jia-Ju Bai df3f0347fd ALSA: usb-audio: quirks: Replace mdelay() with msleep() and usleep_range()
snd_usb_select_mode_quirk(), snd_usb_set_interface_quirk() and
snd_usb_ctl_msg_quirk() are never called in atomic context.
They call mdelay() to busily wait, which is not necessary.
mdelay() can be replaced with msleep() and usleep_range().

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-27 11:48:07 +02:00
Takashi Iwai 00966dcdf0 ALSA: usb-audio: Declare the common variable in header file
Declare snd_usb_feature_unit_ctl properly in mixer.h.  Otherwise it's
error-prone.

This fixes the sparse warning:
  sound/usb/mixer.c:1464:25: warning: symbol 'snd_usb_feature_unit_ctl' was not declared. Should it be static?

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-26 08:32:00 +02:00
Takashi Iwai bd1cd0eb2c ALSA: usb-audio: Fix multiple definitions in AU0828_DEVICE() macro
AU0828_DEVICE() macro in quirks-table.h uses USB_DEVICE_VENDOR_SPEC()
for expanding idVendor and idProduct fields.  However, the latter
macro adds also match_flags and bInterfaceClass, which are different
from the values AU0828_DEVICE() macro sets after that.

For fixing them, just expand idVendor and idProduct fields manually in
AU0828_DEVICE().

This fixes sparse warnings like:
  sound/usb/quirks-table.h:2892:1: warning: Initializer entry defined twice

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-26 08:30:57 +02:00
Jeff Crukley b080dc5bd0 ALSA: usb-audio: Add support for Encore mDSD USB DAC
This patch adds native DSD playback support for the Encore mDSD USB DAC by
specifying the vendor and product ID's

Signed-off-by: Jeff Crukley <jcrukley@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-26 08:29:32 +02:00
Yue Wang 1ea0358ecb ALSA: usb-audio: Generic DSD detection for Thesycon-based implementations
Thesycon provides solutions to XMOS chips, and has its own device
vendor id.

In this patch, we use generic method to detect DSD capability of
Thesycon-based UAC2 implementations in order to support a wide range
of current and future devices.

The patch will enable the SNDRV_PCM_FMTBIT_DSD_U32_BE bit for the DAC
hence enable native DSD playback up to DSD512 format.

Signed-off-by: Yue Wang <yuleopen@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-23 11:29:59 +02:00
Adam Goode 58cabe8715 ALSA: usb-audio: Allow changing from a bad sample rate
If the audio device is externally clocked and set to a rate that does
not match the external clock, the clock will never be valid and we cannot
set the rate successfully. To fix this, allow a rate change even if
the clock is initially invalid, and validate again after the rate is
changed.

This fixes problems with MOTU UltraLite AVB hardware over USB.

Signed-off-by: Adam Goode <agoode@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-19 08:44:46 +02:00
Takashi Iwai fa84cf094e ALSA: pcm: Nuke snd_pcm_lib_mmap_vmalloc()
snd_pcm_lib_mmap_vmalloc() was supposed to be implemented with
somewhat special for vmalloc handling, but in the end, this turned to
just the default handler, i.e. NULL.  As the situation has never
changed over decades, let's rip it off.

Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-18 08:24:29 +02:00
Jorge Sanjuan 55b8cb46a7 ALSA: usb-audio: Tidy up logic for Processing Unit min/max values
This patch refactors the processing units min/max calculation logic
for the mixer controls and fixes an issue where the Mode Select
checking of the Up/Down mixers doesn't differentiate between the
UAC1 and UAC2 Control Selector (0x02) and the UAC3 one which is
different (0x01).

Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-16 16:36:15 +02:00
Jorge Sanjuan 8b3a087f7f ALSA: usb-audio: Unify virtual type units type to UAC3 values
The Audio Control interface descriptor subtypes do not match
across all the UAC versions. That makes reusability of the
"virtual type" (Mixer, Processors, Selectors, etc) terminals
difficult. It also makes the mixer get the default names for
the virtual terminals wrong due to the overlap.

This patch proposes an unified approach by always using the most
comprehensive spec version to define them all (in this case UAC3).

Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-16 16:35:55 +02:00
Jorge Sanjuan 0f292f023f ALSA: usb-audio: Add support for Processing Units in UAC3
This patch adds support for the Processig Units defined in
the UAC3 spec. The main difference with the previous specs
is the lack of on/off switches in the controls for these
units and the addiction of the new Multi Function Processing
Unit.

The current version of the UAC3 spec doesn't define any
useful controls for the new Multi Function Processing Unit
so no control will get created once this unit is parsed.

Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-16 16:35:34 +02:00
Jorge Sanjuan 4e887af31c ALSA: usb-audio: Processing Unit controls parsing in UAC2
Current support for UAC2 Processing Units does the parsing
as one control per bit in the bitmap. However, the UAC2 spec
defines the controls as bit pairs where b01 means read-only
and b11 means read/write control.

This patch fixes that and uses the helper functions for checking
controls readability/writability when the control is defined as
bit pairs (UAC2 and UAC3).

Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-16 16:35:09 +02:00
Jorge Sanjuan c77e1ef1cd ALSA: usb-audio: Add support for Selector Units in UAC3
This patch add support for Selector Units and Clock Selector Units
defined in the new UAC3 spec.

Selector Units play a really important role in the new UAC3 spec as
Processing Units do not define an on/off switch control anymore.
This forces topology designers to add bypass paths in the topology
to enable/dissable the Processing Units.

Signed-off-by: Jorge Sanjuan <jorge.sanjuan@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-16 16:34:44 +02:00