platform/kernel/linux-starfive.git
4 years agoALSA: hda: No preallocation on x86 platforms
Takashi Iwai [Mon, 20 Jan 2020 12:44:23 +0000 (13:44 +0100)]
ALSA: hda: No preallocation on x86 platforms

Like many other drivers, HD-audio drivers also do PCM buffer
preallocation to assure the buffer pages allocated at the early boot
stage.  This step is useful for platforms that may fail to allocate
the PCM hardware buffers -- which is mostly for either large
continuous pages or with the specific DMA mask (like emu10k1).

OTOH, when a buffer is allocated as SG-buffer and the DMA mask is
either 32 or 64 bits, the allocation almost never fails unless it hits
the real OOM situation.  In such a case, we don't need the
preallocation inevitably unlike the cases above.

That said, we may drop the preallocation for HD-audio that does
allocate via SG-buffers, and the patch achieves it.

However, there is one caveat: the buffer allocation behavior depends
on CONFIG_SND_DMA_SGBUF, and it falls back to the continuous pages
when it's not set.  And, currently this SG buffer allocation is
enabled only on x86 platforms.  So, covering those fall-outs, the
patch adjusts CONFIG_SND_HDA_PREALLOC_SIZE depending on the condition,
and keeps the old behavior as-is for non-x86 platforms.

On x86, the kconfig item is no longer adjustable but always set to
zero for disabling the preallocation.  You can still enable the
preallocation via procfs interface at any time later, too.

Link: https://lore.kernel.org/r/20200120124423.11862-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: pcm: Set per-card upper limit of PCM buffer allocations
Takashi Iwai [Mon, 20 Jan 2020 12:44:22 +0000 (13:44 +0100)]
ALSA: pcm: Set per-card upper limit of PCM buffer allocations

Currently, the available buffer allocation size for a PCM stream
depends on the preallocated size; when a buffer has been preallocated,
the max buffer size is set to that size, so that application won't
re-allocate too much memory.  OTOH, when no preallocation is done,
each substream may allocate arbitrary size of buffers as long as
snd_pcm_hardware.buffer_bytes_max allows -- which can be quite high,
HD-audio sets 1GB there.

It means that the system may consume a high amount of pages for PCM
buffers, and they are pinned and never swapped out.  This can lead to
OOM easily.

For avoiding such a situation, this patch adds the upper limit per
card.  Each snd_pcm_lib_malloc_pages() and _free_pages() calls are
tracked and it will return an error if the total amount of buffers
goes over the defined upper limit.  The default value is set to 32MB,
which should be really large enough for usual operations.

If larger buffers are needed for any specific usage, it can be
adjusted (also dynamically) via snd_pcm.max_alloc_per_card option.
Setting zero there means no chceck is performed, and again, unlimited
amount of buffers are allowed.

Link: https://lore.kernel.org/r/20200120124423.11862-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoMerge branch 'for-linus' into for-next
Takashi Iwai [Mon, 20 Jan 2020 10:44:35 +0000 (11:44 +0100)]
Merge branch 'for-linus' into for-next

Resolved the merge conflict in HD-audio Tegra driver.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: hda: Apply aligned MMIO access only conditionally
Takashi Iwai [Mon, 20 Jan 2020 10:41:27 +0000 (11:41 +0100)]
ALSA: hda: Apply aligned MMIO access only conditionally

It turned out that the recent simplification of HD-audio bus access
helpers caused a regression on the virtual HD-audio device on QEMU
with ARM platforms.  The driver got a CORB/RIRB timeout and couldn't
probe any codecs.

The essential difference that caused a problem was the enforced
aligned MMIO accesses by simplification.  Since snd-hda-tegra driver
is enabled on ARM, it enables CONFIG_SND_HDA_ALIGNED_MMIO, which makes
the all HD-audio drivers using the aligned MMIO accesses.  While this
is mandatory for snd-hda-tegra, it seems that snd-hda-intel on ARM
gets broken by this access pattern.

For addressing the regression, this patch introduces a new flag,
aligned_mmio, to hdac_bus object, and applies the aligned MMIO only
when this flag is set.  This change affects only platforms with
CONFIG_SND_HDA_ALIGNED_MMIO set, i.e. mostly only for ARM platforms.

Unfortunately the patch became a big bigger than it should be, just
because the former calls didn't take hdac_bus object in the argument,
hence we had to extend the call patterns.

Fixes: 19abfefd4c76 ("ALSA: hda: Direct MMIO accesses")
BugLink: https://bugzilla.opensuse.org/show_bug.cgi?id=1161152
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200120104127.28985-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: hda/realtek - Add Headset Mic supported for HP cPC
Kailang Yang [Fri, 17 Jan 2020 06:04:01 +0000 (14:04 +0800)]
ALSA: hda/realtek - Add Headset Mic supported for HP cPC

HP ALC671 need to support Headset Mic.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Link: https://lore.kernel.org/r/06a9d2b176e14706976d6584cbe2d92a@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: pcm: Make snd_pcm_hw_constraints_init() and _complete() static
Takashi Iwai [Thu, 16 Jan 2020 16:28:25 +0000 (17:28 +0100)]
ALSA: pcm: Make snd_pcm_hw_constraints_init() and _complete() static

Both snd_pcm_hw_constraints_init() and _complete() functions are
called only from pcm_native.c, hence they can be static for further
optimization.

Link: https://lore.kernel.org/r/20200116162825.24792-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: hda/analog - Minor optimization for SPDIF mux connections
Takashi Iwai [Wed, 15 Jan 2020 10:00:35 +0000 (11:00 +0100)]
ALSA: hda/analog - Minor optimization for SPDIF mux connections

AD HD-audio codec driver has a few code lines invoking
snd_get_num_conns() and using its return value as the array index
without checking.  This is basically safe in all those places; at the
second and later calls snd_get_num_conns() returns the value cached
from the first invocation, hence the value is always consistent.

However, it looks a bit confusing as if a lack of the proper check.
This patch introduces a new field num_smux_conns in ad198x_spec for
simplifying the code.  Now we store and refer to the value more
locally without invoking the extra function at each time.

Reported-by: Colin King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20200115100035.22511-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoMerge tag 'asoc-fix-v5.5-rc6' of https://git.kernel.org/pub/scm/linux/kernel/git...
Takashi Iwai [Thu, 16 Jan 2020 13:14:26 +0000 (14:14 +0100)]
Merge tag 'asoc-fix-v5.5-rc6' of https://git./linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v5.5

