OSDN Git Service

tomoyo/tomoyo-test1.git
2 years agoASoC: SOF: intel: hda: Drop 'error' prefix from error dump functions
Peter Ujfalusi [Wed, 6 Oct 2021 11:06:41 +0000 (14:06 +0300)]
ASoC: SOF: intel: hda: Drop 'error' prefix from error dump functions

Drop the 'error' prefix printed in hda_dsp_dump_ext_rom_status(),
hda_ipc_irq_dump() and hda_ipc_dump() as it gives no value to the
information we print.

The DSP and IPC dump is marked now, which makes the 'error' prefix more
redundant.

Signed-off-by: Peter 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/20211006110645.26679-16-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Introduce macro to set the firmware state
Peter Ujfalusi [Wed, 6 Oct 2021 11:06:40 +0000 (14:06 +0300)]
ASoC: SOF: Introduce macro to set the firmware state

Add sof_set_fw_state() macro to wrap the sdev->fw_state management to allow
actions to be taken when certain state is set or when state is changing.

Signed-off-by: Peter 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/20211006110645.26679-15-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ops: Force DSP panic dumps to be printed
Peter Ujfalusi [Wed, 6 Oct 2021 11:06:39 +0000 (14:06 +0300)]
ASoC: SOF: ops: Force DSP panic dumps to be printed

If a DSP panic happens we want to see the dumps.

Signed-off-by: Peter 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/20211006110645.26679-14-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc: Re-enable dumps after successful IPC tx
Peter Ujfalusi [Wed, 6 Oct 2021 11:06:38 +0000 (14:06 +0300)]
ASoC: SOF: ipc: Re-enable dumps after successful IPC tx

The dumps are silenced after an IPC tx timeout by default.
The IPC timeout can indicate severe error (firmware crash) or in some cases
it is less devastating and the firmware remains operational, the timeout
was due to a scheduling spike or other anomaly.

In any case consequent IPC timeouts will not print dumps but if any IPC do
succeed than we should re-enable the dumps to print dumps the next time
a timeout might happen.

Signed-off-by: Peter 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/20211006110645.26679-13-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: debug: Print out the fw_state along with the DSP dump
Peter Ujfalusi [Wed, 6 Oct 2021 11:06:37 +0000 (14:06 +0300)]
ASoC: SOF: debug: Print out the fw_state along with the DSP dump

The fw state can be an important information along with the DSP dump.
Print it out before the dump.

Signed-off-by: Peter 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/20211006110645.26679-12-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Drop SOF_DBG_DUMP_FORCE_ERR_LEVEL and sof_dev_dbg_or_err
Peter Ujfalusi [Wed, 6 Oct 2021 11:06:36 +0000 (14:06 +0300)]
ASoC: SOF: Drop SOF_DBG_DUMP_FORCE_ERR_LEVEL and sof_dev_dbg_or_err

The sof_dev_dbg_or_err() is only used by intel/hda.c when dumping dsp
debug information.
It was used to print the extended rom status in either dev_dbg (during
retries) and finally with dev_err, but other lines were printed with
dev_err regardless.

Since we now only print the dump once, the flag and the macros is no longer
needed.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211006110645.26679-11-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: intel: hda-loader: Use snd_sof_dsp_dbg_dump() for DSP dump
Peter Ujfalusi [Wed, 6 Oct 2021 11:06:35 +0000 (14:06 +0300)]
ASoC: SOF: intel: hda-loader: Use snd_sof_dsp_dbg_dump() for DSP dump

Do not call directly the hda_dsp_dump(), use the generic wrapper instead
to provide consistent output.

Mark the DSP dumps as optional to not spam the kernel log with the
exception of the last dump in case the DSP fails to run.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211006110645.26679-10-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: debug: Add SOF_DBG_DUMP_OPTIONAL flag for DSP dumping
Peter Ujfalusi [Wed, 6 Oct 2021 11:06:34 +0000 (14:06 +0300)]
ASoC: SOF: debug: Add SOF_DBG_DUMP_OPTIONAL flag for DSP dumping

The new SOF_DBG_DUMP_OPTIONAL flag can be used to mark a DSP dump that
should only be printed when the SOF_DBG_PRINT_ALL_DUMPS sof_core_debug
flag is set, otherwise it should be ignored and not 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>
Link: https://lore.kernel.org/r/20211006110645.26679-9-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: debug/ops: Move the IPC and DSP dump functions out from the header
Peter Ujfalusi [Wed, 6 Oct 2021 11:06:33 +0000 (14:06 +0300)]
ASoC: SOF: debug/ops: Move the IPC and DSP dump functions out from the header

To be usable in platform code, move the IPC and DSP dump function to
debug.c and export it in a similar way as the snd_sof_handle_fw_exception()

Make the snd_sof_ipc_dump() static as it is only used in debug.c

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211006110645.26679-8-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: intel: atom: No need to do a DSP dump in atom_run()
Peter Ujfalusi [Wed, 6 Oct 2021 11:06:32 +0000 (14:06 +0300)]
ASoC: SOF: intel: atom: No need to do a DSP dump in atom_run()

The core already prints a dump if the DSP failed to start in
snd_sof_run_firmware(), there is no need to print it locally as well.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211006110645.26679-7-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: loader: Print the DSP dump if boot fails
Peter Ujfalusi [Wed, 6 Oct 2021 11:06:31 +0000 (14:06 +0300)]
ASoC: SOF: loader: Print the DSP dump if boot fails

It can be useful to print the DSP dump from the core in case the DSP boot
failed.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211006110645.26679-6-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Print the dbg_dump and ipc_dump once to reduce kernel log noise
Peter Ujfalusi [Wed, 6 Oct 2021 11:06:30 +0000 (14:06 +0300)]
ASoC: SOF: Print the dbg_dump and ipc_dump once to reduce kernel log noise

Do not print the dump more than once to keep the kernel log cleaner in case
of a firmware failure.

When the DSP is rebooted due to suspend or runtime_suspend reset the flags
to re-enable the dump prints.

Add also a debug flag to print all dumps to get more coverage if needed.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211006110645.26679-5-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc and dsp dump: Add markers for better visibility
Peter Ujfalusi [Wed, 6 Oct 2021 11:06:29 +0000 (14:06 +0300)]
ASoC: SOF: ipc and dsp dump: Add markers for better visibility

Add markers to identify the start and end of the IPC and DSP dumps in the
kernel log.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211006110645.26679-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: debug: Swap the dsp_dump and ipc_dump sequence for fw_exception
Peter Ujfalusi [Wed, 6 Oct 2021 11:06:28 +0000 (14:06 +0300)]
ASoC: SOF: debug: Swap the dsp_dump and ipc_dump sequence for fw_exception

snd_sof_dsp_panic() only prints dsp_dump followed by flushing the DMA trace
buffer.

To retain similar 'sequence' first do an ipc_dump then the dsp_dump and
finally flush the trace buffer in case of fw_exception.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211006110645.26679-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: core: debug: force all processing on primary core
Pierre-Louis Bossart [Wed, 6 Oct 2021 11:06:27 +0000 (14:06 +0300)]
ASoC: SOF: core: debug: force all processing on primary core

The topology file currently provides information on which
pipeline/processing is to be scheduled on which DSP core.

To help diagnose potential issues, this patch provides an override of
the 'core' tokens to use the primary core (typically core0). Of course
this may result in a Core0 activity that exceeds hardware
capabilities, so this should only be used when the total processing
fits on DSP - possibly using firmware mockup processing and stubs.

No new dmesg log was added to avoid adding noise during topology
parsing, but the existing logs will show the primary core being used.

