OSDN Git Service

tomoyo/tomoyo-test1.git
2 years agoASoC: Intel: sof_rt5682: remap jack pins
Pierre-Louis Bossart [Thu, 16 Jun 2022 21:40:55 +0000 (16:40 -0500)]
ASoC: Intel: sof_rt5682: remap jack pins

The card did not map jack pins to controls, which prevents
PulseAudio/PipeWire from dealing with jack detection. It's likely that
jack detection was only tested with the CRAS server and extensions of
UCM.

Suggested-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-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>
Link: https://lore.kernel.org/r/20220616214055.134943-14-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: sof_nau8825: remap jack pins
Pierre-Louis Bossart [Thu, 16 Jun 2022 21:40:54 +0000 (16:40 -0500)]
ASoC: Intel: sof_nau8825: remap jack pins

The card did not map jack pins to controls, which prevents
PulseAudio/PipeWire from dealing with jack detection. It's likely that
jack detection was only tested with the CRAS server and extensions of
UCM.

Suggested-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-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>
Link: https://lore.kernel.org/r/20220616214055.134943-13-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: sof_da7219_max98373: remap jack pins
Pierre-Louis Bossart [Thu, 16 Jun 2022 21:40:53 +0000 (16:40 -0500)]
ASoC: Intel: sof_da7219_max98373: remap jack pins

The card did not map jack pins to controls, which prevents
PulseAudio/PipeWire from dealing with jack detection. It's likely that
jack detection was only tested with the CRAS server and extensions of
UCM.

Suggested-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-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>
Link: https://lore.kernel.org/r/20220616214055.134943-12-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: sof_cs42l42: remap jack pins
Pierre-Louis Bossart [Thu, 16 Jun 2022 21:40:52 +0000 (16:40 -0500)]
ASoC: Intel: sof_cs42l42: remap jack pins

The card did not map jack pins to controls, which prevents
PulseAudio/PipeWire from dealing with jack detection. It's likely that
jack detection was only tested with the CRAS server and extensions of
UCM.

Suggested-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-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>
Link: https://lore.kernel.org/r/20220616214055.134943-11-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: cml_rt1011_rt5682: remap jack pins
Pierre-Louis Bossart [Thu, 16 Jun 2022 21:40:51 +0000 (16:40 -0500)]
ASoC: Intel: cml_rt1011_rt5682: remap jack pins

The card did not map jack pins to controls, which prevents
PulseAudio/PipeWire from dealing with jack detection. It's likely that
jack detection was only tested with the CRAS server and extensions of
UCM.

Suggested-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-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>
Link: https://lore.kernel.org/r/20220616214055.134943-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: glk_rt5682_max98357a: remap jack pins
Pierre-Louis Bossart [Thu, 16 Jun 2022 21:40:50 +0000 (16:40 -0500)]
ASoC: Intel: glk_rt5682_max98357a: remap jack pins

The card did not map jack pins to controls, which prevents
PulseAudio/PipeWire from dealing with jack detection. It's likely that
jack detection was only tested with the CRAS server and extensions of
UCM.

Suggested-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-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>
Link: https://lore.kernel.org/r/20220616214055.134943-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: bxt_da7219_max98357a: remap jack pins
Pierre-Louis Bossart [Thu, 16 Jun 2022 21:40:49 +0000 (16:40 -0500)]
ASoC: Intel: bxt_da7219_max98357a: remap jack pins

The card did not map jack pins to controls, which prevents
PulseAudio/PipeWire from dealing with jack detection. It's likely that
jack detection was only tested with the CRAS server and extensions of
UCM.

Suggested-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-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>
Link: https://lore.kernel.org/r/20220616214055.134943-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: kbl_rt5663_rt5514_max98927: remap jack pins
Pierre-Louis Bossart [Thu, 16 Jun 2022 21:40:48 +0000 (16:40 -0500)]
ASoC: Intel: kbl_rt5663_rt5514_max98927: remap jack pins

The card did not map jack pins to controls, which prevents
PulseAudio/PipeWire from dealing with jack detection. It's likely that
jack detection was only tested with the CRAS server and extensions of
UCM.

Suggested-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-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>
Link: https://lore.kernel.org/r/20220616214055.134943-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: kbl_da7219_max98927: remap jack pins
Pierre-Louis Bossart [Thu, 16 Jun 2022 21:40:47 +0000 (16:40 -0500)]
ASoC: Intel: kbl_da7219_max98927: remap jack pins

The card did not map jack pins to controls, which prevents
PulseAudio/PipeWire from dealing with jack detection. It's likely that
jack detection was only tested with the CRAS server and extensions of
UCM.

Suggested-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-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>
Link: https://lore.kernel.org/r/20220616214055.134943-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: kbl_da7219_max98357a: remap jack pins
Pierre-Louis Bossart [Thu, 16 Jun 2022 21:40:46 +0000 (16:40 -0500)]
ASoC: Intel: kbl_da7219_max98357a: remap jack pins

The card did not map jack pins to controls, which prevents
PulseAudio/PipeWire from dealing with jack detection. It's likely that
jack detection was only tested with the CRAS server and extensions of
UCM.

Suggested-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-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>
Link: https://lore.kernel.org/r/20220616214055.134943-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: kbl_rt5663_max98927: remap jack pins
Pierre-Louis Bossart [Thu, 16 Jun 2022 21:40:45 +0000 (16:40 -0500)]
ASoC: Intel: kbl_rt5663_max98927: remap jack pins

The card did not map jack pins to controls, which prevents
PulseAudio/PipeWire from dealing with jack detection. It's likely that
jack detection was only tested with the CRAS server and extensions of
UCM.

Suggested-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-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>
Link: https://lore.kernel.org/r/20220616214055.134943-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: skl_nau88l25_ssm4567: remap jack pins
Pierre-Louis Bossart [Thu, 16 Jun 2022 21:40:44 +0000 (16:40 -0500)]
ASoC: Intel: skl_nau88l25_ssm4567: remap jack pins

The card did not map jack pins to controls, which prevents
PulseAudio/PipeWire from dealing with jack detection. It's likely that
jack detection was only tested with the CRAS server and extensions of
UCM.

Suggested-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-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>
Link: https://lore.kernel.org/r/20220616214055.134943-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: skl_nau88l25_max98357a: remap jack pins
Pierre-Louis Bossart [Thu, 16 Jun 2022 21:40:43 +0000 (16:40 -0500)]
ASoC: Intel: skl_nau88l25_max98357a: remap jack pins

The card did not map jack pins to controls, which prevents
PulseAudio/PipeWire from dealing with jack detection. It's likely that
jack detection was only tested with the CRAS server and extensions of
UCM.

Suggested-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-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>
Link: https://lore.kernel.org/r/20220616214055.134943-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Intel: IPC4: enable IMR boot
Peter Ujfalusi [Thu, 16 Jun 2022 05:49:10 +0000 (08:49 +0300)]
ASoC: SOF: Intel: IPC4: enable IMR boot

