platform/kernel/linux-starfive.git
2 years agoASoC: mt6358: Add endianness flag in snd_soc_component_driver
Charles Keepax [Wed, 4 May 2022 17:08:45 +0000 (18:08 +0100)]
ASoC: mt6358: Add endianness flag in snd_soc_component_driver

The endianness flag is used on the CODEC side to specify an
ambivalence to endian, typically because it is lost over the hardware
link. This device receives audio over an I2S DAI and as such should
have endianness applied.

As the core will now expand the formats to cover both endian types,
remove the redundant manual specification of both.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220504170905.332415-19-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: mt6351: Add endianness flag in snd_soc_component_driver
Charles Keepax [Wed, 4 May 2022 17:08:44 +0000 (18:08 +0100)]
ASoC: mt6351: Add endianness flag in snd_soc_component_driver

The endianness flag is used on the CODEC side to specify an
ambivalence to endian, typically because it is lost over the hardware
link. This device receives audio over an I2S DAI and as such should
have endianness applied.

As the core will now expand the formats to cover both endian types,
remove the redundant manual specification of both.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220504170905.332415-18-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: lochnagar: Add endianness flag in snd_soc_component_driver
Charles Keepax [Wed, 4 May 2022 17:08:43 +0000 (18:08 +0100)]
ASoC: lochnagar: Add endianness flag in snd_soc_component_driver

The endianness flag is used on the CODEC side to specify an
ambivalence to endian, typically because it is lost over the hardware
link. This device receives audio over an I2S DAI and as such should
have endianness applied.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220504170905.332415-17-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: cx2072x: Add endianness flag in snd_soc_component_driver
Charles Keepax [Wed, 4 May 2022 17:08:42 +0000 (18:08 +0100)]
ASoC: cx2072x: Add endianness flag in snd_soc_component_driver

The endianness flag is used on the CODEC side to specify an
ambivalence to endian, typically because it is lost over the hardware
link. This device receives audio over an I2S DAI and as such should
have endianness applied.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220504170905.332415-16-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: cs35l41: Add endianness flag in snd_soc_component_driver
Charles Keepax [Wed, 4 May 2022 17:08:41 +0000 (18:08 +0100)]
ASoC: cs35l41: Add endianness flag in snd_soc_component_driver

The endianness flag is used on the CODEC side to specify an
ambivalence to endian, typically because it is lost over the hardware
link. This device receives audio over an I2S DAI and as such should
have endianness applied.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220504170905.332415-15-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: cs4234: Add endianness flag in snd_soc_component_driver
Charles Keepax [Wed, 4 May 2022 17:08:40 +0000 (18:08 +0100)]
ASoC: cs4234: Add endianness flag in snd_soc_component_driver

The endianness flag is used on the CODEC side to specify an
ambivalence to endian, typically because it is lost over the hardware
link. This device receives audio over an I2S DAI and as such should
have endianness applied.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220504170905.332415-14-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: adau1372: Add endianness flag in snd_soc_component_driver
Charles Keepax [Wed, 4 May 2022 17:08:39 +0000 (18:08 +0100)]
ASoC: adau1372: Add endianness flag in snd_soc_component_driver

The endianness flag is used on the CODEC side to specify an
ambivalence to endian, typically because it is lost over the hardware
link. This device receives audio over an I2S DAI and as such should
have endianness applied.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220504170905.332415-13-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: max98504: Add endianness flag in snd_soc_component_driver
Charles Keepax [Wed, 4 May 2022 17:08:38 +0000 (18:08 +0100)]
ASoC: max98504: Add endianness flag in snd_soc_component_driver

The endianness flag is used on the CODEC side to specify an
ambivalence to endian, typically because it is lost over the hardware
link. This device receives audio over a PDM DAI and as such should
have endianness applied.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220504170905.332415-12-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: hdac_hda: Add endianness flag in snd_soc_component_driver
Charles Keepax [Wed, 4 May 2022 17:08:37 +0000 (18:08 +0100)]
ASoC: hdac_hda: Add endianness flag in snd_soc_component_driver

The endianness flag is used on the CODEC side to specify an
ambivalence to endian, typically because it is lost over the hardware
link. This device receives audio over an HDA DAI and as such should
have endianness applied.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220504170905.332415-11-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: sta350: Remove redundant big endian formats
Charles Keepax [Wed, 4 May 2022 17:08:36 +0000 (18:08 +0100)]
ASoC: sta350: Remove redundant big endian formats

The CODEC already provides the endianness flag on its
snd_soc_component_driver structure, specifying it is ambivalent
to endian. The core will expand the formats to cover both
endian types, as such remove the redundant specification of both
endians.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220504170905.332415-10-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: sta32x: Remove redundant big endian formats
Charles Keepax [Wed, 4 May 2022 17:08:35 +0000 (18:08 +0100)]
ASoC: sta32x: Remove redundant big endian formats

The CODEC already provides the endianness flag on its
snd_soc_component_driver structure, specifying it is ambivalent
to endian. The core will expand the formats to cover both
endian types, as such remove the redundant specification of both
endians.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220504170905.332415-9-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: hdmi-codec: Remove redundant big endian formats
Charles Keepax [Wed, 4 May 2022 17:08:34 +0000 (18:08 +0100)]
ASoC: hdmi-codec: Remove redundant big endian formats

The CODEC already provides the endianness flag on its
snd_soc_component_driver structure, specifying it is ambivalent
to endian. The core will expand the formats to cover both
endian types, as such remove the redundant specification of both
endians.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220504170905.332415-8-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: cs4349: Remove redundant big endian formats
Charles Keepax [Wed, 4 May 2022 17:08:33 +0000 (18:08 +0100)]
ASoC: cs4349: Remove redundant big endian formats

The CODEC already provides the endianness flag on its
snd_soc_component_driver structure, specifying it is ambivalent
to endian. The core will expand the formats to cover both
endian types, as such remove the redundant specification of both
endians.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220504170905.332415-7-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: cs42l51: Remove redundant big endian formats
Charles Keepax [Wed, 4 May 2022 17:08:32 +0000 (18:08 +0100)]
ASoC: cs42l51: Remove redundant big endian formats

The CODEC already provides the endianness flag on its
snd_soc_component_driver structure, specifying it is ambivalent
to endian. The core will expand the formats to cover both
endian types, as such remove the redundant specification of both
endians.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220504170905.332415-6-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: cs4270: Remove redundant big endian formats
Charles Keepax [Wed, 4 May 2022 17:08:31 +0000 (18:08 +0100)]
ASoC: cs4270: Remove redundant big endian formats

The CODEC already provides the endianness flag on its
snd_soc_component_driver structure, specifying it is ambivalent
to endian. The core will expand the formats to cover both
endian types, as such remove the redundant specification of both
endians.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220504170905.332415-5-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: atmel-classd: Remove endianness flag on class d component
Charles Keepax [Wed, 4 May 2022 17:08:30 +0000 (18:08 +0100)]
ASoC: atmel-classd: Remove endianness flag on class d component

