aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/mixer.c
Commit message (Collapse)AuthorAgeFilesLines
* ALSA: snd-usb: mixer: ignore -EINVAL in snd_usb_mixer_controls()Daniel Mack2013-03-281-3/+3
| | | | | | | | | | | | | | | | | | | | | | | commit 83ea5d18d74f032a760fecde78c0210f66f7f70c upstream. Creation of individual mixer controls may fail, but that shouldn't cause the entire mixer creation to fail. Even worse, if the mixer creation fails, that will error out the entire device probing. All the functions called by parse_audio_unit() should return -EINVAL if they find descriptors that are unsupported or believed to be malformed, so we can safely handle this error code as a non-fatal condition in snd_usb_mixer_controls(). That fixes a long standing bug which is commonly worked around by adding quirks which make the driver ignore entire interfaces. Some of them might now be unnecessary. Signed-off-by: Daniel Mack <zonque@gmail.com> Reported-and-tested-by: Rodolfo Thomazelli <pe.soberbo@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* ALSA: snd-usb: mixer: propagate errors up the call chainDaniel Mack2013-03-281-4/+6
| | | | | | | | | | | | | commit 4d7b86c98e445b075c2c4c3757eb6d3d6efbe72e upstream. In check_input_term() and parse_audio_feature_unit(), propagate the error value that has been returned by a failing function instead of -EINVAL. That helps cleaning up the error pathes in the mixer. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* ALSA: usb-audio: fix invalid length check for RME and other UAC 2 devicesClemens Ladisch2013-02-031-5/+12
| | | | | | | | | | | | | | | | | | | commit d56268fb108c7c21e19933588ca4d94652585183 upstream. Commit 23caaf19b11e (ALSA: usb-mixer: Add support for Audio Class v2.0) forgot to adjust the length check for UAC 2.0 feature unit descriptors. This would make the code abort on encountering a feature unit without per-channel controls, and thus prevented the driver to work with any device having such a unit, such as the RME Babyface or Fireface UCX. Reported-by: Florian Hanisch <fhanisch@uni-potsdam.de> Tested-by: Matthew Robbetts <wingfeathera@gmail.com> Tested-by: Michael Beer <beerml@sigma6audio.de> Cc: Daniel Mack <daniel@caiaq.de> Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* ALSA: usb-audio: Use rwsem for disconnect protectionTakashi Iwai2012-11-171-6/+6
| | | | | | | | | | | | | | commit 34f3c89fda4fba9fe689db22253ca8db2f5e6386 upstream. Replace mutex with rwsem for codec->shutdown protection so that concurrent accesses are allowed. Also add the protection to snd_usb_autosuspend() and snd_usb_autoresume(), too. Reported-by: Matthieu CASTET <matthieu.castet@parrot.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* ALSA: usb-audio: Fix races at disconnectionTakashi Iwai2012-11-171-22/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | commit 978520b75f0a1ce82b17e1e8186417250de6d545 upstream. Close some races at disconnection of a USB audio device by adding the chip->shutdown_mutex and chip->shutdown check at appropriate places. The spots to put bandaids are: - PCM prepare, hw_params and hw_free - where the usb device is accessed for communication or get speed, in mixer.c and others; the device speed is now cached in subs->speed instead of accessing to chip->dev The accesses in PCM open and close don't need the mutex protection because these are already handled in the core PCM disconnection code. The autosuspend/autoresume codes are still uncovered by this patch because of possible mutex deadlocks. They'll be covered by the upcoming change to rwsem. Also the mixer codes are untouched, too. These will be fixed in another patch, too. Reported-by: Matthieu CASTET <matthieu.castet@parrot.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* ALSA: usb - disable broken hw volume for Tenx TP6911David Henningsson2012-10-131-0/+7
| | | | | | | | | | | | | | | | | | commit c10514394ef9e8de93a4ad8c8904d71dcd82c122 upstream. While going through Ubuntu bugs, I discovered this patch being posted and a confirmation that the patch works as expected. Finding out how the hw volume really works would be preferrable to just disabling the broken one, but this would be better than nothing. Credit: sndfnsdfin (qawsnews) BugLink: https://bugs.launchpad.net/bugs/559939 Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* ALSA: usb-audio - Fix the missing volume quirks at delayed initTakashi Iwai2011-11-211-50/+59
| | | | | | | | | | | | | | | | | | | commit dcaaf9f2c16b56f8bb316881fcd3f15c18fc71e7 upstream. In the recent usb-audio driver, the initialization of volume ranges may be delayed when the device doesn't respond well at the probing time. But the volume quirks for certain devices are applied only in mixer_ctl_feature_info() thus only at the very first probe and will be missing when the volume range is initialized later. This patch moves the volume quirk code to be always called from the volume-range extraction (get_min_max()), so that the quirks are properly applied in the later init time. Reported-and-tested-by: Alexey Fisher <bug-track@fisher-privat.net> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* ALSA: usb-audio - Check the dB-range validity in the later read, tooTakashi Iwai2011-11-211-2/+11
| | | | | | | | | | | | commit 9fcd0ab130579d9742538340edda3225f2b49a3e upstream. When the initial check of dB-range failed due to the read error, try to check again at the later read, too. When an invalid dB range is found, remove TLV flags and notify the mixer info change. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* ALSA: usb-audio - Fix missing mixer dB informationTakashi Iwai2011-08-291-1/+2
| | | | | | | | | | | | | | | | | commit 38b65190c6ab0be8ce7cff69e734ca5b5e7fa309 upstream. The recent fix for testing dB range at the mixer creation time seems to cause regressions in some devices. In such devices, reading the dB info at probing time gives an error, thus both dBmin and dBmax are still zero, and TLV flag isn't set although the later read of dB info succeeds. This patch adds a workaround for such a case by assuming that the later read will succeed. In future, a similar test should be performed in a case where a wrong dB range is seen even in the later read. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* ALSA: snd-usb: operate on given mixer interface onlyDaniel Mack2011-08-151-12/+8
| | | | | | | | | | | | | | | | | commit 1faa5d07a93fc5b0a4a5254fc940a79e20b55540 upstream. When creating the mixers for an USB audio device, the current code looks at the host interface stored in mixer->chip->ctrl_if. Change this and rather keep a local pointer to the interface that was given when snd_usb_create_mixer() was called. Signed-off-by: Daniel Mack <zonque@gmail.com> Reported-by: Nicolai Krakowiak <nicolai.krakowiak@gmail.com> Reported-by: Lean-Yves LENHOF <jean-yves@lenhof.eu.org> Acked-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* ALSA: snd-usb: avoid dividing by zero on invalid inputNicolai Krakowiak2011-08-151-0/+5
| | | | | | | | | | | commit 60c961a9e1ed879a4d151df6076bf1203f595f73 upstream. Signed-off-by: Nicolai Krakowiak <nicolai.krakowiak@gmail.com> Acked-by: Daniel Mack <zonque@gmail.com> Acked-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* ALSA: usb-audio: export snd_usb_feature_unit_ctlDaniel Mack2011-05-251-10/+3
| | | | | | | | | | | | 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>
* ALSA: usb-audio: rework add_control_to_empty()Daniel Mack2011-05-251-9/+10
| | | | | | | | | | | | This patch renames add_control_to_empty() to snd_usb_mixer_add_control() and exports it, so the quirks functions can make use of it. Also, as "struct mixer_build" is private to mixer.c, rewrite the function to take an argument of type "struct usb_mixer_interface" instead. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Merge branch 'topic/misc' into for-linusTakashi Iwai2011-05-221-4/+6
|\
| * ALSA: usb-audio - Don't expose broken dB rangesTakashi Iwai2011-04-281-4/+6
| | | | | | | | | | | | | | | | | | Some crappy USB-audio devices give broken dB ranges, e.g. both min and max are 0dB. This confuses the volume control that prefers dB expression such as alsactl or PulseAudio. In such a case, it's much better not to expose the broken dB information. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | Fix common misspellingsLucas De Marchi2011-03-311-1/+1
|/ | | | | | Fixes generated by 'codespell' and manually reviewed. Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
* ALSA: usbaudio: implement USB autosuspendOliver Neukum2011-03-111-2/+21
| | | | | | | | | | | | Devices are autosuspended if no pcm nor midi channel is open Mixer devices may be opened. This way they are active when in use to play or record sound, but can be suspended while users have a mixer application running. [Small clean-ups using static inline by tiwai] Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: usbaudio: fix suspend/resumeOliver Neukum2011-03-111-2/+23
| | | | | | | | - ESHUTDOWN must be correctly handled - the optional interrupt endpoint's URB must be stopped and restarted Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Merge branch 'fix/misc' into topic/miscTakashi Iwai2011-03-111-2/+2
|\
| * ALSA: usbaudio - Enable the E-MU 0204 USBJoseph Teichman2011-02-081-2/+2
| | | | | | | | | | Signed-off-by: Joseph Teichman <josteich@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: usb-audio - Add "cval->res = 384" quirk for Logitech Webcam C600Alexey Fisher2011-03-101-0/+1
| | | | | | | | | | | | | | | | | | One more affected devices: Logitech Webcam C600 (046d:0808) Volume range before quirk is 6400, after (also real) is 16. Signed-off-by: Alexey Fisher <bug-track@fisher-privat.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: usb-audio - Add volume range check and warn if it too bigAlexey Fisher2011-03-101-0/+16
|/ | | | | Signed-off-by: Alexey Fisher <bug-track@fisher-privat.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: usb-audio: use enum control info helperClemens Ladisch2011-01-101-9/+2
| | | | | | | Simplify info callbacks by using the snd_ctl_enum_info() helper function. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: usb/mixer: remove bogus castDan Carpenter2010-09-161-2/+3
| | | | | | | | | | | | "uinfo->value.enumerated.item" is an unsigned int. If it's negative when we do the comparison: if ((int)uinfo->value.enumerated.item >= cval->max) then we would read past the end of the array on the next line. I also changed the strcpy() to strlcpy() out of paranoia. Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: usb-audio - Fix an unused-variable compile warningTakashi Iwai2010-09-161-3/+1
| | | | | | | | | Used only when CONFIG_SND_DEBUG=y sound/usb/mixer.c: In function 'get_min_max': sound/usb/mixer.c:762: warning: unused variable 'chip' Reported-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: usb-audio: fix detection of vendor-specific device protocol settingsClemens Ladisch2010-09-031-1/+9
| | | | | | | | | | | | | | | | | | The Audio Class v2 support code in 2.6.35 added checks for the bInterfaceProtocol field. However, there are devices (usually those detected by vendor-specific quirks) that do not have one of the predefined values in this field, which made the driver reject them. To fix this regression, restore the old behaviour, i.e., assume that a device with an unknown bInterfaceProtocol field (other than UAC_VERSION_2) has more or less UAC-v1-compatible descriptors. [compile warning fixes by tiwai] Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Cc: Daniel Mack <daniel@caiaq.de> Cc: <stable@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: usb - Fix compile error with CONFIG_SND_DEBUG_VERBOSE=yTakashi Iwai2010-06-241-1/+1
| | | | | | Replaced the forgotten cval->mixer->ctrlif. Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: usb-audio: simplify control interface accessDaniel Mack2010-06-231-19/+18
| | | | | | | | | | | 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>
* ALSA: usb-audio: move and add some commentsDaniel Mack2010-06-231-8/+16
| | | | | | | Also add a list of open topics. Signed-off-by: Daniel Mack <daniel@caiaq.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: usb-audio: unify UAC macros and struct namesDaniel Mack2010-06-231-7/+7
| | | | | | | | | | Get rid of the last occurances of _v1 suffixes, and move the version number right after the "uac" string. Now things are consitent again. Sorry for the forth and back, but it just looks much nicer this way. Signed-off-by: Daniel Mack <daniel@caiaq.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: usb-audio - Add volume resolution quirk for some Logitech webcamsAlexey Fisher2010-06-231-0/+13
| | | | | | | | | | | | | Some programs like Skype trying to set capture volume automatically. Normally it will tray, carefully step by step lover or higher, set the volume. In real word it work not really well, because devises and vendors lie about real audio settings. For example most Logitech webcams have 6400 or 3500 steps for capture volume. They do not tell that actual resolution is 384. So we have only 7 or 18 real steps. In this patch I set real resolution only for tested devices. Signed-off-by: Alexey Fisher <bug-track@fisher-privat.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: usb-audio: fix UAC2 control value queriesDaniel Mack2010-06-111-5/+14
| | | | | | | | | | | | | | | | | For RANGE requests, we should only query as much bytes as we're in fact interested in. For CUR requests, we shouldn't confuse the firmware with an overlong request but just ask for 2 bytes. This might need fixing in the future as it's not entirely clear when to dispatch 1-byte, 2-byte and 4-byte request blocks. For now, we assume everything is coded in 16bit - this works for all firmware implementations I've seen. Signed-off-by: Daniel Mack <daniel@caiaq.de> Reported-by: Alex Lee <alexlee188@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: usb-audio: export UAC2 clock selectors as mixer controlsDaniel Mack2010-05-311-7/+35
| | | | | | | | | | | The UAC2 clock selectors are fortunately compatible with UAC1 audio selector units, so we can simply reuse the same approach to get all the linked units. Requests to this control need a different CS value though. Signed-off-by: Daniel Mack <daniel@caiaq.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: usb-audio: clean up find_audio_control_unit()Daniel Mack2010-05-311-8/+10
| | | | | | | | | Use a struct to parse the audio units, and return usable descriptors for all types. There's no need to limit the result set, except for some kind of sanity check. Signed-off-by: Daniel Mack <daniel@caiaq.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: usb-audio: add UAC2 sepecific Feature Unit controlsDaniel Mack2010-05-311-6/+10
| | | | | | | | The bits to enable them are always 0 for UAC1 devices, so no additional checks are required. Signed-off-by: Daniel Mack <daniel@caiaq.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: usb-audio: unify constants from specificationDaniel Mack2010-05-311-66/+33
| | | | | | | Move more definitions from private enums to appropriate header files. Signed-off-by: Daniel Mack <daniel@caiaq.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: usb-audio: support partially write-protected UAC2 controlsDaniel Mack2010-05-311-6/+24
| | | | | | | | | | | | | So far, UAC2 controls are marked read-only if any of the channels are marked read-only in the descriptors. Change this behaviour and - mark them writeable unless all channels are read-only - store the read-only mask in usb_mixer_elem_info and - check the mask again in set_cur_mix_value(), and bail out for write-protected channels. Signed-off-by: Daniel Mack <daniel@caiaq.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: usb-audio: UAC2: clean up parsing of bmaControlsDaniel Mack2010-05-311-4/+4
| | | | | | | | Introduce two new static inline functions for a more readable parsing of UAC2 bmaControls. Signed-off-by: Daniel Mack <daniel@caiaq.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: usb-audio: fix feature unit parser for UAC2Daniel Mack2010-05-281-1/+1
| | | | | | | | | Fix a small off-by-one bug which causes the feature unit to announce a wrong number of channels. This leads to illegal requests sent to the firmware eventually. Signed-off-by: Daniel Mack <daniel@caiaq.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* Merge branch 'topic/usb' into for-linusTakashi Iwai2010-05-201-14/+86
|\
| * ALSA: sound/usb: add preliminary support for UAC2 interruptsDaniel Mack2010-05-111-13/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For both UAC1 and UAC2, interrupt endpoint messages are now parsed with structs rather that with anonymous buffer array accesses. For UAC2, only CUR interrupt notifications are supported for now. snd_usb_mixer_status_complete() was renamed to snd_usb_mixer_interrupt(). Fixed one indentation flaw on the way. Signed-off-by: Daniel Mack <daniel@caiaq.de> Cc: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
| * ALSA: sound/usb: fix UAC1 regressionDaniel Mack2010-05-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | Commit 23caaf19b ("ALSA: usb-mixer: Add support for Audio Class v2.0") broke support for Class1 devices due to two faulty changes. This patch fixes it. Signed-off-by: Daniel Mack <daniel@caiaq.de> Reported-and-Tested-by: The Source <thesourcehim@gmail.com> Cc: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: usb/mixer - use get_iface_desc() rather than direct structureJaroslav Kysela2010-04-161-1/+1
|/ | | | Signed-off-by: Jaroslav Kysela <perex@perex.cz>
* ALSA: usb-mixer: Add support for Audio Class v2.0Daniel Mack2010-03-121-80/+242
| | | | | | | | | | USB Audio Class v2.0 compliant devices have different descriptors and a different way of setting/getting min/max/res/cur properties. This patch adds support for them. Signed-off-by: Daniel Mack <daniel@caiaq.de> Cc: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: usb-mixer: parse descriptors with structsDaniel Mack2010-03-121-40/+47
| | | | | | | | | | | Introduce a number of new structs for mixer, selector, feature and processing units and some static inline helpers to access fields which have dynamic offsets. Use them in mixer.c to parse the descriptors. This is necessary for the upcoming audio v2 parsers. Signed-off-by: Daniel Mack <daniel@caiaq.de> Cc: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ALSA: usbmixer: rename usbmixer.[ch] -> mixer.[ch]Daniel Mack2010-03-121-0/+1920
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>