IPC4 based firmwares have unconditional support for IMR boot.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@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/20220616054910.16690-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: Skylake: remove redundant re-assignments to pointer array
Colin Ian King [Tue, 14 Jun 2022 18:38:09 +0000 (19:38 +0100)]
ASoC: Intel: Skylake: remove redundant re-assignments to pointer array

There are two occurrences where the pointer array is being assigned a value
that is never read, the pointer gets updated in the next iteration of a
loop. These assignments are redundant and can be removed.

Cleans up clang scan-build warnings:
sound/soc/intel/skylake/skl-topology.c:2953:3: warning: Value stored to
'array' is never read [deadcode.DeadStores]
sound/soc/intel/skylake/skl-topology.c:3602:3: warning: Value stored to
'array' is never read [deadcode.DeadStores]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220614183809.163531-1-colin.i.king@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc4-topology: Fix error code in sof_ipc4_volume_put()
Dan Carpenter [Thu, 16 Jun 2022 04:31:09 +0000 (07:31 +0300)]
ASoC: SOF: ipc4-topology: Fix error code in sof_ipc4_volume_put()

The sof_ipc4_volume_put() function returns type bool so returning
-ENOENT means returning true.  Return false instead.

Fixes: 955e84fc0b6d ("ASoC: SOF: ipc4-topology: Add control IO ops")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/YqqyDU5BhOzpRjco@kili
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Add regmap_field helpers for simple bit operations
Mark Brown [Wed, 15 Jun 2022 17:05:36 +0000 (18:05 +0100)]
ASoC: Add regmap_field helpers for simple bit operations

Merge series from Li Chen <lchen.firstlove@zohomail.com>

This series proposes to add simple bit operations for setting, clearing
and testing specific bits with regmap_field and uses them in one of the
sunxi drivers.

2 years agoASoC: SOF: Intel: Add support for MeteorLake
Mark Brown [Wed, 15 Jun 2022 12:41:28 +0000 (13:41 +0100)]
ASoC: SOF: Intel: Add support for MeteorLake

Merge series from Bard Liao <yung-chuan.liao@linux.intel.com>:

Add platform abstraction for the Meteor Lake platform.

This platform has significant differences compared to the TGL/ADL
generation: it relies on new hardware using the code name 'ACE' and
only supports the INTEL_IPC4 protocol and firmware architecture based
on the Zephyr RTOS

2 years agoASoC: sunxi: Use {regmap/regmap_field}_{set/clear}_bits helpers
Li Chen [Mon, 23 May 2022 03:27:59 +0000 (20:27 -0700)]
ASoC: sunxi: Use {regmap/regmap_field}_{set/clear}_bits helpers

Appropriately change calls to {regmap/regmap_field}_update_bits()
with {regmap/regmap_field}_set_bits()
and {regmap/regmap_field}_clear_bits() for improved readability.

Signed-off-by: Li Chen <lchen@ambarella.com>
Link: https://lore.kernel.org/r/180eef50e96.cb7c34db60740.8898768158778553647@zohomail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoregmap: provide regmap_field helpers for simple bit operations
Li Chen [Mon, 23 May 2022 03:26:58 +0000 (20:26 -0700)]
regmap: provide regmap_field helpers for simple bit operations

We have set/clear/test operations for regmap, but not for regmap_field yet.
So let's introduce regmap_field helpers too.

In many instances regmap_field_update_bits() is used for simple bit setting
and clearing. In these cases the last argument is redundant and we can
hide it with a static inline function.

This adds three new helpers for simple bit operations: set_bits,
clear_bits and test_bits (the last one defined as a regular function).

Signed-off-by: Li Chen <lchen@ambarella.com>
Link: https://lore.kernel.org/r/180eef422c3.deae9cd960729.8518395646822099769@zohomail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Intel: Add support for MeteorLake (MTL)
Bard Liao [Wed, 15 Jun 2022 08:43:48 +0000 (16:43 +0800)]
ASoC: SOF: Intel: Add support for MeteorLake (MTL)

Add platform abstraction for the Meteor Lake platform.

This platform has significant differences compared to the TGL/ADL
generation: it relies on new hardware using the code name 'ACE' and
only supports the INTEL_IPC4 protocol and firmware architecture based
on the Zephyr RTOS

Co-developed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20220615084348.3489-3-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOC: Intel: introduce cl_init callback
Bard Liao [Wed, 15 Jun 2022 08:43:47 +0000 (16:43 +0800)]
ASoC: SOC: Intel: introduce cl_init callback

The code loader init sequences are different between versions of
Intel platforms. Have a cl_init callback allows us to reuse the
common code.
No function changed.

Signed-off-by: Bard Liao <yung-chuan.liao@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://lore.kernel.org/r/20220615084348.3489-2-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: tegra: Fix MBDRC bypass mode check
Sameer Pujar [Wed, 15 Jun 2022 04:38:34 +0000 (10:08 +0530)]
ASoC: tegra: Fix MBDRC bypass mode check

MBDRC supports different modes of operation. There is no configuration
required for bypass mode. The hw_params() call does not filter bypass
mode correctly and it leads to following Smatch static checker warning:

  sound/soc/tegra/tegra210_mbdrc.c:778 tegra210_mbdrc_hw_params()
  warn: bitwise AND condition is false here

Fix this condition by using proper mode mask and just return for bypass
mode.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 7358a803c778 ("ASoC: tegra: Add Tegra210 based OPE driver")
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Link: https://lore.kernel.org/r/1655267914-24702-1-git-send-email-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: tegra: Fix clock DAI format on Tegra210
Sameer Pujar [Wed, 15 Jun 2022 08:04:37 +0000 (13:34 +0530)]
ASoC: tegra: Fix clock DAI format on Tegra210

I2S reset failures are seen on Tegra210 and later platforms. This indicates
absence of I2S bit clock, which is required to perform the reset operation.
Following failures are seen with I2S based tests on Tegra210 and later:

  tegra210-i2s 2901100.i2s: timeout: failed to reset I2S for playback
  tegra210-i2s 2901100.i2s: ASoC: PRE_PMU: I2S2 RX event failed: -110
  tegra210-i2s 2901100.i2s: timeout: failed to reset I2S for capture
  tegra210-i2s 2901100.i2s: ASoC: PRE_PMU: I2S2 TX event failed: -110

The commit d92ad6633fa7 ("ASoC: tegra: Update to use set_fmt_new callback")
regressed I2S functionality on Tegra platforms. Basically it flipped clock
provider and consumer DAI formats. This configures Tegra I2S in consumer
mode by default now and there is none to provide bit clock during loopback
tests. The external codec based tests also fail because both Tegra I2S and
codec I2S get configured in consumer mode.

ASoC core flips the DAI format before calling set_fmt() for CPU DAIs. This
is negated in above commit. Fix this by swapping SND_SOC_DAIFMT_BC_FC and
SND_SOC_DAIFMT_BP_FP switch cases.