This is strictly for validation/debug, products should NEVER use this
override, the topology is assumed to be the description of the
firmware graph.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20211006110645.26679-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoMerge series "ASoC: Intel: machine driver updates for 5.16" from Pierre-Louis Bossart...
Mark Brown [Tue, 5 Oct 2021 15:25:24 +0000 (16:25 +0100)]
Merge series "ASoC: Intel: machine driver updates for 5.16" from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

One quirk for a Dell TigerLake/SoundWire device, and initial support
for platforms based on the ES8336 codec (aka ES8316). For full
functionality, an update of the codec driver will be needed.

Pierre-Louis Bossart (5):
  ASoC: Intel: soc-acpi: apl/glk/tgl: add entry for devices based on
    ES8336 codec
  ALSA: intel-dsp-config: add quirk for APL/GLK/TGL devices based on
    ES8336 codec
  ASoC: Intel: add machine driver for SOF+ES8336
  ASoC: Intel: soc-acpi: add missing quirk for TGL SDCA single amp
  ASoC: Intel: sof_sdw: add missing quirk for Dell SKU 0A45

 sound/hda/intel-dsp-config.c                  |  22 +-
 sound/soc/intel/boards/Kconfig                |  14 +
 sound/soc/intel/boards/Makefile               |   2 +
 sound/soc/intel/boards/sof_es8336.c           | 569 ++++++++++++++++++
 sound/soc/intel/boards/sof_sdw.c              |  10 +
 .../intel/common/soc-acpi-intel-bxt-match.c   |   6 +
 .../intel/common/soc-acpi-intel-glk-match.c   |   7 +-
 .../intel/common/soc-acpi-intel-tgl-match.c   |  47 ++
 8 files changed, 674 insertions(+), 3 deletions(-)
 create mode 100644 sound/soc/intel/boards/sof_es8336.c

--
2.25.1

2 years agoMerge series "ASoC: SOF: Intel: add flags to turn on SSP clocks early" from Pierre...
Mark Brown [Tue, 5 Oct 2021 15:25:23 +0000 (16:25 +0100)]
Merge series "ASoC: SOF: Intel: add flags to turn on SSP clocks early" from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

With the chip shortage, some GeminiLake Intel-based designs were
respun and now rely on codecs that need the SSP bit clock turned on in
the hw_params stage, not the trigger stage. This patchset mirrors the
flags added in the SOF DAI_CONFIG IPC, and sets the flags when this
capability is indicated as necessary in the topology files where the
SSP configuration is stored.

We initially considered a more generic solution with an on-demand SSP
clock activation using the common clock framework. This would be a
more elegant solution indeed, but it would have required more
intrusive changes that would conflict with the SOF multi-client
support (in-development), and more backport hassles on product
branches. The on-demand activation of clocks is still a desired
feature that will be enabled at a later point.

Bard Liao (1):
  ASoC: SOF: dai-intel: add SOF_DAI_INTEL_SSP_CLKCTRL_MCLK/BCLK_ES bits

Pierre-Louis Bossart (4):
  ASoC: SOF: dai: mirror group_id definition added in firmware
  ASoC: SOF: dai: include new flags for DAI_CONFIG
  ASoC: SOF: Intel: hda: add new flags for DAI_CONFIG
  ASoC: SOF: Intel: hda-dai: improve SSP DAI handling for dynamic
    pipelines

 include/sound/sof/dai-intel.h |  4 ++
 include/sound/sof/dai.h       | 10 ++++-
 sound/soc/sof/intel/hda-dai.c | 82 ++++++++++++++++++++++++++++++++++-
 sound/soc/sof/intel/hda.c     |  6 +++
 sound/soc/sof/sof-audio.c     |  4 ++
 5 files changed, 103 insertions(+), 3 deletions(-)

--
2.25.1

2 years agoMerge series "ASoC: SOF: topology: minor updates" from Pierre-Louis Bossart <pierre...
Mark Brown [Tue, 5 Oct 2021 15:25:22 +0000 (16:25 +0100)]
Merge series "ASoC: SOF: topology: minor updates" from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

Two patches to visualize settings and override dynamic pipelines + one
correction for errors on connections.

Pierre-Louis Bossart (2):
  ASoC: SOF: topology: show clks_control value in dynamic debug
  ASoC: SOF: topology: allow for dynamic pipelines override for debug

Ranjani Sridharan (1):
  ASoC: SOF: topology: return error if sof_connect_dai_widget() fails

 sound/soc/sof/sof-priv.h |  6 ++++++
 sound/soc/sof/topology.c | 24 +++++++++++++++---------
 2 files changed, 21 insertions(+), 9 deletions(-)

--
2.25.1

2 years agoASoC: SOF: OF: Add fw_path and tplg_path parameters
Daniel Baluta [Tue, 5 Oct 2021 07:19:49 +0000 (10:19 +0300)]
ASoC: SOF: OF: Add fw_path and tplg_path parameters

This allows specifying an alternate path for SOF firmware or
SOF topology.

This is particularly useful for i.MX when running Linux vs Android.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.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/20211005071949.1277613-1-daniel.baluta@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: amd: acp-rt5645: Constify static snd_soc_ops
Rikard Falkeborn [Mon, 4 Oct 2021 22:45:14 +0000 (00:45 +0200)]
ASoC: amd: acp-rt5645: Constify static snd_soc_ops

The struct cz_aif1_ops is only assigned to the ops field in the
snd_soc_dai_link struct which is a pointer to const struct snd_soc_ops.
Make it const to allow the compiler to put it in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20211004224514.8783-1-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: topology: return error if sof_connect_dai_widget() fails
Ranjani Sridharan [Mon, 4 Oct 2021 21:27:29 +0000 (16:27 -0500)]
ASoC: SOF: topology: return error if sof_connect_dai_widget() fails

Return the error if sof_connect_dai_widget() fails to
abort topology loading and prevent card registration.

Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211004212729.199550-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: topology: allow for dynamic pipelines override for debug
Pierre-Louis Bossart [Mon, 4 Oct 2021 21:27:28 +0000 (16:27 -0500)]
ASoC: SOF: topology: allow for dynamic pipelines override for debug

For debug and community support, it's useful to expose a kernel
parameter to prevent the use of dynamic pipelines exposed in a
topology file, or conversely to force an existing topology to use
dynamic pipelines.

Add an override bit and an enable bit which is valid only when the
override is set.

For products, the intent is that the topology file defines the
behavior, these two bits are only intended for diagnosis and
performance checks.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211004212729.199550-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: topology: show clks_control value in dynamic debug
Pierre-Louis Bossart [Mon, 4 Oct 2021 21:27:27 +0000 (16:27 -0500)]
ASoC: SOF: topology: show clks_control value in dynamic debug

We log most of the SSP configurations except the clks_control. This
will be used to enable bclk/mclk early start so it's useful to show
the information to the user.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211004212729.199550-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Intel: hda-dai: improve SSP DAI handling for dynamic pipelines
Pierre-Louis Bossart [Mon, 4 Oct 2021 17:14:30 +0000 (12:14 -0500)]
ASoC: SOF: Intel: hda-dai: improve SSP DAI handling for dynamic pipelines

In order to keep the widget use_count balanced, make sure the DAI
widgets are allocated once in hw_params and released in hw_free. A
'setup' status flag is used to deal with cases where the .hw_params
callback is invoked multiple times, and likewise with cases where
hw_free is invoked without hw_params being called first (which can
happen if the FE hw_params fails).

In addition, this patch frees the widgets in the suspend transition,
and reallocates them in the .prepare callback. The 'setup' flag helps
in this case differentiate between resume (setup needed) and
xruns (setup not needed).

This balanced operation was not needed previously but will be required
when SOF dynamic pipelines are enabled.

