- Nov 23, 2020
-
-
Takashi Iwai authored
A preliminary patch for the later big change. Just a minor code refactoring. Tested-by:
Keith Milner <kamilner@superlative.org> Tested-by:
Dylan Robinson <dylan_robinson@motu.com> Link: https://lore.kernel.org/r/20201123085347.19667-19-tiwai@suse.de Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
Takashi Iwai authored
The current driver code assumes blindly that all found sample rates for the same endpoint from the UAC2 and UAC3 descriptors can be used no matter which altsetting, but actually this was wrong: some devices accept only limited sample rates in each altsetting. For determining which altsetting supports which rate, we need to verify each sample rate and check the validity via UAC2_AS_VAL_ALT_SETTINGS. This control reports back the available altsettings as a bitmap. This patch implements the missing piece above, the verification and reconstructs the sample rate tables based on the result. An open question is how to deal with the altsettings that ended up with no valid sample rates after verification. At least, there is a device that showed this problem although the sample rates did work in the later usage (see bug link). For now, we accept such an altset as is, assuming that it's a firmware bug. Reported-by:
Dylan Robinson <dylan_robinson@motu.com> Tested-by:
Keith Milner <kamilner@superlative.org> Tested-by:
Dylan Robinson <dylan_robinson@motu.com> BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1178203 Link: https://lore.kernel.org/r/20201123085347.19667-4-tiwai@suse.de Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- Jul 09, 2020
-
-
Gustavo A. R. Silva authored
Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case. [1] https://www.kernel.org/doc/html/latest/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through Signed-off-by:
Gustavo A. R. Silva <gustavoars@kernel.org> Link: https://lore.kernel.org/r/20200708203236.GA5112@embeddedor Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- Mar 06, 2020
-
-
Alexander Tsoy authored
MicroBook IIc operates in UAC2 mode by default. This patch addresses several issues with it: - MicroBook II and IIc shares the same USB ID. We can distinguish them by interface class. - MaxPacketsOnly attribute is erroneously set in endpoint descriptors. As a result this card produces noise with all sample rates other than 96 KHz. This also causes issues like IOMMU page faults and other problems with host controller. - Sample rate changes takes more than 2 seconds for this device. Clock validity request returns false during that period, so the clock validity quirk is required. Signed-off-by:
Alexander Tsoy <alexander@tsoy.me> Link: https://lore.kernel.org/r/20200229151815.14199-1-alexander@tsoy.me Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- Feb 13, 2020
-
-
Alexander Tsoy authored
It should be safe to ignore clock validity check result if the following conditions are met: - only one single sample rate is supported; - the terminal is directly connected to the clock source; - the clock type is internal. This is to deal with some Denon DJ controllers that always reports that clock is invalid. Tested-by:
Tobias Oszlanyi <toszlanyi@yahoo.de> Signed-off-by:
Alexander Tsoy <alexander@tsoy.me> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20200212235450.697348-1-alexander@tsoy.me Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- Oct 30, 2019
-
-
Saurav Girepunje authored
Use true/false for bool type return in uac_clock_source_is_valid(). Signed-off-by:
Saurav Girepunje <saurav.girepunje@gmail.com> Link: https://lore.kernel.org/r/20191029175200.GA7320@saurav Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- Aug 22, 2019
-
-
Takashi Iwai authored
Now that we got the more comprehensive validation code for USB-audio descriptors, the check of overflow in each descriptor unit parser became superfluous. Drop some of the obvious cases. Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- May 30, 2019
-
-
Thomas Gleixner authored
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details you should have received a copy of the gnu general public license along with this program if not write to the free software foundation inc 59 temple place suite 330 boston ma 02111 1307 usa extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 1334 file(s). Signed-off-by:
Thomas Gleixner <tglx@linutronix.de> Reviewed-by:
Allison Randal <allison@lohutok.net> Reviewed-by:
Richard Fontana <rfontana@redhat.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de Signed-off-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
- Jul 19, 2018
-
-
Adam Goode authored
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>
-
- May 28, 2018
-
-
Takashi Iwai authored
Avoid if ((err = ...) style and expand to multiple lines instead. No change in the end result, but just the beautification. Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- May 13, 2018
-
-
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:
Ruslan Bilovol <ruslan.bilovol@gmail.com> Tested-by:
Jorge Sanjuan <jorge.sanjuan@codethink.co.uk> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- Apr 07, 2018
-
-
Takashi Iwai authored
The UAC3 clock parser codes lack of the sanity checks for malformed descriptors like UAC2 parser does. Without it, the driver may lead to a potential crash. Fixes: 9a2fe9b8 ("ALSA: usb: initial USB Audio Device Class 3.0 support") Tested-by:
Ruslan Bilovol <ruslan.bilovol@gmail.com> Reviewed-by:
Ruslan Bilovol <ruslan.bilovol@gmail.com> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
Takashi Iwai authored
The sanity checks introduced for malformed descriptors loosely check the given descriptor size, although the size greater than the defined description is invalid. It was due to a concern of any funky firmware in the actual products. But this doesn't look hitting, and any sane products must have the defined descriptors. So in this patch, we make the validators more strict, allowing only with the defined descriptor sizes. The value in clock selector validator is corrected from 5 to 7 to count the two unlisted fields after baCSourceID[]. Suggested-by:
Ruslan Bilovol <ruslan.bilovol@gmail.com> Reviewed-by:
Ruslan Bilovol <ruslan.bilovol@gmail.com> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
Takashi Iwai authored
There are lots of open-coded functions to find a clock source, selector and multiplier. Now there are both v2 and v3, so six variants. This patch refactors the code to use a common helper for the main loop, and define each validator function for each target. There is no functional change. Fixes: 9a2fe9b8 ("ALSA: usb: initial USB Audio Device Class 3.0 support") Reviewed-by:
Ruslan Bilovol <ruslan.bilovol@gmail.com> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- Mar 23, 2018
-
-
Andrew Chant authored
This patch fixes code readability and should have no functional change. Correct uac control query functions to account for the 1-based indexing of USB Audio Class control identifiers. The function parameter, u8 control, should be the constant defined in audio-v2.h to identify the control to be checked for readability or writeability. This patch fixes all callers that had adjusted, and makes explicit the mapping between audio_feature_info[] array index and the associated control identifier. Signed-off-by:
Andrew Chant <achant@google.com> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- Mar 21, 2018
-
-
Ruslan Bilovol authored
Recently released USB Audio Class 3.0 specification introduces many significant changes comparing to previous versions, like - new Power Domains, support for LPM/L1 - new Cluster descriptor - changed layout of all class-specific descriptors - new High Capability descriptors - New class-specific String descriptors - new and removed units - additional sources for interrupts - removed Type II Audio Data Formats - ... and many other things (check spec) It also provides backward compatibility through multiple configurations, as well as requires mandatory support for BADD (Basic Audio Device Definition) on each ADC3.0 compliant device This patch adds initial support of UAC3 specification that is enough for Generic I/O Profile (BAOF, BAIF) device support from BADD document. Signed-off-by:
Ruslan Bilovol <ruslan.bilovol@gmail.com> Reviewed-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- Nov 21, 2017
-
-
Takashi Iwai authored
The helper functions to parse and look for the clock source, selector and multiplier unit may return the descriptor with a too short length than required, while there is no sanity check in the caller side. Add some sanity checks in the parsers, at least, to guarantee the given descriptor size, for avoiding the potential crashes. Fixes: 79f920fb ("ALSA: usb-audio: parse clock topology of UAC2 devices") Reported-by:
Andrey Konovalov <andreyknvl@google.com> Cc: <stable@vger.kernel.org> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- Apr 29, 2016
-
-
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:
Takashi Iwai <tiwai@suse.de>
-
- Mar 16, 2016
-
-
Takashi Iwai authored
Add some sanity check codes before actually accessing the endpoint via get_endpoint() in order to avoid the invalid access through a malformed USB descriptor. Mostly just checking bNumEndpoints, but in one place (snd_microii_spdif_default_get()), the validity of iface and altsetting index is checked as well. Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=971125 Cc: <stable@vger.kernel.org> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- Feb 17, 2015
-
-
Joe Turner authored
Adds a quirk to disable the check that the sample rate has been set correctly, as the Lifecam does not support getting the sample rate. This means that we don't need to wait for the USB timeout when attempting to get the sample rate. Waiting for the timeout causes problems in some applications, which give up on the device acquisition process before it has had time to complete, resulting in no sound. [minor tidy up by tiwai] Signed-off-by:
Joe Turner <joe@oampo.co.uk> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- Feb 26, 2014
-
-
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:
Takashi Iwai <tiwai@suse.de>
-
- Jun 27, 2013
-
-
Clemens Ladisch authored
Instead of reading bInterfaceProtocol from the descriptor whenever it's needed, store this value in the audioformat structure. Besides simplifying some code, this will allow us to correctly handle vendor- specific devices where the descriptors are marked with other values. Signed-off-by:
Clemens Ladisch <clemens@ladisch.de>
-
- Apr 26, 2013
-
-
David Henningsson authored
The Scarlett 2i2 seems to take almost 500 ms to set the sample rate, even if the clock is currently set to that value. This patch speeds up prepare of the device, by avoiding setting the clock to something it already is. Signed-off-by:
David Henningsson <david.henningsson@canonical.com> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- Apr 10, 2013
-
-
Daniel Mack authored
It turns out the devices from Playback Design need the delay quirk after usb_set_interface from clocks.c as well. Make it a proper quirks function and factor out the code to quirks.c. Signed-off-by:
Daniel Mack <zonque@gmail.com> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- Apr 04, 2013
-
-
Eldad Zack authored
Some clocks might be read-only, e.g., external clocks (see also UAC2 4.7.2.1). In this case, setting the sample frequency will always fail (even if the rate is equal to the current clock rate), therefore do not write, but read the value and compare to the requested rate. If the clock is read only, avoid reading it twice. If it doesn't match, return -ENXIO since the clock is invalid for this configuration. Signed-off-by:
Eldad Zack <eldad@fogrefinery.com> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
Eldad Zack authored
Show the error code returned from the USB subsystem in the debug messages. Signed-off-by:
Eldad Zack <eldad@fogrefinery.com> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
Eldad Zack authored
Add a module param to disable auto clock selection. This is provided for users that expect the audio stream to fail when the clock source is invalid (e.g., the word clock was unintentionally disconnected). Signed-off-by:
Eldad Zack <eldad@fogrefinery.com> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
Eldad Zack authored
If a selector is available on a device, it may be pointing to a clock source which is currently invalid. If there is a valid clock source which can be selected, switch to it. Signed-off-by:
Eldad Zack <eldad@fogrefinery.com> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
Eldad Zack authored
Move the check that parse_audio_format_rates_v2() do after receiving the clock source entity ID directly into the find function and add a validation flag to the function. This patch does not introduce any logic flow change. It is provided to allow introducing automatic clock switching easier later. By moving this uac_clock_source_is_valid callsite, 2 additional callsites can be avoided. Signed-off-by:
Eldad Zack <eldad@fogrefinery.com> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
Eldad Zack authored
Replace the endianness conversions with the kernel-wide swabbing macros in get/set_sample_rate_v2. Signed-off-by:
Eldad Zack <eldad@fogrefinery.com> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- Apr 03, 2013
-
-
Takashi Iwai authored
Just for cleaning up, introduce a new function get_sample_rate_v2() for replacing two identical calls in set_sample_rate_v2(). No functional change. Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
Torstein Hegge authored
The C-Media CM6631 USB receiver doesn't respond to changes in sample rate while the interface is active. The same behavior is observed in other UAC2 hardware like the VIA VT1731. Reset the interface after setting the sampling frequency on sample rate changes, to ensure that the sample rate set by snd_usb_init_sample_rate() is used. Otherwise, the device will try to use the sample rate of the previous stream, causing distorted sound on sample rate changes. The reset is performed for all UAC2 devices, as it should not affect a standards compliant device, but it is only necessary for C-Media CM6631, VIA VT1731 and possibly others. Failure to read sample rate from the device is not handled as an error in set_sample_rate_v2(), as (permanent or intermittent) failure to read sample rate isn't essential for a successful sample rate set. Signed-off-by:
Torstein Hegge <hegge@resisty.net> Acked-by:
Clemens Ladisch <clemens@ladisch.de> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- Aug 01, 2012
-
-
Daniel Mack authored
uac_clock_source_is_valid() uses the control selector value to access the bmControls bitmap of the clock source unit. This is wrong, as control selector values start from 1, while the bitmap uses all available bits. In other words, "Clock Validity Control" is stored in D3..2, not D5..4 of the clock selector unit's bmControls. Signed-off-by:
Daniel Mack <zonque@gmail.com> Reported-by:
Andreas Koch <andreas@akdesigninc.com> Cc: stable@kernel.org Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- Sep 27, 2011
-
-
Clemens Ladisch authored
There are certain devices that are reportedly so slow that they need more than 100 ms to handle control transfers. Therefore, increase the timeout in mixer(_quirks).c to 1000 ms. The timeout parameter of snd_usb_ctl_msg() is now constant, so we can drop it. Reported-by:
Felipe Balbi <balbi@ti.com> Signed-off-by:
Clemens Ladisch <clemens@ladisch.de> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- May 18, 2011
-
-
Daniel Mack authored
If the interface can't report a clock's validity, assume that it's valid. Signed-off-by:
Daniel Mack <zonque@gmail.com> Reported-by:
Vicente Joel <vicentejoel@gmail.com> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- Sep 03, 2010
-
-
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:
Clemens Ladisch <clemens@ladisch.de> Cc: Daniel Mack <daniel@caiaq.de> Cc: <stable@kernel.org> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- Jul 09, 2010
-
-
Clemens Ladisch authored
It is not advisable to print a warning when a device does not support setting the sample rate because this is perfectly valid for devices with a single rate or where rates are implicitly changed by selecting another alternate setting. Signed-off-by:
Clemens Ladisch <clemens@ladisch.de> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
- Jun 23, 2010
-
-
Daniel Mack authored
As the control interface is now carried in struct snd_usb_audio, we can simplify the API a little and also drop the private ctrlif field from struct usb_mixer_interface. Also remove a left-over function prototype in pcm.h. Signed-off-by:
Daniel Mack <daniel@caiaq.de> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
Daniel Mack authored
Also add a list of open topics. Signed-off-by:
Daniel Mack <daniel@caiaq.de> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-
Daniel Mack authored
Signed-off-by:
Daniel Mack <daniel@caiaq.de> Signed-off-by:
Takashi Iwai <tiwai@suse.de>
-