Fixes: d92ad6633fa7 ("ASoC: tegra: Update to use set_fmt_new callback")
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Cc: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/1655280277-4701-1-git-send-email-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: cs35l45: Add endianness flag in snd_soc_component_driver
Charles Keepax [Tue, 14 Jun 2022 13:10:22 +0000 (14:10 +0100)]
ASoC: cs35l45: 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.

Fixes: 0d463d016000 ("ASoC: cs35l45: Add driver for Cirrus Logic CS35L45 Smart Amp")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220614131022.778057-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: ops: Fix boolean/integer detection for simple controls
Mark Brown [Sat, 4 Jun 2022 10:54:07 +0000 (11:54 +0100)]
ASoC: ops: Fix boolean/integer detection for simple controls

The standard snd_soc_info_volsw() detects if a control is a volume control
and needs to be reported as an integer even if it only has two values by
looking for the string " Volume" in the control name. This results in false
positives if the control has a name like "HP Volume Ramp Switch" since any
" Volume" is matched, not just a trailing one. Fix this by making sure that
we only match at the end of the control name.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20220604105407.4055294-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc4-topology: add SoundWire/ALH aggregation support
Bard Liao [Tue, 14 Jun 2022 09:26:30 +0000 (17:26 +0800)]
ASoC: SOF: ipc4-topology: add SoundWire/ALH aggregation support

Some SoundWire hardware topologies rely on different amplifiers or
capture devices connected on different links. These devices need to be
'aggregated', remain synchronized and be handled as a single logical
device.

In the IPC3 solution, the aggregation for amplifiers was handled by a
firmware 'demux' component. In the IPC4 solution, the demux component is
not needed, the gateway component can handle multiple ALH/DMA transfers
at the same time. This change makes the topology slightly more complicated
in that only one ALH DAI will be connected in the topology with the
gateway. The other DAIs that are part of the 'aggregated' dailink are not
shown in the DAPM graph as connected to the gateway, but they will however
be activated thanks to a feature in soc-dapm.c where events are forwarded
to all DAIs in the dailink (see soc_dapm_stream_event).

The topology also sets the same stream name for all widgets, dais and
dailinks, so a search for the stream name helps identify cases where
SoundWire/ALH aggregation is needed.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.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/20220614092630.20144-1-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: ops: Don't modify the driver's plaform_max when reading state
Mark Brown [Fri, 3 Jun 2022 11:25:08 +0000 (13:25 +0200)]
ASoC: ops: Don't modify the driver's plaform_max when reading state

Currently snd_soc_info_volsw() will set a platform_max based on the limit
the control has if one is not already set. This isn't really great, we
shouldn't be modifying the passed in driver data especially in a path like
this which may not ever be executed or where we may execute other callbacks
before this one. Instead make this function leave the data unchanged, and
clarify things a bit by referring to max rather than platform_max within
the function. platform_max is now applied as a limit after working out the
natural maximum value for the control.

This means that platform_max is no longer treated as a direct register
value for controls were min is non-zero. The put() callbacks already
validate on this basis, and there do not appear to be any in tree users
that would be affected.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20220603112508.3856519-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Merge fixes
Mark Brown [Tue, 14 Jun 2022 10:25:45 +0000 (11:25 +0100)]
ASoC: Merge fixes

Required for more changes for the ops.

2 years agoASoC: SOF: Compile and runtime IPC version selection
Peter Ujfalusi [Tue, 14 Jun 2022 07:56:17 +0000 (10:56 +0300)]
ASoC: SOF: Compile and runtime IPC version selection

The new IPC4 version is only supported by Intel platforms, iMX, AMD and
MediaTek only uses the standard SOF IPC.
There is no need for these platforms to build kernel support for IPC4 as
it is just dead code for them.

SND_SOC_SOF_IPC3 and SND_SOC_SOF_INTEL_IPC4 is introduced to allow compile
time selection and exclusion of IPC implementations.

To avoid randconfig failures add also support for runtime selection of
the IPC ops in ipc.c based on sdev->pdata->ipc_type

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220614075618.28605-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: topology: add code to parse config params for ACPDMIC dai
Ajit Kumar Pandey [Tue, 14 Jun 2022 07:52:51 +0000 (10:52 +0300)]
ASoC: SOF: topology: add code to parse config params for ACPDMIC dai

Add sof_ipc_dai_acpdmic_params and tokens to parse dmic channels and
rate params from topology file

Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220614075251.21499-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: reduce default verbosity of IPC logs
Pierre-Louis Bossart [Fri, 10 Jun 2022 21:46:01 +0000 (16:46 -0500)]
ASoC: SOF: reduce default verbosity of IPC logs

We currently log the initiation of an IPC as well at its success.

[ 3906.106987] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: ipc tx: 0x80010000: GLB_DAI_MSG: CONFIG
[ 3906.107189] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: ipc tx succeeded: 0x80010000: GLB_DAI_MSG: CONFIG

This is overkill in most cases, we already have a message thrown in
case of errors and have tracepoints enabled to check for IPC
duration. The only case where this might be useful is to check if
there is an interleaved IPC RX. Add a flag and only print those logs
if enabled.

In addition, the DMA_POSITION_UPDATE for traces brings limited
information in most cases and pollutes the logs for no good reason.

[ 3906.322256] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: ipc rx: 0x90020000: GLB_TRACE_MSG: DMA_POSITION
[ 3906.322308] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: ipc rx done: 0x90020000: GLB_TRACE_MSG: DMA_POSITION
[ 3906.822261] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: ipc rx: 0x90020000: GLB_TRACE_MSG: DMA_POSITION
[ 3906.822319] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: ipc rx done: 0x90020000: GLB_TRACE_MSG: DMA_POSITION
[ 3907.822261] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: ipc rx: 0x90020000: GLB_TRACE_MSG: DMA_POSITION
[ 3907.822319] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: ipc rx done: 0x90020000: GLB_TRACE_MSG: DMA_POSITION
[ 3908.822251] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: ipc rx: 0x90020000: GLB_TRACE_MSG: DMA_POSITION
[ 3908.822309] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: ipc rx done: 0x90020000: GLB_TRACE_MSG: DMA_POSITION

This information is only helpful when debugging the trace support, not
when using the trace. Add a flag to only print DMA position update
logs if enabled.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220610214601.43005-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: fsl_mqs: Add support for i.MX93 platform
Shengjiu Wang [Fri, 10 Jun 2022 05:47:22 +0000 (13:47 +0800)]
ASoC: fsl_mqs: Add support for i.MX93 platform

Add i.MX93 compatible string and specific soc data

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1654840042-7069-2-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: dt-bindings: fsl,mqs: Add compatible string for i.MX93 platform
Shengjiu Wang [Fri, 10 Jun 2022 05:47:21 +0000 (13:47 +0800)]
ASoC: dt-bindings: fsl,mqs: Add compatible string for i.MX93 platform

Add compatible string "fsl,imx93-mqs" for i.MX93 platform

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1654840042-7069-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Intel: hda-dai: enhance debug messages
Pierre-Louis Bossart [Fri, 10 Jun 2022 21:45:04 +0000 (16:45 -0500)]
ASoC: SOF: Intel: hda-dai: enhance debug messages