Co-developed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20211004171430.103674-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: dai-intel: add SOF_DAI_INTEL_SSP_CLKCTRL_MCLK/BCLK_ES bits
Bard Liao [Mon, 4 Oct 2021 17:14:29 +0000 (12:14 -0500)]
ASoC: SOF: dai-intel: add SOF_DAI_INTEL_SSP_CLKCTRL_MCLK/BCLK_ES bits

Add two clks_control bits. MCLK and/or BCLK will start during hw_params
and stop during hw_free if the corresponding bit is set.

While the kernel does not do anything with these bitfields, this is
also tagged as part of the ABI 3.19 changes.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Brent Lu <brent.lu@intel.com>
Link: https://lore.kernel.org/r/20211004171430.103674-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Intel: hda: add new flags for DAI_CONFIG
Pierre-Louis Bossart [Mon, 4 Oct 2021 17:14:28 +0000 (12:14 -0500)]
ASoC: SOF: Intel: hda: add new flags for DAI_CONFIG

The DAI_CONFIG is used for both hw_params and hw_free. Use flags to
specify what stage the configuration applies to.

the DAI_CONFIG IPC may be sent also during the widget setup so each
flag is cleared after the IPC to restore the state.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Brent Lu <brent.lu@intel.com>
Link: https://lore.kernel.org/r/20211004171430.103674-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: dai: include new flags for DAI_CONFIG
Pierre-Louis Bossart [Mon, 4 Oct 2021 17:14:27 +0000 (12:14 -0500)]
ASoC: SOF: dai: include new flags for DAI_CONFIG

Mirror changes done in SOF tree. The changes do not rely on
BIT/GENMASK on purpose to keep the structure and flags common with the
firmware tree.

The DAI_CONFIG IPC is currently used in multiple ways. It is sent to
the DSP firmware when enabling static or dynamic pipelines, in
hw_params or prepare callbacks for Intel SSP, HDaudio and ALH, on
trigger_stop and hw_free.

This IPC has been abused a bit in the past, i.e. the values used for
some of the DAI-specific fields are used to either allocate or free
resources. Two typical examples are Intel HDaudio and SoundWire/ALH
DAIs, where using a zero DMA channel number or stream tag signals to
the firmware the DMA channels or tags allocated earlier can be freed.

Rather than add a new IPC for 'hw_params' and 'hw_free', this patch
suggests supporting a 2-bit value conveying the 'stage' information in
an existing IPC structure. Only 3 possible values are used.

The mapping between HW_PARAMS and HW_FREE flags and ALSA definitions
is not strictly 1:1, e.g. in some cases the HW_PARAM flag might be set
during the .prepare callback, while the HW_FREE might be sent during the
ALSA .trigger for stop/suspend.

The semantics of the flags is to reserve and start/stop all needed
resources, typically hardware related such as DMAs or clocks, when the
HW_PARAMS is set, while the HW_FREE flag allows the firmware to
release the resources allocated. The data transfers are still
controlled within the firmware through the propagation of the trigger
command.

The driver can then pass information that the DAI_CONFIG was invoked
in e.g. a pipeline/DAI setup, hw_params or hw_free stage without
having to use a special DAI-specific encoding. Unfortunately we can't
remove old encodings due to backwards-compatibility requirements but
for new cases, such as the SSP in follow-up patches, we can make the
IPC less cryptic.

This change is tagged as ABI 3.19 and is completely backwards compatible.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Brent Lu <brent.lu@intel.com>
Link: https://lore.kernel.org/r/20211004171430.103674-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: dai: mirror group_id definition added in firmware
Pierre-Louis Bossart [Mon, 4 Oct 2021 17:14:26 +0000 (12:14 -0500)]
ASoC: SOF: dai: mirror group_id definition added in firmware

This was added in ABI 3.17 but never added to the kernel tree. The
group_id is not currently used but this patch is required before
additional changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Brent Lu <brent.lu@intel.com>
Link: https://lore.kernel.org/r/20211004171430.103674-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: sof_sdw: add missing quirk for Dell SKU 0A45
Pierre-Louis Bossart [Mon, 4 Oct 2021 21:35:12 +0000 (16:35 -0500)]
ASoC: Intel: sof_sdw: add missing quirk for Dell SKU 0A45

This device is based on SDCA codecs but with a single amplifier
instead of two.

BugLink: https://github.com/thesofproject/linux/issues/3161
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Link: https://lore.kernel.org/r/20211004213512.220836-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: soc-acpi: add missing quirk for TGL SDCA single amp
Pierre-Louis Bossart [Mon, 4 Oct 2021 21:35:11 +0000 (16:35 -0500)]
ASoC: Intel: soc-acpi: add missing quirk for TGL SDCA single amp

We don't have a configuration for a single amp on link1.

BugLink: https://github.com/thesofproject/linux/issues/3161
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Link: https://lore.kernel.org/r/20211004213512.220836-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: add machine driver for SOF+ES8336
Pierre-Louis Bossart [Mon, 4 Oct 2021 21:35:10 +0000 (16:35 -0500)]
ASoC: Intel: add machine driver for SOF+ES8336

Add machine driver to support APL/GLK/TGL platforms.
The TGL platform supports DMIC, APL and GLK do not.

Co-developed-by: Huajun Li <huajun.li@intel.com>
Signed-off-by: Huajun Li <huajun.li@intel.com>
Signed-off-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/20211004213512.220836-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoALSA: intel-dsp-config: add quirk for APL/GLK/TGL devices based on ES8336 codec
Pierre-Louis Bossart [Mon, 4 Oct 2021 21:35:09 +0000 (16:35 -0500)]
ALSA: intel-dsp-config: add quirk for APL/GLK/TGL devices based on ES8336 codec

These devices are based on an I2C/I2S device, we need to force the use
of the SOF driver otherwise the legacy HDaudio driver will be loaded -
only HDMI will be supported.

Co-developed-by: Huajun Li <huajun.li@intel.com>
Signed-off-by: Huajun Li <huajun.li@intel.com>
Signed-off-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/20211004213512.220836-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: soc-acpi: apl/glk/tgl: add entry for devices based on ES8336 codec
Pierre-Louis Bossart [Mon, 4 Oct 2021 21:35:08 +0000 (16:35 -0500)]
ASoC: Intel: soc-acpi: apl/glk/tgl: add entry for devices based on ES8336 codec

A number of devices, such as the "Chuwi HI10x" and "UNIQCELL Q15.6",
are based on APL/GLK with an I2C/I2S ES8336 codec.

Add table to find topology and firmware files.

Co-developed-by: Huajun Li <huajun.li@intel.com>
Signed-off-by: Huajun Li <huajun.li@intel.com>
Signed-off-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/20211004213512.220836-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: dt-bindings: uniphier: Add description of each port number
Kunihiko Hayashi [Mon, 4 Oct 2021 02:12:26 +0000 (11:12 +0900)]
ASoC: dt-bindings: uniphier: Add description of each port number

To eliminate FIXME, add descriptions of what each port number is
associated with.

Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Link: https://lore.kernel.org/r/1633313546-23258-1-git-send-email-hayashi.kunihiko@socionext.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: cht_bsw_nau8824: Set card.components string
Hans de Goede [Sat, 2 Oct 2021 21:14:59 +0000 (23:14 +0200)]
ASoC: Intel: cht_bsw_nau8824: Set card.components string

Set the card.components string using the new nau8824_components() helper
which returns a components string based on the DMI quirks inside the
nau8824 codec driver.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20211002211459.110124-4-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: nau8824: Add a nau8824_components() helper
Hans de Goede [Sat, 2 Oct 2021 21:14:58 +0000 (23:14 +0200)]
ASoC: nau8824: Add a nau8824_components() helper

Some devices using the NAU8824 have only one speaker. To still have things
working properly this requires the left + right channels to both be mixed
to the left speaker output.

