Takashi Iwai [Wed, 9 Mar 2011 16:33:48 +0000 (17:33 +0100)]
sound: Use sound_register_*() for additional OSS minor devices
Since OSS driver creates the device entries for /dev/audio* and
/dev/dspW* by itself without coping with sound_core, it leads to
conflicts with others and let sysfs spewing warnings.
This patch rewrites the registration part of OSS driver to use
the standard method also for additional minor devices.
Reported-by: Steven Rostedt <rostedt@goodmis.org> (with ktest.pl) Tested-by: Steven Rostedt <rostedt@goodmis.org> (with ktest.pl) Signed-off-by: Takashi Iwai <tiwai@suse.de>
Clemens Ladisch [Mon, 7 Mar 2011 12:24:30 +0000 (13:24 +0100)]
ALSA: control: clean up snd_ctl_hole_check()
The return value of snd_ctl_hole_check() is used only to detect whether
to continue the loop in snd_ctl_find_hole() or not, so we can simplify
the code by changing this return type to a boolean. Also rename this
function to better show what it actually does.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Clemens Ladisch [Mon, 7 Mar 2011 12:22:50 +0000 (13:22 +0100)]
ALSA: control: fix numid conflict check for new controls
The purpose of the snd_ctl_hole_check() function is to find conflicts
between the numerical IDs of the new control and those of any existing
controls. However, it would fail to detect an existing control whose
count is smaller than the new control's count and whose interval of IDs
is entirely contained in the interval of the new control's IDs.
To fix this, use the correct formula to detect overlapping intervals,
which happens to simplify the condition.
This problem was not encountered so far because ALSA does not yet allow
drivers to allocate specific control IDs.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Adrian Knoth [Mon, 28 Feb 2011 14:14:50 +0000 (15:14 +0100)]
ALSA: hdspm - Fix midi port initialization
Depending on the model and the presence of a TCO module, the number of
midi ports varies. Some have 1 port (MADIface), some have 2 (default),
with TCO, there are 3.
Don't hardcode the number of midi ports to initialize.
This patch also fixes a boot lockup on MADIface.
[Coding-style fixes by tiwai]
Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Adrian Knoth [Mon, 28 Feb 2011 14:14:49 +0000 (15:14 +0100)]
ALSA: hdspm - Abort on unknown firmware revision
Don't continue if we cannot detect the real card type, otherwise, all
subsequent functions, especially strcpy(), would fail, leaving the whole
driver in an unusable state.
Without such a protection, dmesg would look like this:
The SNDRV_HDSPM_IOCTL_GET_CONFIG_INFO ioctl in hdspm.c allow unprivileged
users to read uninitialized kernel stack memory, because several fields
of the hdspm_config struct declared on the stack are not altered
or zeroed before being copied back to the user. This patch takes care
of it.
Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Adrian Knoth [Wed, 23 Feb 2011 10:43:13 +0000 (11:43 +0100)]
ALSA: hdspm - fix sync check on AES32
Fredrik Lingvall <fredrik.lingvall@gmail.com> has discovered wrong
frequency and sync detection on AES32. According to him, the provided
patch fixes these issues.
Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Adrian Knoth [Wed, 23 Feb 2011 10:43:12 +0000 (11:43 +0100)]
ALSA: hdspm - Remove input selector on MADIface
In contrast to the RME MADI card, coax/optical selection on the MADIface
is done via a physical switch located at the breakout box. Obviously,
the driver cannot switch ports in software.
Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Adrian Knoth [Wed, 23 Feb 2011 10:43:10 +0000 (11:43 +0100)]
ALSA: hdspm - Restrict channel count on RME AES/AES32
Without calling an appropriate rule, AES/AES32 cards would announce a
theoretical channel count of 64 (HDSPM_MAX_CHANNELS), leading to the
already known bug:
We already have all the right values in place, we simply have to inform
the upper layers about this restriction.
Note that snd_hdspm_hw_rule_rate_out_channels and
snd_hdspm_hw_rule_rate_in_channels must not be called on AES32, because
the channel count is always 16, no matter of the samplerate in use.
Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Adrian Knoth [Wed, 23 Feb 2011 10:43:09 +0000 (11:43 +0100)]
ALSA: hdspm - Fix buffer handling on RME MADI/MADIface/AES(32)
Only RayDAT and AIO provide sane buffer pointers that can be used with
HDSPM_BufferPositionMask, on all other cards, this would result in a
wrong HW pointer leading to xruns and these messages:
On RME AES and AES(32), none of the required information
(max_channels_in, max_channels_out, channel mappings, port names) was
set, leading to the BUG below.
This patch adds the missing bits, thus fixing the bug.
Takashi Iwai [Tue, 22 Feb 2011 09:21:18 +0000 (10:21 +0100)]
ALSA: usb-audio: fix oops due to cleanup race when disconnecting
When a USB audio device is disconnected, snd_usb_audio_disconnect()
kills all audio URBs. At the same time, the application, after being
notified of the disconnection, might close the device, in which case
ALSA calls the .hw_free callback, which should free the URBs too.
Commit de1b8b93a0ba "[ALSA] Fix hang-up at disconnection of usb-audio"
prevented snd_usb_hw_free() from freeing the URBs to avoid a hang that
resulted from this race, but this introduced another race because the
URB callbacks could now be executed after snd_usb_hw_free() has
returned, and try to access already freed data.
Fix the first race by introducing a mutex to serialize the disconnect
callback and all PCM callbacks that manage URBs (hw_free and hw_params).
Reported-and-tested-by: Pierre-Louis Bossart <pierre-louis.bossart@intel.com> Cc: <stable@kernel.org>
[CL: also serialize hw_params callback] Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: HDA: Conexant auto: Handle multiple connections to ADC node
Conexant 20641 has several inputs to its ADC node, with one selector
and individual amps for all inputs. This patch adds support in the
Conexant auto parser to handle that case.
It also means that the pin node's volume is being renamed to "Boost"
to avoid name clash with the new volume controls on the ADC node.
BugLink: http://bugs.launchpad.net/bugs/719524 Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Andreas Mohr [Fri, 18 Feb 2011 23:49:48 +0000 (00:49 +0100)]
ALSA: azt3328: hook up new emulated AC97 on AC97 patch side
Make newly created AC97 emulation of azt3328 known to the AC97 layer
side.
- relocate common functions to the top (due to definition after use)
- rename control names
- adjust 3D settings to the card's custom layout of this register
Signed-off-by: Andreas Mohr <andi@lisas.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Andreas Mohr [Fri, 18 Feb 2011 23:49:32 +0000 (00:49 +0100)]
ALSA: azt3328: add custom AC97 semi-emulation use standard ALSA AC97 layer
Make use of the very flexible ALSA ac97 layer (hooks for custom I/O!)
on this weird AC97 copycat hardware,
via semi-extended I/O translation/emulation.
Some 5kB binary/loaded size saved (well... additional huge AC97 module
penalty not factored in, of course ;-P).
Given that the driver previously had 20kB that's not bad,
but the much more important thing is to have AC97 layer stress-tested
with a thoroughly weird AC97 copycat (or, simply put, if it were not for
this AC97 test aspect, this effort would merely have been a nut job ;).
Signed-off-by: Andreas Mohr <andi@lisas.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Daniel Mack [Fri, 11 Feb 2011 11:08:06 +0000 (11:08 +0000)]
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>
Clemens Ladisch [Mon, 14 Feb 2011 10:00:47 +0000 (11:00 +0100)]
ALSA: core: sparse cleanups
Change the core code where sparse complains. In most cases, this means
just adding annotations to confirm that we indeed want to do the dirty
things we're doing.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Commit bb758e9637e5ddc removed snd_hrtimer_callback() from the hardware
interrupt handler, thus moving it into a tasklet, but did not tell the
ALSA timer framework about this, so the timer handling would now be done
in the ALSA timer tasklet scheduled from another tasklet.
To fix this, add the flag to tell the ALSA timer framework that the
timer handler is already being invoked in a tasklet.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Clemens Ladisch [Thu, 10 Feb 2011 15:15:44 +0000 (16:15 +0100)]
ALSA: hrtimer: handle delayed timer interrupts
If a timer interrupt was delayed too much, hrtimer_forward_now() will
forward the timer expiry more than once. When this happens, the
additional number of elapsed ALSA timer ticks must be passed to
snd_timer_interrupt() to prevent the ALSA timer from falling behind.
This mostly fixes MIDI slowdown problems on highly-loaded systems with
badly behaved interrupt handlers.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Reported-and-tested-by: Arthur Marsh <arthur.marsh@internode.on.net> Cc: <stable@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: asihpi - Remove int flag polling code preparing for stream interrupts.
Interrupt flag used for message handshake will be required for
stream interrupts, so conditionally compiled code without
HPI6205_NO_HSR_POLL defined can never be used; removing it.
ALSA: asihpi - Rewrite PCM timer function. Update control names.
Reported samples_played from card may be inaccurate, so don't use it.
Update control names to be closer to alsa standard practice.
Also fixed some accidentally lowercased strings.
[Removed adriver.h inclusion for external module builds by tiwai]
Remove many unused functions.
Update some message and cache structs.
Use pci info directly from pci_dev.
Allow control cache elements with variable size, and handle
large message/response from dsp.
hpi6000 and hpi6205: fix error path when adapter bootload fails.
hpimsgx.c get rid of code duplicated in hpicmn.c
Takashi Iwai [Tue, 8 Feb 2011 16:25:49 +0000 (17:25 +0100)]
ALSA: hda - Fix missing CA initialization for HDMI/DP
The commit 53d7d69d8ffdfa60c5b66cc2e9ee0774aaaef5c0
ALSA: hdmi - support infoframe for DisplayPort
dropped the initialization of CA field accidentally.
This resulted in only two-channel LPCM mode on Nvidia machines.
Dan Carpenter [Mon, 7 Feb 2011 17:25:19 +0000 (20:25 +0300)]
ALSA: USB: 6fire: signedness bug in usb6fire_pcm_prepare()
rt->rate is an unsigned char so it's never equal to -1. It's not a huge
problem because the invalid rate is caught inside the call to
usb6fire_pcm_set_rate() which returns -EINVAL. But if we fix the test
then it prints out the correct error message so that's good.
Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Mark Brown [Thu, 3 Feb 2011 16:27:35 +0000 (16:27 +0000)]
ASoC: Improve WM8994 digital power sequencing
On WM8994 revision D and earlier ensure optimal sequencing with
simultaneous usage of AIF1 and AIF2 by tying the signals together
so if paths through both are connected the streams are started
simultaneously.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Cc: stable@kernel.org
ASoC: fill in snd_soc_pcm_runtime.card before calling snd_soc_dai_link.init()
The .card member of the snd_soc_pcm_runtime structure pointed to by the
snd_soc_dai_link.init() argument used to be initialized before the
function being called. This has changed, probably unintentionally,
after recent refactorings. Since the function implementations are free
to make use of this pointer, move its assignment back before the
function is called to avoid NULL pointer dereferences.
Created and tested on Amstrad Delta againts linux-2.6.38-rc2
Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Takashi Iwai [Wed, 2 Feb 2011 16:49:53 +0000 (17:49 +0100)]
ALSA: use linux/io.h to fix compile warnings
For helping to reduce Greert's regression list...
src/sound/drivers/mtpav.c: error: implicit declaration of function 'inb'
src/sound/drivers/mtpav.c: error: implicit declaration of function 'outb'
...
Takashi Iwai [Wed, 2 Feb 2011 16:16:38 +0000 (17:16 +0100)]
ALSA: hda - Fix memory leaks in conexant jack arrays
The Conexant codec driver adds the jack arrays in init callback which
may be called also in each PM resume. This results in the addition of
new jack element at each time.
The fix is to check whether the requested jack is already present in
the array.
The CX20442 codec driver never provided the snd_soc_codec_driver's
.reg_cache_default member. With the latest ASoC framework changes, it
seems to be referred unconditionally, resulting in a NULL pointer
dereference if missing. Provide it.
Created and tested on Amstrad Delta against linux-2.6.38-rc2
Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
ASoC: Amstrad Delta: fix const related build error
The Amstrad Delta ASoC driver used to override the digital_mute()
callback, expected to be not provided by the on-board CX20442 CODEC
driver, with its own implementation. While this is still posssible when
substituting the whole empty snd_soc_dai_driver.ops member (the CX20442
case), replacing snd_soc_dai_ops.digital_mute only is no longer correct
after the snd_soc_dai_driver.ops member has been constified, and results
in build error.
Drop this actually not used code path in hope the CX20442 driver never
provides its own snd_soc_dai_ops structure.
Created and tested against linux-2.6.38-rc2
Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Clemens Ladisch [Mon, 31 Jan 2011 10:47:52 +0000 (11:47 +0100)]
ALSA: oxygen: fix output routing on Xonar DG
This card uses separate I2S outputs for the front speakers and
headphones, and reverses the order of the three speaker outputs.
To work around this, add a model-specific callback to adjust the
controller's playback routing.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
snd_soc_dapm_put_volsw() has variables for both the unshifted and
shifted mask for updates commit 97404f (ASoC: Do DAPM control updates in
the middle of DAPM sequences) got confused between the two of these.
Since there's no need to keep a copy of the unshifted mask fix this and
simplify the code by using only one mask variable.
[Completely rewrote the changelog to describe the issue -- broonie.]
Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
ASoC: DaVinci: fix kernel panic due to uninitialized platform_data
This patch fixes the Kernel panic issue on accessing davinci_vc in
cq93vc_probe function. struct davinci_vc is part of platform device's
private driver data(codec->dev->p->driver_data) and this is populated
by DaVinci Voice Codec MFD driver.
Signed-off-by: Manjunathappa, Prakash <prakash.pm@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>