OSDN Git Service

uclinux-h8/linux.git
5 years agoALSA: hda: Add 2 more models to the power_save blacklist
Hans de Goede [Tue, 16 Oct 2018 10:18:21 +0000 (12:18 +0200)]
ALSA: hda: Add 2 more models to the power_save blacklist

Power-saving is causing plops on audio start/stop on Dell Precision T3600
laptops and Intel DZ77BH boards, add these to the power_save blacklist.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1525104
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: asihpi: don't pass GFP_DMA32 to dma_alloc_coherent
Christoph Hellwig [Sat, 13 Oct 2018 15:17:03 +0000 (17:17 +0200)]
ALSA: asihpi: don't pass GFP_DMA32 to dma_alloc_coherent

The DMA API does its own zone decisions based on the coherent_dma_mask.

[ Note: as the driver doesn't set the DMA coherent mask, we can assume
  the default 32bit DMA, hence it should be safe to drop the flag here
  -- tiwai ]

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: au88xx: Add fall-through annotations
Takashi Iwai [Thu, 4 Oct 2018 18:04:38 +0000 (20:04 +0200)]
ALSA: au88xx: Add fall-through annotations

As a preparatory patch for the upcoming -Wimplicit-fallthrough
compiler checks, add the "fall through" annotation in au88xx driver.

Although the usages in both both functions vortex_adbdma_setbuffers()
and vortex_wtdma_setbuffers() look a bit suspicious, we keep the
behavior as before, just to be safer.  If it were broken, we should
have already received bug reports.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: opti92xx-ad1848: Use the standard fall-through annotation
Takashi Iwai [Thu, 4 Oct 2018 18:02:06 +0000 (20:02 +0200)]
ALSA: opti92xx-ad1848: Use the standard fall-through annotation

As a preparatory patch for the upcoming -Wimplicit-fallthrough
compiler checks, replace with the standard "fall through" annotation
at the right places.  They have to be put right before the next
labels.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: seq: oss: Use the standard fall-through annotation
Takashi Iwai [Thu, 4 Oct 2018 17:59:41 +0000 (19:59 +0200)]
ALSA: seq: oss: Use the standard fall-through annotation

As a preparatory patch for the upcoming -Wimplicit-fallthrough
compiler checks, replace with the standard "fall through" annotation.
Unfortunately gcc doesn't understand a chattier text.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: caiaq: Add fall-through annotation
Takashi Iwai [Thu, 4 Oct 2018 17:58:23 +0000 (19:58 +0200)]
ALSA: caiaq: Add fall-through annotation

As a preparatory patch for the upcoming -Wimplicit-fallthrough
compiler checks, add the "fall through" annotation in caiaq driver.
Note that this seems necessary to be put exactly before the next
label, so it's outside the ifdef block.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: memalloc: Add fall-through annotation
Takashi Iwai [Thu, 4 Oct 2018 17:54:51 +0000 (19:54 +0200)]
ALSA: memalloc: Add fall-through annotation

As a preparatory patch for the upcoming -Wimplicit-fallthrough
compiler checks, add the "fall through" annotation in
snd_dma_alloc_pages().  Note that this seems necessary to be put
exactly before the next label, so it's outside the ifdef block.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: firewire-motu: add missing entries to Kconfig
Takashi Sakamoto [Fri, 12 Oct 2018 07:08:59 +0000 (16:08 +0900)]
ALSA: firewire-motu: add missing entries to Kconfig

MOTU Traveler and Audio Express are supported as well.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: isight: fix leak of reference to firewire unit in error path of .probe callback
Takashi Sakamoto [Fri, 12 Oct 2018 05:25:22 +0000 (14:25 +0900)]
ALSA: isight: fix leak of reference to firewire unit in error path of .probe callback

In some error paths, reference count of firewire unit is not decreased.
This commit fixes the bug.

Fixes: 5b14ec25a79b('ALSA: firewire: release reference count of firewire unit in .remove callback of bus driver')
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda - Add mic quirk for the Lenovo G50-30 (17aa:3905)
Jeremy Cline [Thu, 11 Oct 2018 19:49:17 +0000 (15:49 -0400)]
ALSA: hda - Add mic quirk for the Lenovo G50-30 (17aa:3905)

The Lenovo G50-30, like other G50 models, has a Conexant codec that
requires a quirk for its inverted stereo dmic.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1249364
Reported-by: Alexander Ploumistos <alex.ploumistos@gmail.com>
Tested-by: Alexander Ploumistos <alex.ploumistos@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jeremy Cline <jcline@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: firewire: simplify cleanup process when failing to register sound card
Takashi Sakamoto [Wed, 10 Oct 2018 06:35:02 +0000 (15:35 +0900)]
ALSA: firewire: simplify cleanup process when failing to register sound card

In former commits, .private_free callback releases resources just for
data transmission. This release function can be called without the
resources are actually allocated in error paths.

This commit applies a small refactoring to clean up codes in error
paths.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: bebob/fireworks: simplify handling of local device entry table
Takashi Sakamoto [Wed, 10 Oct 2018 06:35:01 +0000 (15:35 +0900)]
ALSA: bebob/fireworks: simplify handling of local device entry table

In drivers of ALSA firewire stack, bebob and fireworks drivers have
local device entry table. At present, critical section to operate the
table is from the beginning/end of 'do_registration' call. This can be
more narrow and simplify codes.

This commit applies small refactoring for the above purpose.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: firewire: release reference count of firewire unit in .remove callback of bus...
Takashi Sakamoto [Wed, 10 Oct 2018 06:35:00 +0000 (15:35 +0900)]
ALSA: firewire: release reference count of firewire unit in .remove callback of bus driver

In a previous commit, drivers in ALSA firewire stack blocks .remove
callback of bus driver. This enables to release members of private
data in the callback after releasing device of sound card.

This commit simplifies codes to release the members.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: firewire: block .remove callback of bus driver till all of ALSA character devic...
Takashi Sakamoto [Wed, 10 Oct 2018 06:34:59 +0000 (15:34 +0900)]
ALSA: firewire: block .remove callback of bus driver till all of ALSA character devices are released

At present, in .remove callback of bus driver just decrease reference
count of device for ALSA card instance. This delegates release of the
device to a process in which the last of ALSA character device is
released.

On the other hand, the other drivers such as for devices on PCIe are
programmed to block .remove callback of bus driver till all of ALSA
character devices are released.