This mixer setup is done by userspace based on UCM profiles. But this
requires userspace to know that there is a mono-speaker. Add a helper
function (for the machine driver) to get a components string providing
this info.

This is done inside the codec driver because the codec driver already
has a DMI quirk table.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20211002211459.110124-3-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: nau8824: Add DMI quirk mechanism for active-high jack-detect
Hans de Goede [Sat, 2 Oct 2021 21:14:57 +0000 (23:14 +0200)]
ASoC: nau8824: Add DMI quirk mechanism for active-high jack-detect

Add a quirk mechanism to allow specifying that active-high jack-detection
should be used on platforms where this info is not available in devicetree.

And add an entry for the Cyberbook T116 tablet to the DMI table, so that
jack-detection will work properly on this tablet.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20211002211459.110124-2-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: nau8824: Fix NAU8824_JACK_LOGIC define
Hans de Goede [Sat, 2 Oct 2021 21:14:56 +0000 (23:14 +0200)]
ASoC: nau8824: Fix NAU8824_JACK_LOGIC define

The NAU8824_JACK_LOGIC define was wrong, for active high jack-detect
to work bit 1 needs to be set, rather then bit 0.

The correct bit was found in the Android kernel source dump for
a Cyberbook T116 tablet; and this was also tested on that same tablet.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211002211459.110124-1-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: rt5651: Use IRQF_NO_AUTOEN when requesting the IRQ
Hans de Goede [Sun, 3 Oct 2021 13:22:55 +0000 (15:22 +0200)]
ASoC: rt5651: Use IRQF_NO_AUTOEN when requesting the IRQ

Use the new IRQF_NO_AUTOEN flag when requesting the IRQ, rather then
disabling it immediately after requesting it.

This fixes a possible race where the IRQ might trigger between requesting
and disabling it; and this also leads to a small code cleanup.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20211003132255.31743-2-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: es8316: Use IRQF_NO_AUTOEN when requesting the IRQ
Hans de Goede [Sun, 3 Oct 2021 13:22:54 +0000 (15:22 +0200)]
ASoC: es8316: Use IRQF_NO_AUTOEN when requesting the IRQ

Use the new IRQF_NO_AUTOEN flag when requesting the IRQ, rather then
disabling it immediately after requesting it.

This fixes a possible race where the IRQ might trigger between requesting
and disabling it; and this also leads to a small code cleanup.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20211003132255.31743-1-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: nau8821: new driver
Seven Lee [Fri, 1 Oct 2021 10:31:08 +0000 (18:31 +0800)]
ASoC: nau8821: new driver

The driver is for codec NAU88L21 of Nuvoton Technology Corporation.
The NAU88L21 is an ultra-low power high performance audio codec that
supports both analog and digital audio functions.

Signed-off-by: Seven Lee <wtli@nuvoton.com>
Link: https://lore.kernel.org/r/20211001103108.3297848-1-wtli@nuvoton.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoMerge series "Add support for on demand pipeline setup/destroy" from Peter Ujfalusi...
Mark Brown [Fri, 1 Oct 2021 22:44:28 +0000 (23:44 +0100)]
Merge series "Add support for on demand pipeline setup/destroy" from Peter Ujfalusi <peter.ujfalusi@linux.intel.com>:

Hi,

The previous, v2 of this series was sent by Daniel Baluta:
https://lore.kernel.org/alsa-devel/20210917143659.401102-1-daniel.baluta@oss.nxp.com/

We have agreed that it might be better that someone from Intel is going to take it
from here as we already have the infrastructure up to test and verify the
dynamic pipelines support.

Changes since v2 (sent by Daniel Baluta):
- patch 10: Fix NULL point dereference in hda_dai_update_config()
- I have kept Daniel's SoB for the series.

Changes since v1:
- Signed-off-by tag added by Daniel

This series implements initial support for dynamic pipelines to setup/teardown
pipeline as needed when a PCM is open/closed.

Initially dynamic pipelines are only supported with single core setup which will
be expanded with a follow-up series.

Review with SOF community at
https://github.com/thesofproject/linux/pull/2794

The feature has been merged on 1st of April to sof-dev, all issues found since
has been fixed and squashed to this upstream series.

Regards,
Peter
---
Ranjani Sridharan (12):
  ASoC: topology: change the complete op in snd_soc_tplg_ops to return
    int
  ASoC: SOF: control: Add access field in struct snd_sof_control
  ASoC: SOF: topology: Add new token for dynamic pipeline
  ASoC: SOF: sof-audio: add helpers for widgets, kcontrols and dai
    config set up
  AsoC: dapm: export a couple of functions
  ASoC: SOF: Add new fields to snd_sof_route
  ASoC: SOF: restore kcontrols for widget during set up
  ASoC: SOF: Don't set up widgets during topology parsing
  ASoC: SOF: Introduce widget use_count
  ASoC: SOF: Intel: hda: make sure DAI widget is set up before IPC
  ASoC: SOF: Add support for dynamic pipelines
  ASoC: SOF: topology: Add kernel parameter for topology verification

 include/sound/soc-dpcm.h               |   1 +
 include/sound/soc-topology.h           |   2 +-
 include/uapi/sound/sof/tokens.h        |   1 +
 sound/soc/intel/skylake/skl-topology.c |   6 +-
 sound/soc/soc-dapm.c                   |   2 +
 sound/soc/soc-pcm.c                    |   4 +-
 sound/soc/soc-topology.c               |  10 +-
 sound/soc/sof/intel/hda-dai.c          | 174 +++---
 sound/soc/sof/intel/hda.c              | 177 ++++--
 sound/soc/sof/intel/hda.h              |   5 +
 sound/soc/sof/ipc.c                    |  22 +
 sound/soc/sof/pcm.c                    |  58 +-
 sound/soc/sof/pm.c                     |   4 +-
 sound/soc/sof/sof-audio.c              | 709 +++++++++++++++++++------
 sound/soc/sof/sof-audio.h              |  32 +-
 sound/soc/sof/sof-priv.h               |   1 +
 sound/soc/sof/topology.c               | 362 +++++--------
 17 files changed, 1032 insertions(+), 538 deletions(-)

--
2.33.0

2 years agoASoC: fsl_spdif: implement bypass mode from in to out
Viorel Suman [Sun, 26 Sep 2021 09:49:20 +0000 (17:49 +0800)]
ASoC: fsl_spdif: implement bypass mode from in to out

Implement SPDIF bypass mode. It implies internal SoC
routing of SPDIF input signal to SPDIF output signal. The
test bed requires two boards: B1 configured in bypass mode,
and B2 to feed B1 SPDIF RX port and read B1 SPDIF TX port:
   B2 TX -> B1 RX,
   B2 RX <- B1 TX.
The test procedure:
 a) Boot both boards
 b) B2: start "arecord <spdifcard> -r 48kHz | aplay <local DAC>"
 c) B2: start "aplay <spdifcard> -r 48kHz <2ch 48kHz audio file>"
 d) B1: enable bypass mode:
amixer -cimxspdif cset numid=8,iface=PCM,name='Bypass Mode' on
 e) B2: check DAC audio, make sure the same sample rate is used at
steps b) and c), in example above the rate is 48kHz.
 f) B1: try to run "aplay" or "arecord" on imxspdif card while in
bypass mode - both must fail until bypass mode is disabled
 g) B1: disable bypass mode:
amixer -cimxspdif cset numid=8,iface=PCM,name='Bypass Mode' off
 h) B1: check the usual playback and capture on imxspdif card.
During this test try to set bypass mode - must not be allowed
while playback or capture is running.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1632649760-1651-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: topology: Add kernel parameter for topology verification
Ranjani Sridharan [Mon, 27 Sep 2021 12:05:17 +0000 (15:05 +0300)]
ASoC: SOF: topology: Add kernel parameter for topology verification

