If getpaths() returned an odd number this would be a buffer under-run and an
endless loop. It turns out that getpaths() can only return even numbers, but
let's make it easy for people auditing code. With the new code you don't
need to look at getpaths().
This silences a smatch warning.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
In the original code the condition was always true (hopefully) because
WM8776_HPLVOL is zero.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
snd_cs46xx_codec_reset() bypassing the register cache, so as to not
clobber the cached register value during resume.
Signed-off-by: Florian Zumbiehl <florz@florz.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch fixes a division by zero error in the irq handler.
There is a small window between the hw_params() callback and when
runtime->frame_bits is set by ALSA middle layer. When another substream is
already running, if an interrupt is delivered during that window the irq
handler calls pcm_pointer() which does a division by zero. The patch below
makes the irq handler skip substreams that are initialized but not started
yet. Cc to Clemens Ladisch because he proposed an alternate fix.
For more information, please read the original thread in the linux-kernel
mailing list: http://lkml.org/lkml/2010/2/2/187
Signed-off-by: Giuliano Pochini <pochini@shiny.it>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch adds rearranges parts of the initialization code and adds
suspend and resume callbacks.
This patch adds suspend and resume callbacks.
It also rearranges parts of the initialization code so it can be
used in both the first initialization (when the module is loaded we
also have to load default settings) and the resume callback (where
we have to restore the previous settings).
Signed-off-by: Giuliano Pochini <pochini@shiny.it>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Move the controls init code outside the init_hw() function because is must
not be called during resume.
This patch moves the code that initializes the card's controls with
default valued from the init_hw() function into a separated
set_mixer_defaults() function (one for each of the 16 supported
cards). This change is necessary because during resume we must
resurrect the hardware without losing the previous
settings. set_mixer_defaults() must be called only once when the
module is loaded.
Signed-off-by: Giuliano Pochini <pochini@shiny.it>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch implements a simple cache for the firmware files when CONFIG_PM is defined.
This patch changes get_firmware(), free_firmware() and adds
free_firmware_cache(). The first two functions implement a very
simple cache and the latter is used to actually release all the stored
firmwares when the module is unloaded.
When CONFIG_PM is not enabled those functions act as before, that is
free_firmware() releases the firmware immediately and
free_firmware_cache() does nothing.
Signed-off-by: Giuliano Pochini <pochini@shiny.it>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Changes the way the firmware is passed through functions.
When CONFIG_PM is enabled the firmware cannot be released because the
driver will need it again to resume the card.
With this patch the firmware is passed as an index of the struct
firmware card_fw[] in place of a pointer. That same index is then used
to locate the firmware in the firmware cache.
Signed-off-by: Giuliano Pochini <pochini@shiny.it>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Replace the zero-division warning message with WARN_ON_ONCE() per the
advice by Linus. This shouldn't happen, but if it happens, it's
possible that the bug happens often due to buggy IRQs.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
On my AMD780V chipset, hda_intel.c can crash the kernel with a divide by
zero
for as-yet unknown reasons. A simple check for zero prevents it, though
the problem that causes it remains. Since the workaround is harmless and
won't affect anyone except victims of this bug, it should be safe;
moreover,
because this crash can be triggered by a user-mode application, there are
denial of service implications on the systems affected by the bug without
the patch.
Signed-off-by: Jody Bruchon <jody@nctritech.com>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Use DEFINE_PCI_DEVICE_TABLE() to make PCI device ids go to
.devinit.rodata section, so they can be discarded in some cases,
and make them const.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The volume register is from 0..0x7f and 0..0x1a range is mute.
Also, fix mute combining in wm_vol_put(). The wrong behaviour was
noticed by Peter Christensen.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This renames the interrupt name in /proc/interrupt.
HDA Intel -> hda_intel
This also eliminates space from the name, probably helping some
parsers.
Don't think anybody depends on this name in userspace
Signed-off-by: Takashi Iwai <tiwai@suse.de>
My sound codec seems sometimes (very rarely) to omit interrupts (ALC268)
However, interrupt mode still works.
Thus if we get timeout, poll the codec once.
If we get 3 such polls in a row, then switch to polling mode.
This patch is maybe an bandaid, but this might be a workaround for hardware bug.
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
I found that the sampling rate locking setting of the ice1712 sound driver
was only half-respected : when the driver was locked to, let's say, 44100Hz,
and a usermode app was requesting 48000Hz playback, the request was succesful
although the soundcard would continue to run at 44100Hz.
Here's a patch that will make those requests to fail.
Signed-off-by: Sebastien Alaiwan <sebastien.alaiwan@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
After hours of debugging, I finally found the reason why some source
and runtime combination does not work. The PTP (page table pages)
address must be aligned. I am not sure how much, but alignment to
PAGE_SIZE is sufficient. Also, use ALSA's page allocation routines
to ensure proper virtual -> physical address translation.
Cc: <stable@kernel.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Sid Boyce reported that his machine locks up without enable_msi=0 option.
This looks like another ASUS mobo with Nvidia combo.
Reported-by: Sid Boyce <sboyce@blueyonder.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Make sure that capture DMA doesn't stay enabled after system resume
as that potentially prevents the processor from entering deep sleep
states.
Signed-off-by: Florian Zumbiehl <florz@florz.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Now one can choose speaker configuration in e.g. PulseAudio mixer
Signed-off-by: Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The SPDIF-input pin 0x1c is muted by default in hardware. Unmute appropriate
pin to get captured samples instead zeros. Tested on Lenovo Thinkstation.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This patch fixes the aut-mute setup on HP T5735 with ALC262 codec.
Instead of wrong amp, use pin control toggling for muting the speaker now.
Tested-by: Lee Trager <lee.trager@hp.com>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Some codecs disable widgets used for output pins and reserve as vendor-
spec widgets. Thus we need to check the widget type and pin cap before
actually sending SET_EAPD verbs in the auto-configuration mode.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALC259 has a widget NID 0x21 for the output pin, but it wasn't handled
properly in alc268_new_analog_output().
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Sony VAIO VGN-P11G with ALC262 codec has only one input pin, and the
recording doesn't work with model=auto because ALC262 parser sets the
wrong cap NIDs to choose the route and the default route for the sole
input pin wasn't initialized properly. This patch solves these issues.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
On my laptop (HP dv6-1110ax), there are no OEM strings in SMBIOS of type
"HP_Mute_LED*". Hence, the GPIO for the mute button LED doesn't get set
properly. I didn't find the strings in my cousin's laptop (HP dv9500t CTO)
either.
As per the documentation of find_mute_led_gpio(), these strings occur
in HP B-series systems - so, before scanning the SMBIOS strings, we need to
check if we're dealing with a B-series system.
Need to get confirmation from HP if this logic takes care of all the
systems. I'm trying to poke a friend there.
Signed-off-by: Kunal Gangakhedkar <kunal.gangakhedkar@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The capture-related mixer elements are missing with ALC861/ALC660 codecs
when quirks are present, due to missing call of set_capture_mixer().
Reference: Novell bnc#567340
http://bugzilla.novell.com/show_bug.cgi?id=567340
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Cc: <stable@kernel.org>
This patch adds support for automatically muting the speakers when headphones
are inserted, as well as relabelling the headphone widgets from the
non-standard "HP" to the standard "Headphone" for the mb5 model.
Signed-off-by: Alex Murray <murray.alex@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The alc664-mode4 model doesn't seem to fit with Toshiba NB205 correctly.
NB205 uses the pin 0x17 connected with the mixer 0x0f for the speaker
output, which isn't controlled by mode4 model at all.
Rather model=auto works fine as is on the latest driver, so let it back
again.
Tested-by: Nickolas Lloyd <ultrageek.lloyd@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The capture source or input source mixer element wasn't created properly
for ALC861-VD codec due to the wrong NID passed to
alc_auto_create_input_ctls().
References: Novell bnc#568305
http://bugzilla.novell.com/show_bug.cgi?id=568305
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Cc: <stable@kernel.org>
Add the STMicroelectronics ST7597 codec and an unknown codec
from the same manufacturer found on the Creative SB 128 card (CT4810).
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This model needs both 'Headphone Jack Sense' and 'Line Jack Sense' muted
for audible playback, so just add it to the ad1981 jack sense blacklist.
Cc: stable@kernel.org
Tested-by: Pete <x41215201@gmail.com>
Signed-off-by: Daniel T Chen <crimsun@ubuntu.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
The XO's audio hardware is wired up to allow DC sensors (e.g. light
sensors, thermistors, etc) to be plugged in through the microphone jack.
Add sound mixer controls to allow this mode to be enabled and tweaked.
Signed-off-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
The XO-1.5 has a microphone LED designed to indicate to the user when
something is being recorded.
This light is controlled by the microphone bias voltage and it is
currently coming on all the time.
This patch defers the microphone port configuration until when recording
is actually taking place, fixing the behaviour of the LED.
Signed-off-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Added patch for Hewlett-Packard Company Device Subsystem id - 103c:30ea.
Signed-off-by: Ken Prox <kprox@users.sourceforge.net>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>