For consistency of behaviour for whole drivers, this probably confuses
users. This commit takes drivers in ALSA firewire stack to imitate the
above behaviour.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/realtek - Fix the problem of the front MIC on the Lenovo M715
Hui Wang [Wed, 10 Oct 2018 03:57:25 +0000 (11:57 +0800)]
ALSA: hda/realtek - Fix the problem of the front MIC on the Lenovo M715

The front MIC on the Lenovo M715 can't record sound, after applying
the ALC294_FIXUP_LENOVO_MIC_LOCATION, the problem is fixed. So add
the pin configuration of this machine to the pin quirk table.

Cc: <stable@vger.kernel.org>
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda - Fix headphone pin config for ASUS G751
Takashi Iwai [Tue, 9 Oct 2018 12:20:17 +0000 (14:20 +0200)]
ALSA: hda - Fix headphone pin config for ASUS G751

BIOS on ASUS G751 doesn't seem to map the headphone pin (NID 0x16)
correctly.  Add a quirk to address it, as well as chaining to the
previous fix for the microphone.

Reported-by: Håvard <hovardslill@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Fix input effect controls for desktop cards
Connor McAdams [Mon, 8 Oct 2018 19:40:00 +0000 (15:40 -0400)]
ALSA: hda/ca0132 - Fix input effect controls for desktop cards

This patch removes the echo cancellation control for desktop cards, and
makes use of the special 0x47 SCP command for noise reduction.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Add error checking in ca0132_build_controls()
Connor McAdams [Mon, 8 Oct 2018 19:39:59 +0000 (15:39 -0400)]
ALSA: hda/ca0132 - Add error checking in ca0132_build_controls()

This patch adds error checking to functions creating controls inside of
ca0132_build_controls().

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Clean up patch_ca0132()
Connor McAdams [Mon, 8 Oct 2018 19:39:58 +0000 (15:39 -0400)]
ALSA: hda/ca0132 - Clean up patch_ca0132()

This patch cleans up the patch_ca0132() function with suggestions from
Takashi Sakamoto.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Fix microphone inconsistency issues
Connor McAdams [Mon, 8 Oct 2018 19:39:57 +0000 (15:39 -0400)]
ALSA: hda/ca0132 - Fix microphone inconsistency issues

This patch fixes microphone inconsistency issues by adding a delay to
each setup_defaults function. Without this, the microphone only works
intermittently.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda - Add ASUS G751 quirk model entry
Takashi Iwai [Sun, 7 Oct 2018 07:47:39 +0000 (09:47 +0200)]
ALSA: hda - Add ASUS G751 quirk model entry

Add a corresponding model list entry for ASUS G751 so that user can
test the quirk for another compatible machines more easily.

Reported-and-tested-by: Håvard <hovardslill@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda - Add quirk for ASUS G751 laptop
Takashi Iwai [Sun, 7 Oct 2018 07:44:17 +0000 (09:44 +0200)]
ALSA: hda - Add quirk for ASUS G751 laptop

ASUS G751 requires the extra COEF initialization to make it microphone
working properly.

Reported-and-tested-by: Håvard <hovardslill@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: usb-audio: Add custom mixer status quirks for RME CC devices
Jussi Laako [Fri, 5 Oct 2018 08:00:04 +0000 (11:00 +0300)]
ALSA: usb-audio: Add custom mixer status quirks for RME CC devices

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>
5 years agoALSA: usb-audio: update quirk for B&W PX to remove microphone
Nicolas Huaman [Thu, 4 Oct 2018 14:42:05 +0000 (16:42 +0200)]
ALSA: usb-audio: update quirk for B&W PX to remove microphone

A quirk in snd-usb-audio was added to automate setting sample rate to
4800k and remove the previously exposed nonfunctional microphone for
the Bowers & Wilkins PX:
commit 240a8af929c7c57dcde28682725b29cf8474e8e5
https://lore.kernel.org/patchwork/patch/919689/

However the headphones where updated shortly after that to remove the
unintentional microphone functionality. I guess because of this the
headphones now crash when connecting them via USB while the quirk is
active. Dmesg:

snd-usb-audio: probe of 2-3:1.0 failed with error -22
usb 2-3: 2:1: cannot get min/max values for control 2 (id 2)

This patch removes the microfone and allows the headphones to connect
and work out of the box. It is based on the current mainline kernel
 and successfully applied an tested on my machine (4.18.10.arch1-1).

Fixes: 240a8af929c7 ("ALSA: usb-audio: Add a quirck for B&W PX headphones")
Signed-off-by: Nicolas Huaman <nicolas@herochao.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/sigmatel - Disable automute for Elo VuPoint
Michael Pobega [Thu, 4 Oct 2018 18:58:21 +0000 (14:58 -0400)]
ALSA: hda/sigmatel - Disable automute for Elo VuPoint

The Elo VuPoint 15MX has two headphone jacks of which neither work by
default. Disabling automute allows ALSA to work normally with the
speakers & left headphone jack.

Future pin configuration changes may be required in the future to get
the right headphone jack working in tandem.

Signed-off-by: Michael Pobega <mpobega@neverware.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: rawmidi: A lightweight function to discard pending bytes
Takashi Iwai [Thu, 13 Sep 2018 06:20:43 +0000 (08:20 +0200)]
ALSA: rawmidi: A lightweight function to discard pending bytes

For discarding the pending bytes on rawmidi, we process with a loop of
snd_rawmidi_transmit() which is just a waste of CPU power.
Implement a lightweight API function to discard the pending bytes and
the proceed the ring buffer instantly, and use it instead of open
codes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: oxfw: use managed-resource to maintain cache of stream formats
Takashi Sakamoto [Tue, 2 Oct 2018 23:21:54 +0000 (08:21 +0900)]
ALSA: oxfw: use managed-resource to maintain cache of stream formats

ALSA oxfw driver allocates memory objects for cache of stream formats.
The objects are used to maintain packet streaming by components for
ALSA rawMIDI/PCM interface. They can be released as managed-resource
of 'struct snd_card.card_dev'.

This commit uses managed-resource of the sound card device for this
purpose.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: oxfw: use managed-resource to maintain model-specific data
Takashi Sakamoto [Tue, 2 Oct 2018 23:21:53 +0000 (08:21 +0900)]
ALSA: oxfw: use managed-resource to maintain model-specific data

ALSA oxfw driver allocates memory objects for data specific to some
models. These objects are used to maintain functionalities specific
to the models for ALSA rawMIDI/control interfaces. They can be
released as managed-resource of 'struct snd_card.card_dev'.

This commit uses managed-resource of the sound card device for this
purpose.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: fireworks: use managed-resource to maintain response buffer
Takashi Sakamoto [Tue, 2 Oct 2018 23:21:52 +0000 (08:21 +0900)]
ALSA: fireworks: use managed-resource to maintain response buffer