The same message was added twice for dai and link_dma, remove the
latter one and add dai name and direction to better understand
problematic sequences.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220610214504.42974-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: mediatek: mt8186: Use new direct clock defines
Charles Keepax [Mon, 13 Jun 2022 16:15:52 +0000 (17:15 +0100)]
ASoC: mediatek: mt8186: Use new direct clock defines

Update this driver to the new direct clock producer/consumer defines. It
appears this driver was added with the inversion taken account of but
still uses the CODEC defines so no inversion of the producer/consumer
is necessary.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220613161552.481337-2-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: sun8i-codec: Partial revert to fix clock specifiers
Charles Keepax [Mon, 13 Jun 2022 16:15:51 +0000 (17:15 +0100)]
ASoC: sun8i-codec: Partial revert to fix clock specifiers

Recent updates accidentally updated the clock producer/consumer
specifiers on this device as part of refactoring the CPU side of the DAI
links. However, this device sits on the CODEC side and shouldn't have
been updated. Partially revert the changes keeping the switch to the new
clock terminology but going back to the CODEC defines.

Fixes: 7cc3965fde74 ("ASoC: sunxi: Update to use set_fmt_new callback")
Reported-by: Samuel Holland <samuel@sholland.org>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Reviewed-by: Samuel Holland <samuel@sholland.org>
Tested-by: Samuel Holland <samuel@sholland.org>
Link: https://lore.kernel.org/r/20220613161552.481337-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: intel: sof_sdw: add RT711 SDCA card for MTL platform
Yong Zhi [Fri, 10 Jun 2022 21:44:15 +0000 (16:44 -0500)]
ASoC: intel: sof_sdw: add RT711 SDCA card for MTL platform

Enable on-board rt711 based sound card for MTL RVP.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Signed-off-by: Uday M Bhat <uday.m.bhat@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220610214415.42942-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: bytcr_wm5102: Fix GPIO related probe-ordering problem
Hans de Goede [Sun, 12 Jun 2022 15:56:52 +0000 (17:56 +0200)]
ASoC: Intel: bytcr_wm5102: Fix GPIO related probe-ordering problem

The "wlf,spkvdd-ena" GPIO needed by the bytcr_wm5102 driver
is made available through a gpio-lookup table.

This gpio-lookup table is registered by drivers/mfd/arizona-spi.c, which
may get probed after the bytcr_wm5102 driver.

If the gpio-lookup table has not registered yet then the gpiod_get()
will return -ENOENT. Treat -ENOENT as -EPROBE_DEFER to still keep
things working in this case.

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/20220612155652.107310-1-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoMAINTAINERS: update ASoC/Intel/SOF maintainers
Pierre-Louis Bossart [Fri, 10 Jun 2022 21:43:13 +0000 (16:43 -0500)]
MAINTAINERS: update ASoC/Intel/SOF maintainers

Keyon Jie was a key contributor to the Intel ASoC and SOF Intel
drivers, but he's moved on to a different role within Intel. We wish
him all the best in his new endeavors.

Bard Liao, Kai Vehmanen, Ranjani Sridharan and Peter Ujfalusi have
been involved in the Intel multi-maintainer team, it's time to update
the MAINTAINERS entry to reflect their contributions and clarify their
role.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220610214313.42903-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: IPC4: Add topology, control and PCM ops
Mark Brown [Mon, 13 Jun 2022 17:12:49 +0000 (18:12 +0100)]
ASoC: SOF: IPC4: Add topology, control and PCM ops

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

This set of patches includes changes to add the topology, control and
PCM ops for IPC4. It also includes a couple of patches to set the IPC4
BE DAI trigger ops for SSP/DMIC/HDA type DAI's.

2 years agoASoC: wcd938x: Fix event generation for some controls
Mark Brown [Fri, 3 Jun 2022 12:25:26 +0000 (14:25 +0200)]
ASoC: wcd938x: Fix event generation for some controls

Currently wcd938x_*_put() unconditionally report that the value of the
control changed, resulting in spurious events being generated. Return 0 in
that case instead as we should. There is still an issue in the compander
control which is a bit more complex.

Signed-off-by: Mark Brown <broonie@kernel.org>
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/20220603122526.3914942-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: hdmi-codec: Update to modern DAI terminology
Mark Brown [Thu, 2 Jun 2022 10:30:29 +0000 (12:30 +0200)]
ASoC: hdmi-codec: Update to modern DAI terminology

As part of retiring the old defines used to specify DAI formats update the
hdmi_codec driver to use the modern names, including the variables in the
struct hdmi_codec_daifmt exported to the DRM drivers.

In updating this I did note that the only use of this information in DRM
drivers is to reject clock provider settings, thinking about what this
hardware is doing I rather suspect that there might not be any hardware
out there which needs the configuration so it may be worth considering
just having hdmi-codec support only clock consumer.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20220602103029.3498791-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: wcd9335: Fix spurious event generation
Mark Brown [Fri, 3 Jun 2022 12:46:09 +0000 (14:46 +0200)]
ASoC: wcd9335: Fix spurious event generation

The slimbus mux put operation unconditionally reports a change in value
which means that spurious events are generated. Fix this by exiting early
in that case.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20220603124609.4024666-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: wcd9335: Remove RX channel from old list before adding it to a new one
Yassine Oudjana [Mon, 6 Jun 2022 15:22:26 +0000 (19:22 +0400)]
ASoC: wcd9335: Remove RX channel from old list before adding it to a new one

Currently in slim_rx_mux_put, an RX channel gets added to a new list
even if it is already in one. This can mess up links and make either
it, the new list head, or both, get linked to the wrong entries.
This can cause an entry to link to itself which in turn ends up
making list_for_each_entry in other functions loop infinitely.
To avoid issues, always remove the RX channel from any list it's in
before adding it to a new list.

Signed-off-by: Yassine Oudjana <y.oudjana@protonmail.com>
Link: https://lore.kernel.org/r/20220606152226.149164-1-y.oudjana@protonmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Add support ctx_save with IPC4
Mark Brown [Fri, 10 Jun 2022 17:28:20 +0000 (18:28 +0100)]
ASoC: SOF: Add support ctx_save with IPC4

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

The context save functionality with IPC4 is triggered by sending a message to
the firmware about the pending power down of the primary core by the host.

In order to have this functionality implemented in a clean way we need to
introduce a new IPC level PM ops for core state management and use that instead
of open coding IPC messages here and there.

The first patch updates the ctx store/ctx_restore documentation to clarify that
they are optional.

2 years agoASoC: qdsp6: q6apm-dai: unprepare stream if its already prepared
Srinivas Kandagatla [Fri, 10 Jun 2022 14:48:18 +0000 (15:48 +0100)]
ASoC: qdsp6: q6apm-dai: unprepare stream if its already prepared

prepare callback can be called multiple times, so unprepare the stream
if its already prepared.

Without this DSP is not happy to setting the params on a already
prepared graph.