This is mostly driver specific fixes, plus an error handling fix
in the core.  There is a rather large diffstat for the stm32 SAI
driver, this is a very large but mostly mechanical update which
wraps every register access in the driver to allow a fix to the
locking which avoids circular locks, the active change is much
smaller and more reasonably sized.

4 years agoALSA: usb-audio: add implicit fb quirk for MOTU M Series
Alexander Tsoy [Wed, 15 Jan 2020 15:13:58 +0000 (18:13 +0300)]
ALSA: usb-audio: add implicit fb quirk for MOTU M Series

This fixes crackling sound during playback.

Further note: MOTU is known for reusing Product IDs for different
devices or different generations of the device (e.g. MicroBook
I/II/IIc shares a single Product ID). This patch was only tested with
M4 audio interface, but the same Product ID is also used by M2. Hope
it will work for M2 as well.

Signed-off-by: Alexander Tsoy <alexander@tsoy.me>
Link: https://lore.kernel.org/r/20200115151358.56672-1-alexander@tsoy.me
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: seq: Fix racy access for queue timer in proc read
Takashi Iwai [Wed, 15 Jan 2020 20:37:33 +0000 (21:37 +0100)]
ALSA: seq: Fix racy access for queue timer in proc read

snd_seq_info_timer_read() reads the information of the timer assigned
for each queue, but it's done in a racy way which may lead to UAF as
spotted by syzkaller.

This patch applies the missing q->timer_mutex lock while accessing the
timer object as well as a slight code change to adapt the standard
coding style.

Reported-by: syzbot+2b2ef983f973e5c40943@syzkaller.appspotmail.com
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200115203733.26530-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: usb-audio: unlock on error in probe
Dan Carpenter [Wed, 15 Jan 2020 17:46:04 +0000 (20:46 +0300)]
ALSA: usb-audio: unlock on error in probe

We need to unlock before we returning on this error path.

Fixes: 73ac9f5e5b43 ("ALSA: usb-audio: Add boot quirk for MOTU M Series")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20200115174604.rhanfgy4j3uc65cx@kili.mountain
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: usb-audio: fix sync-ep altsetting sanity check
Johan Hovold [Tue, 14 Jan 2020 08:39:53 +0000 (09:39 +0100)]
ALSA: usb-audio: fix sync-ep altsetting sanity check

The altsetting sanity check in set_sync_ep_implicit_fb_quirk() was
checking for there to be at least one altsetting but then went on to
access the second one, which may not exist.

This could lead to random slab data being used to initialise the sync
endpoint in snd_usb_add_endpoint().

Fixes: c75a8a7ae565 ("ALSA: snd-usb: add support for implicit feedback")
Fixes: ca10a7ebdff1 ("ALSA: usb-audio: FT C400 sync playback EP to capture EP")
Fixes: 5e35dc0338d8 ("ALSA: usb-audio: add implicit fb quirk for Behringer UFX1204")
Fixes: 17f08b0d9aaf ("ALSA: usb-audio: add implicit fb quirk for Axe-Fx II")
Fixes: 103e9625647a ("ALSA: usb-audio: simplify set_sync_ep_implicit_fb_quirk")
Cc: stable <stable@vger.kernel.org> # 3.5
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20200114083953.1106-1-johan@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: hda: patch_hdmi: remove warnings with empty body
Pierre-Louis Bossart [Mon, 13 Jan 2020 21:14:05 +0000 (15:14 -0600)]
ALSA: hda: patch_hdmi: remove warnings with empty body

make W=1 reports the following warnings, fix as suggested

sound/pci/hda/patch_hdmi.c: In function ‘hdmi_non_intrinsic_event’:
sound/pci/hda/patch_hdmi.c:824:3: warning: suggest braces around empty
body in an ‘if’ statement [-Wempty-body]
  824 |   ;
      |   ^
sound/pci/hda/patch_hdmi.c:826:3: warning: suggest braces around empty
body in an ‘if’ statement [-Wempty-body]
  826 |   ;
      |   ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200113211405.28070-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: hda: correct kernel-doc parameter descriptions
Pierre-Louis Bossart [Mon, 13 Jan 2020 21:14:04 +0000 (15:14 -0600)]
ALSA: hda: correct kernel-doc parameter descriptions

make W=1 throws warnings, provide missing documentation

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200113211405.28070-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: hda: Update kernel-doc function parameter descriptions
Keyon Jie [Mon, 13 Jan 2020 20:56:38 +0000 (14:56 -0600)]
ALSA: hda: Update kernel-doc function parameter descriptions

Make W=1 throws a lot of warnings, with multiple misalignments between
function params and their descriptions.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200113205638.27338-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoASoC: msm8916-wcd-digital: Reset RX interpolation path after use
Stephan Gerhold [Sun, 5 Jan 2020 10:27:53 +0000 (11:27 +0100)]
ASoC: msm8916-wcd-digital: Reset RX interpolation path after use

For some reason, attempting to route audio through QDSP6 on MSM8916
causes the RX interpolation path to get "stuck" after playing audio
a few times. In this situation, the analog codec part is still working,
but the RX path in the digital codec stops working, so you only hear
the analog parts powering up. After a reboot everything works again.

So far I was not able to reproduce the problem when using lpass-cpu.

The downstream kernel driver avoids this by resetting the RX
interpolation path after use. In mainline we do something similar
for the TX decimator (LPASS_CDC_CLK_TX_RESET_B1_CTL), but the
interpolator reset (LPASS_CDC_CLK_RX_RESET_CTL) got lost when the
msm8916-wcd driver was split into analog and digital.

Fix this problem by adding the reset to
msm8916_wcd_digital_enable_interpolator().

Fixes: 150db8c5afa1 ("ASoC: codecs: Add msm8916-wcd digital codec")
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20200105102753.83108-1-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: msm8916-wcd-analog: Fix MIC BIAS Internal1
Stephan Gerhold [Sat, 11 Jan 2020 16:40:04 +0000 (17:40 +0100)]
ASoC: msm8916-wcd-analog: Fix MIC BIAS Internal1

MIC BIAS Internal1 is broken at the moment because we always
enable the internal rbias resistor to the TX2 line (connected to
the headset microphone), rather than enabling the resistor connected
to TX1.

Move the RBIAS code to pm8916_wcd_analog_enable_micbias_int1/2()
to fix this.

Fixes: 585e881e5b9e ("ASoC: codecs: Add msm8916-wcd analog codec")
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20200111164006.43074-3-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: cros_ec_codec: Make the device acpi compatible
Yu-Hsuan Hsu [Sun, 12 Jan 2020 05:49:00 +0000 (13:49 +0800)]
ASoC: cros_ec_codec: Make the device acpi compatible

