Commit Graph

1121684 Commits

Author SHA1 Message Date
Peter Ujfalusi
cc4a3a19b9
ASoC: SOF: Intel: Add mtrace type information for IPC4
Set the mtrace type for platforms supported by IPC4.

Note: currently only SOF_IPC4_MTRACE_INTEL_CAVS_2 type is supported by
the ipc4-mtrace driver, which is used by CAVS 2.x platforms (ICL, TGL, ADL)
and ACE (MTL).

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220909114332.31393-8-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-09 18:48:50 +01:00
Peter Ujfalusi
9ee71a3160
ASoC: SOF: Intel: icl: Set IPC4-specific DSP ops
Add implementation of low level, platform dependent IPC4 message handling
and set the DSP ops for IPC4 for ICL platform.

Suggested-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220909114332.31393-7-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-09 18:48:49 +01:00
Peter Ujfalusi
f4ea22f7aa
ASoC: SOF: ipc4: Add support for mtrace log extraction
One of the debugging/logging features for an IPC4 based firmware is the use
of the debug window to deliver log messages to host via the shared SRAM.

The initial implementation of the mtrace supports only TGL/MTL style of
logging, but can be extended to support other types, like APL, SKL, CNL,
etc.

The window is split into 16 'slots' where the first slot contains the
descriptors for the remaining 15 slots.

Each DSP core logs to a separate slot and the slot allocation is not fixed,
we can not assume that the first slot is always used by core0 for example.

The firmware sends LOG_BUFFER_STATUS message when new log batch is
available from one of the cores (after it updated the write_ptr in the
given slot).
Host should update the read_ptr in the same slot when it has taken out log
data.

The patch also updates the sof_ipc4_fw_data struct with parameters needed
for the mtrace to be enabled and used safely.

Co-developed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Rander Wang <rander.wang@intel.com>
Co-developed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220909114332.31393-6-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-09 18:48:48 +01:00
Peter Ujfalusi
a5d0147ac9
ASoC: SOF: ipc4: Configure the debug box offset
The debug window for IPC4 compatible firmware is always window #2,
set the debug_box.offset accordingly.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220909114332.31393-5-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-09 18:48:47 +01:00
Peter Ujfalusi
b59f1532e0
ASoC: SOF: ipc4: Add define for the outbox window index
Instead of using the index number directly, add a define for the outbox
window index.
It is always window 1 with IPC4.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220909114332.31393-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-09 18:48:46 +01:00
Peter Ujfalusi
e9bcfea156
ASoC: SOF: ipc4: Add macro to get core ID from log buffer status message
The LOG_BUFFER_STATUS message includes the ID of the core which updated
its log buffer.
With IPC4 each core logs to a different slot in the debug window.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220909114332.31393-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-09 18:48:45 +01:00
Peter Ujfalusi
621a3f772b
ASoC: SOF: ipc4: Only print LOG BUFFER update message info if requested
Do not print messages when the SOF_DBG_PRINT_DMA_POSITION_UPDATE_LOGS flag
is not set to reduce the amount of prints when the tracing is used.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220909114332.31393-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-09 18:48:44 +01:00
Mark Brown
523820002e
ASoC: soc-dapm.c: random cleanup retry
Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

These are remains of my previous cleanup patch-set.
2022-09-08 13:31:27 +01:00
Shengjiu Wang
e9e7df8899
ASoC: ak4458: Remove component probe() and remove()
Most function in ak4458_probe() and ak4458_remove() are
duplicate with dai ops, so remove them and move dsd_path
setting to dai ops.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://lore.kernel.org/r/1662622316-23426-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-08 11:39:44 +01:00
ye xingchen
b075f21e53
ASoC: sti-sas: Remove the unneeded result variable
Return the value regmap_write() and sti_sas_init_sas_registers() directly
instead of storing it in another redundant variable.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
Link: https://lore.kernel.org/r/20220908010304.342760-1-ye.xingchen@zte.com.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-08 11:39:43 +01:00
Steve Lee
6ac246105b
ASoC: max98390: Remove unnecessary amp on/off conrtol
The Amp is already control in userspace before trigger calibrate function.
Remove unnecessary control in calibrate function and
add condition to check calibration is ready.

