History log of /linux-master/sound/usb/quirks.c
Revision Date Author Comments
# 668abe6d 24-Jan-2024 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Sort quirk table entries

The quirk table entries should be put in the USB ID order, but some
entries have been put in random places. Re-sort them.

Fixes: bf990c102319 ("ALSA: usb-audio: add quirk to fix Hamedal C20 disconnect issue")
Fixes: fd28941cff1c ("ALSA: usb-audio: Add new quirk FIXED_RATE for JBL Quantum810 Wireless")
Fixes: dfd5fe19db7d ("ALSA: usb-audio: Add FIXED_RATE quirk for JBL Quantum610 Wireless")
Fixes: 4a63e68a2951 ("ALSA: usb-audio: Fix microphone sound on Nexigo webcam.")
Fixes: 7822baa844a8 ("ALSA: usb-audio: add quirk for RODE NT-USB+")
Fixes: 4fb7c24f69c4 ("ALSA: usb-audio: Add quirk for Fiero SC-01")
Fixes: 2307a0e1ca0b ("ALSA: usb-audio: Add quirk for Fiero SC-01 (fw v1.0.0)")
Link: https://lore.kernel.org/r/20240124155307.16996-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 7822baa8 24-Jan-2024 Sean Young <sean@mess.org>

ALSA: usb-audio: add quirk for RODE NT-USB+

The RODE NT-USB+ is marketed as a professional usb microphone, however the
usb audio interface is a mess:

[ 1.130977] usb 1-5: new full-speed USB device number 2 using xhci_hcd
[ 1.503906] usb 1-5: config 1 has an invalid interface number: 5 but max is 4
[ 1.503912] usb 1-5: config 1 has no interface number 4
[ 1.519689] usb 1-5: New USB device found, idVendor=19f7, idProduct=0035, bcdDevice= 1.09
[ 1.519695] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1.519697] usb 1-5: Product: RØDE NT-USB+
[ 1.519699] usb 1-5: Manufacturer: RØDE
[ 1.519700] usb 1-5: SerialNumber: 1D773A1A
[ 8.327495] usb 1-5: 1:1: cannot get freq at ep 0x82
[ 8.344500] usb 1-5: 1:2: cannot get freq at ep 0x82
[ 8.365499] usb 1-5: 2:1: cannot get freq at ep 0x2

Add QUIRK_FLAG_GET_SAMPLE_RATE to work around the broken sample rate get.
I have asked Rode support to fix it, but they show no interest.

Signed-off-by: Sean Young <sean@mess.org>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20240124151524.23314-1-sean@mess.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# d915a685 24-Jan-2024 Alexander Tsoy <alexander@tsoy.me>

ALSA: usb-audio: Add delay quirk for MOTU M Series 2nd revision

Audio control requests that sets sampling frequency sometimes fail on
this card. Adding delay between control messages eliminates that problem.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=217601
Cc: <stable@vger.kernel.org>
Signed-off-by: Alexander Tsoy <alexander@tsoy.me>
Link: https://lore.kernel.org/r/20240124130239.358298-1-alexander@tsoy.me
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a9692100 23-Jan-2024 Julian Sikorski <belegdol+github@gmail.com>

ALSA: usb-audio: Add a quirk for Yamaha YIT-W12TX transmitter

The device fails to initialize otherwise, giving the following error:
[ 3676.671641] usb 2-1.1: 1:1: cannot get freq at ep 0x1

Signed-off-by: Julian Sikorski <belegdol+github@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20240123084935.2745-1-belegdol+github@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 48d6b917 16-Dec-2023 Jeremie Knuesel <knuesel@gmail.com>

ALSA: usb-audio: Increase delay in MOTU M quirk

Increase the quirk delay from 2 seconds to 4 seconds. This reflects a
change in the Windows driver in which the delay was increased to about
3.7 seconds. The larger delay fixes an issue where the device fails to
work unless it was powered up early during boot.

Also clarify in the quirk comment that the quirk is only applied to
older devices (USB ID 07fd:0008).

Signed-off-by: Jeremie Knuesel <knuesel@gmail.com>
Suggested-by: Alexander Tsoy <alexander@tsoy.me>
Cc: <stable@vger.kernel.org>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=211975
Link: https://lore.kernel.org/r/20231217112243.33409-1-knuesel@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 99248c89 23-Oct-2023 Max McCarthy <mmccarthy@mcintoshlabs.com>

ALSA: usb-audio: add quirk flag to enable native DSD for McIntosh devices

McIntosh devices supporting native DSD require the feature to be
explicitly exposed. Add a flag that fixes an issue where DSD audio was
defaulting to DSD over PCM instead of delivering raw DSD data.

Signed-off-by: Max McCarthy <mmccarthy@mcintoshlabs.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/BL0PR13MB4433226005162D186A8DFF4AD6DFA@BL0PR13MB4433.namprd13.prod.outlook.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 4a63e68a 06-Oct-2023 Christos Skevis <xristos.thes@gmail.com>

ALSA: usb-audio: Fix microphone sound on Nexigo webcam.

I own an external usb Webcam, model NexiGo N930AF, which had low mic volume and
inconsistent sound quality. Video works as expected.

(snip)
[ +0.047857] usb 5-1: new high-speed USB device number 2 using xhci_hcd
[ +0.003406] usb 5-1: New USB device found, idVendor=1bcf, idProduct=2283, bcdDevice=12.17
[ +0.000007] usb 5-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ +0.000004] usb 5-1: Product: NexiGo N930AF FHD Webcam
[ +0.000003] usb 5-1: Manufacturer: SHENZHEN AONI ELECTRONIC CO., LTD
[ +0.000004] usb 5-1: SerialNumber: 20201217011
[ +0.003900] usb 5-1: Found UVC 1.00 device NexiGo N930AF FHD Webcam (1bcf:2283)
[ +0.025726] usb 5-1: 3:1: cannot get usb sound sample rate freq at ep 0x86
[ +0.071482] usb 5-1: 3:2: cannot get usb sound sample rate freq at ep 0x86
[ +0.004679] usb 5-1: 3:3: cannot get usb sound sample rate freq at ep 0x86
[ +0.051607] usb 5-1: Warning! Unlikely big volume range (=4096), cval->res is probably wrong.
[ +0.000005] usb 5-1: [7] FU [Mic Capture Volume] ch = 1, val = 0/4096/1

Set up quirk cval->res to 16 for 256 levels,
Set GET_SAMPLE_RATE quirk flag to stop trying to get the sample rate.
Confirmed that happened anyway later due to the backoff mechanism, after 3 failures

All audio stream on device interfaces share the same values,
apart from wMaxPacketSize and tSamFreq :

(snip)
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 3
bAlternateSetting 3
bNumEndpoints 1
bInterfaceClass 1 Audio
bInterfaceSubClass 2 Streaming
bInterfaceProtocol 0
iInterface 0
AudioStreaming Interface Descriptor:
bLength 7
bDescriptorType 36
bDescriptorSubtype 1 (AS_GENERAL)
bTerminalLink 8
bDelay 1 frames
wFormatTag 0x0001 PCM
AudioStreaming Interface Descriptor:
bLength 11
bDescriptorType 36
bDescriptorSubtype 2 (FORMAT_TYPE)
bFormatType 1 (FORMAT_TYPE_I)
bNrChannels 1
bSubframeSize 2
bBitResolution 16
bSamFreqType 1 Discrete
tSamFreq[ 0] 44100
Endpoint Descriptor:
bLength 9
bDescriptorType 5
bEndpointAddress 0x86 EP 6 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x005c 1x 92 bytes
bInterval 4
bRefresh 0
bSynchAddress 0
AudioStreaming Endpoint Descriptor:
bLength 7
bDescriptorType 37
bDescriptorSubtype 1 (EP_GENERAL)
bmAttributes 0x01
Sampling Frequency
bLockDelayUnits 0 Undefined
wLockDelay 0x0000
(snip)

Based on the usb data about manufacturer, SPCA2281B3 is the most likely controller IC
Manufacturer does not provide link for datasheet nor detailed specs.
No way to confirm if the firmware supports any other way of getting the sample rate.

Testing patch provides consistent good sound recording quality and volume range.

(snip)
[ +0.045764] usb 5-1: new high-speed USB device number 2 using xhci_hcd
[ +0.106290] usb 5-1: New USB device found, idVendor=1bcf, idProduct=2283, bcdDevice=12.17
[ +0.000006] usb 5-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ +0.000004] usb 5-1: Product: NexiGo N930AF FHD Webcam
[ +0.000003] usb 5-1: Manufacturer: SHENZHEN AONI ELECTRONIC CO., LTD
[ +0.000004] usb 5-1: SerialNumber: 20201217011
[ +0.043700] usb 5-1: set resolution quirk: cval->res = 16
[ +0.002585] usb 5-1: Found UVC 1.00 device NexiGo N930AF FHD Webcam (1bcf:2283)

Signed-off-by: Christos Skevis <xristos.thes@gmail.com>
Link: https://lore.kernel.org/r/20231006155330.399393-1-xristos.thes@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 6a83d6f3 05-Oct-2023 WhaleChang <whalechang@google.com>

ALSA: usb-audio: Fix microphone sound on Opencomm2 Headset

When a Opencomm2 Headset is connected to a Bluetooth USB dongle,
the audio playback functions properly, but the microphone does not work.

In the dmesg logs, there are messages indicating that the init_pitch
function fails when the capture process begins.

The microphone only functions when the ep pitch control is not set.

Toggling the pitch control off bypasses the init_piatch function
and allows the microphone to work.

Signed-off-by: WhaleChang <whalechang@google.com>
Link: https://lore.kernel.org/r/20231006044852.4181022-1-whalechang@google.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f7fea075 26-Jul-2023 Jussi Laako <jussi@sonarnerd.net>

ALSA: usb-audio: Update for native DSD support quirks

Maintenance patch for native DSD support.

Remove incorrect T+A device quirks. Move set of device quirks to vendor
quirks. Add set of missing device and vendor quirks.

Signed-off-by: Jussi Laako <jussi@sonarnerd.net>
Link: https://lore.kernel.org/r/20230726165645.404311-1-jussi@sonarnerd.net
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 3da43506 25-Jul-2023 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Add quirk for Microsoft Modern Wireless Headset