Add ACPI entry for cros_ec_codec.

Signed-off-by: Yu-Hsuan Hsu <yuhsuan@chromium.org>
Link: https://lore.kernel.org/r/20200112054900.236576-1-yuhsuan@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: sti: fix possible sleep-in-atomic
Arnaud Pouliquen [Mon, 13 Jan 2020 10:04:00 +0000 (11:04 +0100)]
ASoC: sti: fix possible sleep-in-atomic

Change mutex and spinlock management to avoid sleep
in atomic issue.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Link: https://lore.kernel.org/r/20200113100400.30472-1-arnaud.pouliquen@st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: msm8916-wcd-analog: Fix selected events for MIC BIAS External1
Stephan Gerhold [Sat, 11 Jan 2020 16:40:03 +0000 (17:40 +0100)]
ASoC: msm8916-wcd-analog: Fix selected events for MIC BIAS External1

MIC BIAS External1 sets pm8916_wcd_analog_enable_micbias_ext1()
as event handler, which ends up in pm8916_wcd_analog_enable_micbias_ext().

But pm8916_wcd_analog_enable_micbias_ext() only handles the POST_PMU
event, which is not specified in the event flags for MIC BIAS External1.
This means that the code in the event handler is never actually run.

Set SND_SOC_DAPM_POST_PMU as the only event for the handler to fix this.

Fixes: 585e881e5b9e ("ASoC: codecs: Add msm8916-wcd analog codec")
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20200111164006.43074-2-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: hdac_hda: Fix error in driver removal after failed probe
Kai Vehmanen [Fri, 10 Jan 2020 23:57:51 +0000 (17:57 -0600)]
ASoC: hdac_hda: Fix error in driver removal after failed probe

In case system has multiple HDA codecs, and codec probe fails for
at least one but not all codecs, driver will end up cancelling
a non-initialized timer context upon driver removal.

Call trace of typical case:

[   60.593646] WARNING: CPU: 1 PID: 1147 at kernel/workqueue.c:3032
__flush_work+0x18b/0x1a0
[...]
[   60.593670]  __cancel_work_timer+0x11f/0x1a0
[   60.593673]  hdac_hda_dev_remove+0x25/0x30 [snd_soc_hdac_hda]
[   60.593674]  device_release_driver_internal+0xe0/0x1c0
[   60.593675]  bus_remove_device+0xd6/0x140
[   60.593677]  device_del+0x175/0x3e0
[   60.593679]  ? widget_tree_free.isra.7+0x90/0xb0 [snd_hda_core]
[   60.593680]  snd_hdac_device_unregister+0x34/0x50 [snd_hda_core]
[   60.593682]  snd_hdac_ext_bus_device_remove+0x2a/0x60 [snd_hda_ext_core]
[   60.593684]  hda_dsp_remove+0x26/0x100 [snd_sof_intel_hda_common]
[   60.593686]  snd_sof_device_remove+0x84/0xa0 [snd_sof]
[   60.593687]  sof_pci_remove+0x10/0x30 [snd_sof_pci]
[   60.593689]  pci_device_remove+0x36/0xb0

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200110235751.3404-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: Intel: fix HDA codec driver probe with multiple controllers
Kai Vehmanen [Fri, 10 Jan 2020 23:57:50 +0000 (17:57 -0600)]
ASoC: SOF: Intel: fix HDA codec driver probe with multiple controllers

In case system has multiple HDA controllers, it can happen that
same HDA codec driver is used for codecs of multiple controllers.
In this case, SOF may fail to probe the HDA driver and SOF
initialization fails.

SOF HDA code currently relies that a call to request_module() will
also run device matching logic to attach driver to the codec instance.
However if driver for another HDA controller was already loaded and it
already loaded the HDA codec driver, this breaks current logic in SOF.
In this case the request_module() SOF does becomes a no-op and HDA
Codec driver is not attached to the codec instance sitting on the HDA
bus SOF is controlling. Typical scenario would be a system with both
external and internal GPUs, with driver of the external GPU loaded
first.

Fix this by adding similar logic as is used in legacy HDA driver
where an explicit device_attach() call is done after request_module().

Also add logic to propagate errors reported by device_attach() back
to caller. This also works in the case where drivers are not built
as modules.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200110235751.3404-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: SOF: Intel: lower print level to dbg if we will reinit DSP
Bard liao [Fri, 10 Jan 2020 23:57:48 +0000 (17:57 -0600)]
ASoC: SOF: Intel: lower print level to dbg if we will reinit DSP

We will reinit DSP in a loop when it fails to initialize the first
time, as recommended. So, it is not an error before we finally give
up. And reorder the trace to make it more readable.

Signed-off-by: Bard liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200110235751.3404-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoALSA: hda: Manage concurrent reg access more properly
Takashi Iwai [Thu, 9 Jan 2020 09:01:04 +0000 (10:01 +0100)]
ALSA: hda: Manage concurrent reg access more properly