Fixes: 9b4fe0f1cd79 ("ASoC: qdsp6: audioreach: add q6apm-dai support")
Reported-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220610144818.511797-1-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Remove unused hw_write_t type
Amadeusz Sławiński [Fri, 10 Jun 2022 12:44:20 +0000 (14:44 +0200)]
ASoC: Remove unused hw_write_t type

Commit 81da8a0b7975 ("ASoC: remove codec hw_write/control_data") removed
use of hw_write_t in struct snd_soc_codec, but it left type definition.
Fully clean it up.

Fixes: 81da8a0b7975 ("ASoC: remove codec hw_write/control_data")
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220610124420.4160986-1-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: avs: Fix parsing UUIDs in topology
Amadeusz Sławiński [Fri, 10 Jun 2022 12:42:57 +0000 (14:42 +0200)]
ASoC: Intel: avs: Fix parsing UUIDs in topology

Use correct type for parsing UUIDs, this eliminates warning present,
when compiling with W=1.

Fixes: 34ae2cd53673 ("ASoC: Intel: avs: Add topology parsing infrastructure")
Reported-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220610124257.4160658-1-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc3-dtrace: Handle race during initialization
Mark Brown [Fri, 10 Jun 2022 16:21:29 +0000 (17:21 +0100)]
ASoC: SOF: ipc3-dtrace: Handle race during initialization

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

This series handles the race which can result missing the first position update
after the trace is enabled.
In short: the firmware might send the position update (if we have enough
trace data generated) after the dma-trace is enabled by the TRACE_DMA_PARAMS_EXT
message. Depending on scheduling, load, preemption on Linux side we have seen
that occasionally this first position update got missed and we missed reading it
out.

A new state and more strict handling of host_offset can overcome this issue,
making the dtrace more reliable.

2 years agoASoC: codecs: qualcomm move gain to S8_TLV
Mark Brown [Fri, 10 Jun 2022 15:57:37 +0000 (16:57 +0100)]
ASoC: codecs: qualcomm move gain to S8_TLV

Merge series from Srinivas Kandagatla <srinivas.kandagatla@linaro.org>:

Move all the digital and IIR gains form using SX_TLV to S8_TLV,
these gains are actually 8 bit gains with 7th signed bit and
ranges from -84dB to +40dB

Tested on DB410c with Headset playback

2 years agoASoC: codecs: Series of fixes for realtek codecs used on RVPs
Mark Brown [Fri, 10 Jun 2022 15:57:35 +0000 (16:57 +0100)]
ASoC: codecs: Series of fixes for realtek codecs used on RVPs

Merge series from Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>:

Our tests platforms do use realtek codecs, while implementing avs driver
and machine boards for it, we identified quite a lot of problems with
those codec drivers.

2 years agoASoC: SOF: ipc3-dtrace: use pm_runtime_resume_and_get()
Pierre-Louis Bossart [Fri, 10 Jun 2022 07:12:45 +0000 (10:12 +0300)]
ASoC: SOF: ipc3-dtrace: 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>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220610071245.26576-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: debug: Clarify the IPC timeout handling path
Peter Ujfalusi [Fri, 10 Jun 2022 08:04:21 +0000 (11:04 +0300)]
ASoC: SOF: debug: Clarify the IPC timeout handling path

The dmesg log message of "Firmware exception" causes lots of confusion as
the snd_sof_handle_fw_exception() is only called in case of an IPC tx
timeout, where such a message does not make much sense.

To not limit the snd_sof_handle_fw_exception() handler to just one error
case, add a parameter to allow the caller to specify a meaningful message
to be printed.

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>
Reviewed-by: Yaochun Hung <yc.hung@mediatek.com>
Link: https://lore.kernel.org/r/20220610080421.31453-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Introduce 'fixup_controls' card method
Martin Povišer [Mon, 6 Jun 2022 19:19:09 +0000 (21:19 +0200)]
ASoC: Introduce 'fixup_controls' card method

The new method is called just before the card is registered, providing
an opportune time for machine-level drivers to do some final controls
amending: deactivating individual controls or obtaining control
references for later use.

Some controls can be created by DAPM after 'late_probe' has been called,
hence the need for this new method.

Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
Link: https://lore.kernel.org/r/20220606191910.16580-5-povik+lin@cutebit.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: codecs: rt298: Reorganize jack detect handling
Cezary Rojewski [Thu, 9 Jun 2022 13:35:33 +0000 (15:35 +0200)]
ASoC: codecs: rt298: Reorganize jack detect handling

Clean up in order to use and expose .set_jack callback.

Signed-off-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/20220609133541.3984886-4-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: codecs: rt286: Reorganize jack detect handling
Cezary Rojewski [Thu, 9 Jun 2022 13:35:32 +0000 (15:35 +0200)]
ASoC: codecs: rt286: Reorganize jack detect handling

Clean up in order to use and expose .set_jack callback.

Signed-off-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/20220609133541.3984886-3-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: codecs: rt274: Always init jack_detect_work
Cezary Rojewski [Thu, 9 Jun 2022 13:35:31 +0000 (15:35 +0200)]
ASoC: codecs: rt274: Always init jack_detect_work

Improves readability by making sure the work is always initialized.

Signed-off-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/20220609133541.3984886-2-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: codecs: wcd9335: move gains from SX_TLV to S8_TLV
Srinivas Kandagatla [Thu, 9 Jun 2022 11:19:01 +0000 (12:19 +0100)]
ASoC: codecs: wcd9335: move gains from SX_TLV to S8_TLV

move all the digital gains form using SX_TLV to S8_TLV, these gains are
actually 8 bit gains with 7th signed bit and ranges from -84dB to +40dB

rest of the Qualcomm wcd codecs uses these properly.

Fixes: 8c4f021d806a ("ASoC: wcd9335: add basic controls")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220609111901.318047-3-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: codecs: msm8916-wcd-digital: move gains from SX_TLV to S8_TLV
Srinivas Kandagatla [Thu, 9 Jun 2022 11:19:00 +0000 (12:19 +0100)]
ASoC: codecs: msm8916-wcd-digital: move gains from SX_TLV to S8_TLV

move all the digital gains form using SX_TLV to S8_TLV, these gains are
actually 8 bit gains with 7th signed bit and ranges from -84dB to +40dB

rest of the Qualcomm wcd codecs uses these properly.

Fixes: ef8a4757a6db ("ASoC: msm8916-wcd-digital: Add sidetone support")
Fixes: 150db8c5afa1 ("ASoC: codecs: Add msm8916-wcd digital codec")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220609111901.318047-2-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: IPC4: add sdw blob
Bard Liao [Thu, 9 Jun 2022 03:26:43 +0000 (20:26 -0700)]
ASoC: SOF: IPC4: add sdw blob

Add IPC4 SoundWire blob. It includes a common IPC4 gateway and a multiple
ALH configuration struct which is used for storing the aggregated
SoundWire stream information.