Signed-off-by: Steve Lee <steve.lee.analog@gmail.com>
Link: https://lore.kernel.org/r/20220908060359.13606-1-steve.lee.analog@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-08 11:39:42 +01:00
Kuninori Morimoto
59a1063dca
ASoC: soc-dapm.c: tidyup snd_soc_dai_link_event_pre_pmu()
snd_soc_dai_link_event_pre_pmu() is using if/else for config->formats
check, but "else" case is for just error.
Unnecessary if/else is not good for readable code. this patch checks
if config->formats was zero as error case.

Moreover, we don't need to indicate config->formats value in error message,
because it is zero. This patch tidyup it, too.

=>	if (config->formats) {
		...
	} else {
		dev_warn(w->dapm->dev, "ASoC: Invalid format %llx specified\n",
=>			 config->formats);
		...
	}

Link: https://lore.kernel.org/all/YxiDkDOwRsbXeZ17@sirena.org.uk/
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/877d2ebn3t.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-08 11:39:40 +01:00
Kuninori Morimoto
6ef8443fb1
ASoC: soc-dapm.c: add comment for kzalloc()/kfree() on snd_soc_dai_link_event_pre_pmu()
snd_soc_dai_link_event_pre_pmu() is using kzalloc()/kfree() for params.
It looks we don't need to use these, but are necessary.
But, it is difficult to know why it is necessary without any comments.
This patch adds the reasons via comment.

Link: https://lore.kernel.org/all/Yxc2wzbZsSVZNf8Y@sirena.org.uk/
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/878rmubn47.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-08 11:39:39 +01:00
Mark Brown
e0d38f88e9
ASoC: Fixes for MT8195 SOF support
Merge series from AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>:

This series fixes Sound Open Firmware support for MT8195 by making
sure that the sound card driver is actually able to probe and IPC
can finally happen.
It is now possible to get DSP support for audio.

Tested on MT8195 Tomato - Acer Chromebook Spin 513 CP513-2H (Pipewire).
2022-09-07 15:28:51 +01:00
Mark Brown
5b16f2677b
ASoC: soc-dapm.c: random cleanup
Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

These are cleanup patches for soc-dapm.c.
Each patches are not related, very random cleanup.
2022-09-07 14:37:12 +01:00
Kuninori Morimoto
3caac75968
ASoC: soc-dapm.c: fixup snd_soc_dapm_new_control_unlocked() error handling
Current snd_soc_dapm_new_control_unlocked() error handling is wrong.
It is using "goto request_failed" (A), but error message is using
"w->name" (B) which is not yet created in such timing.

	snd_soc_dapm_new_control_unlocked(xxx)
	{
		...
		switch (w->id) {
		case xxx:
			...
			if (IS_ERR(...)) {
				ret = PTR_ERR(...);
(A)				goto request_failed;
			}
		...
		}

		prefix = soc_dapm_prefix(...);
		if (prefix)
(B)			w->name = kasprintf(...);
		else
(B)			w->name = kstrdup_const(...);
		...

(A)	request_failed:
		if (ret != -EPROBE_DEFER)
(B)			dev_err(..., w->name, ...);

		return ...;
	}

we can create "w->name" at beginning of this function.
In such case, we need to call kfree_const(w->name) at error case.
This patch do these.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87wnah8l7e.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-07 12:44:31 +01:00
Kuninori Morimoto
427de091a7
ASoC: soc-dapm.c: don't use WARN_ON() at snd_soc_dai_link_event_pre_pmu()
Current snd_soc_dai_link_event_pre_pmu() is checking "config".
It is using dev_err() (A) if it was NULL, so we don't need to use
WARN_ON() (B) to check it, it is over-kill. This patch removes it.