Add a kernel debug flag to enable a one-shot topology
verification for all pipelines including the dynamic
ones. If the debug flag is set, all the topology
component loading will be verified during the complete
callback.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20210927120517.20505-13-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Add support for dynamic pipelines
Ranjani Sridharan [Mon, 27 Sep 2021 12:05:16 +0000 (15:05 +0300)]
ASoC: SOF: Add support for dynamic pipelines

Add support for dynamic pipelines by modifying the PCM
hw_params ioctl implementation to determine the widgets
required for a PCM stream by querying the list of
connected DAPM widgets. This list is saved as part of
snd_sof_pcm_stream struct and will be used to setup the widgets.

The sof_widget_list_setup/free routines setup and free connected
DAPM widgets when a PCM is opened/closed. These routines accept
a list of connected DAPM widgets as input and determine the SOF
widgets, their corresponding pipeline widgets and connections
between them that need to be setup before the PCM is triggered.

Please note that the dynamic pipeline feature will only be enabled
for those pipelines whose dynamic_pipeline_widget flag is set in
topologies. Add a new token called SOF_TKN_SCHED_DYNAMIC_PIPELINE
that when set in topology will be applied to the
dynamic_pipeline_widget flag of the pipeline widget.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20210927120517.20505-12-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Intel: hda: make sure DAI widget is set up before IPC
Ranjani Sridharan [Mon, 27 Sep 2021 12:05:15 +0000 (15:05 +0300)]
ASoC: SOF: Intel: hda: make sure DAI widget is set up before IPC

With the implementation of the dynamic pipeline feature, widgets
will only be setup when a PCM is opened during the
hw_params ioctl. The BE hw_params callback is responsible for
sending the DAI_CONFIG for the DAI widgets in the DSP.
With dynamic pipelines, the DAI widgets will need to set up
first before sending the DAI_CONFIG IPC in the BE hw_params.

Update the BE hw_params/hw_free callbacks for all ALH, HDA and SSP
DAIs to set up/free the DAI widget before/after DAI_CONFIG IPC.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20210927120517.20505-11-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Introduce widget use_count
Ranjani Sridharan [Mon, 27 Sep 2021 12:05:14 +0000 (15:05 +0300)]
ASoC: SOF: Introduce widget use_count

Add a new field, use_count to struct snd_sof_widget to keep track
of the usage count for each widget. Since widgets can belong to
multiple pipelines, this field will ensure that the widget
is setup only when the first pipeline that needs it is started
and freed when the last pipeline that needs it is stopped. There is
no need to protect the widget use_count access as the core already
handles mutual exclusion at the PCM level.
Add a new helper sof_widget_free() to handle freeing the SOF
widgets and export the sof_widget_setup/free() functions.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20210927120517.20505-10-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Don't set up widgets during topology parsing
Ranjani Sridharan [Mon, 27 Sep 2021 12:05:13 +0000 (15:05 +0300)]
ASoC: SOF: Don't set up widgets during topology parsing

In preparation for supporting dynamic pipelines, move the
widget setup, DAI config IPCs to the complete callback
during topology loading. For current topology where all
the pipelines are static, all the pipelines will be set up
during complete. For topologies with dynamic and static pipelines,
this will enable setting up only the static ones  during
topology loading. Reuse the sof_restore_pipelines() function for
this purpose and rename it to sof_set_up_pipelines().

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20210927120517.20505-9-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: restore kcontrols for widget during set up
Ranjani Sridharan [Mon, 27 Sep 2021 12:05:12 +0000 (15:05 +0300)]
ASoC: SOF: restore kcontrols for widget during set up

Restore kcontrols for each widget after it has been set up
successfully.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Seppo Ingalsuo <seppo.ingalsuo@intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20210927120517.20505-8-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Add new fields to snd_sof_route
Ranjani Sridharan [Mon, 27 Sep 2021 12:05:11 +0000 (15:05 +0300)]
ASoC: SOF: Add new fields to snd_sof_route

Add two new fields to save the source widget and sink widget
pointers in struct snd_sof_route to make it easier to look up
routes by source/sink widget. Also, add a flag to indicate
if the route has been set up in the DSP. These will be used
when the dynamic pipeline feature is implemented and routes
will have to be set up at run time.

Also, add a new sof_tear_down_pipelines() callback, that will
used to reset the set up status for all routes during suspend.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20210927120517.20505-7-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoAsoC: dapm: export a couple of functions
Ranjani Sridharan [Mon, 27 Sep 2021 12:05:10 +0000 (15:05 +0300)]
AsoC: dapm: export a couple of functions

Export a couple of DAPM functions that can be used by
ASoC drivers to determine connected widgets when a PCM
is started.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20210927120517.20505-6-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: sof-audio: add helpers for widgets, kcontrols and dai config set up
Ranjani Sridharan [Mon, 27 Sep 2021 12:05:09 +0000 (15:05 +0300)]
ASoC: SOF: sof-audio: add helpers for widgets, kcontrols and dai config set up

Refactor the existing code to use helper functions to
set up/free widgets, send dai config and set up kcontrols for
widgets. These will be reused later on for setting up widgets in
the connected DAPM widgets list for a particular PCM when the
dynamic pipeline feature is implemented.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20210927120517.20505-5-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: topology: Add new token for dynamic pipeline
Ranjani Sridharan [Mon, 27 Sep 2021 12:05:08 +0000 (15:05 +0300)]
ASoC: SOF: topology: Add new token for dynamic pipeline

Today, we set up all widgets required for all PCM streams
at the time of topology parsing even if they are not
used. An optimization would be to only set up the widgets
required for currently active PCM streams. This would give
the FW the opportunity to power gate unused memory blocks,
thereby saving power.

For dynamic pipelines, the widgets in the connected DAPM path
for each PCM will need to be set up at runtime. This patch
introduces a new token, DYNAMIC_PIPELINE, for scheduler type
widgets that indicate whether a pipeline should be set up
statically during topology load or at runtime when the PCM is
opened. Introduce a new field called dynamic_pipeline_widget
in struct snd_sof_widget to save the value of the parsed token.

The token is set only for the pipeline (scheduler type)
widget and must be propagated to all widgets in the same
pipeline during topology load. Introduce another field called
pipe_widget in struct snd_sof_widget that saves the pointer to
the scheduler widget with the same pipeline ID as that of the
widget. This field is populated when the pipeline completion
callback is invoked during topology loading.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20210927120517.20505-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: control: Add access field in struct snd_sof_control
Ranjani Sridharan [Mon, 27 Sep 2021 12:05:07 +0000 (15:05 +0300)]
ASoC: SOF: control: Add access field in struct snd_sof_control

Add a new field to save the access setting for all controls
in struct snd_sof_control. This will be used to ensure that
only widgets belonging to static pipelines have volatile
controls.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20210927120517.20505-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: topology: change the complete op in snd_soc_tplg_ops to return int
Ranjani Sridharan [Mon, 27 Sep 2021 12:05:06 +0000 (15:05 +0300)]
ASoC: topology: change the complete op in snd_soc_tplg_ops to return int

In the SOF driver, the operations performed in the complete callback
can fail and therefore topology loading should return an error in
such cases. So, change the signature of the complete op
in struct snd_soc_tplg_ops to return an int to return the error.

Also, amend the complete callback functions in the SOF driver and
the SKL driver to conform with the new signature.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20210927120517.20505-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: qcom: apq8096: Constify static snd_soc_ops
Rikard Falkeborn [Fri, 1 Oct 2021 11:50:30 +0000 (13:50 +0200)]
ASoC: qcom: apq8096: Constify static snd_soc_ops

