linux-2.6-block.git
3 months agoASoC: wm_adsp: Include array_size.h
Richard Fitzgerald [Wed, 10 Apr 2024 16:13:12 +0000 (17:13 +0100)]
ASoC: wm_adsp: Include array_size.h

Explicitly #include array_size.h for the ARRAY_SIZE() macro.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://msgid.link/r/20240410161312.22313-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 months agoASoC: ti: davinci-i2s: Add features to McBSP
Mark Brown [Tue, 9 Apr 2024 22:27:01 +0000 (23:27 +0100)]
ASoC: ti: davinci-i2s: Add features to McBSP

Merge series from Bastien Curutchet <bastien.curutchet@bootlin.com>:

This series aims to add some features to McBSP driver.

Convert bindings from .txt to .yaml.
Add possibility to use an external clock as sample rate generator's
input.
Add handling of new formats (TDM, S24_LE, BP_FC).
Enable the detection of unexpected frame pulses.
Set the clock free-running mode according to SND_SOC_DAIFMT_[GATED/CONT]
configuration in DAI format.
Add ti,T1-framing[tx/rx] properties in DT. They allow to set the data
delay to two bit-clock periods.

This has been tested on a platform designed off of the DAVINCI/OMAP-L138
connected to 3 daisy-chained AD7767. An external clock drives the
sample rate generator through the CLKS pin.
The hardware I have only allowed me to test acquisition side of McBSP.
It is connected to a 6 channels TDM and acts as Bit clock provider and
Frame clock consumer.

3 months agoASoC: SOF: Intel: Add fw_regs area to debugfs map for
Mark Brown [Tue, 9 Apr 2024 22:26:49 +0000 (23:26 +0100)]
ASoC: SOF: Intel: Add fw_regs area to debugfs map for

Merge series from Peter Ujfalusi <peter.ujfalusi@linux.intel.com>:

The beginning of the first SRAM window contains various fw registers and
additional information which can be very beneficial to read to gather
information on the current states to debug issues.

3 months agoASoC: pcm: perform power-down delay checks a bit faster
Dragan Simic [Tue, 9 Apr 2024 17:56:36 +0000 (19:56 +0200)]
ASoC: pcm: perform power-down delay checks a bit faster

When checking whether the power-down delay should be ignored for a specific
PCM runtime, there's no need to keep going through all DAI link components
after any of them is found to be configured to use the power-down delay.

While there, fix a small typo in one of the comment blocks.

Signed-off-by: Dragan Simic <dsimic@manjaro.org>
Link: https://msgid.link/r/90ae761a5b99640ece48363a7099ac2cf402bd37.1712684592.git.dsimic@manjaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
3 months agoASoC: amd: fix for soundwire build dependencies for legacy stack
Vijendar Mukunda [Mon, 8 Apr 2024 18:02:26 +0000 (23:32 +0530)]
ASoC: amd: fix for soundwire build dependencies for legacy stack

The SND_SOC_AMD_SOUNDWIRE Kconfig symbol has build dependency on
SOUNDWIRE_AMD. It gets it wrong for a configuration involving
SND_SOC_AMD_SOUNDWIRE_LINK_BASELINE=y,SND_SOC_AMD_PS=y and SOUNDWIRE_AMD=m,
which results in a link failure:

ld: vmlinux.o: in function `amd_sdw_probe':
>> sound/soc/amd/ps/pci-ps.c:271:(.text+0x1d51eff):
undefined reference to `sdw_amd_probe'
ld: vmlinux.o: in function `acp63_sdw_machine_select':
>> sound/soc/amd/ps/pci-ps.c:294:(.text+0x1d525d5):
undefined reference to `sdw_amd_get_slave_info'
ld: vmlinux.o: in function `amd_sdw_exit':
>> sound/soc/amd/ps/pci-ps.c:280:(.text+0x1d538ce):
undefined reference to `sdw_amd_exit'

Add a top level check config that forbids any of the AMD ACP drivers
with version >= 6.3 from being built-in with CONFIG_SOUNDWIRE_AMD=m.
Move SND_AMD_ACP_CONFIG common dependency config to
SND_SOC_AMD_ACP63_TOPLEVEL config.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202404061257.khJml82D-lkp@intel.com/
Fixes: a806793f231e ("ASoC: amd: simplify soundwire dependencies for legacy stack")
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://msgid.link/r/20240408180229.3287220-1-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 months agoASoC: ti: davinci-i2s: Add T1 framing support
Bastien Curutchet [Tue, 2 Apr 2024 07:12:13 +0000 (09:12 +0200)]
ASoC: ti: davinci-i2s: Add T1 framing support

McBSP's data delay can be configured from 0 to 2 bit clock periods. 0 is
used for DSP_B format, 1 is used for DSP_A format, 2 is unused.

A data delay of 2 bit clock periods can be used to interface to
'T1 framing' devices where data stream is preceded by a 'framing bit'. On
transmission, McBSP inserts a blank period (high-impedance period)
before the first data bit to leave an opportunity for other devices to
set this 'framing bit'. On reception, McBSP discards the 'framing bit'
that precedes the data stream.

Add support for the 'framing bit' according to the
'ti,T1-framing-[tx/rx]' device-tree properties. If a flag is present,
the data delay is set to 2 bit clock periods regardless of the selected
DAI format.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://msgid.link/r/20240402071213.11671-14-bastien.curutchet@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 months agoASoC: dt-bindings: davinci-mcbsp: Add the 'ti,T1-framing-{rx/tx}' flags
Bastien Curutchet [Tue, 2 Apr 2024 07:12:12 +0000 (09:12 +0200)]
ASoC: dt-bindings: davinci-mcbsp: Add the 'ti,T1-framing-{rx/tx}' flags

McBSP's data delay can be configured from 0 to 2 bit clock periods. 0 is
used for DSP_B format, 1 for DSP_A format. A data delay of 2 bit clock
periods can be used to interface to 'T1 framing' devices where data
stream is preceded by a 'framing bit'. This 2 bit clock data delay is
not described in the bindings.

Add two flags 'ti,T1-framing-[rx/tx]' to enable a data delay of 2
bit clock periods in reception or transmission.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://msgid.link/r/20240402071213.11671-13-bastien.curutchet@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 months agoASoC: ti: davinci-i2s: Add S24_LE to supported formats
Bastien Curutchet [Tue, 2 Apr 2024 07:12:11 +0000 (09:12 +0200)]
ASoC: ti: davinci-i2s: Add S24_LE to supported formats

S24_LE is supported by McBSP but not by the driver.

Add S24_LE to driver's supported formats. Using it enables the sign
extension in DRR (Data Receive Register). The other formats are kept
with the zero extension in DRR.

Remove data_type table as it is no longer used.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://msgid.link/r/20240402071213.11671-12-bastien.curutchet@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 months agoASoC: ti: davinci-i2s: Link free-run mode to SND_SOC_DAIFMT_[GATED/CONT]
Bastien Curutchet [Tue, 2 Apr 2024 07:12:10 +0000 (09:12 +0200)]
ASoC: ti: davinci-i2s: Link free-run mode to SND_SOC_DAIFMT_[GATED/CONT]

McBSP has free-running mode where serial clocks continue to run during
emulation halts. This mode is always enabled by the driver.

Set free-running mode when SND_SOC_DAIFMT_CONT is selected by DAI
format, unset it when SND_SOC_DAIFMT_GATED is selected.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://msgid.link/r/20240402071213.11671-11-bastien.curutchet@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 months agoASoC: ti: davinci-i2s: Enable unexpected frame pulses detection
Bastien Curutchet [Tue, 2 Apr 2024 07:12:09 +0000 (09:12 +0200)]
ASoC: ti: davinci-i2s: Enable unexpected frame pulses detection