In the commit 8e85def5723e ("ALSA: hda: enable regmap internal
locking"), we re-enabled the regmap lock due to the reported
regression that showed the possible concurrent accesses.  It was a
temporary workaround, and there are still a few opened races even
after the revert.  In this patch, we cover those still opened windows
with a proper mutex lock and disable the regmap internal lock again.

First off, the patch introduces a new snd_hdac_device.regmap_lock
mutex that is applied for each snd_hdac_regmap_*() call, including
read, write and update helpers.  The mutex is applied carefully so
that it won't block the self-power-up procedure in the helper
function.  Also, this assures the protection for the accesses without
regmap, too.

The snd_hdac_regmap_update_raw() is refactored to use the standard
regmap_update_bits_check() function instead of the open-code.  The
non-regmap case is still open-coded but it's an easy part.  The all
read and write operations are in the single mutex protection, so it's
now race-free.

In addition, a couple of new helper functions are added:
snd_hdac_regmap_update_raw_once() and snd_hdac_regmap_sync().  Both
are called from HD-audio legacy driver.  The former is to initialize
the given verb bits but only once when it's not initialized yet.  Due
to this condition, the function invokes regcache_cache_only(), and
it's now performed inside the regmap_lock (formerly it was racy) too.
The latter function is for simply invoking regcache_sync() inside the
regmap_lock, which is called from the codec resume call path.
Along with that, the HD-audio codec driver code is slightly modified /
simplified to adapt those new functions.

And finally, snd_hdac_regmap_read_raw(), *_write_raw(), etc are
rewritten with the helper macro.  It's just for simplification because
the code logic is identical among all those functions.

Tested-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200109090104.26073-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: usb-audio: Add boot quirk for MOTU M Series
Alexander Tsoy [Sun, 12 Jan 2020 10:23:58 +0000 (13:23 +0300)]
ALSA: usb-audio: Add boot quirk for MOTU M Series

Add delay to make sure that audio urbs are not sent too early.
Otherwise the device hangs. Windows driver makes ~2s delay, so use
about the same time delay value.

snd_usb_apply_boot_quirk() is called 3 times for my MOTU M4, which
is an overkill. Thus a quirk that is called only once is implemented.

Also send two vendor-specific control messages before and after
the delay. This behaviour is blindly copied from the Windows driver.

Signed-off-by: Alexander Tsoy <alexander@tsoy.me>
Link: https://lore.kernel.org/r/20200112102358.18085-1-alexander@tsoy.me
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: dice: add support for Alesis MasterControl
Takashi Sakamoto [Mon, 13 Jan 2020 08:46:30 +0000 (17:46 +0900)]
ALSA: dice: add support for Alesis MasterControl

Alesis MasterControl was shipped 2009 and already discontinued. This model
consists of:
 * TSB41AB2 for physical layer of IEEE 1394
 * WaveFront Dice II STD for link layer and protocol implementation
 * FreeScale DSPB56374AE

Although the firmware of this model can respond against read transaction
to address space for TCAT extension protocol, the content is not valid
for protocol extension. This results in sound card without any PCM/MIDI
interfaces.

$ ./firewire-request /dev/fw1 read 0xffffe0200000 0x48
result: 000: 00 00 00 20 00 00 04 94 00 00 04 b4 00 00 00 b4
result: 010: 00 00 05 68 00 00 00 24 00 00 05 8c 00 00 00 48
result: 020: 00 00 00 20 00 00 00 08 00 00 00 20 00 00 00 20
result: 030: 00 00 00 10 00 00 00 08 00 00 00 08 00 00 00 04
result: 040: 00 00 00 00 00 00 00 00

This commit adds support the model by adding hard-coded stream formats.

$ python3 ~/git/linux-firewire-utils/src/crpp < /sys/bus/firewire/devices/fw1/config_rom
               ROM header and bus information block
               -----------------------------------------------------------------
400  04041ad7  bus_info_length 4, crc_length 4, crc 6871
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  00059504  company_id 000595     | Alesis Corporation
410  008003f5  device_id 04008003f5  | EUI-64 00059504008003f5

               root directory
               -----------------------------------------------------------------
414  0006a620  directory_length 6, crc 42528
418  03000595  vendor: Alesis Corporation
41c  8100000a  --> descriptor leaf at 444
420  17000002  model
424  8100000d  --> descriptor leaf at 458
428  0c0087c0  node capabilities per IEEE 1394
42c  d1000001  --> unit directory at 430

               unit directory at 430
               -----------------------------------------------------------------
430  00041b9f  directory_length 4, crc 7071
434  12000595  specifier id: Alesis Corporation
438  13000001  version: audio
43c  17000002  model
440  8100000d  --> descriptor leaf at 474

               descriptor leaf at 444
               -----------------------------------------------------------------
444  000494c2  leaf_length 4, crc 38082
448  00000000  textual descriptor
44c  00000000  minimal ASCII
450  416c6573  "Ales"
454  69730000  "is"

               descriptor leaf at 458
               -----------------------------------------------------------------
458  0006c2ec  leaf_length 6, crc 49900
45c  00000000  textual descriptor
460  00000000  minimal ASCII
464  4d617374  "Mast"
468  6572436f  "erCo"
46c  6e74726f  "ntro"
470  6c000000  "l"

               descriptor leaf at 474
               -----------------------------------------------------------------
474  0006c2ec  leaf_length 6, crc 49900
478  00000000  textual descriptor
47c  00000000  minimal ASCII
480  4d617374  "Mast"
484  6572436f  "erCo"
488  6e74726f  "ntro"
48c  6c000000  "l"

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20200113084630.14305-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: dice: loosen stream format check for MIDI conformant data channel
Takashi Sakamoto [Mon, 13 Jan 2020 08:46:29 +0000 (17:46 +0900)]
ALSA: dice: loosen stream format check for MIDI conformant data channel

ALSA dice driver expects devices to multiplex MIDI messages into first
port of isochronous communication. Actually devices perform for it.
However, check of stream format is invalid for second port of isochronous
communication. As a result, when the device supports two ports for
isochronous communication and the stream format is hard-coded, ALSA
dice driver fails to start packet streaming.

This commit loosens stream format check for MIDI conformant data channel.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20200113084630.14305-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: dice: fix fallback from protocol extension into limited functionality
Takashi Sakamoto [Mon, 13 Jan 2020 08:46:28 +0000 (17:46 +0900)]
ALSA: dice: fix fallback from protocol extension into limited functionality

At failure of attempt to detect protocol extension, ALSA dice driver
should be fallback to limited functionality. However it's not.

This commit fixes it.

Cc: <stable@vger.kernel.org> # v4.18+
Fixes: 58579c056c1c9 ("ALSA: dice: use extended protocol to detect available stream formats")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20200113084630.14305-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: oxfw: fix for Stanton SCS.1d
Takashi Sakamoto [Mon, 13 Jan 2020 07:34:18 +0000 (16:34 +0900)]
ALSA: oxfw: fix for Stanton SCS.1d

Stanton SCS.1d uses Oxford Semiconductor FW 971 ASIC (FW971) for
communication. Although the unit is bound to ALSA oxfw driver, the instance
of sound card can not be added due to its quirk of plug information. This
bug was added when snd-scs1x is merged into snd-oxfw at commit
9e2004f9cedf ("ALSA: oxfw: obsolete scs1x module").

This commit fixes the driver for the quirk. In cases that the unit returns
NOT IMPLEMENTED for some AV/C commands, the sound card is added without any
PCM/MIDI interfaces for packet streaming. For SCS.1d, model dependent
operation adds MIDI interface and applications can use it to operate
according to HSS1394 protocol from reverse-engineering work by Sean M.
Pappalardo.

Plug Control Register (PCR) has information that the unit has a pair of
plugs for isochronous communication:

(oMPR)
$ ./firewire-request /dev/fw1 read 0xfffff0000900
result: 80ff0001
(iMPR)
$ ./firewire-request /dev/fw1 read 0xfffff0000980
result: 80ff0001

AV/C PLUG INFO also returns information that the unit has a pair of
plugs for isochronous communication.

(AV/C PLUG INFO command)
$ ./firewire-request /dev/fw1 fcp 0x01ff0200ffffffff
response: 000: 0c ff 02 00 01 01 02 02

However, AV/C PLUG SIGNAL INFO command is rejected for both plugs.

(AV/C OUTPUT PLUG SIGNAL INFO command)
$ ./firewire-request /dev/fw1 fcp 0x01ff1800ffffffff
response: 000: 0a ff 18 00 ff ff ff ff
(AV/C INPUT PLUG SIGNAL INFO command)
$ ./firewire-request /dev/fw1 fcp 0x01ff1900ffffffff
response: 000: 0a ff 19 00 ff ff ff ff

Furthermore, AV/C EXTENDED STREAM FORMAT INFO is not implemented.

(AV/C EXTENDED STREAM FORMAT INFO list subfunction for input plug)
$ ./firewire-request /dev/fw1 fcp 0x01ffbfc000000000ffff00ff
response: 000: 08 ff bf c0 00 00 00 00 ff ff 00 ff
(AV/C EXTENDED STREAM FORMAT INFO list subfunction for output plug)
$ ./firewire-request /dev/fw1 fcp 0x01ffbfc001000000ffff00ff
response: 000: 08 ff bf c0 01 00 00 00 ff ff 00 ff
(AV/C EXTENDED STREAM FORMAT INFO single subfunction for input plug)
$ ./firewire-request /dev/fw1 fcp 0x01ffbfc100000000ffffffff
response: 000: 08 ff bf c1 00 00 00 00 ff ff ff ff
(AV/C EXTENDED STREAM FORMAT INFO single subfunction for output plug)
$ ./firewire-request /dev/fw1 fcp 0x01ffbfc101000000ffffffff
response: 000: 08 ff bf c1 01 00 00 00 ff ff ff ff

Reference: https://mailman.alsa-project.org/pipermail/alsa-devel/2012-May/052264.html
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20200113073418.24622-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: oxfw: don't add MIDI/PCM interface when packet streaming is unavailable
Takashi Sakamoto [Mon, 13 Jan 2020 07:34:17 +0000 (16:34 +0900)]
ALSA: oxfw: don't add MIDI/PCM interface when packet streaming is unavailable

Stanton SCS.1d doesn't support packet streaming even if it has plugs for
isochronous communication.

This commit is a preparation for this case. The 'has_input' member is
added to specific structure, and MIDI/PCM interfaces are not added when
the member is false.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20200113073418.24622-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: oxfw: use ENXIO for not-supported cases
Takashi Sakamoto [Mon, 13 Jan 2020 07:34:16 +0000 (16:34 +0900)]
ALSA: oxfw: use ENXIO for not-supported cases

When AV/C command returns 'NOT IMPLEMENTED' status in its response, ALSA
oxfw driver uses ENOSYS as error code. However, it's expected just to be
used for missing system call number.

This commit replaces it with ENXIO.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20200113073418.24622-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: firewire-tascam: fix corruption due to spin lock without restoration in SoftIRQ...
Takashi Sakamoto [Mon, 13 Jan 2020 08:57:19 +0000 (17:57 +0900)]
ALSA: firewire-tascam: fix corruption due to spin lock without restoration in SoftIRQ context

ALSA firewire-tascam driver can bring corruption due to spin lock without
restoration of IRQ flag in SoftIRQ context. This commit fixes the bug.

Cc: Scott Bahling <sbahling@suse.com>
Cc: <stable@vger.kernel.org> # v4.21
Fixes: d7167422433c ("ALSA: firewire-tascam: queue events for change of control surface")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20200113085719.26788-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: usb: update old-style static const declaration
Pierre-Louis Bossart [Sat, 11 Jan 2020 21:47:36 +0000 (15:47 -0600)]
ALSA: usb: update old-style static const declaration

GCC reports the following warning with W=1

sound/usb/mixer_quirks.c: In function ‘snd_microii_controls_create’:
sound/usb/mixer_quirks.c:1694:2: warning: ‘static’ is not at beginning
of declaration [-Wold-style-declaration]
 1694 |  const static usb_mixer_elem_resume_func_t resume_funcs[] = {
      |  ^~~~~

Move static to the beginning of declaration

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200111214736.3002-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: hda: patch_realtek: fix empty macro usage in if block
Pierre-Louis Bossart [Sat, 11 Jan 2020 21:47:35 +0000 (15:47 -0600)]
ALSA: hda: patch_realtek: fix empty macro usage in if block

GCC reports the following warning with W=1

sound/pci/hda/patch_realtek.c: In function ‘alc269_suspend’:
sound/pci/hda/patch_realtek.c:3616:29: warning: suggest braces around
empty body in an ‘if’ statement [-Wempty-body]
 3616 |   alc5505_dsp_suspend(codec);
      |                             ^

sound/pci/hda/patch_realtek.c: In function ‘alc269_resume’:
sound/pci/hda/patch_realtek.c:3651:28: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
 3651 |   alc5505_dsp_resume(codec);
      |                            ^

This is a classic macro problem and can indeed lead to bad program
flows.

Fix by using the usual "do { } while (0)" pattern

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200111214736.3002-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: timer: fix nsec/sec initialization confusion
Pierre-Louis Bossart [Sat, 11 Jan 2020 20:33:25 +0000 (14:33 -0600)]
ALSA: timer: fix nsec/sec initialization confusion

GCC reports a warning with W=1:

sound/core/timer.c: In function ‘snd_timer_user_read’:
sound/core/timer.c:2219:19: warning: initialized field overwritten
[-Woverride-init]
 2219 |     .tstamp_sec = tread->tstamp_nsec,
      |                   ^~~~~
sound/core/timer.c:2219:19: note: (near initialization for
‘(anonymous).tstamp_sec’)

Assigning nsec values to sec fields is problematic in general, even
more so when the initial goal was to survive the 2030 timer
armageddon.

Fix by using the proper field in the initialization

Cc: Baolin Wang <baolin.wang@linaro.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Fixes: 07094ae6f9527 ("ALSA: Avoid using timespec for struct snd_timer_tread")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20200111203325.20498-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoMerge branch 'for-linus' into for-next
Takashi Iwai [Sat, 11 Jan 2020 08:03:32 +0000 (09:03 +0100)]
Merge branch 'for-linus' into for-next

Sync 5.5-devel branch once again for applying the HD-audio fixes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: hda: Rename back to dmic_detect option
Takashi Iwai [Thu, 9 Jan 2020 08:20:00 +0000 (09:20 +0100)]
ALSA: hda: Rename back to dmic_detect option

We've got quite a few bug reports showing the SOF driver being loaded
unintentionally recently, and the reason seems to be that users didn't
know the module option change: with the recent kernel, a new option
dsp_driver=1 has to be passed to a new module snd-intel-dspcfg
instead of snd_hda_intel.dmic_detect=0 option.

That is, actually there are two tricky things here:
- We changed the whole detection in another module and another
  option semantics.
- The existing option for skipping the DSP probe was also renamed.

For avoiding the confusion and giving user more hint, this patch
reverts the renamed option dsp_driver back to dmic_detect for
snd-hda-intel module, and show the warning about the module option
change when the non-default value is passed.

Fixes: 82d9d54a6c0e ("ALSA: hda: add Intel DSP configuration / probe code")
Link: https://lore.kernel.org/r/20200109082000.26729-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoASoC: stm32: dfsdm: fix 16 bits record
Olivier Moysan [Fri, 10 Jan 2020 13:11:31 +0000 (14:11 +0100)]
ASoC: stm32: dfsdm: fix 16 bits record

In stm32_afsdm_pcm_cb function, the transfer size is provided in bytes.
However, samples are copied as 16 bits words from iio buffer.
Divide by two the transfer size, to copy the right number of samples.

Fixes: 1e7f6e1c69f0 ("ASoC: stm32: dfsdm: add 16 bits audio record support")

Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
Link: https://lore.kernel.org/r/20200110131131.3191-1-olivier.moysan@st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: stm32: sai: fix possible circular locking
Olivier Moysan [Thu, 9 Jan 2020 08:32:54 +0000 (09:32 +0100)]
ASoC: stm32: sai: fix possible circular locking

In current driver, locks can be taken as follows:
- Register access: take a lock on regmap config and then on clock.
- Master clock provider: take a lock on clock and then on regmap config.
This can lead to the circular locking summarized below.

Remove peripheral clock management through regmap framework, and manage
peripheral clock in driver instead. On register access, lock on clock
is taken first, which allows to avoid possible locking issue.

[ 6696.561513] ======================================================
[ 6696.567670] WARNING: possible circular locking dependency detected
[ 6696.573842] 4.19.49 #866 Not tainted
[ 6696.577397] ------------------------------------------------------
[ 6696.583566] pulseaudio/6439 is trying to acquire lock:
[ 6696.588697] 87b0a25b (enable_lock){..-.}, at: clk_enable_lock+0x64/0x128
[ 6696.595377]
[ 6696.595377] but task is already holding lock:
[ 6696.601197] d858f825 (stm32_sai_sub:1342:(sai->regmap_config)->lock){....}
...
[ 6696.812513]  Possible unsafe locking scenario:
[ 6696.812513]
[ 6696.818418]        CPU0                    CPU1
[ 6696.822935]        ----                    ----
[ 6696.827451]   lock(stm32_sai_sub:1342:(sai->regmap_config)->lock);
[ 6696.833618]                                lock(enable_lock);
[ 6696.839350]                                lock(stm32_sai_sub:1342:
                                              (sai->regmap_config)->lock);
[ 6696.848035]   lock(enable_lock);

Fixes: 03e78a242a15 ("ASoC: stm32: sai: add h7 support")

Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
Link: https://lore.kernel.org/r/20200109083254.478-1-olivier.moysan@st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoALSA: hda: enable regmap internal locking
Kai Vehmanen [Wed, 8 Jan 2020 18:08:56 +0000 (20:08 +0200)]
ALSA: hda: enable regmap internal locking

This reverts commit 42ec336f1f9d ("ALSA: hda: Disable regmap
internal locking").

Without regmap locking, there is a race between snd_hda_codec_amp_init()
and PM callbacks issuing regcache_sync(). This was caught by
following kernel warning trace:

<4> [358.080081] WARNING: CPU: 2 PID: 4157 at drivers/base/regmap/regcache.c:498 regcache_cache_only+0xf5/0x130
[...]
<4> [358.080148] Call Trace:
<4> [358.080158]  snd_hda_codec_amp_init+0x4e/0x100 [snd_hda_codec]
<4> [358.080169]  snd_hda_codec_amp_init_stereo+0x40/0x80 [snd_hda_codec]

Suggested-by: Takashi Iwai <tiwai@suse.de>
BugLink: https://gitlab.freedesktop.org/drm/intel/issues/592
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200108180856.5194-1-kai.vehmanen@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: hda: Fix a typo in comments
Takashi Iwai [Wed, 8 Jan 2020 15:34:30 +0000 (16:34 +0100)]
ALSA: hda: Fix a typo in comments

Link: https://lore.kernel.org/r/20200108153430.31456-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: pci: echoaudio: remove set but not used variable 'chip'
YueHaibing [Wed, 8 Jan 2020 12:58:03 +0000 (20:58 +0800)]
ALSA: pci: echoaudio: remove set but not used variable 'chip'

sound/pci/echoaudio/echoaudio.c: In function snd_echo_mixer_info:
sound/pci/echoaudio/echoaudio.c:1233:20: warning: variable chip set but not used [-Wunused-but-set-variable]
sound/pci/echoaudio/echoaudio.c: In function 'snd_echo_vmixer_info':
sound/pci/echoaudio/echoaudio.c:1300:20: warning: variable 'chip' set but not used [-Wunused-but-set-variable]

commit e67c3f0fd44c ("ALSA: pci: echoaudio: remove usage
of dimen menber of elem_value structure") left behind this
unused variable.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20200108125803.45584-1-yuehaibing@huawei.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: hda/realtek - Add quirk for the bass speaker on Lenovo Yoga X1 7th gen
Kailang Yang [Wed, 8 Jan 2020 08:47:56 +0000 (16:47 +0800)]
ALSA: hda/realtek - Add quirk for the bass speaker on Lenovo Yoga X1 7th gen

Add quirk to ALC285_FIXUP_SPEAKER2_TO_DAC1, which is the same fixup
applied for X1 Carbon 7th gen in commit d2cd795c4ece ("ALSA: hda -
fixup for the bass speaker on Lenovo Carbon X1 7th gen").

Signed-off-by: Kailang Yang <kailang@realtek.com>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: hda/realtek - Set EAPD control to default for ALC222
Kailang Yang [Tue, 7 Jan 2020 09:22:19 +0000 (17:22 +0800)]
ALSA: hda/realtek - Set EAPD control to default for ALC222

Set EAPD control to verb control.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: control: potential uninitialized return value
Dan Carpenter [Wed, 8 Jan 2020 05:37:06 +0000 (08:37 +0300)]
ALSA: control: potential uninitialized return value

Smatch complains that "ret" might be uninitialized.

Fixes: fbd3eb7f66c5 ("ALSA: control: Add verification for kctl accesses")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20200108053706.h3hcnvmnf62wkjac@kili.mountain
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoASoC: Fix NULL dereference at freeing
Takashi Iwai [Tue, 7 Jan 2020 07:09:56 +0000 (08:09 +0100)]
ASoC: Fix NULL dereference at freeing

When an ASoC driver with pcm_destruct component ops is freed before
the PCM object instantiation (e.g. deferring the probe), it hits an
Oops at snd_soc_pcm_component_free() that calls the pcm_destruct ops
unconditionally.

Fix it by adding a NULL-check of rtd->pcm before calling callbacks.

Fixes: c64bfc906600 ("ASoC: soc-core: add new pcm_construct/pcm_destruct")
Reported-by: Matthias Brugger <matthias.bgg@gmail.com>
Tested-by: Ben Ho <ben.ho@mediatek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20200107070956.15807-1-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: Intel: bytcht_es8316: Fix Irbis NB41 netbook quirk
Hans de Goede [Mon, 6 Jan 2020 11:39:03 +0000 (12:39 +0100)]
ASoC: Intel: bytcht_es8316: Fix Irbis NB41 netbook quirk

When a quirk for the Irbis NB41 netbook was added, to override the defaults
for this device, I forgot to add/keep the BYT_CHT_ES8316_SSP0 part of the
defaults, completely breaking audio on this netbook.

This commit adds the BYT_CHT_ES8316_SSP0 flag to the Irbis NB41 netbook
quirk, making audio work again.

Cc: stable@vger.kernel.org
Cc: russianneuromancer@ya.ru
Fixes: aa2ba991c420 ("ASoC: Intel: bytcht_es8316: Add quirk for Irbis NB41 netbook")
Reported-and-tested-by: russianneuromancer@ya.ru
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200106113903.279394-1-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoASoC: rt5640: Fix NULL dereference on module unload
Dmitry Osipenko [Mon, 6 Jan 2020 01:47:07 +0000 (04:47 +0300)]
ASoC: rt5640: Fix NULL dereference on module unload

The rt5640->jack is NULL if jack is already disabled at the time of
driver's module unloading.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/20200106014707.11378-1-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 years agoMerge tag 'asoc-fix-v5.5-rc5' of https://git.kernel.org/pub/scm/linux/kernel/git...
Takashi Iwai [Mon, 6 Jan 2020 16:39:15 +0000 (17:39 +0100)]
Merge tag 'asoc-fix-v5.5-rc5' of https://git./linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v5.5

More fixes that have been collected, nothing super remarkable here - the
few core fixes are mainly error handling related as are many of the
driver fixes.

4 years agoALSA: sh: Fix compile warning wrt const
Takashi Iwai [Sun, 5 Jan 2020 14:48:23 +0000 (15:48 +0100)]
ALSA: sh: Fix compile warning wrt const

A long-standing compile warning was seen during build test:
  sound/sh/aica.c: In function 'load_aica_firmware':
  sound/sh/aica.c:521:25: warning: passing argument 2 of 'spu_memload' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]

Fixes: 198de43d758c ("[ALSA] Add ALSA support for the SEGA Dreamcast PCM device")
Link: https://lore.kernel.org/r/20200105144823.29547-69-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: spi: More constification
Takashi Iwai [Sun, 5 Jan 2020 14:48:22 +0000 (15:48 +0100)]
ALSA: spi: More constification

Apply const prefix to the static table for registers.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-68-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: pdaudiocf: More constification
Takashi Iwai [Sun, 5 Jan 2020 14:48:21 +0000 (15:48 +0100)]
ALSA: pdaudiocf: More constification

Apply const prefix to the static table for verbs.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-67-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: via82xx: More constification
Takashi Iwai [Sun, 5 Jan 2020 14:48:20 +0000 (15:48 +0100)]
ALSA: via82xx: More constification

Apply const prefix to the static table for the chip models.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-66-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: fm801: More constification
Takashi Iwai [Sun, 5 Jan 2020 14:48:19 +0000 (15:48 +0100)]
ALSA: fm801: More constification

Apply const prefix to the static register table.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-65-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: ens137x: More constification
Takashi Iwai [Sun, 5 Jan 2020 14:48:18 +0000 (15:48 +0100)]
ALSA: ens137x: More constification

Apply const prefix to the quirk entry, forgotten in the previous fix.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-64-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: echoaudio: More constification
Takashi Iwai [Sun, 5 Jan 2020 14:48:17 +0000 (15:48 +0100)]
ALSA: echoaudio: More constification

Apply const prefix to the static channel list table.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-63-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: cs4281: More constification
Takashi Iwai [Sun, 5 Jan 2020 14:48:16 +0000 (15:48 +0100)]
ALSA: cs4281: More constification

Apply const prefix to the static register table.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-62-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: azt3328: More constification
Takashi Iwai [Sun, 5 Jan 2020 14:48:15 +0000 (15:48 +0100)]
ALSA: azt3328: More constification

Apply const prefix to the static initial register table.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-61-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: ak4531: More constification
Takashi Iwai [Sun, 5 Jan 2020 14:48:14 +0000 (15:48 +0100)]
ALSA: ak4531: More constification

Apply const prefix to the initial register map.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-60-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: serial-u16550: More constification
Takashi Iwai [Sun, 5 Jan 2020 14:48:13 +0000 (15:48 +0100)]
ALSA: serial-u16550: More constification

Apply const prefix to the string array.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-59-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: opl4: More constification
Takashi Iwai [Sun, 5 Jan 2020 14:48:12 +0000 (15:48 +0100)]
ALSA: opl4: More constification

Apply const prefix to the static volume table.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-58-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: arm: More constification
Takashi Iwai [Sun, 5 Jan 2020 14:48:11 +0000 (15:48 +0100)]
ALSA: arm: More constification

Apply const prefix to the static channel list table.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-57-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: lx6464es: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:48:10 +0000 (15:48 +0100)]
ALSA: lx6464es: More constifications

Apply const prefix to the static tables for the DSP command and the
peak map.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-56-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: aw2: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:48:09 +0000 (15:48 +0100)]
ALSA: aw2: More constifications

Apply const prefix to the static parameter tables.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-55-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: mts64: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:48:08 +0000 (15:48 +0100)]
ALSA: mts64: More constifications

Apply const prefix to the static mapping tables.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-54-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: sc6000: More constification
Takashi Iwai [Sun, 5 Jan 2020 14:48:07 +0000 (15:48 +0100)]
ALSA: sc6000: More constification

Apply const prefix to the static resource tables.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-53-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: wss: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:48:06 +0000 (15:48 +0100)]
ALSA: wss: More constifications

