Commit Graph

34853 Commits

Author SHA1 Message Date
Arnaud Pouliquen ce780a47c3
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>
2020-01-13 15:12:26 +00:00
Stephan Gerhold e0beec8839
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: 585e881e5b ("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>
2020-01-13 15:12:25 +00:00
Kai Vehmanen 552b1a85da
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>
2020-01-13 15:12:24 +00:00
Kai Vehmanen 2c63bea714
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>
2020-01-13 15:12:23 +00:00
Bard liao ceca2197b2
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>
2020-01-13 15:12:22 +00:00
Pierre-Louis Bossart 5732c0fc53
ASoC: SOF: Intel: reference SoundWire machine lists
Use static tables to automatically select the relevant configurations.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200110222530.30303-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-13 15:01:39 +00:00
Pierre-Louis Bossart d985d208bf
ASoC: Intel: common: add match tables for TGL w/ SoundWire
RT711 is in SoundWire mode on link0.
RT1308 is either on SSP2 or on SoundWire link1 (depending on hardware
reworks).

Signed-off-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200110222530.30303-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-13 15:01:24 +00:00
Rander Wang db0b9efb98
ASoC: Intel: common: add match tables for CNL/CFL/CML w/ SoundWire
The two configurations are with the Realtek 3-in-1 board requiring all
4 links to be enabled, or basic configuration with the on-board
RT700 using link1.

For now we only have definitions for CML. CNL and CFL are just
placeholders.

Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
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/20200110222530.30303-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-13 15:01:09 +00:00
Bard Liao 4313dd3efe
ASoC: Intel: common: add match tables for ICL w/ SoundWire
The two configurations are with the Realtek 3-in-1 board requiring all
4 links to be enabled, or basic configuration with the on-board RT700
using link0.

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/20200110222530.30303-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-13 15:00:53 +00:00
Kai Vehmanen cfe8191b1b
ASoC: SOF: fix PCM playback through ALSA OSS emulation
Any app using ALSA OSS emulation on top of SOF will fail
to error from OSS SNDCTL_DSP_SETFMT ioctl. Reported initially
as an issue with xournalpp (application using PortAudio with
an OSS backend), but applies more generally to other apps
using OSS as well.

Problem is caused by SOF PCM not supporting repeated calls
to hw_params(), without matching calls to pcm_free(). This
is however exactly what the ALSA OSS PCM code is doing when
it is handling the OSS ioctls.

The problem will lead to leaking of DSP resources and eventual
failure of DSP PCM_PARAMS IPC.

BugLink: https://github.com/thesofproject/linux/issues/1510
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-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-13 15:00:00 +00:00
Pierre-Louis Bossart a40acc6bfc
ASoC: Intel: bdw-rt5650: change cpu_dai and platform components for SOF
The legacy driver uses dummy cpu_dai and platform, SOF requires actual
values to bind.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200110235751.3404-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-13 14:59:45 +00:00
Pan Xiuli 64df6afa0d
ASoC: Intel: broadwell: change cpu_dai and platform components for SOF
The legacy driver uses dummy cpu_dai and platform, SOF requires actual
values to bind.

Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200110235751.3404-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-13 14:59:30 +00:00
Pierre-Louis Bossart 4865bde187
ASoC: Intel: bdw-rt5677: change cpu_dai and platform components for SOF
The legacy driver uses dummy cpu_dai and platform, SOF requires actual
values to bind.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200110235751.3404-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-13 14:59:14 +00:00
Pierre-Louis Bossart 630db15493
ASoC: Intel: bdw-rt5677: fix Kconfig dependencies
The existing machine driver depends on SPI Master capabilities, but
the Kconfig does not model this dependency and the SPI controller
needs to be selected as well.

Without this patch the machine driver probe would fail with the
spi-RT5677AA:00 component never registered by the ACPI/LPSS subsystem.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200110235751.3404-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-13 14:59:05 +00:00
YueHaibing 62d28dcb65
ASoC: rt711: remove unused including <linux/version.h>
Remove including <linux/version.h> that don't need it.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20200113013123.47561-1-yuehaibing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-13 14:58:56 +00:00
Jack Yu d1ede0641b
ASoC: rt715: add RT715 codec driver
Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/20200110021821.17843-1-jack.yu@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-13 14:58:45 +00:00
Paul Burton ec0f6a4c4a
ASoC: txx9: Remove unused rtd variable
Commit a857e073ff ("ASoC: txx9: txx9aclc: remove snd_pcm_ops") removed
the last use of the rtd variable but didn't remove its definition,
leading to the following warning/error for MIPS rbtx49xx_defconfig
builds:

sound/soc/txx9/txx9aclc.c: In function 'txx9aclc_pcm_hw_params':
sound/soc/txx9/txx9aclc.c:54:30: error: unused variable 'rtd'
    [-Werror=unused-variable]
  struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
                              ^~~

Resolve this by removing the unused variable.

Signed-off-by: Paul Burton <paulburton@kernel.org>
Fixes: a857e073ff ("ASoC: txx9: txx9aclc: remove snd_pcm_ops")
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: alsa-devel@alsa-project.org
Link: https://lore.kernel.org/r/20200109191422.334516-1-paulburton@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-13 14:58:38 +00:00
Takashi Iwai 1a462be52f ALSA: hda: Manage concurrent reg access more properly
In the commit 8e85def572 ("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>
2020-01-13 13:40:41 +01:00
Alexander Tsoy 73ac9f5e5b 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>
2020-01-13 10:47:56 +01:00
Takashi Sakamoto 791a485f2d 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>
2020-01-13 10:44:30 +01:00
Takashi Sakamoto a9f47fcb5e 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>
2020-01-13 10:44:00 +01:00
Takashi Sakamoto 3e2dc6bdb5 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: 58579c056c ("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>
2020-01-13 10:43:27 +01:00
Takashi Sakamoto 41dbc79279 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
9e2004f9ce ("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>
2020-01-13 10:42:27 +01:00
Takashi Sakamoto 06a42a74a0 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>
2020-01-13 10:42:14 +01:00
Takashi Sakamoto 03be63b295 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>
2020-01-13 10:41:47 +01:00
Takashi Sakamoto 747d1f076d 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: d716742243 ("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>
2020-01-13 10:41:01 +01:00
Pierre-Louis Bossart ff40e0d41a 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>
2020-01-12 09:45:17 +01:00
Pierre-Louis Bossart 8a71821f12 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>
2020-01-12 09:45:09 +01:00
Pierre-Louis Bossart f999348021 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: 07094ae6f9 ("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>
2020-01-12 09:08:22 +01:00
Takashi Iwai 3cdca6d62b 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>
2020-01-11 09:03:40 +01:00
Takashi Iwai 7fba6aea44 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: 82d9d54a6c ("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>
2020-01-11 09:02:23 +01:00
Linus Torvalds b1d198c08c sound fixes for 5.5-rc6
A few piled ASoC fixes and usual HD-audio and USB-audio fixups.
 Some of them are for ASoC core, but rather about error-handling.
 -----BEGIN PGP SIGNATURE-----
 
 iQJCBAABCAAsFiEEIXTw5fNLNI7mMiVaLtJE4w1nLE8FAl4YWVcOHHRpd2FpQHN1
 c2UuZGUACgkQLtJE4w1nLE+D1RAAgAvg1Zm2u2qv3D0qNt6eip88yFvXy+ZkgZF+
 nBy/cVCqRDm+VLwEK3hQe4G/jk+h39PTxS1Pa3PMWwu++MvwuIHLH5ekv77o51pT
 SW1DhIPzrE8vv3iN7r9/xLjFxeJcM6yn297aMI362MXhb42wLTddiQPooqUmCcqr
 XOZvNVjJq35jyJVojaViuabxO+4K6zlgrjvNw5HLpUb4c82mKX/fsoeS7INOJd0q
 JDJHVI77GUNSJN/4ub0WD72i4v39QWDtWJWhn3yagmYGTW9RVwCVRGstDOLehDv0
 dletpXPL+cza1P7aqD12ZSY2fWM6AivEjW+kaNmq1ag8MRRNC2SgsQEecSmQJcIZ
 IHF/n4S1LJw0V/Pnn+M+UUPZmzTV7LEIKQJ2FXQ6OmnUJLPyE3FZQDG+DVtlaKTg
 5Q6lPaIcmZpVJdpd38K1vlogcwQJ8euLKtwmMvuLzrwc+oycp5o1Vha3VuxyhIlk
 WS563iJOQ2HHuturqdLR6qhNetmGwZ5FhGJgyFIN3yXQxD8mBBxPuoGTzgCUu0oH
 u0dJU+dyd/lMa+CUQuB0CftvWwbqDf6QF607RCuiIaArQO+LAi8rllwxPkVkXwWl
 iuEBCCp16A7hajthZpUhTjS8EIFSs/CgmYYspA77kDl9WUUpnvxqaNFYDtb6DveI
 95QOWes=
 =/0Br
 -----END PGP SIGNATURE-----

Merge tag 'sound-5.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "A few piled ASoC fixes and usual HD-audio and USB-audio fixups. Some
  of them are for ASoC core error-handling"

* tag 'sound-5.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: hda: enable regmap internal locking
  ALSA: hda/realtek - Add quirk for the bass speaker on Lenovo Yoga X1 7th gen
  ALSA: hda/realtek - Set EAPD control to default for ALC222
  ALSA: usb-audio: Apply the sample rate quirk for Bose Companion 5
  ALSA: hda/realtek - Add new codec supported for ALCS1200A
  ASoC: Intel: boards: Fix compile-testing RT1011/RT5682
  ASoC: SOF: imx8: Fix dsp_box offset
  ASoC: topology: Prevent use-after-free in snd_soc_get_pcm_runtime()
  ASoC: fsl_audmix: add missed pm_runtime_disable
  ASoC: stm32: spdifrx: fix input pin state management
  ASoC: stm32: spdifrx: fix race condition in irq handler
  ASoC: stm32: spdifrx: fix inconsistent lock state
  ASoC: core: Fix access to uninitialized list heads
  ASoC: soc-core: Set dpcm_playback / dpcm_capture
  ASoC: SOF: imx8: fix memory allocation failure check on priv->pd_dev
  ASoC: SOF: Intel: hda: hda-dai: fix oops on hda_link .hw_free
  ASoC: SOF: fix fault at driver unload after failed probe
2020-01-10 11:52:36 -08:00
Kuninori Morimoto b0edff4236
ASoC: soc-pcm/soc-compress: use snd_soc_dapm_stream_stop() for SND_SOC_DAPM_STREAM_STOP
dpcm_fe_dai_shutdown() / soc_compr_free_fe() didn't care pmdown_time.
We already have snd_soc_dapm_stream_stop() for it.
Let's use common method.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87zhewrq9j.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-10 13:34:19 +00:00
Kuninori Morimoto 3f4cf79793
ASoC: soc-dapm: add snd_soc_dapm_stream_stop()
When we stop stream, if it was Playback, we might need to care
about power down time. In such case, we need to use delayed work.

We have same implementation for it at soc-pcm.c and soc-compress.c,
but we don't want to have duplicate code.
This patch adds snd_soc_dapm_stream_stop(), and share same code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/871rs8t4uw.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-10 13:33:53 +00:00
Kuninori Morimoto 83f94a2e29
ASoC: soc-core: add snd_soc_close_delayed_work()
We need to setup rtd->close_delayed_work_func.
It will be set at snd_soc_dai_compress_new() or soc_new_pcm().
But these setups close_delayed_work() which is same name /
same implemantaion, but different local code.
To reduce duplicate code, this patch moves it as
snd_soc_close_delayed_work() and share same code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/8736cot4v2.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-10 13:33:27 +00:00
Kuninori Morimoto 76c39e867c
ASoC: soc-core: do pinctrl_pm_select_xxx() as component
ALSA SoC need to care pinctrl_pm_select_xxx().
It is called at soc-core and soc-pcm.
soc-pcm  is controlling it for activate DAI.
soc-core is controlling it for whole system
(= suspend/resume/probe/poweroff).

If we focus to soc-core side, it need to care about BIAS level.
Then, snd_soc_suspend() only is controlling it by Component base (a).
Other functions are DAI base (b).

(a)	pinctrl_pm_select_xxx(component->dev, xxx);
(b)	pinctrl_pm_select_xxx(dai->dev, xxx);

Because of these unbalance, the code is confusable.
Here, dai->dev and component->dev are same pointer.
Thus, we can replace it component base.

One note here is that it cared DAI (= CPU/Codec) pin before this patch,
after this patch, it cares Component (= CPU/Codec/Platform) pin.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/874kx4t4v6.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-10 13:33:08 +00:00
Kuninori Morimoto d7a8cb4931
ASoC: soc-core: remove duplicate pinctrl operation when suspend
snd_soc_suspend() are doing below for pinctrl_pm_select_sleep_state()

	int snd_soc_suspend(struct device *dev)
	{
		...
		for_each_card_components(card, component) {
			...
(1)			pinctrl_pm_select_sleep_state(component->dev);
		}

		for_each_card_rtds(card, rtd) {
			...
(2)			pinctrl_pm_select_sleep_state(cpu_dai->dev);
		}
	}

(1) is called for all component (CPU/Codec/Platform), and
(2) is called for CPU DAIs.
Here, component->dev is same as dai->dev.
This means, it is called in duplicate on CPU case.
This patch removes (2).

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/875zhkt4vc.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-10 13:32:50 +00:00
Kuninori Morimoto 1272063a7e
ASoC: soc-core: care .ignore_suspend for Component suspend
Card dai_link has .ignore_suspend, and ALSA SoC cares it when suspend.
For example, like this

	for_each_card_rtds(card, rtd) {
		if (rtd->dai_link->ignore_suspend)
			continue;
		...
	}

But in snd_soc_suspend(), it doesn't care about
it when suspending Component. This patch cares it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/877e20t4vh.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-10 13:32:31 +00:00
Kuninori Morimoto 12b052327d
ASoC: soc-core: rename snd_soc_rtdcom_add() to snd_soc_rtd_add_component()
We don't have snd_soc_rtdcom_list anymore.
Let's rename snd_soc_rtdcom_add() to more understandable
snd_soc_rtd_add_component()

Reported-by: Sridharan, Ranjani <ranjani.sridharan@intel.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/878smgt4vp.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-10 13:32:13 +00:00
Shuming Fan 7d2a5f9ae4
ASoC: rt700: add rt700 codec driver
This is the initial codec driver for rt700.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200110014552.17252-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-10 13:31:49 +00:00
Kuninori Morimoto 613fb50059
ASoC: soc-core: remove snd_soc_rtdcom_list
Current ALSA SoC is using struct snd_soc_rtdcom_list to
connecting component to rtd by using list_head.

	struct snd_soc_rtdcom_list {
		struct snd_soc_component *component;
		struct list_head list; /* rtd::component_list */
	};

	struct snd_soc_pcm_runtime {
		...
		struct list_head component_list; /* list of connected components */
		...
	};

The CPU/Codec/Platform component which will be connected to rtd (a)
is indicated via dai_link at snd_soc_add_pcm_runtime()

	int snd_soc_add_pcm_runtime(...)
	{
		...
		/* Find CPU from registered CPUs */
		rtd->cpu_dai = snd_soc_find_dai(dai_link->cpus);
		...
(a)		snd_soc_rtdcom_add(rtd, rtd->cpu_dai->component);
		...

		/* Find CODEC from registered CODECs */
(b)		for_each_link_codecs(dai_link, i, codec) {
			rtd->codec_dais[i] = snd_soc_find_dai(codec);
			...
(a)			snd_soc_rtdcom_add(rtd, rtd->codec_dais[i]->component);
		}
		...

		/* Find PLATFORM from registered PLATFORMs */
(b)		for_each_link_platforms(dai_link, i, platform) {
			for_each_component(component) {
				...
(a)				snd_soc_rtdcom_add(rtd, component);
			}
		}

	}

It shows, it is possible to know how many components will be
connected to rtd by using

	dai_link->num_cpus
	dai_link->num_codecs
	dai_link->num_platforms

If so, we can use component pointer array instead of list_head,
in such case, code can be more simple.
This patch removes struct snd_soc_rtdcom_list that is only
of temporary value, and convert to pointer array.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87a76wt4wm.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-10 13:31:22 +00:00
Olivier Moysan 8e55ea1912
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: 1e7f6e1c69 ("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>
2020-01-10 13:30:10 +00:00
Mark Brown a84188eced
ASoC: max98090: Drop incorrectly applied duplicate commit
This reverts commit 4e93c1294f (ASoC: max98090: fix incorrect
helper in max98090_dapm_put_enum_double()) which was misapplied.

Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-10 13:24:02 +00:00
Mark Brown 23534b1971
Merge branch 'for-5.5' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-5.6 2020-01-10 11:51:21 +00:00
Shuming Fan 320b8b0d13
ASoC: rt711: add rt711 codec driver
This is the initial codec driver for rt711.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191227054445.27223-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-09 21:22:36 +00:00
Srinivas Kandagatla a0aab9e140
ASoC: codecs: add wsa881x amplifier support
This patch adds support to WSA8810/WSA8815 Class-D Smart Speaker
Amplifier. This Amplifier is primarily interfaced with SoundWire.
One WSA is used for mono speaker configuration and second one
would give stereo setup.

This patch is tested on SDM845 based DragonBoard DB845c and
Lenovo YOGA C630 Laptop based on SDM850 with WSA8815
speaker amplifiers.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200107135929.3267-3-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-09 21:19:00 +00:00
Olivier Moysan a14bf98c04
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: 03e78a242a ("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>
2020-01-09 21:17:38 +00:00
Marek Szyprowski 2dc98af62c
ASoC: max98090: fix lockdep warning
Commit 62d5ae4caf ("ASoC: max98090: save and restore SHDN when changing
sensitive registers") extended the code for handling many controls by
adding a custom put function to them. That new custom put function
properly handles relations between codec's hardware registers. However
they used card->dapm_mutex to properly serialize those operations. This
in turn triggers a lockdep warning about possible circular dependency.
Fix this by introducing a separate mutex only for serializing the SHDN
hardware register related operations.

This fixes the following lockdep warning observed on Exynos4412-based
Odroid U3 board:
======================================================
WARNING: possible circular locking dependency detected
5.5.0-rc5-next-20200107 #166 Not tainted
------------------------------------------------------
alsactl/1104 is trying to acquire lock:
ed0d50f4 (&card->dapm_mutex){+.+.}, at: max98090_shdn_save+0x1c/0x28

but task is already holding lock:
edb4b49c (&card->controls_rwsem){++++}, at: snd_ctl_ioctl+0xcc/0xbb8

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-> #1 (&card->controls_rwsem){++++}:
       snd_ctl_add_replace+0x3c/0x84
       dapm_create_or_share_kcontrol+0x24c/0x2e0
       snd_soc_dapm_new_widgets+0x308/0x594
       snd_soc_bind_card+0x80c/0xad4
       devm_snd_soc_register_card+0x34/0x6c
       odroid_audio_probe+0x288/0x34c
       platform_drv_probe+0x6c/0xa4
       really_probe+0x200/0x490
       driver_probe_device+0x78/0x1f8
       bus_for_each_drv+0x74/0xb8
       __device_attach+0xd4/0x16c
       bus_probe_device+0x88/0x90
       deferred_probe_work_func+0x3c/0xd0
       process_one_work+0x22c/0x7c4
       worker_thread+0x44/0x524
       kthread+0x130/0x164
       ret_from_fork+0x14/0x20
       0x0

-> #0 (&card->dapm_mutex){+.+.}:
       lock_acquire+0xe8/0x270
       __mutex_lock+0x9c/0xb18
       mutex_lock_nested+0x1c/0x24
       max98090_shdn_save+0x1c/0x28
       max98090_put_enum_double+0x20/0x40
       snd_ctl_ioctl+0x190/0xbb8
       ksys_ioctl+0x470/0xaf8
       ret_fast_syscall+0x0/0x28
       0xbefaa564

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&card->controls_rwsem);
                               lock(&card->dapm_mutex);
                               lock(&card->controls_rwsem);
  lock(&card->dapm_mutex);

 *** DEADLOCK ***

1 lock held by alsactl/1104:
 #0: edb4b49c (&card->controls_rwsem){++++}, at: snd_ctl_ioctl+0xcc/0xbb8

stack backtrace:
CPU: 0 PID: 1104 Comm: alsactl Not tainted 5.5.0-rc5-next-20200107 #166
Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
(unwind_backtrace) from [<c010e180>] (show_stack+0x10/0x14)
(show_stack) from [<c0b2a09c>] (dump_stack+0xb4/0xe0)
(dump_stack) from [<c018a1c0>] (check_noncircular+0x1ec/0x208)
(check_noncircular) from [<c018c5dc>] (__lock_acquire+0x1210/0x25ec)
(__lock_acquire) from [<c018e2d8>] (lock_acquire+0xe8/0x270)
(lock_acquire) from [<c0b49678>] (__mutex_lock+0x9c/0xb18)
(__mutex_lock) from [<c0b4a110>] (mutex_lock_nested+0x1c/0x24)
(mutex_lock_nested) from [<c0839b3c>] (max98090_shdn_save+0x1c/0x28)
(max98090_shdn_save) from [<c083a5b8>] (max98090_put_enum_double+0x20/0x40)
(max98090_put_enum_double) from [<c080d0e8>] (snd_ctl_ioctl+0x190/0xbb8)
(snd_ctl_ioctl) from [<c02cafec>] (ksys_ioctl+0x470/0xaf8)
(ksys_ioctl) from [<c0101000>] (ret_fast_syscall+0x0/0x28)
...

Fixes: 62d5ae4caf ("ASoC: max98090: save and restore SHDN when changing sensitive registers")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://lore.kernel.org/r/20200108115007.31095-2-m.szyprowski@samsung.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-09 13:25:18 +00:00
Marek Szyprowski 4e93c1294f
ASoC: max98090: fix incorrect helper in max98090_dapm_put_enum_double()
Commit 62d5ae4caf ("ASoC: max98090: save and restore SHDN when changing
sensitive registers") extended the code for handling "LTENL Mux", "LTENR
Mux", "LBENL Mux" and "LBENR Mux" controls by adding a custom
max98090_dapm_put_enum_double() function to them. However that function
used incorrect helper to get its component object. Fix this by using the
proper snd_soc_dapm_* helper.

This fixes the following NULL pointer exception observed on
Exynos4412-based Odroid U3 board:
8<--- cut here ---
Unable to handle kernel NULL pointer dereference at virtual address 000000b0
pgd = (ptrval)
[000000b0] *pgd=00000000
Internal error: Oops: 5 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 0 PID: 1104 Comm: alsactl Not tainted 5.5.0-rc5-next-20200107 #166
Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
PC is at __mutex_lock+0x54/0xb18
LR is at ___might_sleep+0x3c/0x2e0
...
Process alsactl (pid: 1104, stack limit = 0x(ptrval))
...
[<c0b49630>] (__mutex_lock) from [<c0b4a110>] (mutex_lock_nested+0x1c/0x24)
[<c0b4a110>] (mutex_lock_nested) from [<c0839b3c>] (max98090_shdn_save+0x1c/0x28)
[<c0839b3c>] (max98090_shdn_save) from [<c083a4f8>] (max98090_dapm_put_enum_double+0x20/0x40)
[<c083a4f8>] (max98090_dapm_put_enum_double) from [<c080d0e8>] (snd_ctl_ioctl+0x190/0xbb8)
[<c080d0e8>] (snd_ctl_ioctl) from [<c02cafec>] (ksys_ioctl+0x470/0xaf8)
[<c02cafec>] (ksys_ioctl) from [<c0101000>] (ret_fast_syscall+0x0/0x28)
...
---[ end trace 0e93f0580f4b9241 ]---

Fixes: 62d5ae4caf ("ASoC: max98090: save and restore SHDN when changing sensitive registers")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20200108115007.31095-1-m.szyprowski@samsung.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-09 13:25:00 +00:00
Marek Szyprowski 1d7b051891
ASoC: max98090: fix incorrect helper in max98090_dapm_put_enum_double()
Commit 62d5ae4caf ("ASoC: max98090: save and restore SHDN when changing
sensitive registers") extended the code for handling "LTENL Mux", "LTENR
Mux", "LBENL Mux" and "LBENR Mux" controls by adding a custom
max98090_dapm_put_enum_double() function to them. However that function
used incorrect helper to get its component object. Fix this by using the
proper snd_soc_dapm_* helper.

This fixes the following NULL pointer exception observed on
Exynos4412-based Odroid U3 board:
8<--- cut here ---
Unable to handle kernel NULL pointer dereference at virtual address 000000b0
pgd = (ptrval)
[000000b0] *pgd=00000000
Internal error: Oops: 5 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 0 PID: 1104 Comm: alsactl Not tainted 5.5.0-rc5-next-20200107 #166
Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
PC is at __mutex_lock+0x54/0xb18
LR is at ___might_sleep+0x3c/0x2e0
...
Process alsactl (pid: 1104, stack limit = 0x(ptrval))
...
[<c0b49630>] (__mutex_lock) from [<c0b4a110>] (mutex_lock_nested+0x1c/0x24)
[<c0b4a110>] (mutex_lock_nested) from [<c0839b3c>] (max98090_shdn_save+0x1c/0x28)
[<c0839b3c>] (max98090_shdn_save) from [<c083a4f8>] (max98090_dapm_put_enum_double+0x20/0x40)
[<c083a4f8>] (max98090_dapm_put_enum_double) from [<c080d0e8>] (snd_ctl_ioctl+0x190/0xbb8)
[<c080d0e8>] (snd_ctl_ioctl) from [<c02cafec>] (ksys_ioctl+0x470/0xaf8)
[<c02cafec>] (ksys_ioctl) from [<c0101000>] (ret_fast_syscall+0x0/0x28)
...
---[ end trace 0e93f0580f4b9241 ]---

Fixes: 62d5ae4caf ("ASoC: max98090: save and restore SHDN when changing sensitive registers")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20200108115007.31095-1-m.szyprowski@samsung.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-09 13:24:06 +00:00
Wei Yongjun f0df2e650e
ASoC: amd: acp3x: Fix return value check in acp3x_dai_probe()
In case of error, the function devm_ioremap() returns NULL pointer not
ERR_PTR(). The IS_ERR() test in the return value check should be
replaced with NULL test.

Fixes: c9fe7db6e8 ("ASoC: amd: Refactoring of DAI from DMA driver")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Link: https://lore.kernel.org/r/20200108035954.51317-1-weiyongjun1@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-09 13:23:43 +00:00
Kai Vehmanen 8e85def572 ALSA: hda: enable regmap internal locking
This reverts commit 42ec336f1f ("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>
2020-01-08 20:10:08 +01:00
Takashi Iwai 1a0986c1bc 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>
2020-01-08 16:35:00 +01:00
YueHaibing 55c203a308 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 e67c3f0fd4 ("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>
2020-01-08 15:07:24 +01:00
Kailang Yang 54a6a7dc10 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 d2cd795c4e ("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>
2020-01-08 10:46:33 +01:00
Kailang Yang 9194a1ebbc 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>
2020-01-08 09:48:36 +01:00
Dan Carpenter 3b2549a374 ALSA: control: potential uninitialized return value
Smatch complains that "ret" might be uninitialized.

Fixes: fbd3eb7f66 ("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>
2020-01-08 07:20:28 +01:00
Arnd Bergmann 599b10193c
ASoC: gtm601: fix build warning
The driver produces warnings without CONFIG_OF, and makes
no sense without it either:

sound/soc/codecs/gtm601.c:50:34: error: 'bm818_dai' defined but not used [-Werror=unused-variable]
 static struct snd_soc_dai_driver bm818_dai = {
                                  ^~~~~~~~~
sound/soc/codecs/gtm601.c:32:34: error: 'gtm601_dai' defined but not used [-Werror=unused-variable]
 static struct snd_soc_dai_driver gtm601_dai = {
                                  ^~~~~~~~~~

Remove the #ifdef check to avoid the warning.

Fixes: 057a317a8d ("ASoC: gtm601: add Broadmobi bm818 sound profile")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20200107214846.1284981-1-arnd@arndb.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-07 22:29:38 +00:00
Pierre-Louis Bossart 490a625b01
ASoC: SOF: loader: add dynamic debug trace
We currently have no trace referring to the firmware path, add a trace
to help debug cases where the wrong file might be used.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200107160840.1524-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-07 22:29:20 +00:00
Pierre-Louis Bossart 46207ca245
ASoC: SOF: pci: change the default firmware path when the community key is used
Since ApolloLake, Intel platforms require signed firmware. On all
Windows platforms the default is to require the Intel production key
be used. But some platforms allow for a community key to be used,
which allows developers to compile/build their own firmware.

In the linux-firmware tree, the default intel/sof path is used for
firmwares signed for the production key, and files signed with the
community key are located in intel/sof/community.

Since we don't have an API to query which key is used on what
platforms, we have to rely on DMI-based quirks.

Developers can bypass this mechanism by setting a kernel 'fw_path'
module parameter. Additional dynamic debug traces are provided to help
debug cases where the wrong file might be used.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200107160840.1524-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-07 22:29:01 +00:00
Takashi Iwai 8e3366cad2
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: c64bfc9066 ("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>
2020-01-07 22:27:44 +00:00
Sam McNally d4b74e218a
ASoC: Intel: sof_rt5682: Ignore the speaker amp when there isn't one.
Some members of the Google_Hatch family include a rt5682 jack codec, but
no speaker amplifier. This uses the same driver (sof_rt5682) as a
combination of rt5682 jack codec and max98357a speaker amplifier. Within
the sof_rt5682 driver, these cases are not currently distinguishable,
relying on a DMI quirk to decide the configuration. This causes an
incorrect configuration when only the rt5682 is present on a
Google_Hatch device.

For CML, the jack codec is used as the primary key when matching,
with a possible speaker amplifier described in quirk_data. The two cases
of interest are the second and third 10EC5682 entries in
snd_soc_acpi_intel_cml_machines[]. The second entry matches the
combination of rt5682 and max98357a, resulting in the quirk_data field
in the snd_soc_acpi_mach being non-null, pointing at
max98357a_spk_codecs, the snd_soc_acpi_codecs for the matched speaker
amplifier. The third entry matches just the rt5682, resulting in a null
quirk_data.

The sof_rt5682 driver's DMI data matching identifies that a speaker
amplifier is present for all Google_Hatch family devices. Detect cases
where there is no speaker amplifier by checking for a null quirk_data in
the snd_soc_acpi_mach and remove the speaker amplifier bit in that case.

Signed-off-by: Sam McNally <sammc@chromium.org>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200103124921.v3.1.Ib87c4a7fbb3fc818ea12198e291b87dc2d5bc8c2@changeid
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-06 20:45:58 +00:00
Hans de Goede 869bced7a0
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: aa2ba991c4 ("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>
2020-01-06 20:44:45 +00:00
Dmitry Osipenko 89b71b3f02
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>
2020-01-06 20:44:25 +00:00
Takashi Iwai fbca72c154 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.
 -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl4TL10THGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0OCZB/9X2QIslZRGJi4gM1jLmcvPy64FLqUE
 iRE0Gi3MVG7r2i7HIgnTu2NHD/Ozpzs89droA0KpXC/uf/JaI8HRXY+tnHP4Qo1F
 126h0T0JoDoZDr7IwHY5O+8Zgzqiaq3+JpUB9IBGrHw2DvBx1LCjBR6RRc7vFYM2
 mA7HZ260GslhcUwGD+YYBglsABUkP60/MyWb/frxqugclNkUXP9GbnDEBGbVaZCC
 hZqus4BBHEGGiTNyL6kb2D6lvxF2e0OH7FpAi55g9lWkN6uzUNph8/o9HBLkNsTI
 XEGFRJzJGdwelEbrd+kA7QCCVt3IqxsulpsVndhbn4oSgav5xJeC1VsY
 =d133
 -----END PGP SIGNATURE-----

Merge tag 'asoc-fix-v5.5-rc5' of https://git.kernel.org/pub/scm/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.
2020-01-06 17:39:15 +01:00
Christoph Hellwig 4bdc0d676a remove ioremap_nocache and devm_ioremap_nocache
ioremap has provided non-cached semantics by default since the Linux 2.6
days, so remove the additional ioremap_nocache interface.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
2020-01-06 09:45:59 +01:00
Takashi Iwai f1dd4795b1 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: 198de43d75 ("[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>
2020-01-05 16:15:14 +01:00
Takashi Iwai cabc046807 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>
2020-01-05 16:15:13 +01:00
Takashi Iwai 6ab9eabe19 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>
2020-01-05 16:15:13 +01:00
Takashi Iwai a05c0737d3 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>
2020-01-05 16:15:12 +01:00
Takashi Iwai 8045d0fc95 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>
2020-01-05 16:15:12 +01:00
Takashi Iwai 7103e4a70c 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>
2020-01-05 16:15:11 +01:00
Takashi Iwai 9bca090793 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>
2020-01-05 16:15:10 +01:00
Takashi Iwai e157f0cd05 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>
2020-01-05 16:15:10 +01:00
Takashi Iwai 83fdb6fbcc 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>
2020-01-05 16:15:09 +01:00
Takashi Iwai 24ce8056a9 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>
2020-01-05 16:15:09 +01:00
Takashi Iwai 6c8454888f 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>
2020-01-05 16:15:08 +01:00
Takashi Iwai 1d99500a1d 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>
2020-01-05 16:15:08 +01:00
Takashi Iwai 7840d8a103 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>
2020-01-05 16:15:07 +01:00
Takashi Iwai 2f200ce291 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>
2020-01-05 16:15:07 +01:00
Takashi Iwai 26170691ff 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>
2020-01-05 16:15:06 +01:00
Takashi Iwai 616986985d 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>
2020-01-05 16:15:06 +01:00
Takashi Iwai 8fc179162d 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>
2020-01-05 16:15:05 +01:00
Takashi Iwai 429bca4d76 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>
2020-01-05 16:15:05 +01:00
Takashi Iwai 80e0a7c095 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>
2020-01-05 16:15:04 +01:00
Takashi Iwai 15a1af95d6 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>
2020-01-05 16:15:03 +01:00
Takashi Iwai fce6709730 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>
2020-01-05 16:15:03 +01:00
Takashi Iwai 748f518121 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>
2020-01-05 16:15:02 +01:00
Takashi Iwai 350f613f37 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>
2020-01-05 16:15:01 +01:00
Takashi Iwai 2a076d0af4 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>
2020-01-05 16:15:00 +01:00
Takashi Iwai 58b5b36370 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>
2020-01-05 16:15:00 +01:00
Takashi Iwai f3c0916946 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>
2020-01-05 16:14:59 +01:00
Takashi Iwai e3de2a406e 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>
2020-01-05 16:14:59 +01:00
Takashi Iwai edb87ed5f9 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>
2020-01-05 16:14:58 +01:00
Takashi Iwai b40fe4bbc7 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>
2020-01-05 16:14:58 +01:00
Takashi Iwai f98903fce9 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>
2020-01-05 16:14:57 +01:00
Takashi Iwai 51d7847a2d 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>
2020-01-05 16:14:57 +01:00
Takashi Iwai 121f46be2c 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>
2020-01-05 16:14:56 +01:00
Takashi Iwai 5f3aca1065 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>
2020-01-05 16:14:55 +01:00
Takashi Iwai 096da809f6 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>
2020-01-05 16:14:55 +01:00
Takashi Iwai 96d5ebf25e 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>
2020-01-05 16:14:54 +01:00
Takashi Iwai 066c044b05 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>
2020-01-05 16:14:54 +01:00
Takashi Iwai 9ca7a0c979 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>
2020-01-05 16:14:53 +01:00
Takashi Iwai 6e0e75d94e 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>
2020-01-05 16:14:52 +01:00
Takashi Iwai 9797430972 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>
2020-01-05 16:14:52 +01:00
Takashi Iwai ba09f5d84e 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>
2020-01-05 16:14:51 +01:00
Takashi Iwai a7f7edcfa4 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>
2020-01-05 16:14:50 +01:00
Takashi Iwai ccfacf2b2e 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>
2020-01-05 16:14:50 +01:00
Takashi Iwai 71075c4210 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>
2020-01-05 16:14:49 +01:00
Takashi Iwai 10aab1a24d 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>
2020-01-05 16:14:49 +01:00
Takashi Iwai 3cfe54b96c 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>
2020-01-05 16:14:48 +01:00
Takashi Iwai 98fd539841 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>
2020-01-05 16:14:47 +01:00
Takashi Iwai 7ec03ff7c7 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>
2020-01-05 16:14:47 +01:00
Takashi Iwai 55a6921bf1 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>
2020-01-05 16:14:46 +01:00
Takashi Iwai 1e393ef4e3 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>
2020-01-05 16:14:45 +01:00
Takashi Iwai e315cc3f93 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>
2020-01-05 16:14:45 +01:00
Takashi Iwai d92596402d 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>
2020-01-05 16:14:44 +01:00
Takashi Iwai 6e9ef32fab ALSA: ppc: More constifications
Apply const prefix to each possible place: the static tables for rate,
volume, etc.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-18-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-05 16:14:43 +01:00
Takashi Iwai f16a4e960a ALSA: ice1712: More constifications
Apply const prefix to each possible place: the EEPROM tables, the
static string arrays, the init verb tables, etc.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-17-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-05 16:14:41 +01:00
Takashi Iwai bf6f3d74c9 ALSA: riptide: More constifications
Apply const prefix to each lbus path table definition and its
callers.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-16-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-05 16:14:40 +01:00
Takashi Iwai 6fddce26f8 ALSA: emu10k1: More constifications
Apply const prefix to the remaining possible places: the static tables
for init verbs and registers, the string arrays, the conversion
tables, etc.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-15-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-05 16:14:39 +01:00
Takashi Iwai eafcdbdb4f ALSA: au88x0: More constifications
Apply const prefix to each possible place: the static register tables,
the coef tables, the string arrays, etc.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-14-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-05 16:14:38 +01:00
Takashi Iwai 56d7058e12 ALSA: caiaq: More constifications
Apply const prefix to each possible place: the rate table, the
controller tables, and the key tables.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-13-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-05 16:14:37 +01:00
Takashi Iwai a01df925d1 ALSA: usb-audio: More constifications
Apply const prefix to the remaining places: the static table for the
unit information, the mixer maps, the validator tables, etc.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-12-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-05 16:14:34 +01:00
Takashi Iwai 1675bfc0fb ALSA: ac97: More constifications
Apply const prefix to each possible place: the static tables for
registers and bits, the quirk tables, etc.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-11-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-05 16:14:34 +01:00
Takashi Iwai bf82326fce ALSA: hda: More constifications
Apply const prefix to the remaining possible places: the string
tables, the rate tables, the verb tables, the index tables, etc.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-10-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-05 16:14:32 +01:00
Takashi Iwai f729f88a04 ALSA: intel8x0: More constifications
Apply const prefix to more places: the static tables for PCM
definitions, the register tables, etc.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-9-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-05 16:14:31 +01:00
Takashi Iwai c09482455c ALSA: vx: More constifications
Apply const prefix to every possible place: the static tables for DSP
commands, the string tables, and register/offset tables.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-8-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-05 16:14:30 +01:00
Takashi Iwai 731922a593 ALSA: seq: More constifications
Apply const prefix to the remaining sequencer code: the static tables
for MIDI macros, RPN/NRPN, and some strings.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-7-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-05 16:14:29 +01:00
Takashi Iwai d03af9b8ea ALSA: pcm: More constifications
Apply const prefix to more possible places: the string tables for PCM
format and co, the table for the PCM type helpers, etc.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-6-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-05 16:14:29 +01:00
Takashi Iwai d64e7f7c9e ALSA: dummy: More constifications
Apply const prefix to every possible place: mostly for declaring the
dummy hardware models.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-5-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-05 16:14:28 +01:00
Takashi Iwai 6b0f95c49d ALSA: hda/realtek - More constifications
Apply const prefix to each coef table array.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-05 16:14:27 +01:00
Takashi Iwai fa35aa4607 ALSA: aoa: More constifications
Apply const prefix at every place where appropriate: the static
register tables, the volume tables and the callback tables.

Just for minor optimization and no functional changes.

Link: https://lore.kernel.org/r/20200105144823.29547-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-05 16:14:27 +01:00
Takashi Iwai 8be03a7177 ALSA: usb-audio: Use lower hex numbers for IDs
For consistency reason, make all hex numbers with lower alphabets for
USB ID entries.  It improves grep-ability and reduces careless
mistakes.

Link: https://lore.kernel.org/r/20200105081900.21870-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-05 09:20:44 +01:00
Takashi Iwai 5d8398aa59 Merge branch 'for-linus' into for-next
Merge 5.5-rc devel branch back for applying the conflicting USB-audio
fix.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-05 09:19:34 +01:00
Takashi Iwai 5fab582967 ALSA: hda/realtek - Apply mic mute LED quirk for Dell E7xx laptops, too
Dell E7xx laptops have also mic mute LED that is driven by the
dell-laptop platform driver.  Bind it with the capture control as
already done for other models.

A caveat is that the fixup hook for the mic mute LED has to be applied
at last, otherwise it results in the invalid override of the callback.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=205529
Link: https://lore.kernel.org/r/20200105081119.21396-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-05 09:12:11 +01:00
Takashi Iwai 51d4efab78 ALSA: usb-audio: Apply the sample rate quirk for Bose Companion 5
Bose Companion 5 (with USB ID 05a7:1020) doesn't seem supporting
reading back the sample rate, so the existing quirk is needed.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206063
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200104110936.14288-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-04 12:16:04 +01:00
Takashi Iwai 5da116f164 ALSA: sh: Fix unused variable warnings
Remove unused variables that are left over after the conversion of new
PCM ops:
  sound/sh/sh_dac_audio.c:166:26: warning: unused variable 'runtime'
  sound/sh/sh_dac_audio.c:186:26: warning: unused variable 'runtime'
  sound/sh/sh_dac_audio.c:205:26: warning: unused variable 'runtime'

Fixes: 1cc2f8ba0b ("ALSA: sh: Convert to the new PCM ops")
Link: https://lore.kernel.org/r/20200104110057.13875-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-04 12:02:32 +01:00
Takashi Iwai fbd3eb7f66 ALSA: control: Add verification for kctl accesses
The current implementation of ALSA control API fully relies on the
callbacks of each driver, and there is no verification of the values
passed via API.  This patch is an attempt to improve the situation
slightly by adding the validation code for the values stored via info
and get callbacks.

The patch adds a new kconfig, CONFIG_SND_CTL_VALIDATION.  It depends
on CONFIG_SND_DEBUG and off as default since the validation would
require a slight overhead including the additional call of info
callback at each get callback invocation.

When this config is enabled, the values stored by each info callback
invocation are verified, namely:
- Whether the info type is valid
- Whether the number of enum items is non-zero
- Whether the given info count is within the allowed boundary

Similarly, the values stored at each get callback are verified as
well:
- Whether the values are within the given range
- Whether the values are aligned with the given step
- Whether any further changes are seen in the data array over the
  given info count

The last point helps identifying a possibly invalid data type access,
typically a case where the info callback declares the type being
SNDRV_CTL_ELEM_TYPE_ENUMERATED while the get/put callbacks store
the values in value.integer.value[] array.

When a validation fails, the ALSA core logs an error message including
the device and the control ID, and the API call also returns an
error.  So, with the new validation turned on, the driver behavior
difference may be visible on user-space, too -- it's intentional,
though, so that we can catch an error more clearly.

The patch also introduces a new ctl access type,
SNDRV_CTL_ELEM_ACCESS_SKIP_CHECK.  A driver may pass this flag with
other access bits to indicate that the ctl element won't be verified.
It's useful when a driver code is specially written to access the data
greater than info->count size by some reason.  For example, this flag
is actually set now in HD-audio HDMI codec driver which needs to clear
the data array in the case of the disconnected monitor.

Also, the PCM channel-map helper code is slightly modified to avoid
the false-positive hit by this validation code, too.

Link: https://lore.kernel.org/r/20200104083556.27789-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-04 09:37:59 +01:00
Kailang Yang 6d9ffcff64 ALSA: hda/realtek - Add new codec supported for ALCS1200A
Add ALCS1200A supported.
It was similar as ALC900.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/a9bd3cdaa02d4fa197623448d5c51e50@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-04 09:22:34 +01:00
Linus Torvalds e35d016590 sound fixes for 5.5-rc5
Nothing to worry at this stage but all nice small changes:
 - A regression fix for AMD GPU detection in HD-audio
 - A long-standing sleep-in-atomic fix for an ice1724 device
 - Usual suspects, the device-specific quirks for HD- and USB-audio
 -----BEGIN PGP SIGNATURE-----
 
 iQJCBAABCAAsFiEEIXTw5fNLNI7mMiVaLtJE4w1nLE8FAl4O9hYOHHRpd2FpQHN1
 c2UuZGUACgkQLtJE4w1nLE+x9RAAl59MhUqA+FmjNsQ+1tKHt6cfAlyvR5xnJ6vn
 95XefS1BFWhOjH6Xu4egF1QJIfah6XHAgrIHm/mjml9g2dGTGQuzSnUDB7klxnKi
 uPVfrZOTvqvNV+CaLPNr7LEFNYzuljMCRtoeWiPcn3Z3+C3qWjqpRkJw8YR7Mgzx
 J6IbUNuFKtWiQ6DoH19oSQUIZhwWDAFyl7JAE6JUQ2L5haMqE6T1w5Gw7g8BQZLC
 L7+ozmTT8g+v4yD/E2NAxZ5vzjHxA6Er9H4I5m7cAEVjXBEBwT4zVXElCk/x6Gh1
 sR7a8AfNVjPkesFpITQFc8Q/7kvMC/OpNv0nZLhEEdfv+6DkY7RQ0K+mH7oQsIQw
 3p9XJxsPtlFmcpeoCaSgUGTMHEUiE+up6RiXyITQGK00CBF9HzNRne5/UURkw/5f
 G/oOqxQITEVQJE8zTx+WQy95UnPXfwe7SFMMlpGU8Vsf4qlVKIGcQoDMA6GlKLOg
 2t/jeBLGKltcchyg+IgELymcQGvyq1OwjhCbs9UUds2PpfTJIjOsqJNvGWrQRs0q
 5ROBr/RkHD+BzA0cK0JIMABe1vuiQO1o5RoCe1KZ7r5SwgsuAYGPo934ejJuCDW2
 wJ7ezfiZu9+tFIRXyqc116QrX/vDessKKKIGp0UNm9SsboNzmZ/8I6IdSMP3JFEz
 iTHe8kI=
 =mm0Z
 -----END PGP SIGNATURE-----

Merge tag 'sound-5.5-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "Nothing to worry at this stage but all nice small changes:

   - A regression fix for AMD GPU detection in HD-audio

   - A long-standing sleep-in-atomic fix for an ice1724 device

   - Usual suspects, the device-specific quirks for HD- and USB-audio"

* tag 'sound-5.5-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: hda/realtek - Enable the bass speaker of ASUS UX431FLC
  ALSA: ice1724: Fix sleep-in-atomic in Infrasonic Quartet support code
  ALSA: hda/realtek - Add Bass Speaker and fixed dac for bass speaker
  ALSA: hda - Apply sync-write workaround to old Intel platforms, too
  ALSA: hda/hdmi - fix atpx_present when CLASS is not VGA
  ALSA: usb-audio: fix set_format altsetting sanity check
  ALSA: hda/realtek - Add headset Mic no shutup for ALC283
  ALSA: usb-audio: set the interface format after resume on Dell WD19
2020-01-03 11:10:31 -08:00
Michał Mirosław caf3c0437a ALSA: hda - constify and cleanup static NodeID tables
Make hda_nid_t tables static const, as they are not intended to be
modified by callees.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Link: https://lore.kernel.org/r/5150c94101c9534f4c8e987324f6912c16d459f6.1578043216.git.mirq-linux@rere.qmqm.pl
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 10:38:38 +01:00
Takashi Iwai 88e540a876 ALSA: pci: Constify snd_pci_quirk tables
The snd_pci_quirk tables are referred as read-only, hence they can be
declared as const gracefully.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-59-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:45 +01:00
Takashi Iwai a5dc05e466 ALSA: hda: Constify snd_pci_quirk tables
The snd_pci_quirk tables are referred as read-only, hence they can be
declared as const gracefully.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-58-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:44 +01:00
Takashi Iwai fb537cd008 ALSA: fm801: Constify snd_fm801_tea575x_gpios
The snd_fm801_tea575x_gpios table is referred as read-only, hence it
can be declared as const gracefully.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-57-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:44 +01:00
Takashi Iwai cd6e03122b ALSA: es1968: Constify snd_es1968_tea575x_gpios
The snd_es1968_tea575x_gpios table is referred as read-only, hence it
can be declared as const gracefully.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-56-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:43 +01:00
Takashi Iwai c274d967ce ALSA: emu10k1: Constify snd_emu_chip_details
The snd_emu_chip_details definitions are referred as read-only, hence
they can be declared as const gracefully.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-55-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:43 +01:00
Takashi Iwai baa9df207a ALSA: bt87x: Constify snd_bt87x_boards
The snd_bt87x_boards array is referred as read-only, hence it can be
declared as const gracefully.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-54-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:42 +01:00
Takashi Iwai 87065d3d94 ALSA: seq: oss: Constify snd_seq_oss_callback definitions
The snd_seq_oss_callback items are just copied to another struct
as-is, hence they can be declared as const.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-53-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:41 +01:00
Takashi Iwai 49624472a9 ALSA: usx2y: Constify struct snd_usb_audio_quirk entries
The quirk entries used in us122l and usx2y drivers can be declared as
const as they are read-only.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-52-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:41 +01:00
Takashi Iwai 37cc306b72 ALSA: line6: Constify snd_ratden definitions
The snd_ratden definitions used in line6 drivers are all read-only, so
they can be marked as const.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-51-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:40 +01:00
Takashi Iwai 4f8ce9821e ALSA: ice1712: Constify wm-specific tables
The tables defined in wm8766.c and wm8776.c are referred as read-only,
hence they can be declared as const gracefully.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-50-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:39 +01:00
Takashi Iwai aeb0215c76 ALSA: ice17xx: Constify snd_ice1712_card_info
The snd_ice1712_card_info objects are referred only as read-only.
Let's make them const for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-49-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:39 +01:00
Takashi Iwai dc6ffaf828 ALSA: ca0106: Constify snd_ca0106_details
The snd_ca0106_details table entries are referred only as read-only.
Let's make them const.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-48-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:38 +01:00
Takashi Iwai 311840d96f ALSA: ca0106: Constify snd_ca0106_category_str items
snd_ca0106_con_category array is read-only and can be marked as const.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-47-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:37 +01:00
Takashi Iwai c0476b980d ALSA: ac97: Constify snd_ac97_res_table definition
One snd_ac97_res_table definition remains forgotten without const.
Let's add it for a bit of optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-46-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:37 +01:00
Takashi Iwai fe27463ad8 ALSA: opl3: Constify snd_opl3_drum_voice definitions
The snd_opl3_drum_voice items are all read-only, hence they can be
declared as const.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-45-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:36 +01:00
Takashi Iwai 1da7f0c570 ALSA: dummy: Constify snd_pcm_ops definitions
The snd_pcm_ops items defined in snd-dummy driver can be gracefully
declared as const.  Let's mark them for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-44-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:36 +01:00
Takashi Iwai 46708e626d ALSA: parisc: Constify snd_kcontrol_new items
Most of snd_kcontrol_new definitions are read-only and passed as-is.
Let's declare them as const for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-43-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:35 +01:00
Takashi Iwai 195727e8b6 ALSA: usb: Constify snd_kcontrol_new items
Most of snd_kcontrol_new definitions are read-only and passed as-is.
Let's declare them as const for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-42-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:34 +01:00
Takashi Iwai 1aeb1c7f28 ALSA: spi: Constify snd_kcontrol_new items
Most of snd_kcontrol_new definitions are read-only and passed as-is.
Let's declare them as const for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-41-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:34 +01:00
Takashi Iwai f8a32d94f3 ALSA: sparc: Constify snd_kcontrol_new items
Most of snd_kcontrol_new definitions are read-only and passed as-is.
Let's declare them as const for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-40-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:33 +01:00
Takashi Iwai c031b0cc77 ALSA: ppc: Constify snd_kcontrol_new items
Most of snd_kcontrol_new definitions are read-only and passed as-is.
Let's declare them as const for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-39-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:32 +01:00
Takashi Iwai b4e5e70775 ALSA: pci: Constify snd_kcontrol_new items
Most of snd_kcontrol_new definitions are read-only and passed as-is.
Let's declare them as const for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-38-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:28 +01:00
Takashi Iwai 35ace5e841 ALSA: hda: Constify snd_kcontrol_new items
Most of snd_kcontrol_new definitions are read-only and passed as-is.
Let's declare them as const for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-37-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:27 +01:00
Takashi Iwai fdd1f6fd32 ALSA: isa: Constify snd_kcontrol_new items
Most of snd_kcontrol_new definitions are read-only and passed as-is.
Let's declare them as const for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-36-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:25 +01:00
Takashi Iwai 0da2c47a95 ALSA: i2c: Constify snd_kcontrol_new items
Most of snd_kcontrol_new definitions are read-only and passed as-is.
Let's declare them as const for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-35-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:24 +01:00
Takashi Iwai 2eccd40803 ALSA: drivers: Constify snd_kcontrol_new items
Most of snd_kcontrol_new definitions are read-only and passed as-is.
Let's declare them as const for further optimization.
Constify snd_kcontrol_new items

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-34-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:23 +01:00
Takashi Iwai dde5199c98 ALSA: aoa: Constify snd_kcontrol_new items
Most of snd_kcontrol_new definitions are read-only and passed as-is.
Let's declare them as const for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-33-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:22 +01:00
Takashi Iwai 454f5ec1d2 ALSA: mixer: oss: Constify snd_mixer_oss_assign_table definition
The snd_mixer_oss_assign_table is read-only, and can it be declared as
const.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-32-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:22 +01:00
Takashi Iwai f8ae2d2919 ALSA: vx: Constify snd_vx_hardware and snd_vx_ops definitions
Both snd_vx_hardware and snd_vx_ops are only referred without
modification, hence they can be constified gracefully for further
optimizations.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-31-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:20 +01:00
Takashi Iwai aad7ebb544 ALSA: seq: Constify struct snd_midi_op
Change the argument of snd_midi_process_event() to receive a const
snd_midi_op pointer and its callers respectively.  This allows further
optimizations.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-30-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:19 +01:00
Takashi Iwai d25ff26840 ALSA: info: Make snd_info_entry_ops as const
The reference to snd_info_entry_ops is rather read-only, so declare it
as a const pointer.  This allows a bit more optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-29-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:18 +01:00
Takashi Iwai 51055da51d ALSA: pci: Constify snd_ac97_bus_ops definitions
Now snd_ac97_bus() takes the const ops pointer, so we can define the
snd_ac97_bus_ops locally as const as well for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-28-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:13 +01:00
Takashi Iwai 6e6598db07 ALSA: drivers: Constify snd_ac97_bus_ops definitions
Now snd_ac97_bus() takes the const ops pointer, so we can define the
snd_ac97_bus_ops locally as const as well for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-27-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:12 +01:00
Takashi Iwai 3a3fac8b3b ALSA: atmel: Constify snd_ac97_bus_ops definitions
Now snd_ac97_bus() takes the const ops pointer, so we can define the
snd_ac97_bus_ops locally as const as well for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-26-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:12 +01:00
Takashi Iwai 74d2bae343 ALSA: arm: Constify snd_ac97_bus_ops definitions
Now snd_ac97_bus() takes the const ops pointer, so we can define the
snd_ac97_bus_ops locally as const as well for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-25-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:11 +01:00
Takashi Iwai 33c83aaf29 ALSA: ac97: Constify snd_ac97_bus_ops definitions
Now snd_ac97_bus() takes the const ops pointer, so we can define the
snd_ac97_bus_ops locally as const as well for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-24-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:11 +01:00
Takashi Iwai 19260818a9 ALSA: ac97: Treat snd_ac97_bus_ops as const
This is a preliminary patch to allow const for snd_ac97_bus_ops
definitions in each driver's code.  The ops reference is read-only,
hence it can be declared as const for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-23-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:08 +01:00
Takashi Iwai 5ff16a3d48 ALSA: Constify snd_timer_hardware definitions
Most of snd_timer_hardware definitions do simply copying to another
struct as-is.  Mark them as const for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-22-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:07 +01:00
Takashi Iwai df76996a2c ALSA: timer: Constify snd_timer_hardware definitions
Most of snd_timer_hardware definitions do simply copying to another
struct as-is.  Mark them as const for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-21-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:07 +01:00
Takashi Iwai c3b53df3d0 ALSA: spi: Constify snd_device_ops definitions
Now we may declare const for snd_device_ops definitions, so let's do
it for optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-19-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:06 +01:00
Takashi Iwai 52b136d248 ALSA: sh: Constify snd_device_ops definitions
Now we may declare const for snd_device_ops definitions, so let's do
it for optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-18-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:05 +01:00
Takashi Iwai b75851d43d ALSA: sparc: Constify snd_device_ops definitions
Now we may declare const for snd_device_ops definitions, so let's do
it for optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-17-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:05 +01:00
Takashi Iwai 46dd47c106 ALSA: ppc: Constify snd_device_ops definitions
Now we may declare const for snd_device_ops definitions, so let's do
it for optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-16-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:04 +01:00
Takashi Iwai 0326564d72 ALSA: pcmcia: Constify snd_device_ops definitions
Now we may declare const for snd_device_ops definitions, so let's do
it for optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-15-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:04 +01:00
Takashi Iwai 6534158959 ALSA: parisc: Constify snd_device_ops definitions
Now we may declare const for snd_device_ops definitions, so let's do
it for optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-14-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:03 +01:00
Takashi Iwai 35a76585c6 ALSA: mips: Constify snd_device_ops definitions
Now we may declare const for snd_device_ops definitions, so let's do
it for optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-13-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:02 +01:00
Takashi Iwai e6f2a617ac ALSA: aoa: Constify snd_device_ops definitions
Now we may declare const for snd_device_ops definitions, so let's do
it for optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-12-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:01 +01:00
Takashi Iwai c0a142e21b ALSA: usb: Constify snd_device_ops definitions
Now we may declare const for snd_device_ops definitions, so let's do
it for optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-11-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:24:01 +01:00
Takashi Iwai efb0ad25d3 ALSA: pci: Constify snd_device_ops definitions
Now we may declare const for snd_device_ops definitions, so let's do
it for optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-10-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:23:56 +01:00
Takashi Iwai 41f394a8d8 ALSA: hda: Constify snd_device_ops definitions
Now we may declare const for snd_device_ops definitions, so let's do
it for optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-9-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:23:55 +01:00
Takashi Iwai 99f664df4f ALSA: isa: Constify snd_device_ops definitions
Now we may declare const for snd_device_ops definitions, so let's do
it for optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-8-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:23:54 +01:00
Takashi Iwai d23015c121 ALSA: i2c: Constify snd_device_ops definitions
Now we may declare const for snd_device_ops definitions, so let's do
it for optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-7-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:23:53 +01:00
Takashi Iwai 34273b234c ALSA: drivers: Constify snd_device_ops definitions
Now we may declare const for snd_device_ops definitions, so let's do
it for optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-6-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:23:52 +01:00
Takashi Iwai f15ee210cd ALSA: core: Constify snd_device_ops definitions
Now we may declare const for snd_device_ops definitions, so let's do
it for optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-5-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:23:51 +01:00
Takashi Iwai 8b57582430 ALSA: core: Treat snd_device_ops as const
This is a preliminary patch to allow const for snd_device_ops
definitions in each driver's code.  The ops reference is read-only,
hence it can be declared as const for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:23:50 +01:00
Takashi Iwai 2ead9d087f ALSA: usb: Constify snd_pcm_hardware definitions
Most of snd_pcm_hardware definitions are just copied to another object
as-is, hence we can define them as const for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:23:49 +01:00
Takashi Iwai c1c3981fa1 ALSA: pci: Constify snd_pcm_hardware definitions
Most of snd_pcm_hardware definitions are just copied to another object
as-is, hence we can define them as const for further optimization.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-03 09:23:47 +01:00
Pierre-Louis Bossart 72bbeda022
ASoC: soc-topology: fix endianness issues
Sparse complains about a series of easy warnings, fix.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200102195952.9465-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-03 00:57:57 +00:00
Pierre-Louis Bossart 22a0d31a59
ASoC: Intel: boards: hda_dsp_common: use NULL pointer assignment, not 0
Fix Sparse warning:
hda_dsp_common.c:66:37: warning: Using plain integer as NULL pointer

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200102195952.9465-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-03 00:57:42 +00:00
Arnd Bergmann ff3b574170
ASoC: Intel: boards: Fix compile-testing RT1011/RT5682
On non-x86, the new driver results in a build failure:

sound/soc/intel/boards/cml_rt1011_rt5682.c:14:10: fatal error: asm/cpu_device_id.h: No such file or directory

The asm/cpu_device_id.h header is not actually needed here,
so don't include it.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200102135322.1841053-1-arnd@arndb.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-03 00:56:47 +00:00
Julia Lawall 49f261e273
ASoC: SOF: imx8: use resource_size
Use resource_size rather than a verbose computation on
the end and start fields.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

<smpl>
@@ struct resource ptr; @@
- (ptr.end - ptr.start + 1)
+ resource_size(&ptr)
</smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Link: https://lore.kernel.org/r/1577900990-8588-7-git-send-email-Julia.Lawall@inria.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-01 21:39:33 +00:00
Julia Lawall 0da390ba86
ASoC: qdsp6: q6asm-dai: constify copied structure
The q6asm_dai_hardware_capture structure is only copied into another
structure, so make it const.

The opportunity for this change was found using Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Link: https://lore.kernel.org/r/1577864614-5543-11-git-send-email-Julia.Lawall@inria.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-01 21:38:48 +00:00
Julia Lawall c56fc8c9ad ALSA: hda: constify copied structure
The azx_pcm_hw structure is only copied into another structure,
so make it const.

The opportunity for this change was found using Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Link: https://lore.kernel.org/r/1577864614-5543-3-git-send-email-Julia.Lawall@inria.fr
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-01 12:39:27 +01:00
Julia Lawall cb5b83580c ALSA: ad1816a: constify copied structure
The snd_ad1816a_timer_table structure is only copied into
another structure, so make it const.

The opportunity for this change was found using Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Link: https://lore.kernel.org/r/1577864614-5543-2-git-send-email-Julia.Lawall@inria.fr
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2020-01-01 12:36:19 +01:00
Ravulapati Vishnu vardhan rao 3d8cbeda38
ASoC: amd MMAP_INTERLEAVED Support
ACP-I2S device support MMAP_INTERLEAVED.
Added support for the same.

Signed-off-by: Ravulapati Vishnu vardhan rao <Vishnuvardhanrao.Ravulapati@amd.com>
Link: https://lore.kernel.org/r/1577540460-21438-7-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-31 00:23:32 +00:00
Ravulapati Vishnu vardhan rao 535fd141ef
ASoC: amd: Added ACP3x system resume and runtime pm
When system wide suspend happens, ACP will be powered off
and when system resumes,for audio usecase to continue,all
the runtime configuration data needs to be programmed again.
Added resume pm call back to ACP pm ops and also added runtime
PM operations for ACP3x PCM platform device.
Device will enter into D3 state when there is no activity
on audio I2S lines.

Signed-off-by: Ravulapati Vishnu vardhan rao <Vishnuvardhanrao.Ravulapati@amd.com>
Link: https://lore.kernel.org/r/1577540460-21438-6-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-31 00:23:15 +00:00
Ravulapati Vishnu vardhan rao cea5f40d4e
ASoC: amd: Handle ACP3x I2S-SP Interrupts.
Enabled support for I2S-SP interrupt handling.
Previous to this implementation, driver supports only interrupts
on BT instance.

Signed-off-by: Ravulapati Vishnu vardhan rao <Vishnuvardhanrao.Ravulapati@amd.com>
Link: https://lore.kernel.org/r/1577540460-21438-5-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-31 00:22:59 +00:00
Ravulapati Vishnu vardhan rao a43ea44ddd
ASoC: amd: add ACP3x TDM mode support
ACP3x I2S (CPU DAI) can act in normal I2S and TDM modes. Added support
for TDM mode. Desired mode can be selected from ASoC machine driver.

Signed-off-by: Ravulapati Vishnu vardhan rao <Vishnuvardhanrao.Ravulapati@amd.com>
Link: https://lore.kernel.org/r/1577540460-21438-4-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-31 00:22:43 +00:00
Ravulapati Vishnu vardhan rao 703a6e2288
ASoC: amd: Enabling I2S instance in DMA and DAI
This patch adds I2S SP support in ACP PCM DMA and DAI.
Added I2S support in DMA and DAI probe,its hw_params handling
its open and close functionalities.
This enables to open and close on the SP instance for
playback and capture.

Signed-off-by: Ravulapati Vishnu vardhan rao <Vishnuvardhanrao.Ravulapati@amd.com>
Link: https://lore.kernel.org/r/1577540460-21438-3-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-31 00:22:28 +00:00
Ravulapati Vishnu vardhan rao c9fe7db6e8
ASoC: amd: Refactoring of DAI from DMA driver
ASoC: PCM DMA driver should only have dma ops.
So Removed all DAI related functionality.Refactoring
the PCM DMA diver code.Added new file containing only DAI ops

Signed-off-by: Ravulapati Vishnu vardhan rao <Vishnuvardhanrao.Ravulapati@amd.com>
Link: https://lore.kernel.org/r/1577540460-21438-2-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-31 00:22:12 +00:00
Charles Keepax 3863857dd5
ASoC: madera: Enable clocks for input pins when used for the FLL
When one of the MCLK pins is used to supply the FLL enable that clock
source.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20191230143517.21005-2-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-31 00:21:54 +00:00
Charles Keepax 1094af1199
ASoC: madera: Enable clocks for input pins when used as a direct clock
When one of the MCLK pins is used to supply an internal clock directly
enable the source clock for that pin.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20191230143517.21005-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-31 00:21:36 +00:00
Christophe JAILLET 9ea7a991cc
ASoC: cs47l92: Simplify error handling code in 'cs47l92_probe()'
If 'madera_init_bus_error_irq()' fails,
'wm_adsp2_remove(&cs47l92->core.adsp[0])' will be called twice.
Once in the 'if' block, and once in the error handling path.
This is harmless, but one of this call can be axed.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20191226162907.9490-1-christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-31 00:21:20 +00:00
Chris Chiu 48e01504cf ALSA: hda/realtek - Enable the bass speaker of ASUS UX431FLC
ASUS reported that there's an bass speaker in addition to internal
speaker and it uses DAC 0x02. It was not enabled in the commit
436e25505f ("ALSA: hda/realtek - Enable internal speaker of ASUS
UX431FLC") which only enables the amplifier and the front speaker.
This commit enables the bass speaker on top of the aforementioned
work to improve the acoustic experience.

Fixes: 436e25505f ("ALSA: hda/realtek - Enable internal speaker of ASUS UX431FLC")
Signed-off-by: Chris Chiu <chiu@endlessm.com>
Signed-off-by: Jian-Hong Pan <jian-hong@endlessm.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191230031118.95076-1-chiu@endlessm.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-12-30 08:02:47 +01:00
Takashi Iwai 0aec96f589 ALSA: ice1724: Fix sleep-in-atomic in Infrasonic Quartet support code
Jia-Ju Bai reported a possible sleep-in-atomic scenario in the ice1724
driver with Infrasonic Quartet support code: namely, ice->set_rate
callback gets called inside ice->reg_lock spinlock, while the callback
in quartet.c holds ice->gpio_mutex.

This patch fixes the invalid call: it simply moves the calls of
ice->set_rate and ice->set_mclk callbacks outside the spinlock.

Reported-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/5d43135e-73b9-a46a-2155-9e91d0dcdf83@gmail.com
Link: https://lore.kernel.org/r/20191218192606.12866-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-12-29 09:18:19 +01:00
Chris Boyle 7d8d3c377c ALSA: usb-audio: fix Corsair Virtuoso mixer label collision
The Corsair Virtuoso RGB Wireless is a USB headset with a mic and a
sidetone feature. Label its mixer appropriately instead of all
"Headset", so that applications such as Pulseaudio don't just move
the sidetone control when they intend the main Headset control.

Signed-off-by: Chris Boyle <chris@boyle.name>
Link: https://lore.kernel.org/r/20191227094053.GA12167@nova.chris.boyle.name
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-12-28 14:17:57 +01:00
Kailang Yang e79c22695a ALSA: hda/realtek - Add Bass Speaker and fixed dac for bass speaker
Dell has new platform which has dual speaker connecting.
They want dual speaker which use same dac for output.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/229c7efa2b474a16b7d8a916cd096b68@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-12-27 09:15:44 +01:00
Ravulapati Vishnu vardhan rao 5def0136c6
ASoC: amd: Create multiple I2S platform device endpoint
Creates Platform Device endpoints for multiple
I2S instances: SP and  BT endpoints device.
Pass PCI resources like MMIO, irq to the platform devices.

Signed-off-by: Ravulapati Vishnu vardhan rao <Vishnuvardhanrao.Ravulapati@amd.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/1575553053-18344-2-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-27 01:06:31 +00:00
Srinivas Kandagatla 5caf64c633
ASoC: qcom: sdm845: add support to DB845c and Lenovo Yoga
This patch adds support to Lenovo Yoga c630 compatible strings
and related setup to the sound machine driver.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20191219103153.14875-12-srinivas.kandagatla@linaro.org
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-25 18:19:51 +00:00
Srinivas Kandagatla da3e83f8bb
ASoC: wcd934x: add audio routings
This patch adds audio routing for both playback and capture.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20191219103153.14875-8-srinivas.kandagatla@linaro.org
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-25 18:19:42 +00:00
Srinivas Kandagatla a70d924575
ASoC: wcd934x: add capture dapm widgets
This patch adds required dapm widgets for capture path.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20191219103153.14875-7-srinivas.kandagatla@linaro.org
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-25 18:19:39 +00:00
Srinivas Kandagatla dd9eb19b56
ASoC: wcd934x: add playback dapm widgets
This patch adds required dapm widgets for playback.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20191219103153.14875-6-srinivas.kandagatla@linaro.org
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-25 18:19:35 +00:00
Srinivas Kandagatla 1cde8b8223
ASoC: wcd934x: add basic controls
This patch adds basic controls found in wcd934x codec.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20191219103153.14875-5-srinivas.kandagatla@linaro.org
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-25 18:19:31 +00:00
Srinivas Kandagatla a61f3b4f47
ASoC: wcd934x: add support to wcd9340/wcd9341 codec
Qualcomm WCD9340/WCD9341 Codec is a standalone Hi-Fi audio codec IC,
It supports both I2S/I2C and SLIMbus audio interfaces.
On slimbus interface it supports two data lanes; 16 Tx ports
and 8 Rx ports. It has Five DACs and seven dedicated interpolators,
Seven (six audio ADCs, and one VBAT ADC), Multibutton headset
control (MBHC), Active noise cancellation, Sidetone paths,
MAD (mic activity detection) and codec processing engine.
It supports Class-H differential earpiece out and stereo single
ended headphones out.
This codec also has integrated SoundWire controller.

This patchset adds very basic support for playback and capture
via the interpolators and ADC respectively.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20191219103153.14875-4-srinivas.kandagatla@linaro.org
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-25 18:19:27 +00:00
Mark Brown a82cf72f94
Merge branch 'for-5.5' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-5.6 2019-12-25 17:51:43 +00:00
Angus Ainslie (Purism) 057a317a8d
ASoC: gtm601: add Broadmobi bm818 sound profile
The Broadmobi bm818 uses stereo sound at 48Khz sample rate

Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca>
Link: https://lore.kernel.org/r/20191223154712.18581-2-angus@akkea.ca
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-25 00:03:08 +00:00
YueHaibing c5614fb8e3
ASoC: Intel: kbl_da7219_max98357a: remove unused variable 'constraints_16000' and 'ch_mono'
sound/soc/intel/boards/kbl_da7219_max98357a.c:343:48:
 warning: constraints_16000 defined but not used [-Wunused-const-variable=]
sound/soc/intel/boards/kbl_da7219_max98357a.c:348:27:
 warning: ch_mono defined but not used [-Wunused-const-variable=]

They are never used, so can be removed.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20191224140237.36732-1-yuehaibing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-25 00:02:53 +00:00
Sathyanarayana Nujella 4bb16cd827
ASoC: hdac_hda: Update hdac hda dai table to include intel-hdmi-hifi4
TGL supports more than three HDMI Dai's. So, update hdac_hda_dais table
to include 4th DAI.

Without this patch, we saw the below error in TGL DUT:
 sof_rt5682 tgl_max98357a_rt5682: ASoC: CODEC DAI intel-hdmi-hifi4 not

Signed-off-by: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>
Signed-off-by: Jairaj Arava <jairaj.arava@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191220171037.10689-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-25 00:02:37 +00:00
Sathyanarayana Nujella e68d669657
ASoC: SOF: Intel: hda: Add iDisp4 DAI
TGL supports more than three iDisp DAI's.
Add support for iDisp4 CPU DAI.

Without this patch, we saw the below error on our TGL DUT:
   sof_rt5682 tgl_max98357a_rt5682: ASoC: CPU DAI iDisp4 Pin not registered

Signed-off-by: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>
Signed-off-by: Jairaj Arava <jairaj.arava@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191220171037.10689-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-25 00:02:30 +00:00
Daniel Baluta dcf08d0f8f
ASoC: SOF: imx8: Fix dsp_box offset
dsp_box is used to keep DSP initiated messages. The value of dsp_offset
is set by the DSP with the first message, so we need a way to bootstrap
it in order to get the first message.

We do this by setting the correct default dsp_box offset which on i.MX8
is not zero.

Very interesting is why it has worked until now.

On i.MX8, DSP communicates with ARM core using a shared SDRAM memory
area. Actually, there are two shared areas:
	* SDRAM0 - starting at 0x92400000, size 0x800000
	* SDRAM1 - starting at 0x92C00000, size 0x800000

SDRAM0 keeps the data sections, starting with .rodata. By chance
fw_ready structure was placed at the beginning of .rodata.

dsp_box_base is defined as SDRAM0 + dsp_box_offset and it is placed
at the beginning of SDRAM1 (dsp_box_offset should be 0x800000). But
because it is zero initialized by default it points to SDRAM0 where
by chance the fw_ready was placed in the SOF firmware.

Anyhow, SOF commit 7466bee378dd811b ("clk: make freq arrays constant")
fw_ready is no longer at the beginning of SDRAM0 and everything shows
how lucky we were until now.

Fix this by properly setting the default dsp_box offset.

Fixes: 202acc565a ("ASoC: SOF: imx: Add i.MX8 HW support")
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191220170531.10423-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-24 23:57:29 +00:00
Dragos Tarcatu dd836ddf4e
ASoC: topology: Prevent use-after-free in snd_soc_get_pcm_runtime()
remove_link() is currently calling snd_soc_remove_dai_link() after
it has already freed the memory for the link name. But this is later
read from snd_soc_get_pcm_runtime() causing a KASAN use-after-free
warning. Reorder the cleanups to fix this issue.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Dragos Tarcatu <dragos_tarcatu@mentor.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20191204210447.11701-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-24 23:56:19 +00:00
Chuhong Yuan 77fffa7422
ASoC: fsl_audmix: add missed pm_runtime_disable
The driver forgets to call pm_runtime_disable in probe failure
and remove.
Add the missed calls to fix it.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/20191203111303.12933-1-hslester96@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-24 23:56:18 +00:00
Olivier Moysan 3b7658679d
ASoC: stm32: spdifrx: fix input pin state management
Changing input state in iec capture control is not safe,
as the pin state may be changed concurrently by ASoC
framework.
Remove pin state handling in iec capture control.

Note: This introduces a restriction on capture control,
when pin sleep state is defined in device tree. In this case
channel status can be captured only when an audio stream
capture is active.

Fixes: f68c2a682d ("ASoC: stm32: spdifrx: add power management")

Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
Link: https://lore.kernel.org/r/20191204154333.7152-4-olivier.moysan@st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-24 23:56:17 +00:00
Olivier Moysan 86e1956af4
ASoC: stm32: spdifrx: fix race condition in irq handler
When snd_pcm_stop() is called in interrupt routine,
substream context may have already been released.
Add protection on substream context.

Fixes: 03e4d5d56f ("ASoC: stm32: Add SPDIFRX support")

Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
Link: https://lore.kernel.org/r/20191204154333.7152-3-olivier.moysan@st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-24 23:56:17 +00:00
Olivier Moysan 2859b17840
ASoC: stm32: spdifrx: fix inconsistent lock state
In current spdifrx driver locks may be requested as follows:
- request lock on iec capture control, when starting synchronization.
- request lock in interrupt context, when spdifrx stop is called
from IRQ handler.

Take lock with IRQs disabled, to avoid the possible deadlock.

Lockdep report:
[   74.278059] ================================
[   74.282306] WARNING: inconsistent lock state
[   74.290120] --------------------------------
...
[   74.314373]        CPU0
[   74.314377]        ----
[   74.314381]   lock(&(&spdifrx->lock)->rlock);
[   74.314396]   <Interrupt>
[   74.314400]     lock(&(&spdifrx->lock)->rlock);

Fixes: 03e4d5d56f ("ASoC: stm32: Add SPDIFRX support")

Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
Link: https://lore.kernel.org/r/20191204154333.7152-2-olivier.moysan@st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-24 23:56:16 +00:00
Takashi Iwai 07d22a9bb6
ASoC: core: Fix access to uninitialized list heads
The error path of soc_new_pcm_runtime() invokes soc_free_pcm_runtime()
that may cause a few problems.  First off, it calls list_del() for
rtd->list that may not be initialized.  Similarly,
snd_soc_pcm_component_free() traverses over the component list that
may not be initialized, either.  Such access to the uninitialized list
head would lead to either a BUG_ON() or a memory corruption.

This patch fixes the access to uninitialized list heads by
initializing the list heads properly at the beginning before those
error paths.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191204151454.21643-1-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-24 23:56:15 +00:00
Daniel Baluta 218fe9b7ec
ASoC: soc-core: Set dpcm_playback / dpcm_capture
When converting a normal link to a DPCM link we need
to set dpcm_playback / dpcm_capture otherwise playback/capture
streams will not be created resulting in errors like this:

[   36.039111]  sai1-wm8960-hifi: ASoC: no backend playback stream

Fixes: a655de808c ("ASoC: core: Allow topology to override machine driver FE DAI link config")
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://lore.kernel.org/r/20191204151333.26625-1-daniel.baluta@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-24 23:56:14 +00:00
Colin Ian King 98910e1d61
ASoC: SOF: imx8: fix memory allocation failure check on priv->pd_dev
The memory allocation failure check for priv->pd_dev is incorrectly
pointer checking priv instead of priv->pd_dev. Fix this.

Addresses-Coverity: ("Logically dead code")
Fixes: 202acc565a ("ASoC: SOF: imx: Add i.MX8 HW support")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191204124816.1415359-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-24 23:56:13 +00:00
Takashi Sakamoto d61fe22c2a ALSA: ctl: allow TLV read operation for callback type of element in locked case
A design of ALSA control core allows applications to execute three
operations for TLV feature; read, write and command. Furthermore, it
allows driver developers to process the operations by two ways; allocated
array or callback function. In the former, read operation is just allowed,
thus developers uses the latter when device driver supports variety of
models or the target model is expected to dynamically change information
stored in TLV container.

The core also allows applications to lock any element so that the other
applications can't perform write operation to the element for element
value and TLV information. When the element is locked, write and command
operation for TLV information are prohibited as well as element value.
Any read operation should be allowed in the case.

At present, when an element has callback function for TLV information,
TLV read operation returns EPERM if the element is locked. On the
other hand, the read operation is success when an element has allocated
array for TLV information. In both cases, read operation is success for
element value expectedly.

This commit fixes the bug. This change can be backported to v4.14
kernel or later.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20191223093347.15279-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-12-24 15:29:12 +01:00
Takashi Iwai c366b3dbba ALSA: hda - Apply sync-write workaround to old Intel platforms, too
Klaus Ethgen reported occasional high CPU usages in his system that
seem caused by HD-audio driver.  The perf output revealed that it's
in the unsolicited event handling in the workqueue, and the problem
seems triggered by some communication stall between the controller and
the codec at the runtime or system resume.

Actually a similar phenomenon was seen in the past for other Intel
platforms, and we already applied the workaround to enforce sync-write
for CORB/RIRB verbs for Skylake and newer chipsets (commit
2756d9143a "ALSA: hda - Fix intermittent CORB/RIRB stall on Intel
chips").  Fortunately, the same workaround is applicable to the old
chipset, and the experiment showed the positive effect.

Based on the experiment result, this patch enables the sync-write
workaround for all Intel chipsets.  The only reason I hesitated to
apply this workaround was about the possibly slightly higher CPU usage.
But if the lack of sync causes a much severer problem even for quite
old chip, we should think this would be necessary for all Intel chips.

Reported-by: Klaus Ethgen <Klaus@ethgen.ch>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191223171833.GA17053@chua
Link: https://lore.kernel.org/r/20191223221816.32572-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-12-23 23:19:03 +01:00
Takashi Sakamoto ff16351e3f ALSA: ctl: remove dimen member from elem_info structure
The 'dimen' member of 'struct snd_ctl_elem_info' is designed to deliver
information to use an array of value as multi-dimensional values. This
feature is used just by echoaudio PCI driver, and fortunately it's not
used by the other applications than 'echomixer' in alsa-tools.

In a previous commit, usage of 'dimen' member is removed from echoaudio
PCI driver. Nowadays no driver/application use the feature.

This commit removes the member from structure.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191223023921.8151-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-12-23 15:57:35 +01:00
Takashi Sakamoto e67c3f0fd4 ALSA: pci: echoaudio: remove usage of dimen menber of elem_value structure
In a couple of years ago, 'echomixer' userspace application was revised
not to use 'dimen' member of 'struct snd_ctl_elem_info'.

This commit removes usage of 'dimen' member from echoaudio PCI driver so
that no implementation uses the member.

Reference: 275353bb68 ("ALSA: echoaudio: purge contradictions between dimension matrix members and total number of members")
Reference: 51db452df0 ("Revert "ALSA: echoaudio: purge contradictions between dimension matrix members and total number of members")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191223023921.8151-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-12-23 15:57:34 +01:00
Alex Deucher 8cc0991c09 ALSA: hda/hdmi - fix atpx_present when CLASS is not VGA
You can't use PCI_BASE_CLASS with pci_get_class().  This
happens to work by luck on devices with PCI_CLASS_DISPLAY_VGA, but
misses PCI_CLASS_DISPLAY_OTHER.  Add a check for those as well.

Fixes: 586bc4aab8 ("ALSA: hda/hdmi - fix vgaswitcheroo detection for AMD")
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://lore.kernel.org/r/20191221001702.1338587-1-alexander.deucher@amd.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-12-21 09:28:19 +01:00
Takashi Iwai d63e63d421 ALSA: hdsp: Make uapi/hdsp.h compilable again
Recently alsa-lib updated its content of sound/hdsp.h just by copying
the latest Linus kernel uapi/*.h, and this broke the build of
alsa-tools programs.  We used to modify the headers so that they can
be built without asoundlib.h and linux kernel headers, and the
verbatim copy doesn't work as is.

This patch removes again the linux/types.h inclusion and drop __user
prefix that broke the build and adjusts the corresponding code.

Link: https://lore.kernel.org/r/20191220153415.2740-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-12-20 16:45:10 +01:00
Takashi Iwai 2e46886763 ALSA: emu10k1: Make uapi/emu10k1.h compilable again
Recently we updated the content in alsa-lib uapi header files by just
copying from the latest Linus kernel uapi/*.h, and noticed that it
broke the build of some alsa-tools programs.  The reason is that we
used to have a modified version in the past, so that the program can
be built without referring to the unexported stuff like
snd_ctl_elem_id or __user prefix.

This patch attempts to restore that, i.e. dropping the stuff that
can't be referred in the user-space.  For adapting the changes in
uapi/emu10k1.h, the emu10k1 driver code is also slightly modified.
Most of changes are pointer cast.

Link: https://lore.kernel.org/r/20191220153415.2740-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-12-20 16:45:10 +01:00
Mark Brown d24a70636b
ASoC: max98090: Remove empty suspend function
The suspend function is empty so can be removed.

Signed-off-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20191219125140.47689-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-20 13:02:04 +00:00
Johan Hovold 0141254b0a ALSA: usb-audio: fix set_format altsetting sanity check
Make sure to check the return value of usb_altnum_to_altsetting() to
avoid dereferencing a NULL pointer when the requested alternate settings
is missing.

The format altsetting number may come from a quirk table and there does
not seem to be any other validation of it (the corresponding index is
checked however).

Fixes: b099b9693d ("ALSA: usb-audio: Avoid superfluous usb_set_interface() calls")
Cc: stable <stable@vger.kernel.org>     # 4.18
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20191220093134.1248-1-johan@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-12-20 11:31:46 +01:00
Kailang Yang 66c5d718e5 ALSA: hda/realtek - Add headset Mic no shutup for ALC283
Chrome machine had humming noise from external speaker plugin at
codec D3 state.

Signed-off-by: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/2692449396954c6c968f5b75e2660358@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-12-19 09:44:13 +01:00