McBSP can generate a SYNCERR when unexpected frame pulses are
detected. The driver always disables this feature and ignore the
unexpected frame pulses.

Enable the generation of SYNCERR by the McBSP. Unexpected frame
pulses are not ignored anymore.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://msgid.link/r/20240402071213.11671-10-bastien.curutchet@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 months agoASoC: ti: davinci-i2s: Add handling of BP_FC format
Bastien Curutchet [Tue, 2 Apr 2024 07:12:08 +0000 (09:12 +0200)]
ASoC: ti: davinci-i2s: Add handling of BP_FC format

McBSP is able to drive bit clock and consume frame clock but BP_FC
format is not handled by McBSP driver.

Add BP_FC format support.
When BP_FC is selected:
  - CLKX and CLKR are configured as outputs
  - The sample rate generator is configured to be able to provide bit
    clock.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://msgid.link/r/20240402071213.11671-9-bastien.curutchet@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 months agoASoC: ti: davinci-i2s: Add TDM support
Bastien Curutchet [Tue, 2 Apr 2024 07:12:07 +0000 (09:12 +0200)]
ASoC: ti: davinci-i2s: Add TDM support

TDM is not supported by the McBSP driver. The McBSP datasheet does not
name explicitly TDM as a supported format but it is possible to configure
the McBSP to do TDM if all slots are used by McBSP.

Add TDM support. It uses single-phase frame. Slot width is used to
compute the McBSP's word length.

Implement the set_tdm_slot() hook of snd_soc_dai_ops struct. It only
supports TDM if all slots are used by McBSP.

The snd_soc_dai_driver's channels_max is updated from 2 to 128.

This was tested with BP_FC format on a platform designed off of
DAVINCI/OMAP_L138. A check is done in davinci_i2s_set_dai_fmt() to
prevent TDM to be used with BC_FC and BC_FP formats.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://msgid.link/r/20240402071213.11671-8-bastien.curutchet@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 months agoASoC: ti: davinci-i2s: Delete unnecessary assignment
Bastien Curutchet [Tue, 2 Apr 2024 07:12:06 +0000 (09:12 +0200)]
ASoC: ti: davinci-i2s: Delete unnecessary assignment

In davinci_i2s_hw_params(), mcbsp_word_length is set twice to
asp_word_length[fmt].

Remove second unnecessary assignment.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://msgid.link/r/20240402071213.11671-7-bastien.curutchet@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 months agoASoC: ti: davinci-i2s: Use external clock to drive sample rate generator
Bastien Curutchet [Tue, 2 Apr 2024 07:12:05 +0000 (09:12 +0200)]
ASoC: ti: davinci-i2s: Use external clock to drive sample rate generator

McBSP's internal sample rate generator can be programed to be driven by
its internal clock or by an external clock source located on CLKS pin.
The external clock source case is not handled by the driver.

Handle an optional clock related to this external clock source. If
present, the driver uses the clock located on CLKS pin as input for the
sample rate generator. Thus, the external clock rate is used to compute
divisors. If this optional clock is not present, the sample rate
generator is driven by the McBSP's functional clock.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://msgid.link/r/20240402071213.11671-6-bastien.curutchet@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 months agoASoC: ti: davinci-i2s: Replace dev_err with dev_err_probe
Bastien Curutchet [Tue, 2 Apr 2024 07:12:04 +0000 (09:12 +0200)]
ASoC: ti: davinci-i2s: Replace dev_err with dev_err_probe

In probe(), the dev_err() is used for every returned error.

Replace dev_err() with dev_err_probe() where -EPROBE_DEFER can be
returned.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://msgid.link/r/20240402071213.11671-5-bastien.curutchet@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 months agoASoC: ti: davinci-i2s: Remove the unused clk_input_pin attribute
Bastien Curutchet [Tue, 2 Apr 2024 07:12:03 +0000 (09:12 +0200)]
ASoC: ti: davinci-i2s: Remove the unused clk_input_pin attribute

The clk_input_pin attribute of davinci_mcbsp_dev struct is not set since
commit 257ade78b601 ("ASoC: davinci-i2s: Convert to use edma-pcm").