Apply const prefix to the static tables for parameters.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-52-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: opti9xx: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:48:05 +0000 (15:48 +0100)]
ALSA: opti9xx: More constifications

Apply const prefix to the static resource tables, the mc size tables
and the string arrays.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-51-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: gus: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:48:04 +0000 (15:48 +0100)]
ALSA: gus: More constifications

Apply const prefix to each possible place: the static resource tables,
the volume table, etc.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-50-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: es18xx: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:48:03 +0000 (15:48 +0100)]
ALSA: es18xx: More constifications

Apply const prefix to the static map tables and the static resource
tables.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-49-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: es1688: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:48:02 +0000 (15:48 +0100)]
ALSA: es1688: More constifications

Apply const prefix to the static resource tables and init tables.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-48-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: cmi8330: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:48:01 +0000 (15:48 +0100)]
ALSA: cmi8330: More constifications

Apply const prefix to the static tables for the register, controls and
callbacks.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-47-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: sb: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:48:00 +0000 (15:48 +0100)]
ALSA: sb: More constifications

Apply const prefix to each possible place: the static tables for the
resources, controls, registers, values and parameters.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-46-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: cs423x: More constification
Takashi Iwai [Sun, 5 Jan 2020 14:47:59 +0000 (15:47 +0100)]
ALSA: cs423x: More constification