(B)	if (WARN_ON(!config)) {
(A)		dev_err(...);
		...
	}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87zgfd8l7s.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-07 12:44:30 +01:00
Krzysztof Kozlowski
e9d967679e
ASoC: dt-bindings: qcom,q6core: remove binding
qcom,q6core is already described in soc/qcom/qcom,apr.yaml.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220906121110.301900-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-07 12:42:23 +01:00
Dmitry Torokhov
355beeed93
ASoC: simple-card-utils: switch to using gpiod API
This patch switches the driver away from legacy gpio/of_gpio API to
gpiod API, and removes use of of_get_named_gpio_flags() which I want to
make private to gpiolib.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/YxeaITtlJexygQo9@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-07 12:42:22 +01:00
AngeloGioacchino Del Regno
8a7d5d85ed
ASoC: SOF: mediatek: mt8195: Add devicetree support to select topologies
Support devicetree by adding a snd_soc_of_mach array, specifying SOF
topologies for a generic MT8195 machine and for Google Tomato
Chromebooks.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220906092727.37324-6-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-07 12:40:53 +01:00
AngeloGioacchino Del Regno
cf84edeeb9
ASoC: SOF: mediatek: mt8195: Add generic pcm_{open,close} callbacks
Use the generic sof_stream_pcm_{open,close}() functions for the
pcm_{open,close} callbacks.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220906092727.37324-5-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-07 12:40:52 +01:00
AngeloGioacchino Del Regno
c2186a9b3a
ASoC: SOF: mediatek: mt8195: Add mailbox generic callbacks for IPC
Add the .mailbox_{read,write} generic callbacks for SOF IPC and, while
at it, also change the ipc_msg_data callback to use the SOF API
sof_ipc_msg_data() instead of the custom function mt8195_ipc_msg_data().

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220906092727.37324-4-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-07 12:40:50 +01:00
AngeloGioacchino Del Regno
404bec4c8f
ASoC: SOF: mediatek: mt8195: Import namespace SND_SOC_SOF_MTK_COMMON
Here we're using function mtk_adsp_dump() from mtk-adsp-common:
explicitly import its namespace.

Fixes: 3a054f90e9 ("ASoC: SOF: mediatek: Add mt8195 debug dump")
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220906092727.37324-3-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-07 12:40:49 +01:00
AngeloGioacchino Del Regno
64ec924c78
ASoC: mediatek: mt8195-mt6359: Properly register sound card for SOF
Adding a probe callback on this snd_soc_card is required when
Sound Open Firmware support is desired, as we need to appropriately
populate the stream_name for SOF to be able to bind widgets.
Failing to do so will produce errors when applying the SOF topology
leading to card registration failure (so, no sound).
While at it, also make sure to fill the topology_shortname as required.

Fixes: 0caf1120c5 ("ASoC: mediatek: mt8195: extract SOF common code")
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220906092727.37324-2-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-07 12:40:48 +01:00
Mark Brown
d2a411f810
lib/string_helpers: Introduce parse_int_array_user()
Merge series from Cezary Rojewski <cezary.rojewski@intel.com>:

Continuation of recent upstream discussion [1] regarding user string
tokenization.

First, parse_int_array_user() is introduced to allow for splitting
specified user string into a sequence of integers. Makes use of
get_options() internally so the parsing logic is not duplicated.

With that done, redundant parts of the sound driver are removed.

Originally similar functionality was added for the SOF sound driver. As
more users are on the horizon, it is desirable to update existing
string_helpers code and provide a unified solution.
2022-09-05 16:49:32 +01:00
Mark Brown
cdcdb00855
Untested TAS2562 power setting fixes
Merge series from Martin Povišer <povik+lin@cutebit.org>:

The tas2562 driver does the same thing with the setting of PWR_CTRL
field as the tas2764/tas2770 drivers were doing.
Link: https://lore.kernel.org/alsa-devel/20220808141246.5749-1-povik+lin@cutebit.org/T/#t
Link: https://lore.kernel.org/alsa-devel/20220825140241.53963-1-povik+lin@cutebit.org/T/#t