Remove the attribute.
Keep the behaviour of the MCBSP_CLKR case as MCBSP_CLKR == 0.
I can't test the BC_FP format so I added back the initial comment that
was removed by commit ec6375533748 ("ASoC: DaVinci: Added selection of
clk input pin for McBSP"). This was the last dependency to
linux/platform_data/davinci_asp.h so it is not included anymore.

Remove the enum mcbsp_clk_input_pin from davinci_asp.h as it is not used
anywhere else.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://msgid.link/r/20240402071213.11671-4-bastien.curutchet@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 months agoASoC: dt-bindings: davinci-mcbsp: Add optional clock
Bastien Curutchet [Tue, 2 Apr 2024 07:12:02 +0000 (09:12 +0200)]
ASoC: dt-bindings: davinci-mcbsp: Add optional clock

The McBSP uses an internal sample rate generator to provide bit clock
or frame clock. This sample rate generator can be programmed to be
driven by McBSP's internal clock source or by an external clock source
(located on CLKS pin). The external clock source is not described in
the bindings.

Add an optional clock item that allows to select an external clock as
sample rate generator's input.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://msgid.link/r/20240402071213.11671-3-bastien.curutchet@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 months agoASoC: dt-bindings: davinci-mcbsp: convert McBSP bindings to yaml schema
Bastien Curutchet [Tue, 2 Apr 2024 07:12:01 +0000 (09:12 +0200)]
ASoC: dt-bindings: davinci-mcbsp: convert McBSP bindings to yaml schema

Convert the binding for McBSP controllers for TI SoCs from txt
to YAML schema.

Add properties 'clocks', 'clock-names', 'power-domains' and
'#sound-dai-cells' which were missing from the txt file.
Add '#sound-dai-cells' and 'clocks' in the example which were missing
from the txt file.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://msgid.link/r/20240402071213.11671-2-bastien.curutchet@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 months agoASoC: codecs: Rockchip on-SoC codecs should depend on ARCH_ROCKCHIP
Geert Uytterhoeven [Tue, 9 Apr 2024 15:34:56 +0000 (17:34 +0200)]
ASoC: codecs: Rockchip on-SoC codecs should depend on ARCH_ROCKCHIP

The various Rockchip embedded audio codecs are only present on Rockchip
SoCs.  Hence add dependencies on ARCH_ROCKCHIP, to prevent asking the
user about these drivers when configuring a kernel without Rockchip SoC
support.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://msgid.link/r/6cdbaf4afcf4d2059b257f6cb3a8a61bf5e17688.1712676714.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
3 months agoASoC: SOF: Intel: lnl: Add fw_regs area to debugfs map
Peter Ujfalusi [Tue, 9 Apr 2024 11:33:49 +0000 (14:33 +0300)]
ASoC: SOF: Intel: lnl: Add fw_regs area to debugfs map

Expose the firmware registers via debugfs. it can be of great help while
debugging complex issues.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://msgid.link/r/20240409113349.21623-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 months agoASoC: SOF: Intel: mtl: Add fw_regs area to debugfs map
Peter Ujfalusi [Tue, 9 Apr 2024 11:33:48 +0000 (14:33 +0300)]
ASoC: SOF: Intel: mtl: Add fw_regs area to debugfs map

Expose the firmware registers via debugfs. it can be of great help while
debugging complex issues.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://msgid.link/r/20240409113349.21623-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 months agoASoC: SOF: Intel: tgl: Add fw_regs area to debugfs map for IPC4
Peter Ujfalusi [Tue, 9 Apr 2024 11:33:47 +0000 (14:33 +0300)]
ASoC: SOF: Intel: tgl: Add fw_regs area to debugfs map for IPC4

Expose the firmware registers via debugfs. it can be of great help while
debugging complex issues.
The area is only available with IPC4.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://msgid.link/r/20240409113349.21623-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 months agoASoC: Intel: sof_rt5682: Fix uninitialized variable in probe
Dan Carpenter [Mon, 8 Apr 2024 07:35:59 +0000 (10:35 +0300)]
ASoC: Intel: sof_rt5682: Fix uninitialized variable in probe

Initialize "is_legacy_cpu" to false to prevent an uninitialized variable
bug.

Fixes: 8efcd4864652 ("ASoC: Intel: sof_rt5682: use common module for sof_card_private initialization")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://msgid.link/r/6e16433f-1897-46a2-b3ee-e177e7d846b8@moroto.mountain
Signed-off-by: Mark Brown <broonie@kernel.org>
3 months agoAdd support for QCM6490 and QCS6490
Mark Brown [Mon, 8 Apr 2024 17:11:23 +0000 (18:11 +0100)]
Add support for QCM6490 and QCS6490

Merge series from Mohammad Rafi Shaik <quic_mohs@quicinc.com>:

This patchset adds support for sound card on Qualcomm QCM6490 IDP and
QCS6490 RB3Gen2 boards.

3 months agoASoC: dt-bindings: ti,pcm1681: Convert to dtschema
Animesh Agarwal [Sat, 6 Apr 2024 14:14:49 +0000 (19:44 +0530)]
ASoC: dt-bindings: ti,pcm1681: Convert to dtschema

Convert the Texas Instruments PCM1681 bindings to DT schema.
Make bindings complete by adding #sound-dai-cells.

Signed-off-by: Animesh Agarwal <animeshagarwal28@gmail.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://msgid.link/r/20240406141454.45529-1-animeshagarwal28@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 months agoASoC: qcom: sc8280xp: Add support for QCM6490 and QCS6490
Mohammad Rafi Shaik [Mon, 8 Apr 2024 04:23:31 +0000 (09:53 +0530)]
ASoC: qcom: sc8280xp: Add support for QCM6490 and QCS6490

Add compatibles for sound card on Qualcomm QCM6490 IDP and
QCS6490 RB3Gen2 boards.

Signed-off-by: Mohammad Rafi Shaik <quic_mohs@quicinc.com>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://msgid.link/r/20240408042331.403103-3-quic_mohs@quicinc.com
Signed-off-by: Mark Brown <broonie@kernel.org>
3 months agoASoC: dt-bindings: qcom,sm8250: Add QCM6490 snd QCS6490 sound card
Mohammad Rafi Shaik [Mon, 8 Apr 2024 04:23:30 +0000 (09:53 +0530)]
ASoC: dt-bindings: qcom,sm8250: Add QCM6490 snd QCS6490 sound card

Document the bindings for the Qualcomm QCM6490 IDP and QCS6490 RB3Gen2
board specific sound card.

The bindings are the same as for other newer Qualcomm ADSP sound cards,
thus keep them in existing qcom,sm8250.yaml file, even though Linux driver
is separate.

Signed-off-by: Mohammad Rafi Shaik <quic_mohs@quicinc.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://msgid.link/r/20240408042331.403103-2-quic_mohs@quicinc.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: SOF: Intel: improve and extend HDaudio-based
Mark Brown [Fri, 5 Apr 2024 22:15:55 +0000 (23:15 +0100)]
ASoC: SOF: Intel: improve and extend HDaudio-based

Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

For LunarLake, the SoundWire in-band wake detection is reported with
the HDAudio WAKE_EN/WAKE_STS registers. In the existing code, these
registers are only handled for HDaudio codecs. Now the same registers
have to be handled with care as shared resources.

The in-band wake detection mainly used for jack detection. Without
this patchset, the SoundWire headset codecs signal an event that would
be ignored and not reported.

4 months agoASoC: Intel: avs: Fixes and cleanups for 6.10
Mark Brown [Fri, 5 Apr 2024 22:15:43 +0000 (23:15 +0100)]
ASoC: Intel: avs: Fixes and cleanups for 6.10

Merge series from Cezary Rojewski <cezary.rojewski@intel.com>:

Set of changes targeting the avs-driver only. No new features, patchset
either fixes or fortifies existing code.

Patchset starts off with a fix for debugbility on ICL+ platforms which I
have forgotten to fixup when providing support for these initially.
The next two address copier module initialization, most importantly,
silence the gcc 'field-spanning write' false-positive.

The following four:
6/13 ASoC: Intel: avs: Replace risky functions with safer variants
7/13 ASoC: Intel: avs: Fix potential integer overflow
8/13 ASoC: Intel: avs: Test result of avs_get_module_entry()
9/13 ASoC: Intel: avs: Remove dead code

address problems found out by Coverity static analysis tool.

The last two worth mentioning are: recommendation from the firmware team
to wake subsystem from D0ix when starting any pipeline -and- shielding
against invalid period/buffer sizes. Audio format shall be taken into
consideration when calculating either of these.

Amadeusz Sławiński (2):
  ASoC: Intel: avs: Restore stream decoupling on prepare
  ASoC: Intel: avs: Add assert_static to guarantee ABI sizes

Cezary Rojewski (11):
  ASoC: Intel: avs: Fix debug-slot offset calculation
  ASoC: Intel: avs: Silence false-positive memcpy() warnings
  ASoC: Intel: avs: Fix config_length for config-less copiers
  ASoC: Intel: avs: Fix ASRC module initialization
  ASoC: Intel: avs: Replace risky functions with safer variants
  ASoC: Intel: avs: Fix potential integer overflow
  ASoC: Intel: avs: Test result of avs_get_module_entry()
  ASoC: Intel: avs: Remove dead code
  ASoC: Intel: avs: Wake from D0ix when starting streaming
  ASoC: Intel: avs: Init debugfs before booting firmware
  ASoC: Intel: avs: Rule invalid buffer and period sizes out

 sound/soc/intel/avs/avs.h      |  1 +
 sound/soc/intel/avs/cldma.c    |  2 +-
 sound/soc/intel/avs/core.c     |  4 +--
 sound/soc/intel/avs/icl.c      | 12 ++++++---
 sound/soc/intel/avs/loader.c   |  6 +++--
 sound/soc/intel/avs/messages.h | 47 ++++++++++++++++++++++++++++++++--
 sound/soc/intel/avs/path.c     | 13 ++++------
 sound/soc/intel/avs/pcm.c      | 34 +++++++++++++++++++++++-
 sound/soc/intel/avs/probes.c   | 14 ++++++----
 9 files changed, 109 insertions(+), 24 deletions(-)

--
2.25.1

4 months agoASoC: Intel: avs: Rule invalid buffer and period sizes out
Cezary Rojewski [Fri, 5 Apr 2024 09:09:29 +0000 (11:09 +0200)]
ASoC: Intel: avs: Rule invalid buffer and period sizes out

While HDAudio controller supports buffer packets up to 128 bytes low,
audio format shall be taken into consideration when calculating buffer
and period sizes to avoid undesired xruns.

As *_size in ALSA terms means frames (channels times bit-depth-bytes),
hw_rules can calculate minimal buffer and period sizes solely from
sample rate and the number of milliseconds commonly used on the
AudioDSP firmware side.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240405090929.1184068-14-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: Intel: avs: Add assert_static to guarantee ABI sizes
Amadeusz Sławiński [Fri, 5 Apr 2024 09:09:28 +0000 (11:09 +0200)]
ASoC: Intel: avs: Add assert_static to guarantee ABI sizes

In order to make sure that IPC interface is stable use assert_static to
check union and struct sizes that describe communication interface.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240405090929.1184068-13-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: Intel: avs: Init debugfs before booting firmware
Cezary Rojewski [Fri, 5 Apr 2024 09:09:27 +0000 (11:09 +0200)]
ASoC: Intel: avs: Init debugfs before booting firmware

When bringing up setups it's vital to have access to debug functionality
even if firmware boot fails. As order of probe()ing operations is
changed, update remove() procedure accordingly.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240405090929.1184068-12-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: Intel: avs: Wake from D0ix when starting streaming
Cezary Rojewski [Fri, 5 Apr 2024 09:09:26 +0000 (11:09 +0200)]
ASoC: Intel: avs: Wake from D0ix when starting streaming

It is recommended to keep the DSP domain in full-power when starting DMA
engines.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240405090929.1184068-11-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: Intel: avs: Remove dead code
Cezary Rojewski [Fri, 5 Apr 2024 09:09:25 +0000 (11:09 +0200)]
ASoC: Intel: avs: Remove dead code

The result of list_next_entry()/list_last_entry() is never null.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240405090929.1184068-10-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: Intel: avs: Test result of avs_get_module_entry()
Cezary Rojewski [Fri, 5 Apr 2024 09:09:24 +0000 (11:09 +0200)]
ASoC: Intel: avs: Test result of avs_get_module_entry()

While PROBE_MOD_UUID is always part of the base AudioDSP firmware
manifest, from maintenance point of view it is better to check the
result.

Fixes: dab8d000e25c ("ASoC: Intel: avs: Add data probing requests")
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240405090929.1184068-9-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: Intel: avs: Fix potential integer overflow
Cezary Rojewski [Fri, 5 Apr 2024 09:09:23 +0000 (11:09 +0200)]
ASoC: Intel: avs: Fix potential integer overflow

While stream_tag for CLDMA on SKL-based platforms is always 1, function
hda_cldma_setup() uses AZX_SD_CTL_STRM() macro which does:
stream_tag << 20

what combined with stream_tag type of 'unsigned int' generates a
potential overflow issue. Update the field type to fix that.

Fixes: 45864e49a05a ("ASoC: Intel: avs: Implement CLDMA transfer")
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240405090929.1184068-8-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: Intel: avs: Replace risky functions with safer variants
Cezary Rojewski [Fri, 5 Apr 2024 09:09:22 +0000 (11:09 +0200)]
ASoC: Intel: avs: Replace risky functions with safer variants

strscpy() and snprintf() are the recommended equivalents of their
riskier friends.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240405090929.1184068-7-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: Intel: avs: Fix ASRC module initialization
Cezary Rojewski [Fri, 5 Apr 2024 09:09:21 +0000 (11:09 +0200)]
ASoC: Intel: avs: Fix ASRC module initialization

The ASRC module configuration consists of several reserved fields. Zero
them out when initializing the module to avoid sending invalid data.

Fixes: 274d79e51875 ("ASoC: Intel: avs: Configure modules according to their type")
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240405090929.1184068-6-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: Intel: avs: Fix config_length for config-less copiers
Cezary Rojewski [Fri, 5 Apr 2024 09:09:20 +0000 (11:09 +0200)]
ASoC: Intel: avs: Fix config_length for config-less copiers

Copier's config_length shall always be at least one even if there is no
configuration payload to carry. While the firmware treats
config_length=0 or 1 in the same manner, the driver shall initialize the
module properly.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240405090929.1184068-5-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: Intel: avs: Silence false-positive memcpy() warnings
Cezary Rojewski [Fri, 5 Apr 2024 09:09:19 +0000 (11:09 +0200)]
ASoC: Intel: avs: Silence false-positive memcpy() warnings

Commit df8fc4e934c1 ("kbuild: Enable -fstrict-flex-arrays=3") enforced
strict flex array declarations. This generates false-positive in form of:
"memcpy: detected field-spanning write". Avoid it by utilizing the
DECLARE_FLEX_ARRAY() macro.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240405090929.1184068-4-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: Intel: avs: Fix debug-slot offset calculation
Cezary Rojewski [Fri, 5 Apr 2024 09:09:18 +0000 (11:09 +0200)]
ASoC: Intel: avs: Fix debug-slot offset calculation

For resources with ID other than 0 the current calculus is incorrect.

Fixes: 275b583d047a ("ASoC: Intel: avs: ICL-based platforms support")
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240405090929.1184068-3-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: Intel: avs: Restore stream decoupling on prepare
Amadeusz Sławiński [Fri, 5 Apr 2024 09:09:17 +0000 (11:09 +0200)]
ASoC: Intel: avs: Restore stream decoupling on prepare

Revert changes from commit b87b8f43afd5 ("ASoC: Intel: avs: Drop
superfluous stream decoupling") to restore working streaming during S3.

Fixes: b87b8f43afd5 ("ASoC: Intel: avs: Drop superfluous stream decoupling")
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240405090929.1184068-2-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: SOF: Intel: hda-ctrl: only clear WAKESTS for HDaudio codecs
Pierre-Louis Bossart [Thu, 4 Apr 2024 19:03:57 +0000 (14:03 -0500)]
ASoC: SOF: Intel: hda-ctrl: only clear WAKESTS for HDaudio codecs

When a PME wake happens due to a SoundWire wake, we currently clear
all WAKESTS bits during the resume operation initiated by the PCI
subsystem. As a result, we are unable to identify which SoundWire
links need to be resumed and don't properly handle jack detection.

This patch only clears the WAKESTS bits for the HDaudio codecs
detected earlier.

Note that we still clear all WAKESTS bits unconditionally in
hda_dsp_ctrl_stop_chip(). The existing behavior is potentially racy if
e.g. a jack event happens during a suspend routine, but there's a risk
of breaking shutdown or reboot sequences so the code is left as is for
now.

Closes: https://github.com/thesofproject/linux/issues/4687
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: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Keqiao Zhang <keqiao.zhang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://msgid.link/r/20240404190357.138073-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: SOF: Intel: hda-codec: preserve WAKEEN values
Pierre-Louis Bossart [Thu, 4 Apr 2024 19:03:56 +0000 (14:03 -0500)]
ASoC: SOF: Intel: hda-codec: preserve WAKEEN values

Since LunarLake, we use the HDadio WAKEEN/WAKESTS to detect wakes for
SoundWire codecs. Unfortunately, the existing code in
hda_codec_jack_wake_enable() unconditionally resets the WAKEEN bits.

This patch changes the initialization to preserve SoundWire WAKEEN
bits. For HDAudio codecs the same strategy is used, WAKEEN is only set
when the jacktbl.used property is set.

Closes: https://github.com/thesofproject/linux/issues/4687
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: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Keqiao Zhang <keqiao.zhang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://msgid.link/r/20240404190357.138073-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: SOF: Intel: lnl: add helper to detect SoundWire wakes
Pierre-Louis Bossart [Thu, 4 Apr 2024 19:03:55 +0000 (14:03 -0500)]
ASoC: SOF: Intel: lnl: add helper to detect SoundWire wakes

The global STATESTS register will provide information on all
links. Rather than iterate on all possible links, the helpers only
filters the range of possible bits for a quick lookup. The
process_wakeen() helper will walk through all the links and deal with
wakes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://msgid.link/r/20240404190357.138073-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: SOF: Intel: hda-ctrl: add missing WAKE_STS clear
Pierre-Louis Bossart [Thu, 4 Apr 2024 19:03:54 +0000 (14:03 -0500)]
ASoC: SOF: Intel: hda-ctrl: add missing WAKE_STS clear

For some reason, the programming sequences in the SOF driver do not
include a clear of the WAKE_STS bits before resetting the controller.

This clear is not formally required by the HDaudio specification, but
was added to harden the snd-hda-reset back in 2007. Adding this
sequence back avoids an issue reported by the Intel CI.

Closes: https://github.com/thesofproject/linux/issues/4889
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://msgid.link/r/20240404190357.138073-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: SOF: Intel: hda-stream: clarify comment
Pierre-Louis Bossart [Thu, 4 Apr 2024 18:54:48 +0000 (13:54 -0500)]
ASoC: SOF: Intel: hda-stream: clarify comment

The Yoda grammar and multiple negatives are unclear.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://msgid.link/r/20240404185448.136157-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: SOF: Intel: don't ignore IOC interrupts for non-audio transfers
Pierre-Louis Bossart [Thu, 4 Apr 2024 18:54:47 +0000 (13:54 -0500)]
ASoC: SOF: Intel: don't ignore IOC interrupts for non-audio transfers

The HDaudio stream interrupts are ignored unless the stream is PCM or
compressed audio. For alternate non-audio usages, such as code loader
or SoundWire BPT case, the IOC interrupt on the last buffer
transferred is silently ignored.

This patch adds a 'struct completion' for each HDaudio stream. This
capability helps detect if the non-audio data transfers
completed. There is no performance impact for audio streams.

In the code loader case, the code currently starts the DMA and
directly checks if the firmware status changes, without checking if
the DMA succeeded. With a first pass waiting for the DMA to complete,
system validation engineers can gather more precise timing information
on firmware boot time or root-cause boot failures more accurately.

A timeout of 500ms was selected for the code loader DMA. This is an
experimental value which should be more than enough - higher values
would certainly be problematic from a usage/latency perspective.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://msgid.link/r/20240404185448.136157-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: SOF: Intel: hda-loader: change signature of code loader helpers
Pierre-Louis Bossart [Thu, 4 Apr 2024 18:54:46 +0000 (13:54 -0500)]
ASoC: SOF: Intel: hda-loader: change signature of code loader helpers

We need to reuse cl_prepare, cl_trigger and cl_cleanup helpers from a
SoundWire context where only the device information is
available. Rather than pass the 'sdev' argument, use get_drvdata() to
retrieve the required structure.

For consistency, rename hda_cl_stream_prepare() as hda_cl_prepare().

These three helpers are also exported so that they can be referenced
from another module.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://msgid.link/r/20240404185448.136157-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: SOF: Intel: hda-loader: add flag to tag ICCMAX stream
Pierre-Louis Bossart [Thu, 4 Apr 2024 18:54:45 +0000 (13:54 -0500)]
ASoC: SOF: Intel: hda-loader: add flag to tag ICCMAX stream

The existing code conflates capture stream and ICCMAX stream. This
isn't going to be true any longer when we add support for SDW BPT RX
streams. Add a boolean tag to flag ICCMAX streams.

No functionality change, only future-proofing change.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://msgid.link/r/20240404185448.136157-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: Drop soc-topology ABI v4 support
Mark Brown [Thu, 4 Apr 2024 17:09:18 +0000 (18:09 +0100)]
ASoC: Drop soc-topology ABI v4 support

Merge series from Cezary Rojewski <cezary.rojewski@intel.com>:

This patchset impacts UAPI.

The only known users of the soc-topology ABI v4 are Chromebook
configurations. Starting from kernel v5.4, all of them are making use of
soc-topology ABI v5. The patchset first removes obsolete code from the
Intel's skylake-driver - the driver of choice for the mentioned
Chromebooks - and then proceeds with removal of relevant soc-topology.c
and uapi bits.

Cezary Rojewski (4):
  ASoC: Intel: Skylake: Remove soc-topology ABI v4 support
  ASoC: topology: Remove ABI v4 support
  ASoC: topology: Cleanup after ABI v4 support removal
  ASoC: topology: Remove obsolete ABI v4 structs

 include/uapi/sound/asoc.h               |  56 ------
 include/uapi/sound/skl-tplg-interface.h |  74 --------
 sound/soc/intel/skylake/skl-topology.c  | 169 -----------------
 sound/soc/soc-topology.c                | 241 ++----------------------
 4 files changed, 18 insertions(+), 522 deletions(-)

--
2.25.1

4 months agoASoC: SOF: Clean up sof_ipc_flood_dfs_write()
Dan Carpenter [Thu, 4 Apr 2024 07:34:53 +0000 (10:34 +0300)]
ASoC: SOF: Clean up sof_ipc_flood_dfs_write()

This function doesn't support partial writes so using
simple_write_to_buffer() doesn't really make sense.  It's better to
just use copy_from_user().

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://msgid.link/r/a35dded2-392b-4ccb-9dbb-d782ac9b6547@moroto.mountain
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: SOF: Disable pointless writes to debugfs file
Dan Carpenter [Thu, 4 Apr 2024 07:38:45 +0000 (10:38 +0300)]
ASoC: SOF: Disable pointless writes to debugfs file

The permissions on this debugfs file are 0444 so it can't be written to.
And writing to the file hasn't done anything since commit 6e9548cdb30e
("ASoC: SOF: Convert the generic IPC flood test into SOF client").
Delete the write function.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://msgid.link/r/9d2477cf-25aa-4d12-818f-fdafc9aaa28a@moroto.mountain
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: topology: Remove obsolete ABI v4 structs
Cezary Rojewski [Wed, 3 Apr 2024 09:16:29 +0000 (11:16 +0200)]
ASoC: topology: Remove obsolete ABI v4 structs

There are no users of soc-topology ABI v4 since kernel v5.4 and no
kernel code makes use of them.

Cc: Curtis Malainey <cujomalainey@chromium.org>
Cc: Łukasz Majczak <lmajczak@google.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240403091629.647267-5-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: topology: Cleanup after ABI v4 support removal
Cezary Rojewski [Wed, 3 Apr 2024 09:16:28 +0000 (11:16 +0200)]
ASoC: topology: Cleanup after ABI v4 support removal

Flag 'abi_match' along with several other local variables has no purpose
with v4 related members removed.

Cc: Curtis Malainey <cujomalainey@chromium.org>
Cc: Łukasz Majczak <lmajczak@google.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240403091629.647267-4-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: topology: Remove ABI v4 support
Cezary Rojewski [Wed, 3 Apr 2024 09:16:27 +0000 (11:16 +0200)]
ASoC: topology: Remove ABI v4 support

There are no users of soc-topology ABI v4 since kernel v5.4 so remove
all v4 -> v5 converters.

Cc: Curtis Malainey <cujomalainey@chromium.org>
Cc: Łukasz Majczak <lmajczak@google.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240403091629.647267-3-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: Intel: Skylake: Remove soc-topology ABI v4 support
Cezary Rojewski [Wed, 3 Apr 2024 09:16:26 +0000 (11:16 +0200)]
ASoC: Intel: Skylake: Remove soc-topology ABI v4 support

The only known users are Chromebook configurations. Starting from
kernel v5.4, all of them are making use of soc-topology ABI v5.

Cc: Curtis Malainey <cujomalainey@chromium.org>
Cc: Łukasz Majczak <lmajczak@google.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240403091629.647267-2-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: SOF: imx: stop using the imx8_*_clocks API
Mark Brown [Thu, 4 Apr 2024 14:31:30 +0000 (15:31 +0100)]
ASoC: SOF: imx: stop using the imx8_*_clocks API

Merge series from Laurentiu Mihalcea <laurentiumihalcea111@gmail.com>:

The imx8_*_clocks API requires keeping track of all of the clocks used
by the IMX SOF driver via an array. This is unnecessary and doesn't
scale well. As such, remove it altogether and replace it with
devm_clk_bulk_get_all() and friends.

4 months agoASoC: nau8822: Remove unused member from struct
Francesco Dolcini [Thu, 4 Apr 2024 11:19:53 +0000 (13:19 +0200)]
ASoC: nau8822: Remove unused member from struct

Remove unused mclk_idx struct member.

Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Link: https://msgid.link/r/20240404111953.99287-1-francesco@dolcini.it
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: codecs: rk3308: fix building without CONFIG_OF
Arnd Bergmann [Thu, 4 Apr 2024 09:57:34 +0000 (11:57 +0200)]
ASoC: codecs: rk3308: fix building without CONFIG_OF

The newly added codec has an extraneous of_match_ptr() annotation for
the ID table:

sound/soc/codecs/rk3308_codec.c:956:34: error: 'rk3308_codec_of_match' defined but not used [-Werror=unused-const-variable=]
  956 | static const struct of_device_id rk3308_codec_of_match[] = {

Remove it to avoid introducing a warning when -Wunused-const-variable
gets enabled by default:

Fixes: 4ed0915f5bc4 ("ASoC: codecs: Add RK3308 internal audio codec driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://msgid.link/r/20240404095755.650364-1-arnd@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoALSA: cirrus: Tidy up of firmware control read/write
Mark Brown [Wed, 3 Apr 2024 19:45:32 +0000 (20:45 +0100)]
ALSA: cirrus: Tidy up of firmware control read/write

Merge series from Richard Fitzgerald <rf@opensource.cirrus.com>:

This set of patches factors out some repeated code to clean up
firmware control read/write functions, and removes some redundant
control notification code.

base-commit: f193957b0fbbba397c8bddedf158b3bf7e4850fc

4 months agoASoC: codecs: rk3308: fix build warning without OF
Mark Brown [Wed, 3 Apr 2024 17:56:57 +0000 (18:56 +0100)]
ASoC: codecs: rk3308: fix build warning without OF

Merge series from Luca Ceresoli <luca.ceresoli@bootlin.com>:

This small series fixes a build warning reported by kernel test robot
<lkp@intel.com> and improves the Kconfig entry.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
Changes in v2:
- Replaced v1 implementation with __maybe_unused
- Added patch to depend on || COMPILE_TEST
- Link to v1: https://lore.kernel.org/r/20240329-rk3308-audio-codec-fix-warning-v1-1-b9d177fcd6c9@bootlin.com

---
Luca Ceresoli (2):
      ASoC: codecs: rk3308: fix "defined but not used" warning on !OF
      ASoC: codecs: rk3308: depend on ARM64 || COMPILE_TEST

 sound/soc/codecs/Kconfig        | 1 +
 sound/soc/codecs/rk3308_codec.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
---
base-commit: 4ed0915f5bc4bcc81bca783a5b984f3d81e9764e
change-id: 20240329-rk3308-audio-codec-fix-warning-51bb572ebd96

Best regards,
--
Luca Ceresoli <luca.ceresoli@bootlin.com>

4 months agoASoC: SOF: Intel: mtl/lnl: Improve firmware boot state
Mark Brown [Wed, 3 Apr 2024 15:28:31 +0000 (16:28 +0100)]
ASoC: SOF: Intel: mtl/lnl: Improve firmware boot state

Merge series from Peter Ujfalusi <peter.ujfalusi@linux.intel.com>:

This series improves the firmware/boot state handling which will allow
failed IMR boot recovery and human readable boot failure decoding.

Additionally a new debugfs file is added to force a purge/clean boot
of the DSP for developers.

4 months agoALSA: hda: hda_cs_dsp_ctl: Remove notification of driver write
Simon Trimmer [Mon, 25 Mar 2024 11:31:27 +0000 (11:31 +0000)]
ALSA: hda: hda_cs_dsp_ctl: Remove notification of driver write

Any control that the driver is updating should be marked as SYSTEM and
therefore will not have an ALSA control to notify.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://msgid.link/r/20240325113127.112783-6-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: wm_adsp: Remove notification of driver write
Simon Trimmer [Mon, 25 Mar 2024 11:31:26 +0000 (11:31 +0000)]
ASoC: wm_adsp: Remove notification of driver write

Any control that the driver is updating should be marked as SYSTEM and
therefore will not have an ALSA control to notify.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://msgid.link/r/20240325113127.112783-5-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoALSA: hda: hda_cs_dsp_ctl: Use cs_dsp_coeff_lock_and_[read|write]_ctrl()
Simon Trimmer [Mon, 25 Mar 2024 11:31:25 +0000 (11:31 +0000)]
ALSA: hda: hda_cs_dsp_ctl: Use cs_dsp_coeff_lock_and_[read|write]_ctrl()

Using the cs_dsp_coeff_lock_and_[read|write]_ctrl() wrappers tidies
the calling functions as it does not need to manage the DSP pwr_lock.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://msgid.link/r/20240325113127.112783-4-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: wm_adsp: Use cs_dsp_coeff_lock_and_[read|write]_ctrl()
Simon Trimmer [Mon, 25 Mar 2024 11:31:24 +0000 (11:31 +0000)]
ASoC: wm_adsp: Use cs_dsp_coeff_lock_and_[read|write]_ctrl()

Using the cs_dsp_coeff_lock_and_[read|write]_ctrl() wrappers tidies
the calling functions as it does not need to manage the DSP pwr_lock.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://msgid.link/r/20240325113127.112783-3-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agofirmware: cs_dsp: Add locked wrappers for coeff read and write
Simon Trimmer [Mon, 25 Mar 2024 11:31:23 +0000 (11:31 +0000)]
firmware: cs_dsp: Add locked wrappers for coeff read and write

It is a common pattern for functions to take and release the DSP
pwr_lock over the cs_dsp calls to read and write firmware controls.
Add wrapper functions to do this sequence so that the calling code can
be simplified to a single function call..

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://msgid.link/r/20240325113127.112783-2-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: Merge up fixes
Mark Brown [Wed, 3 Apr 2024 15:07:41 +0000 (16:07 +0100)]
ASoC: Merge up fixes

Some of these, particularly the wm_adsp one in the immediate case, are
needed as a basis for new work.

4 months agoASoC: Merge up left over v6.8 fix
Mark Brown [Wed, 3 Apr 2024 15:03:56 +0000 (16:03 +0100)]
ASoC: Merge up left over v6.8 fix

This v6.8 change didn't make it into the release, send it as a fix for
v6.9.

4 months agoASoC: SOF: imx: remove imx8_*_clocks API
Laurentiu Mihalcea [Thu, 28 Mar 2024 22:12:01 +0000 (00:12 +0200)]
ASoC: SOF: imx: remove imx8_*_clocks API

Since the i.MX drivers no longer use the imx8_*_clocks API
this can be removed.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://msgid.link/r/20240328221201.24722-3-laurentiumihalcea111@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: SOF: imx: drop usage of the imx8_*_clocks API
Laurentiu Mihalcea [Thu, 28 Mar 2024 22:12:00 +0000 (00:12 +0200)]
ASoC: SOF: imx: drop usage of the imx8_*_clocks API

Currently, the driver has to keep track of all the clocks
it uses via an array of "struct clk_bulk_data", which doesn't
scale well and is unnecessary. As such, replace the usage of
the imx8_*_clocks with "devm_clk_bulk_get_all()" and friends.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://msgid.link/r/20240328221201.24722-2-laurentiumihalcea111@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: codecs: rk3308: depend on ARM64 || COMPILE_TEST
Luca Ceresoli [Wed, 3 Apr 2024 11:03:19 +0000 (13:03 +0200)]
ASoC: codecs: rk3308: depend on ARM64 || COMPILE_TEST

This codec is only known to exist in the RK3308 ARM64 SoC, so depend on it
except for compile test cases. Note that the driver won't probe without
CONFIG_OF, but ARM64 selects OF already so it is not needed.

Suggested-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Link: https://msgid.link/r/20240403-rk3308-audio-codec-fix-warning-v2-2-816bae4c1dc5@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: codecs: rk3308: fix "defined but not used" warning on !OF
Luca Ceresoli [Wed, 3 Apr 2024 11:03:18 +0000 (13:03 +0200)]
ASoC: codecs: rk3308: fix "defined but not used" warning on !OF

Building with CONFIG_OF=n triggers:

  warning: 'rk3308_codec_of_match' defined but not used [-Wunused-const-variable=]
  warning: unused variable 'rk3308_codec_of_match' [-Wunused-const-variable]

Even though OF is needed for probing, fix by declaring as __maybe_unused to
still allow building on non-OF configurations for build testing.

Fixes: 9fdd7b45da18 ("arm64: defconfig: enable Rockchip RK3308 internal audio codec driver")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202403271905.BYbGJiPi-lkp@intel.com/
Closes: https://lore.kernel.org/oe-kbuild-all/202403271907.0z0uuG5I-lkp@intel.com/
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Link: https://msgid.link/r/20240403-rk3308-audio-codec-fix-warning-v2-1-816bae4c1dc5@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: SOF: Intel: mtl: Correct the mtl_dsp_dump output
Peter Ujfalusi [Wed, 3 Apr 2024 10:52:10 +0000 (13:52 +0300)]
ASoC: SOF: Intel: mtl: Correct the mtl_dsp_dump output

The ROM/firmware state handling has changed between CAVS and ACE
architecture:
CAVS: ROM and firmware uses the SRAM window for the state and status/error
code reporting

ACE: ROM code is using two registers to report the state and error while
the firmware is using the SRAM window to report states and status/error
codes.

Use the generic hda_dsp_get_state() to decode ROM state and error codes and
print out the firmware state and status/error code only if the SRAM
window is accessible - the firmware is booted and the Status readout is
not 0xffffffff.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
Link: https://msgid.link/r/20240403105210.17949-8-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: SOF: Intel: hda-dsp/mtl: Add support for ACE ROM state codes
Peter Ujfalusi [Wed, 3 Apr 2024 10:52:09 +0000 (13:52 +0300)]
ASoC: SOF: Intel: hda-dsp/mtl: Add support for ACE ROM state codes

The ROM state codes differ between CAVS and ACE architecture, there is a
slight overlap.
Add the ACE related state defines to mtl.h, introduce new table and
use it on case the function is called when running on ACE architecture.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
Link: https://msgid.link/r/20240403105210.17949-7-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: SOF: Intel: mtl: Implement firmware boot state check
Peter Ujfalusi [Wed, 3 Apr 2024 10:52:08 +0000 (13:52 +0300)]
ASoC: SOF: Intel: mtl: Implement firmware boot state check

With the corrected rom_status_reg values we can now add a check for target
boot status for firmware booting.
With the check now we can identify failed firmware boots (IMR boots) and
we can use the fallback to purge boot the DSP.

Fixes: 064520e8aeaa ("ASoC: SOF: Intel: Add support for MeteorLake (MTL)")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
Link: https://msgid.link/r/20240403105210.17949-6-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: SOF: Intel: mtl: Disable interrupts when firmware boot failed
Peter Ujfalusi [Wed, 3 Apr 2024 10:52:07 +0000 (13:52 +0300)]
ASoC: SOF: Intel: mtl: Disable interrupts when firmware boot failed

In case of error during the firmware boot we need to disable the interrupts
which were enabled as part of the boot sequence.

Fixes: 064520e8aeaa ("ASoC: SOF: Intel: Add support for MeteorLake (MTL)")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
Link: https://msgid.link/r/20240403105210.17949-5-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: SOF: Intel: lnl: Correct rom_status_reg
Peter Ujfalusi [Wed, 3 Apr 2024 10:52:06 +0000 (13:52 +0300)]
ASoC: SOF: Intel: lnl: Correct rom_status_reg

ACE2 architecture changed the place where the ROM updates the status code
from the shared SRAM window (and HFFLGP1QW0 in ACE1) to HFDSC register for
the status and HFDEC (HFDSC + 4) for the error code.

The rom_status_reg is not used on LNL because it was wrongly assigned based
on older platform convention (SRAM window) and it was giving inconsistent
readings.

Add new header file for lnl specific register definitions.

Fixes: 64a63d9914a5 ("ASoC: SOF: Intel: LNL: Add support for Lunarlake platform")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
Link: https://msgid.link/r/20240403105210.17949-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: SOF: Intel: mtl: Correct rom_status_reg
Peter Ujfalusi [Wed, 3 Apr 2024 10:52:05 +0000 (13:52 +0300)]
ASoC: SOF: Intel: mtl: Correct rom_status_reg

ACE1 architecture changed the place where the ROM updates the status code
from the shared SRAM window to HFFLGP1QW0 register for the status and
HFFLGP1QW0 + 4 for the error code.

The rom_status_reg is not used on MTL because it was wrongly assigned based
on older platform convention (SRAM window) and it was giving inconsistent
readings.

Fixes: 064520e8aeaa ("ASoC: SOF: Intel: Add support for MeteorLake (MTL)")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
Link: https://msgid.link/r/20240403105210.17949-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: SOF: Intel: hda: Create debugfs file to force a clean DSP boot
Peter Ujfalusi [Wed, 3 Apr 2024 10:52:04 +0000 (13:52 +0300)]
ASoC: SOF: Intel: hda: Create debugfs file to force a clean DSP boot

When IMR boot is supported on a platform it is always going to be used to
boot the DSP unless some catastrophic event happens.
There is no way for a developer to force a clean DSP boot without removing
and re-inserting the modules.

Create a 'skip_imr_boot' debugfs file which can be used to force the
next DSP boot as clean (prune) boot.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://msgid.link/r/20240403105210.17949-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: Intel: avs: rt5682: Constify card_headset_pins
Amadeusz Sławiński [Wed, 3 Apr 2024 09:31:45 +0000 (11:31 +0200)]
ASoC: Intel: avs: rt5682: Constify card_headset_pins

card_headset_pins is never modified, mark it const.

Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://msgid.link/r/20240403093145.3375857-11-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: Intel: avs: rt5663: Constify card_headset_pins
Amadeusz Sławiński [Wed, 3 Apr 2024 09:31:44 +0000 (11:31 +0200)]
ASoC: Intel: avs: rt5663: Constify card_headset_pins

card_headset_pins is never modified, mark it const.

Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://msgid.link/r/20240403093145.3375857-10-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: Intel: avs: rt298: Constify card_headset_pins
Amadeusz Sławiński [Wed, 3 Apr 2024 09:31:43 +0000 (11:31 +0200)]
ASoC: Intel: avs: rt298: Constify card_headset_pins

card_headset_pins is never modified, mark it const.

Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://msgid.link/r/20240403093145.3375857-9-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: Intel: avs: rt286: Constify card_headset_pins
Amadeusz Sławiński [Wed, 3 Apr 2024 09:31:42 +0000 (11:31 +0200)]
ASoC: Intel: avs: rt286: Constify card_headset_pins

card_headset_pins is never modified, mark it const.

Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://msgid.link/r/20240403093145.3375857-8-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: Intel: avs: rt274: Constify card_headset_pins
Amadeusz Sławiński [Wed, 3 Apr 2024 09:31:41 +0000 (11:31 +0200)]
ASoC: Intel: avs: rt274: Constify card_headset_pins

card_headset_pins is never modified, mark it const.

Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://msgid.link/r/20240403093145.3375857-7-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: Intel: avs: nau8825: Constify card_headset_pins
Amadeusz Sławiński [Wed, 3 Apr 2024 09:31:40 +0000 (11:31 +0200)]
ASoC: Intel: avs: nau8825: Constify card_headset_pins

card_headset_pins is never modified, mark it const.

Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://msgid.link/r/20240403093145.3375857-6-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: Intel: avs: es8336: Constify card_headset_pins
Amadeusz Sławiński [Wed, 3 Apr 2024 09:31:39 +0000 (11:31 +0200)]
ASoC: Intel: avs: es8336: Constify card_headset_pins

card_headset_pins is never modified, mark it const.

Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://msgid.link/r/20240403093145.3375857-5-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: Intel: avs: hdaudio: Constify probing_link
Amadeusz Sławiński [Wed, 3 Apr 2024 09:31:38 +0000 (11:31 +0200)]
ASoC: Intel: avs: hdaudio: Constify probing_link

probing_link is passed to devm_kmemdup, and is never modified, may as
well mark it const.

Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://msgid.link/r/20240403093145.3375857-4-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: Intel: avs: Use devm_kstrdup_const
Amadeusz Sławiński [Wed, 3 Apr 2024 09:31:37 +0000 (11:31 +0200)]
ASoC: Intel: avs: Use devm_kstrdup_const

FW name is constant and we just duplicate it, use const variant of
devm_kstrdup to possibly save a bit of memory.

Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://msgid.link/r/20240403093145.3375857-3-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: Intel: avs: hdaudio: Use devm_kstrdup_const
Amadeusz Sławiński [Wed, 3 Apr 2024 09:31:36 +0000 (11:31 +0200)]
ASoC: Intel: avs: hdaudio: Use devm_kstrdup_const

HDA codec name is constant and we just duplicate it, use const variant
of devm_kstrdup to possibly save a bit of memory.

Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://msgid.link/r/20240403093145.3375857-2-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: rsnd: reg cleanup
Mark Brown [Wed, 3 Apr 2024 10:04:23 +0000 (11:04 +0100)]
ASoC: rsnd: reg cleanup

Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

These are Renesas Sound driver cleanups for Gen3/Gen4.

4 months agoASoC: SOF: cppcheck fixes and debugfs addition
Mark Brown [Tue, 2 Apr 2024 21:30:44 +0000 (22:30 +0100)]
ASoC: SOF: cppcheck fixes and debugfs addition

Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

Small changes with 3 cppcheck fixes and the firmware version now
visible with debugfs instead of only via dmesg logs.

4 months agoASoC: SOF: Intel: improve SoundWire support for
Mark Brown [Tue, 2 Apr 2024 21:19:33 +0000 (22:19 +0100)]
ASoC: SOF: Intel: improve SoundWire support for

Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

This patchset contains important updates for SoundWire support.

We initially implemented support for multiple amplifiers on different
links using a single HDaudio DMA transfer. To align with the other OS,
the 'aggregation' is now supported by the firmware. This change in
directions has kernel impacts, since we now have multiple HDaudio DMAs
to program and start, but since there are no platforms released so far
there's no end-user impact.

In addition, the behavior in case of xruns is improved by clearing the
PCM states and better handling of the hw_free case.

Note that the hw_free support will compile but will only be functional
with the companion patch "soundwire: intel: add intel_free_stream() back"
already applied in the SoundWire tree.

4 months agoASoC: Use snd_ctl_find_id_mixer() instead of
Mark Brown [Tue, 2 Apr 2024 21:19:21 +0000 (22:19 +0100)]
ASoC: Use snd_ctl_find_id_mixer() instead of

Merge series from Richard Fitzgerald <rf@opensource.cirrus.com>:

The first two patches change snd_soc_card_get_kcontrol() to use the
core snd_ctl_find_id_mixer() functionality instead of open-coding its
own list walk.

The last patch adds a KUnit test for this, which was tested on the
original and modified code.

4 months agoASoC: codecs: ES8326: solve some hp issues and
Mark Brown [Tue, 2 Apr 2024 20:01:43 +0000 (21:01 +0100)]
ASoC: codecs: ES8326: solve some hp issues and

Merge series from Zhang Yi <zhangyi@everest-semi.com>:

We solved some issues related to headphone detection.And for using
the same configuration in different power conditions,we modified the
clock table

4 months agoASoC: dt-bindings: fsl-asoc-card: convert to YAML
Shengjiu Wang [Mon, 1 Apr 2024 12:54:16 +0000 (20:54 +0800)]
ASoC: dt-bindings: fsl-asoc-card: convert to YAML

Convert the fsl-asoc-card binding to YAML.

When testing dtbs_check, found below compatible strings
are not listed in document:

fsl,imx-sgtl5000
fsl,imx53-cpuvo-sgtl5000
fsl,imx51-babbage-sgtl5000
fsl,imx53-m53evk-sgtl5000
fsl,imx53-qsb-sgtl5000
fsl,imx53-voipac-sgtl5000
fsl,imx6-armadeus-sgtl5000
fsl,imx6-rex-sgtl5000
fsl,imx6-sabreauto-cs42888
fsl,imx6-wandboard-sgtl5000
fsl,imx6dl-nit6xlite-sgtl5000
fsl,imx6q-ba16-sgtl5000
fsl,imx6q-nitrogen6_max-sgtl5000
fsl,imx6q-nitrogen6_som2-sgtl5000
fsl,imx6q-nitrogen6x-sgtl5000
fsl,imx6q-sabrelite-sgtl5000
fsl,imx6q-sabresd-wm8962
fsl,imx6q-udoo-ac97
fsl,imx6q-ventana-sgtl5000
fsl,imx6sl-evk-wm8962
fsl,imx6sx-sdb-mqs
fsl,imx6sx-sdb-wm8962
fsl,imx7d-evk-wm8960
karo,tx53-audio-sgtl5000
tq,imx53-mba53-sgtl5000

So add them in yaml file to pass the test.

Also correct the 'dai-format' to 'format' in document.

For 'audio-routing', the items are not listed. Because
this fsl-asoc-card is generic driver, which supports several
codecs, if list all the items, there will be a long list.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://msgid.link/r/1711976056-19884-3-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: SOF: ipc4-topology: Save the ALH DAI index during hw_params
Ranjani Sridharan [Tue, 2 Apr 2024 15:18:28 +0000 (10:18 -0500)]
ASoC: SOF: ipc4-topology: Save the ALH DAI index during hw_params

The node_id for multi-gateway ALH DAI's get overwritten with the
group_id during the DAI copier's ipc_prepare op. So, save the ALH
dai_index during the BE DAI hw_params in the dai_index field of struct
ipc4_copier and use that to set the device ID in the configuration blob.
This will avoid errors during copier init after an xrun.

Note that the dai_index is typically set in topology for DMIC/SSP, but
it's not used for ALH. Reclaiming this dai_index field to store the
node_id does not generate a conflict with topology-defined values.

Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://msgid.link/r/20240402151828.175002-18-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: SOF: pcm: reset all PCM sources in case of xruns
Pierre-Louis Bossart [Tue, 2 Apr 2024 15:18:27 +0000 (10:18 -0500)]
ASoC: SOF: pcm: reset all PCM sources in case of xruns

With the delayed stops, the xrun handling is problematic: the
applications expects everything to be reset but the firmware and DMA
are still in a PAUSED state.

This patch makes sure the prepare while pending_stop is set is
special-cased.

Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Co-developed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://msgid.link/r/20240402151828.175002-17-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
4 months agoASoC: SOF: pcm: add pending_stop state variable
Pierre-Louis Bossart [Tue, 2 Apr 2024 15:18:26 +0000 (10:18 -0500)]
ASoC: SOF: pcm: add pending_stop state variable

Add a state variable to keep track of delayed stops, in case
pcm_ops->platform_stop_during_hw_free is set.

This patch should be iso-functionality, possibly removing no-op
cases. The main purpose of this new state variable is to prepare a
follow-up patch to reset all PCM and DMAs in case of stop/prepare xrun
sequences.

Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://msgid.link/r/20240402151828.175002-16-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>