summaryrefslogtreecommitdiffstats
path: root/sound/usb
AgeCommit message (Collapse)AuthorFilesLines
2021-06-21ALSA: usb-audio: scarlett2: Remove unused/useless codeGeoffrey D. Bennett1-21/+5
Remove #define not used. Remove useless assignments and copies. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/20210620164630.GA9180@m.b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21ALSA: usb-audio: scarlett2: Coding style improvementsGeoffrey D. Bennett1-26/+27
Improve alignment and readability with: - Whitespace fixes - Add leading zeros to 32-bit flag values - Rename SCARLETT2_USB_GET_METER_LEVELS to SCARLETT2_USB_GET_METER - Rename SCARLETT2_PORT_DIRECTIONS to SCARLETT2_PORT_DIRNS Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/20210620164628.GA9172@m.b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21ALSA: usb-audio: scarlett2: Fix 18i8 Gen 2 PCM Input countGeoffrey D. Bennett1-1/+1
The 18i8 Gen 2 has 8 PCM Inputs, not 20. Fix the ports entry in s18i8_gen2_info. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/20210620164625.GA9165@m.b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-21ALSA: usb-audio: scarlett2: Remove incorrect S/PDIF commentGeoffrey D. Bennett1-4/+0
The 18i8 Gen 2 S/PDIF outputs are available at 192kHz, unlike the 18i20 Gen 2. Remove the comment that says otherwise. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/20210620164622.GA9155@m.b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-17ALSA: usb-audio: fix rate on Ozone Z90 USB headsetDaehwan Jung1-0/+2
It mislabels its 96 kHz altsetting and that's why it causes some noise Signed-off-by: Daehwan Jung <dh10.jung@samsung.com> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/1623836097-61918-1-git-send-email-dh10.jung@samsung.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-10ALSA: usb-audio: Add support for Denon DN-X1600Damien Zammit2-0/+77
This provides support for Denon DN-X1600 hardware mixer. The device itself supports 44100, 48000 and 96000 (Hz) sample rates, but switching rates via software is currently not working. Therefore, this patch hardcodes the sample rate to 48000Hz which enables all 8 channels to function correctly when the correct sample rate is selected on the hardware itself. MIDI also tested and works. Signed-off-by: Damien Zammit <damien@zamaudio.com> Tested-by: xalmoxis@gmail.com Link: https://lore.kernel.org/r/20210610083528.603942-2-damien@zamaudio.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-08ALSA: usb-audio: scarlett2: Read mux at init timeGeoffrey D. Bennett1-64/+106
Add support for retrieving the mux configuration from the hardware when the driver is initialising. Previously the ALSA controls were initialised to a default hard-coded state instead of being initialised to match the hardware state. Fixes: 9e4d5c1be21f ("ALSA: usb-audio: Scarlett Gen 2 mixer interface") Suggested-by: Vladimir Sadovnikov <sadko4u@gmail.com> Tested-by: Markus Schroetter <project.m.schroetter@gmail.com> Tested-by: Alex Fellows <alex.fellows@gmail.com> Tested-by: Daniel Sales <daniel.sales.z@gmail.com> Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/15b17c60a2bca174bcddcec41c9419b746f21c1d.1623091570.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-08ALSA: usb-audio: scarlett2: Read mixer volumes at init timeGeoffrey D. Bennett1-2/+55
Add support for reading the mixer volumes from the hardware when the driver is initialising. Previously these ALSA volume controls were initialised to zero instead of being initialised to match the hardware state. Fixes: 9e4d5c1be21f ("ALSA: usb-audio: Scarlett Gen 2 mixer interface") Suggested-by: Vladimir Sadovnikov <sadko4u@gmail.com> Tested-by: Markus Schroetter <project.m.schroetter@gmail.com> Tested-by: Alex Fellows <alex.fellows@gmail.com> Tested-by: Daniel Sales <daniel.sales.z@gmail.com> Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/bb33fa9b79efc6f7a0f0e6fb7018cc8d4d59b3ba.1623091570.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-08Merge branch 'for-linus' into for-nextTakashi Iwai7-44/+58
2021-06-02ALSA: usb-audio: Reduce latency at playback startTakashi Iwai1-5/+9
USB-audio driver behaves a bit strangely for the playback stream -- namely, it starts sending silent packets at PCM prepare state while the actual data is submitted at first when the trigger START is kicked off. This is a workaround for the behavior where URBs are processed too quickly at the beginning. That is, if we start submitting URBs at trigger START, the first few URBs will be immediately completed, and this would result in the immediate period-elapsed calls right after the start, which may confuse applications. OTOH, submitting the data after silent URBs would, of course, result in a certain delay of the actual data processing, and this is rather more serious problem on modern systems, in practice. This patch tries to revert the workaround and lets the URB submission starting at PCM trigger for the playback again. As far as I've tested with various backends (native ALSA, PA, JACK, PW), I haven't seen any problems (famous last words :) Note that the capture stream handling needs no such workaround, since the capture is driven per received URB. Link: https://lore.kernel.org/r/20210601162457.4877-6-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-02ALSA: usb-audio: Factor out DSD bitrev copy functionTakashi Iwai1-9/+19
Just minor code refactoring. Like DOP DSD code, it can be better in a separate function for code readability. Link: https://lore.kernel.org/r/20210601162457.4877-5-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-02ALSA: usb-audio: Refactoring delay account codeTakashi Iwai3-80/+56
The PCM delay accounting in USB-audio driver is a bit complex to follow, and this is an attempt to improve the readability and provide some potential fix. Basically, the PCM position delay is calculated from two factors: the in-flight data on URBs and the USB frame counter. For the playback stream, we advance the hwptr already at submitting URBs. Those "in-flight" data amount is now tracked, and this is used as the base value for the PCM delay correction. The in-flight data is decreased again at URB completion in return. For the capture stream, OTOH, there is no in-flight data, hence the delay base is zero. The USB frame counter is used in addition for correcting the current position. The reference frame counter is updated at each submission and receiving time, and the difference from the current counter value is taken into account. In this patch, each in-flight data bytes is recorded in the new snd_usb_ctx.queued field, and the total in-flight amount is tracked in snd_usb_substream.inflight_bytes field, as the replacement of last_delay field. Note that updating the hwptr after URB completion doesn't work for PulseAudio who tries to scratch the buffer on the fly; USB-audio is basically a double-buffer implementation, hence the scratching the buffer can't work for the already submitted data. So we always update hwptr beforehand. It's not ideal, but the delay account should give enough correctness. Link: https://lore.kernel.org/r/20210601162457.4877-4-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-02ALSA: usb-audio: Pre-calculate buffer byte sizeTakashi Iwai2-24/+25
There are a bunch of lines calculating the buffer size in bytes at each time. Keep the value in subs->buffer_bytes and use it consistently for the code simplicity. Link: https://lore.kernel.org/r/20210601162457.4877-3-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-02ALSA: usb-audio: Make snd_usb_pcm_delay() staticTakashi Iwai2-5/+2
It's a local function, let's make it static. Link: https://lore.kernel.org/r/20210601162457.4877-2-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-30ALSA: usb-audio: Remove the repeated declarationShaokun Zhang1-1/+0
Function 'snd_usb_endpoint_suspend' is declared twice, so remove the repeated declaration. Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com> Link: https://lore.kernel.org/r/1622278926-63857-1-git-send-email-zhangshaokun@hisilicon.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-25Merge branch 'topic/pci-rescan-prep-v2' into for-nextTakashi Iwai1-1/+1
Pull PCI rescan prep work. Link: https://lore.kernel.org/r/20210523090920.15345-1-tiwai@suse.de
2021-05-25ALSA: Drop superfluous argument from snd_power_wait()Takashi Iwai1-1/+1
The power_state argument of snd_power_wait() is superfluous, receiving only SNDRV_POWER_STATE_D0. Let's drop it in all callers for simplicity. Reviewed-by: Jaroslav Kysela <perex@perex.cz> Acked-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20210523090920.15345-6-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-23ALSA: usb-audio: scarlett2: snd_scarlett_gen2_controls_create() can be statickernel test robot1-2/+2
sound/usb/mixer_scarlett_gen2.c:2000:5: warning: symbol 'snd_scarlett_gen2_controls_create' was not declared. Should it be static? Fixes: 265d1a90e4fb ("ALSA: usb-audio: scarlett2: Improve driver startup messages") Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: kernel test robot <lkp@intel.com> Link: https://lore.kernel.org/r/20210522180900.GA83915@f59a3af2f1d9 Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-21ALSA: usb-audio: scarlett2: Improve driver startup messagesGeoffrey D. Bennett3-31/+52
Add separate init function to call the existing controls_create function so a custom error can be displayed if initialisation fails. Use info level instead of error for notifications. Display the VID/PID so device_setup is targeted to the right device. Display "enabled" message to easily confirm that the driver is loaded. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/b5d140c65f640faf2427e085fbbc0297b32e5fce.1621584566.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-21ALSA: usb-audio: scarlett2: Fix device hang with ehci-pciGeoffrey D. Bennett1-1/+1
Use usb_rcvctrlpipe() not usb_sndctrlpipe() for USB control input in the Scarlett Gen 2 mixer driver. This fixes the device hang during initialisation when used with the ehci-pci host driver. Fixes: 9e4d5c1be21f ("ALSA: usb-audio: Scarlett Gen 2 mixer interface") Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/66a3d05dac325d5b53e4930578e143cef1f50dbe.1621584566.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-21ALSA: usb-audio: fix control-request directionJohan Hovold1-1/+1
The direction of the pipe argument must match the request-type direction bit or control requests may fail depending on the host-controller-driver implementation. Fix the UAC2_CS_CUR request which erroneously used usb_sndctrlpipe(). Fixes: 93db51d06b32 ("ALSA: usb-audio: Check valid altsetting at parsing rates for UAC2/3") Cc: stable@vger.kernel.org # 5.10 Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://lore.kernel.org/r/20210521133742.18098-1-johan@kernel.org Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-21ALSA: usb-audio: Fix uninitialized variable at __uac_clock_find_source()Takashi Iwai1-1/+1
The cur variable indicating the currently selected clock source can be theoretically used as uninitialized after the recent commit 481f17c41803 ("ALSA: usb-audio: Handle error for the current selector gracefully"). For addressing it, initialize it before use. Also, one place seems setting 0 to a wrong variable ret, instead of cur; otherwise it makes little sense. Since the initialization is done beforehand, we can get rid of this line, too. Fixes: 481f17c41803 ("ALSA: usb-audio: Handle error for the current selector gracefully") Reported-by: Colin Ian King <colin.king@canonical.com> Link: https://lore.kernel.org/r/4b261d68-f53f-240d-2d8a-2f88b337849d@canonical.com Link: https://lore.kernel.org/r/s5hfsyhh97t.wl-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-19ALSA: line6: Fix racy initialization of LINE6 MIDITakashi Iwai3-11/+4
The initialization of MIDI devices that are found on some LINE6 drivers are currently done in a racy way; namely, the MIDI buffer instance is allocated and initialized in each private_init callback while the communication with the interface is already started via line6_init_cap_control() call before that point. This may lead to Oops in line6_data_received() when a spurious event is received, as reported by syzkaller. This patch moves the MIDI initialization to line6_init_cap_control() as well instead of the too-lately-called private_init for avoiding the race. Also this reduces slightly more lines, so it's a win-win change. Reported-by: syzbot+0d2b3feb0a2887862e06@syzkallerlkml..appspotmail.com Link: https://lore.kernel.org/r/000000000000a4be9405c28520de@google.com Link: https://lore.kernel.org/r/20210517132725.GA50495@hyeyoo Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20210518083939.1927-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-19ALSA: usb-audio: Handle error for the current selector gracefullyTakashi Iwai1-3/+10
Currently we bail out when the device returns an error or an invalid value for the current clock selector value via uac_clock_selector_get_val(). But it's possible that the device is really uninitialized and waits for the setup of the proper route at first. For handling such a case, this patch lets the driver dealing with the error or the invalid error more gracefully, choosing the clock source automatically instead. Link: https://lore.kernel.org/r/20210518152112.8016-3-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-19ALSA: usb-audio: Refactoring UAC2/3 clock setup codeTakashi Iwai1-200/+85
This patch just does refactoring of the UAC2/3 clock setup code. There should be no functional changes. The major changes are: * Provide union objects for pointing both UAC2 and UAC3 objects * Unify clock source, selector and multiplier helper functions * Unify __uac_clock_find_source() to deal with both UAC2 and UAC3 equally Link: https://lore.kernel.org/r/20210518152112.8016-2-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-17ALSA: usx2y: Nuke pcm_listTakashi Iwai2-4/+1
It's nowhere actually used. Link: https://lore.kernel.org/r/20210517131545.27252-12-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-17ALSA: usx2y: Cleanup probe and disconnect callbacksTakashi Iwai1-67/+40
Minor code refactoring by merging the superfluous function calls. The functions were split in the past for covering pre-history USB driver code, but this is utterly useless. Link: https://lore.kernel.org/r/20210517131545.27252-11-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-17ALSA: usx2y: Don't call free_pages_exact() with NULL addressTakashi Iwai1-2/+5
Unlike some other functions, we can't pass NULL pointer to free_pages_exact(). Add a proper NULL check for avoiding possible Oops. Link: https://lore.kernel.org/r/20210517131545.27252-10-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-17ALSA: usx2y: Fix shmem initializationTakashi Iwai2-9/+10
Currently us428ctls_shmem pages are allocated dynamically upon the mmap call, but this is quite racy. Since the shared memory itself is mandatory for the mmap, let's allocate it at the beginning of the card initialization. Also, fix the initialization of the wait queue, too. Link: https://lore.kernel.org/r/20210517131545.27252-9-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-17ALSA: usxy2: Fix potential doubly allocationsTakashi Iwai1-3/+6
The PCM shmem pages are allocated in snd_usx2y_usbpcm_prepare(). Theoretically the prepare callback may be called simultaneously for both playback and capture, hence this allocation can be racy. Make sure that the allocation is performed exclusively by extending the pcm_mutex lock to cover the allocation code, too. Link: https://lore.kernel.org/r/20210517131545.27252-8-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-17ALSA: usx2y: Fix potential memory leaksTakashi Iwai1-6/+33
Theoretically the initialization functions in usx2y drivers may be called multiple times as the driver gets initialized via hwpdep ioctl. Meanwhile, those functions including memory allocations don't check whether they are called twice, and they forget the old resources, which would lead to memory leaks. This patch adds the sanity checks about the doubly initializations to give kernel WARNING, and returns an error in such a case. Also, each allocation assures to release the resources at its error path properly. Link: https://lore.kernel.org/r/20210517131545.27252-7-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-17ALSA: usx2y: Avoid self-killingTakashi Iwai1-1/+0
The initialization os usx2y driver is multi-staged, and the PCM and other device creations are done after the DSP is loaded and initialized. Upon the initialization, when an error happens, the driver tries to call snd_card_free(). But this is dangerous, and in general, the driver cannot kill itself during its operation. Hence better to drop the snd_card_free() call from there. Link: https://lore.kernel.org/r/20210517131545.27252-6-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-17ALSA: usx2y: Fix potential leaks of uninitialized memoryTakashi Iwai4-10/+15
usx2y drivers may expose the allocated pages via mmap, but it performs zero-clear only for the struct size, not aligned with the page size. This leaves out some uninitialized trailing bytes. This patch fixes the clearance to cover all memory that are exposed to user-space. Link: https://lore.kernel.org/r/20210517131545.27252-5-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-17ALSA: usx2y: Coding style fixesTakashi Iwai9-320/+381
This patch fixes various trivial coding-style issues in usx2y code, such as: * the assginments in if condition * comparison order with constants * NULL / zero checks * unsigned -> unsigned int * addition of braces in control blocks * debug print with function names * move local variables in block into function head * reduction of too nested indentations No functional changes. Link: https://lore.kernel.org/r/20210517131545.27252-4-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-17ALSA: usx2y: Fix spacesTakashi Iwai9-211/+256
This patch corrects merely the spaces in the usx2y code, including the superfluous trailing space in the debug prints and a slight reformat of some comment lines. Nothing really touches about the code itself. Link: https://lore.kernel.org/r/20210517131545.27252-3-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-17ALSA: usx2y: Avoid camelCaseTakashi Iwai8-649/+649
For improving readability, convert camelCase fields, variables and functions to the plain names with underscore. Also align the macros to be capital letters. All done via sed, no functional changes. Note that you'll still see many coding style issues even after this patch; the fixes will follow. Link: https://lore.kernel.org/r/20210517131545.27252-2-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-11ALSA: usb-audio: Fix potential out-of-bounce access in MIDI EP parserTakashi Iwai1-3/+4
The recently introduced MIDI endpoint parser code has an access to the field without the size validation, hence it might lead to out-of-bounce access. Add the sanity checks for the descriptor sizes. Fixes: eb596e0fd13c ("ALSA: usb-audio: generate midi streaming substream names from jack names") Link: https://lore.kernel.org/r/20210511090500.2637-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-10ALSA: usb-audio: Validate MS endpoint descriptorsTakashi Iwai1-0/+4
snd_usbmidi_get_ms_info() may access beyond the border when a malformed descriptor is passed. This patch adds the sanity checks of the given MS endpoint descriptors, and skips invalid ones. Reported-by: syzbot+6bb23a5d5548b93c94aa@syzkaller.appspotmail.com Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20210510150659.17710-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-03ALSA: usb-audio: Add dB range mapping for Sennheiser Communications Headset PC 8Timo Gurr1-0/+12
The decibel volume range contains a negative maximum value resulting in pipewire complaining about the device and effectivly having no sound output. The wrong values also resulted in the headset sounding muted already at a mixer level of about ~25%. PipeWire BugLink: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1049 BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=212897 Signed-off-by: Timo Gurr <timo.gurr@gmail.com> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20210503110822.10222-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-04-28ALSA: usb-audio: Remove redundant assignment to lenJiapeng Chong1-1/+0
Variable len is set to zero but this value is never read as it is overwritten with a new value later on, hence it is a redundant assignment and can be removed. Cleans up the following clang-analyzer warning: sound/usb/mixer.c:2713:3: warning: Value stored to 'len' is never read [clang-analyzer-deadcode.DeadStores]. Reported-by: Abaci Robot <abaci@linux.alibaba.com> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> Link: https://lore.kernel.org/r/1619519194-57806-1-git-send-email-jiapeng.chong@linux.alibaba.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-04-26ALSA: usb-audio: Fix implicit sync clearance at stopping streamTakashi Iwai1-4/+4
The recent endpoint management change for implicit feedback mode added a clearance of ep->sync_sink (formerly ep->sync_slave) pointer at snd_usb_endpoint_stop() to assure no leftover for the feedback from the already stopped capture stream. This turned out to cause a regression, however, when full-duplex streams were running and only a capture was stopped. Because of the above clearance of ep->sync_sink pointer, no more feedback is done, hence the playback will stall. This patch fixes the ep->sync_sink clearance to be done only after all endpoints are released, for addressing the regression. Reported-and-tested-by: Lucas Endres <jaffa225man@gmail.com> Fixes: bf6313a0ff76 ("ALSA: usb-audio: Refactor endpoint management") Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20210426063349.18601-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-04-22ALSA: usb-audio: Generic application of implicit fb to Roland/BOSS devicesTakashi Iwai1-30/+62
Through the examinations and experiments with lots of Roland and BOSS USB-audio devices, we found out that the recently introduced full-duplex operations with the implicit feedback mode work fine for quite a few devices, while the others need only the capture-side quirk to enforce the full-duplex mode. The recent commit d86f43b17ed4 ("ALSA: usb-audio: Add support for many Roland devices' implicit feedback quirks") tried to add such quirk entries manually in the lists, but this turned out to be too many and error-prone, hence it was reverted again. This patch is another attempt to cover those missing Roland/BOSS devices but in a more generic way. It matches the devices with the vendor ID 0x0582, and checks whether they are with both ASYNC sync types or ASYNC is only for capture device. In the former case, it's the device with the implicit feedback mode, and applies accordingly. In both cases, the capture stream requires always the full-duplex mode, and we apply the known capture quirk for that, too. Basically the already existing BOSS device quirk entries become redundant after this generic matching, so those are removed. Although the capture_implicit_fb_quirks[] table became empty and superfluous, I keep it for now, so that people can put a special device easily at any time later again. Link: https://lore.kernel.org/r/CAOsVg8rA61B=005_VyUwpw3piVwA7Bo5fs1GYEB054efyzGjLw@mail.gmail.com Link: https://lore.kernel.org/r/20210414083255.9527-1-tiwai@suse.de BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=212519 Tested-by: Lucas Endres <jaffa225man@gmail.com> Link: https://lore.kernel.org/r/20210422120413.457-2-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-04-22Revert "ALSA: usb-audio: Add support for many Roland devices..."Takashi Iwai1-59/+0
This reverts commit d86f43b17ed4 ("ALSA: usb-audio: Add support for many Roland devices' feedback quirks"). It turned out that many quirk entries there don't contain the proper EP values and/or the quirk types, which lead to the broken operations. As we're going to cover all Roland/BOSS devices in a more generic way rather the explicit lists, let's revert the previous additions at first. Fixes: d86f43b17ed4 ("ALSA: usb-audio: Add support for many Roland devices' implicit feedback quirks") Link: https://lore.kernel.org/r/20210422120413.457-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-04-20ALSA: usb: midi: don't return -ENOMEM when usb_urb_ep_type_check failsColin Ian King1-1/+1
Currently when the call to usb_urb_ep_type_check fails (returning -EINVAL) the error return path returns -ENOMEM via the exit label "error". Other uses of the same error exit label set the err variable to -ENOMEM but this is not being used. I believe the original intent was for the error exit path to return the value in err rather than the hard coded -ENOMEM, so return this rather than the hard coded -ENOMEM. Addresses-Coverity: ("Unused value") Fixes: 738d9edcfd44 ("ALSA: usb-audio: Add sanity checks for invalid EPs") Signed-off-by: Colin Ian King <colin.king@canonical.com> Link: https://lore.kernel.org/r/20210420134719.381409-1-colin.king@canonical.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-04-19ALSA: usb-audio: Re-apply implicit feedback mode to Pioneer devicesTakashi Iwai1-15/+27
Pioneer devices are supposed to be working with the implicit feedback mode, but so far the attempt to apply the implicit feedback caused issues, hence we explicitly skipped the implicit feedback mode for them. Recently, Geraldo discovered that the device actually works if you skip the generic matching of the sync EPs for the capture stream. That is, we should apply the implicit feedback setup for the playback like other similar devices, while we need to return 1 from audioformat_capture_quirk() so that no further matching will be done. And, later on, Olivia reported later that the fiddling with the capture quirk alone doesn't suffice for the test with speaker-test program. This seems to be a similar case like the recently fixed BOSS devices. Indeed, the problem could be addressed by setting playback_first flag, which indicates that the playback URBs have to be sent out at first even in the implicit feedback mode. This patch implements the application of the implicit feedback to Pioneer devices as described in the above. The former skip_pioneer_sync_ep() was dropped, and instead we provide is_pioneer_implicit_fb() to check the Pioneer devices that need the implicit feedback. In the audioformat_implicit_fb_quirk(), simply apply the implicit fb for playback and set chip->playback_first flag if matching, and in audioformat_capture_quirk()(), it returns 1 for skipping the generic EP sync handling. Reported-by: Geraldo <geraldogabriel@gmail.com> Tested-by: Olivia Mackintosh <livvy@base.nu> Link: https://lore.kernel.org/r/s5ha6pygqfz.wl-tiwai@suse.de Link: https://lore.kernel.org/r/20210419153918.450-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-04-19ALSA: usb-audio: DJM-750: ensure format is setOlivia Mackintosh1-0/+1
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>
2021-04-17ALSA: usb-audio: Add support for many Roland devices' implicit feedback quirksLucas Endres1-0/+59
It makes USB audio capture and playback possible and pristine on my Roland INTEGRA-7, Boutique D-05, and R-26, along with many more I've encountered people having had issues with over the last decade or so. Signed-off-by: Lucas Endres <jaffa225man@gmail.com> Link: https://lore.kernel.org/r/CAOsVg8rA61B=005_VyUwpw3piVwA7Bo5fs1GYEB054efyzGjLw@mail.gmail.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-04-14ALSA: usb-audio: Apply implicit feedback mode for BOSS devicesTakashi Iwai3-13/+26
During the recent rewrite of the implicit feedback support, we've tested to apply the implicit fb on BOSS devices, but it failed, as the capture stream didn't start without the playback. As the end result, it got another type of quirk for tying both streams but starts playback always (commit 6234fdc1cede "ALSA: usb-audio: Quirk for BOSS GT-001"). Meanwhile, Mike Oliphant has tested the real implicit feedback mode for the playback again with the latest code, and found out that it actually works if the initial feedback sync is skipped; that is, on those BOSS devices, the playback stream has to be started at first without waiting for the capture URB completions. Otherwise it gets stuck. In the rest operations after the capture stream processed, we can take them as the implicit feedback source. This patch is an attempt to improve the support for BOSS devices with the implicit feedback mode in the way described above. It adds a new flag to snd_usb_audio, playback_first, indicating that the playback stream starts without sync with the initial capture completion. This flag is set in the quirk table with the new IMPLICIT_FB_BOTH type. Reported-and-tested-by: Mike Oliphant <oliphant@nostatic.org> Link: https://lore.kernel.org/r/20210414083255.9527-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-04-13ALSA: usb-audio: Explicitly set up the clock selectorTakashi Iwai1-4/+14
In the current code, we have some assumption that the audio clock selector has been set up implicitly and don't want to touch it unless it's really needed for the fallback autoclock setup. This works for most devices but some seem having a problem. Partially this was covered for the devices with a single connector at the initialization phase (commit 086b957cc17f "ALSA: usb-audio: Skip the clock selector inquiry for single connections"), but also there are cases where the wrong clock set up is kept silently. The latter seems to be the cause of the noises on Behringer devices. In this patch, we explicitly set up the audio clock selector whenever the appropriate node is found. Reported-by: Geraldo Nascimento <geraldogabriel@gmail.com> BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=199327 Link: https://lore.kernel.org/r/CAEsQvcvF7LnO8PxyyCxuRCx=7jNeSCvFAd-+dE0g_rd1rOxxdw@mail.gmail.com Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20210413084152.32325-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-04-09ALSA: usb-audio: Add MIDI quirk for Vox ToneLab EXTakashi Iwai1-0/+10
ToneLab EX guitar pedal device requires the same quirk like ToneLab ST for supporting the MIDI. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=212593 Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20210407144549.1530-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>