The endianness flag should have been removed when the driver was
ported across from having both a CODEC and CPU side component, to
just having a CPU component and using the dummy for the CODEC. The
endianness flag is used to indicate that the device is completely
ambivalent to the endianness of the data, typically due to the
endianness being lost over the hardware link (ie. the link defines
bit ordering). It's usage didn't have any effect when the driver
had both a CPU and CODEC component, since the union of those equals
the CPU side settings, but now causes the driver to falsely report
it supports big endian. Correct this by removing the flag.

Fixes: 1dfdbe73ccf9 ("ASoC: atmel-classd: remove codec component")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220504170905.332415-4-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: atmel-pdmic: Remove endianness flag on pdmic component
Charles Keepax [Wed, 4 May 2022 17:08:29 +0000 (18:08 +0100)]
ASoC: atmel-pdmic: Remove endianness flag on pdmic component

The endianness flag should have been removed when the driver was
ported across from having both a CODEC and CPU side component, to
just having a CPU component and using the dummy for the CODEC. The
endianness flag is used to indicate that the device is completely
ambivalent to the endianness of the data, typically due to the
endianness being lost over the hardware link (ie. the link defines
bit ordering). It's usage didn't have any effect when the driver
had both a CPU and CODEC component, since the union of those equals
the CPU side settings, but now causes the driver to falsely report
it supports big endian. Correct this by removing the flag.

Fixes: f3c668074a04 ("ASoC: atmel-pdmic: remove codec component")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220504170905.332415-3-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: soc-component: Add comment for the endianness flag
Charles Keepax [Wed, 4 May 2022 17:08:28 +0000 (18:08 +0100)]
ASoC: soc-component: Add comment for the endianness flag

Add a comment to make the purpose of the endianness flag on the
snd_soc_component structure more clear.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220504170905.332415-2-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: IPC4: Introduce message handling functionality
Mark Brown [Thu, 5 May 2022 15:08:39 +0000 (16:08 +0100)]
ASoC: SOF: IPC4: Introduce message handling functionality

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

The series adds the basic IPC4 message handling code, implementing the ipc
callbacks.
Due to the difference between IPC3 and IPC4 messaging we need to introduce new
message container for IPC4, but the SOF internal callbacks and structures can be
kept as they were and leaving it for the IPC specific code to handle the
differences.

The series provides the foundation for both lowe level (sound/soc/sof/intel) and
high level IPC4 implementation (topologies, firmware loading, control handling,
etc).

2 years agoASoC: cs43130: Re-use generic struct u16_fract
Andy Shevchenko [Mon, 2 May 2022 12:04:55 +0000 (15:04 +0300)]
ASoC: cs43130: Re-use generic struct u16_fract

Instead of custom data type re-use generic struct u16_fract.
No changes intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220502120455.84386-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: fsl_micfil: fix the naming style for mask definition
Shengjiu Wang [Thu, 5 May 2022 07:34:07 +0000 (15:34 +0800)]
ASoC: fsl_micfil: fix the naming style for mask definition

Remove the _SHIFT for the mask definition.

Fixes: 17f2142bae4b ("ASoC: fsl_micfil: use GENMASK to define register bit fields")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.kernel.org/r/1651736047-28809-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: ti: davinci-mcasp: Add dma-type for bcdma
Jayesh Choudhary [Thu, 5 May 2022 11:12:26 +0000 (16:42 +0530)]
ASoC: ti: davinci-mcasp: Add dma-type for bcdma

Set DMA type for ti-bcdma controller for AM62-SK.

Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Signed-off-by: Jayesh Choudhary <j-choudhary@ti.com>
Signed-off-by: Jai Luthra <j-luthra@ti.com>
Link: https://lore.kernel.org/r/20220505111226.29217-1-j-luthra@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc4: Add support for mandatory message handling functionality
Peter Ujfalusi [Thu, 5 May 2022 09:48:18 +0000 (12:48 +0300)]
ASoC: SOF: ipc4: Add support for mandatory message handling functionality

Introduce the initial and mandatory IPC ops support for IPC4 to enable
IPC communication with this new IPC protocol.

This patch implements the following ops:
tx_msg, rx_msg, set_get_data and get_reply.

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: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220505094818.10346-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Add initial header file for ipc4
Peter Ujfalusi [Thu, 5 May 2022 09:48:17 +0000 (12:48 +0300)]
ASoC: SOF: Add initial header file for ipc4

The header file contains essential structure definitions, description of
bit fields and bits in the ipc4 header and an internally used ipc4 message
container definition.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220505094818.10346-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Add rx_data pointer to snd_sof_ipc_msg struct
Peter Ujfalusi [Thu, 5 May 2022 09:48:16 +0000 (12:48 +0300)]
ASoC: SOF: Add rx_data pointer to snd_sof_ipc_msg struct

The rx_data pointer can be used by IPC implementations to pass the received
message (or part of the message, like the header) from platform code to
generic, high level IPC code.

IPC4 is going to be the first user of this as its implementation on Intel
platforms detaches the header and payload and the rx cannot be handled in
a similar way as it is implemented for ipc3.

If the rx_data is dynamically allocated, it is up to the platform code to
free it up.
After the message reception handling (rx_msg ops) returned, the pointer via
the msg->rx_data should be considered as invalid.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220505094818.10346-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: cs35l45: Enable BOOST
Richard Fitzgerald [Wed, 4 May 2022 13:44:58 +0000 (14:44 +0100)]
ASoC: cs35l45: Enable BOOST

Do not disable the boost converter during probe. The silicon
contains functional default tunings so the boost converter can
be left at the chip default enabled state.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220504134458.283780-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: soc-generic-dmaengine-pcm: Use default config when none is given
Sascha Hauer [Mon, 2 May 2022 13:13:35 +0000 (15:13 +0200)]
ASoC: soc-generic-dmaengine-pcm: Use default config when none is given

snd_dmaengine_pcm_register() can be passed a NULL pointer for the config
which means that the we have to test for pcm->config being non NULL
before accessing it. Make the code more straight forward by providing a
default config when none is passed. With this pcm->config is never NULL
and we can skip all the if (pcm->config) tests.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.kernel.org/r/20220502131335.2604158-1-s.hauer@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc3: Remove the ipc3-ops.h header file
Peter Ujfalusi [Wed, 4 May 2022 10:28:31 +0000 (13:28 +0300)]
ASoC: SOF: ipc3: Remove the ipc3-ops.h header file

Only the main IPC ops struct should be visible outside of IPC3 code to make
sure that the code is correctly abstracted.

Instead of keeping the ipc3-ops.h with only the high level ops struct
declaration, put the ipc3_ops to sof-priv.h and move all other ops struct
declaration into ipc3-priv.h

New IPC implementation should follow this route: the main IPC ops should be
declared in sof-priv.h and no other IPC version related header be used
for generic code.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20220504102831.10071-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Pull in fixes
Mark Brown [Wed, 4 May 2022 14:30:32 +0000 (15:30 +0100)]
ASoC: Pull in fixes