These are blindly written patches without testing since I don't have
the hardware. (I even tried TI's formal sample request program but
was refused there. CCing @ti.com addresses I found on other series
recently submitted.)
2022-09-05 16:27:19 +01:00
Mark Brown
5176ee6443
ASoC: soc-pcm.c: random cleanup
Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

These are not related, but random cleanup patches for soc-pcm.c
2022-09-05 16:27:13 +01:00
Cezary Rojewski
b9163e9b5f
ASoC: SOF: Remove strsplit_u32() and tokenize_input()
Make use of global integer-array parsing helper instead of the internal
one as both serve same purpose. With that, both strsplit_u32() and
tokenize_input() become unused so remove them.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220904102840.862395-3-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-05 14:51:47 +01:00
Cezary Rojewski
f0b933236e
lib/string_helpers: Introduce parse_int_array_user()
Add new helper function to allow for splitting specified user string
into a sequence of integers. Internally it makes use of get_options() so
the returned sequence contains the integers extracted plus an additional
element that begins the sequence and specifies the integers count.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220904102840.862395-2-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-05 14:51:46 +01:00
Martin Povišer
4ec8179c21
ASoC: apple: mca: Postpone requesting of DMA channels
Move the requesting of DMA channels further down from 'probe' to
'pcm_new'. This is to spare the allocated DMA channel resources as we
typically only ever use one or two of the clusters for PCM streaming.
Before we would request DMA channels for all clusters.

(This is prompted by a change in the Audio DMA Controller driver, which
will now be allocating cache SRAM to channels.)

Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
Link: https://lore.kernel.org/r/20220905074030.1293-1-povik+lin@cutebit.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-05 13:09:41 +01:00
Chunxu Li
354f6008b7
ASoC: SOF: Introduce function sof_of_machine_select
From current design in sof_machine_check the SOF can only support
ACPI type machine.

In sof_machine_check if there is no ACPI machine exist, the function
will return -ENODEV directly, that's we don't expected if we do not
base on ACPI machine.

So we add a new function named sof_of_machine_select that we can pass
sof_machine_check and obtain info required by snd_sof_new_platform_drv.