The struct iapq8096_ops is only assigned to the ops field in the
snd_soc_dai_link struct which is a pointer to const struct snd_soc_ops.
Make it const to allow the compiler to put it in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20211001115030.10402-1-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: rt5682s: Fix HP noise caused by SAR mode switch when the system resumes
Derek Fang [Fri, 1 Oct 2021 07:41:13 +0000 (15:41 +0800)]
ASoC: rt5682s: Fix HP noise caused by SAR mode switch when the system resumes

When the system resumes from S3, if the system plays a beep,
there is continuous "Zizi.." noise from HP that could be heard.
It is caused by the SAR mode switch during the combo jack
re-detection which be executed parallelly in a workqueue
after the system resumes.

This patch changes the behavior of SAR mode switch to
avoid this issue.

Signed-off-by: Derek Fang <derek.fang@realtek.com>
Link: https://lore.kernel.org/r/20211001074113.2223-2-derek.fang@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: rt5682s: Enable ASRC auto-disable to fix pop during jack plug-in while playback
Derek Fang [Fri, 1 Oct 2021 07:41:12 +0000 (15:41 +0800)]
ASoC: rt5682s: Enable ASRC auto-disable to fix pop during jack plug-in while playback

When codec's ASRC was enabled, the DA and AD filters use
the reference clk which tracks the I2S clks.
And if the I2S clks' timing of open and close are not expected,
this patch allows the filters to switch to use sysclk if
ASRC's ref clks disappeared and could fix the below possible issues:
1. Avoid DA filter to keep surplus samples.
2. Avoid that AD filter works failed during dapm's power on.

For example,
if I2S clks were closed before dacdat during playback off
due to jack unplug, it causes ref clks disappeared and
DA filter remained some samples which will produce pop noise
on the next HP playback.
ASRC auto-disable could clear the samples during the playback off.

Signed-off-by: Derek Fang <derek.fang@realtek.com>
Link: https://lore.kernel.org/r/20211001074113.2223-1-derek.fang@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: mediatek: mt8195: move of_node_put to remove function
Trevor Wu [Fri, 1 Oct 2021 03:16:01 +0000 (11:16 +0800)]
ASoC: mediatek: mt8195: move of_node_put to remove function

platforms->of_node and codes->of_node are assigned in probe function,
and of_node_put is called at the end of probe function, because of_node
seems to be not used after probe functon

In this patch, of_node_put is moved to platform remove function in case
of_node is used at any occasions after probe function in the future.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20211001031601.3953-1-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: sof_rt5682: Add support for max98360a speaker amp
Malik_Hsu [Fri, 1 Oct 2021 15:03:16 +0000 (23:03 +0800)]
ASoC: Intel: sof_rt5682: Add support for max98360a speaker amp

Add a board config adl_mx98360a_rt5682 to support alc5682 headset
codec and max98360a speaker amplifier. Follow Intel BT offload design
by connecting alc5682 to SSP0 and max98360a to SSP1.

Signed-off-by: Malik_Hsu <malik_hsu@wistron.corp-partner.google.com>
Signed-off-by: Brent Lu <brent.lu@intel.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211001150316.414141-1-brent.lu@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: tegra: Constify static snd_soc_ops
Rikard Falkeborn [Fri, 1 Oct 2021 11:45:17 +0000 (13:45 +0200)]
ASoC: tegra: Constify static snd_soc_ops

The struct tegra_machine_snd_ops is only assigned to the ops field in the
snd_soc_dai_link struct which is a pointer to const struct snd_soc_ops.
Make it const to allow the compiler to put it in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20211001114517.6752-1-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: soc-component: Remove conditional definition of debugfs data members
Simon Trimmer [Thu, 30 Sep 2021 14:21:16 +0000 (15:21 +0100)]
ASoC: soc-component: Remove conditional definition of debugfs data members

This simplification allows the use of the standard kernel pattern of
static inline dummy functions for debugfs code. Most systems will only
have a small number of snd_soc_components so the memory impact is
minimal.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Suggested-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210930142116.528878-1-simont@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: rt5682: move clk related code to rt5682_i2c_probe
Jack Yu [Wed, 29 Sep 2021 05:43:44 +0000 (13:43 +0800)]
ASoC: rt5682: move clk related code to rt5682_i2c_probe

The DAI clock is only used in I2S mode, to make it clear
and to fix clock resource release issue, we move CCF clock
related code to rt5682_i2c_probe to fix clock
register/unregister issue.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/20210929054344.12112-1-jack.yu@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: fsl_rpmsg: Add rpmsg audio support for i.MX8ULP
Shengjiu Wang [Thu, 30 Sep 2021 03:26:53 +0000 (11:26 +0800)]
ASoC: fsl_rpmsg: Add rpmsg audio support for i.MX8ULP

On i.MX8ULP the audio interface and codec are controlled
by Cortex-M domain, Cortex-M core provides audio service
over rpmsg.

The rpmsg audio function is almost same as i.MX7ULP
platform, so share same configuration.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1632972413-22130-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: wm_adsp: remove a repeated including
Guo Zhengkui [Wed, 29 Sep 2021 12:32:15 +0000 (20:32 +0800)]
ASoC: wm_adsp: remove a repeated including

Remove a repeated "#include <linux/firmware.h>" in line 32.

Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
Acked-by: Simon Trimmer <simont@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210929123217.5240-1-guozhengkui@vivo.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Change SND_SOC_SOF_TOPLEVEL from config to menuconfig
Peter Ujfalusi [Thu, 30 Sep 2021 07:04:38 +0000 (10:04 +0300)]
ASoC: SOF: Change SND_SOC_SOF_TOPLEVEL from config to menuconfig

We have growing number of options under SND_SOC_SOF_TOPLEVEL as SOF
adaptation is growing (Intel, NXP, AMD and Mediatek) and new features are
added.
It will make the menuconfig user experience much cleaner if we move the
SOF options under a separate page.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@gmail.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20210930070438.16846-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: dt-bindings: rt5682s: fix the device-tree schema errors
Derek Fang [Wed, 29 Sep 2021 13:04:06 +0000 (21:04 +0800)]
ASoC: dt-bindings: rt5682s: fix the device-tree schema errors

Fix the device-tree schema errors that be reported by using 'make
dt_binding_check'.

Signed-off-by: Derek Fang <derek.fang@realtek.com>
Link: https://lore.kernel.org/r/20210929130406.24325-1-derek.fang@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: rt5682s: Revise the macro RT5682S_PLLB_SRC_MASK
Derek Fang [Thu, 30 Sep 2021 10:29:28 +0000 (18:29 +0800)]
ASoC: rt5682s: Revise the macro RT5682S_PLLB_SRC_MASK

Revise the macro RT5682S_PLLB_SRC_MASK to 0x1
because the mux is only two-source.

Signed-off-by: Derek Fang <derek.fang@realtek.com>
Link: https://lore.kernel.org/r/20210930102928.28628-3-derek.fang@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: rt5682s: Use dev_dbg instead of pr_debug
Derek Fang [Thu, 30 Sep 2021 10:29:27 +0000 (18:29 +0800)]
ASoC: rt5682s: Use dev_dbg instead of pr_debug

It could observe the debug messages more clearly by using dev_dbg.

Signed-off-by: Derek Fang <derek.fang@realtek.com>
Link: https://lore.kernel.org/r/20210930102928.28628-2-derek.fang@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: rt5682s: Remove the volatile SW reset register from reg_default
Derek Fang [Thu, 30 Sep 2021 10:29:26 +0000 (18:29 +0800)]
ASoC: rt5682s: Remove the volatile SW reset register from reg_default

This reg is for SW reset.
It shouldn't have default value, so remove.

Signed-off-by: Derek Fang <derek.fang@realtek.com>
Link: https://lore.kernel.org/r/20210930102928.28628-1-derek.fang@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: ux500: mop500: Constify static snd_soc_ops
Rikard Falkeborn [Wed, 29 Sep 2021 09:44:01 +0000 (11:44 +0200)]
ASoC: ux500: mop500: Constify static snd_soc_ops