Cleanups for the dmaengine code build on top of current fixes.

2 years agoASoC: tpa6130: use i2c_match_id and simple i2c probe
Stephen Kitt [Sun, 1 May 2022 17:10:09 +0000 (19:10 +0200)]
ASoC: tpa6130: use i2c_match_id and simple i2c probe

As part of the ongoing i2c transition to the simple probe
("probe_new"), this patch uses i2c_match_id to retrieve the
driver_data for the probed device. The id parameter is thus no longer
necessary and the simple probe can be used instead.

The i2c id table is moved up before the probe function, as suggested
by Wolfram Sang.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Link: https://lore.kernel.org/r/20220501171009.45060-1-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: rk3328: fix disabling mclk on pclk probe failure
Nicolas Frattaroli [Wed, 27 Apr 2022 17:23:11 +0000 (19:23 +0200)]
ASoC: rk3328: fix disabling mclk on pclk probe failure

If preparing/enabling the pclk fails, the probe function should
unprepare and disable the previously prepared and enabled mclk,
which it doesn't do. This commit rectifies this.

Fixes: c32759035ad2 ("ASoC: rockchip: support ACODEC for rk3328")
Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
Reviewed-by: Katsuhiro Suzuki <katsuhiro@katsuster.net>
Link: https://lore.kernel.org/r/20220427172310.138638-1-frattaroli.nicolas@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: adau1761: Add ADAU1761-as-ADAU1361 compatibility mode
Ricard Wanderlof [Thu, 28 Apr 2022 16:46:35 +0000 (18:46 +0200)]
ASoC: adau1761: Add ADAU1761-as-ADAU1361 compatibility mode

During probe, determine if the chip is in fact an ADAU1761
even though an ADAU1361 is specified, and perform additional
operations to enable the ADAU1761 to behave as an ADAU1361,
i.e. disregarding the DSP and setting up routing and PM
transparently.

This enables either chip to be mounted when an ADAU1361 is specified.

Signed-off-by: Ricard Wanderlof <ricardw@axis.com>
Link: https://lore.kernel.org/r/alpine.DEB.2.21.2204281841290.5574@lnxricardw1.se.axis.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc3-topology: Correct get_control_data for non bytes payload
Peter Ujfalusi [Wed, 27 Apr 2022 18:52:21 +0000 (21:52 +0300)]
ASoC: SOF: ipc3-topology: Correct get_control_data for non bytes payload

It is possible to craft a topology where sof_get_control_data() would do
out of bounds access because it expects that it is only called when the
payload is bytes type.
Confusingly it also handles other types of controls, but the payload
parsing implementation is only valid for bytes.

Fix the code to count the non bytes controls and instead of storing a
pointer to sof_abi_hdr in sof_widget_data (which is only valid for bytes),
store the pointer to the data itself and add a new member to save the size
of the data.

In case of non bytes controls we store the pointer to the chanv itself,
which is just an array of values at the end.

In case of bytes control, drop the wrong cdata->data (wdata[i].pdata) check
against NULL since it is incorrect and invalid in this context.
The data is pointing to the end of cdata struct, so it should never be
null.

Reported-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Tested-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Link: https://lore.kernel.org/r/20220427185221.28928-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: rt5514: Fix event generation for "DSP Voice Wake Up" control
Mark Brown [Thu, 28 Apr 2022 16:24:44 +0000 (17:24 +0100)]
ASoC: rt5514: Fix event generation for "DSP Voice Wake Up" control

The driver has a custom put function for "DSP Voice Wake Up" which does
not generate event notifications on change, instead returning 0. Since we
already exit early in the case that there is no change this can be fixed
by unconditionally returning 1 at the end of the function.

Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20220428162444.3883147-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: dapm: Don't fold register value changes into notifications
Mark Brown [Thu, 28 Apr 2022 16:18:32 +0000 (17:18 +0100)]
ASoC: dapm: Don't fold register value changes into notifications

DAPM tracks and reports the value presented to the user from DAPM controls
separately to the register value, these may diverge during initialisation
or when an autodisable control is in use.

When writing DAPM controls we currently report that a change has occurred
if either the DAPM value or the value stored in the register has changed,
meaning that if the two are out of sync we may appear to report a spurious
event to userspace. Since we use this folded in value for nothing other
than the value reported to userspace simply drop the folding in of the
register change.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20220428161833.3690050-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: max98090: Fix event generation for custom controls
Mark Brown [Thu, 28 Apr 2022 11:32:21 +0000 (12:32 +0100)]
ASoC: max98090: Fix event generation for custom controls

The previous fix for event generation for custom controls compared the
value already in the register with the value being written, missing the
logic that only applies the value to the register when the control is
already enabled. Fix this, compare the value cached in the driver data
rather than the register.

This should really be an autodisable control rather than open coded.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20220428113221.15326-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Miscellaneous preparatory patches for IPC4
Mark Brown [Fri, 29 Apr 2022 18:48:47 +0000 (19:48 +0100)]
ASoC: SOF: Miscellaneous preparatory patches for IPC4

Merge series from Ranjani Sridharan <ranjani.sridharan@linux.intel.com>:

This series includes last few remaining miscellaneous patches to prepare
for the introduction of new IPC version, IPC4, in the SOF driver. The changes
include new IPC ops for topology parsing to set up the volume table, prepare
the widgets for set up and free the routes. The remaining patches introduce
new fields in the existing data structures for use in IPC4 and align the flows
for widget/route set up so that they are common for both IPC3 and IPC4.

2 years agoASoC: SOF: IPC Abstraction for FW loading
Mark Brown [Fri, 29 Apr 2022 16:01:18 +0000 (17:01 +0100)]
ASoC: SOF: IPC Abstraction for FW loading

Merge series from Ranjani Sridharan <ranjani.sridharan@linux.intel.com>:

This series introduces IPC abstraction for FW loading in the SOF driver
in preparation for supporting the new IPC version in the SOF firmware.

2 years agoASoC: dsp: mediatek: add mt8195 dsp document
YC Hung [Thu, 6 Jan 2022 06:48:48 +0000 (14:48 +0800)]
ASoC: dsp: mediatek: add mt8195 dsp document

This patch adds mt8195 dsp document. The dsp is used for Sound Open
Firmware driver node. It includes registers,  clocks, memory regions,
and mailbox for dsp.

Signed-off-by: yc.hung <yc.hung@mediatek.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220106064847.15588-1-yc.hung@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: sof-pci-dev: fix missing pci_release_regions() on error in sof_pci_probe()
Yang Yingliang [Tue, 26 Apr 2022 13:25:39 +0000 (21:25 +0800)]
ASoC: SOF: sof-pci-dev: fix missing pci_release_regions() on error in sof_pci_probe()

Fix the missing pci_release_regions() before return
from sof_pci_probe() in the error handling case.