Apply const prefix to the static mapping table.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-45-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: cmi8328: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:47:58 +0000 (15:47 +0100)]
ALSA: cmi8328: More constifications

Apply const prefix to the static resource tables.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-44-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: opl3: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:47:57 +0000 (15:47 +0100)]
ALSA: opl3: More constifications

Apply const prefix to the static tables for drum, volume and notes.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-43-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: rawmidi: More constification
Takashi Iwai [Sun, 5 Jan 2020 14:47:56 +0000 (15:47 +0100)]
ALSA: rawmidi: More constification

Apply const prefix to the static flag info table.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-42-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: oss: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:47:55 +0000 (15:47 +0100)]
ALSA: oss: More constifications

Apply const prefix to the static tables for strings and formats.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-41-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: jack: More constification
Takashi Iwai [Sun, 5 Jan 2020 14:47:54 +0000 (15:47 +0100)]
ALSA: jack: More constification

Apply const prefix to the static jack switch table.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-40-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: info: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:47:53 +0000 (15:47 +0100)]
ALSA: info: More constifications

Apply const prefix to the string array and its callers.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-39-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: sparc: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:47:52 +0000 (15:47 +0100)]
ALSA: sparc: More constifications

Apply const prefix to the static tables for rates, bits and strings.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-38-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: cmipci: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:47:51 +0000 (15:47 +0100)]
ALSA: cmipci: More constifications