Microsoft Modern Wireless Headset (appearing on the host as "Microsoft
USB Link") has a playback and a capture mixer volume/switch, but they
are fairly broken. The descriptor reports wrong dB ranges for
playback, and the capture volume/switch don't influence on the actual
recording at all. Moreover, there seem instabilities in the
connection, and at best, we should disable the runtime PM.

So this ended up with a quirk entry for:
- Correct the playback dB range;
I picked up some reasonable values but it's a guess work
- Disable the capture mixer;
it's completely useless and confuses PA/PW
- Suppress get-sample-rate, apply the delay for message handling,
and suppress the auto-suspend

The behavior of the wheel control on the headset is somehow flaky,
too, but it's an issue of HID.

Link: https://bugzilla.suse.com/show_bug.cgi?id=1207129
Link: https://lore.kernel.org/r/20230725092057.15115-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 122e2cb7 14-Jun-2023 Lukasz Tyl <ltyl@hem-e.com>

ALSA: usb-audio: Add quirk flag for HEM devices to enable native DSD playback

This commit adds new DEVICE_FLG with QUIRK_FLAG_DSD_RAW and Vendor Id for
HEM devices which supports native DSD. Prior to this change Linux kernel
was not enabling native DSD playback for HEM devices, and as a result,
DSD audio was being converted to PCM "on the fly". HEM devices,
when connected to the system, would only play audio in PCM format,
even if the source material was in DSD format. With the addition of new
VENDOR_FLG in the quircks.c file, the devices are now correctly
recognized, and raw DSD data is transmitted to the device,
allowing for native DSD playback.

Signed-off-by: Lukasz Tyl <ltyl@hem-e.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20230614122524.30271-1-ltyl@hem-e.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# ff49d1df 23-May-2023 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: USB MIDI 2.0 UMP support

This patch provides a basic support for USB MIDI 2.0. As of this
patch, the driver creates a UMP device per MIDI I/O endpoints, which
serves as a dumb terminal to read/write UMP streams.

A new Kconfig CONFIG_SND_USB_AUDIO_MIDI_V2 manages whether to enable
or disable the MIDI 2.0 support. Also, the driver provides a new
module option, midi2_enable, to allow disabling the MIDI 2.0 at
runtime, too. When MIDI 2.0 support is disabled, the driver tries to
fall back to the already existing MIDI 1.0 device (each MIDI 2.0
device is supposed to provide the MIDI 1.0 interface at the altset
0).

For now, the driver doesn't manage any MIDI-CI or other protocol
setups by itself, but relies on the default protocol given via the
group terminal block descriptors.

The MIDI 1.0 messages on MIDI 2.0 device will be automatically
converted in ALSA sequencer in a later patch. As of this commit, the
driver accepts merely the rawmidi UMP accesses.

The driver builds up the topology in the following way:
- Create an object for each MIDI endpoint belonging to the USB
interface
- Find MIDI EP "pairs" that share the same GTB;
note that MIDI EP is unidirectional, while UMP is (normally)
bidirectional, so two MIDI EPs can form a single UMP EP
- A UMP endpoint object is created for each I/O pair
- For remaining "solo" MIDI EPs, create unidirectional UMP EPs
- Finally, parse GTBs and fill the protocol bits on each UMP

So the driver may support multiple UMP Endpoints in theory, although
most devices are supposed to have a single UMP EP that can contain up
to 16 groups -- which should be large enough.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20230523075358.9672-10-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# bb1bf4fa 23-May-2023 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Manage number of rawmidis globally

We're going to create rawmidi objects for MIDI 2.0 in a different code
from the current code for USB-MIDI 1.0. As a preliminary work, this
patch adds the number of rawmidi objects to keep globally in a
USB-audio card instance, so that it can be referred from both MIDI 1.0
and 2.0 code.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20230523075358.9672-8-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# dfd5fe19 18-Jan-2023 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Add FIXED_RATE quirk for JBL Quantum610 Wireless

JBL Quantum610 Wireless (0ecb:205c) requires the same workaround that
was used for JBL Quantum810 for limiting the sample rate.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=216798
Link: https://lore.kernel.org/r/20230118165947.22317-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# fd28941c 15-Dec-2022 Jaroslav Kysela <perex@perex.cz>

ALSA: usb-audio: Add new quirk FIXED_RATE for JBL Quantum810 Wireless

It seems that the firmware is broken and does not accept
the UAC_EP_CS_ATTR_SAMPLE_RATE URB. There is only one rate (48000Hz)
available in the descriptors for the output endpoint.

Create a new quirk QUIRK_FLAG_FIXED_RATE to skip the rate setup
when only one rate is available (fixed).

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=216798
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20221215153037.1163786-1-perex@perex.cz
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 67df411d 29-Nov-2022 John Keeping <john@metanate.com>

ALSA: usb-audio: Add quirk for Tascam Model 12

Tascam's Model 12 is a mixer which can also operate as a USB audio
interface. The audio interface uses explicit feedback but it seems that
it does not correctly handle missing isochronous frames.

When injecting an xrun (or doing anything else that pauses the playback
stream) the feedback rate climbs (for example, at 44,100Hz nominal, I
see a stable rate around 44,099 but xrun injection sees this peak at
around 44,135 in most cases) and glitches are heard in the audio stream
for several seconds - this is significantly worse than the single glitch
expected for an underrun.

While the stream does normally recover and the feedback rate returns to
a stable value, I have seen some occurrences where this does not happen
and the rate continues to increase while no audio is heard from the
output. I have not found a solid reproduction for this.

This misbehaviour can be avoided by totally resetting the stream state
by switching the interface to alt 0 and back before restarting the
playback stream.

Add a new quirk flag which forces the endpoint and interface to be
reconfigured whenever the stream is stopped, and use this for the Tascam
Model 12.

Separate interfaces are used for the playback and capture endpoints, so
resetting the playback interface here will not affect the capture stream
if it is running. While there are two endpoints on the interface,
these are the OUT data endpoint and the IN explicit feedback endpoint
corresponding to it and these are always stopped and started together.

Signed-off-by: John Keeping <john@metanate.com>
Link: https://lore.kernel.org/r/20221129130100.1257904-1-john@metanate.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# bf990c10 09-Nov-2022 Ai Chao <aichao@kylinos.cn>

ALSA: usb-audio: add quirk to fix Hamedal C20 disconnect issue

For Hamedal C20, the current rate is different from the runtime rate,
snd_usb_endpoint stop and close endpoint to resetting rate.
if snd_usb_endpoint close the endpoint, sometimes usb will
disconnect the device.

Signed-off-by: Ai Chao <aichao@kylinos.cn>
Link: https://lore.kernel.org/r/20221110063452.295110-1-aichao@kylinos.cn
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 8cbd4725 08-Nov-2022 Jussi Laako <jussi@sonarnerd.net>

ALSA: usb-audio: Add DSD support for Accuphase DAC-60

Accuphase DAC-60 option card supports native DSD up to DSD256,
but doesn't have support for auto-detection. Explicitly enable
DSD support for the correct altsetting.

Signed-off-by: Jussi Laako <jussi@sonarnerd.net>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20221108221241.1220878-1-jussi@sonarnerd.net
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# ea83ec50 07-Nov-2022 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Remove redundant workaround for Roland quirk

The recent fix for the delayed card registration made the current
workaround for QUIRK_AUTODETECT superfluous, since the card
registration itself is delayed until the last interface probe.

This patch drops the redundant workaround in
create_autodetect_quirks() for simplification.

Fixes: 39efc9c8a973 ("ALSA: usb-audio: Fix last interface check for registration")
Link: https://bugzilla.suse.com/show_bug.cgi?id=1205111
Link: https://lore.kernel.org/r/20221108065824.14418-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 6392dcd1 04-Sep-2022 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Register card at the last interface

The USB-audio driver matches per interface, and as default, it
registers the card instance at the very first instance. This can be a
problem for the devices that have multiple interfaces to be probed, as
the udev rule isn't applied properly for the later appearing
interfaces. Although we introduced the delayed_register option and
the quirks for covering those shortcomings, it's nothing but a
workaround for specific devices.

This patch is an another attempt to fix the problem in a more generic
way. Now the driver checks the whole USB device descriptor at the
very first time when an interface is attached to a sound card. It
looks at each matching interface in the descriptor and remembers the
last matching one. The snd_card_register() is invoked only when this
last interface is probed.

After this change, the quirks for the delayed registration become
superfluous, hence they are removed along with the patch. OTOH, the
delayed_register option is still kept, as it might be useful for some
corner cases (e.g. a special driver overtakes the interface probe from
the standard driver, and the last interface probe may miss).

Link: https://lore.kernel.org/r/20220904161247.16461-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b01104fc 18-Aug-2022 Conner Knox <connerknoxpublic@gmail.com>

ALSA: usb-audio: Add quirk to enable Avid Mbox 3 support

Add support for Avid Mbox3 USB audio interface at 48kHz

Signed-off-by: Conner Knox <connerknoxpublic@gmail.com>
Link: https://lore.kernel.org/r/20220818201433.16360-1-mbarriolinares@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2027f114 31-Aug-2022 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Register card again for iface over delayed_register option

When the delayed registration is specified via either delayed_register
option or the quirk, we delay the invocation of snd_card_register()
until the given interface. But if a wrong value has been set there
and there are more interfaces over the given interface number,
snd_card_register() call would be missing for those interfaces.

This patch catches up those missing calls by fixing the comparison of
the interface number. Now the call is skipped only if the processed
interface is less than the given interface, instead of the exact
match.

Fixes: b70038ef4fea ("ALSA: usb-audio: Add delayed_register option")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=216082
Link: https://lore.kernel.org/r/20220831125901.4660-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 5f3d9e81 28-Aug-2022 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Add quirk for LH Labs Geek Out HD Audio 1V5

The USB DAC from LH Labs (2522:0007) seems requiring the same quirk as
Sony Walkman to set up the interface like UAC1; otherwise it gets the
constant errors "usb_set_interface failed (-71)". This patch adds a
quirk entry for addressing the buggy behavior.

Reported-by: Lennert Van Alboom <lennert@vanalboom.org>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/T3VPXtCc4uFws9Gfh2RjX6OdwM1RqfC6VqQr--_LMDyB2x5N3p9_q6AtPna17IXhHwBtcJVdXuS80ZZSCMjh_BafIbnzJPhbrkmhmWS6DlI=@vanalboom.org
Link: https://lore.kernel.org/r/20220828074143.14736-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e086c37f 22-Jul-2022 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Add quirk for Behringer UMC202HD

Just like other Behringer models, UMC202HD (USB ID 1397:0507) requires
the quirk for the stable streaming, too.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=215934
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220722143948.29804-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2307a0e1 27-Jun-2022 Egor Vorontsov <sdoregor@sdore.me>

ALSA: usb-audio: Add quirk for Fiero SC-01 (fw v1.0.0)

The patch applies the same quirks used for SC-01 at firmware v1.1.0 to
the ones running v1.0.0, with respect to hard-coded sample rates.

I got two more units and successfully tested the patch series with both
firmwares.

The support is now complete (not accounting ASIO).

Signed-off-by: Egor Vorontsov <sdoregor@sdore.me>
Link: https://lore.kernel.org/r/20220627100041.2861494-2-sdoregor@sdore.me
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 4fb7c24f 27-Jun-2022 Egor Vorontsov <sdoregor@sdore.me>

ALSA: usb-audio: Add quirk for Fiero SC-01

Fiero SC-01 is a USB sound card with two mono inputs and a single
stereo output. The inputs are composed into a single stereo stream.

The device uses a vendor-provided driver on Windows and does not work
at all without it. The driver mostly provides ASIO functionality, but
also alters the way the sound card is queried for sample rates and
clocks.

ALSA queries those failing with an EPIPE (same as Windows 10 does).
Presumably, the vendor-provided driver does not query it at all, simply
matching by VID:PID. Thus, I consider this a buggy firmware and adhere
to a set of fixed endpoint quirks instead.

The soundcard has an internal clock. Implicit feedback mode is required
for the playback.

I have updated my device to v1.1.0 from a Windows 10 VM using a vendor-
provided binary prior to the development, hoping for it to just begin
working. The device provides no obvious way to downgrade the firmware,
and regardless, there's no binary available for v1.0.0 anyway.

Thus, I will be getting another unit to extend the patch with support
for that. Expected to be a simple copy-paste of the existing one,
though.

There were no previous reports of that device in context of Linux
anywhere. Other issues have been reported though, but that's out of the
scope.

Signed-off-by: Egor Vorontsov <sdoregor@sdore.me>
Link: https://lore.kernel.org/r/20220627100041.2861494-1-sdoregor@sdore.me
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 6e2c9105 24-Jun-2022 John Veness <john-linux@pelago.org.uk>

ALSA: usb-audio: Add quirks for MacroSilicon MS2100/MS2106 devices

Treat the claimed 96kHz 1ch in the descriptors as 48kHz 2ch, so that
the audio stream doesn't sound mono. Also fix initial stream
alignment, so that left and right channels are in the correct order.

Signed-off-by: John Veness <john-linux@pelago.org.uk>
Link: https://lore.kernel.org/r/20220624140757.28758-1-john-linux@pelago.org.uk
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# ae8b1631 23-Jun-2022 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Workarounds for Behringer UMC 204/404 HD

Both Behringer UMC 202 HD and 404 HD need explicit quirks to enable
the implicit feedback mode and start the playback stream primarily.
The former seems fixing the stuttering and the latter is required for
a playback-only case.

Note that the "clock source 41 is not valid" error message still
appears even after this fix, but it should be only once at probe.
The reason of the error is still unknown, but this seems to be mostly
harmless as it's a one-off error and the driver retires the clock
setup and it succeeds afterwards.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=215934
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20220624101132.14528-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 67d64069 21-Apr-2022 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Move generic implicit fb quirk entries into quirks.c

Use the new quirk bits to manage the generic implicit fb quirk
entries. This makes easier to compare with other devices.

Link: https://lore.kernel.org/r/20220421064101.12456-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# d7be2138 03-May-2022 Forest Crossman <cyrozap@gmail.com>

ALSA: usb-audio: Don't get sample rate for MCT Trigger 5 USB-to-HDMI

This device doesn't support reading the sample rate, so we need to apply
this quirk to avoid a 15-second delay waiting for three timeouts.

Signed-off-by: Forest Crossman <cyrozap@gmail.com>
Link: https://lore.kernel.org/r/20220504002444.114011-2-cyrozap@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 1e583aef 02-Dec-2021 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Drop superfluous '0' in Presonus Studio 1810c's ID

The vendor ID of Presonus Studio 1810c had a superfluous '0' in its
USB ID. Drop it.

Fixes: 8dc5efe3d17c ("ALSA: usb-audio: Add support for Presonus Studio 1810c")
Link: https://lore.kernel.org/r/20211202083833.17784-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# df0380b9 02-Nov-2021 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Add quirk for Audient iD14

Audient iD14 (2708:0002) may get a control message error that
interferes the operation e.g. with alsactl. Add the quirk to ignore
such errors like other devices.

BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1191247
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20211102161859.19301-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 763d92ed 30-Oct-2021 Alexander Tsoy <alexander@tsoy.me>

ALSA: usb-audio: Add registration quirk for JBL Quantum 400

Add another device ID for JBL Quantum 400. It requires the same quirk as
other JBL Quantum devices.

Signed-off-by: Alexander Tsoy <alexander@tsoy.me>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20211030174308.1011825-1-alexander@tsoy.me
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 29664923 18-Oct-2021 Marco Giunta <giun7a@gmail.com>

ALSA: usb-audio: Fix microphone sound on Jieli webcam.

When a Jieli Technology USB Webcam is connected, the video part works
well, but the mic sound is speeded up. On dmesg there are messages
about different rates from the runtime rates, warnings about volume
resolution and lastly, the log is filled, every 5 seconds, with
retire_capture_urb error messages.

The mic works only when ep packet size is set to wMaxPacketSize (normal
sound and no more retire_capture_urb error messages). Skipping reading
sample rate, fixes the messages about different rates and forcing a volume
resolution, fixes warnings about volume range. I have arbitrarily choosed
the value (16): I read in a comment that there should be no more than 255
levels, so 4096 (max volume) / 16 = 0-255.

Signed-off-by: Marco Giunta <giun7a@gmail.com>
Link: https://lore.kernel.org/r/20211018162552.12082-1-giun7a@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 22390ce7 14-Oct-2021 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: usb-audio: add Schiit Hel device to quirk table

The Shciit Hel device responds to the ctl message for the mic capture
switch with a timeout of -EPIPE:

usb 7-2.2: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x1100, type = 1
usb 7-2.2: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x1100, type = 1
usb 7-2.2: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x1100, type = 1
usb 7-2.2: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x1100, type = 1

This seems safe to ignore as the device works properly with the control
message quirk, so add it to the quirk table so all is good.

Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: alsa-devel@alsa-project.org
Cc: linux-usb@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/YWgR3nOI1osvr5Yo@kroah.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 5963e526 04-Oct-2021 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Enable rate validation for Scarlett devices

The Scarlett device series from Focusrite Novation seem requiring the
sample rate validations as we've done for MOTU devices; otherwise the
driver probes invalid audioformat entries that contain the sample
rates that actually don't work, and this may result in an incomplete
setup as reported recently.

This patch adds the needed quirk flag for enabling the sample rate
validation for Focusrite Novation devices.

Fixes: fe773b8711e3 ("ALSA: usb-audio: workaround for iface reset issue")
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=214493
Link: https://lore.kernel.org/r/20211004074050.28241-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# c8b177b6 30-Aug-2021 Alexander Tsoy <alexander@tsoy.me>

ALSA: usb-audio: Add registration quirk for JBL Quantum 800

Add another device ID for JBL Quantum 800. It requires the same quirk as
other JBL Quantum devices.

Signed-off-by: Alexander Tsoy <alexander@tsoy.me>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210831002531.116957-1-alexander@tsoy.me
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 6e413409 23-Aug-2021 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Move set-interface-first workaround into common quirk

The recent quirk for WALKMAN (commit 7af5a14371c1: "ALSA: usb-audio:
Fix regression on Sony WALKMAN NW-A45 DAC") may be required for other
devices and is worth to be put into the common quirk flags.
This patch adds a new quirk flag bit QUIRK_FLAG_SET_IFACE_FIRST and a
quirk table entry for the device.

Link: https://lore.kernel.org/r/20210824055720.9240-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 68e851ee 29-Jul-2021 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Move generic DSD raw detection into quirk_flags

The generic DSD raw detection is based on the known allow list, and we
can integrate it into quirk_flags, too.

Link: https://lore.kernel.org/r/20210729074404.19728-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 3c69dc91 29-Jul-2021 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Move ignore_ctl_error check into quirk_flags

The mixer code has a flag ignore_ctl_error for ignoring the errors
returned from the device wrt mixer accesses, and this is set from the
entries in mixer_maps.c, as well as ignore_ctl_error module option.
Those can be well integrated into the new quirk_flags field, too.

Link: https://lore.kernel.org/r/20210729074404.19728-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 44e6fc64 29-Jul-2021 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Move autosuspend quirk into quirk_flags

The auto-suspend suppression workaround for Lenovo machines are
handled in quirks-table.h. Now it's more easier to handle with
quirk_flags.

Link: https://lore.kernel.org/r/20210729074404.19728-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 8bfe17ad 29-Jul-2021 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Move rate validation quirk into quirk_flags

The rate validation at the device probe is applied only to the
specific devices (currently only for MOTU devices), and this check can
be moved to quirk_flags gracefully, too.

Link: https://lore.kernel.org/r/20210729074404.19728-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 1f074fe5 29-Jul-2021 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Move interface setup delay into quirk_flags

Yet another delay is applied at switching the interface. This can be
moved to quirk_flags, too.

Link: https://lore.kernel.org/r/20210729073855.19043-10-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f7483854 29-Jul-2021 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Move control message delay quirk into quirk_flags

We apply some delay for the control messages on certain devices as a
workaround, and this can be moved into the quirk_flags as well.
Currently there are three different delay periods (1ms, 5ms and 20ms),
so three different quirk bits are assigned for them.

Link: https://lore.kernel.org/r/20210729073855.19043-9-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2de00d5a 29-Jul-2021 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Move ITF-USB DSD quirk handling into quirk_flags

The devices with ITF-USB DSD type are listed in another function, and
this can be integrated into the quirk_flags easily.

Link: https://lore.kernel.org/r/20210729073855.19043-8-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f21dca85 29-Jul-2021 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Move clock setup quirk into quirk_flags

There are a couple of device-specific quirks in the clock setup code,
and those can be moved gracefully to quirk_flags, too.

Link: https://lore.kernel.org/r/20210729073855.19043-7-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# c1b034a4 29-Jul-2021 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Move tx_length quirk handling to quirk_flags

There is another quirk for the transfer, and that's currently specific
to Zoom R16/24, handled in create_standard_audio_quirk(). Let's move
this also to the new quirk_flags.

Link: https://lore.kernel.org/r/20210729073855.19043-5-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# af158a7f 29-Jul-2021 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Move txfr_quirk handling to quirk_flags

The txfr_quirk field was meant for aligning the transfer, and it's set
for certain devices in quirks-table.h. Now we can move that stuff
also to the new quirk_flags gracefully, and reduce the quirks-table.h
entries (that are exposed to module device table).

As the quirks-table.h entries are also with the name string override,
provide the corresponding entries to the usb_audio_names[] table,
too.

Link: https://lore.kernel.org/r/20210729073855.19043-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# ce47d47e 29-Jul-2021 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Move media-controller API quirk into quirk_flags

The devices that can have media-controller API entries are currently
specified via tables in quirks-table.h, as a part of descriptor
override. This can fit better to the new quirk_flags, as we just need
a matching with the given ID and create the MC entries accordingly.

Link: https://lore.kernel.org/r/20210729073855.19043-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 4d4dee0a 29-Jul-2021 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Introduce quirk_flags field

As more and more device-specific workarounds came up and gathered in
various places, it becomes harder to manage. Now it's time to clean
up and collect workarounds more consistently and make them more easily
applicable.

This patch is the first step for that: a new field quirk_flags is
introduced in snd_usb_audio struct to contain the bit flags for
various device-specific quirks. Those are separate one from the
quirks in quirks-table.h; the quirks-table.h entries are for more
intrusive stuff that needs the descriptor override, while the new
quirk_flags is for easier ones that are tied with the vendor:product
IDs.

In this patch, as the first example, we convert the list of devices
and vendors to ignore GET_SAMPLE_RATE, formerly defined in
snb_usb_get_sample_rate_quirk().

Link: https://lore.kernel.org/r/20210729073855.19043-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 4b0556b9 26-Jul-2021 Alexander Tsoy <alexander@tsoy.me>

ALSA: usb-audio: Add registration quirk for JBL Quantum 600

Apparently JBL Quantum 600 has multiple hardware revisions. Apply
registration quirk to another device id as well.

Signed-off-by: Alexander Tsoy <alexander@tsoy.me>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210727093326.1153366-1-alexander@tsoy.me
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b0084afd 21-Jul-2021 Alexander Tsoy <alexander@tsoy.me>

ALSA: usb-audio: Add registration quirk for JBL Quantum headsets

These devices has two interfaces, but only the second interface
contains the capture endpoint, thus quirk is required to delay the
registration until the second interface appears.

Tested-by: Jakub Fišer <jakub@ufiseru.cz>
Signed-off-by: Alexander Tsoy <alexander@tsoy.me>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210721235605.53741-1-alexander@tsoy.me
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e7df7df5 18-Apr-2021 Olivia Mackintosh <livvy@base.nu>

ALSA: usb-audio: DJM-750: ensure format is set

Add case statement to set sample-rate for the DJM-750 Pioneer
mixer. This was included as part of another patch but I think it has
been archived on Patchwork and hasn't been merged.

Signed-off-by: Olivia Mackintosh <livvy@base.nu>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210418165901.25776-1-livvy@base.nu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 5fb45414 06-Apr-2021 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Add error checks for usb_driver_claim_interface() calls

There are a few calls of usb_driver_claim_interface() but all of those
miss the proper error checks, as reported by Coverity. This patch
adds those missing checks.

Along with it, replace the magic pointer with -1 with a constant
USB_AUDIO_IFACE_UNUSED for better readability.

Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1475943 ("Error handling issues")
Addresses-Coverity-ID: 1475944 ("Error handling issues")
Addresses-Coverity-ID: 1475945 ("Error handling issues")
Fixes: b1ce7ba619d9 ("ALSA: usb-audio: claim autodetected PCM interfaces all at once")
Fixes: e5779998bf8b ("ALSA: usb-audio: refactor code")
Link: https://lore.kernel.org/r/202104051059.FB7F3016@keescook
Link: https://lore.kernel.org/r/20210406113534.30455-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 1a2a94a4 01-Mar-2021 Nicolas MURE <nicolas.mure2019@gmail.com>

ALSA: usb-audio: Configure Pioneer DJM-850 samplerate

Send an `URB_CONTROL out` USB frame to the device to configure its
samplerate. This should be done before using the device for audio
streaming (capture or playback).

See https://github.com/nm2107/Pioneer-DJM-850-driver-reverse-engineering/blob/172fb9a61055960c88c67b7c416fe5bf3609807b/doc/windows-dvs/framerate-setting/README.md

Signed-off-by: Nicolas MURE <nicolas.mure2019@gmail.com>
Link: https://lore.kernel.org/r/20210301152729.18094-4-nicolas.mure2019@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 625bd5a6 24-Mar-2021 Ikjoon Jang <ikjn@chromium.org>

ALSA: usb-audio: Apply sample rate quirk to Logitech Connect

Logitech ConferenceCam Connect is a compound USB device with UVC and
UAC. Not 100% reproducible but sometimes it keeps responding STALL to
every control transfer once it receives get_freq request.

This patch adds 046d:0x084c to a snd_usb_get_sample_rate_quirk list.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203419
Signed-off-by: Ikjoon Jang <ikjn@chromium.org>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210324105153.2322881-1-ikjn@chromium.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 06abcb18 04-Mar-2021 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Apply the control quirk to Plantronics headsets

Other Plantronics headset models seem requiring the same workaround as
C320-M to add the 20ms delay for the control messages, too. Apply the
workaround generically for devices with the vendor ID 0x047f.

Note that the problem didn't surface before 5.11 just with luck.
Since 5.11 got a big code rewrite about the stream handling, the
parameter setup procedure has changed, and this seemed triggering the
problem more often.

BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1182552
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210304085009.4770-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# fec60c3b 04-Mar-2021 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Fix "cannot get freq eq" errors on Dell AE515 sound bar

Dell AE515 sound bar (413c:a506) spews the error messages when the
driver tries to read the current sample frequency, hence it needs to
be on the list in snd_usb_get_sample_rate_quirk().

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=211551
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210304083021.2152-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 97991108 03-Mar-2021 Kai-Heng Feng <kai.heng.feng@canonical.com>

ALSA: usb-audio: Disable USB autosuspend properly in setup_disable_autosuspend()

Rear audio on Lenovo ThinkStation P620 stops working after commit
1965c4364bdd ("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: 1965c4364bdd ("ALSA: usb-audio: Disable autosuspend for Lenovo ThinkStation P620")
Signed-off-by: Kai-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: Takashi Iwai <tiwai@suse.de>


# fc7c5c20 03-Mar-2021 John Ernberg <john.ernberg@actia.se>

ALSA: usb: Add Plantronics C320-M USB ctrl msg delay quirk

The microphone in the Plantronics C320-M headset will randomly
fail to initialize properly, at least when using Microsoft Teams.
Introducing a 20ms delay on the control messages appears to
resolve the issue.

Link: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1065
Tested-by: Andreas Kempe <kempe@lysator.liu.se>
Signed-off-by: John Ernberg <john.ernberg@actia.se>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210303181405.39835-1-john.ernberg@actia.se
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2c911900 01-Mar-2021 Nicolas MURE <nicolas.mure2019@gmail.com>

ALSA: usb-audio: Fix Pioneer DJM devices URB_CONTROL request direction to set samplerate

This commit only contains the fix about the `URB_CONTROL` request
direction to set the samplerate of Pioneer DJM devices (`URB_CONTROL out`).

Fixes: 3b85f5fc75d5 ("ALSA: usb-audio: Add DJM450 to Pioneer format quirk")
Signed-off-by: Nicolas MURE <nicolas.mure2019@gmail.com>
Link: https://lore.kernel.org/r/20210301142927.14552-1-nicolas.mure2019@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 3b85f5fc 02-Feb-2021 Olivia Mackintosh <livvy@base.nu>

ALSA: usb-audio: Add DJM450 to Pioneer format quirk

Like the DJM-750, ensure that the format control message is passed to
the device when opening a stream. It seems as though fmt->sync_ep is not
always set when this function is called hence the passing of the value
at the call site. If this can be fixed, fmt->sync_up should be used as
the wvalue.

There doesn't seem to be a "cpu_to_le24" type function defined hence for
the open code but I did see a similar thing done in Bluez lib. Perhaps
we can get these definitions defined in byteorder.h. See hci_cpu_to_le24
in include/net/bluetooth/hci.h:2543 for similar usage.

Signed-off-by: Olivia Mackintosh <livvy@base.nu>
Link: https://lore.kernel.org/r/20210202134225.3217-2-livvy@base.nu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 87cb9af9 18-Jan-2021 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Fix UAC1 rate setup for secondary endpoints

The current sample rate setup function for UAC1 assumes only the first
endpoint retrieved from the interface:altset pair, but the rate set up
may be needed also for the secondary endpoint. Also, retrieving the
endpoint number from the interface descriptor is redundant; we have
already the target endpoint in the given audioformat object.

This patch simplifies the code and corrects the target endpoint as
described in the above. It simply refers to fmt->endpoint directly.

Also, this patch drops the pioneer_djm_set_format_quirk() that is
caleld from snd_usb_set_format_quirk(); this function does the sample
rate setup but for the capture endpoint (0x82), and that's exactly
what the change above fixes.

Link: https://lore.kernel.org/r/20210118075816.25068-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# eae4d054 08-Jan-2021 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Annotate the endpoint index in audioformat

There are devices that have multiple endpoints sharing the same
iface/altset not only for sync but also for the actual streams, and
the audioformat for such an endpoint needs to be handled with the
proper endpoint index; otherwise it confuses the endpoint management.

This patch extends the audioformat to annotate the endpoint index, and
put the proper ep_idx=1 to Pioneer device quirk entries accordingly.

Fixes: bf6313a0ff76 ("ALSA: usb-audio: Refactor endpoint management")
Link: https://lore.kernel.org/r/20210108075219.21463-5-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b2345a8a 08-Jan-2021 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Fix the missing endpoints creations for quirks

The recent change in the endpoint management moved the endpoint object
creation from the stream open time to the parser of the audio
descriptor. It works fine for the standard audio, but it overlooked
the other places that create audio streams via quirks
(QUIRK_AUDIO_FIXED_ENDPOINT) like the reported a few Pioneer devices;
those call snd_usb_add_audio_stream() manually, hence they miss the
endpoints, eventually resulting in the error at opening streams.
Moreover, now the sync EP setup was moved to the explicit call of
snd_usb_audioformat_set_sync_ep(), and this needs to be added for
those places, too.

This patch addresses those regressions for quirks. It adds a local
helper function add_audio_stream_from_fixed_fmt(), which does the all
needed tasks, and replaces the calls of snd_usb_add_audio_stream()
with this new function.

Fixes: 54cb31901b83 ("ALSA: usb-audio: Create endpoint objects at parsing phase")
Reported-by: František Kučera <konference@frantovo.cz>
Link: https://lore.kernel.org/r/20210108075219.21463-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 725124d1 15-Dec-2020 Amadej Kastelic <amadejkastelic7@gmail.com>

ALSA: usb-audio: Add VID to support native DSD reproduction on FiiO devices

Add VID to support native DSD reproduction on FiiO devices.

Tested-by: Amadej Kastelic <amadejkastelic7@gmail.com>
Signed-off-by: Emilio Moretti <emilio.moretti@gmail.com>
Signed-off-by: Amadej Kastelic <amadejkastelic7@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/X9j7wdXSr4XyK7Bd@ryzen.localdomain
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 29b105d9 23-Nov-2020 Dylan Robinson <dylan_robinson@motu.com>

ALSA: usb-audio: Fix MOTU M-Series quirks

Now that the usb audio driver correctly finds implicit feedback endpoints,
the implicit feedback quirk for the MOTU M-Series is no longer required.

This also removes some unnecessary vendor specific messages from the MOTU
M-Series boot quirk. The removed vendor specific messages turned on vendor
specific interrupts to the host every 32 samples. The only thing the boot
quirk needs to do is wait for 2 seconds.

Tested-by: Dylan Robinson <dylan_robinson@motu.com>
Signed-off-by: Dylan Robinson <dylan_robinson@motu.com>
Link: https://lore.kernel.org/r/20201123085347.19667-42-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 6aa719d1 23-Nov-2020 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Drop unneeded snd_usb_substream fields

Some fields like interface and alt_idx in snd_usb_substream are mostly
useless now as they can be referred via either cur_audiofmt or
data_endpoint assigned to the substream. Drop those, and also assure
the concurrency about the access of cur_audiofmt field.

Tested-by: Keith Milner <kamilner@superlative.org>
Tested-by: Dylan Robinson <dylan_robinson@motu.com>
Link: https://lore.kernel.org/r/20201123085347.19667-31-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# cab941b7 23-Nov-2020 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Constify audioformat pointer references

The audioformat is referred in many places but most of usages are
read-only. Let's add const prefix in the possible places.

Tested-by: Keith Milner <kamilner@superlative.org>
Tested-by: Dylan Robinson <dylan_robinson@motu.com>
Link: https://lore.kernel.org/r/20201123085347.19667-28-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 75c16b51 23-Nov-2020 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Always set up the parameters after resume

The commit 92adc96f8eec ("ALSA: usb-audio: set the interface format
after resume on Dell WD19") introduced the workaround for the broken
setup after the resume specifically on a Dell dock model. However,
the full setup should have been performed after the resume on all
devices, as we can't guarantee the same state. So this patch removes
the conditional check and applies the workaround always.

Tested-by: Keith Milner <kamilner@superlative.org>
Tested-by: Dylan Robinson <dylan_robinson@motu.com>
Link: https://lore.kernel.org/r/20201123085347.19667-24-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 73037c8d 23-Nov-2020 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Simplify snd_usb_init_pitch() arguments

A preliminary change for the later big changes. This is a minor code
refactoring to drop the unnecessary arguments that can be retrieved in
a different way.

Tested-by: Keith Milner <kamilner@superlative.org>
Tested-by: Dylan Robinson <dylan_robinson@motu.com>
Link: https://lore.kernel.org/r/20201123085347.19667-21-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 953a446b 23-Nov-2020 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Simplify snd_usb_init_sample_rate() arguments

A preliminary change for the later big changes. This is a minor code
refactoring to drop the unnecessary arguments that can be retrieved in
a different way.

Tested-by: Keith Milner <kamilner@superlative.org>
Tested-by: Dylan Robinson <dylan_robinson@motu.com>
Link: https://lore.kernel.org/r/20201123085347.19667-20-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# d767aba2 23-Nov-2020 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Pass snd_usb_audio object to quirk functions

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>


# 54a2a389 17-Nov-2020 Joakim Tjernlund <joakim.tjernlund@infinera.com>

ALSA: usb-audio: Add delay quirk for all Logitech USB devices

Found one more Logitech device, BCC950 ConferenceCam, which needs
the same delay here. This makes 3 out of 3 devices I have tried.

Therefore, add a delay for all Logitech devices as it does not hurt.

Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
Cc: <stable@vger.kernel.org> # 4.19.y, 5.4.y
Link: https://lore.kernel.org/r/20201117122803.24310-1-joakim.tjernlund@infinera.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 07815a2b 03-Nov-2020 Artem Lapkin <art@khadas.com>

ALSA: usb-audio: add usb vendor id as DSD-capable for Khadas devices

Khadas audio devices ( USB_ID_VENDOR 0x3353 )
have DSD-capable implementations from XMOS
need add new usb vendor id for recognition

Signed-off-by: Artem Lapkin <art@khadas.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20201103103311.5435-1-art@khadas.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 315c7ad7 10-Sep-2020 Joakim Tjernlund <joakim.tjernlund@infinera.com>

ALSA: usb-audio: Add delay quirk for H570e USB headsets

Needs the same delay as H650e

Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20200910085328.19188-1-joakim.tjernlund@infinera.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 4f6d57e4 14-Sep-2020 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

ALSA: remove calls to usb_pipe_type_check for control endpoints

A USB device will always haev a bi-directional endpoint 0, that's just
how the devices work, so no need to check for that in a few quirk tests
as it will always pass.

Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Alexander Tsoy <alexander@tsoy.me>
Reported-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/20200914153756.3412156-12-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# fcc2cc1f 14-Sep-2020 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

USB: move snd_usb_pipe_sanity_check into the USB core

snd_usb_pipe_sanity_check() is a great function, so let's move it into
the USB core so that other parts of the kernel, including the USB core,
can call it.

Name it usb_pipe_type_check() to match the existing
usb_urb_ep_type_check() call, which now uses this function.

Cc: Jaroslav Kysela <perex@perex.cz>
Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: Eli Billauer <eli.billauer@gmail.com>
Cc: Emiliano Ingrassia <ingrassia@epigenesys.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Alexander Tsoy <alexander@tsoy.me>
Cc: "Geoffrey D. Bennett" <g@b4.vu>
Cc: Jussi Laako <jussi@sonarnerd.net>
Cc: Nick Kossifidis <mickflemm@gmail.com>
Cc: Dmitry Panchenko <dmitry@d-systems.ee>
Cc: Chris Wulff <crwulff@gmail.com>
Cc: Jesus Ramos <jesus-ramos@live.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20200914153756.3412156-2-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 14335d8b 25-Aug-2020 František Kučera <franta-linux@frantovo.cz>

ALSA: usb-audio: Add basic capture support for Pioneer DJ DJM-250MK2

This patch extends support for DJM-250MK2 and allows recording.
However, DVS is not possible yet (see the comment in code).

Signed-off-by: František Kučera <franta-linux@frantovo.cz>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200825153113.6352-1-konference@frantovo.cz
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 1965c436 23-Aug-2020 Kai-Heng Feng <kai.heng.feng@canonical.com>

ALSA: usb-audio: Disable autosuspend for Lenovo ThinkStation P620

If USB autosuspend is enabled, both front and rear panel can no longer
detect jack insertion.

Enable USB remote wakeup, i.e. needs_remote_wakeup = 1, doesn't help
either.

So disable USB autosuspend to prevent missing jack detection event.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Link: https://lore.kernel.org/r/20200823105854.26950-1-kai.heng.feng@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 1b7ecc24 10-Aug-2020 Hector Martin <marcan@marcan.st>

ALSA: usb-audio: work around streaming quirk for MacroSilicon MS2109

Further investigation of the L-R swap problem on the MS2109 reveals that
the problem isn't that the channels are swapped, but rather that they
are swapped and also out of phase by one sample. In other words, the
issue is actually that the very first frame that comes from the hardware
is a half-frame containing only the right channel, and after that
everything becomes offset.

So introduce a new quirk field to drop the very first 2 bytes that come
in after the format is configured and a capture stream starts. This puts
the channels in phase and in the correct order.

Cc: stable@vger.kernel.org
Signed-off-by: Hector Martin <marcan@marcan.st>
Link: https://lore.kernel.org/r/20200810082400.225858-1-marcan@marcan.st
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 5ff40e6d 28-Jun-2020 Alexander Tsoy <alexander@tsoy.me>

ALSA: usb-audio: Fix some typos

Fix the following typos in comments and in the code:
- KHz -> kHz
- procssed -> processed

Signed-off-by: Alexander Tsoy <alexander@tsoy.me>
Link: https://lore.kernel.org/r/20200629032607.255419-1-alexander@tsoy.me
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a32a1fc9 23-Jun-2020 Macpaul Lin <macpaul.lin@mediatek.com>

ALSA: usb-audio: add quirk for Samsung USBC Headset (AKG)

We've found Samsung USBC Headset (AKG) (VID: 0x04e8, PID: 0xa051)
need a tiny delay after each class compliant request.
Otherwise the device might not be able to be recognized each times.

Signed-off-by: Chihhao Chen <chihhao.chen@mediatek.com>
Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/1592910203-24035-1-git-send-email-macpaul.lin@mediatek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 73094608 19-Jun-2020 Christoffer Nielsen <cn@obviux.dk>

ALSA: usb-audio: Add registration quirk for Kingston HyperX Cloud Flight S

Similar to the Kingston HyperX AMP, the Kingston HyperX Cloud
Alpha S (0951:0x16ea) uses two interfaces, but only the second
interface contains the capture stream. This patch delays the
registration until the second interface appears.

Signed-off-by: Christoffer Nielsen <cn@obviux.dk>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/CAOtG2YHOM3zy+ed9KS-J4HkZo_QGzcUG9MigSp4e4_-13r6B=Q@mail.gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# c9808bbf 13-Jun-2020 Yick W. Tse <y_w_tse@yahoo.com.hk>

ALSA: usb-audio: add quirk for Denon DCD-1500RE

fix error "clock source 41 is not valid, cannot use"

[] New USB device found, idVendor=154e, idProduct=1002, bcdDevice= 1.00
[] New USB device strings: Mfr=1, Product=2, SerialNumber=0
[] Product: DCD-1500RE
[] Manufacturer: D & M Holdings Inc.
[]
[] clock source 41 is not valid, cannot use
[] usbcore: registered new interface driver snd-usb-audio

Signed-off-by: Yick W. Tse <y_w_tse@yahoo.com.hk>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/1373857985.210365.1592048406997@mail.yahoo.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 7fccfecf 01-Jun-2020 Dmitry Panchenko <dmitry@d-systems.ee>

ALSA: usb-audio: Add Pioneer DJ DJM-900NXS2 support

Pioneer DJ DJM-900NXS2 is a widely used DJ mixer with 2 audio USB
interfaces. Both have a MIDI controller, 10 playback and 12 capture
channels. Audio endpoints are vendor-specific and 3 files need to be
patched. All playback and capture channels work fine with all supported
sample rates (44.1k, 48k, 96k). Patches are attached.

Signed-off-by: Dmitry Panchenko <dmitry@d-systems.ee>
Link: https://lore.kernel.org/r/48ab19ff-3303-9bf8-ed0e-bcb31d8537eb@d-systems.ee
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 073919e0 27-Apr-2020 Jesus Ramos <jesus-ramos@live.com>

ALSA: usb-audio: Add control message quirk delay for Kingston HyperX headset

Kingston HyperX headset with 0951:16ad also needs the same quirk for
delaying the frequency controls.

Signed-off-by: Jesus Ramos <jesus-ramos@live.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/BY5PR19MB3634BA68C7CCA23D8DF428E796AF0@BY5PR19MB3634.namprd19.prod.outlook.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 547d2c9c 30-Apr-2020 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Correct a typo of NuPrime DAC-10 USB ID

The USB vendor ID of NuPrime DAC-10 is not 16b0 but 16d0.

Fixes: f656891c6619 ("ALSA: usb-audio: add more quirks for DSD interfaces")
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200430124755.15940-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 04c96460 23-Apr-2020 Alexander Tsoy <alexander@tsoy.me>

ALSA: usb-audio: Remove async workaround for Scarlett 2nd gen

Frame size computation has been fixed and the workaround is no longer
needed.

Signed-off-by: Alexander Tsoy <alexander@tsoy.me>
Link: https://lore.kernel.org/r/20200424022449.14972-2-alexander@tsoy.me
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# cf9fb7b8 21-Apr-2020 Alexander Tsoy <alexander@tsoy.me>

ALSA: usb-audio: Apply async workaround for Scarlett 2i4 2nd gen

Due to rounding error driver sometimes incorrectly calculate next packet
size, which results in audible clicks on devices with synchronous playback
endpoints. For example on a high speed bus and a sample rate 44.1 kHz it
loses one sample every ~40.9 seconds. Fortunately playback interface on
Scarlett 2i4 2nd gen has a working explicit feedback endpoint, so we can
switch playback data endpoint to asynchronous mode as a workaround.

Signed-off-by: Alexander Tsoy <alexander@tsoy.me>
Link: https://lore.kernel.org/r/20200421190908.462860-1-alexander@tsoy.me
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 6f4ea207 20-Apr-2020 Gregor Pintar <grpintar@gmail.com>

ALSA: usb-audio: Add quirk for Focusrite Scarlett 2i2

Force it to use asynchronous playback.

Same quirk has already been added for Focusrite Scarlett Solo (2nd gen)
with a commit 46f5710f0b88 ("ALSA: usb-audio: Add quirk for Focusrite
Scarlett Solo").

This also seems to prevent regular clicks when playing at 44100Hz
on Scarlett 2i2 (2nd gen). I did not notice any side effects.

Moved both quirks to snd_usb_audioformat_attributes_quirk() as suggested.

Signed-off-by: Gregor Pintar <grpintar@gmail.com>
Reviewed-by: Alexander Tsoy <alexander@tsoy.me>
Link: https://lore.kernel.org/r/20200420214030.2361-1-grpintar@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# fd60e068 04-Apr-2020 Emmanuel Pescosta <emmanuelpescosta099@gmail.com>

ALSA: usb-audio: Add registration quirk for Kingston HyperX Cloud Alpha S

Similar to the Kingston HyperX AMP, the Kingston HyperX Cloud
Alpha S (0951:16d8) uses two interfaces, but only the second
interface contains the capture stream. This patch delays the
registration until the second interface appears.

Signed-off-by: Emmanuel Pescosta <emmanuelpescosta099@gmail.com>
Link: https://lore.kernel.org/r/20200404153843.9288-1-emmanuelpescosta099@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# d8695bc5 25-Mar-2020 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Rewrite registration quirk handling

A slight refactoring of the registration quirk code. Now it uses the
table lookup for easy additions in future. Also the return type was
changed to bool, and got a few more comments.

Link: https://lore.kernel.org/r/20200325103322.2508-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 55f73261 13-Mar-2020 Chris Wulff <crwulff@gmail.com>

ALSA: usb-audio: Create a registration quirk for Kingston HyperX Amp (0951:16d8)

Create a quirk that allows special processing and/or
skipping the call to snd_card_register.

For HyperX AMP, which uses two interfaces, but only has
a capture stream in the second, this allows the capture
stream to merge with the first PCM.

Signed-off-by: Chris Wulff <crwulff@gmail.com>
Link: https://lore.kernel.org/r/20200314165449.4086-3-crwulff@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2edb84e3 29-Feb-2020 Alexander Tsoy <alexander@tsoy.me>

ALSA: usb-audio: Add support for MOTU MicroBook IIc

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>


# 8dc5efe3 14-Feb-2020 Nick Kossifidis <mickflemm@gmail.com>

ALSA: usb-audio: Add support for Presonus Studio 1810c

This patch adds support for Presonus Studio 1810c, a usb interface
that's UAC2 compliant with a few quirks and a few extra hw-specific
controls. I've tested all 3 altsettings and the added switch
controls and they work as expected.

More infos on the card:
https://www.presonus.com/products/Studio-1810c

Note that this work is based on packet inspection with
usbmon. I just wanted to get this card to work for using
it on our open-source radio station:
https://github.com/UoC-Radio

v2 address issues reported by Takashi:
* Properly get/set enum type controls
* Prevent race condition on switch_get/set
* Various control naming changes
* Various coding style fixes

v3 improve readability of sample rate filtering
and some other minor changes.

Signed-off-by: Nick Kossifidis <mickflemm@gmail.com>
Link: https://lore.kernel.org/r/5e47481a.1c69fb81.befb3.8dac@mx.google.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 93f9d1a4 11-Feb-2020 Arvind Sankar <nivedita@alum.mit.edu>

ALSA: usb-audio: Apply sample rate quirk for Audioengine D1

The Audioengine D1 (0x2912:0x30c8) does support reading the sample rate,
but it returns the rate in byte-reversed order.

When setting sampling rate, the driver produces these warning messages:
[168840.944226] usb 3-2.2: current rate 4500480 is different from the runtime rate 44100
[168854.930414] usb 3-2.2: current rate 8436480 is different from the runtime rate 48000
[168905.185825] usb 3-2.1.2: current rate 30465 is different from the runtime rate 96000

As can be seen from the hexadecimal conversion, the current rate read
back is byte-reversed from the rate that was set.

44100 == 0x00ac44, 4500480 == 0x44ac00
48000 == 0x00bb80, 8436480 == 0x80bb00
96000 == 0x017700, 30465 == 0x007701

Rather than implementing a new quirk to reverse the order, just skip
checking the rate to avoid spamming the log.

Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200211162235.1639889-1-nivedita@alum.mit.edu
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 73ac9f5e 12-Jan-2020 Alexander Tsoy <alexander@tsoy.me>

ALSA: usb-audio: Add boot quirk for MOTU M Series

Add delay to make sure that audio urbs are not sent too early.
Otherwise the device hangs. Windows driver makes ~2s delay, so use
about the same time delay value.

snd_usb_apply_boot_quirk() is called 3 times for my MOTU M4, which
is an overkill. Thus a quirk that is called only once is implemented.

Also send two vendor-specific control messages before and after
the delay. This behaviour is blindly copied from the Windows driver.

Signed-off-by: Alexander Tsoy <alexander@tsoy.me>
Link: https://lore.kernel.org/r/20200112102358.18085-1-alexander@tsoy.me
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 8be03a71 05-Jan-2020 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Use lower hex numbers for IDs

For consistency reason, make all hex numbers with lower alphabets for
USB ID entries. It improves grep-ability and reduces careless
mistakes.

Link: https://lore.kernel.org/r/20200105081900.21870-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 51d4efab 03-Jan-2020 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Apply the sample rate quirk for Bose Companion 5

Bose Companion 5 (with USB ID 05a7:1020) doesn't seem supporting
reading back the sample rate, so the existing quirk is needed.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206063
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200104110936.14288-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 92adc96f 18-Dec-2019 Hui Wang <hui.wang@canonical.com>

ALSA: usb-audio: set the interface format after resume on Dell WD19

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: Hui 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: Takashi Iwai <tiwai@suse.de>


# cc9dbfa9 12-Nov-2019 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Fix incorrect NULL check in create_yamaha_midi_quirk()

The commit 60849562a5db ("ALSA: usb-audio: Fix possible NULL
dereference at create_yamaha_midi_quirk()") added NULL checks in
create_yamaha_midi_quirk(), but there was an overlook. The code
allows one of either injd or outjd is NULL, but the second if check
made returning -ENODEV if any of them is NULL. Fix it in a proper
form.

Fixes: 60849562a5db ("ALSA: usb-audio: Fix possible NULL dereference at create_yamaha_midi_quirk()")
Reported-by: Pavel Machek <pavel@denx.de>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191113111259.24123-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e2995b95 23-Oct-2019 Justin Song <flyingecar@gmail.com>

ALSA: usb-audio: Add DSD support for Gustard U16/X26 USB Interface

This patch adds native DSD support for Gustard U16/X26 USB Interface.
Tested using VID and fp->dsd_raw method.

Signed-off-by: Justin Song <flyingecar@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/CA+9XP1ipsFn+r3bCBKRinQv-JrJ+EHOGBdZWZoMwxFv0R8Y1MQ@mail.gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f41f9005 24-Sep-2019 Jussi Laako <jussi@sonarnerd.net>

ALSA: usb-audio: Add DSD support for EVGA NU Audio

EVGA NU Audio is actually a USB audio device on a PCIexpress card,
with it's own USB controller. It supports both PCM and DSD.

Signed-off-by: Jussi Laako <jussi@sonarnerd.net>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20190924071143.30911-1-jussi@sonarnerd.net
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 029d2c0f 17-Sep-2019 Ilya Pshonkin <sudokamikaze@protonmail.com>

ALSA: usb-audio: Add Hiby device family to quirks for native DSD support

This patch adds quirk VID ID for Hiby portable players family with
native DSD playback support.

Signed-off-by: Ilya Pshonkin <sudokamikaze@protonmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20190917074937.157802-1-ilya.pshonkin@netforce.ua
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 0067e154 27-Aug-2019 Jussi Laako <jussi@sonarnerd.net>

ALSA: usb-audio: Update DSD support quirks for Oppo and Rotel

Oppo has issued firmware updates that change alt setting used for DSD
support. However, these devices seem to support auto-detection, so
support is moved from explicit whitelisting to auto-detection.

Also Rotel devices have USB interfaces that support DSD with
auto-detection.

Signed-off-by: Jussi Laako <jussi@sonarnerd.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# eb7505d5 27-Aug-2019 Jussi Laako <jussi@sonarnerd.net>

ALSA: usb-audio: DSD auto-detection for Playback Designs

Add DSD support auto-detection for newer Playback Designs devices. Older
device generations have a different USB interface implementation.

Keep the auto-detection VID whitelist sorted.

Signed-off-by: Jussi Laako <jussi@sonarnerd.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 60849562 26-Aug-2019 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Fix possible NULL dereference at create_yamaha_midi_quirk()

The previous addition of descriptor validation may lead to a NULL
dereference at create_yamaha_midi_quirk() when either injd or outjd is
NULL. Add proper non-NULL checks.

Fixes: 57f8770620e9 ("ALSA: usb-audio: More validations of descriptor units")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 57f87706 20-Aug-2019 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: More validations of descriptor units

Introduce a new helper to validate each audio descriptor unit before
and check the unit before actually accessing it. This should harden
against the OOB access cases with malformed descriptors that have been
recently frequently reported by fuzzers.

The existing descriptor checks are still kept although they become
superfluous after this patch. They'll be cleaned up eventually
later.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 801ebf10 24-Jun-2019 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Sanity checks for each pipe and EP types

The recent USB core code performs sanity checks for the given pipe and
EP types, and it can be hit by manipulated USB descriptors by syzbot.
For making syzbot happier, this patch introduces a local helper for a
sanity check in the driver side and calls it at each place before the
message handling, so that we can avoid the WARNING splats.

Reported-by: syzbot+d952e5e28f5fb7718d23@syzkaller.appspotmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 1a59d1b8 27-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156

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>


# a634090a 28-Feb-2019 Manuel Reinhardt <manuel.rhdt@gmail.com>

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>


# 3bff2407 05-Feb-2019 Udo Eberhardt <udo.eberhardt@thesycon.de>

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>


# 202e69e6 28-Jan-2019 Jussi Laako <jussi@sonarnerd.net>

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>


# 9e696664 24-Jan-2019 Olek Poplavsky <woodenbits@gmail.com>

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>


# f5c9571e 08-Jan-2019 Amadeusz Sławiński <amade@asmblr.net>

ALSA: usb-audio: fix CM6206 register definitions

fix typo after a recent commit causing headphones to have no sound

Fixes: ad43d528a7ac (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>


# 44ff57e6 28-Nov-2018 Tony Das <tdas444@gmail.com>

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>


# ad43d528 02-Nov-2018 Linus Walleij <linus.walleij@linaro.org>

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>


# df3f0347 27-Jul-2018 Jia-Ju Bai <baijiaju1990@gmail.com>

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>


# b080dc5b 25-Jul-2018 Jeff Crukley <jcrukley@gmail.com>

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>


# 1ea0358e 23-Jul-2018 Yue Wang <yuleopen@gmail.com>

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>


# d9d5ed1a 13-Jun-2018 Jussi Laako <jussi@sonarnerd.net>

ALSA: usb-audio: Remove explicitly listed Mytek devices

Remove explicitly listed Mytek devices covered by the more generic DSD
detection method.

Signed-off-by: Jussi Laako <jussi@sonarnerd.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f332485f 12-Jun-2018 Jussi Laako <jussi@sonarnerd.net>

ALSA: usb-audio: Generic DSD detection for XMOS-based implementations

Use more generic method to detect DSD capability of XMOS-based UAC2
implementations in order to support future devices without having to
explicitly list every device separately.

Signed-off-by: Jussi Laako <jussi@sonarnerd.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 3a572d94 12-Jun-2018 Jussi Laako <jussi@sonarnerd.net>

ALSA: usb-audio: Add native DSD support for Mytek DACs

Add new mostly generic code with Mytek VID to support native DSD mode.

This implementation should be easier to maintain when manufacturers
release new products.

Signed-off-by: Jussi Laako <jussi@sonarnerd.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 16bafa79 08-May-2018 Alberto Aguirre <albaguirre@gmail.com>

ALSA: usb-audio: add boot quirk for Axe-Fx III

Wait for Axe-Fx III to fully bootup before initializing card.

Signed-off-by: Alberto Aguirre <albaguirre@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f656891c 20-Apr-2018 Daniel Mack <daniel@zonque.org>

ALSA: usb-audio: add more quirks for DSD interfaces

Based on a downstream patch from Harry ten Berge.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Reported-and-tested-by: wenyi@tianyu-wool.com
Original-by: Harry ten Berge <htenberge@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f3b906d7 23-Mar-2018 Nobutaka Okabe <nob77413@gmail.com>

ALSA: usb-audio: Integrate native DSD support for ITF-USB based DACs.

Integrate the native DSD support quirk codes of "ITF-USB DSD" based DACs.

Now, "is_itf_usb_dsd_2alts_dac()" and "is_itf_usb_dsd_3alts_dac()" is
integrated into one function "is_itf_usb_dsd_dac()".
So, remove the logic to distinguish UD-501 and UD-501V2 by the
"Product Name".

The integration is possible by changing the following two functions.

- snd_usb_select_mode_quirk():
Change the determination condition of the DSD mode switch command,
from the altset number being used, to the audio format being played.
Actually, this operation is same as playback using ASIO driver in
Windows environment.

- snd_usb_interface_dsd_format_quirk():
To which altset supports native DSD is determined by the number of altsets.
Previously, it's a constant "2" or "3".

Signed-off-by: Nobutaka Okabe <nob77413@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 74dc71f8 23-Mar-2018 Nobutaka Okabe <nob77413@gmail.com>

ALSA: usb-audio: FIX native DSD support for TEAC UD-501 DAC

There are two versions of TEAC UD-501, the normal version and
the vendor updated version(UD-501V2).

They have the same VID/PID, but the num of the altsetting is different,
UD-501 has 2 altsets for stream, and UD-501V2 has 3.

So, add the logic to distinguish them by the Product Name, not by the PID.

Signed-off-by: Nobutaka Okabe <nob77413@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 71426535 23-Mar-2018 Nobutaka Okabe <nob77413@gmail.com>

ALSA: usb-audio: Add native DSD support for Luxman DA-06

Add native DSD support quirk for Luxman DA-06 DAC, by adding the
PID/VID 1852:5065.

Rename "is_marantz_denon_dac()" function to "is_itf_usb_dsd_2alts_dac()"
to cover broader device family sharing the same USB audio
implementation(*).
For the same reason, rename "is_teac_dsd_dac()" function to
"is_itf_usb_dsd_3alts_dac()".

(*)
These devices have the same USB controller "ITF-USB DSD", supplied by
INTERFACE Co., Ltd.
"ITF-USB DSD" USB controller has two patterns,

Pattern 1. (2 altsets version)
- Altset 0: for control
- Altset 1: for stream (S32)
- Altset 2: for stream (S32, DSD_U32)

Pattern 2. (3 altsets version)
- Altset 0: for control
- Altset 1: for stream (S16)
- Altset 2: for stream (S32)
- Altset 3: for stream (S32, DSD_U32)

"is_itf_usb_dsd_2alts_dac()" returns true, if the DAC has "Pattern 1"
USB controller, and "is_itf_usb_dsd_3alts_dac()" returns true, if
"Pattern2".

Signed-off-by: Nobutaka Okabe <nob77413@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b0021486 23-Mar-2018 Nobutaka Okabe <nob77413@gmail.com>

ALSA: usb-audio: Add native DSD support for TEAC UD-301

Add native DSD support quirk for TEAC UD-301 DAC,
by adding the PID/VID 0644:804a.

Signed-off-by: Nobutaka Okabe <nob77413@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# ceb18f51 18-Mar-2018 Ruslan Bilovol <ruslan.bilovol@gmail.com>

ALSA: usb-audio: move audioformat quirks to quirks.c

Offload USB audio interface parsing function by
moving quirks to a specially designed location (quirks.c)

Signed-off-by: Ruslan Bilovol <ruslan.bilovol@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 7c74866b 11-Feb-2018 Daniel Mack <daniel@zonque.org>

ALSA: usb: add more device quirks for USB DSD devices

Add some more devices that need quirks to handle DSD modes correctly.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Reported-and-tested-by: Thomas Gresens <tgresens@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 866f7ed7 06-Dec-2017 Jussi Laako <jussi@sonarnerd.net>

ALSA: usb-audio: Add native DSD support for Esoteric D-05X

Adds VID:PID of Esoteric D-05X to the TEAC device id's.
Renames the is_teac_50X_dac() function to is_teac_dsd_dac() to cover
broader device family from the same corporation sharing the same USB
audio implementation.

Signed-off-by: Jussi Laako <jussi@sonarnerd.net>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f5ce8179 01-Nov-2017 Jussi Laako <jussi@sonarnerd.net>

ALSA: usb-audio: support new Amanero Combo384 firmware version

Support DSD_U32_BE sample format on new Amanero Combo384 firmware
version on older VID/PID.

Fixes: 3eff682d765b ("ALSA: usb-audio: Support both DSD LE/BE Amanero firmware versions")
Signed-off-by: Jussi Laako <jussi@sonarnerd.net>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 9bb201a5 14-Oct-2017 Jussi Laako <jussi@sonarnerd.net>

ALSA: usb-audio: Add native DSD support for Pro-Ject Pre Box S2 Digital

Add native DSD support quirk for Pro-Ject Pre Box S2 Digital USB id
2772:0230.

Signed-off-by: Jussi Laako <jussi@sonarnerd.net>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a6aa6cdc 05-Oct-2017 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Apply vendor ID matching for sample rate quirk

So far, lots of Plantronics, MS and Phoenix Audio devices need the
quirk not to read sample rate back, and the list just grows.
In this patch, instead of adding each device, apply the quirk by
matching with these vendors.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# c247487c 05-Oct-2017 Kai-Heng Feng <kai.heng.feng@canonical.com>

ALSA: usb-audio: Add sample rate quirk for Plantronics P610

Like other Plantronics devices, P610 does not support sample
rate reading. Apply sample rate quirk to it.

BugLink: https://bugs.launchpad.net/bugs/1719853

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 0dcd020b 19-Sep-2017 Kai-Heng Feng <kai.heng.feng@canonical.com>

ALSA: usb-audio: Add sample rate quirk for Plantronics C310/C520-M

Like other Plantronics devices, C310 and C520-M do not support sample
rate reading. Add them to the sample rate quirk accordingly.

BugLink: https://bugs.launchpad.net/bugs/1708499
BugLink: https://bugs.launchpad.net/bugs/1709282
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 07b3b5e9 22-Aug-2017 Joakim Tjernlund <joakim.tjernlund@infinera.com>

ALSA: usb-audio: Add delay quirk for H650e/Jabra 550a USB headsets

These headsets reports a lot of: cannot set freq 44100 to ep 0x81
and need a small delay between sample rate settings, just like
Zoom R16/24. Add both headsets to the Zoom R16/24 quirk for
a 1 ms delay between control msgs.

Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# ed993c6f 18-Aug-2017 Jussi Laako <jussi@sonarnerd.net>

ALSA: usb-audio: add DSD support for new Amanero PID

Add DSD support for new Amanero Combo384 firmware version with a new
PID. This firmware uses DSD_U32_BE.

Fixes: 3eff682d765b ("ALSA: usb-audio: Support both DSD LE/BE Amanero firmware versions")
Signed-off-by: Jussi Laako <jussi@sonarnerd.net>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a8e800fe 14-Aug-2017 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Apply sample rate quirk to Sennheiser headset

A Senheisser headset requires the typical sample-rate quirk for
avoiding spurious errors from inquiring the current sample rate like:
usb 1-1: 2:1: cannot get freq at ep 0x4
usb 1-1: 3:1: cannot get freq at ep 0x83

The USB ID 1395:740a has to be added to the entries in
snd_usb_get_sample_rate_quirk().

Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1052580
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 9ecb2406 11-Aug-2017 Markus Elfring <elfring@users.sourceforge.net>

ALSA: usb: Delete an error message for a failed memory allocation in two functions

Omit an extra message for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f83914fd 12-May-2017 Johan Hovold <johan@kernel.org>

ALSA: usb-audio: fix Amanero Combo384 quirk on big-endian hosts

Add missing endianness conversion when using the USB device-descriptor
bcdDevice field when applying the Amanero Combo384 (endianness!) quirk.

Fixes: 3eff682d765b ("ALSA: usb-audio: Support both DSD LE/BE Amanero firmware versions")
Cc: Jussi Laako <jussi@sonarnerd.net>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2e40795c 09-Jan-2017 Dennis Kadioglu <denk@post.com>

ALSA: usb-audio: Add a quirk for Plantronics BT600

Plantronics BT600 does not support reading the sample rate which leads
to many lines of "cannot get freq at ep 0x1" and "cannot get freq at
ep 0x82". This patch adds the USB ID of the BT600 to quirks.c and
avoids those error messages.

Signed-off-by: Dennis Kadioglu <denk@post.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 3eff682d 17-Dec-2016 Jussi Laako <jussi@sonarnerd.net>

ALSA: usb-audio: Support both DSD LE/BE Amanero firmware versions

Add DSD support for both little endian (DSD_U32_LE) and big endian
(DSD_U32_BE) version of the Amanero firmware.

Signed-off-by: Jussi Laako <jussi@sonarnerd.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 7f38ca04 12-Dec-2016 Nobutaka Okabe <nob77413@gmail.com>

ALSA: usb-audio: Add native DSD support for TEAC 501/503 DAC

This patch adds native DSD support for the following devices.

- TEAC NT-503
- TEAC UD-503
- TEAC UD-501

(1) Add quirks for native DSD support for TEAC devices.
(2) A specific vendor command is needed to switch between PCM/DOP and
DSD mode, same as Denon/Marantz devices.

Signed-off-by: Nobutaka Okabe <nob77413@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 83d9956b 12-Aug-2016 Ken Lin <ken.lin@advantech.com.tw>

ALSA: usb-audio: Add sample rate inquiry quirk for B850V3 CP2114

Avoid getting sample rate on B850V3 CP2114 as it is unsupported and
causes noisy "current rate is different from the runtime rate" messages
when playback starts.

Signed-off-by: Ken Lin <ken.lin@advantech.com.tw>
Signed-off-by: Akshay Bhat <akshay.bhat@timesys.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# ca0dd273 22-Aug-2016 Daniel Mack <daniel@zonque.org>

ALSA: usb: use TEAC UD-H01 quirk for more devices

The quirk seems to be necessary not only for TEAC UD-H01 devices, but to
more that are based on the Tenor 8802TL chipset. Devices built by T+A
are affected too, and they apparently all use the same USB PID:PID.

Extend the quirky handling for that device as well, and rename the
quirks flag.

Reported-and-tested-by: Thomas Gresens <T.Gresens@intershop.de>
Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 9abc1341 22-Aug-2016 Daniel Mack <daniel@zonque.org>

ALSA: usb: move udh01_fb_quirk setting to quirks.c

That's a quirk, after all, so move it where to all the other quirks
live.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 41f5e3bd 07-Aug-2016 Vittorio Gambaletta (VittGam) <linuxbugs@vittgam.net>

ALSA: usb-audio: Add quirk for ELP HD USB Camera

The ELP HD USB Camera (05a3:9420) needs this quirk for suppressing
the unsupported sample rate inquiry.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=98481
Cc: <stable@vger.kernel.org>
Signed-off-by: Vittorio Gambaletta <linuxbugs@vittgam.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 7627e40c 06-Aug-2016 Piotr Karasinski <peter.karasinski@gmail.com>

ALSA: usb-audio: Add a sample rate quirk for Creative Live! Cam Socialize HD (VF0610)

VF0610 does not support reading the sample rate which leads to many
lines of "cannot get freq at ep 0x82". This patch adds the USB ID
(0x041E:4080) to snd_usb_get_sample_rate_quirk() list.

Signed-off-by: Piotr Karasinski <peter.karasinski@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 84add303 11-May-2016 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Yet another Phoneix Audio device quirk

Phoenix Audio has yet another device with another id (even a different
vendor id, 0556:0014) that requires the same quirk for the sample
rate.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=110221
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2d2c038a 29-Apr-2016 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Quirk for yet another Phoenix Audio devices (v2)

Phoenix Audio MT202pcs (1de7:0114) and MT202exe (1de7:0013) need the
same workaround as TMX320 for avoiding the firmware bug. It fixes the
frequent error about the sample rate inquiries and the slow device
probe as consequence.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=117321
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b4203ff5 06-Apr-2016 Dennis Kadioglu <denk@post.com>

ALSA: usb-audio: Add a quirk for Plantronics BT300

Plantronics BT300 does not support reading the sample rate which leads
to many lines of "cannot get freq at ep 0x1". This patch adds the USB
ID of the BT300 to quirks.c and avoids those error messages.

Signed-off-by: Dennis Kadioglu <denk@post.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f03b24a8 04-Apr-2016 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Add a sample rate quirk for Phoenix Audio TMX320

Phoenix Audio TMX320 gives the similar error when the sample rate is
asked:
usb 2-1.3: 2:1: cannot get freq at ep 0x85
usb 2-1.3: 1:1: cannot get freq at ep 0x2
....

Add the corresponding USB-device ID (1de7:0014) to
snd_usb_get_sample_rate_quirk() list.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=110221
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 836b34a9 30-Mar-2016 Vladis Dronov <vdronov@redhat.com>

ALSA: usb-audio: Fix double-free in error paths after snd_usb_add_audio_stream() call

create_fixed_stream_quirk(), snd_usb_parse_audio_interface() and
create_uaxx_quirk() functions allocate the audioformat object by themselves
and free it upon error before returning. However, once the object is linked
to a stream, it's freed again in snd_usb_audio_pcm_free(), thus it'll be
double-freed, eventually resulting in a memory corruption.

This patch fixes these failures in the error paths by unlinking the audioformat
object before freeing it.

Based on a patch by Takashi Iwai <tiwai@suse.de>

[Note for stable backports:
this patch requires the commit 902eb7fd1e4a ('ALSA: usb-audio: Minor
code cleanup in create_fixed_stream_quirk()')]

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1283358
Reported-by: Ralf Spenneberg <ralf@spenneberg.net>
Cc: <stable@vger.kernel.org> # see the note above
Signed-off-by: Vladis Dronov <vdronov@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 0ef21100 19-Mar-2016 Victor Clément <victor.clement@openmailbox.org>

ALSA: usb-audio: add Microsoft HD-5001 to quirks

The Microsoft HD-5001 webcam microphone does not support sample rate
reading as the HD-5000 one.
This results in dmesg errors and sound hanging with pulseaudio.

Signed-off-by: Victor Clément <victor.clement@openmailbox.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 902eb7fd 14-Mar-2016 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Minor code cleanup in create_fixed_stream_quirk()

Just a minor code cleanup: unify the error paths.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 0f886ca1 14-Mar-2016 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Fix NULL dereference in create_fixed_stream_quirk()

create_fixed_stream_quirk() may cause a NULL-pointer dereference by
accessing the non-existing endpoint when a USB device with a malformed
USB descriptor is used.

This patch avoids it simply by adding a sanity check of bNumEndpoints
before the accesses.

Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=971125
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 17e2df46 01-Mar-2016 Dennis Kadioglu <denk@post.com>

ALSA: usb-audio: Add a quirk for Plantronics DA45

Plantronics DA45 does not support reading the sample rate which leads
to many lines of "cannot get freq at ep 0x4" and "cannot get freq at
ep 0x84". This patch adds the USB ID of the DA45 to quirks.c and
avoids those error messages.

Signed-off-by: Dennis Kadioglu <denk@post.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 1b3c993a 29-Jan-2016 Lev Lybin <lev.lybin@gmail.com>

ALSA: usb-audio: Add quirk for Microsoft LifeCam HD-6000

Microsoft LifeCam HD-6000 (045e:076f) requires the similar quirk for
avoiding the stall due to the invalid sample rate reads.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=111491
Signed-off-by: Lev Lybin <lev.lybin@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# ad678b4c 29-Jan-2016 Jurgen Kramer <gtmkramer@xs4all.nl>

ALSA: usb-audio: Add native DSD support for PS Audio NuWave DAC

This patch adds native DSD support for the PS Audio NuWave DAC.

Signed-off-by: Jurgen Kramer <gtmkramer@xs4all.nl>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 5327d6ba 29-Jan-2016 Jurgen Kramer <gtmkramer@xs4all.nl>

ALSA: usb-audio: Fix OPPO HA-1 vendor ID

In my patch adding native DSD support for the Oppo HA-1, the wrong vendor ID got
through. This patch fixes the vendor ID and aligns the comment.

Fixes: a4eae3a506ea ('ALSA: usb: Add native DSD support for Oppo HA-1')
Signed-off-by: Jurgen Kramer <gtmkramer@xs4all.nl>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 79289e24 11-Jan-2016 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Refer to chip->usb_id for quirks and MIDI creation

This is a preliminary patch for the later change to allow a better
quirk ID management. In the current USB-audio code, there are a few
places looking at usb_device idVendor and idProduct fields directly
even though we have already a static member in snd_usb_audio.usb_id.
This patch modifies such codes to refer to the latter field.

For achieving this, two slightly intensive changes have been done:
- The snd_usb_audio object is set/reset via dev_getdrv() for the given
USB device; it's needed for minimizing the changes for some existing
quirks that take only usb_device object.

- __snd_usbmidi_create() is introduced to receive the pre-given usb_id
argument. The exported snd_usbmidi_create() is unchanged by calling
this new function internally.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 5a4ff9ec 25-Jan-2016 Guillaume Fougnies <guillaume@eulerian.com>

ALSA: usb-audio: Fix TEAC UD-501/UD-503/NT-503 usb delay

TEAC UD-501/UD-503/NT-503 fail to switch properly between different
rate/format. Similar to 'Playback Design', this patch corrects the
invalid clock source error for TEAC products and avoids complete
freeze of the usb interface of 503 series.

Signed-off-by: Guillaume Fougnies <guillaume@eulerian.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# a4eae3a5 11-Jan-2016 Jurgen Kramer <gtmkramer@xs4all.nl>

ALSA: usb: Add native DSD support for Oppo HA-1

This patch adds native DSD support for the Oppo HA-1. It uses a XMOS chipset
but they use their own vendor ID.

Signed-off-by: Jurgen Kramer <gtmkramer@xs4all.nl>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 12a6116e 13-Dec-2015 Anssi Hannula <anssi.hannula@iki.fi>

ALSA: usb-audio: Add sample rate inquiry quirk for AudioQuest DragonFly

Avoid getting sample rate on AudioQuest DragonFly as it is unsupported
and causes noisy "cannot get freq at ep 0x1" messages when playback
starts.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 1ca8b201 15-Nov-2015 Clemens Ladisch <clemens@ladisch.de>

ALSA: usb-audio: prevent CH345 multiport output SysEx corruption

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: Clemens Ladisch <clemens@ladisch.de>
Cc: stable@vger.kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 16771c7c 08-Nov-2015 Jurgen Kramer <gtmkramer@xs4all.nl>

ALSA: usb: Add native DSD support for Aune X1S

This patch adds native DSD support for the Aune X1S 32BIT/384 DSD DAC

Signed-off-by: Jurgen Kramer <gtmkramer@xs4all.nl>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e0570446 19-Oct-2015 Ricard Wanderlof <ricard.wanderlof@axis.com>

ALSA: USB-audio: Add quirk for Zoom R16/24 playback

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: Ricard Wanderlof <ricardw@axis.com>
Tested-by: Panu Matilainen <pmatilai@laiskiainen.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 9544f8b6 21-Aug-2015 Jurgen Kramer <gtmkramer@xs4all.nl>

ALSA: usb: Add native DSD support for Gustard DAC-X20U

This patch adds native DSD support for the Gustard DAC-X20U.

Signed-off-by: Jurgen Kramer <gtmkramer@xs4all.nl>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 3b7e5c7e 05-Jun-2015 Jurgen Kramer <gtmkramer@xs4all.nl>

ALSA: usb-audio: add native DSD support for JLsounds I2SoverUSB

This patch adds native DSD support for the XMOS based JLsounds I2SoverUSB board

Signed-off-by: Jurgen Kramer <gtmkramer@xs4all.nl>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 2f80b295 30-May-2015 Eric Wong <normalperson@yhbt.net>

ALSA: usb-audio: don't try to get Outlaw RR2150 sample rate

This quirk allows us to avoid the noisy:

current rate 0 is different from the runtime rate

message every time playback starts. While USB DAC in the RR2150
supports reading the sample rate, it never returns a sample rate
other than zero in my observation with common sample rates.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Cc: Joe Turner <joe@oampo.co.uk>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# ae425bb2 22-May-2015 Vittorio G (VittGam) <linuxbugs@vittgam.net>

ALSA: usb-audio: Add quirk for MS LifeCam HD-3000

Microsoft LifeCam HD-3000 (045e:0779) needs a similar quirk for
suppressing the unsupported sample rate inquiry.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=98481
Cc: <stable@vger.kernel.org>
Signed-off-by: Vittorio Gambaletta <linuxbugs@vittgam.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# fa94b0d7 19-May-2015 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Add quirk for MS LifeCam Studio

Microsoft LifeCam Studio (045e:0772) needs a similar quirk for
suppressing the wrong sample rate inquiry.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=98481
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# eef0342c 12-Apr-2015 Adam Honse <calcprogrammer1@gmail.com>

ALSA: usb-audio: Don't attempt to get Microsoft Lifecam Cinema sample rate

Adds Microsoft LifeCam Cinema USB ID to the snd_usb_get_sample_rate_quirk list as the Lifecam Cinema does not appear to support getting the sample rate.

Fixes the issue where the LifeCam Cinema would wait for USB timeout and log the message "cannot get freq at ep 0x82" when accessed.

Addresses bug report https://bugzilla.kernel.org/show_bug.cgi?id=95961.

Signed-off-by: Adam Honse <calcprogrammer1@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 9fc88ad6 31-Mar-2015 Eric Wong <normalperson@yhbt.net>

ALSA: usb-audio: don't try to get Benchmark DAC1 sample rate

Adding this quirk allows us to avoid the noisy
"cannot get freq at ep 0x1" message in dmesg output every time
playback starts.

This ought to affect other Benchmark DAC1 variations using the same
"Microchip Technology, Inc." chip as well, but I have only tested
with the "Pre" variant.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Cc: Joe Turner <joe@oampo.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 8b28c93f 04-Mar-2015 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Check Marantz/Denon USB DACs in a single place

There are three places doing the same check. Let's make them
together.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 3cd1ce04 17-Feb-2015 Frank C Guenther <bugzilla.frnkcg@spamgourmet.com>

ALSA: usb: Fix support for Denon DA-300USB DAC (ID 154e:1003)

Fix problem where playback of Denon DA-300USB DAC sometimes does not
start and leads to error messages like "clock source 41 is not valid,
cannot use".

Solution: Treat this device the same as other Denon/Marantz devices in
sound/usb/quirks.c.

Tested with both PCM and DSD formats.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=93261
Signed-off-by: Frank C Guenther <bugzilla.frnkcg@spamgourmet.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b62b9980 16-Feb-2015 Joe Turner <joe@oampo.co.uk>

ALSA: usb-audio: Don't attempt to get Lifecam HD-5000 sample rate

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>


# 38f74d5b 17-Dec-2014 Jurgen Kramer <gtmkramer@xs4all.nl>

ALSA: usb-audio: add native DSD support for Matrix Audio DACs

This patch adds native DSD support for two XMOS based DACs from Matrix Audio:
- X-Sabre
- Mini-i Pro

Signed-off-by: Jurgen Kramer <gtmkramer@xs4all.nl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# dacacb0a 30-Nov-2014 Panu Matilainen <pmatilai@laiskiainen.org>

ALSA: usb-audio: Add support for Zoom R16/24 capture and midi interfaces

This makes the midi interface and capture work out of the box with
R16 (and presumably R24 too but untested). Playback stream would also
seem to function fine except for one caveat: no sound is produced,
so it is disabled for now. Mixer descriptors are garbage and will
require further quirks to enable functionality, also disabled here.

Signed-off-by: Panu Matilainen <pmatilai@laiskiainen.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 6874daad 28-Nov-2014 Jurgen Kramer <gtmkramer@xs4all.nl>

ALSA: usb-audio: Add mode select quirk for Denon/Marantz DACs

Denon/Marantz USB DACs need a specific vendor command to switch between PCM and
DSD mode. This patch adds a new quirk function to switch between the two modes
using the specific USB vendor command.

This patch applies to the following devices:
- Marantz SA-14S1
- Marantz HD-DAC1

Signed-off-by: Jurgen Kramer <gtmkramer@xs4all.nl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 7a2e9ddc 28-Nov-2014 Jurgen Kramer <gtmkramer@xs4all.nl>

ALSA: usb-audio: Add native DSD support for Denon/Marantz DACs

This patch adds native DSD support for the following devices:
- Marantz SA-14S1
- Marants HD-DAC1

Signed-off-by: Jurgen Kramer <gtmkramer@xs4all.nl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# d42472ec 21-Nov-2014 Jussi Laako <jussi@sonarnerd.net>

ALSA: pcm: Add big-endian DSD sample formats and fix XMOS DSD sample format

This patch fixes XMOS DSD sample format to DSD_U32_BE and also adds
DSD_U16_BE and DSD_U32_BE sample formats.

Signed-off-by: Jussi Laako <jussi@sonarnerd.net>
Acked-by: Jurgen Kramer <gtmkramer@xs4all.nl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 6e84a8d7 15-Nov-2014 Jurgen Kramer <gtmkramer@xs4all.nl>

ALSA: usb-audio: Add ctrl message delay quirk for Marantz/Denon devices

This patch adds a USB control message delay quirk for a few specific Marantz/Denon
devices. Without the delay the DACs will not work properly and produces the
following type of messages:

Nov 15 10:09:21 orwell kernel: [ 91.342880] usb 3-13: clock source 41 is not valid, cannot use
Nov 15 10:09:21 orwell kernel: [ 91.343775] usb 3-13: clock source 41 is not valid, cannot use

There are likely other Marantz/Denon devices using the same USB module which exhibit the
same problems. But as this cannot be verified I limited the patch to the devices
I could test.

The following two devices are covered by this path:
- Marantz SA-14S1
- Marantz HD-DAC1

Signed-off-by: Jurgen Kramer <gtmkramer@xs4all.nl>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 85a81813 09-Nov-2014 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Fix Oops by composite quirk enhancement

The quirk argument itself was used as iterator, so it cannot be taken
back to the original value, obviously.

Fixes: d4b8fc66f770 ('ALSA: usb-audio: Allow multiple entries for the same iface in composite quirk')
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# d4b8fc66 09-Nov-2014 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Allow multiple entries for the same iface in composite quirk

Currently the composite quirk doesn't work when multiple entries are
assigned to the same interface because it marks the interface as
claimed then checks whether the interface has been already claimed for
the secondary entry. But, if you look at the code, you'll notice that
multiple entries are allowed if the entry is the current interface;
i.e. the current behavior is anyway inconsistent, and this is an
unintended shortcoming.

This patch fixes the problem by marking the relevant interfaces as
claimed after applying the all composite entries. This fix will be
needed for the upcoming enhancements for Digidesign Mbox 1 quirks.

Reviewed-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 848f3a82 05-Sep-2014 Jurgen Kramer <gtmkramer@xs4all.nl>

ALSA: usb-audio: add native DSD support for XMOS based DACs

Add quirks for XMOS based DACs for native DSD playback support using the new
DSD_U32_LE sample format.

This version adds native DSD support for:
- iFi Audio micro iDSD/nano iDSD (they use the same prod. id)
- DIYINHK USB to I2S/DSD converter

Changes from v2:
- fix and simplify switch statement
Changes from v1:
- use specific product id and alt setting per XMOS based device

[fixed a misc coding style issue by tiwai]

Signed-off-by: Jurgen Kramer <gtmkramer@xs4all.nl>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 542baf94 03-Aug-2014 Paul S McSpadden <fisch602@gmail.com>

ALSA: usb-audio: Adjust Gamecom 780 volume level

Original patch fixed the original problem, but the sound was far too low
for most users. This patch references a compare matrix to allow the
volume levels to act normally. I personally tested this patch myself,
and volume levels returned to normal. Please see this discussion for
more details: https://bugzilla.kernel.org/show_bug.cgi?id=65251

Signed-off-by: Paul S McSpadden <fisch602@gmail.com>
Cc: <stable@vger.kernel.org> [v3.14+]
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 0ba41d91 26-Feb-2014 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Use standard printk helpers

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>


# 11e424e8 20-Dec-2013 Eduard Gilmutdinov <edgilmutdinov@gmail.com>

ALSA: usb-audio: Add support for Focusrite Saffire 6 USB

Signed-off-by: Eduard Gilmutdinov <edgilmutdinov@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 19570d74 19-Dec-2013 Takashi Iwai <tiwai@suse.de>

ALSA: usb-audio: Add a quirk for Plantronics Gamecom 780

Plantronics Gamecom 780 headset has a firmware problem, and when the
FU 0x09 volume is changed, it results in either too loud or silence
except for a very narrow range. This patch provides a workaround,
ignoring the node, initialize the volume in a sane value and keep
untouched.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=65251
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# aa773bfe 11-Aug-2013 Clemens Ladisch <clemens@ladisch.de>

ALSA: usb-audio: fix automatic Roland/Yamaha MIDI detection

Commit aafe77cc45a5 (ALSA: usb-audio: add support for many Roland/Yamaha
devices) had several logic errors that prevented create_auto_midi_quirk
from enumerating any MIDI ports.

Reported-by: Keith A. Milner <maillist@superlative.org>
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 42d4ab83 09-Jul-2013 Eldad Zack <eldad@fogrefinery.com>

ALSA: usb-audio: fix regression for fixed stream quirk

Commit 8f898e92aea2c24c7f379ee265d178f69ebb9c07 removed the redundant
reads of bInterfaceProtocol from the descriptors, but introduced a
regression to devices with quirks of type QUIRK_AUDIO_FIXED_ENDPOINT,
since fp->protocol is not set in setup process.

As a consequence, audio streams would not get initialized, as the
following logs show:

[ 48.923043] setting usb interface 3:1
[ 48.923056] Creating new capture data endpoint #81
[ 48.923484] 4:3:1: cannot set freq 48000 to ep 0x81

This patch sets fp->protocol in create_fixed_stream_quirk() and
resolves the regression.

Signed-off-by: Eldad Zack <eldad@fogrefinery.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b1ce7ba6 04-Apr-2013 Clemens Ladisch <clemens@ladisch.de>

ALSA: usb-audio: claim autodetected PCM interfaces all at once

snd_card_register() registers all devices newly added since the last
call. However, the playback/capture streams are handled as one ALSA
device, so the second /dev device will not be registered if the PCM
streams are added in two steps.

QUIRK_AUTODETECT caused the probe callback to be called once for each
interface, which triggered this problem. Work around this by handling
this like the composite quirk, i.e., autodetecting all other interfaces
that might be used for PCM or MIDI.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>


# aafe77cc 31-Mar-2013 Clemens Ladisch <clemens@ladisch.de>

ALSA: usb-audio: add support for many Roland/Yamaha devices

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: Clemens Ladisch <clemens@ladisch.de>


# 126825e7 16-Apr-2013 Daniel Mack <zonque@gmail.com>

ALSA: snd-usb: add quirks handler for DSD streams

Unfortunately, none of the UAC standards provides a way to identify DSD
(Direct Stream Digital) formats. Hence, this patch adds a quirks
handler to identify USB interfaces that are capable of handling DSD.

That quirks handler can augment the already parsed formats bit-field,
by any of the new SNDRV_PCM_FMTBIT_DSD_{U8_U16} and setting the dsd_dop
flag in the audio format, if the driver should take care for the DOP
byte stuffing.

The only devices that are known to work with this are the ones with
a 'Playback Designs' vendor id.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 1539d4f8 12-Apr-2013 Calvin Owens <jcalvinowens@gmail.com>

ALSA: usb: Add quirk for 192KHz recording on E-Mu devices

When recording at 176.2KHz or 192Khz, the device adds a 32-bit length
header to the capture packets, which obviously needs to be ignored for
recording to work properly.

Userspace expected: L0 L1 L2 R0 R1 R2
...but actually got: R2 L0 L1 L2 R0 R1

Also, the last byte of the length header being interpreted as L0 of
the first sample caused spikes every 0.5ms, resulting in a loud 16KHz
tone (about the highest 'B' on a piano) being present throughout
captures.

Tested at all sample rates on an E-Mu 0404USB, and tested for
regressions on a generic USB headset.

Signed-off-by: Calvin Owens <jcalvinowens@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 21bb5aaf 09-Apr-2013 Daniel Mack <zonque@gmail.com>

ALSA: snd-usb: Playback Design: use usb_set_inferface quirk from more locations

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>


# 889d6684 05-Apr-2013 Eldad Zack <eldad@fogrefinery.com>

ALSA: usb-audio: fix endianness bug in snd_nativeinstruments_*

The usb_control_msg() function expects __u16 types and performs
the endianness conversions by itself.
However, in three places, a conversion is performed before it is
handed over to usb_control_msg(), which leads to a double conversion
(= no conversion):
* snd_usb_nativeinstruments_boot_quirk()
* snd_nativeinstruments_control_get()
* snd_nativeinstruments_control_put()

Caught by sparse:

sound/usb/mixer_quirks.c:512:38: warning: incorrect type in argument 6 (different base types)
sound/usb/mixer_quirks.c:512:38: expected unsigned short [unsigned] [usertype] index
sound/usb/mixer_quirks.c:512:38: got restricted __le16 [usertype] <noident>
sound/usb/mixer_quirks.c:543:35: warning: incorrect type in argument 5 (different base types)
sound/usb/mixer_quirks.c:543:35: expected unsigned short [unsigned] [usertype] value
sound/usb/mixer_quirks.c:543:35: got restricted __le16 [usertype] <noident>
sound/usb/mixer_quirks.c:543:56: warning: incorrect type in argument 6 (different base types)
sound/usb/mixer_quirks.c:543:56: expected unsigned short [unsigned] [usertype] index
sound/usb/mixer_quirks.c:543:56: got restricted __le16 [usertype] <noident>
sound/usb/quirks.c:502:35: warning: incorrect type in argument 5 (different base types)
sound/usb/quirks.c:502:35: expected unsigned short [unsigned] [usertype] value
sound/usb/quirks.c:502:35: got restricted __le16 [usertype] <noident>

Signed-off-by: Eldad Zack <eldad@fogrefinery.com>
Acked-by: Daniel Mack <zonque@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 59ea586f 17-Mar-2013 Mark Hills <mark@xwax.org>

ALSA: usb-audio: Trust fields given in the quirk

The maxpacksize field is given in some quirks, but it gets ignored (in
favour of wMaxPacketSize from the first endpoint.) This patch favours
the one in the quirk.

Digidesign Mbox and Mbox 2 are the only affected quirks and the devices
are assumed to be working without this patch. So for safety against the
values in the quirk being incorrect, remove them.

The datainterval is also ignored but there are not currently any quirks
which choose to override this.

Cc: Damien Zammit <damien@zamaudio.com>
Cc: Chris J Arges <christopherarges@gmail.com>
Signed-off-by: Mark Hills <mark@xwax.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 5e212332 17-Mar-2013 Mark Hills <mark@xwax.org>

ALSA: usb-audio: Playback and MIDI support for Novation Twitch DJ controller

The hardware also has a PCM capture device which is not implemented in
this patch.

It may be possible to generalise this to Saffire 6 USB support and some
of the other Focusrite interfaces, but as I don't have access to these
devices we should wait until capture support is working first.

Capture support is not implemented because the code assumes the endpoint
to have its own interface (instead, it shares the interface with playback)
and some thought will be needed to lift this limitation.

Signed-off-by: Mark Hills <mark@xwax.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 4909a0ca 17-Feb-2013 Jiri Slaby <jirislaby@kernel.org>

ALSA: usb/quirks, fix out-of-bounds access

bootresponse in snd_usb_mbox2_boot_quirk is only 12 (decimal) u8's
long, but i9s passed to snd_usb_ctl_msg as it would be 0x12 (hexa)
long. Fix that by having proper size of the array, i.e. 0x12.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e9a25e04 08-Feb-2013 Matt Gruskin <matthew.gruskin@gmail.com>

ALSA: usb-audio: add support for M-Audio FT C600

Adds quirks and mixer support for the M-Audio Fast Track C600 USB
audio interface. This device is very similar to the C400 - the C600
simply has some more inputs and outputs, so the existing C400 support
is extended to support this device as well.

Signed-off-by: Matt Gruskin <matthew.gruskin@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 83e3acd4 13-Jan-2013 Eldad Zack <eldad@fogrefinery.com>

ALSA: usb-audio: M-Audio FT C400 skip packet quirk

Attain constant real-world latency by skipping 16 data packets.
The number of packets to be skipped was found by trial and error.

Signed-off-by: Eldad Zack <eldad@fogrefinery.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b98ae272 04-Jan-2013 David Henningsson <david.henningsson@canonical.com>

ALSA: usb - fix race in creation of M-Audio Fast track pro driver

A patch in the 3.2 kernel caused regression with hotplugging the
M-Audio Fast track pro, or sound after suspend. I don't have the
device so I haven't done a full analysis, but it seems userspace
(both udev and pulseaudio) got confused when a card was created,
immediately destroyed, and then created again.

However, at least one person in the bug report (martin djfun)
reports that this patch resolves the issue for him. It also leaves
a message in the log:
"snd-usb-audio: probe of 1-1.1:1.1 failed with error -5" which is
a bit misleading. It is better than non-working audio, but maybe
there's a more elegant solution?

BugLink: https://bugs.launchpad.net/bugs/1095315
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# b7b435e8 04-Jan-2013 Damien Zammit <damien@zamaudio.com>

ALSA: usb-audio: Fix kernel panic of Digidesign Mbox2 quirk

This patch is based on 3.8-rc1. It fixes two things:
1) A kernel panic caused by incorrect allocation of a u8 variable
"bootresponse".
2) A noisy dmesg (urb status -32) caused by broken pipe to an
invalid midi endpoint.

It is also a little cleaner because there is no need for a new
QUIRK_MIDI type as suggested by kernel developers, since the device
follows exactly the MIDIMAN protocol.

Signed-off-by: Damien Zammit <damien@zamaudio.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# cb99864d 19-Dec-2012 Damien Zammit <damien@zamaudio.com>

ALSA: usb-audio: Support for Digidesign Mbox 2 USB sound card:

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: Damien Zammit <damien@zamaudio.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 48fc7f7e 19-Sep-2012 Adam Buchbinder <adam.buchbinder@gmail.com>

Fix misspellings of "whether" in comments.

"Whether" is misspelled in various comments across the tree; this
fixes them. No code changes.

Signed-off-by: Adam Buchbinder <adam.buchbinder@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 2b58fd5b 04-Sep-2012 Daniel Mack <zonque@gmail.com>

ALSA: snd-usb: Add quirks for Playback Designs devices

Playback Designs' USB devices have some hardware limitations on their
USB interface. In particular:

- They need a 20ms delay after each class compliant request as the
hardware ACKs the USB packets before the device is actually ready
for the next command. Sending data immediately will result in buffer
overflows in the hardware.
- The devices send bogus feedback data at the start of each stream
which confuse the feedback format auto-detection.

This patch introduces a new quirks hook that is called after each
control packet and which adds a delay for all devices that match
Playback Designs' USB VID for now.

In addition, it adds a counter to snd_usb_endpoint to drop received
packets on the floor. Another new quirks function that is called once
an endpoint is started initializes that counter for these devices on
their sync endpoint.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Reported-and-tested-by: Andreas Koch <andreas@akdesigninc.com>
Supported-by: Demian Martin <demianm_1@yahoo.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 8866f405 14-Feb-2012 Xi Wang <xi.wang@gmail.com>

ALSA: usb-audio: avoid integer overflow in create_fixed_stream_quirk()

A malicious USB device could feed in a large nr_rates value. This would
cause the subsequent call to kmemdup() to allocate a smaller buffer than
expected, leading to out-of-bounds access.

This patch validates the nr_rates value and reuses the limit introduced
in commit 4fa0e81b ("ALSA: usb-audio: fix possible hang and overflow
in parse_uac2_sample_rate_range()").

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 43df2a57 10-Nov-2011 Thomas Meyer <thomas@m3y3r.de>

ALSA: usb-audio: Use kmemdup rather than duplicating its implementation

Use kmemdup rather than duplicating its implementation

The semantic patch that makes this change is available
in scripts/coccinelle/api/memdup.cocci.

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 17d900c4 26-Sep-2011 Clemens Ladisch <clemens@ladisch.de>

ALSA: usb-audio: increase control transfer timeout

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>


# e8e8babf 12-Sep-2011 Daniel Mack <zonque@gmail.com>

ALSA: snd-usb: re-order code

Move code from endpoint.c into a new file called stream.c and rename
functions so that their names actually reflect what they're doing.

This way, endpoint.c will be available to functions that hold all the
endpoint logic.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Acked-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 1ef0e0a0 26-Aug-2011 Kristian Amlie <kristian@amlie.name>

ALSA: usb-audio: add Starr Labs USB MIDI support

Add support for Starr Labs USB MIDI devices such as the Z7S, which are
based on an FTDI serial UART chip.

Based on a patch by Daniel Mack.

Signed-off-by: Kristian Amlie <kristian@amlie.name>
Acked-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# dac8f847 05-Aug-2011 Daniel Mack <zonque@gmail.com>

ALSA: snd-usb: Fix uninitialized variable usage

Purely cosmetic, but fixes the following build warning.

CC [M] sound/usb/quirks.o
sound/usb/quirks.c: In function ‘snd_usb_apply_boot_quirk’:
sound/usb/quirks.c:429:6: warning: ‘err’ may be used uninitialized in this function [-Wuninitialized]

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 0f5733b0 12-Jul-2011 Guillaume Pellerin <yomguy@parisson.com>

ALSA: usb-audio - Add quirks for M-Audio Fast Track Pro and Quattro

This patch gives M-Audio Fast Track Pro and M-Audio Quattro quirks and
endpoints to boot and setup those devices with special options (digital
inputs and outputs, 24 bits mode, etc...). M-Audio Audiophile quirks are
just adapted to match the new global M-Audio parameters.

Special configurations can be then loaded through a modprobe conf file.
For example, to set the 24 bits mode on the Fast Track Pro add
/etc/modprobe.d/fast_track_pro.conf :

options snd_usb_audio vid=0x763 pid=0x2012 device_setup=0x08

Here is a list of the possibilities in this example :
http://files.parisson.com/debian/fast-track-pro.conf

Signed-off-by: Guillaume Pellerin <yomguy@parisson.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 157186bc 27-May-2011 Eric Lammerts <alsa-devel@lists.lammerts.org>

ALSA: usb - turn off de-emphasis in s/pdif for cm6206

CM6206: Turn off de-emphasis channel status bit in S/PDIF output.

Signed-off-by: Eric Lammerts <eric@lammerts.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 014950b0 25-May-2011 Daniel Mack <zonque@gmail.com>

ALSA: usb-audio: add new quirk type QUIRK_AUDIO_STANDARD_MIXER

This quirk type will let the driver assume that there is a standard
mixer on a given interface, or that a specific mixer quirks will handle
the device.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 9e38658f 25-May-2011 Daniel Mack <zonque@gmail.com>

ALSA: usb-audio: export snd_usb_feature_unit_ctl

In order to allow quirks functions to hook up to the standard feature
unit op tables, this patch exports a pointer to the struct that is used
internally.

That way, all the code handling the control can be kept private, and
external code can reference the symbol to re-use it.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 759e890f 18-May-2011 Daniel Mack <zonque@gmail.com>

ALSA: usb-audio: remove invalid extra mixers for Komplete Audio 6

This was a flaw in the reading of the spec tables - Native Instrument's
"Komplete Audio 6" device has no such extra controls.

This patch also fixes the device name in two comments.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 8129e79e 28-Apr-2011 Wolfgang Breyha <wbreyha@gmx.net>

ALSA: usb-audio - Terratec Aureon 7.1 USB ID as C-Media cm6206 quirks

This patch adds support for the Terratec Aureon 7.1 USB which uses a
C-Media cm6206 and needs all the quirks already found in the past.

Signed-off-by: Wolfgang Breyha <wbreyha@gmx.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 9cdc3529 11-Apr-2011 Daniel Mack <zonque@gmail.com>

ALSA: usb-audio: Add quirks for Audio Kontrol 6

This new device by Native Instruments is also compliant to the USB
standard v2.0, but hides this detail at when connected.

It needs the same boot quirks than other models, and also has two
non-class-compliant mixer controls.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 25985edc 30-Mar-2011 Lucas De Marchi <lucas.demarchi@profusion.mobi>

Fix common misspellings

Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>


# 3347b26c 11-Feb-2011 Daniel Mack <daniel@caiaq.de>

ALSA: usb-audio: reconstruct some dispatcher functions to use switch-case

The number of cases has increased so use switch-case rather than
if-statements.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 54a8c500 11-Feb-2011 Daniel Mack <daniel@caiaq.de>

ALSA: usb-audio: add support for Native Instruments MK2 devices

The MK2 generation of Native Instruments' sound cards are in fact
compliant to the USB audio standard of version 2 and other approved USB
standards. However, they come up as vendor-specific device when first
connected but can be told to come up with a new set of descriptors
upon their next enumeration. The interfaces announced by the new
descriptors will be handled by the kernel's class drivers. This is done
by issuing a vendor specific device request and sending the device to
reset.

There are also some vendor-specific USB requests for some mixer elements
that can't be exported in a standard compliant way. The driver now
supports them with quirks handling mechanisms.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 1cdfa9f3 07-Feb-2011 Joseph Teichman <josteich@gmail.com>

ALSA: usbaudio - Enable the E-MU 0204 USB

Signed-off-by: Joseph Teichman <josteich@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# c7f57216 22-Oct-2010 Clemens Ladisch <clemens@ladisch.de>

ALSA: usb-audio: add Novation Launchpad support

Add a quirk entry for the Novation Launchpad USB MIDI controller.

QUIRK_MIDI_FASTLANE gets renamed to *_RAW_BYTES because this quirk type
is now shared by different devices.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Tested-by: Jakob Flierl <jakob.flierl@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 3d8d4dcf 16-Jun-2010 Daniel Mack <daniel@caiaq.de>

ALSA: usb-audio: simplify control interface access

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>


# 4434ade8 20-May-2010 Krzysztof Foltman <wdev@foltman.com>

ALSA: usb-audio: add support for Akai MPD16

The decoding/encoding is based on own reverse-engineering. Both control and
data ports are handled. Writing to control port supports SysEx events only,
as this is the only type of messages that MPD16 recognizes.

Signed-off-by: Krzysztof Foltman <wdev@foltman.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 36db0456 28-Mar-2010 Stephen Rothwell <sfr@canb.auug.org.au>

ALSA: usb - use of kmalloc/kfree requires the include of slab.h

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# f0b5e634 11-Mar-2010 Daniel Mack <daniel@caiaq.de>

ALSA: usbmixer: rename usbmixer.[ch] -> mixer.[ch]

For clearer namespace, also rename usbmixer_maps.c -> mixer_maps.c

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 7b1eda22 11-Mar-2010 Daniel Mack <daniel@caiaq.de>

ALSA: usb-mixer: factor out quirks

Move all non-standard mixer controls and vendor-specific extensions to a
separate file. Some structs need to be exported now.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 767d75ad 04-Mar-2010 Daniel Mack <daniel@caiaq.de>

ALSA: usb-audio: add support for samplerate setting on v2 devices

Sample rate setting is done with a 4-byte long class request that
addresses the interface.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 015eb0b0 04-Mar-2010 Clemens Ladisch <clemens@ladisch.de>

ALSA: usb-audio: use a format bitmask per alternate setting

In preparation for USB audio 2.0 support, change the audioformat
structure so that it uses a bitmask to specify possible formats.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# e5779998 04-Mar-2010 Daniel Mack <daniel@caiaq.de>

ALSA: usb-audio: refactor code

Clean up the usb audio driver by factoring out a lot of functions to
separate files. Code for procfs, quirks, urbs, format parsers etc all
got a new home now.

Moved almost all special quirk handling to quirks.c and introduced new
generic functions to handle them, so the exceptions do not pollute the
whole driver.

Renamed usbaudio.c to card.c because this is what it actually does now.
Renamed usbmidi.c to midi.c for namespace clarity.
Removed more things from usbaudio.h.

The non-standard drivers were adopted accordingly.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>