Fixes: 4bfbbb76e82e ("ASOC: SOF: pci: add ipc_type override for Intel IPC4 tests")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20220426132539.416676-1-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: loader: Call optional query_fw_configuration on first boot
Peter Ujfalusi [Mon, 25 Apr 2022 22:11:29 +0000 (15:11 -0700)]
ASoC: SOF: loader: Call optional query_fw_configuration on first boot

Execute the firmware information query on the first boot if it is
available.

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>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220425221129.124615-11-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: loader: Remove snd_sof_parse_module_memcpy() as it is not used
Peter Ujfalusi [Mon, 25 Apr 2022 22:11:28 +0000 (15:11 -0700)]
ASoC: SOF: loader: Remove snd_sof_parse_module_memcpy() as it is not used

The snd_sof_parse_module_memcpy() is no longer used and we have the
implementation of it in ipc3-loader.c which is a default mode to load
module(s) with IPC3 if the snd_sof_load_firmware_memcpy() is used for
loading the firmware.

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>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220425221129.124615-10-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: mediatek: mt8195: Do not set the load_module ops
Peter Ujfalusi [Mon, 25 Apr 2022 22:11:27 +0000 (15:11 -0700)]
ASoC: SOF: mediatek: mt8195: Do not set the load_module ops

The used firmware loader (snd_sof_load_firmware_memcpy) can use the generic
module loading, which is by default uses the same implementation as the
snd_sof_parse_module_memcpy.

No need to set the callback for this platform.

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>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220425221129.124615-9-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Intel: bdw/byt/pci-tng: Do not set the load_module ops
Peter Ujfalusi [Mon, 25 Apr 2022 22:11:26 +0000 (15:11 -0700)]
ASoC: SOF: Intel: bdw/byt/pci-tng: Do not set the load_module ops

The used firmware loader (snd_sof_load_firmware_memcpy) can use the generic
module loading, which is by default uses the same implementation as the
snd_sof_parse_module_memcpy.

No need to set the callback for these platforms.

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>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220425221129.124615-8-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: imx: Do not set the load_module ops
Peter Ujfalusi [Mon, 25 Apr 2022 22:11:25 +0000 (15:11 -0700)]
ASoC: SOF: imx: Do not set the load_module ops

The used firmware loader (snd_sof_load_firmware_memcpy) can use the generic
module loading, which is by default uses the same implementation as the
snd_sof_parse_module_memcpy.

No need to set the callback for iMX.

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>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220425221129.124615-7-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: amd: renoir: Do not set the load_module ops
Peter Ujfalusi [Mon, 25 Apr 2022 22:11:24 +0000 (15:11 -0700)]
ASoC: SOF: amd: renoir: Do not set the load_module ops

The used firmware loader (snd_sof_load_firmware_memcpy) can use the generic
module loading, which is by default uses the same implementation as the
snd_sof_parse_module_memcpy.

No need to set the callback for this platform.

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>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220425221129.124615-6-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: loader: Switch to use the fw_loader ops
Peter Ujfalusi [Mon, 25 Apr 2022 22:11:23 +0000 (15:11 -0700)]
ASoC: SOF: loader: Switch to use the fw_loader ops

Since we have the fw_loader ops implementation for IPC3, we can start
using it and remove most of the IPC dependent code from the file.

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>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220425221129.124615-5-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc: Add check for fw_loader ops
Peter Ujfalusi [Mon, 25 Apr 2022 22:11:22 +0000 (15:11 -0700)]
ASoC: SOF: ipc: Add check for fw_loader ops

Add checks for the mandatory fw_loader ops.

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>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220425221129.124615-4-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc3-loader: Implement firmware parsing and loading
Peter Ujfalusi [Mon, 25 Apr 2022 22:11:21 +0000 (15:11 -0700)]
ASoC: SOF: ipc3-loader: Implement firmware parsing and loading

Add the IPC3 dependent implementation of validating the firmware image,
parsing the ext manifest and to load modules via memcpy.

The code introduced by this commit is the IPC dependent code from the
loader.c, which is going to be removed later.

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>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220425221129.124615-3-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Introduce IPC dependent ops for firmware handling, loading
Peter Ujfalusi [Mon, 25 Apr 2022 22:11:20 +0000 (15:11 -0700)]
ASoC: SOF: Introduce IPC dependent ops for firmware handling, loading

The parsing and loading of firmware modules/components are IPC dependent
operations as the organization of the firmware depends on the IPC it is
supporting.

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>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220425221129.124615-2-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Add a prepare op to IPC topology widget ops
Ranjani Sridharan [Tue, 26 Apr 2022 17:17:43 +0000 (10:17 -0700)]
ASoC: SOF: Add a prepare op to IPC topology widget ops

In order to set up a pipeline with IPC4, the total memory usage for the
pipeline needs to be calculated based on the list of connected widgets.
Add a new ipc_prepare() op to struct sof_ipc_tplg_widget_ops that will be
used to calculate the memory usage for each widget in the pipelines
associated with a PCM and prepare the widget for getting set up in the
DSP. The prepare step will be used to allocate memory for the IPC
payload, assign instance ID and update the config data for the widget
based on the runtime PCM params. Once prepared, the setup step is used
to send the IPC to create the widget in the DSP.

Add an ipc_unprepare() op to unprepare the widget i.e free the memory
allocated during prepare, free the instance ID etc. This should be
invoked after the widget is freed.

A new flag "prepared" is added to struct snd_sof_widget to track the
prepared status of widgets.

Also, IPC4 requires the platform_params and the runtime PCM params in
order to prepare a widget for set up. So modify the signature of
sof_pcm_setup_connected_widgets() and sof_widget_list_setup() to accept
these as arguments.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20220426171743.171061-12-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: clarify use of widget complete flag
Ranjani Sridharan [Tue, 26 Apr 2022 17:17:42 +0000 (10:17 -0700)]
ASoC: SOF: clarify use of widget complete flag

Currently, the complete flag is used only for the snd_soc_dapm_scheduler
type widgets to indicate that the pipeline has been set up. All other
widgets do not need it. Add a comment to clarify its usage and set the
complete flag to false only for the scheduler widget in
sof_widget_free().

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20220426171743.171061-11-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: topology: Skip parsing DAI link tokens if not needed
Ranjani Sridharan [Tue, 26 Apr 2022 17:17:41 +0000 (10:17 -0700)]
ASoC: SOF: topology: Skip parsing DAI link tokens if not needed

Do not parse these tokens if they are not defined in the IPC version
specific token list. In the case of IPC4 with HDA topologies for
example, no DAI link specific tokens need to be added in topology.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220426171743.171061-10-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: pcm: remove unnecessary function declaration
Ranjani Sridharan [Tue, 26 Apr 2022 17:17:40 +0000 (10:17 -0700)]
ASoC: SOF: pcm: remove unnecessary function declaration

sof_pcm_setup_connected_widgets() can be a static function in pcm.c. No
need to declare it in the header.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220426171743.171061-9-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Add two new fields to struct snd_sof_widget
Ranjani Sridharan [Tue, 26 Apr 2022 17:17:39 +0000 (10:17 -0700)]
ASoC: SOF: Add two new fields to struct snd_sof_widget