The struct mop500_ab8500_ops is only assigned to the ops field in the
snd_soc_dai_link struct which is a pointer to const struct snd_soc_ops.
Make it const to allow the compiler to put it in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20210929094401.28086-1-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: ti: Constify static snd_soc_ops
Rikard Falkeborn [Wed, 29 Sep 2021 09:31:21 +0000 (11:31 +0200)]
ASoC: ti: Constify static snd_soc_ops

These are only assigned to the ops field in the snd_soc_dai_link struct
which is a pointer to const struct snd_soc_ops. Make them const to allow
the compiler to put them in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20210929093121.21253-1-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: intel: sof_rt5682: update platform device name for Maxim amplifier
Brent Lu [Mon, 27 Sep 2021 14:32:49 +0000 (22:32 +0800)]
ASoC: intel: sof_rt5682: update platform device name for Maxim amplifier

To follow 20-character length limitation of platform device name, we
have only 7 character space for amplifier. Therefore, the last
character of mx98357a and mx98360a is removed to save space.

Signed-off-by: Brent Lu <brent.lu@intel.com>
Fixes: e224ef76fa8a ('ASoC: intel: sof_rt5682: support jsl_rt5682s_mx98360a board')
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210927143249.439129-1-brent.lu@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc: Make the error prints consistent in tx_wait_done()
Peter Ujfalusi [Tue, 28 Sep 2021 07:36:15 +0000 (10:36 +0300)]
ASoC: SOF: ipc: Make the error prints consistent in tx_wait_done()

If we get an error on reply (msg->reply_error) then we should print the
error value out.

At the same time extend the print to include the message size as well and
do the same in case of a timeout.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@gmail.com>
Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210928073615.29574-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: prefix some terse and cryptic dev_dbg() with __func__
Marc Herbert [Tue, 28 Sep 2021 10:26:35 +0000 (13:26 +0300)]
ASoC: SOF: prefix some terse and cryptic dev_dbg() with __func__

These helped troubleshoot some DMA issue in SOF.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20210928102635.26227-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: add error handling to snd_sof_ipc_msg_data()
Guennadi Liakhovetski [Tue, 28 Sep 2021 10:35:16 +0000 (13:35 +0300)]
ASoC: SOF: add error handling to snd_sof_ipc_msg_data()

If an invalid stream is passed to snd_sof_ipc_msg_data() it won't
fill the provided object with data. The caller has to be able to
recognise such cases to avoid handling invalid data. Make the
function return an error when failing.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20210928103516.8066-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: mediatek: mt8195: add missing of_node_put in probe
Trevor Wu [Tue, 28 Sep 2021 06:35:20 +0000 (14:35 +0800)]
ASoC: mediatek: mt8195: add missing of_node_put in probe

dp node and hdmi node are retrieved from of_parse_phandle(), so using
of_node_put() on them before return.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20210928063520.23927-1-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: imx: add header file for ops
Pierre-Louis Bossart [Tue, 28 Sep 2021 07:28:07 +0000 (10:28 +0300)]
ASoC: SOF: imx: add header file for ops

Sparse (make C=2) complains about undeclared variables. Fix by adding
a real prototype instead of 'extern' in sof-of-dev.c

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@gmail.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20210928072807.27838-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: pm: fix a stale comment
Ranjani Sridharan [Tue, 28 Sep 2021 07:40:30 +0000 (10:40 +0300)]
ASoC: SOF: pm: fix a stale comment

There is no restore_stream flag anymmore.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@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/20210928074030.30553-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Intel: hda-stream: Print stream name on STREAM_SD_OFFSET timeout
Peter Ujfalusi [Tue, 28 Sep 2021 08:17:44 +0000 (11:17 +0300)]
ASoC: SOF: Intel: hda-stream: Print stream name on STREAM_SD_OFFSET timeout

In order to provide more information in case of timeout observed while
reading STREAM_SD_OFFSET, print out the stream name or in case there is
no audio stream associated (like dma-trace), print "--"

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>
Link: https://lore.kernel.org/r/20210928081744.4785-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoMerge series "add driver to support firmware loading on Cirrus Logic DSPs" from Simon...
Mark Brown [Mon, 27 Sep 2021 17:32:10 +0000 (18:32 +0100)]
Merge series "add driver to support firmware loading on Cirrus Logic DSPs" from Simon Trimmer <simont@opensource.cirrus.com>:

This series of patches gradually separates the ASoC specific wm_adsp
code from that required to manage firmware in Cirrus Logic DSPs.

The series starts with renaming, progresses to splitting the
functionality before finally moving the independent functionality into
drivers/firmware so that it can be used by both the existing ASoC
wm_adsp and new non-audio parts.

Charles Keepax (3):
  ASoC: wm_adsp: Move check for control existence
  ASoC: wm_adsp: Switch to using wm_coeff_read_ctrl for compressed
    buffers
  ASoC: wm_adsp: Move sys_config_size to wm_adsp

Simon Trimmer (13):
  ASoC: wm_adsp: Remove use of snd_ctl_elem_type_t
  ASoC: wm_adsp: Cancel ongoing work when removing controls
  ASoC: wm_adsp: Rename generic DSP support
  ASoC: wm_adsp: Introduce cs_dsp logging macros
  ASoC: wm_adsp: Separate some ASoC and generic functions
  ASoC: wm_adsp: Split DSP power operations into helper functions
  ASoC: wm_adsp: Separate generic cs_dsp_coeff_ctl handling
  ASoC: wm_adsp: Move check of dsp->running to better place
  ASoC: wm_adsp: Pass firmware names as parameters when starting DSP
    core
  ASoC: wm_adsp: move firmware loading to client
  ASoC: wm_adsp: Split out struct cs_dsp from struct wm_adsp
  ASoC: wm_adsp: Separate wm_adsp specifics in cs_dsp_client_ops
  firmware: cs_dsp: add driver to support firmware loading on Cirrus
    Logic DSPs

 MAINTAINERS                                   |   11 +
 drivers/firmware/Kconfig                      |    1 +
 drivers/firmware/Makefile                     |    1 +
 drivers/firmware/cirrus/Kconfig               |    5 +
 drivers/firmware/cirrus/Makefile              |    3 +
 drivers/firmware/cirrus/cs_dsp.c              | 3109 ++++++++++++++++
 include/linux/firmware/cirrus/cs_dsp.h        |  242 ++
 .../linux/firmware/cirrus}/wmfw.h             |    8 +-
 sound/soc/codecs/Kconfig                      |    1 +
 sound/soc/codecs/cs47l15.c                    |   22 +-
 sound/soc/codecs/cs47l24.c                    |   20 +-
 sound/soc/codecs/cs47l35.c                    |   24 +-
 sound/soc/codecs/cs47l85.c                    |   32 +-
 sound/soc/codecs/cs47l90.c                    |   34 +-
 sound/soc/codecs/cs47l92.c                    |   20 +-
 sound/soc/codecs/madera.c                     |   18 +-
 sound/soc/codecs/wm2200.c                     |   30 +-
 sound/soc/codecs/wm5102.c                     |   16 +-
 sound/soc/codecs/wm5110.c                     |   24 +-
 sound/soc/codecs/wm_adsp.c                    | 3188 ++---------------
 sound/soc/codecs/wm_adsp.h                    |  105 +-
 21 files changed, 3794 insertions(+), 3120 deletions(-)
 create mode 100644 drivers/firmware/cirrus/Kconfig
 create mode 100644 drivers/firmware/cirrus/Makefile
 create mode 100644 drivers/firmware/cirrus/cs_dsp.c
 create mode 100644 include/linux/firmware/cirrus/cs_dsp.h
 rename {sound/soc/codecs => include/linux/firmware/cirrus}/wmfw.h (91%)