ALSA fireworks driver allocates memory object to handle response from
target unit. The object is used to initiate transaction unique to
Fireworks board module. This can be released as managed-resource
of 'struct snd_card.card_dev'.

This commit uses managed-resource of the sound card device for this
purpose.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: bebob: use managed-resource to maintain data specific to M-Audio FW-1814/Projec...
Takashi Sakamoto [Tue, 2 Oct 2018 23:21:51 +0000 (08:21 +0900)]
ALSA: bebob: use managed-resource to maintain data specific to M-Audio FW-1814/ProjectMix I/O

ALSA bebob driver allocates memory object for data specific to M-Audio
FW-1884/ProjectMix I/O. The object is to maintain format of isochronous
packet payload for packet streaming by components for ALSA rawMIDI/PCM
interfaces. The object can be released as managed-resource of
'struct snd_card.card_dev'.

This commit uses managed-resource of the sound card device for this
purpose.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: firewire: use managed-resource of fw unit device for private data
Takashi Sakamoto [Tue, 2 Oct 2018 23:21:50 +0000 (08:21 +0900)]
ALSA: firewire: use managed-resource of fw unit device for private data

At present, private data of each driver in ALSA firewire stack is
allocated/freed by kernel slab allocator for corresponding unit on
IEEE 1394 bus. In this case, resource-managed slab allocator is
available to release memory object automatically just before releasing
device structure for the unit. This idea can prevent runtime from
memory leak due to programming mistakes.

This commit uses the allocator for the private data. These drivers
already use reference counter to maintain lifetime of device structure
for the unit by a pair of fw_unit_get()/fw_unit_put(). The private data
is safely released in a callback of 'struct snd_card.private_free().

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoMerge branch 'for-linus' into for-next
Takashi Iwai [Thu, 4 Oct 2018 05:52:58 +0000 (07:52 +0200)]
Merge branch 'for-linus' into for-next

Back-merge 4.19-devel branch into 4.20 for applying FireWire patches
cleanly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/realtek - Cannot adjust speaker's volume on Dell XPS 27 7760
Kai-Heng Feng [Thu, 4 Oct 2018 03:39:42 +0000 (11:39 +0800)]
ALSA: hda/realtek - Cannot adjust speaker's volume on Dell XPS 27 7760