Add two new fields, instance_id and module_info to struct
snd_sof_widget. instance_id for widgets will be assigned when they are
set up in the DSP and reset when the widgets are freed. module_info is
used to save information the firmware provides about each module in its
manifest.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220426171743.171061-8-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Add a route_free op in struct sof_ipc_tplg_ops
Ranjani Sridharan [Tue, 26 Apr 2022 17:17:38 +0000 (10:17 -0700)]
ASoC: SOF: Add a route_free op in struct sof_ipc_tplg_ops

IPC4 requires that the widgets be unbound in the firmware before they
are freed. So add a new op in struct sof_ipc_tplg_ops that will be used
to send the IPC to the firmware to unbind widgets.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220426171743.171061-7-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: expose a couple of functions
Ranjani Sridharan [Tue, 26 Apr 2022 17:17:37 +0000 (10:17 -0700)]
ASoC: SOF: expose a couple of functions

Expose the mixer_to_ipc() and ipc_to_mixer() functions for reuse in
IPC4.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220426171743.171061-6-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: pcm: Move the call to snd_sof_pcm_platform_hw_params()
Ranjani Sridharan [Tue, 26 Apr 2022 17:17:36 +0000 (10:17 -0700)]
ASoC: SOF: pcm: Move the call to snd_sof_pcm_platform_hw_params()

IPC4 requires the platform_params be passed when invoking
sof_pcm_setup_connected_widgets(). So move the call to
snd_sof_pcm_platform_hw_params() before calling
sof_pcm_setup_connected_widgets(). This has no functional impact.

sof_pcm_setup_connected_widgets will be modified in the follow up
patches to accept the platform params as an argument.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220426171743.171061-5-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: sof-audio: Set up widgets from source to sink
Ranjani Sridharan [Tue, 26 Apr 2022 17:17:35 +0000 (10:17 -0700)]
ASoC: SOF: sof-audio: Set up widgets from source to sink

For IPC3, the order of setting up the widgets associated with a PCM
doesn't matter. But for IPC4, widgets must be set up from the source to
the sink in order. In order to accommodate this, change the
sof_widget_list_setup/free() functions to set up/free widgets starting
with the source widget all the way to the sink widget for all pipelines.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20220426171743.171061-4-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: sof-audio: reset route status before freeing widget
Ranjani Sridharan [Tue, 26 Apr 2022 17:17:34 +0000 (10:17 -0700)]
ASoC: SOF: sof-audio: reset route status before freeing widget

This is in preparation for IPC4 which requires that the route be reset
before the widget is freed. For IPC3, there is nothing more to be done
other than setting the route status. So it is OK to be moved before the
widget is freed.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter 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://lore.kernel.org/r/20220426171743.171061-3-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Add a new op to set up volume table
Ranjani Sridharan [Tue, 26 Apr 2022 17:17:33 +0000 (10:17 -0700)]
ASoC: SOF: Add a new op to set up volume table

Add a new op set_up_volume_table for control IPC ops. Define and set
the op for IPC3.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220426171743.171061-2-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: bytcr_rt5640: Add quirk for the HP Pro Tablet 408
Hans de Goede [Wed, 27 Apr 2022 13:49:18 +0000 (15:49 +0200)]
ASoC: Intel: bytcr_rt5640: Add quirk for the HP Pro Tablet 408

Add a quirk for the HP Pro Tablet 408, this BYTCR tablet has no CHAN
package in its ACPI tables and uses SSP0-AIF1 rather then SSP0-AIF2 which
is the default for BYTCR devices.

It also uses DMIC1 for the internal mic rather then the default IN3
and it uses JD2 rather then the default JD1 for jack-detect.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=211485
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220427134918.527381-1-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: rk3328: fix disabling mclk on pclk probe failure
Nicolas Frattaroli [Wed, 27 Apr 2022 17:23:11 +0000 (19:23 +0200)]
ASoC: rk3328: fix disabling mclk on pclk probe failure

If preparing/enabling the pclk fails, the probe function should
unprepare and disable the previously prepared and enabled mclk,
which it doesn't do. This commit rectifies this.

Fixes: c32759035ad2 ("ASoC: rockchip: support ACODEC for rk3328")
Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
Reviewed-by: Katsuhiro Suzuki <katsuhiro@katsuster.net>
Link: https://lore.kernel.org/r/20220427172310.138638-1-frattaroli.nicolas@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: wm8960: Add ACPI support
Nicola Lunghi [Wed, 27 Apr 2022 21:29:16 +0000 (22:29 +0100)]
ASoC: wm8960: Add ACPI support

HID made of either Wolfson/CirrusLogic PCI ID + 8960 identifier

This helps enumerate the Waveshare WM8960 WM8960 Hi-Fi Sound
Card HAT on the Up2 platform.

The scripts at https://github.com/thesofproject/acpi-scripts
can be used to add the ACPI initrd overlay.

This commit is similar to the commit:
960cdd50ca9f ("ASoC: wm8804: Add ACPI support")

Signed-off-by: Nicola Lunghi <nick83ola@gmail.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220427212916.40145-1-nick83ola@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: sh: rz-ssi: Trivial fixes
Mark Brown [Wed, 27 Apr 2022 22:01:24 +0000 (23:01 +0100)]
ASoC: sh: rz-ssi: Trivial fixes

Merge series from Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>:

This patch series aims to fix trivial issues found in rz-ssi driver.

2 years agoASoC: SOF: use pm_runtime_resume_and_get()
Mark Brown [Wed, 27 Apr 2022 22:01:23 +0000 (23:01 +0100)]
ASoC: SOF: use pm_runtime_resume_and_get()

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

simplify code pattern as recommended by Mark Brown.

2 years agoASoC: sh: rz-ssi: Release the DMA channels in rz_ssi_probe() error path
Lad Prabhakar [Tue, 26 Apr 2022 07:49:22 +0000 (08:49 +0100)]
ASoC: sh: rz-ssi: Release the DMA channels in rz_ssi_probe() error path

DMA channels requested by rz_ssi_dma_request() in rz_ssi_probe() were
never released in the error path apart from one place. This patch fixes
this issue by calling rz_ssi_release_dma_channels() in the error path.

Fixes: 26ac471c5354 ("ASoC: sh: rz-ssi: Add SSI DMAC support")
Reported-by: Pavel Machek <pavel@denx.de>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://lore.kernel.org/r/20220426074922.13319-4-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: sh: rz-ssi: Propagate error codes returned from platform_get_irq_byname()
Lad Prabhakar [Tue, 26 Apr 2022 07:49:21 +0000 (08:49 +0100)]
ASoC: sh: rz-ssi: Propagate error codes returned from platform_get_irq_byname()

Propagate error codes returned from platform_get_irq_byname() instead of
returning -ENODEV. platform_get_irq_byname() may return -EPROBE_DEFER, to
handle such cases propagate the error codes.