--
2.33.0

2 years agoASoC: ak4458: Use modern ASoC DAI format terminology
Mark Brown [Mon, 20 Sep 2021 16:38:17 +0000 (17:38 +0100)]
ASoC: ak4458: Use modern ASoC DAI format terminology

As part of moving to remove the old style defines for the bus clocks update
the ak4458 driver to use more modern terminology for clocking.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210920163817.16490-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: ak5558: Use modern ASoC DAI format terminology
Mark Brown [Mon, 20 Sep 2021 16:47:53 +0000 (17:47 +0100)]
ASoC: ak5558: Use modern ASoC DAI format terminology

As part of moving to remove the old style defines for the bus clocks update
the ak5558 driver to use more modern terminology for clocking.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210920164753.17030-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: dmaengine: Introduce module option prealloc_buffer_size_kbytes
Sugar Zhang [Thu, 23 Sep 2021 10:50:46 +0000 (18:50 +0800)]
ASoC: dmaengine: Introduce module option prealloc_buffer_size_kbytes

Currently, The fixed 512KB prealloc buffer size is too larger for
tiny memory kernel (such as 16MB memory). This patch adds the module
option "prealloc_buffer_size_kbytes" to specify prealloc buffer size.

It's suitable for cards which use the generic dmaengine pcm driver
with no config.

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Link: https://lore.kernel.org/r/1632394246-59341-1-git-send-email-sugar.zhang@rock-chips.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: dwc-i2s: Update to modern clocking terminology
Mark Brown [Tue, 21 Sep 2021 20:53:13 +0000 (21:53 +0100)]
ASoC: dwc-i2s: Update to modern clocking terminology

As part of moving to remove the old style defines for the bus clocks update
the dwc-i2s driver to use more modern terminology for clocking.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210921205313.46710-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: ak4671: Use modern ASoC DAI format terminology
Mark Brown [Mon, 20 Sep 2021 16:42:11 +0000 (17:42 +0100)]
ASoC: ak4671: Use modern ASoC DAI format terminology

As part of moving to remove the old style defines for the bus clocks update
the ak4671 driver to use more modern terminology for clocking.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210920164211.16718-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: alc5623: Use modern ASoC DAI format terminology
Mark Brown [Mon, 20 Sep 2021 16:50:36 +0000 (17:50 +0100)]
ASoC: alc5623: Use modern ASoC DAI format terminology

As part of moving to remove the old style defines for the bus clocks update
the alc5623 driver to use more modern terminology for clocking.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210920165036.17142-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: bcm: Convert to modern clocking terminology
Mark Brown [Thu, 16 Sep 2021 14:34:23 +0000 (15:34 +0100)]
ASoC: bcm: Convert to modern clocking terminology

As part of the effort to remove our old APIs based on outdated terminology
update the Broadcom drivers to use modern terminology.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210916143423.24025-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: cpcap: Use modern ASoC DAI format terminology
Mark Brown [Tue, 21 Sep 2021 21:30:34 +0000 (22:30 +0100)]
ASoC: cpcap: Use modern ASoC DAI format terminology

As part of moving to remove the old style defines for the bus clocks update
the cpcap driver to use more modern terminology for clocking.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210921213034.31427-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: meson: aiu: Fix spelling mistake "Unsupport" -> "Unsupported"
Colin Ian King [Fri, 24 Sep 2021 23:12:42 +0000 (00:12 +0100)]
ASoC: meson: aiu: Fix spelling mistake "Unsupport" -> "Unsupported"

There is a spelling mistake in a dev_err error message. Fix it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Link: https://lore.kernel.org/r/20210924231242.144692-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: dt-bindings: wlf,wm8978: Fix I2C address in example
Geert Uytterhoeven [Fri, 24 Sep 2021 12:47:32 +0000 (14:47 +0200)]
ASoC: dt-bindings: wlf,wm8978: Fix I2C address in example

According to the WM8978 datasheet, the address of the device is fixed as
0011010 in 2-wire mode.

Fixes: 5bd5699c494f42a3 ("ASoC: dt-bindings: Add WM8978 Binding")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/c99fc865e3fca6ea623661c52de7dc6a3c36c8b4.1632487554.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: codecs: Fix spelling mistake "Unsupport" -> "Unsupported"
Colin Ian King [Fri, 24 Sep 2021 23:10:03 +0000 (00:10 +0100)]
ASoC: codecs: Fix spelling mistake "Unsupport" -> "Unsupported"

There are spelling mistakes in dev_err error messages. Fix them.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210924231003.144502-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: ad193x: Update to modern clocking terminology
Mark Brown [Thu, 16 Sep 2021 14:22:32 +0000 (15:22 +0100)]
ASoC: ad193x: Update to modern clocking terminology

As part of moving to remove the old style defines for the bus clocks update
the ad193x driver to use more modern terminology for clocking.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210916142232.33914-1-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: tegra: Constify static snd_soc_dai_ops structs
Rikard Falkeborn [Wed, 22 Sep 2021 20:54:38 +0000 (22:54 +0200)]
ASoC: tegra: Constify static snd_soc_dai_ops structs

The only usage of these is to assign their address to the ops field in
the snd_soc_dai_driver struct, which is a pointer to const. Make them
const to allow the compiler to put them in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Acked-by: Sameer Pujar <spujar@nvidia.com>
Link: https://lore.kernel.org/r/20210922205438.34519-1-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: cs42l42: Use two thresholds and increased wait time for manual type detection
Stefan Binding [Mon, 27 Sep 2021 11:14:37 +0000 (12:14 +0100)]
ASoC: cs42l42: Use two thresholds and increased wait time for manual type detection

Some headsets require very different comparator thresholds for type detection,
as well as longer settling times. In order to detect a larger number of headsets,
use 2 thresholds to give maximum coverage (1.25V and 1.75V), as well as a longer
settling time of 100ms. This will not affect default audotodetect mode
and applies to manual mode type detection only.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210927111437.18113-1-vitalyr@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: adav80x: Update to modern clocking terminology
Mark Brown [Thu, 16 Sep 2021 15:18:06 +0000 (16:18 +0100)]
ASoC: adav80x: Update to modern clocking terminology

As part of moving to remove the old style defines for the bus clocks update
the adav80x driver to use more modern terminology for clocking.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210916151806.20756-6-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: adau1977: Update to modern clocking terminology
Mark Brown [Thu, 16 Sep 2021 15:18:05 +0000 (16:18 +0100)]
ASoC: adau1977: Update to modern clocking terminology

As part of moving to remove the old style defines for the bus clocks update
the adau1977 driver to use more modern terminology for clocking.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210916151806.20756-5-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: adau17x1: Update to modern clocking terminology
Mark Brown [Thu, 16 Sep 2021 15:18:04 +0000 (16:18 +0100)]
ASoC: adau17x1: Update to modern clocking terminology

As part of moving to remove the old style defines for the bus clocks update
the adau17x1 driver to use more modern terminology for clocking.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210916151806.20756-4-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: adau1701: Update to modern clocking terminology
Mark Brown [Thu, 16 Sep 2021 15:18:03 +0000 (16:18 +0100)]
ASoC: adau1701: Update to modern clocking terminology

As part of moving to remove the old style defines for the bus clocks update
the adau1701 driver to use more modern terminology for clocking.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210916151806.20756-3-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: adau1373: Update to modern clocking terminology
Mark Brown [Thu, 16 Sep 2021 15:18:02 +0000 (16:18 +0100)]
ASoC: adau1373: Update to modern clocking terminology

As part of moving to remove the old style defines for the bus clocks update
the adau1373 driver to use more modern terminology for clocking.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210916151806.20756-2-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>