The issue is the same as commit dd9aa335c880 ("ALSA: hda/realtek - Can't
adjust speaker's volume on a Dell AIO"), the output requires to connect
to a node with Amp-out capability.

Applying the same fixup ALC298_FIXUP_SPK_VOLUME can fix the issue.

BugLink: https://bugs.launchpad.net/bugs/1775068
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: intel8x0: Fix fall-through annotations
Gustavo A. R. Silva [Wed, 3 Oct 2018 10:38:36 +0000 (12:38 +0200)]
ALSA: intel8x0: Fix fall-through annotations

Replace "fallthru" with a proper "fall through" annotation.

This fix is part of the ongoing efforts to enabling
-Wimplicit-fallthrough

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: sb8: Fix fall-through annotations
Gustavo A. R. Silva [Tue, 2 Oct 2018 09:56:36 +0000 (11:56 +0200)]
ALSA: sb8: Fix fall-through annotations

Replace "fallthru" with a proper "fall through" annotation.

This fix is part of the ongoing efforts to enabling
-Wimplicit-fallthrough

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: firewire-lib: add PCM rules to obsolete PCM constraints based on LCM of SYT_INT...
Takashi Sakamoto [Sun, 30 Sep 2018 19:11:49 +0000 (04:11 +0900)]
ALSA: firewire-lib: add PCM rules to obsolete PCM constraints based on LCM of SYT_INTERVAL

In blocking mode of IEC 61883-1/6, when one isochronous packet includes
data for events, the data is for the same number of events as
SYT_INTERVAL decided according to sampling transmission frequency (SFC).

IEC 61883-1/6 engine of ALSA firewire stack applies constraints of
period and buffer size of PCM intermediate buffer of PCM substream.
At present, this constraint is designed to round the size up/down to
32 frames. This value comes from the least common multiple (LCM) of
SYT_INTERVAL. Although this looks to work well, in lower sampling
rate, applications are not allowed to set size of period quite near
period time constraint (at present 5 msec per period).

This commit adds PCM rules for period/buffer size and rate to obsoletes
the constraints based on LCM.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Add ZxR exit commands
Connor McAdams [Sun, 30 Sep 2018 03:03:26 +0000 (23:03 -0400)]
ALSA: hda/ca0132 - Add ZxR exit commands

This patch adds exit operations for the Sound Blaster ZxR.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Add ZxR 600 ohm gain control
Connor McAdams [Sun, 30 Sep 2018 03:03:25 +0000 (23:03 -0400)]
ALSA: hda/ca0132 - Add ZxR 600 ohm gain control

This patch adds a control for 600 ohm gain on the Sound Blaster ZxR.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Remove input select enum for ZxR
Connor McAdams [Sun, 30 Sep 2018 03:03:24 +0000 (23:03 -0400)]
ALSA: hda/ca0132 - Remove input select enum for ZxR

This patch removes the input select control for the ZxR, as it only has
one input option, rear microphone.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Add ZxR input/output select commands
Connor McAdams [Sun, 30 Sep 2018 03:03:23 +0000 (23:03 -0400)]
ALSA: hda/ca0132 - Add ZxR input/output select commands

This patch adds commands for selecting input and output on the Sound
Blaster ZxR. The ZxR has no front panel header, and has line-in on the
separate daughter board, so it only does rear-mic.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Add ZxR DSP post-download commands
Connor McAdams [Sun, 30 Sep 2018 03:03:22 +0000 (23:03 -0400)]
ALSA: hda/ca0132 - Add ZxR DSP post-download commands

This patch adds commands for setting up the ZxR after the DSP is
downloaded. The ZxR already shares most of the post-download commands
from the regular Sound Blaster Z.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Add ZxR init commands
Connor McAdams [Sun, 30 Sep 2018 03:03:21 +0000 (23:03 -0400)]
ALSA: hda/ca0132 - Add ZxR init commands

This patch adds init commands for the main Sound Blaster ZxR card.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Add DBpro hda_codec_ops
Connor McAdams [Sun, 30 Sep 2018 03:03:20 +0000 (23:03 -0400)]
ALSA: hda/ca0132 - Add DBpro hda_codec_ops

This patch adds separate hda_codec_ops for the DBPro daughter board, as
it behaves more like a generic HDA codec than the other ca0132 cards,
despite having a ca0132 on board.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Add ZxR pincfg
Connor McAdams [Sun, 30 Sep 2018 03:03:19 +0000 (23:03 -0400)]
ALSA: hda/ca0132 - Add ZxR pincfg

This patch adds a pincfg for the ZxR, and defines which pins are used
for both.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Add ZxR quirks + new quirk check function
Connor McAdams [Sun, 30 Sep 2018 03:03:18 +0000 (23:03 -0400)]
ALSA: hda/ca0132 - Add ZxR quirks + new quirk check function

This patch adds quirk ID's for the ZxR and it's daughter board, the
DBPro. It also adds a function for determining the quirk for each board
through HDA subsytem ID's instead of PCI subsystem ID's.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Fix surround sound with output effects
Connor McAdams [Sun, 30 Sep 2018 03:03:17 +0000 (23:03 -0400)]
ALSA: hda/ca0132 - Fix surround sound with output effects

This patch fixes an issue where if surround sound was the selected
output and output effects were enabled, the sound wasn't sent to all
channels correctly.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Fix AE-5 control type
Connor McAdams [Sun, 30 Sep 2018 03:03:16 +0000 (23:03 -0400)]
ALSA: hda/ca0132 - Fix AE-5 control type

This patch corrects the control type of the additional AE-5 controls
added in a previous patch from HDA_INPUT to HDA_OUTPUT.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: timer: fix wrong comment to refer to 'SNDRV_TIMER_PSFLG_*'
Takashi Sakamoto [Sat, 29 Sep 2018 14:20:51 +0000 (23:20 +0900)]
ALSA: timer: fix wrong comment to refer to 'SNDRV_TIMER_PSFLG_*'

ALSA timer core has a comment referring to 'SNDRV_MIXER_PSFLG_*' in
a definition of 'struct snd_timer_params' of UAPI header. I can see
this in initial state of ALSA timer core, at least in
'alsa-driver-0.4.0.tar.gz'.

This commit fixes the comment.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda: Fix mismatch for register mask and value in ext controller.
Keyon Jie [Fri, 28 Sep 2018 09:38:59 +0000 (17:38 +0800)]
ALSA: hda: Fix mismatch for register mask and value in ext controller.

E.g. for snd_hdac_ext_bus_link_power_up(), we should set mask to be
AZX_MLCTL_SPA(it was 0), and AZX_MLCTL_SPA as value to power up it,
here correct it and several similar mismatches.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Add AE-5 exit function
Connor McAdams [Tue, 18 Sep 2018 18:33:43 +0000 (14:33 -0400)]
ALSA: hda/ca0132 - Add AE-5 exit function

This patch adds exit commands for the AE-5.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Add AE-5 specific controls
Connor McAdams [Tue, 18 Sep 2018 18:33:42 +0000 (14:33 -0400)]
ALSA: hda/ca0132 - Add AE-5 specific controls

This patch adds controls for the AE-5's headphone gain setting, and the
DAC's interpolation filter setting.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Add input selection commands for AE-5
Connor McAdams [Tue, 18 Sep 2018 18:33:41 +0000 (14:33 -0400)]
ALSA: hda/ca0132 - Add input selection commands for AE-5

This patch adds the input selection commands for the Sound BlasterX
AE-5.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Add output set commands for AE-5
Connor McAdams [Tue, 18 Sep 2018 18:33:40 +0000 (14:33 -0400)]
ALSA: hda/ca0132 - Add output set commands for AE-5

This patch adds output selection commands for the AE-5.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Clean up ca0132_alt_out_select
Connor McAdams [Tue, 18 Sep 2018 18:33:39 +0000 (14:33 -0400)]
ALSA: hda/ca0132 - Clean up ca0132_alt_out_select

This patch cleans up ca0132_alt_out_select by moving the card specific
output commands into a separate function. As more cards are added, the
function ca0132_alt_out_select is going to get more bloated with these,
so moving into a separate function tries to keep that from happening.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Add DSP setup functions for AE-5
Connor McAdams [Tue, 18 Sep 2018 18:33:38 +0000 (14:33 -0400)]
ALSA: hda/ca0132 - Add DSP setup functions for AE-5

This patch adds DSP setup functions for the AE-5.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Merge post-dsp functions + cleanup
Connor McAdams [Tue, 18 Sep 2018 18:33:37 +0000 (14:33 -0400)]
ALSA: hda/ca0132 - Merge post-dsp functions + cleanup

This patch cleans up some of the formatting of the post-dsp load setup
functions, and also merges some of the sub functions into individual
ones.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Change firmware name and usage
Connor McAdams [Tue, 18 Sep 2018 18:33:36 +0000 (14:33 -0400)]
ALSA: hda/ca0132 - Change firmware name and usage

The Recon3D, AE-5, Z and ZxR all share the same firmware file. Rename
this from the specific "ctefx-sbz.bin" to "ctefx-desktop.bin" and set
the AE-5 and Recon3D to use it as well.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Add AE-5 regular init setup
Connor McAdams [Tue, 18 Sep 2018 18:33:35 +0000 (14:33 -0400)]
ALSA: hda/ca0132 - Add AE-5 regular init setup

This patch adds AE-5 specific stuff to the ca0132_alt_init function.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Add AE-5 pre-init and ca0113 functions
Connor McAdams [Tue, 18 Sep 2018 18:33:34 +0000 (14:33 -0400)]
ALSA: hda/ca0132 - Add AE-5 pre-init and ca0113 functions

This patch adds AE-5 pre-init functions that happen before the main
ca0132_alt_init, and gives functions related to the ca0113 a ca0113
prefix instead of ca0132. It also adds functions to write to the 8051's
SFRs, and to write the special ca0113 commands for the AE-5.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Change ca0132_mmio_init for AE-5
Connor McAdams [Tue, 18 Sep 2018 18:33:33 +0000 (14:33 -0400)]
ALSA: hda/ca0132 - Change ca0132_mmio_init for AE-5

This patch adds the unique writes for the AE-5 on startup to
ca0132_mmio_init. The other cards share some addresses written to, but
use different values.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Set AE-5 bools and select mixer
Connor McAdams [Tue, 18 Sep 2018 18:33:32 +0000 (14:33 -0400)]
ALSA: hda/ca0132 - Set AE-5 bools and select mixer

This patch sets the bool values for the AE-5, as well as selects the
mixer it will use.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Add pincfg for AE-5
Connor McAdams [Tue, 18 Sep 2018 18:33:31 +0000 (14:33 -0400)]
ALSA: hda/ca0132 - Add pincfg for AE-5

This patch adds the pincfg for the Sound BlasterX AE-5, and cleans up
the function it's assigned in.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Add quirk for Sound BlasterX AE-5
Connor McAdams [Tue, 18 Sep 2018 18:33:30 +0000 (14:33 -0400)]
ALSA: hda/ca0132 - Add quirk for Sound BlasterX AE-5

This patch adds the PCI subsys ID quirk for the Sound BlasterX AE-5.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda/ca0132 - Define new verbs and control params
Connor McAdams [Tue, 18 Sep 2018 18:33:29 +0000 (14:33 -0400)]
ALSA: hda/ca0132 - Define new verbs and control params

This patch defines some new verbs found from reverse engineering of the
onboard 8051 CPU, and a control param found there as well. This clears
up usage of these verbs in other parts of the driver, and removes their
usage where they're now known to be unnecessary.

Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: xen-front: Refine indentations and constify snd_pcm_ops
Nick Simonov [Wed, 19 Sep 2018 21:47:10 +0000 (00:47 +0300)]
ALSA: xen-front: Refine indentations and constify snd_pcm_ops

snd_pcm_ops are not supposed to change. So mark the
non-const structs as const. Also, refine indentation
to ncrease readability.

Signed-off-by: Nick Simonov <nicksimonovv@gmail.com>
Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda: Fix the audio-component completion timeout
Takashi Iwai [Tue, 18 Sep 2018 16:21:11 +0000 (18:21 +0200)]
ALSA: hda: Fix the audio-component completion timeout

The timeout of audio component binding was incorrectly specified in
msec, not in jiffies, which results in way too shorter timeout than
expected.

Along with fixing it, add the information print about the binding
failure to show the unexpected situation more clearly.

Fixes: a57942bfdd61 ("ALSA: hda: Make audio component support more generic")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoMerge tag 'asoc-v4.19-rc4' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie...
Takashi Iwai [Mon, 17 Sep 2018 16:59:21 +0000 (18:59 +0200)]
Merge tag 'asoc-v4.19-rc4' of https://git./linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v4.19

This is the usual set of small fixes scatterd around various drivers,
plus one fix for DAPM and a UAPI build fix.  There's not a huge amount
that stands out here relative to anything else.

5 years agoALSA: fireworks: fix memory leak of response buffer at error path
Takashi Sakamoto [Mon, 17 Sep 2018 08:26:41 +0000 (17:26 +0900)]
ALSA: fireworks: fix memory leak of response buffer at error path

After allocating memory object for response buffer, ALSA fireworks
driver has leak of the memory object at error path.

This commit releases the object at the error path.

Fixes: 7d3c1d5901aa('ALSA: fireworks: delayed registration of sound card')
Cc: <stable@vger.kernel.org> # v4.7+
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: oxfw: fix memory leak of discovered stream formats at error path
Takashi Sakamoto [Mon, 17 Sep 2018 08:26:20 +0000 (17:26 +0900)]
ALSA: oxfw: fix memory leak of discovered stream formats at error path

After finishing discover of stream formats, ALSA OXFW driver has memory
leak of allocated memory object at error path.

This commit releases the memory object at the error path.

Fixes: 6c29230e2a5f ('ALSA: oxfw: delayed registration of sound card')
Cc: <stable@vger.kernel.org> # v4.7+
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: oxfw: fix memory leak for model-dependent data at error path
Takashi Sakamoto [Mon, 17 Sep 2018 08:26:08 +0000 (17:26 +0900)]
ALSA: oxfw: fix memory leak for model-dependent data at error path

After allocating model-dependent data, ALSA OXFW driver has memory leak
of the data at error path.

This commit releases the data at the error path.

Fixes: 6c29230e2a5f ('ALSA: oxfw: delayed registration of sound card')
Cc: <stable@vger.kernel.org> # v4.7+
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: bebob: fix memory leak for M-Audio FW1814 and ProjectMix I/O at error path
Takashi Sakamoto [Mon, 17 Sep 2018 08:25:24 +0000 (17:25 +0900)]
ALSA: bebob: fix memory leak for M-Audio FW1814 and ProjectMix I/O at error path

After allocating model-dependent data for M-Audio FW1814 and ProjectMix
I/O, ALSA bebob driver has memory leak at error path.

This commit releases the allocated data at the error path.

Fixes: 04a2c73c97eb('ALSA: bebob: delayed registration of sound card')
Cc: <stable@vger.kernel.org> # v4.7+
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: atiixp: fix fall-through annotations
Gustavo A. R. Silva [Thu, 13 Sep 2018 18:43:47 +0000 (13:43 -0500)]
ALSA: atiixp: fix fall-through annotations

Replace "fallthru" with a proper "fall through" annotation.

This fix is part of the ongoing efforts to enabling
-Wimplicit-fallthrough

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda - Enable runtime PM only for discrete GPU
Takashi Iwai [Mon, 10 Sep 2018 14:20:25 +0000 (16:20 +0200)]
ALSA: hda - Enable runtime PM only for discrete GPU

The recent change of vga_switcheroo allowed the runtime PM for
HD-audio on AMD GPUs, but this also resulted in a regression.  When
the HD-audio controller driver gets runtime-suspended, HD-audio link
is turned off, and the hotplug notification is ignored.  This leads to
the inconsistent audio state (the connection isn't notified and ELD is
ignored).

The best fix would be to implement the proper ELD notification via the
audio component, but it's still not ready.  As a quick workaround,
this patch adds the check of runtime_idle and allows the runtime
suspend only when the vga_switcheroo is bound with discrete GPU.
That is, a system with a single GPU and APU would be again without
runtime PM to keep the HD-audio link for the hotplug notification and
ELD read out.

Also, the codec->auto_runtime_pm flag is set only for the discrete GPU
at the time GPU gets bound via vga_switcheroo (i.e. only dGPU is
forcibly runtime-PM enabled), so that APU can still get the ELD
notification.

For identifying which GPU is bound, a new vga_switcheroo client
callback, gpu_bound, is implemented.  The vga_switcheroo simply calls
this when GPU is bound, and tells whether it's dGPU or APU.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=200945
Fixes: 07f4f97d7b4b ("vga_switcheroo: Use device link for HDA controller")
Reported-by: Jian-Hong Pan <jian-hong@endlessm.com>
Tested-by: Jian-Hong Pan <jian-hong@endlessm.com>
Acked-by: Lukas Wunner <lukas@wunner.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: oxfw: fix memory leak of private data
Takashi Sakamoto [Thu, 13 Sep 2018 12:31:18 +0000 (21:31 +0900)]
ALSA: oxfw: fix memory leak of private data

Although private data of sound card instance is usually allocated in the
tail of the instance, drivers in ALSA firewire stack allocate the private
data before allocating the instance. In this case, the private data
should be released explicitly at .private_free callback of the instance.

This commit fixes memory leak following to the above design.

Fixes: 6c29230e2a5f ('ALSA: oxfw: delayed registration of sound card')
Cc: <stable@vger.kernel.org> # v4.7+
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: firewire-tascam: fix memory leak of private data
Takashi Sakamoto [Thu, 13 Sep 2018 12:31:05 +0000 (21:31 +0900)]
ALSA: firewire-tascam: fix memory leak of private data

Although private data of sound card instance is usually allocated in the
tail of the instance, drivers in ALSA firewire stack allocate the private
data before allocating the instance. In this case, the private data
should be released explicitly at .private_free callback of the instance.

This commit fixes memory leak following to the above design.

Fixes: b610386c8afb ('ALSA: firewire-tascam: deleyed registration of sound card')
Cc: <stable@vger.kernel.org> # v4.7+
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: firewire-digi00x: fix memory leak of private data
Takashi Sakamoto [Thu, 13 Sep 2018 12:30:34 +0000 (21:30 +0900)]
ALSA: firewire-digi00x: fix memory leak of private data

Although private data of sound card instance is usually allocated in the
tail of the instance, drivers in ALSA firewire stack allocate the private
data before allocating the instance. In this case, the private data
should be released explicitly at .private_free callback of the instance.

This commit fixes memory leak following to the above design.

Fixes: 86c8dd7f4da3 ('ALSA: firewire-digi00x: delayed registration of sound card')
Cc: <stable@vger.kernel.org> # v4.7+
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: intel8x0m: Register irq handler after register initializations
Takashi Iwai [Tue, 28 Aug 2018 14:39:10 +0000 (16:39 +0200)]
ALSA: intel8x0m: Register irq handler after register initializations

The interrupt handler has to be acquired after the other resource
initialization when allocated with IRQF_SHARED.  Otherwise it's
triggered before the resource gets ready, and may lead to unpleasant
behavior.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agosound: don't call skl_init_chip() to reset intel skl soc
Yu Zhao [Tue, 11 Sep 2018 21:15:16 +0000 (15:15 -0600)]
sound: don't call skl_init_chip() to reset intel skl soc

Internally, skl_init_chip() calls snd_hdac_bus_init_chip() which
1) sets bus->chip_init to prevent multiple entrances before device
is stopped; 2) enables interrupt.