While at it drop the dev_err_probe() messages as platform_get_irq_byname()
already does this for us in case of error.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://lore.kernel.org/r/20220426074922.13319-3-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: sh: rz-ssi: Drop SSIFSR_TDC and SSIFSR_RDC macros
Lad Prabhakar [Tue, 26 Apr 2022 07:49:20 +0000 (08:49 +0100)]
ASoC: sh: rz-ssi: Drop SSIFSR_TDC and SSIFSR_RDC macros

The mask values of SSIFSR_TDC and SSIFSR_RDC macros are incorrect and
they are unused in the file so just drop them.

Reported-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20220426074922.13319-2-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: mediatek: Fix allyesconfig build error
Tinghan Shen [Wed, 27 Apr 2022 07:10:30 +0000 (15:10 +0800)]
ASoC: SOF: mediatek: Fix allyesconfig build error

ld: sound/soc/sof/mediatek/mt8186/mt8186-clk.o:(.opd+0x18): multiple
definition of `adsp_clock_on';
sound/soc/sof/mediatek/mt8195/mt8195-clk.o:(.opd+0x60): first defined
here
ld: sound/soc/sof/mediatek/mt8186/mt8186-clk.o: in function
`.adsp_clock_on':

ld: sound/soc/sof/mediatek/mt8186/mt8186-clk.o:(.opd+0x30): multiple
definition of `adsp_clock_off';
sound/soc/sof/mediatek/mt8195/mt8195-clk.o:(.opd+0x78): first defined
here
ld: sound/soc/sof/mediatek/mt8186/mt8186-clk.o: in function
`.adsp_clock_off':

ld: sound/soc/sof/mediatek/mt8186/mt8186-loader.o:(.opd+0x0): multiple
definition of `sof_hifixdsp_boot_sequence';
sound/soc/sof/mediatek/mt8195/mt8195-loader.o:(.opd+0x0): first defined
here
ld: sound/soc/sof/mediatek/mt8186/mt8186-loader.o: in function
`.sof_hifixdsp_boot_sequence':

ld: sound/soc/sof/mediatek/mt8186/mt8186-loader.o:(.opd+0x18): multiple
definition of `sof_hifixdsp_shutdown';
 sound/soc/sof/mediatek/mt8195/mt8195-loader.o:(.opd+0x18): first defined
here
ld: sound/soc/sof/mediatek/mt8186/mt8186-loader.o: in function
`.sof_hifixdsp_shutdown':