Signed-off-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>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220609032643.916882-24-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoAsoC: SOF: ipc4-topology: Add dai_get_clk op
Ranjani Sridharan [Thu, 9 Jun 2022 03:26:42 +0000 (20:26 -0700)]
AsoC: SOF: ipc4-topology: Add dai_get_clk op

Define and set the dai_get_clk_op for IPC4.

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/20220609032643.916882-23-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc4-topology: Add support for SSP/DMIC DAI's
Ranjani Sridharan [Thu, 9 Jun 2022 03:26:41 +0000 (20:26 -0700)]
ASoC: SOF: ipc4-topology: Add support for SSP/DMIC DAI's

The copier config for SSP and DMIC type DAI copiers needs to be parsed
and matched with the runtime hw_config from the NHLT table. Along with
this, also add the change to set the node_id for these copier types.

Co-developed-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Signed-off-by: Jaska Uimonen <jaska.uimonen@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>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220609032643.916882-22-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Add a new IPC op for parsing topology manifest
Ranjani Sridharan [Thu, 9 Jun 2022 03:26:40 +0000 (20:26 -0700)]
ASoC: SOF: Add a new IPC op for parsing topology manifest

Add a new topology IPC op, parse_manifest. Define and set the op for
IPC4 and IPC4.

Co-developed-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
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/20220609032643.916882-21-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Add two new structures for topology manifest data
Ranjani Sridharan [Thu, 9 Jun 2022 03:26:39 +0000 (20:26 -0700)]
ASoC: SOF: Add two new structures for topology manifest data

Add a couple of structures for parsing and saving the topology manifest
data.

Co-developed-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
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/20220609032643.916882-20-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Intel: hda: init NHLT for IPC4
Ranjani Sridharan [Thu, 9 Jun 2022 03:26:38 +0000 (20:26 -0700)]
ASoC: SOF: Intel: hda: init NHLT for IPC4

Init and save the BIOS NHLT as part of the IPC4 FW data.
Add a kernel module param to override the BIOS NHLT with the NHLT from
the topology. Also, add the ops_free callback for all HDA platforms to
free the NHLT.

Co-developed-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Signed-off-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
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/20220609032643.916882-19-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Add ops_free
Ranjani Sridharan [Thu, 9 Jun 2022 03:26:37 +0000 (20:26 -0700)]
ASoC: SOF: Add ops_free

Add the ops_free callback in struct sof_dev_desc.

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/20220609032643.916882-18-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: IPC4: set the BE DAI ops
Ranjani Sridharan [Thu, 9 Jun 2022 03:26:36 +0000 (20:26 -0700)]
ASoC: SOF: IPC4: set the BE DAI ops

Add BE DAI drv ops for IPC4 for DMIC, SSP and HDA type DAI's.

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/20220609032643.916882-17-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc4-pcm: Expose sof_ipc4_set_pipeline_state()
Ranjani Sridharan [Thu, 9 Jun 2022 03:26:35 +0000 (20:26 -0700)]
ASoC: SOF: ipc4-pcm: Expose sof_ipc4_set_pipeline_state()

Expose the sof_ipc4_set_pipeline_state() function as it will be used in
the IPC4-specific BE DAI driver ops.

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/20220609032643.916882-16-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc4-topology: Add the dai_config op
Ranjani Sridharan [Thu, 9 Jun 2022 03:26:34 +0000 (20:26 -0700)]
ASoC: SOF: ipc4-topology: Add the dai_config op

Define and set the dai_config op for IPC4.

Co-developed-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Rander Wang <rander.wang@linux.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: 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>
Link: https://lore.kernel.org/r/20220609032643.916882-15-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc4-topology: Add route_setup/route_free ops
Ranjani Sridharan [Thu, 9 Jun 2022 03:26:33 +0000 (20:26 -0700)]
ASoC: SOF: ipc4-topology: Add route_setup/route_free ops

Define and set the route_setup/route_free ops for IPC4.

Co-developed-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Rander Wang <rander.wang@linux.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: 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/20220609032643.916882-14-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc4-topology: Add widget_setup/widget_free ops
Ranjani Sridharan [Thu, 9 Jun 2022 03:26:32 +0000 (20:26 -0700)]
ASoC: SOF: ipc4-topology: Add widget_setup/widget_free ops

Define and set the widget_setup/widget_free ops for IPC4.

Co-developed-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Rander Wang <rander.wang@linux.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: 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/20220609032643.916882-13-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: IPC4: Add pcm ops
Ranjani Sridharan [Thu, 9 Jun 2022 03:26:31 +0000 (20:26 -0700)]
ASoC: SOF: IPC4: Add pcm ops

Define and set the PCM ops for IPC4.

Co-developed-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
Co-developed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-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: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Yaochun Hung <yc.hung@mediatek.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220609032643.916882-12-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc4-topology: Add control IO ops
Ranjani Sridharan [Thu, 9 Jun 2022 03:26:30 +0000 (20:26 -0700)]
ASoC: SOF: ipc4-topology: Add control IO ops

Define the kcontrol IO ops for volume type controls for IPC4. Support
for other kcontrol types will be added later.

Co-developed-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Rander Wang <rander.wang@linux.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: Ranjani Sridharan <ranjani.sridharan@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: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220609032643.916882-11-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc4-topology: Add control_setup op
Ranjani Sridharan [Thu, 9 Jun 2022 03:26:29 +0000 (20:26 -0700)]
ASoC: SOF: ipc4-topology: Add control_setup op

Define the control_setup op for IPC4 topology IPC ops to handle the
volume kcontrol types. Support for other kcontrol types will be added in
the follow up patches.

Co-developed-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Rander Wang <rander.wang@linux.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: Ranjani Sridharan <ranjani.sridharan@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: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220609032643.916882-10-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc4-topology: Add support for parsing mixer widgets
Ranjani Sridharan [Thu, 9 Jun 2022 03:26:28 +0000 (20:26 -0700)]
ASoC: SOF: ipc4-topology: Add support for parsing mixer widgets

Add support for parsing and preparing mixer type widgets. Define the
token ID's and the associated token arrays needed to parse these
widgets.

Co-developed-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Rander Wang <rander.wang@linux.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: Ranjani Sridharan <ranjani.sridharan@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: Paul Olaru <paul.olaru@oss.nxp.com>
Link: https://lore.kernel.org/r/20220609032643.916882-9-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc4-topology: Add support for parsing and preparing pga widgets
Ranjani Sridharan [Thu, 9 Jun 2022 03:26:27 +0000 (20:26 -0700)]
ASoC: SOF: ipc4-topology: Add support for parsing and preparing pga widgets

Add support for parsing and preparing pga type widgets. Define the
token ID's and the associated token arrays needed to parse these
widgets.

Co-developed-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Rander Wang <rander.wang@linux.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: Ranjani Sridharan <ranjani.sridharan@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: Paul Olaru <paul.olaru@oss.nxp.com>
Link: https://lore.kernel.org/r/20220609032643.916882-8-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc4-topology: Add prepare op for DAI type widgets
Ranjani Sridharan [Thu, 9 Jun 2022 03:26:26 +0000 (20:26 -0700)]
ASoC: SOF: ipc4-topology: Add prepare op for DAI type widgets

