ALSA: ak4117: Do not free priv until timer handler hasn't actually stopped using it

Function del_timer() does not guarantee that timer was really deleted.
If the timer handler is beeing executed at the moment, the function
does nothing. So, it's possible to use already freed memory in the handler:

[ref: Documentation/DocBook/kernel-locking.tmpl]

This was found using grep and compile-tested only.

Signed-off-by: Kirill Tkhai <ktkhai@parallels.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Merge branch 'for-next'
ALSA: hda - Remove dependency on bus->pci in hda_beep.c

The default parent device can be obtained directly via card object, so
we don't need to rely on pci->dev.parent.  Since there is no access to
pci_dev, we can reduce the inclusion of linux/pci.h, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: hda/realtek - Allow NULL bus->pci

Realtek codec driver contains some codes referring to the PCI
subdevice IDs, but most of them are optional, typically for checking
the codec name variants.  Add NULL checks appropriately so that it can
work without PCI assignment.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: hda - Remove superfluous inclusion of linux/pci.h

Some codec drivers still have it since using PCI_VENDOR_ID_*.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: usb-audio: work around KEF X300A firmware bug

When the driver tries to access Function Unit 10, the KEF X300A
speakers' firmware apparently locks up, making even PCM streaming
impossible.  Work around this by ignoring this FU.

Cc: <stable@vger.kernel.org>
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Merge branch 'for-linus'
ALSA: usx2y: Don't peep the card internal object

Avoid traversing the device object list of the card instance just for
checking the PCM streams.  The driver's private object already
contains the array of substream pointers, so it can be simply looked
through.  The card internal may be restructured in future, thus better
not to rely on it.

Also, this fixes the possible deadlocks in PCM mutex.  Instead of
taking multiple PCM mutexes, just take the common mutex in all
places.  Along with it, rename prepare_mutex as pcm_mutex.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Merge branch 'for-next'
ALSA: hda - add headset mic detect quirks for two Dell laptops

When we plug a 3-ring headset on the Dell machines (Vendor ID:
0x10ec0255, Subsystem ID: 0x10280657; Vendor ID: 0x10ec0255,
Subsystem ID: 0x1028065f), the headset mic can't be
detected, after apply this patch, the headset mic can work well.

BugLink: https://bugs.launchpad.net/bugs/1260303
Cc: David Henningsson <david.henningsson@canonical.com>
Tested-by: Cyrus Lien <cyrus.lien@canonical.com>
Cc: stable@vger.kernel.org
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Merge branch 'for-linus'
ALSA: hda/ca0132 - setup/cleanup streams

When a HDMI stream is opened with the same stream tag
as a following opened stream to ca0132, audio will be
heard from two ports simultaneously.
Fix this issue by change to use snd_hda_codec_setup_stream
and snd_hda_codec_cleanup_stream instead, so that an
inactive stream can be marked as 'dirty' when found
with a conflict stream tag, and then get purified.

Signed-off-by: Hsin-Yu Chao <hychao@chromium.org>
Reviewed-by: Chih-Chung Chang <chihchung@chromium.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: hda/ca0132 - Fix recording from mode id 0x8

Incorrect ADC is picked in ca0132_capture_pcm_prepare(),
where it assumes multiple streams while there is one stream
per ADC. Note that ca0132_capture_pcm_cleanup() already does
the right thing.

The Chromebook Pixel has a microphone under the keyboard that
is attached to node id 0x8. Before this fix, recording would
always go to the main internal mic (node id 0x7).

Signed-off-by: Hsin-Yu Chao <hychao@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Merge branch 'for-linus'