summaryrefslogtreecommitdiff
path: root/sound/usb/mixer_quirks.c
AgeCommit message (Collapse)Author
2023-10-27ALSA: scarlett2: Rename scarlett_gen2 to scarlett2Geoffrey D. Bennett
This driver was originally developed for the Focusrite Scarlett Gen 2 series. Since then Focusrite have used a similar protocol for their Gen 3, Gen 4, Clarett USB, Clarett+, and Vocaster series. Let's call this common protocol the "Scarlett 2 Protocol" and rename the driver to scarlett2 to not imply that it is restricted to Gen 2 series devices. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/e1ad7f69a1e20cdb39094164504389160c1a0a0b.1698342632.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-09ALSA: scarlett2: Add Focusrite Clarett 2Pre and 4Pre USB supportGeoffrey D. Bennett
It has been confirmed that all devices in the Focusrite Clarett USB series work the same as the devices in the Clarett+ series. Add the missing PIDs to enable support for the Clarett 2Pre and 4Pre USB. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/ZSFB8EVTG1PK1eq/@m.b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-06ALSA: scarlett2: Add Focusrite Clarett+ 2Pre and 4Pre supportGeoffrey D. Bennett
The Focusrite Clarett+ series uses the same protocol as the Scarlett Gen 2 and Gen 3 series. This patch adds support for the Clarett+ 2Pre and Clarett+ 4Pre similarly to the existing 8Pre support by adding appropriate entries to the scarlett2 driver. The Clarett 2Pre USB and 4Pre USB presumably use the same protocol as well, so support for them can easily be added if someone can test. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/ZRL7qjC3tYQllT3H@m.b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-18ALSA: scarlett2: Add support for Clarett 8Pre USBGeoffrey D. Bennett
The Clarett 8Pre USB works the same as the Clarett+ 8Pre, only the USB ID is different. Tested-by: Philippe Perrot <philippe@perrot-net.fr> Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/e59f47b29e2037f031b56bde10474c6e96e31ba5.1694705811.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-08-09ALSA: scarlett2: Add Focusrite Clarett+ 8Pre supportChristian Colglazier
The Focusrite Clarett+ 8Pre uses the same protocol as the Scarlett Gen 2 and Gen 3 product range. This patch adds support for the Clarett+ 8Pre by adding appropriate entries to the scarlett2 driver. The Clarett+ 2Pre and 4Pre, and the Clarett USB product line presumably use the same protocol as well, so support for them can easily be added if someone can test. Signed-off-by: Christian Colglazier <christian@cacolglazier.com> Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/20220809043241.GA2749152@m.b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-07-05ALSA: usb-audio: Add endianness annotationsJan Schär
Fixes: 4b8ea38fabab ("ALSA: usb-audio: Support jack detection on Dell dock") Reported-by: kernel test robot <lkp@intel.com> Link: https://lore.kernel.org/r/202207051932.qUilU0am-lkp@intel.com Signed-off-by: Jan Schär <jan@jschaer.ch> Link: https://lore.kernel.org/r/20220705135746.13713-1-jan@jschaer.ch Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-07-04ALSA: usb-audio: Turn off 'manual mode' on Dell dockJan Schär
This removes the need to power cycle the Dell WD15 dock if it has been attached to a Windows machine. The Windows driver puts the ALC4020 USB audio controller into 'manual mode', and then does all the power management and other configuration itself, by sending HD audio commands directly to the ALC3263 audio codec via vendor-type USB messages. If manual mode is off, this is all handled by the firmware, and works well enough. If manual mode is turned on, the latency of the SET INTERFACE command goes from several hundred ms to less than 1 ms (see https://bugzilla.suse.com/show_bug.cgi?id=1089467), but I'm not sure if the additional code that would be required is worth it. Funnily enough, the Windows driver tries to turn off manual mode when the dock is disconnected, which doesn't work for obvious reasons. Additionally, fix a bug in dell_dock_init_vol, which didn't work because the Control Selector was missing. Now, it properly resets the volume to 0dB. Fixes: 964af639ad69 ("ALSA: usb-audio: Initialize Dell Dock playback volumes") Signed-off-by: Jan Schär <jan@jschaer.ch> Link: https://lore.kernel.org/r/20220627171855.42338-2-jan@jschaer.ch Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-07-04ALSA: usb-audio: Support jack detection on Dell dockJan Schär
The Dell WD15 dock has a headset and a line out port. Add support for detecting if a jack is inserted into one of these ports. For the headset jack, additionally determine if a mic is present. The WD15 contains an ALC4020 USB audio controller and ALC3263 audio codec from Realtek. It is a UAC 1 device, and UAC 1 does not support jack detection. Instead, jack detection works by sending HD Audio commands over vendor-type USB messages. I found out how it works by looking at USB captures on Windows. The audio codec is very similar to the one supported by sound/soc/codecs/rt298.c / rt298.h, some constant names and the mic detection are adapted from there. The realtek_add_jack function is adapted from build_connector_control in sound/usb/mixer.c. I tested this on a WD15 dock with the latest firmware. Signed-off-by: Jan Schär <jan@jschaer.ch> Link: https://lore.kernel.org/r/20220627171855.42338-1-jan@jschaer.ch Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-03-12ALSA: usb-audio: Add mute TLV for playback volumes on RODE NT-USBLars-Peter Clausen
For the RODE NT-USB the lowest Playback mixer volume setting mutes the audio output. But it is not reported as such causing e.g. PulseAudio to accidentally mute the device when selecting a low volume. Fix this by applying the existing quirk for this kind of issue when the device is detected. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20220311201400.235892-1-lars@metafoo.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2022-01-05Merge branch 'for-next' into for-linusTakashi Iwai
Pull 5.17 materials. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-12-06ALSA: usb-audio: Drop CONFIG_PM ifdefsTakashi Iwai
Practically seen, CONFIG_PM is almost mandatory. Let's drop the ugly ifdef lines and simplify the code. Link: https://lore.kernel.org/r/20211202084053.18201-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-12-06ALSA: usb-audio: Reorder snd_djm_devices[] entriesGeraldo Nascimento
Olivia Mackintosh has posted to alsa-devel reporting that there's a potential bug that could break mixer quirks for Pioneer devices introduced by 6d27788160362a7ee6c0d317636fe4b1ddbe59a7 "ALSA: usb-audio: Add support for the Pioneer DJM 750MK2 Mixer/Soundcard". This happened because the DJM 750 MK2 was added last to the Pioneer DJM device table index and defined as 0x4 but was added to snd_djm_devices[] just after the DJM 750 (MK1) entry instead of last, after the DJM 900 NXS2. This escaped review. To prevent that from ever happening again, Takashi Iwai suggested to use C99 array designators in snd_djm_devices[] instead of simply reordering the entries. Fixes: 6d2778816036 ("ALSA: usb-audio: Add support for the Pioneer DJM 750MK2") Reported-by: Olivia Mackintosh <livvy@base.nu> Suggested-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Geraldo Nascimento <geraldogabriel@gmail.com> Link: https://lore.kernel.org/r/Yau46FDzoql0SNnW@geday Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-12-02ALSA: usb-audio: Drop superfluous '0' in Presonus Studio 1810c's IDTakashi Iwai
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>
2021-10-10ALSA: usb-audio: Add support for the Pioneer DJM 750MK2 Mixer/SoundcardWilliam Overton
The kernel already has support for very similar Pioneer djm products and this work is based on that. Added device to quirks-table.h and added control info to mixer_quirks.c. Tested on my hardware and all working. Signed-off-by: William Overton <willovertonuk@gmail.com> Link: https://lore.kernel.org/r/20211010145841.11907-1-willovertonuk@gmail.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-09-13ALSA: usb-audio: Unify mixer resume and reset_resume procedureTakashi Iwai
USB-audio driver assumes that the normal resume would preserve the device configuration while reset_resume wouldn't, and tries to restore the mixer elements only at reset_resume callback. However, this seems too naive, and some devices do behave differently, resetting the volume at the normal resume; this resulted in the inconsistent volume that surprised users. This patch changes the mixer resume code to handle both the normal and reset resume in the same way, always restoring the original mixer element values. This allows us to unify the both callbacks as well as dropping the no longer used reset_resume field, which ends up with a good code reduction. A slight behavior change by this patch is that now we assign restore_mixer_value() as the default resume callback, and the function is no longer called at reset-resume when the resume callback is overridden by the quirk function. That is, if needed, the quirk resume function would have to handle similarly as restore_mixer_value() by itself. Reported-by: En-Shuo Hsu <enshuo@chromium.org> Cc: Yu-Hsuan Hsu <yuhsuan@chromium.org> Link: https://lore.kernel.org/r/CADDZ45UPsbpAAqP6=ZkTT8BE-yLii4Y7xSDnjK550G2DhQsMew@mail.gmail.com Link: https://lore.kernel.org/r/20210910105155.12862-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-08-14ALSA: usb-audio: Input source control - digidesign mboxDamien Zammit
This adds a second mixer control to Digidesign Mbox to select between Analog/SPDIF capture. Users will note that selecting the SPDIF input source automatically switches the clock mode to sync to SPDIF, which is a feature of the hardware. (You can change the clock source back to internal if you want to capture from spdif but not sync to its clock although this mode is probably not recommended). Unfortunately, starting the stream resets both modes to Internally clocked and Analog input mode. Signed-off-by: Damien Zammit <damien@zamaudio.com> Tested-by: Damien Zammit <damien@zamaudio.com> Link: https://lore.kernel.org/r/20210813113402.11849-1-damien@zamaudio.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Add support for Solo and 2i2 Gen 3Geoffrey D. Bennett
Add initial support for the Focusrite Scarlett Solo and 2i2 devices: - They have no mixer - They don't support reporting sync status or levels - The configuration space is laid out differently to the other models - There is no level (line/inst) switch on input 1 of the Solo Co-developed-by: Vladimir Sadovnikov <sadko4u@gmail.com> Signed-off-by: Vladimir Sadovnikov <sadko4u@gmail.com> Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/190b90f6f1f8f8d4dfb5f0a7761ff8ae5c40fdde.1624379707.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-06-22ALSA: usb-audio: scarlett2: Add Gen 3 mixer supportGeoffrey D. Bennett
Add mixer support for the Focusrite Scarlett 4i4, 8i6, 18i8, and 18i20 Gen 3 devices. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Link: https://lore.kernel.org/r/22d0dc877dec026eb19630edec217ab72ebcd50a.1624379707.git.g@b4.vu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-05-21ALSA: usb-audio: scarlett2: Improve driver startup messagesGeoffrey D. Bennett
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-03-30Merge tag 'tags/mute-led-rework' into for-nextTakashi Iwai
ALSA: control - add generic LED API This patchset tries to resolve the diversity in the audio LED control among the ALSA drivers. A new control layer registration is introduced which allows to run additional operations on top of the elementary ALSA sound controls. A new control access group (three bits in the access flags) was introduced to carry the LED group information for the sound controls. The low-level sound drivers can just mark those controls using this access group. This information is not exported to the user space, but user space can manage the LED sound control associations through sysfs (last patch) per Mark's request. It makes things fully configurable in the kernel and user space (UCM). The actual state ('route') evaluation is really easy (the minimal value check for all channels / controls / cards). If there's more complicated logic for a given hardware, the card driver may eventually export a new read-only sound control for the LED group and do the logic itself. The new LED trigger control code is completely separated and possibly optional (there's no symbol dependency). The full code separation allows eventually to move this LED trigger control to the user space in future. Actually it replaces the already present functionality in the kernel space (HDA drivers) and allows a quick adoption for the recent hardware (ASoC codecs including SoundWire). snd_ctl_led 24576 0 The sound driver implementation is really easy: 1) call snd_ctl_led_request() when control LED layer should be automatically activated / it calls module_request("snd-ctl-led") on demand / 2) mark all related kcontrols with SNDRV_CTL_ELEM_ACCESS_SPK_LED or SNDRV_CTL_ELEM_ACCESS_MIC_LED Link: https://lore.kernel.org/r/20210317172945.842280-1-perex@perex.cz Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-03-26ALSA: usb-audio: Check connector value on resumeKai-Heng Feng
Rear Mic on Lenovo P620 cannot record after S3, despite that there's no error and the other two functions of the USB audio, Line In and Line Out, work just fine. The mic starts to work again after running userspace app like "alsactl store". Following the lead, the evidence shows that as soon as connector status is queried, the mic can work again. So also check connector value on resume to "wake up" the USB audio to make it functional. This can be device specific, however I think this generic approach may benefit more than one device. Now the resume callback checks connector, and a new callback, reset_resume, to also restore switches and volumes. Suggested-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com> Link: https://lore.kernel.org/r/20210325165918.22593-2-kai.heng.feng@canonical.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-03-18ALSA: usb-audio: Fix unintentional sign extension issueColin Ian King
The shifting of the u8 integer device by 24 bits to the left will be promoted to a 32 bit signed int and then sign-extended to a 64 bit unsigned long. In the event that the top bit of device is set then all then all the upper 32 bits of the unsigned long will end up as also being set because of the sign-extension. Fix this by casting device to an unsigned long before the shift. Addresses-Coverity: ("Unintended sign extension") Fixes: a07df82c7990 ("ALSA: usb-audio: Add DJM750 to Pioneer mixer quirk") Signed-off-by: Colin Ian King <colin.king@canonical.com> Link: https://lore.kernel.org/r/20210318132008.15266-1-colin.king@canonical.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-03-02ALSA: usb-audio: fix Pioneer DJM-850 control label infoNicolas MURE
Unlike the other DJM, the value to set the "CD/LINE" and "LINE" capture control options are inverted. This fix makes sure that the displayed info label while using `alsamixer` matches the input switches label on the DJM-850 mixer. Signed-off-by: Nicolas MURE <nicolas.mure2019@gmail.com> Link: https://lore.kernel.org/r/20210301152729.18094-5-nicolas.mure2019@gmail.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-03-02ALSA: usb-audio: Declare Pioneer DJM-850 mixer controlsNicolas MURE
Declare audio capture controls to choose the audio source, and also to set the capture level (in dB). See https://github.com/nm2107/Pioneer-DJM-850-driver-reverse-engineering/blob/172fb9a61055960c88c67b7c416fe5bf3609807b/doc/windows-djm-850-setting-utility/mixer-output-tab/README.md Signed-off-by: Nicolas MURE <nicolas.mure2019@gmail.com> Link: https://lore.kernel.org/r/20210301152729.18094-3-nicolas.mure2019@gmail.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-02-05ALSA: usb-audio: add mixer quirks for Pioneer DJM-900NXS2Fabian Lesniak
This commit adds mixer quirks for the Pioneer DJM-900NXS2 mixer. This device has 6 capture channels, 5 of them allow setting the signal source. This adds controls for these, similar to the DJM-250Mk2. However, playpack channels are not controllable via software like on the 250Mk2, as they can only be set manually on the mixing console. Read-only controls showing the currently selected playback channels are omitted. Signed-off-by: Fabian Lesniak <fabian@lesniak-it.de> Link: https://lore.kernel.org/r/20210205215116.258724-2-fabian@lesniak-it.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-02-05ALSA: usb-audio: Add DJM750 to Pioneer mixer quirkOlivia Mackintosh
This allows for N different devices to use the pioneer mixer quirk for setting capture/record type and recording level. The impementation has not changed much with the exception of an additional mask on private_value to allow storing of a device index: DEVICE MASK 0xff000000 GROUP_MASK 0x00ff0000 VALUE_MASK 0x0000ffff This could be improved by changing the arrays of wValues for each channel to contain named definitions (e.g. SND_DJM_CAP_LINE). It would improve readability and perhaps would allow using the same array for multiple channels. The channel number can be specified on the control next to the wIndex. Feedback is very much appreciated as I'm not the most proficient C programmer but am learning as I go. Signed-off-by: Olivia Mackintosh <livvy@base.nu> Link: https://lore.kernel.org/r/20210205184256.10201-2-livvy@base.nu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-01-08ALSA: Convert strlcpy to strscpy when return value is unusedJoe Perches
strlcpy is deprecated. see: Documentation/process/deprecated.rst Change the calls that do not use the strlcpy return value to the preferred strscpy. Done with cocci script: @@ expression e1, e2, e3; @@ - strlcpy( + strscpy( e1, e2, e3); This cocci script leaves the instances where the return value is used unchanged. After this patch, sound/ has 3 uses of strlcpy() that need to be manually inspected for conversion and changed one day. $ git grep -w strlcpy sound/ sound/usb/card.c: len = strlcpy(card->longname, s, sizeof(card->longname)); sound/usb/mixer.c: return strlcpy(buf, p->name, buflen); sound/usb/mixer.c: return strlcpy(buf, p->names[index], buflen); Miscellenea: o Remove trailing whitespace in conversion of sound/core/hwdep.c Link: https://lore.kernel.org/lkml/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/ Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/22b393d1790bb268769d0bab7bacf0866dcb0c14.camel@perches.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-09-23ALSA: usb-audio: Add mixer support for Pioneer DJ DJM-250MK2František Kučera
This patch extends support for DJM-250MK2 and allows mapping playback and capture channels to available sources. Configures the card through USB commands. Signed-off-by: František Kučera <franta-linux@frantovo.cz> Link: https://lore.kernel.org/r/20200922144206.10472-1-konference@frantovo.cz Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-08-06ALSA: usb-audio: Creative USB X-Fi Pro SB1095 volume knob supportMirko Dietrich
Adds an entry for Creative USB X-Fi to the rc_config array in mixer_quirks.c to allow use of volume knob on the device. Adds support for newer X-Fi Pro card, known as "Model No. SB1095" with USB ID "041e:3263" Signed-off-by: Mirko Dietrich <buzz@l4m1.de> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20200806124850.20334-1-buzz@l4m1.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-06-24ALSA: usb-audio: Fix OOB access of mixer element listTakashi Iwai
The USB-audio mixer code holds a linked list of usb_mixer_elem_list, and several operations are performed for each mixer element. A few of them (snd_usb_mixer_notify_id() and snd_usb_mixer_interrupt_v2()) assume each mixer element being a usb_mixer_elem_info object that is a subclass of usb_mixer_elem_list, cast via container_of() and access it members. This may result in an out-of-bound access when a non-standard list element has been added, as spotted by syzkaller recently. This patch adds a new field, is_std_info, in usb_mixer_elem_list to indicate that the element is the usb_mixer_elem_info type or not, and skip the access to such an element if needed. Reported-by: syzbot+fb14314433463ad51625@syzkaller.appspotmail.com Reported-by: syzbot+2405ca3401e943c538b5@syzkaller.appspotmail.com Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20200624122340.9615-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-29ALSA: usb-audio: Fixing usage of plain int instead of NULLThomas Ebeling
As reported by kbuild test robot, mixer quirks for RME Babyface Pro used plain integer instead of NULL. Fixes: 3e8f3bd04716 ("ALSA: usb-audio: RME Babyface Pro mixer patch") Signed-off-by: Thomas Ebeling <penguins@bollie.de> Reported-by: kbuild test robot <lkp@intel.com> Link: https://lore.kernel.org/r/20200529173248.zzawijfvw73kzjxt@bollie.ca9.eu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-05-15ALSA: usb-audio: fixing upper volume limit for RME Babyface Pro routing ↵Thomas Ebeling
crosspoints In my initial patch, these were set too low. Fixes: 3e8f3bd04716 ("ALSA: usb-audio: RME Babyface Pro mixer patch") Signed-off-by: Thomas Ebeling <penguins@bollie.de> Link: https://lore.kernel.org/r/20200515114556.vtspnonzvp4xp44m@bollie.ca9.eu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-04-24Merge branch 'for-linus' into for-nextTakashi Iwai
Back-merge 5.7-rc devel branch for further changes. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-04-23ALSA: usb-audio: Fix usb audio refcnt leak when getting spdifXiyu Yang
snd_microii_spdif_default_get() invokes snd_usb_lock_shutdown(), which increases the refcount of the snd_usb_audio object "chip". When snd_microii_spdif_default_get() returns, local variable "chip" becomes invalid, so the refcount should be decreased to keep refcount balanced. The reference counting issue happens in several exception handling paths of snd_microii_spdif_default_get(). When those error scenarios occur such as usb_ifnum_to_if() returns NULL, the function forgets to decrease the refcnt increased by snd_usb_lock_shutdown(), causing a refcnt leak. Fix this issue by jumping to "end" label when those error scenarios occur. Fixes: 447d6275f0c2 ("ALSA: usb-audio: Add sanity checks for endpoint accesses") Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn> Signed-off-by: Xin Tan <tanxin.ctf@gmail.com> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/1587617711-13200-1-git-send-email-xiyuyang19@fudan.edu.cn Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-04-15ALSA: usb-audio: RME Babyface Pro mixer patchThomas Ebeling
Added mixer quirks to allow controlling the internal DSP of the RME Babyface Pro and its successor Babyface Pro FS. Signed-off-by: Thomas Ebeling <penguins@bollie.de> Link: https://lore.kernel.org/r/20200414211019.qprg7whepg2y7nei@bollie.ca9.eu Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-02-15ALSA: usb-audio: Add support for Presonus Studio 1810cNick Kossifidis
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>
2020-01-12ALSA: usb: update old-style static const declarationPierre-Louis Bossart
GCC reports the following warning with W=1 sound/usb/mixer_quirks.c: In function ‘snd_microii_controls_create’: sound/usb/mixer_quirks.c:1694:2: warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration] 1694 | const static usb_mixer_elem_resume_func_t resume_funcs[] = { | ^~~~~ Move static to the beginning of declaration Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20200111214736.3002-3-pierre-louis.bossart@linux.intel.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-05ALSA: usb-audio: More constificationsTakashi Iwai
Apply const prefix to the remaining places: the static table for the unit information, the mixer maps, the validator tables, etc. Just for minor optimization and no functional changes. Link: https://lore.kernel.org/r/20200105144823.29547-12-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03ALSA: usb: Constify snd_kcontrol_new itemsTakashi Iwai
Most of snd_kcontrol_new definitions are read-only and passed as-is. Let's declare them as const for further optimization. There should be no functional changes by this patch. Link: https://lore.kernel.org/r/20200103081714.9560-42-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-22Merge branch 'topic/usb-validation' into for-nextTakashi Iwai
Pull USB validation patches. It's based on the latest 5.3 development branch, so we shall catch up the whole things. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-08-21ALSA: usb-audio: Fix invalid NULL check in snd_emuusb_set_samplerate()Takashi Iwai
The quirk function snd_emuusb_set_samplerate() has a NULL check for the mixer element, but this is useless in the current code. It used to be a check against mixer->id_elems[unitid] but it was changed later to the value after mixer_eleme_list_to_info() which is always non-NULL due to the container_of() usage. This patch fixes the check before the conversion. While we're at it, correct a typo in the comment in the function, too. Fixes: 8c558076c740 ("ALSA: usb-audio: Clean up mixer element list traverse") Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-07-28ALSA: usb-audio: Scarlett Gen 2 mixer interfaceGeoffrey D. Bennett
Add mixer quirk for the Focusrite Scarlett 6i6, 18i8, and 18i20 Gen 2 audio interfaces. Although the interfaces are USB compliant, additional input/output level controls and hardware routing/mixing functionality are available using proprietary USB requests. Signed-off-by: Geoffrey D. Bennett <g@b4.vu> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-07-08Merge tag 'asoc-v5.3' of ↵Takashi Iwai
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus ASoC: Updates for v5.3 This is a very big update, mainly thanks to Morimoto-san's refactoring work and some fairly large new drivers. - Lots more work on moving towards a component based framework from Morimoto-san. - Support for force disconnecting muxes from Jerome Brunet. - New drivers for Cirrus Logic CS47L35, CS47L85 and CS47L90, Conexant CX2072X, Realtek RT1011 and RT1308. Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-06-28ALSA: usb-audio: fix sign unintended sign extension on left shiftsColin Ian King
There are a couple of left shifts of unsigned 8 bit values that first get promoted to signed ints and hence get sign extended on the shift if the top bit of the 8 bit values are set. Fix this by casting the 8 bit values to unsigned ints to stop the unintentional sign extension. Addresses-Coverity: ("Unintended sign extension") Signed-off-by: Colin Ian King <colin.king@canonical.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156Thomas Gleixner
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>
2019-02-06ALSA: usb: Clean up with new procfs helpersTakashi Iwai
Simplify the proc fs creation code with new helper functions, snd_card_ro_proc_new() and snd_card_rw_proc_new(). Just a code refactoring and no functional changes. Reviewed-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-10-05ALSA: usb-audio: Add custom mixer status quirks for RME CC devicesJussi Laako
Adds several vendor specific mixer quirks for RME's Class Compliant USB devices. These provide extra status information from the device otherwise not available. These include AES/SPDIF rate and status information, current system sampling rate and measured frequency. This information is especially useful in cases where device's clock is slaved to external clock source. Signed-off-by: Jussi Laako <jussi@sonarnerd.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-07-26ALSA: usb-audio: Declare the common variable in header fileTakashi Iwai
Declare snd_usb_feature_unit_ctl properly in mixer.h. Otherwise it's error-prone. This fixes the sparse warning: sound/usb/mixer.c:1464:25: warning: symbol 'snd_usb_feature_unit_ctl' was not declared. Should it be static? Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-06-04ALSA: usb-audio: remove redundant check on errColin Ian King
The check on err is redundant as both the true and false paths end up on a break statement. Remove the redundant check. Detected by CoverityScan, CID#1268773 ("Identical code for different branches") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2018-05-28ALSA: usb-audio: Follow standard coding styleTakashi Iwai
Avoid if ((err = ...) style and expand to multiple lines instead. No change in the end result, but just the beautification. Signed-off-by: Takashi Iwai <tiwai@suse.de>