Fixes: 570c14dc92d5 ("ASoC: SOF: mediatek: Add mt8186 sof fw loader and
dsp ops")
Fixes: 210b3ab932f7 ("ASoC: SOF: mediatek: Add mt8186 dsp clock support")

Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
Link: https://lore.kernel.org/r/20220427071030.10172-1-tinghan.shen@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: avs: Drop direct ACPI dependency
Amadeusz Sławiński [Tue, 26 Apr 2022 20:05:39 +0000 (22:05 +0200)]
ASoC: Intel: avs: Drop direct ACPI dependency

With previous patch this allows for building driver on architectures
without ACPI support present, when building with COMPILE_TEST enabled.

Fixes: 47a1886a610a ("ASoC: Intel: avs: Enable AVS driver only on x86 platforms")
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20220426200539.894010-2-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoALSA: hda: intel-nhlt: Move structs out of #define block
Amadeusz Sławiński [Tue, 26 Apr 2022 20:05:38 +0000 (22:05 +0200)]
ALSA: hda: intel-nhlt: Move structs out of #define block

As functions prototypes regerdless of CONFIG options as well as some
code depend on structures defined in sound/intel-nhlt.h header, move
them out of #define block. This allows to compile code depending on
mentioned header with "depends on ACPI || COMPILE_TEST" in Kconfig.

Fixes: 47a1886a610a ("ASoC: Intel: avs: Enable AVS driver only on x86 platforms")
Reported-by: kernel test robot <lkp@intel.com>
Suggested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20220426200539.894010-1-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: mediatek: mt8195 change ipc timeout as 1 second
YC Hung [Tue, 26 Apr 2022 18:34:59 +0000 (13:34 -0500)]
ASoC: SOF: mediatek: mt8195 change ipc timeout as 1 second

The IPC message sending can take longer than the default 500ms during
system boot up due to the concurrent loading of different drivers.
Increase the IPC timeout to 1 second to avoid timeout errors due to
Linux load and scheduling.

Reviewed-by: Curtis Malainey <cujomalainey@chromium.org>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220426183459.102251-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: bump SOF_ABI_MINOR
Pierre-Louis Bossart [Tue, 26 Apr 2022 18:36:31 +0000 (13:36 -0500)]
ASoC: SOF: bump SOF_ABI_MINOR

Commit a0f84dfb3f6d9 ("ASoC: SOF: IPC: dai: Expand DAI_CONFIG IPC flags")
did not update the SOF_ABI_MINOR, bump to version 20 before new
changes are added.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20220426183631.102356-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Intel: Do not (wrongly) assume positive return value in IMR path
Peter Ujfalusi [Wed, 27 Apr 2022 11:51:59 +0000 (14:51 +0300)]
ASoC: SOF: Intel: Do not (wrongly) assume positive return value in IMR path

The cl_dsp_init() returns 0 on success or negative errno on error.
Replace the 'if (ret >= 0)' checks with correct 'if (!ret)` to check for
success.

Fixes: 2a68ff846164 ("ASoC: SOF: Intel: hda: Revisit IMR boot sequence")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220427115159.26177-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: atom: use pm_runtime_resume_and_get()
Pierre-Louis Bossart [Tue, 26 Apr 2022 18:38:07 +0000 (13:38 -0500)]
ASoC: Intel: atom: use pm_runtime_resume_and_get()

Use pm_runtime_resume_and_get() to replace the pm_runtime_get_sync() and
pm_runtime_put_sync() pattern.

No functional changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20220426183807.102442-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: sof-client-ipc-msg-injector: use pm_runtime_resume_and_get()
Pierre-Louis Bossart [Tue, 26 Apr 2022 18:41:06 +0000 (13:41 -0500)]
ASoC: SOF: sof-client-ipc-msg-injector: use pm_runtime_resume_and_get()

Use pm_runtime_resume_and_get() to replace the pm_runtime_get_sync() and
pm_runtime_put_noidle() pattern.

No functional changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20220426184106.102636-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: debug: use pm_runtime_resume_and_get()
Pierre-Louis Bossart [Tue, 26 Apr 2022 18:41:04 +0000 (13:41 -0500)]
ASoC: SOF: debug: use pm_runtime_resume_and_get()

Use pm_runtime_resume_and_get() to replace the pm_runtime_get_sync() and
pm_runtime_put_noidle() pattern.

No functional changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20220426184106.102636-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: control: use pm_runtime_resume_and_get()
Pierre-Louis Bossart [Tue, 26 Apr 2022 18:41:03 +0000 (13:41 -0500)]
ASoC: SOF: control: use pm_runtime_resume_and_get()

Use pm_runtime_resume_and_get() to replace the pm_runtime_get_sync() and
pm_runtime_put_noidle() pattern.

No functional changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20220426184106.102636-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Fix NULL pointer exception in sof_pci_probe callback
Ajit Kumar Pandey [Tue, 26 Apr 2022 18:33:57 +0000 (13:33 -0500)]
ASoC: SOF: Fix NULL pointer exception in sof_pci_probe callback

We are accessing "desc->ops" in sof_pci_probe without checking "desc"
pointer. This results in NULL pointer exception if pci_id->driver_data
i.e desc pointer isn't defined in sof device probe:

BUG: kernel NULL pointer dereference, address: 0000000000000060
PGD 0 P4D 0
Oops: 0000 [#1] PREEMPT SMP NOPTI
RIP: 0010:sof_pci_probe+0x1e/0x17f [snd_sof_pci]
Code: Unable to access opcode bytes at RIP 0xffffffffc043dff4.
RSP: 0018:ffffac4b03b9b8d8 EFLAGS: 00010246

Add NULL pointer check for sof_dev_desc pointer to avoid such exception.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220426183357.102155-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: pcm1789: Make pcm1789_common_exit() return void
Uwe Kleine-König [Mon, 25 Apr 2022 19:30:23 +0000 (21:30 +0200)]
ASoC: pcm1789: Make pcm1789_common_exit() return void

This function returns zero unconditionally, so there isn't any benefit
of returning a value. Make it return void to be able to see at a glance
that the return value of pcm1789_i2c_remove() is always zero.

This patch is a preparation for making i2c remove callbacks return void.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20220425193023.61046-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: qcom: SC7280: Update machine driver startup, shutdown callbacks
Srinivasa Rao Mandadapu [Tue, 19 Apr 2022 13:18:49 +0000 (18:48 +0530)]
ASoC: qcom: SC7280: Update machine driver startup, shutdown callbacks

Update machine driver startup, shutdown callback functions to avoid
sound card registration failure on other platforms.
Without this change, platforms with WCD codec is failing to register
sound card.

Fixes: c5198db82d4c ("ASoC: qcom: Add driver support for ALC5682I-VS")

Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
Co-developed-by: Venkata Prasad Potturu <quic_potturu@quicinc.com>
Signed-off-by: Venkata Prasad Potturu <quic_potturu@quicinc.com>
Link: https://lore.kernel.org/r/1650374329-7279-1-git-send-email-quic_srivasam@quicinc.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: dt-bindings: max98396: add amplifier driver
Ryan Lee [Mon, 25 Apr 2022 17:37:15 +0000 (10:37 -0700)]
ASoC: dt-bindings: max98396: add amplifier driver

This patch adds dt-bindings information for Analog Devices MAX98396
and MAX98397 Smart Amplifier.

Signed-off-by: Ryan Lee <ryans.lee@analog.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220425173715.1827706-1-ryan.lee.analog@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: max98396: add amplifier driver
Ryan Lee [Sat, 23 Apr 2022 02:15:58 +0000 (19:15 -0700)]
ASoC: max98396: add amplifier driver

This series of patches adds support for Analog Devices MAX98396
mono amplifier with IV sense. The device provides a PCM interface
for audio data and a standard I2C interface for control data
communication. This driver also supports MAX98397 which is
a variant of MAX98396 with wide input supply range.

Signed-off-by: Ryan Lee <ryan.lee.analog@gmail.com>
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/20220423021558.1773598-1-ryan.lee.analog@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: tas6424: Return zero in remove callback
Uwe Kleine-König [Mon, 25 Apr 2022 19:32:06 +0000 (21:32 +0200)]
ASoC: tas6424: Return zero in remove callback

The only effect of returning an error code in an i2c remove callback
(compared to returning zero) is that the i2c core emits a generic
warning. The device is still removed.

So even if disabling the regulators fails it's sensible to return zero
to suppress the additional generic and little helpful error message.

This patch is a preparation for making i2c remove callbacks return void.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20220425193206.61710-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: ops: Validate input values in snd_soc_put_volsw_range()
Mark Brown [Sat, 23 Apr 2022 13:12:39 +0000 (14:12 +0100)]
ASoC: ops: Validate input values in snd_soc_put_volsw_range()

Check that values written via snd_soc_put_volsw_range() are
within the range advertised by the control, ensuring that we
don't write out of spec values to the hardware.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20220423131239.3375261-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Intel: improve HDaudio DAI support
Mark Brown [Mon, 25 Apr 2022 22:51:28 +0000 (23:51 +0100)]
ASoC: SOF: Intel: improve HDaudio DAI support

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

The SOF CI and daily tests exposed a number of issues with corner
cases on platforms using the HDaudio DAI, such as UpExtreme boards or
usual HDaudio+DMIC laptops.

This patchset provides improvements for pause_push/pause_release,
suspend-resume, mixing use cases and combinations of all three.

The initial patches provide a cleanup, the last patches improve the
state machine and DMA handling.

2 years agoASoC: SOF: Rework the firmware ready message handling
Mark Brown [Mon, 25 Apr 2022 17:34:41 +0000 (18:34 +0100)]
ASoC: SOF: Rework the firmware ready message handling

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

The firmware ready (fw_ready) message is sent by the firmware to notify the host
that it has been booted up and caries additional information about it's
configuration.
All of this is IPC specific, the message itself is IPC version specific and the
information itself also.

Move the code to handle the fw_ready message under ipc3.c since the parsing and
interpretation is IPC specific.

A followup series is going to take care of the rest of the loader.c to make it
IPC agnostic.

2 years agoASoC: Add macros for signed TLV controls with callbacks
Mark Brown [Mon, 25 Apr 2022 17:22:55 +0000 (18:22 +0100)]
ASoC: Add macros for signed TLV controls with callbacks

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

This adds SOC_DOUBLE_R_S_EXT_TLV and SOC_SINGLE_S_EXT_TLV macros for
signed TLV controls that need custom get/put callbacks. These will be
needed by future Cirrus codec drivers, but are not particularly exotic
so could be useful for others.

2 years agoASoC: remaining i2c_match_id i2c probe changes
Mark Brown [Mon, 25 Apr 2022 17:22:54 +0000 (18:22 +0100)]
ASoC: remaining i2c_match_id i2c probe changes

Merge series from Stephen Kitt <steve@sk2.org>:

This series covers all the remaining changes to migrate
sound/soc/codecs i2c probes to probe_new, where the const struct
i2c_client * argument is still used. Instead of relying on the
parameter passed in, i2c_match_id is used instead.

With this set of patches, all the sound/soc/codecs i2c probes use the
new probe definition.

Changes since v1: two missing files were added.

Stephen Kitt (7):
  ASoC: ak*: use i2c_match_id and simple i2c probe
  ASoC: alc56*: use i2c_match_id and simple i2c probe
  ASoC: max980*: use i2c_match_id and simple i2c probe
  ASoC: pcm186x: use i2c_match_id and simple i2c probe
  ASoC: tas*: use i2c_match_id and simple i2c probe
  ASoC: tlv320*: use i2c_match_id and simple i2c probe
  ASoC: tpa6130: use i2c_match_id and simple i2c probe

 sound/soc/codecs/ak4613.c            | 10 +++++----
 sound/soc/codecs/ak4642.c            |  8 ++++---
 sound/soc/codecs/alc5623.c           | 24 +++++++++++----------
 sound/soc/codecs/alc5632.c           | 20 +++++++++--------
 sound/soc/codecs/max98088.c          | 21 +++++++++---------
 sound/soc/codecs/max98090.c          | 23 ++++++++++----------
 sound/soc/codecs/max98095.c          | 19 +++++++++--------
 sound/soc/codecs/pcm186x-i2c.c       | 24 ++++++++++-----------
 sound/soc/codecs/tas2562.c           | 25 +++++++++++-----------
 sound/soc/codecs/tas571x.c           | 11 ++++++----
 sound/soc/codecs/tas5720.c           | 21 +++++++++---------
 sound/soc/codecs/tlv320adc3xxx.c     | 21 +++++++++---------
 sound/soc/codecs/tlv320aic31xx.c     | 32 ++++++++++++++--------------
 sound/soc/codecs/tlv320aic32x4-i2c.c | 11 ++++++----
 sound/soc/codecs/tlv320aic3x-i2c.c   | 25 +++++++++++-----------
 sound/soc/codecs/tpa6130a2.c         | 19 +++++++++--------
 16 files changed, 168 insertions(+), 146 deletions(-)

base-commit: 5d763a740e5b24e4a2ca04317255e7e941876338
--
2.27.0

2 years agoAdd support of MediaTek mt8186 to SOF
Mark Brown [Mon, 25 Apr 2022 17:22:52 +0000 (18:22 +0100)]
Add support of MediaTek mt8186 to SOF

Merge series from Tinghan Shen <tinghan.shen@mediatek.com>:

Add support of MediaTek mt8186 SoC DSP to SOF.

2 years agoASoC: SOF: mediatek: Add DSP system PM callback for mt8186
Tinghan Shen [Fri, 22 Apr 2022 05:56:59 +0000 (13:56 +0800)]
ASoC: SOF: mediatek: Add DSP system PM callback for mt8186

Add DSP system PM callback for suspend and resume

Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Yaochun Hung <yc.hung@mediatek.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220422055659.8738-5-tinghan.shen@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: mediatek: Add mt8186 dsp clock support
Tinghan Shen [Fri, 22 Apr 2022 05:56:58 +0000 (13:56 +0800)]
ASoC: SOF: mediatek: Add mt8186 dsp clock support

Add adsp clock on/off support on mt8186 SoC.

Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Yaochun Hung <yc.hung@mediatek.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220422055659.8738-4-tinghan.shen@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: mediatek: Add mt8186 sof fw loader and dsp ops
Tinghan Shen [Fri, 22 Apr 2022 05:56:57 +0000 (13:56 +0800)]
ASoC: SOF: mediatek: Add mt8186 sof fw loader and dsp ops

Add mt8186-loader module with ops callback to load and run firmware
on mt8186 SoC.

Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Yaochun Hung <yc.hung@mediatek.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220422055659.8738-3-tinghan.shen@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: mediatek: Add mt8186 hardware support
Tinghan Shen [Fri, 22 Apr 2022 05:56:56 +0000 (13:56 +0800)]
ASoC: SOF: mediatek: Add mt8186 hardware support

Add support of SOF on Mediatek mt8186 SoC.
MT8186 has 2 Cortex A76 cores paired with 6 Cortex A55 cores.
It also has Cadence HiFi-5 DSP single core. The IPC communication
between AP and DSP is based on shared DRAM and mailbox interrupt.

Signed-off-by: Allen-KH Cheng <allen-kh.cheng@mediatek.com>
Signed-off-by: Tinghan Shen <tinghan.shen@mediatek.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Yaochun Hung <yc.hung@mediatek.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220422055659.8738-2-tinghan.shen@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: img-i2s-in: using pm_runtime_resume_and_get instead of pm_runtime_get_sync
Minghao Chi [Thu, 14 Apr 2022 08:53:10 +0000 (08:53 +0000)]
ASoC: img-i2s-in: using pm_runtime_resume_and_get instead of pm_runtime_get_sync

Using pm_runtime_resume_and_get() to replace pm_runtime_get_sync and
pm_runtime_put_noidle. This change is just to simplify the code, no
actual functional changes.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
Link: https://lore.kernel.org/r/20220414085310.2541546-1-chi.minghao@zte.com.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: img-parallel-out: using pm_runtime_resume_and_get
Minghao Chi [Wed, 20 Apr 2022 03:02:46 +0000 (03:02 +0000)]
ASoC: img-parallel-out: using pm_runtime_resume_and_get

Using pm_runtime_resume_and_get() to replace pm_runtime_get_sync and
pm_runtime_put_noidle. This change is just to simplify the code, no
actual functional changes.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
Link: https://lore.kernel.org/r/20220420030246.2575629-1-chi.minghao@zte.com.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: qcom: Use MCLK as RT5682I-VS sysclk source
Judy Hsiao [Tue, 19 Apr 2022 06:29:52 +0000 (14:29 +0800)]
ASoC: qcom: Use MCLK as RT5682I-VS sysclk source

Both MCLK and BCLK can be the clock source of sysclk via PLL
according to its datasheet.
This patch sets MCLK as the clock source as we use MCLK in the
previous projects.

Fixes: c5198db82d4c ("ASoC: qcom: Add driver support for ALC5682I-VS")
Signed-off-by: Judy Hsiao <judyhsiao@chromium.org>
Link: https://lore.kernel.org/r/20220419062952.356017-1-judyhsiao@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: imx-hdmi: remove useless null check before call of_node_put()
Haowen Bai [Thu, 21 Apr 2022 02:45:20 +0000 (10:45 +0800)]
ASoC: imx-hdmi: remove useless null check before call of_node_put()

No need to add null check before call of_node_put(), since the
implementation of of_node_put() has done it.

Signed-off-by: Haowen Bai <baihaowen@meizu.com>
Link: https://lore.kernel.org/r/1650509120-25377-1-git-send-email-baihaowen@meizu.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: avs: Depend on SND_INTEL_DSP_CONFIG
Amadeusz Sławiński [Mon, 25 Apr 2022 09:16:46 +0000 (11:16 +0200)]
ASoC: Intel: avs: Depend on SND_INTEL_DSP_CONFIG

In order to enable NHLT support one must select SND_INTEL_DSP_CONFIG,
which will select SND_INTEL_NHLT. Otherwise the file containing NHLT
code doesn't get build leading to errors when linking.

Fixes: 274d79e51875 ("ASoC: Intel: avs: Configure modules according to their type")
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20220425091646.545216-2-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>