Define the prepare op for the DAI type widgets for IPC4.
The prepare op is responsible for choosing the input/output audio
formats for these widgets based on the runtime PCM params, assigning the
instance ID and updating the total memory usage for the pipelines these
widgets belong to.

Co-developed-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Rander Wang <rander.wang@linux.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: Ranjani Sridharan <ranjani.sridharan@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: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220609032643.916882-7-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc4-topology: Add prepare op for AIF type widgets
Ranjani Sridharan [Thu, 9 Jun 2022 03:26:25 +0000 (20:26 -0700)]
ASoC: SOF: ipc4-topology: Add prepare op for AIF type widgets

Define the prepare op for the AIF type widgets for IPC4.
The prepare op is responsible for choosing the input/output audio
formats for these widgets based on the runtime PCM params, assigning the
instance ID and updating the total memory usage for the pipelines these
widgets belong to.

Co-developed-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Rander Wang <rander.wang@linux.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: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220609032643.916882-6-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc4-topology: Add support for parsing DAI_IN/DAI_OUT widgets
Ranjani Sridharan [Thu, 9 Jun 2022 03:26:24 +0000 (20:26 -0700)]
ASoC: SOF: ipc4-topology: Add support for parsing DAI_IN/DAI_OUT widgets

Add support for parsing and setting up the IPC structure for
DAI_IN/DAI_OUT type widgets in IPC4.

Co-developed-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Rander Wang <rander.wang@linux.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: Ranjani Sridharan <ranjani.sridharan@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: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220609032643.916882-5-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc4-topology: Add support for parsing AIF_IN/AIF_OUT widgets
Ranjani Sridharan [Thu, 9 Jun 2022 03:26:23 +0000 (20:26 -0700)]
ASoC: SOF: ipc4-topology: Add support for parsing AIF_IN/AIF_OUT widgets

Add support for parsing AIF_IN/AIF_OUT type widgets in IPC4. Add all the
new required token ID's for parsing these widgets to the list of tokens in
enum sof_tokens and the definitions of the token arrays corresponding to
each of the token ID's.

Also, upgrade the sof_widget_parse_tokens() function in the common
topology parser to be able to parse multiple sets of tokens for the
audio format and copier gateway config tokens.

Co-developed-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Rander Wang <rander.wang@linux.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: Ranjani Sridharan <ranjani.sridharan@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: Paul Olaru <paul.olaru@oss.nxp.com>
Link: https://lore.kernel.org/r/20220609032643.916882-4-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: IPC4: Introduce topology ops
Ranjani Sridharan [Thu, 9 Jun 2022 03:26:22 +0000 (20:26 -0700)]
ASoC: SOF: IPC4: Introduce topology ops

Introduce the topology ops for IPC4. Set the widget_ops and token_list
for parsing the scheduler type widget. Support for other widget types
will be added in the follow up patches.

Co-developed-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Rander Wang <rander.wang@linux.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: Ranjani Sridharan <ranjani.sridharan@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: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com>
Link: https://lore.kernel.org/r/20220609032643.916882-3-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Add topology tokens for IPC4
Ranjani Sridharan [Thu, 9 Jun 2022 03:26:21 +0000 (20:26 -0700)]
ASoC: SOF: Add topology tokens for IPC4

Add the required tokens for parsing the topology for IPC4.

Co-developed-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Rander Wang <rander.wang@linux.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: 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: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220609032643.916882-2-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc3-dtrace: Return from dtrace_read if there is no new data available
Peter Ujfalusi [Fri, 10 Jun 2022 08:01:19 +0000 (11:01 +0300)]
ASoC: SOF: ipc3-dtrace: Return from dtrace_read if there is no new data available

If no new trace data is available then return immediately, there is no
need to continue with the execution of the trace_read() function.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20220610080119.30880-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc3-dtrace: Add helper function to update the sdev->host_offset
Peter Ujfalusi [Fri, 10 Jun 2022 08:01:18 +0000 (11:01 +0300)]
ASoC: SOF: ipc3-dtrace: Add helper function to update the sdev->host_offset

We are using the READ_ONCE() on the debugfs read path for accessing
sdev->host_offset, but the set is not atomic or protected in any way.

Add a small helper to do the host_offset update and be really paranoid
about the a possible race in update

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20220610080119.30880-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc3-dtrace: Introduce SOF_DTRACE_INITIALIZING state
Peter Ujfalusi [Fri, 10 Jun 2022 08:01:17 +0000 (11:01 +0300)]
ASoC: SOF: ipc3-dtrace: Introduce SOF_DTRACE_INITIALIZING state

With the new state we can make sure we are not missing the first
host_offset update.

In case the dtrace is small, the DMA copy will be fast and depending on
the moonphase it might be done before we set the sdev->dtrace_state  to
SOF_DTRACE_ENABLED.

The DMA will start the copy as soon as the host starts the DMA. Set the
dtrace to enabled before we let the DMA to run in order to avoid missing
the position update.

The new state is needed to cover architectures where the host side
snd_sof_dma_trace_trigger() is a NOP and the dtrace in the firmware is
ready as soon as the IPC message has been processed.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20220610080119.30880-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc4: implement pm ctx_save callback
Peter Ujfalusi [Fri, 10 Jun 2022 08:35:49 +0000 (11:35 +0300)]
ASoC: SOF: ipc4: implement pm ctx_save callback

Use the context save callback to power down the primary core which is used
by the firmware as an indication that the DSP is going to be turned off.

The IMR boot setup is done in response to the primary core power down.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@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/20220610083549.16773-7-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Intel: Switch to use the generic pm_ops.set_core_state
Peter Ujfalusi [Fri, 10 Jun 2022 08:35:48 +0000 (11:35 +0300)]
ASoC: SOF: Intel: Switch to use the generic pm_ops.set_core_state

Instead of craft and send an IPC(3) message in hda_dsp_core_get(),
tgl_dsp_core_get() and tgl_dsp_core_put(), use the generic ops for handling
the IPC dependent implementation of core power on/off.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@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/20220610083549.16773-6-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc4: Add set_core_state pm_ops implementation
Peter Ujfalusi [Fri, 10 Jun 2022 08:35:47 +0000 (11:35 +0300)]
ASoC: SOF: ipc4: Add set_core_state pm_ops implementation

IPC4 uses the SET_DX message to enable/disable cores managed by the DSP.
The dx_state.core_mask indicates which core is going to change state,
the dx_state.dx_mask is to power on (1) or off (0) the core.
In the dx_mask only those bits (cores) checked which bit is set in the
core_mask, other bits (cores) ignored.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@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/20220610083549.16773-5-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc3: Add set_core_state pm_ops implementation
Peter Ujfalusi [Fri, 10 Jun 2022 08:35:46 +0000 (11:35 +0300)]
ASoC: SOF: ipc3: Add set_core_state pm_ops implementation