We shouldn't use it for the purpose of resetting device only because
1) when we really want to initialize device, we won't be able to do
so; 2) we are ready to handle interrupt yet, and kernel crashes when
interrupt comes in.

Rename azx_reset() to snd_hdac_bus_reset_link(), and use it to reset
device properly.

Fixes: 60767abcea3d ("ASoC: Intel: Skylake: Reset the controller in probe")
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Yu Zhao <yuzhao@google.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agosound: enable interrupt after dma buffer initialization
Yu Zhao [Tue, 11 Sep 2018 21:14:04 +0000 (15:14 -0600)]
sound: enable interrupt after dma buffer initialization

In snd_hdac_bus_init_chip(), we enable interrupt before
snd_hdac_bus_init_cmd_io() initializing dma buffers. If irq has
been acquired and irq handler uses the dma buffer, kernel may crash
when interrupt comes in.

Fix the problem by postponing enabling irq after dma buffer
initialization. And warn once on null dma buffer pointer during the
initialization.

Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Yu Zhao <yuzhao@google.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoRevert "ASoC: Intel: Skylake: Acquire irq after RIRB allocation"
Yu Zhao [Tue, 11 Sep 2018 21:12:46 +0000 (15:12 -0600)]
Revert "ASoC: Intel: Skylake: Acquire irq after RIRB allocation"

