platform/kernel/linux-rpi.git
6 years agoALSA: usb-audio: Disable the quirk for Nura headset
Takashi Iwai [Mon, 11 Jun 2018 20:34:11 +0000 (22:34 +0200)]
ALSA: usb-audio: Disable the quirk for Nura headset

The commit 33193dca671c ("ALSA: usb-audio: Add a quirk for Nura's
first gen headset") added a quirk for Nura headset with USB ID
0a12:1243, with a hope that it doesn't conflict with others.
Unfortunately, other devices (e.g. Philips Wecall) with the very same
ID got broken by this change, spewing an error like:
  usb 2-1.8.2: 2:1: cannot set freq 48000 to ep 0x3

Until we find a proper solution, fix the regression at first by
disabling the added quirk entry.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=199905
Fixes: 33193dca671c ("ALSA: usb-audio: Add a quirk for Nura's first gen headset")
Reviewed-by: Martin Peres <martin.peres@free.fr>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda: add dock and led support for HP ProBook 640 G4
Dennis Wassenberg [Tue, 12 Jun 2018 05:11:11 +0000 (07:11 +0200)]
ALSA: hda: add dock and led support for HP ProBook 640 G4

This patch adds missing initialisation for HP 2013 UltraSlim Dock
Line-In/Out PINs and activates keyboard mute/micmute leds
for HP ProBook 640 G4

Signed-off-by: Dennis Wassenberg <dennis.wassenberg@secunet.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda: add dock and led support for HP EliteBook 830 G5
Dennis Wassenberg [Tue, 12 Jun 2018 05:10:59 +0000 (07:10 +0200)]
ALSA: hda: add dock and led support for HP EliteBook 830 G5

This patch adds missing initialisation for HP 2013 UltraSlim Dock
Line-In/Out PINs and activates keyboard mute/micmute leds
for HP EliteBook 830 G5

Signed-off-by: Dennis Wassenberg <dennis.wassenberg@secunet.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: emu10k1: add error handling for snd_ctl_add
Zhouyang Jia [Mon, 11 Jun 2018 08:18:40 +0000 (16:18 +0800)]
ALSA: emu10k1: add error handling for snd_ctl_add

When snd_ctl_add fails, the lack of error-handling code may
cause unexpected results.

This patch adds error-handling code after calling snd_ctl_add.

Signed-off-by: Zhouyang Jia <jiazhouyang09@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: fm801: add error handling for snd_ctl_add
Zhouyang Jia [Mon, 11 Jun 2018 08:04:06 +0000 (16:04 +0800)]
ALSA: fm801: add error handling for snd_ctl_add

When snd_ctl_add fails, the lack of error-handling code may
cause unexpected results.

This patch adds error-handling code after calling snd_ctl_add.

Signed-off-by: Zhouyang Jia <jiazhouyang09@gmail.com>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoMerge tag 'asoc-v4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound...
Takashi Iwai [Tue, 5 Jun 2018 14:51:55 +0000 (16:51 +0200)]
Merge tag 'asoc-v4.18' of git://git./linux/kernel/git/broonie/sound into for-linus

ASoC: Updates for v4.18

This is a very big update, mainly due to a huge set of new drivers some
of which are individually very large.  We also have a lot of fixes for
the topology stuff, several of the users have stepped up and fixed some
the serious issues there, and continued progress on the transition away
from CODEC specific drivers to generic component drivers.

 - Many fixes for the topology code, including fixes for the half done
   v4 ABI compatibility from Guenter Roeck and other ABI fixes from
   Kirill Marinushkin.
 - Lots of cleanup for Intel platforms based on Realtek CODECs from Hans
   de Goode.
 - More followups on removing legacy CODEC things and transitioning to
   components from Morimoto-san.
 - Conversion of OMAP DMA to the new, more standard SDMA-PCM driver.
 - A series of fixes and updates to the rather elderly Cirrus Logic SoC
   drivers from Alexander Sverdlin.
 - Qualcomm DSP support from Srinivas Kandagatla.
 - New drivers for Analog SSM2305, Atmel I2S controllers, Mediatek
   MT6351, MT6797 and MT7622, Qualcomm DSPs, Realtek RT1305, RT1306 and
   RT5668 and TI TSCS454

6 years agoMerge branch 'asoc-4.17' into asoc-4.18 merge window
Mark Brown [Tue, 5 Jun 2018 14:25:41 +0000 (15:25 +0100)]
Merge branch 'asoc-4.17' into asoc-4.18 merge window

6 years agoASoC: dapm: delete dapm_kcontrol_data paths list before freeing it
Srinivas Kandagatla [Mon, 4 Jun 2018 11:13:26 +0000 (12:13 +0100)]
ASoC: dapm: delete dapm_kcontrol_data paths list before freeing it

dapm_kcontrol_data is freed as part of dapm_kcontrol_free(), leaving the
paths pointer dangling in the list.

This leads to system crash when we try to unload and reload sound card.
I hit this bug during ADSP crash/reboot test case on Dragon board DB410c.

Without this patch, on SLAB Poisoning enabled build, kernel crashes with
"BUG kmalloc-128 (Tainted: G        W        ): Poison overwritten"

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
6 years agoALSA: usb-audio: remove redundant check on err
Colin Ian King [Mon, 4 Jun 2018 11:49:19 +0000 (12:49 +0100)]
ALSA: usb-audio: remove redundant check on err

The check on err is redundant as both the true and false paths
end up on a break statement. Remove the redundant check.

Detected by CoverityScan, CID#1268773 ("Identical code for different
branches")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoMerge branch 'for-next' into for-linus
Takashi Iwai [Mon, 4 Jun 2018 09:41:48 +0000 (11:41 +0200)]
Merge branch 'for-next' into for-linus

4.18-rc1 merge material.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoASoC: topology: Move skl-tplg-interface.h to uapi
Guenter Roeck [Thu, 24 May 2018 19:49:23 +0000 (12:49 -0700)]
ASoC: topology: Move skl-tplg-interface.h to uapi

skl-tplg-interface.h describes firmware format details for Skylake
topology files. It is part of the ABI and should reside in the uapi
directory.

While moving the file, also replace the license boilerplate with
the SPDX License Identifier.

No functional change.

Signed-off-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: topology: Move v4 manifest header data structures to uapi
Guenter Roeck [Thu, 24 May 2018 19:49:22 +0000 (12:49 -0700)]
ASoC: topology: Move v4 manifest header data structures to uapi

Topology manifest v4 is still part of the ABI. Move its data structures
into the uapi header file.

No functional change.

Signed-off-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: topology: Improve backwards compatibility with v4 topology files
Guenter Roeck [Thu, 24 May 2018 19:49:21 +0000 (12:49 -0700)]
ASoC: topology: Improve backwards compatibility with v4 topology files

Commit dc31e741db49 ("ASoC: topology: ABI - Add the types for BE
DAI") introduced sound topology files version 5. Initially, this
change made the topology code incompatible with v4 topology files.
Backwards compatibility with v4 configuration files was
subsequently added with commit 288b8da7e992 ("ASoC: topology:
Support topology file of ABI v4").

Unfortunately, backwards compatibility was never fully implemented.

First, the manifest size in (Skylake) v4 configuration files is set
to 0, which causes manifest_new_ver() to bail out with error messages
similar to the following.

snd_soc_skl 0000:00:1f.3: ASoC: invalid manifest size
snd_soc_skl 0000:00:1f.3: tplg component load failed-22
snd_soc_skl 0000:00:1f.3: Failed to init topology!
snd_soc_skl 0000:00:1f.3: ASoC: failed to probe component -22
skl_n88l25_m98357a skl_n88l25_m98357a: ASoC: failed to instantiate card -22
skl_n88l25_m98357a: probe of skl_n88l25_m98357a failed with error -22

After this problem is fixed, the following error message is seen instead.

snd_soc_skl 0000:00:1f.3: ASoC: old version of manifest
snd_soc_skl 0000:00:1f.3: Invalid descriptor token 1093938482
snd_soc_skl 0000:00:1f.3: ASoC: failed to load widget media0_in cpr 0
snd_soc_skl 0000:00:1f.3: tPlg component load failed-22

This message is seen because backwards compatibility for loading widgets
was never implemented.

The lack of audio support when running the upstream kernel on recent
Chromebooks has been reported in various forums, and can be traced back
to this problem. Attempts to fix the problem, usually by providing v5
configuration files, were only partially successful.

Let's implement backward compatibility properly to solve the problem
for good.

Signed-off-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoALSA: pci/hda: Remove unused, broken, header file
Ben Hutchings [Fri, 1 Jun 2018 15:32:30 +0000 (16:32 +0100)]
ALSA: pci/hda: Remove unused, broken, header file

sound/pci/hda/local.h seems to be an earlier version of
sound/hda/local.h; it was added at the same time but doesn't seem to
have ever been used (within the git history).  Most of its macros
depend on a hdac_read_parm() function which is not defined anywhere.

Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoASoC: TSCS454: Add Support
Steven Eckhoff [Thu, 31 May 2018 20:24:07 +0000 (15:24 -0500)]
ASoC: TSCS454: Add Support

Currently there is no support for Tempo Semiconductor's TSCS454 CODEC.

Add support for it.

Signed-off-by: Steven Eckhoff <steven.eckhoff.opensource@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: Intel: kbl: Move codec sysclk config to codec_init function
Mac Chiang [Thu, 31 May 2018 17:18:32 +0000 (01:18 +0800)]
ASoC: Intel: kbl: Move codec sysclk config to codec_init function

On APL, commit fd0f237572ad
("ASoC: Intel: bxt: Move codec sysclk config to codec_init function")
fixed an issue related to jack detection.

The MCLK for DA7219 does not change in this platform, but is
currently being configured everytime as part of the platform_clock
event handler for DAPM. The upshot of this is that we have
unnecessary calls to this function, and it also means that if
a stream hasn't yet been started, DA7219 driver does not have the
correct MCLK rates programmed and so the HP detection feature does
not operate as expected.

The same fix is needed on KBL.

This patch rectifies this issue by moving the sysclk call to
codec_init function so it's only called once at initialisation.

Signed-off-by: Mac Chiang <mac.chiang@intel.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: simple-card: set cpu dai clk in hw_params
Daniel Mack [Wed, 30 May 2018 19:45:56 +0000 (21:45 +0200)]
ASoC: simple-card: set cpu dai clk in hw_params

The simple-card driver currently accepts a clock node in the cpu dai
sub-node and only uses it as an alternative to the
'system-clock-frequency' property to get the current frequency.

This patch adds another use of the passed clock node. If mclk-fs is
specified, the clocks in cpu and codec dai sub-nodes will be set to
the calculated rate (stream rate * mclk_fs) in hw_params.

This allows platforms to pass tuneable clocks as phandle that will
automatically be set to the right rates.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoALSA: hda - Handle kzalloc() failure in snd_hda_attach_pcm_stream()
Bo Chen [Thu, 31 May 2018 22:35:18 +0000 (15:35 -0700)]
ALSA: hda - Handle kzalloc() failure in snd_hda_attach_pcm_stream()

When 'kzalloc()' fails in 'snd_hda_attach_pcm_stream()', a new pcm instance is
created without setting its operators via 'snd_pcm_set_ops()'. Following
operations on the new pcm instance can trigger kernel null pointer dereferences
and cause kernel oops.

This bug was found with my work on building a gray-box fault-injection tool for
linux-kernel-module binaries. A kernel null pointer dereference was confirmed
from line 'substream->ops->open()' in function 'snd_pcm_open_substream()' in
file 'sound/core/pcm_native.c'.

This patch fixes the bug by calling 'snd_device_free()' in the error handling
path of 'kzalloc()', which removes the new pcm instance from the snd card before
returns with an error code.

Signed-off-by: Bo Chen <chenbo@pdx.edu>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: oxygen: use match_string() helper
Yisheng Xie [Thu, 31 May 2018 11:11:20 +0000 (19:11 +0800)]
ALSA: oxygen: use match_string() helper

match_string() returns the index of an array for a matching string,
which can be used instead of open coded variant.

Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoASoC: dapm: use match_string() helper
Xie Yisheng [Thu, 31 May 2018 11:11:23 +0000 (19:11 +0800)]
ASoC: dapm: use match_string() helper

match_string() returns the index of an array for a matching string,
which can be used instead of open coded variant.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: alsa-devel@alsa-project.org
Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: max98095: use match_string() helper
Xie Yisheng [Thu, 31 May 2018 11:11:22 +0000 (19:11 +0800)]
ASoC: max98095: use match_string() helper

match_string() returns the index of an array for a matching string,
which can be used instead of open coded variant.

Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: alsa-devel@alsa-project.org
Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: max98088: use match_string() helper
Xie Yisheng [Thu, 31 May 2018 11:11:21 +0000 (19:11 +0800)]
ASoC: max98088: use match_string() helper

match_string() returns the index of an array for a matching string,
which can be used instead of open coded variant.

Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: alsa-devel@alsa-project.org
Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: Intel: bytcr_rt5651: Set card long_name based on quirks
Hans de Goede [Fri, 18 May 2018 19:35:06 +0000 (21:35 +0200)]
ASoC: Intel: bytcr_rt5651: Set card long_name based on quirks

Many X86 devices using a BYT SoC + RT5651 codec are cheap devices with
generic DMI strings, causing snd_soc_set_dmi_name() to fail to set a
long_name, making it impossible for userspace to have a correct UCM
profile which knowns which input is connected to the internal mic,
which input is connected to the hsmic (for correct jack-based switching)
and which inputs are unused.

Our quirks already specify which inputs the internal and headset mic
are connected to.

This commit sets a long_name based on the quirks so that userspace can
have UCM profiles doing the right thing based on the long_name.

Note that if we ever encounter the need for a special UCM profile for
some device we can add a quirk to set a specific long_name for the
device,

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: mt6797-mt6351: add hostless phone call path
Kai Chieh Chuang [Thu, 31 May 2018 01:26:21 +0000 (09:26 +0800)]
ASoC: mt6797-mt6351: add hostless phone call path

Signed-off-by: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: mt6797: add Hostless DAI
Kai Chieh Chuang [Thu, 31 May 2018 01:26:20 +0000 (09:26 +0800)]
ASoC: mt6797: add Hostless DAI

add path for hosltess lpbk from ADDA Capture to ADDA Playback
add path for hostless phone call between ADDA DAI and PCM DAI

Signed-off-by: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: mt6797: add PCM interface
Kai Chieh Chuang [Thu, 31 May 2018 01:26:19 +0000 (09:26 +0800)]
ASoC: mt6797: add PCM interface

Signed-off-by: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: mediatek: export mtk-afe symbols as needed
Arnd Bergmann [Wed, 30 May 2018 22:00:35 +0000 (00:00 +0200)]
ASoC: mediatek: export mtk-afe symbols as needed

The new mt6797-afe driver uses some functions in a common file, which
works for a built-in driver but fails for a loadable module:

ERROR: "mtk_afe_pcm_free" [sound/soc/mediatek/mt6797/snd-soc-mt6797-afe.ko] undefined!
ERROR: "mtk_afe_add_sub_dai_control" [sound/soc/mediatek/mt6797/snd-soc-mt6797-afe.ko] undefined!
ERROR: "mtk_afe_pcm_new" [sound/soc/mediatek/mt6797/snd-soc-mt6797-afe.ko] undefined!
ERROR: "mtk_afe_combine_sub_dai" [sound/soc/mediatek/mt6797/snd-soc-mt6797-afe.ko] undefined!
ERROR: "mtk_afe_pcm_ops" [sound/soc/mediatek/mt6797/snd-soc-mt6797-afe.ko] undefined!

This exports the five symbols above for modules.

Fixes: b3c702f56bf5 ("ASoC: mt6797: combine DAI to register component")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: codecs: PCM1789: include gpio/consumer.h
Arnd Bergmann [Wed, 30 May 2018 21:53:45 +0000 (23:53 +0200)]
ASoC: codecs: PCM1789: include gpio/consumer.h

When CONFIG_GPIOLIB is disabled, this codec fails to build
because gpio/consumer.h is not included implicitly.

sound/soc/codecs/pcm1789.c: In function 'pcm1789_common_init':
sound/soc/codecs/pcm1789.c:247:19: error: implicit declaration of function 'devm_gpiod_get_optional'; did you mean 'devm_gpio_request_one'? [-Werror=implicit-function-declaration]
  pcm1789->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
                   ^~~~~~~~~~~~~~~~~~~~~~~

Fixes: 4ae340d1be36 ("ASoC: codecs: Add support for PCM1789")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoALSA: xen-front: fix a loop timeout
Dan Carpenter [Thu, 31 May 2018 06:25:07 +0000 (09:25 +0300)]
ALSA: xen-front: fix a loop timeout

We want the loop to exit when "to" is set to zero, but in the current
code it's set to -1.  Also I tweaked the indenting so it doesn't look
like we're passing "--to" to xenbus_read_unsigned().

Fixes: cc3196ae197c ("ALSA: xen-front: Introduce Xen para-virtualized sound frontend driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoASoC: core: Fix return code shown on error for hw_params
Jon Hunter [Wed, 30 May 2018 15:15:19 +0000 (16:15 +0100)]
ASoC: core: Fix return code shown on error for hw_params

When the call to hw_params for a component fails, the error code is held
by the variable '__ret' but the error message displays the value held by
the variable 'ret'. Fix the return code shown when hw_params fails for
a component.

Fixes: b8135864d4d3 ("ASoC: snd_soc_component_driver has snd_pcm_ops")
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoALSA: xen-front: freeing an error pointer
Dan Carpenter [Wed, 30 May 2018 10:36:55 +0000 (13:36 +0300)]
ALSA: xen-front: freeing an error pointer

kfree() doesn't accept error pointers so I've set "str" to NULL on these
paths.

Fixes: fd3b36045c2c ("ALSA: xen-front: Read sound driver configuration from Xen store")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoASoC: imx-audmux: add RXFS/RXCLK defines for 6-wire connections
Philipp Zabel [Wed, 23 May 2018 09:43:00 +0000 (11:43 +0200)]
ASoC: imx-audmux: add RXFS/RXCLK defines for 6-wire connections

In asynchronous mode, a RxFS and RxClk connection needs to be made between
two ports. Add a define for the bit to be set in the *SEL fields.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
[m.felsch@pengutronix.de: fixed comment to include i.MX21 and 35]
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: fix 0-day warnings with snd_soc_new_compress()
Pierre-Louis Bossart [Tue, 29 May 2018 23:30:02 +0000 (18:30 -0500)]
ASoC: fix 0-day warnings with snd_soc_new_compress()

All conditionally-defined routines in include/sound/soc.h expose a
static inline fallback to avoid 0-day warnings and compilation issues,
except snd_soc_new_compress().

Fixes: 5db6aab6f36f ('ASoC: topology: Add support for compressed PCMs')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoALSA: hda/realtek - Enable mic-mute hotkey for several Lenovo AIOs
Hui Wang [Wed, 30 May 2018 04:33:07 +0000 (12:33 +0800)]
ALSA: hda/realtek - Enable mic-mute hotkey for several Lenovo AIOs

We have several Lenovo AIOs like M810z, M820z and M920z, they have
the same design for mic-mute hotkey and led and they use the same
codec with the same pin configuration, so use the pin conf table to
apply fix to all of them.

Fixes: 29693efcea0f ("ALSA: hda - Fix micmute hotkey problem for a lenovo AIO machine")
Cc: <stable@vger.kernel.org>
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda/realtek - Fixup for HP x360 laptops with B&O speakers
Tom Briden [Tue, 29 May 2018 16:34:20 +0000 (17:34 +0100)]
ALSA: hda/realtek - Fixup for HP x360 laptops with B&O speakers

Added a new helper file for these fixups due to requiring a huge number
of coefs being set to get the top speakers to work, as well as
setting pin 0x17 for the top speakers and the correct input source
of 0x17 for volume control

[ Note: this is a revised work based on Tom's fixup patch with the
  replacement of the full COEF tables provided by Realtek.
  Also, the fixup function has a proper HDA_FIXUP_ACT_* handling now.
  The credit for the new COEF table goes to Kailang  -- tiwai ]

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189331
Cc: Kailang Yang <kailang@realtek.com>
Signed-off-by: Tom Briden <tom@decompile.me.uk>
Tested-by: Tom Briden <tom@decompile.me.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoASoC: atmel-i2s: add driver for the new Atmel I2S controller
Cyrille Pitchen [Fri, 25 May 2018 12:34:26 +0000 (15:34 +0300)]
ASoC: atmel-i2s: add driver for the new Atmel I2S controller

This patch adds support for the Atmel I2S controller embedded into
sama5d2x SoCs.

Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: atmel-i2s: dt-bindings: add DT bindings for I2S controller
Cyrille Pitchen [Fri, 25 May 2018 12:34:25 +0000 (15:34 +0300)]
ASoC: atmel-i2s: dt-bindings: add DT bindings for I2S controller

This patch adds DT bindings for the new Atmel I2S controller embedded
inside sama5d2x SoCs.

Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: qdsp6: q6routing: Add support to all TDM Mixers
Srinivas Kandagatla [Tue, 29 May 2018 10:18:33 +0000 (11:18 +0100)]
ASoC: qdsp6: q6routing: Add support to all TDM Mixers

This patch adds TX and RX TDM mixers for 40 TDM ports.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: qdsp6: q6routing: Add macros for mixers
Srinivas Kandagatla [Tue, 29 May 2018 10:18:32 +0000 (11:18 +0100)]
ASoC: qdsp6: q6routing: Add macros for mixers

All the mixer controls are pretty much same from all the afe ports.

Make these as proper macros for 2 reasons.

1> To avoid any typos in adding new mixer controls for each port.
2> Easy to edit from single place, easy to add new ports

This also prepares the routing driver to accomdate 40 tdm dais.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: qdsp6: q6afe-dai: add support to tdm dais
Srinivas Kandagatla [Tue, 29 May 2018 10:18:31 +0000 (11:18 +0100)]
ASoC: qdsp6: q6afe-dai: add support to tdm dais

This patch adds support to 40 TDM ports supported in AFE.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: qdsp6: q6afe-dai: use q6afe_dai_prepare() for MI2S
Srinivas Kandagatla [Tue, 29 May 2018 10:18:30 +0000 (11:18 +0100)]
ASoC: qdsp6: q6afe-dai: use q6afe_dai_prepare() for MI2S

Use common q6afe_dai_prepare() for MI2S dais, this will remove
some code duplication. Also make the if statement to switch to
make the code look neater.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: qdsp6: qdafe: add support to tdm ports
Srinivas Kandagatla [Tue, 29 May 2018 10:18:29 +0000 (11:18 +0100)]
ASoC: qdsp6: qdafe: add support to tdm ports

This patch adds support to tdm ports in AFE.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: qdsp6: dt-bindings: Add q6afe tdm dt binding
Srinivas Kandagatla [Tue, 29 May 2018 10:18:28 +0000 (11:18 +0100)]
ASoC: qdsp6: dt-bindings: Add q6afe tdm dt binding

This patch adds bindings required for TDM ports on AFE.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: dpcm: symmetry constraint on FE substream
Kai Chieh Chuang [Mon, 28 May 2018 02:18:19 +0000 (10:18 +0800)]
ASoC: dpcm: symmetry constraint on FE substream

We should set BE symmetric constraint on FE substream.

in case one BE is used by two FE1/FE2,
the first BE runtime will use FE1's substream->runtime.
hence the FE1's will be constrained by BE symmetry property.

Though, second FE2 call dpcm_apply_symmetry,
the be_substream->runtime == FE1's substream->runtime.
The FE2's substream->runtime will not be constrained
by BE's symmetry property.

Signed-off-by: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: dpcm: fix BE dai not hw_free and shutdown
Kai Chieh Chuang [Mon, 28 May 2018 02:18:18 +0000 (10:18 +0800)]
ASoC: dpcm: fix BE dai not hw_free and shutdown

In case, one BE is used by two FE1/FE2
FE1--->BE-->
       |
FE2----]
when FE1/FE2 call dpcm_be_dai_hw_free() together
the BE users will be 2 (> 1), hence cannot be hw_free
the be state will leave at, ex. SND_SOC_DPCM_STATE_STOP

later FE1/FE2 call dpcm_be_dai_shutdown(),
will be skip due to wrong state.
leaving the BE not being hw_free and shutdown.

The BE dai will be hw_free later when calling
dpcm_be_dai_shutdown() if still in invalid state.

Signed-off-by: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: AMD: make channel 1 dma as circular
Agrawal, Akshu [Mon, 28 May 2018 03:48:22 +0000 (11:48 +0800)]
ASoC: AMD: make channel 1 dma as circular

channel 1: SYSMEM<->ACP
channel 2: ACP<->I2S
Instead of waiting on period interrupt of ch 2 and then starting
dma on ch1, we make ch1 dma as circular.
This removes dependency of period granularity on hw pointer.

Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Tested-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: Intel: bytcr_rt5640: Add quirk for the ARCHOS 80 Cesium 8" windows tablet
Hans de Goede [Mon, 28 May 2018 20:26:49 +0000 (22:26 +0200)]
ASoC: Intel: bytcr_rt5640: Add quirk for the ARCHOS 80 Cesium 8" windows tablet

Add a quirk for the ARCHOS 80 Cesium 8" windows tablet, this device mostly
works with the default settings, except that it has only one speaker.
So add a quirk with the default settings + the mono-speaker flag.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoALSA: hda/realtek - Refactor alc269_fixup_hp_mute_led_mic*()
Takashi Iwai [Tue, 29 May 2018 09:38:38 +0000 (11:38 +0200)]
ALSA: hda/realtek - Refactor alc269_fixup_hp_mute_led_mic*()

Just a code refactoring to use the common helper for the all three
functions.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda/realtek - Fixup mute led on HP Spectre x360
Tom Briden [Sat, 25 Mar 2017 10:12:01 +0000 (10:12 +0000)]
ALSA: hda/realtek - Fixup mute led on HP Spectre x360

This patch adds the mute LED control for HP Spectre x360 Kabylake
model.  The mute LED is controlled via VREF bits on NID 0x1b, so we
need a new fixup function.

Note that this doesn't fix the other issues like the missing speaker
output on the machine.  They will be addressed by later patches.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189331
Signed-off-by: Tom Briden <tom@decompile.me.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: Allow non-vmalloc buffer for PCM buffers
Takashi Iwai [Sun, 27 May 2018 11:01:17 +0000 (13:01 +0200)]
ALSA: usb-audio: Allow non-vmalloc buffer for PCM buffers

Currently, USB-audio driver allocates the PCM buffer via vmalloc(), as
this serves merely as an intermediate buffer that is copied to each
URB transfer buffer.  This works well in general on x86, but on some
archs this may result in cache coherency issues when mmap is used.
OTOH, it works also on such arch unless mmap is used.

This patch is a step for mitigating the inconvenience; a new module
option "use_vmalloc" is provided so that user can choose to allocate
the DMA coherent buffer instead of the existing vmalloc buffer.
The drawback is that it'd be the standard dma_alloc_coherent() calls
and the system would require contiguous pages on non-x86 archs.

Note that it's a global option and not dynamically switchable since
the buffer is pre-allocated at the probe time.  In theory, it's
possible to be switchable, but it'd be trickier and racier.

As default use_vmalloc option is set to true, so that the old behavior
is kept.  For allowing the coherent mmap on ARM or MIPS, pass
use_vmalloc=0 option explicitly.

Reported-and-tested-by: Daniel Danzberger <daniel@dd-wrt.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda: Add Intel NUC5i7RY to the power_save blacklist
Hans de Goede [Sun, 13 May 2018 13:48:13 +0000 (14:48 +0100)]
ALSA: hda: Add Intel NUC5i7RY to the power_save blacklist

Power-saving is causing a humming sound when active on the Intel
NUC5i7RY, add it to the blacklist.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=199607
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: xen: ensure nul-terminated device name
Arnd Bergmann [Mon, 28 May 2018 15:59:57 +0000 (17:59 +0200)]
ALSA: xen: ensure nul-terminated device name

gcc-8 warns that pcm_instance->name is not necessarily terminated correctly
if the input is more than 80 characters long or lacks a termination byte
itself:

In function 'strncpy',
    inlined from 'cfg_device' at sound/xen/xen_snd_front_cfg.c:399:3,
    inlined from 'xen_snd_front_cfg_card' at sound/xen/xen_snd_front_cfg.c:509:9:
include/linux/string.h:254:9: error: '__builtin_strncpy' specified bound 80 equals destination size [-Werror=stringop-truncation]
  return __builtin_strncpy(p, q, size);

Using strlcpy() instead of strncpy() makes this a bit safer.

Fixes: fd3b36045c2c ("ALSA: xen-front: Read sound driver configuration from Xen store")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: Avoid lowlevel device object
Takashi Iwai [Sun, 27 May 2018 13:07:01 +0000 (15:07 +0200)]
ALSA: usb-audio: Avoid lowlevel device object

Simplify the device management by replacing the lowlevel device object
allocation with the card->private_data.  Nowadays there is almost no
advantage by the lowlevel device, and with card->private_data, the
code becomes cleaner.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: Follow standard coding style
Takashi Iwai [Sun, 27 May 2018 13:18:22 +0000 (15:18 +0200)]
ALSA: usb-audio: Follow standard coding style

Avoid if ((err = ...) style and expand to multiple lines instead.
No change in the end result, but just the beautification.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: Move autoresume call at the end of open
Takashi Iwai [Sun, 27 May 2018 13:09:15 +0000 (15:09 +0200)]
ALSA: usb-audio: Move autoresume call at the end of open

... so that we can avoid the extra goto lines.
Also beautify the code to follow the standard codex.

No functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: Simplify PCM open/close callbacks
Takashi Iwai [Sun, 27 May 2018 11:59:03 +0000 (13:59 +0200)]
ALSA: usb-audio: Simplify PCM open/close callbacks

The stream direction in open and close callbacks can be retrieved from
substream->direction, hence we don't have to stick with the unique PCM
ops hard-coded for each direction.  Rewrite the common open/close
callback functions.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: aloop: Reduced duplicated PCM ops definition
Takashi Iwai [Sun, 27 May 2018 11:55:01 +0000 (13:55 +0200)]
ALSA: aloop: Reduced duplicated PCM ops definition

The PCM ops defined for playback and capture are identical.  Just use
the single one for both.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: xen-front: fix unsigned error check on return from to_sndif_format
Colin Ian King [Sun, 27 May 2018 21:32:19 +0000 (22:32 +0100)]
ALSA: xen-front: fix unsigned error check on return from to_sndif_format

The negative error return from the call to to_sndif_format is being
assigned to an unsigned 8 bit integer and hence the check for a negative
value is always going to be false.  Fix this by using ret as the error
return and hence the negative error can be detected and assign
the u8 sndif_format to ret if there is no error.

Detected by CoverityScan, CID#1469385 ("Unsigned compared against 0")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamoccchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: xen-front: remove redundant error check on ret
Colin Ian King [Sun, 27 May 2018 21:23:12 +0000 (22:23 +0100)]
ALSA: xen-front: remove redundant error check on ret

The error for a -ve value in ret is redundant as all previous
assignments to ret have an associated -ve check and hence it
is impossible for ret to be less that zero at the point of the
check.  Remove this redundant error check.

Detected by CoveritScan, CID#1469407 ("Logically Dead code")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agosound: Use octal not symbolic permissions
Joe Perches [Wed, 23 May 2018 19:20:59 +0000 (12:20 -0700)]
sound: Use octal not symbolic permissions

Convert the S_<FOO> symbolic permissions to their octal equivalents as
using octal and not symbolic permissions is preferred by many as more
readable.

see: https://lkml.org/lkml/2016/8/2/1945

Done with automated conversion via:
$ ./scripts/checkpatch.pl -f --types=SYMBOLIC_PERMS --fix-inplace <files...>

Miscellanea:

o Wrapped one multi-line call to a single line

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: dice: unuse second stream for MIDI conformant data channel for TC Electronic...
Takashi Sakamoto [Sun, 27 May 2018 01:13:30 +0000 (10:13 +0900)]
ALSA: dice: unuse second stream for MIDI conformant data channel for TC Electronic models

At present, all of models produced by TC Electronic except for Konnekt Live
are supported with hard-coded their stream formats. Studio Konnekt 48 is
sore model to support dual streams for both directions. The second stream
has no MIDI conformant data channel in its data block. But current
implementation transfers the second stream with MIDI conformant data
channel.

This commit fixes this issue.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: dice: fix stream format parameters for TC Electronic Studio Konnekt 48
Takashi Sakamoto [Sun, 27 May 2018 01:13:29 +0000 (10:13 +0900)]
ALSA: dice: fix stream format parameters for TC Electronic Studio Konnekt 48

TC Electronic Studio Konnekt 48 is an application of combination of
WaveFront Dice II STD and TC Applied Technologies (TCAT) TCD2210 (Dice
Mini). The latter is on a board with BNC and optical interfaces, thus
used for signal processing for word clock, S/PDIF and ADAT. This model
doesn't support TCAT extended application protocol. For such devices,
ALSA dice driver needs to have hard-coded parameters for stream formats.

This commit fixes stream format parameters for this model. Unfortunately, at
sampling transmission frequencies over 48.0kHz, I confirmed that current
ALSA dice driver doesn't drive the device appropriately to generate sounds
(silence). I guess that this comes from timestamping quirk of Dice-based
devices, which I reported.

[alsa-devel] Dice packet sequence quirk and ALSA firewire stack in Linux 4.6
http://mailman.alsa-project.org/pipermail/alsa-devel/2016-May/107715.html

$ cd linux-firewire-utils/src
$ python2 crpp < /sys/bus/firewire/devices/fw1/config_rom
               ROM header and bus information block
               -----------------------------------------------------------------
400  04044a26  bus_info_length 4, crc_length 4, crc 18982
404  31333934  bus_name "1394"
408  e0ff8112  irmc 1, cmc 1, isc 1, bmc 0, pmc 0, cyc_clk_acc 255,
               max_rec 8 (512), max_rom 1, gen 1, spd 2 (S400)
40c  00016604  company_id 000166     |
410  08a65810  device_id 0408a65810  | EUI-64 0001660408a65810

               root directory
               -----------------------------------------------------------------
414  00062ab9  directory_length 6, crc 10937
418  03000166  vendor
41c  8100000a  --> descriptor leaf at 444
420  17000022  model
424  8100000f  --> descriptor leaf at 460
428  0c0087c0  node capabilities per IEEE 1394
42c  d1000001  --> unit directory at 430

               unit directory at 430
               -----------------------------------------------------------------
430  0004d5c5  directory_length 4, crc 54725
434  12000166  specifier id
438  13000001  version
43c  17000022  model
440  8100000f  --> descriptor leaf at 47c

               descriptor leaf at 444
               -----------------------------------------------------------------
444  0006c490  leaf_length 6, crc 50320
448  00000000  textual descriptor
44c  00000000  minimal ASCII
450  54432045  "TC E"
454  6c656374  "lect"
458  726f6e69  "roni"
45c  63000000  "c"

               descriptor leaf at 460
               -----------------------------------------------------------------
460  0006e08e  leaf_length 6, crc 57486
464  00000000  textual descriptor
468  00000000  minimal ASCII
46c  53747564  "Stud"
470  696f4b6f  "ioKo"
474  6e6e656b  "nnek"
478  74343800  "t48"

               descriptor leaf at 47c
               -----------------------------------------------------------------
47c  0006e08e  leaf_length 6, crc 57486
480  00000000  textual descriptor
484  00000000  minimal ASCII
488  53747564  "Stud"
48c  696f4b6f  "ioKo"
490  6e6e656b  "nnek"
494  74343800  "t48"

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: seq: fix spelling mistake "Unamed" -> "Unnamed"
Colin Ian King [Sat, 26 May 2018 15:11:00 +0000 (16:11 +0100)]
ALSA: seq: fix spelling mistake "Unamed" -> "Unnamed"

Trivial fix to spelling mistake in string

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoASoC: mt6797: combine DAI to register component
KaiChieh Chuang [Fri, 25 May 2018 03:48:18 +0000 (11:48 +0800)]
ASoC: mt6797: combine DAI to register component

Signed-off-by: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: mt6797: extract DAI adda in separate file
KaiChieh Chuang [Fri, 25 May 2018 03:48:17 +0000 (11:48 +0800)]
ASoC: mt6797: extract DAI adda in separate file

Signed-off-by: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: mediatek: add sub dai to mtk_base_afe
KaiChieh Chuang [Fri, 25 May 2018 03:48:16 +0000 (11:48 +0800)]
ASoC: mediatek: add sub dai to mtk_base_afe

In MediaTek SoC chip we have multiple DAI,
such as I2S, ADDA, PCM, etc.

Organize each DAI in to one sub dai,
with its dai driver, controls, widgets, routes.

add mtk_afe_combine_sub_dai() to combine
dai driver from each DAI.

add mtk_afe_add_sub_dai_control() to register
the control, widget, routes to component.

Signed-off-by: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: omap: fix compile-test building
Arnd Bergmann [Fri, 25 May 2018 16:02:32 +0000 (18:02 +0200)]
ASoC: omap: fix compile-test building

The newly introduced driver causes a harmless Kconfig warning when
compile-testing random configurations:

WARNING: unmet direct dependencies detected for SND_SDMA_SOC
  Depends on [n]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && DMA_OMAP [=n]
  Selected by [y]:
  - SND_OMAP_SOC [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && (ARCH_OMAP [=y] && DMA_OMAP [=n] || ARM [=y] && COMPILE_TEST [=y])

By simply allow build testing without DMA_OMAP, we can shut up that warning.

Fixes: dde637f2daf1 ("ASoC: omap: Introduce the generic_dmaengine_pcm based sdma-pcm")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoALSA: hda - Fix runtime PM
Lukas Wunner [Thu, 24 May 2018 17:01:07 +0000 (19:01 +0200)]
ALSA: hda - Fix runtime PM

Before commit 3b5b899ca67d ("ALSA: hda: Make use of core codec functions
to sync power state"), hda_set_power_state() returned the response to
the Get Power State verb, a 32-bit unsigned integer whose expected value
is 0x233 after transitioning a codec to D3, and 0x0 after transitioning
it to D0.

The response value is significant because hda_codec_runtime_suspend()
does not clear the codec's bit in the codec_powered bitmask unless the
AC_PWRST_CLK_STOP_OK bit (0x200) is set in the response value.  That in
turn prevents the HDA controller from runtime suspending because
azx_runtime_idle() checks that the codec_powered bitmask is zero.

Since commit 3b5b899ca67d, hda_set_power_state() only returns 0x0 or
0x1, thereby breaking runtime PM for any HDA controller.  That's because
an inline function introduced by the commit returns a bool instead of a
32-bit unsigned int.  The change was likely erroneous and resulted from
copying and pasting snd_hda_check_power_state(), which is immediately
preceding the newly introduced inline function.  Fix it.

Link: https://bugs.freedesktop.org/show_bug.cgi?id=106597
Fixes: 3b5b899ca67d ("ALSA: hda: Make use of core codec functions to sync power state")
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Abhijeet Kumar <abhijeet.kumar@intel.com>
Reported-and-tested-by: Gunnar Krüger <taijian@posteo.de>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: echoaudio: Drop superfluous macro
Takashi Iwai [Thu, 24 May 2018 09:20:06 +0000 (11:20 +0200)]
ALSA: echoaudio: Drop superfluous macro

Drop pci_device() macro that just leads to chip->pci->dev, and pass it
directly to request_firmware().  It was introduced for allowing the
external alsa-driver kernel module builds.  Since it was discontinued
years ago, we should clean it up now.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: usb-audio: Drop superfluous ifndef
Takashi Iwai [Thu, 24 May 2018 09:15:45 +0000 (11:15 +0200)]
ALSA: usb-audio: Drop superfluous ifndef

Drop the superfluous #ifndef checks that had been put just for
allowing building the alsa-driver kernel modules externally.
Since the external build was discontinued years ago, let's clean up
the old kludges.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: memalloc: Drop superfluous ifndef
Takashi Iwai [Thu, 24 May 2018 09:14:13 +0000 (11:14 +0200)]
ALSA: memalloc: Drop superfluous ifndef

Drop the superfluous #ifndef check in memalloc.h that had been put
just for allowing building the alsa-driver kernel modules externally.
Since the external build was discontinued years ago, let's clean up
the old kludges.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda: Add ASRock H81M-HDS to the power_save blacklist
Hans de Goede [Wed, 23 May 2018 13:27:05 +0000 (15:27 +0200)]
ALSA: hda: Add ASRock H81M-HDS to the power_save blacklist

Power-saving is causing plops on audio start/stop on ASRock H81M-HDS
machines, 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>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda: Add Gigabyte P55A-UD3 and Z87-D3HP to the power_save blacklist
Hans de Goede [Wed, 23 May 2018 13:27:04 +0000 (15:27 +0200)]
ALSA: hda: Add Gigabyte P55A-UD3 and Z87-D3HP to the power_save blacklist

Power-saving is causing plops on audio start/stop on Gigabyte
P55A-UD3 and Gigabyte Z87-D3HP machines, add these to the power_save
blacklist.

Note these 2 boards both use 1458:a002 as subsystem ids, so they share
a single entry.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1525104
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda: Add Clevo W35xSS_370SS to the power_save blacklist
Hans de Goede [Wed, 23 May 2018 13:27:03 +0000 (15:27 +0200)]
ALSA: hda: Add Clevo W35xSS_370SS to the power_save blacklist

Power-saving is causing a plop and silences the first 2 seconds
(give or take) of audio, silencing notifications sounds on Medion /
Clevo W35xSS_370SS laptops.

Add the Clevo W35xSS_370SS to the power_save blacklist.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1581607
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda: Add Intel NUC7i3BNB to the power_save blacklist
Hans de Goede [Wed, 23 May 2018 13:27:02 +0000 (15:27 +0200)]
ALSA: hda: Add Intel NUC7i3BNB to the power_save blacklist

Power-saving is causing a humming sound when active on the Intel
NUC7i3BNB, add it to the blacklist.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1520902
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoASoC: Intel: cht_bsw_nau8824: Fix jack_type to include SND_JACK_MICROPHONE
Hans de Goede [Mon, 21 May 2018 12:42:51 +0000 (14:42 +0200)]
ASoC: Intel: cht_bsw_nau8824: Fix jack_type to include SND_JACK_MICROPHONE

The nau8824 codec can detect whether a headset or plain headphones is
inserted (as well as button presses on the headset) as such the jack_type
passed to snd_soc_card_jack_new() should include SND_JACK_MICROPHONE.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: rockchip: cdn-dp sound output use spdif
Lin Huang [Tue, 22 May 2018 08:53:42 +0000 (16:53 +0800)]
ASoC: rockchip: cdn-dp sound output use spdif

some monitors care about the parity bit in the sub-frame of I2S,
but the cdn-dp always set this bit to "1", so these monitors
do not have sound output if use i2s, use spdif can fix this issue.

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Lin Huang <hl@rock-chips.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoALSA: hda/conexant - Add hp-mic-fix model string
Takashi Iwai [Fri, 18 May 2018 10:18:59 +0000 (12:18 +0200)]
ALSA: hda/conexant - Add hp-mic-fix model string

Add "hp-mic-fix" model string for Conexant codecs so that user can
test the quirk without recompiling.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoALSA: hda/conexant - Add fixup for HP Z2 G4 workstation
Takashi Iwai [Fri, 18 May 2018 10:14:32 +0000 (12:14 +0200)]
ALSA: hda/conexant - Add fixup for HP Z2 G4 workstation

HP Z2 G4 requires the same workaround as other HP machines that have
no mic-pin detection.

Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoASoC: codec: realtek: Make the node name generic
Fabio Estevam [Sun, 20 May 2018 15:22:48 +0000 (12:22 -0300)]
ASoC: codec: realtek: Make the node name generic

"The name of a node should be somewhat generic, reflecting the function
of the device and not its precise programming model."

Do as suggested in the bindings examples.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: codec: wolfson: Make the node name generic
Fabio Estevam [Sun, 20 May 2018 12:53:41 +0000 (09:53 -0300)]
ASoC: codec: wolfson: Make the node name generic

According to Devicetree Specification v0.2 document:

"The name of a node should be somewhat generic, reflecting the function
of the device and not its precise programming model."

Do as suggested in the bindings examples.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: make wm8782 codec selectable in Kconfig
Daniel Mack [Mon, 21 May 2018 21:54:50 +0000 (23:54 +0200)]
ASoC: make wm8782 codec selectable in Kconfig

FOr platforms that use the simple-card driver, the codec cannot be selected
through 'select' magic in Kconfig. So turn this into a real config option.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: wm8782: add device-tree matching table
Daniel Mack [Mon, 21 May 2018 21:54:49 +0000 (23:54 +0200)]
ASoC: wm8782: add device-tree matching table

This is needed when the codec is instanciated from from a device tree.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: pxa-ssp: simplify pxa_ssp_set_dai_sysclk()
Daniel Mack [Mon, 21 May 2018 21:50:17 +0000 (23:50 +0200)]
ASoC: pxa-ssp: simplify pxa_ssp_set_dai_sysclk()

There's no need to read the register again prior to writing it, we did
that in the beginning of the function.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: pxa-ssp: allow more flexible setup order
Daniel Mack [Mon, 21 May 2018 21:50:16 +0000 (23:50 +0200)]
ASoC: pxa-ssp: allow more flexible setup order

The pxa-ssp driver currently assumes that .set_fmt() is called before
.set_clkdiv(), .set_pll() etc.

Commit a8bd0ee558714 ("ASoC: raumfeld: Use static DAI format setup") broke
support for Raumfeld hardware (and possible other PXA based ones) because
it effectively changed the order of these calls. Also, as the call to
.set_fmt() is now done at probe time, the port clock is not yet enabled.

To fix this, strip all hardware register access code from the .set_fmt()
callback and memorize the desired value, so we can use it from the
.hw_params() callback. Also make the .set_fmt() callback less destructive
by reading all registers that it writes to in the beginning and only
masking out the bits that it possibly fiddles with.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoALSA: oxfw: use match_string() helper
Yisheng Xie [Mon, 21 May 2018 11:58:06 +0000 (19:58 +0800)]
ALSA: oxfw: use match_string() helper

match_string() returns the index of an array for a matching string,
which can be used intead of open coded variant.

Signed-off-by: Yisheng Xie <xieyisheng1@huawei.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoMerge branch 'topic/xen' into for-next
Takashi Iwai [Mon, 21 May 2018 20:21:50 +0000 (22:21 +0200)]
Merge branch 'topic/xen' into for-next

Merge Xen para-virtualized frontend driver from Oleksandr Andrushchenko.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
6 years agoASoC: qcom: apq8096: Add db820c machine driver
Srinivas Kandagatla [Fri, 18 May 2018 12:56:10 +0000 (13:56 +0100)]
ASoC: qcom: apq8096: Add db820c machine driver

This patch adds support to DB820c machine driver.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: qdsp6: dt-bindings: Add apq8096 machine bindings
Srinivas Kandagatla [Fri, 18 May 2018 12:56:09 +0000 (13:56 +0100)]
ASoC: qdsp6: dt-bindings: Add apq8096 machine bindings

Add devicetree bindings documentation file for Qualcomm apq8096 sound card.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: qdsp6: q6asm: Add q6asm dai driver
Srinivas Kandagatla [Fri, 18 May 2018 12:56:08 +0000 (13:56 +0100)]
ASoC: qdsp6: q6asm: Add q6asm dai driver

This patch adds support to q6asm dai driver which configures Q6ASM streams
to pass pcm data.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-and-tested-by: Rohit kumar <rohitkr@codeaurora.org>
Reviewed-by: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: qdsp6: q6afe: Add q6afe dai driver
Srinivas Kandagatla [Fri, 18 May 2018 12:56:07 +0000 (13:56 +0100)]
ASoC: qdsp6: q6afe: Add q6afe dai driver

This patch adds support to q6afe backend dais driver.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-and-tested-by: Rohit kumar <rohitkr@codeaurora.org>
Reviewed-by: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: qdsp6: q6routing: Add support to MI2S Mixers
Srinivas Kandagatla [Fri, 18 May 2018 12:56:06 +0000 (13:56 +0100)]
ASoC: qdsp6: q6routing: Add support to MI2S Mixers

This patch add support to MI2S mixers required to select path between
ASM stream and AFE ports.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-and-tested-by: Rohit kumar <rohitkr@codeaurora.org>
Reviewed-by: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: qdsp6: q6routing: Add support to all SLIMBus Mixers
Srinivas Kandagatla [Fri, 18 May 2018 12:56:05 +0000 (13:56 +0100)]
ASoC: qdsp6: q6routing: Add support to all SLIMBus Mixers

This patch adds support to SLIMBus related mixers to control mux between
ASM stream and AFE port.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-and-tested-by: Rohit kumar <rohitkr@codeaurora.org>
Reviewed-by: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: qdsp6: q6routing: Add q6routing driver
Srinivas Kandagatla [Fri, 18 May 2018 12:56:04 +0000 (13:56 +0100)]
ASoC: qdsp6: q6routing: Add q6routing driver

This patch adds support to q6 routing driver which configures route
between ASM and AFE module using ADM apis.

This driver uses dapm widgets to setup the matrix between AFE ports and
ASM streams.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-and-tested-by: Rohit kumar <rohitkr@codeaurora.org>
Reviewed-by: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: qdsp6: q6asm: Add support to audio stream apis
Srinivas Kandagatla [Fri, 18 May 2018 12:56:03 +0000 (13:56 +0100)]
ASoC: qdsp6: q6asm: Add support to audio stream apis

This patch adds support to open, write and media format commands
in the q6asm module.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-and-tested-by: Rohit kumar <rohitkr@codeaurora.org>
Reviewed-by: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: qdsp6: q6asm: Add support to memory map and unmap
Srinivas Kandagatla [Fri, 18 May 2018 12:56:02 +0000 (13:56 +0100)]
ASoC: qdsp6: q6asm: Add support to memory map and unmap

This patch adds support to memory map and unmap regions commands in
q6asm module.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-and-tested-by: Rohit kumar <rohitkr@codeaurora.org>
Reviewed-by: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: qdsp6: q6asm: Add q6asm driver
Srinivas Kandagatla [Fri, 18 May 2018 12:56:01 +0000 (13:56 +0100)]
ASoC: qdsp6: q6asm: Add q6asm driver

This patch adds basic support to Q6 ASM (Audio Stream Manager) module on
Q6DSP. ASM supports up to 8 concurrent streams. each stream can be setup
as playback/capture. ASM provides top control functions like
Pause/flush/resume for playback and record. ASM can Create/destroy encoder,
decoder and also provides POPP dynamic services.

This patch adds support to basic features to allow hdmi playback.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-and-tested-by: Rohit kumar <rohitkr@codeaurora.org>
Reviewed-by: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: qdsp6: q6adm: Add q6adm driver
Srinivas Kandagatla [Fri, 18 May 2018 12:56:00 +0000 (13:56 +0100)]
ASoC: qdsp6: q6adm: Add q6adm driver

This patch adds support to Q6ADM (Audio Device Manager) module in
q6dsp. ADM performs routing between audio streams and AFE ports.
It does Rate matching for streams going to devices driven by
different clocks, it handles volume ramping, Mixing with channel
and bit-width. ADM creates and destroys dynamic COPP services
for device-related audio processing as needed.

This patch adds basic support to ADM.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-and-tested-by: Rohit kumar <rohitkr@codeaurora.org>
Reviewed-by: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: amd: dma driver changes for bt i2s instance
Mukunda, Vijendar [Tue, 8 May 2018 04:47:53 +0000 (10:17 +0530)]
ASoC: amd: dma driver changes for bt i2s instance

With in ACP, There are three I2S controllers can be
configured/enabled ( I2S SP, I2S MICSP, I2S BT).
Default enabled I2S controller instance is I2S SP.
This patch provides required changes to support I2S BT
controller Instance.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
6 years agoASoC: AMD: Add const to snd_soc_ops instances
Akshu Agrawal [Tue, 8 May 2018 04:47:52 +0000 (10:17 +0530)]
ASoC: AMD: Add const to snd_soc_ops instances

Marking snd_soc_ops instances const

Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com>
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>