Signed-off-by: Chunxu Li <chunxu.li@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220903032151.13664-1-chunxu.li@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-05 13:09:40 +01:00
Cristian Ciocaltea
35c8ae25c4
ASoC: wm_adsp: Handle optional legacy support
The tracing capabilities for the speaker protection fw enabled via
commit c55b3e46cb ("ASoC: wm_adsp: Add trace caps to speaker
protection FW") are not be available on all platforms, such as the
Valve's Steam Deck which is based on the Halo Core DSP.

As a consequence, whenever the firmware is loaded, a rather misleading
'Failed to parse legacy: -19' error message is written to the kernel
ring buffer:

[  288.977412] steamdeck kernel: cs35l41 spi-VLV1776:01: DSP1: Firmware version: 3
[  288.978002] steamdeck kernel: cs35l41 spi-VLV1776:01: DSP1: cs35l41-dsp1-spk-prot.wmfw: Fri 02 Apr 2021 21:03:50 W. Europe Daylight Time
[  289.094065] steamdeck kernel: cs35l41 spi-VLV1776:01: DSP1: Firmware: 400a4 vendor: 0x2 v0.33.0, 2 algorithms
[  289.095073] steamdeck kernel: cs35l41 spi-VLV1776:01: DSP1: 0: ID cd v29.53.0 XM@94 YM@e
[  289.095665] steamdeck kernel: cs35l41 spi-VLV1776:01: DSP1: 1: ID f20b v0.0.1 XM@170 YM@0
[  289.096275] steamdeck kernel: cs35l41 spi-VLV1776:01: DSP1: Protection: C:\Users\ocanavan\Desktop\cirrusTune_july2021.bin
[  291.172383] steamdeck kernel: cs35l41 spi-VLV1776:01: DSP1: Failed to parse legacy: -19

Update wm_adsp_buffer_init() to print a more descriptive info message
when wm_adsp_buffer_parse_legacy() returns -ENODEV.

Fixes: c55b3e46cb ("ASoC: wm_adsp: Add trace caps to speaker protection FW")
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220825220530.1205141-1-cristian.ciocaltea@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-05 13:09:39 +01:00
Martin Povišer
2848d34c3b
ASoC: tas2562: Fix mute/unmute
Because the PWR_CTRL field is modeled as the power state of the DAC
widget, and at the same time it is used to implement mute/unmute, we
need some additional book-keeping to have the right end result no matter
the sequence of calls. Without this fix, one permanently mutes an
ongoing stream by toggling the associated speaker pin control.

(This mirrors commit 1e5907bcb3 ("ASoC: tas2770: Fix handling of
mute/unmute") which was a fix to the tas2770 driver.)

Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
Link: https://lore.kernel.org/r/20220825142226.80929-3-povik+lin@cutebit.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-05 13:09:10 +01:00
Martin Povišer
b6b55b2325
ASoC: tas2562: Drop conflicting set_bias_level power setting
The driver is setting the PWR_CTRL field in both the set_bias_level
callback and on DAPM events of the DAC widget (and also in the
mute_stream method). Drop the set_bias_level callback altogether as the
power setting it does is in conflict with the other code paths.

(This mirrors commit c8a6ae3fe1c8 ("ASoC: tas2770: Drop conflicting
set_bias_level power setting") which was a fix to the tas2770 driver.)

Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
Link: https://lore.kernel.org/r/20220825142226.80929-2-povik+lin@cutebit.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-05 13:09:09 +01:00
Kuninori Morimoto
6932b20d4f
ASoC: soc-pcm.c: check fe condition at out of loop
Current dpcm_add_paths() is checking fe condition in loop (= A),
but fe condition (X) is not related to the loop (B).

(X)	static int dpcm_add_paths(fe, stream, ...)
	{
		...
(B)		for_each_dapm_widgets(list, i, widget) {
			...
(A)			if (!fe->dpcm[stream].runtime && !fe->fe_compr)
				continue;
			...
		}
		...
	}

This patch checks fe condition at out of loop

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87pmgi4dz4.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-05 13:09:07 +01:00
Kuninori Morimoto
041107289c
ASoC: soc-pcm.c: add soc_pcm_ret()
Current soc-pcm.c has many similar code for error case.
This patch adds soc_pcm_ret() and share the code and error message.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87r10y4dzb.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-05 13:09:06 +01:00
Kuninori Morimoto
10d5d8cbf6
ASoC: soc-pcm.c: remove unnecessary codec2codec_close_delayed_work()
commit 4bf2e385aa ("ASoC: core: Init pcm runtime work early to
avoid warnings") has added generic close_delayed_work() which checks
close_delayed_work_func

	static void close_delayed_work(...) {
		...
=>		if (rtd->close_delayed_work_func)
			rtd->close_delayed_work_func(rtd);
	}

So, we don't need to have NULL function for Codec2Codec.

=>	static void codec2codec_close_delayed_work()
	{
		/*
		 * Currently nothing to do for c2c links
		 * Since c2c links are internal nodes in the DAPM graph and
		 * don't interface with the outside world or application layer
		 * we don't have to do any special handling on close.
		 */
	}

	int soc_new_pcm(...)
	{
		...
		if (rtd->dai_link->params)
=>			rtd->close_delayed_work_func = codec2codec_close_delayed_work;
		else
			rtd->close_delayed_work_func = snd_soc_close_delayed_work;
		...
	}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87sfle4dzk.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-05 13:09:05 +01:00
Jiasheng Jiang
376be51caf
ASoC: rsnd: Add check for rsnd_mod_power_on
As rsnd_mod_power_on() can return negative numbers,
it should be better to check the return value and
deal with the exception.

Fixes: e7d850dd10 ("ASoC: rsnd: use mod base common method on SSI-parent")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20220902013030.3691266-1-jiasheng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-02 13:27:16 +01:00
Martin Povišer
55e2bd9c41
MAINTAINERS: Fix file pattern for ARM/APPLE MACHINE SOUND DRIVERS
This is what was meant of course.

Fixes: 3df5d0d972 ("ASoC: apple: mca: Start new platform driver")
Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
Link: https://lore.kernel.org/r/20220901113415.27449-2-povik+lin@cutebit.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-01 12:49:22 +01:00
Martin Povišer
7d2497b7fd
ASoC: apple: mca: Unselect COMMON_CLK in Kconfig
The MCA driver selects COMMON_CLK, which leads to misconfiguration
on platforms with HAVE_LEGACY_CLK (under compile test). Kconfig catches
the conflict with the following warning:

  WARNING: unmet direct dependencies detected for COMMON_CLK
  Depends on [n]: !HAVE_LEGACY_CLK [=y]
  Selected by [m]:
  - SND_SOC_APPLE_MCA [=m] && SOUND [=m] && !UML && SND [=m] &&
    SND_SOC [=m] && (ARCH_APPLE || COMPILE_TEST [=y])

Eventually the build fails with errors like:

>> drivers/clk/clk.c:867:6: error: redefinition of 'clk_unprepare'
     867 | void clk_unprepare(struct clk *clk)
         |      ^~~~~~~~~~~~~
   In file included from drivers/clk/clk.c:9:
   include/linux/clk.h:303:20: note: previous definition of 'clk_unprepare' with type 'void(struct clk *)'
     303 | static inline void clk_unprepare(struct clk *clk)
         |                    ^~~~~~~~~~~~~

which appears to be because COMMON_CLK is selected but HAVE_CLK_PREPARE
is not. In the end it seems we had no business selecting COMMON_CLK from
an unrelated driver like that, so remove the selection. The linux/clk.h
API is there anyway.

Fixes: 3df5d0d972 ("ASoC: apple: mca: Start new platform driver")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
Link: https://lore.kernel.org/r/20220901113415.27449-1-povik+lin@cutebit.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-01 12:49:21 +01:00
Krzysztof Kozlowski
69e3e537ec
ASoC: codecs: rk817: drop I2C dependencies
The RK817 codec uses regmap API and not directly regmap I2C.  It is the
parent MFD who uses and selects regmap I2C.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220901101458.365354-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-01 11:56:25 +01:00
Krzysztof Kozlowski
9815746c48
ASoC: codecs: wcd934x: add Slimbus dependency
The WCD934X codec is a Slimbus driver, so it must depend on SLIMBUS,
also for compile tests:

  ERROR: modpost: "slim_stream_prepare" [sound/soc/codecs/snd-soc-wcd934x.ko] undefined!

Reported-by: kernel test robot <lkp@intel.com>
Fixes: 5b7f4e5de6 ("ASoC: codecs: allow compile testing without MFD drivers")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220901101458.365354-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-01 11:56:24 +01:00
Mark Brown
447d63a2cd
ASoC: codecs: minor cppcheck cleanups
Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

Small number of cleanups that were either missed in previous versions
or detected by new cppcheck version.
2022-08-31 13:51:56 +01:00
Mark Brown
ce963f84a8
ASoC: SOF: compress: Add support for timestamp on capture
Merge series from Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>:

The purpose of this patch series is to add support for
timestamping on capture direction using the compress
API.

This is simply done by splitting sof_compr_copy into 2
functions: sof_compr_copy_playback and sof_compr_copy_capture.
Each of these functions handles one of the possible directions:
capture or playback and is called in sof_compr_copy based on
the stream's direction.

The only difference between sof_compr_copy_playback and
sof_compr_copy_capture is the fact that on playback case
we need to copy data from user space and on capture we
need to copy data to user space.
2022-08-31 13:40:16 +01:00
Daniel Mack
33b7504ae0
ASoC: max98396: Make data monitor features configurable
Allow the data monitor features to be enabled explicitly, and enable control
over their details.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Link: https://lore.kernel.org/r/20220826085927.2336224-2-daniel@zonque.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-08-31 12:13:07 +01:00
Daniel Mack
ec2988da1a
ASoC: dt-bindings: max98396: Document data monitor properties
This device features a data monitor that puts the device in software reset
upon a configurable set of events.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220826085927.2336224-1-daniel@zonque.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-08-31 12:13:06 +01:00
Pierre-Louis Bossart
7a0431bbda
ASoC: ti: omap-mcbsp: remove useless assignment
sound/soc/ti/omap-mcbsp.c:617:10: style: Variable 'ret' is assigned a
value that is never used. [unreadVariable]
 int ret = 0;
         ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Link: https://lore.kernel.org/r/20220822184239.169757-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-08-31 12:13:05 +01:00
Pierre-Louis Bossart
3653a6a2a7
ASoC: fsl: fsl-utils: remove useless assignment
cppcheck warning:

sound/soc/fsl/fsl_utils.c:127:10: style: Variable 'ret' is assigned a
value that is never used. [unreadVariable]
 int ret = 0;
         ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Link: https://lore.kernel.org/r/20220822184239.169757-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-08-31 12:13:03 +01:00
Pierre-Louis Bossart
c9a9b4dbc1
ASoC: wcd9335: remove always-true condition
cppcheck warning:

sound/soc/codecs/wcd9335.c:1824:22: style: Condition 'tx_port==13' is
always true [knownConditionTrueFalse]
  } else if (tx_port == 13) {
                     ^
sound/soc/codecs/wcd9335.c:1802:16: note: Assuming that condition
'tx_port==12' is not redundant
  if ((tx_port == 12) || (tx_port >= 14)) {
               ^
sound/soc/codecs/wcd9335.c:1802:35: note: Assuming that condition
'tx_port>=14' is not redundant
  if ((tx_port == 12) || (tx_port >= 14)) {
                                  ^
sound/soc/codecs/wcd9335.c:1824:22: note: Condition 'tx_port==13' is
always true
  } else if (tx_port == 13) {
                     ^
sound/soc/codecs/wcd9335.c:1845:22: style: Condition 'tx_port==13' is
always true [knownConditionTrueFalse]
  } else if (tx_port == 13) {
                     ^
sound/soc/codecs/wcd9335.c:1802:16: note: Assuming that condition
'tx_port==12' is not redundant
  if ((tx_port == 12) || (tx_port >= 14)) {
               ^
sound/soc/codecs/wcd9335.c:1802:35: note: Assuming that condition
'tx_port>=14' is not redundant
  if ((tx_port == 12) || (tx_port >= 14)) {
                                  ^
sound/soc/codecs/wcd9335.c:1845:22: note: Condition 'tx_port==13' is
always true
  } else if (tx_port == 13) {
                     ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Link: https://lore.kernel.org/r/20220822184239.169757-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-08-31 12:13:02 +01:00
Pierre-Louis Bossart
43265ceeb0
ASoC: wcd-mbhc-v2: remove always-true condition
cppcheck warning:

'cross_conn<0' is always true [knownConditionTrueFalse]
   } else if (cross_conn < 0) /* Error */
                         ^
'!cross_conn' is not redundant
   } else if (!cross_conn) { /* no cross connection */
              ^
is always true
   } else if (cross_conn < 0) /* Error */
                         ^

sound/soc/codecs/wcd-mbhc-v2.c:1192:26: style: Condition
sound/soc/codecs/wcd-mbhc-v2.c:1188:15: note: Assuming that condition
sound/soc/codecs/wcd-mbhc-v2.c:1192:26: note: Condition 'cross_conn<0'
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Link: https://lore.kernel.org/r/20220822184239.169757-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-08-31 12:13:01 +01:00