This reverts commit 12eeeb4f4733bbc4481d01df35933fc15beb8b19.

The patch doesn't fix accessing memory with null pointer in
skl_interrupt().

There are two problems: 1) skl_init_chip() is called twice, before
and after dma buffer is allocate. The first call sets bus->chip_init
which prevents the second from initializing bus->corb.buf and
rirb.buf from bus->rb.area. 2) snd_hdac_bus_init_chip() enables
interrupt before snd_hdac_bus_init_cmd_io() initializing dma buffers.
There is a small window which skl_interrupt() can be called if irq
has been acquired. If so, it crashes when using null dma buffer
pointers.

Will fix the problems in the following patches. Also attaching the
crash for future reference.

[   16.949148] general protection fault: 0000 [#1] PREEMPT SMP KASAN PTI
<snipped>
[   16.950903] Call Trace:
[   16.950906]  <IRQ>
[   16.950918]  skl_interrupt+0x19e/0x2d6 [snd_soc_skl]
[   16.950926]  ? dma_supported+0xb5/0xb5 [snd_soc_skl]
[   16.950933]  __handle_irq_event_percpu+0x27a/0x6c8
[   16.950937]  ? __irq_wake_thread+0x1d1/0x1d1
[   16.950942]  ? __do_softirq+0x57a/0x69e
[   16.950944]  handle_irq_event_percpu+0x95/0x1ba
[   16.950948]  ? _raw_spin_unlock+0x65/0xdc
[   16.950951]  ? __handle_irq_event_percpu+0x6c8/0x6c8
[   16.950953]  ? _raw_spin_unlock+0x65/0xdc
[   16.950957]  ? time_cpufreq_notifier+0x483/0x483
[   16.950959]  handle_irq_event+0x89/0x123
[   16.950962]  handle_fasteoi_irq+0x16f/0x425
[   16.950965]  handle_irq+0x1fe/0x28e
[   16.950969]  do_IRQ+0x6e/0x12e
[   16.950972]  common_interrupt+0x7a/0x7a
[   16.950974]  </IRQ>
<snipped>
[   16.951031] RIP: snd_hdac_bus_update_rirb+0x19b/0x4cf [snd_hda_core] RSP: ffff88015c807c08
[   16.951036] ---[ end trace 58bf9ece1775bc92 ]---

Fixes: 2eeeb4f4733b ("ASoC: Intel: Skylake: Acquire irq after RIRB allocation")
Signed-off-by: Yu Zhao <yuzhao@google.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoALSA: hda: fix unused variable warning
Anders Roxell [Tue, 11 Sep 2018 14:18:36 +0000 (16:18 +0200)]
ALSA: hda: fix unused variable warning

When CONFIG_X86=n function azx_snoop doesn't use the variable chip it
only returns true.

sound/pci/hda/hda_intel.c: In function ‘dma_alloc_pages’:
sound/pci/hda/hda_intel.c:2002:14: warning: unused variable ‘chip’ [-Wunused-variable]
  struct azx *chip = bus_to_azx(bus);
              ^~~~

Create a inline function of azx_snoop.

Fixes: a41d122449be ("ALSA: hda - Embed bus into controller object")
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: emu10k1: fix possible info leak to userspace on SNDRV_EMU10K1_IOCTL_INFO
Willy Tarreau [Sat, 8 Sep 2018 06:12:21 +0000 (08:12 +0200)]
ALSA: emu10k1: fix possible info leak to userspace on SNDRV_EMU10K1_IOCTL_INFO

snd_emu10k1_fx8010_ioctl(SNDRV_EMU10K1_IOCTL_INFO) allocates
memory using kmalloc() and partially fills it by calling
snd_emu10k1_fx8010_info() before returning the resulting
structure to userspace, leaving uninitialized holes. Let's
just use kzalloc() here.

BugLink: http://blog.infosectcbr.com.au/2018/09/linux-kernel-infoleaks.html
Signed-off-by: Willy Tarreau <w@1wt.eu>
Cc: Jann Horn <jannh@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoASoC: cs4265: fix MMTLR Data switch control
Sébastien Szymanski [Thu, 6 Sep 2018 09:16:00 +0000 (11:16 +0200)]
ASoC: cs4265: fix MMTLR Data switch control

The MMTLR bit is in the CS4265_SPDIF_CTL2 register at address 0x12 bit 0
and not at address 0x0 bit 1. Fix this.

Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
5 years agoASoC: AMD: Ensure reset bit is cleared before configuring
Akshu Agrawal [Mon, 10 Sep 2018 08:06:30 +0000 (13:36 +0530)]
ASoC: AMD: Ensure reset bit is cleared before configuring

HW register descriptions says:
"DMA Channel Reset...Software must confirm that this bit is
cleared before reprogramming any of the channel configuration registers."
There could be cases where dma stop errored out leaving dma channel
in reset state. We need to ensure that before the start of another dma,
channel is out of the reset state.

Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoALSA: fireface: fix memory leak in ff400_switch_fetching_mode()
Takashi Sakamoto [Sun, 9 Sep 2018 13:25:52 +0000 (22:25 +0900)]
ALSA: fireface: fix memory leak in ff400_switch_fetching_mode()

An allocated memory forgets to be released.

Fixes: 76fdb3a9e13 ('ALSA: fireface: add support for Fireface 400')
Cc: <stable@vger.kernel.org> # 4.12+
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: bebob: use address returned by kmalloc() instead of kernel stack for streaming...
Takashi Sakamoto [Sun, 9 Sep 2018 13:25:12 +0000 (22:25 +0900)]
ALSA: bebob: use address returned by kmalloc() instead of kernel stack for streaming DMA mapping

When executing 'fw_run_transaction()' with 'TCODE_WRITE_BLOCK_REQUEST',
an address of 'payload' argument is used for streaming DMA mapping by
'firewire_ohci' module if 'size' argument is larger than 8 byte.
Although in this case the address should not be on kernel stack, current
implementation of ALSA bebob driver uses data in kernel stack for a cue
to boot M-Audio devices. This often brings unexpected result, especially
for a case of CONFIG_VMAP_STACK=y.

This commit fixes the bug.

Reference: https://bugzilla.kernel.org/show_bug.cgi?id=201021
Reference: https://forum.manjaro.org/t/firewire-m-audio-410-driver-wont-load-firmware/51165
Fixes: a2b2a7798fb6('ALSA: bebob: Send a cue to load firmware for M-Audio Firewire series')
Cc: <stable@vger.kernel.org> # v3.16+
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: pcm: Update hardware pointer before start capture
Ricardo Biehl Pasquali [Fri, 7 Sep 2018 19:58:54 +0000 (16:58 -0300)]
ALSA: pcm: Update hardware pointer before start capture

This ensures the transfer loop won't waste a run to read
the few frames (if any) between start and hw_ptr update.
It will wait for the next interrupt with wait_for_avail().

Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoASoC: rsnd: don't fallback to PIO mode when -EPROBE_DEFER
Kuninori Morimoto [Thu, 6 Sep 2018 03:21:47 +0000 (03:21 +0000)]
ASoC: rsnd: don't fallback to PIO mode when -EPROBE_DEFER

Current rsnd driver will fallback to PIO mode if it can't get DMA
handler. But, DMA might return -EPROBE_DEFER when probe timing.
This driver always fallback to PIO mode especially from
commit ac6bbf0cdf4206c ("iommu: Remove IOMMU_OF_DECLARE") because
of this reason.

The DMA driver will be probed later, but sound driver might be
probed as PIO mode in such case. This patch fixup this issue.
Then, -EPROBE_DEFER is not error. Thus, let's don't indicate error
message in such case.
And it needs to call rsnd_adg_remove() individually if probe failed,
because it registers clk which should be unregister.

Maybe PIO fallback feature itself is not needed,
but let's keep it so far.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: rsnd: adg: care clock-frequency size
Kuninori Morimoto [Thu, 6 Sep 2018 03:21:33 +0000 (03:21 +0000)]
ASoC: rsnd: adg: care clock-frequency size

ADG has buffer over flow bug if DT has more than 3 clock-frequency.
This patch fixup this issue, and uses first 2 values.

clock-frequency = <x y>; /* this is OK */
clock-frequency = <x y z>; /* this is NG */

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoASoC: uniphier: change status to orphan
Katsuhiro Suzuki [Wed, 5 Sep 2018 08:31:37 +0000 (17:31 +0900)]
ASoC: uniphier: change status to orphan

Since I'm leaving from Socionext, I'll unable to access specification
documents of this hardware (these are not public). So change the
state to orphan until someone will maintain this driver.

Signed-off-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
5 years agoMerge branch 'topic/pcm-indirect-fixes' into for-next
Takashi Iwai [Tue, 4 Sep 2018 18:23:29 +0000 (20:23 +0200)]
Merge branch 'topic/pcm-indirect-fixes' into for-next

Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: mips: Cleanup indirect PCM helper usages
Takashi Iwai [Sun, 2 Sep 2018 08:26:08 +0000 (10:26 +0200)]
ALSA: mips: Cleanup indirect PCM helper usages

We shouldn't set up the indirect PCM parameters at trigger but they
should be set at prepare.  Also, remove a useless debug message, too.

Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: cs46xx: Use SNDRV_PCM_INFO_SYNC_APPLPTR info flag
Takashi Iwai [Sun, 2 Sep 2018 08:23:22 +0000 (10:23 +0200)]
ALSA: cs46xx: Use SNDRV_PCM_INFO_SYNC_APPLPTR info flag

The recently introduced PCM info flag assures the call of ack ops at
each applptr change, and this is mandatory for the indirect PCM
helpers.

Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: emu10k1: Use SNDRV_PCM_INFO_SYNC_APPLPTR info flag
Takashi Iwai [Sun, 2 Sep 2018 08:23:07 +0000 (10:23 +0200)]
ALSA: emu10k1: Use SNDRV_PCM_INFO_SYNC_APPLPTR info flag

The recently introduced PCM info flag assures the call of ack ops at
each applptr change, and this is mandatory for the indirect PCM
helpers.

Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: mips: Use SNDRV_PCM_INFO_SYNC_APPLPTR info flag
Takashi Iwai [Sun, 2 Sep 2018 08:22:37 +0000 (10:22 +0200)]
ALSA: mips: Use SNDRV_PCM_INFO_SYNC_APPLPTR info flag

The recently introduced PCM info flag assures the call of ack ops at
each applptr change, and this is mandatory for the indirect PCM
helpers.

Also, with the proper ack callback, we need no longer prefill at
trigger start.  The relevant code can be killed.

Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: rme32: Use SNDRV_PCM_INFO_SYNC_APPLPTR info flag
Takashi Iwai [Sun, 2 Sep 2018 08:22:13 +0000 (10:22 +0200)]
ALSA: rme32: Use SNDRV_PCM_INFO_SYNC_APPLPTR info flag

The recently introduced PCM info flag assures the call of ack ops at
each applptr change, and this is mandatory for the indirect PCM
helpers.

Also, with the proper ack callback, we need no longer prefill at
trigger start.  The relevant code can be killed.

Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: hda: Fix several mismatch for register mask and value
Keyon Jie [Mon, 3 Sep 2018 02:47:09 +0000 (10:47 +0800)]
ALSA: hda: Fix several mismatch for register mask and value

E.g. for snd_hdac_ext_link_clear_stream_id(), we should set (1 << stream)
as mask, and 0 as value, here correct it and several similar mismatches.

And, here also remove unreadable register_mask usage for those mask value
updating.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoALSA: aoa: Convert to using %pOFn instead of device_node.name
Rob Herring [Tue, 28 Aug 2018 15:44:31 +0000 (10:44 -0500)]
ALSA: aoa: Convert to using %pOFn instead of device_node.name

In preparation to remove the node name pointer from struct device_node,
convert printf users to use the %pOFn format specifier.

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
5 years agoASoC: rsnd: fixup not to call clk_get/set under non-atomic
Jiada Wang [Mon, 3 Sep 2018 07:08:58 +0000 (07:08 +0000)]
ASoC: rsnd: fixup not to call clk_get/set under non-atomic

Clocking operations clk_get/set_rate, are non-atomic,
they shouldn't be called in soc_pcm_trigger() which is atomic.

Following issue was found due to execution of clk_get_rate() causes
sleep in soc_pcm_trigger(), which shouldn't be blocked.

We can reproduce this issue by following
> enable CONFIG_DEBUG_ATOMIC_SLEEP=y
> compile, and boot
> mount -t debugfs none /sys/kernel/debug
> while true; do cat /sys/kernel/debug/clk/clk_summary > /dev/null; done &
> while true; do aplay xxx; done

This patch adds support to .prepare callback, and moves non-atomic
clocking operations to it. As .prepare is non-atomic, it is always
called before trigger_start/trigger_stop.

BUG: sleeping function called from invalid context at kernel/locking/mutex.c:620
in_atomic(): 1, irqs_disabled(): 128, pid: 2242, name: aplay
INFO: lockdep is turned off.
irq event stamp: 5964
hardirqs last enabled at (5963): [<ffff200008e59e40>] mutex_lock_nested+0x6e8/0x6f0
hardirqs last disabled at (5964): [<ffff200008e623f0>] _raw_spin_lock_irqsave+0x24/0x68
softirqs last enabled at (5502): [<ffff200008081838>] __do_softirq+0x560/0x10c0
softirqs last disabled at (5495): [<ffff2000080c2e78>] irq_exit+0x160/0x25c
Preemption disabled at:[ 62.904063] [<ffff200008be4d48>] snd_pcm_stream_lock+0xb4/0xc0
CPU: 2 PID: 2242 Comm: aplay Tainted: G B C 4.9.54+ #186
Hardware name: Renesas Salvator-X board based on r8a7795 (DT)
Call trace:
[<ffff20000808fe48>] dump_backtrace+0x0/0x37c
[<ffff2000080901d8>] show_stack+0x14/0x1c
[<ffff2000086f4458>] dump_stack+0xfc/0x154
[<ffff2000081134a0>] ___might_sleep+0x57c/0x58c
[<ffff2000081136b8>] __might_sleep+0x208/0x21c
[<ffff200008e5980c>] mutex_lock_nested+0xb4/0x6f0
[<ffff2000087cac74>] clk_prepare_lock+0xb0/0x184
[<ffff2000087cb094>] clk_core_get_rate+0x14/0x54
[<ffff2000087cb0f4>] clk_get_rate+0x20/0x34
[<ffff20000113aa00>] rsnd_adg_ssi_clk_try_start+0x158/0x4f8 [snd_soc_rcar]
[<ffff20000113da00>] rsnd_ssi_init+0x668/0x7a0 [snd_soc_rcar]
[<ffff200001133ff4>] rsnd_soc_dai_trigger+0x4bc/0xcf8 [snd_soc_rcar]
[<ffff200008c1af24>] soc_pcm_trigger+0x2a4/0x2d4

Fixes: e7d850dd10f4 ("ASoC: rsnd: use mod base common method on SSI-parent")
Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
[Kuninori: tidyup for upstream]
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
5 years agoALSA: rawmidi: Initialize allocated buffers
Takashi Iwai [Mon, 3 Sep 2018 13:16:43 +0000 (15:16 +0200)]
ALSA: rawmidi: Initialize allocated buffers

syzbot reported the uninitialized value exposure in certain situations
using virmidi loop.  It's likely a very small race at writing and
reading, and the influence is almost negligible.  But it's safer to
paper over this just by replacing the existing kvmalloc() with
kvzalloc().

Reported-by: syzbot+194dffdb8b22fc5d207a@syzkaller.appspotmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>