IPC3 uses sof_ipc_pm_core_config message
(SOF_IPC_GLB_PM_MSG | SOF_IPC_PM_CORE_ENABLE) to enable/disable cores
managed by the DSP.
The core state is set via a single bitfield, if the bit is 1 the core
should be on, if it is 0 then it is off.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@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/20220610083549.16773-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: sof_ipc_pm_ops: Add support for DSP core power management
Peter Ujfalusi [Fri, 10 Jun 2022 08:35:45 +0000 (11:35 +0300)]
ASoC: SOF: sof_ipc_pm_ops: Add support for DSP core power management

Add a new ops for handling DSP core power state which can be used to tell
the DSP to turn on/off a core (or to inform it that a core is going to be
turned on/off if the core is host managed).

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@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/20220610083549.16773-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: make ctx_store and ctx_restore as optional
Peter Ujfalusi [Fri, 10 Jun 2022 08:35:44 +0000 (11:35 +0300)]
ASoC: SOF: make ctx_store and ctx_restore as optional

Commit 657774acd00f ("ASoC: SOF: Make sof_suspend/resume IPC agnostic")
did not marked ctx_store and ctx_restore as Optional.

Fixes: 657774acd00f ("ASoC: SOF: Make sof_suspend/resume IPC agnostic")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@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/20220610083549.16773-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc3-topology: Move and correct size checks in sof_ipc3_control_load_bytes()
Peter Ujfalusi [Fri, 10 Jun 2022 08:47:35 +0000 (11:47 +0300)]
ASoC: SOF: ipc3-topology: Move and correct size checks in sof_ipc3_control_load_bytes()

Move the size checks prior to allocating memory as these checks do not need
the data to be allocated and in case of an error we would not need to free
the allocation.

The max size must not be less than the size of
struct sof_ipc_ctrl_data + struct sof_abi_hdr as the ABI header needs to
be present under all circumstances.
The check was incorrectly used or between the two size checks.

Fixes: b5cee8feb1d4 ("ASoC: SOF: topology: Make control parsing IPC agnostic")
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/20220610084735.19397-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: imx-audmux: remove unnecessary check of clk_disable_unprepare/clk_prepare_enable
Minghao Chi [Mon, 6 Jun 2022 03:37:05 +0000 (03:37 +0000)]
ASoC: imx-audmux: remove unnecessary check of clk_disable_unprepare/clk_prepare_enable

Because clk_disable_unprepare/clk_prepare_enable already checked NULL clock
parameter, so the additional checks are unnecessary, just remove them.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Link: https://lore.kernel.org/r/20220606033705.291048-1-chi.minghao@zte.com.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoSpecify clock provider directly to CPU DAIs
Mark Brown [Thu, 9 Jun 2022 10:26:00 +0000 (11:26 +0100)]
Specify clock provider directly to CPU DAIs

Merge series from Charles Keepax <ckeepax@opensource.cirrus.com>:

Currently the set_fmt callback always passes clock provider/consumer
with respect to the CODEC. This made sense when the framework was
directly broken down into platforms and CODECs. However, as things
are now broken down into components which can be connected as either
the CPU or CODEC side of a DAI link it simplifies things if each
side of the link is just told if it is provider or consumer of the
clocks. Making this change allows us to remove one of the last parts
of the ASoC core that needs to know if a driver is a CODEC driver,
where it flips the clock format specifier if a CODEC driver is used on
the CPU side of a DAI link, as well as just being conceptually more
consistent with componentisation.

The basic idea of this patch chain is to change the set_fmt callback
from specifying if the CODEC is provider/consumer into directly
specifying if the component is provider/consumer. To do this we add
some new defines, and then to preserve bisectability, the migration is
done by adding a new callback, converting over all existing CPU side
drivers, converting the core, and then finally reverting back to the
old callback.

Converting the platform drivers makes sense as the existing defines
are from the perspective of the CODEC and there are more CODEC drivers
than platform drivers.

Obviously a fair amount of this patch chain I was only able to build
test, so any testing that can be done would be greatly appreciated.

2 years agoASoC: SOF: Intel: hda-loader: Clarify the cl_dsp_init() flow
Peter Ujfalusi [Thu, 9 Jun 2022 08:59:49 +0000 (11:59 +0300)]
ASoC: SOF: Intel: hda-loader: Clarify the cl_dsp_init() flow

Update the comment for the cl_dsp_init() to clarify what is done by the
function and use the chip->init_core_mask instead of BIT(0) when
unstalling/running the init core.

Complements: 2a68ff846164 ("ASoC: SOF: Intel: hda: Revisit IMR boot sequence")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@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: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220609085949.29062-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Intel: hda-loader: Make sure that the fw load sequence is followed
Peter Ujfalusi [Thu, 9 Jun 2022 08:59:48 +0000 (11:59 +0300)]
ASoC: SOF: Intel: hda-loader: Make sure that the fw load sequence is followed

The hda_dsp_enable_core() is powering up _and_ unstall the core in one
call while the first step of the firmware loading  must not unstall the
core.
The core can be unstalled only after the set cpb_cfp and the configuration
of the IPC register for the ROM_CONTROL message.

Complements: 2a68ff846164 ("ASoC: SOF: Intel: hda: Revisit IMR boot sequence")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@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: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220609085949.29062-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Intel: hda-dsp: Expose hda_dsp_core_power_up()
Peter Ujfalusi [Thu, 9 Jun 2022 08:59:47 +0000 (11:59 +0300)]
ASoC: SOF: Intel: hda-dsp: Expose hda_dsp_core_power_up()

The hda_dsp_core_power_up() needs to be exposed so that it can be used in
hda-loader.c to correct the boot flow.
The first step must not unstall the core, it should only power up the
core(s).

Add sanity check for the core_mask while exposing it to be safe.

Complements: 2a68ff846164 ("ASoC: SOF: Intel: hda: Revisit IMR boot sequence")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@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: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220609085949.29062-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: fsl_sai: Enable MCTL_MCLK_EN bit for master mode
Shengjiu Wang [Thu, 19 May 2022 12:36:48 +0000 (20:36 +0800)]
ASoC: fsl_sai: Enable MCTL_MCLK_EN bit for master mode

On i.MX8MM, the MCTL_MCLK_EN bit it is not only the gate
for MCLK output to PAD, but also the gate bit between
root clock and SAI module, So it is need to be enabled
for master mode, otherwise there is no bclk generated.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1652963808-14515-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: ak4613: cares Simple-Audio-Card case for TDM
Kuninori Morimoto [Wed, 8 Jun 2022 02:09:16 +0000 (02:09 +0000)]
ASoC: ak4613: cares Simple-Audio-Card case for TDM

Renesas is the only user of ak4613 on upstream for now, and
commit f28dbaa958fbd8 ("ASoC: ak4613: add TDM256 support")
added TDM256 support. Renesas tested part of it, because of
board connection.

It was assuming ak4613 is probed via Audio-Graph-Card, but it
might be probed via Simple-Audio-Card either.
It will indicates WARNING in such case. This patch fixup it.

Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/87h74v29f7.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>