Apply const prefix to the static tables for rates, ports and
registers.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-37-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: es1968: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:47:50 +0000 (15:47 +0100)]
ALSA: es1968: More constifications

Apply const prefix to the quirk white/black lists.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-36-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: es1938: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:47:49 +0000 (15:47 +0100)]
ALSA: es1938: More constifications

Apply const prefix to the static register table and its callers.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-35-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: atiixp: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:47:48 +0000 (15:47 +0100)]
ALSA: atiixp: More constifications

Apply const prefix to the static register tables.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-34-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: asihpi: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:47:47 +0000 (15:47 +0100)]
ALSA: asihpi: More constifications

Apply const prefix to each possible place: the static tables for
formats, parameters, etc.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-33-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: ctxfi: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:47:46 +0000 (15:47 +0100)]
ALSA: ctxfi: More constifications

Apply const prefix to each possible place: the DAIO tables and the
register offset table.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-32-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: ca0106: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:47:45 +0000 (15:47 +0100)]
ALSA: ca0106: More constifications

Apply const prefix to each possible place: the static tables for
registers and verbs, and the string arrays.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-31-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: cs46xx: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:47:44 +0000 (15:47 +0100)]
ALSA: cs46xx: More constifications

Apply const prefix to each possible place: the static tables for
registers and op codes, etc.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-30-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: korg1212: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:47:43 +0000 (15:47 +0100)]
ALSA: korg1212: More constifications

Apply const prefix to each possible place: the string array, the
static tables for clock selectors, etc.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-29-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: nm256: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:47:42 +0000 (15:47 +0100)]
ALSA: nm256: More constifications

Apply const prefix to the static tables coefs and init registers.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-28-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: bcd2000: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:47:41 +0000 (15:47 +0100)]
ALSA: bcd2000: More constifications

Apply const prefix to the static tables for command and verbs.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-27-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: ymfpci: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:47:40 +0000 (15:47 +0100)]
ALSA: ymfpci: More constifications

Apply const prefix to each possible place: the static tables for
sample rates, parameters and registers.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-26-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: mixart: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:47:39 +0000 (15:47 +0100)]
ALSA: mixart: More constifications

Apply const prefix to each possible place: the string arrays and the
static tables for volumes.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-25-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: pcxhr: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:47:38 +0000 (15:47 +0100)]
ALSA: pcxhr: More constifications

Apply const prefix to each possible place: the board parameters and
DSP command table, and the string arrays.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-24-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: usx2y: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:47:37 +0000 (15:47 +0100)]
ALSA: usx2y: More constifications

Apply const prefix to each possible place: the string array and the
parameter tables and callers.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-23-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: emux: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:47:36 +0000 (15:47 +0100)]
ALSA: emux: More constifications

Apply const prefix to each possible place: the MIDI data definitions,
the static tables for volume parameters, etc.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-22-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: rme9652: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:47:35 +0000 (15:47 +0100)]
ALSA: rme9652: More constifications

Apply const prefix to the channel map tables.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-21-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: hdspm: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:47:34 +0000 (15:47 +0100)]
ALSA: hdspm: More constifications

Apply const prefix to each possible place: the string arrays, the
channel map tables and callers.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-20-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
4 years agoALSA: hdsp: More constifications
Takashi Iwai [Sun, 5 Jan 2020 14:47:33 +0000 (15:47 +0100)]
ALSA: hdsp: More constifications

Apply const prefix to each channel map table and its callers.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-19-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>