platform/kernel/linux-rpi.git
2 years agoASoC: tegra-audio-rt5677: Correct example
Dmitry Osipenko [Thu, 16 Dec 2021 16:02:29 +0000 (19:02 +0300)]
ASoC: tegra-audio-rt5677: Correct example

Remove non-existent properties from the example of the binding. These
properties were borrower from the old txt binding, but they were never
used in practice and aren't documented in the new binding. They aren't
reported by the binding checker because dtschema needs extra patch that
hasn't been upstreamed yet to make unevaluatedProperties work properly.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20211216160229.17049-1-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: amd: acp-config: Update sof_tplg_filename for SOF machines
Ajit Kumar Pandey [Tue, 21 Dec 2021 16:18:09 +0000 (21:48 +0530)]
ASoC: amd: acp-config: Update sof_tplg_filename for SOF machines

SOF machines support different codec end points and hence required
different topologies configuration. Update tplg filename in machine
struct to load different topology files for SOF machines.

Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Reviewed-by: Curtis Malainey <curtis@malainey.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211221161814.236318-3-AjitKumar.Pandey@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: amd: acp-config: Enable SOF audio for Google chrome boards.
Ajit Kumar Pandey [Tue, 21 Dec 2021 16:18:08 +0000 (21:48 +0530)]
ASoC: amd: acp-config: Enable SOF audio for Google chrome boards.

We need to support sof audio on different variants of Google boards.
Add new entry in dmi table to enable SOF flag on Google chrome boards.
Also add newer machines to sof_machines list with codecs and amps acpi
id check to register sof sound cards on different variants.

Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@intel.com>
Link: https://lore.kernel.org/r/20211221161814.236318-2-AjitKumar.Pandey@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Use dev_err_probe() helper
Mark Brown [Tue, 21 Dec 2021 02:48:48 +0000 (02:48 +0000)]
ASoC: Use dev_err_probe() helper

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

This patch-set tries to use dev_err_probe() helper function
instead of manual dev_err() code.
I hope ASoC will be more clean code by this patch-set.

2 years agoASoC: mediatek: mt8195-mt6359: reduce log verbosity in probe()
Tzung-Bi Shih [Mon, 20 Dec 2021 09:34:07 +0000 (17:34 +0800)]
ASoC: mediatek: mt8195-mt6359: reduce log verbosity in probe()

Eliminates error messages if snd_soc_register_card() failed.  Kernel
emits messages if device probe error anyway.

This is mainly for removing the following error messages during boot.
    >>> snd_soc_register_card fail -517

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20211220093408.207206-1-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: codec: tlv320adc3xxx: New codec driver
Ricard Wanderlof [Wed, 15 Dec 2021 17:04:23 +0000 (18:04 +0100)]
ASoC: codec: tlv320adc3xxx: New codec driver

New codec driver for Texas Instruments TLV320ADC3001 and
TLV320ADC3101 audio ADCs.

Signed-off-by: Ricard Wanderlof <ricardw@axis.com>
Link: https://lore.kernel.org/r/alpine.DEB.2.21.2112151801370.27889@lap5cg0092dnk.se.axis.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: tlv320adc3xxx: New codec bindings
Ricard Wanderlof [Wed, 15 Dec 2021 17:01:24 +0000 (18:01 +0100)]
ASoC: tlv320adc3xxx: New codec bindings

DT bindings for Texas Instruments TLV320ADC3001 and TLV320ADC3101
audio ADCs.

Signed-off-by: Ricard Wanderlof <ricardw@axis.com>
Link: https://lore.kernel.org/r/alpine.DEB.2.21.2112151759170.27889@lap5cg0092dnk.se.axis.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: sunxi: Use dev_err_probe() helper
Kuninori Morimoto [Tue, 14 Dec 2021 02:08:43 +0000 (11:08 +0900)]
ASoC: sunxi: Use dev_err_probe() helper

Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-23-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: stm: Use dev_err_probe() helper
Kuninori Morimoto [Tue, 14 Dec 2021 02:08:42 +0000 (11:08 +0900)]
ASoC: stm: Use dev_err_probe() helper

Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-22-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: samsung: Use dev_err_probe() helper
Kuninori Morimoto [Tue, 14 Dec 2021 02:08:41 +0000 (11:08 +0900)]
ASoC: samsung: Use dev_err_probe() helper

Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-21-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: rockchip: Use dev_err_probe() helper
Kuninori Morimoto [Tue, 14 Dec 2021 02:08:40 +0000 (11:08 +0900)]
ASoC: rockchip: Use dev_err_probe() helper

Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-20-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: qcom: Use dev_err_probe() helper
Kuninori Morimoto [Tue, 14 Dec 2021 02:08:39 +0000 (11:08 +0900)]
ASoC: qcom: Use dev_err_probe() helper

Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-19-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: mxs: Use dev_err_probe() helper
Kuninori Morimoto [Tue, 14 Dec 2021 02:08:38 +0000 (11:08 +0900)]
ASoC: mxs: Use dev_err_probe() helper

Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-18-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: meson: Use dev_err_probe() helper
Kuninori Morimoto [Tue, 14 Dec 2021 02:08:37 +0000 (11:08 +0900)]
ASoC: meson: Use dev_err_probe() helper

Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-17-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: img: Use dev_err_probe() helper
Kuninori Morimoto [Tue, 14 Dec 2021 02:08:36 +0000 (11:08 +0900)]
ASoC: img: Use dev_err_probe() helper

Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-16-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: generic: Use dev_err_probe() helper
Kuninori Morimoto [Tue, 14 Dec 2021 02:08:35 +0000 (11:08 +0900)]
ASoC: generic: Use dev_err_probe() helper

Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-15-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: fsl: Use dev_err_probe() helper
Kuninori Morimoto [Tue, 14 Dec 2021 02:08:34 +0000 (11:08 +0900)]
ASoC: fsl: Use dev_err_probe() helper

Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-14-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: ti: Use dev_err_probe() helper
Kuninori Morimoto [Tue, 14 Dec 2021 02:08:33 +0000 (11:08 +0900)]
ASoC: ti: Use dev_err_probe() helper

Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-13-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: ateml: Use dev_err_probe() helper
Kuninori Morimoto [Tue, 14 Dec 2021 02:08:32 +0000 (11:08 +0900)]
ASoC: ateml: Use dev_err_probe() helper

Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-12-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: codecs: tlv320aic31xx: Use dev_err_probe() helper
Kuninori Morimoto [Tue, 14 Dec 2021 02:08:31 +0000 (11:08 +0900)]
ASoC: codecs: tlv320aic31xx: Use dev_err_probe() helper

Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-11-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: codecs: ssm2305: Use dev_err_probe() helper
Kuninori Morimoto [Tue, 14 Dec 2021 02:08:30 +0000 (11:08 +0900)]
ASoC: codecs: ssm2305: Use dev_err_probe() helper

Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-10-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: codecs: simple-mux: Use dev_err_probe() helper
Kuninori Morimoto [Tue, 14 Dec 2021 02:08:29 +0000 (11:08 +0900)]
ASoC: codecs: simple-mux: Use dev_err_probe() helper

Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-9-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: codecs: simple-amplifier: Use dev_err_probe() helper
Kuninori Morimoto [Tue, 14 Dec 2021 02:08:28 +0000 (11:08 +0900)]
ASoC: codecs: simple-amplifier: Use dev_err_probe() helper

Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-8-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: codecs: sgtl5000: Use dev_err_probe() helper
Kuninori Morimoto [Tue, 14 Dec 2021 02:08:27 +0000 (11:08 +0900)]
ASoC: codecs: sgtl5000: Use dev_err_probe() helper

Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-7-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: codecs: pcm3168a: Use dev_err_probe() helper
Kuninori Morimoto [Tue, 14 Dec 2021 02:08:26 +0000 (11:08 +0900)]
ASoC: codecs: pcm3168a: Use dev_err_probe() helper

Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-6-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: codecs: max9860: Use dev_err_probe() helper
Kuninori Morimoto [Tue, 14 Dec 2021 02:08:25 +0000 (11:08 +0900)]
ASoC: codecs: max9860: Use dev_err_probe() helper

Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-5-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: codecs: max9759: Use dev_err_probe() helper
Kuninori Morimoto [Tue, 14 Dec 2021 02:08:24 +0000 (11:08 +0900)]
ASoC: codecs: max9759: Use dev_err_probe() helper

Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-4-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: codecs: es7241: Use dev_err_probe() helper
Kuninori Morimoto [Tue, 14 Dec 2021 02:08:23 +0000 (11:08 +0900)]
ASoC: codecs: es7241: Use dev_err_probe() helper

Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-3-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: codecs: ak4118: Use dev_err_probe() helper
Kuninori Morimoto [Tue, 14 Dec 2021 02:08:22 +0000 (11:08 +0900)]
ASoC: codecs: ak4118: Use dev_err_probe() helper

Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-2-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: catpt: Dma-transfer fix and couple
Mark Brown [Fri, 17 Dec 2021 17:32:48 +0000 (17:32 +0000)]
ASoC: Intel: catpt: Dma-transfer fix and couple

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

Set is made of one fix for dma-transfer so that result of
dmaengine_submit() is tested before moving on, and few cleanups:

- two non-impactful, where catpt_component_open() layout gets improved
  slightly as well as relocation of couple of locals found in
  PCM-functions so that they look more cohesive
- no need to expose catpt-driver board-matching information globally.
  Most fields are not by it and it's the sole user of haswell_machines
  table. By having them locally it is clear what is actually being used

Cezary Rojewski (5):
  ASoC: Intel: catpt: Test dmaengine_submit() result before moving on
  ASoC: Intel: catpt: Reduce size of catpt_component_open()
  ASoC: Intel: catpt: Streamline locals declaration for PCM-functions
  ASoC: Intel: catpt: Drop SND_SOC_ACPI_INTEL_MATCH dependency
  ASoC: Intel: Drop legacy HSW/BDW board-match information

 include/sound/soc-acpi-intel-match.h          |  1 -
 sound/soc/intel/Kconfig                       |  2 +-
 sound/soc/intel/catpt/device.c                | 33 +++++++++++++++--
 sound/soc/intel/catpt/dsp.c                   | 14 ++++++-
 sound/soc/intel/catpt/pcm.c                   | 37 +++++++++----------
 .../common/soc-acpi-intel-hsw-bdw-match.c     | 16 --------
 6 files changed, 61 insertions(+), 42 deletions(-)

--
2.25.1

2 years agoSupport HDMI audio on NVIDIA Tegra20
Mark Brown [Fri, 17 Dec 2021 17:32:46 +0000 (17:32 +0000)]
Support HDMI audio on NVIDIA Tegra20

Merge series from Dmitry Osipenko <digetx@gmail.com>:

This series revives Tegra20 S/PDIF driver which was upstreamed long time
ago, but never was used. It also turns Tegra DRM HDMI driver into HDMI
audio CODEC provider. Finally, HDMI audio is enabled in device-trees.
For now the audio is enable only for Acer A500 tablet and Toshiba AC100
netbook because they're already supported by upstream, later on ASUS TF101
tablet will join them.

I based S/PDIF patches on Arnd's Bergmann patch from a separate series [1]
that removes obsolete slave_id. This eases merging of the patches by
removing the merge conflict. This is a note for Mark Brown.

I also based this series on top of power management series [2]. I.e. [2]
should be applied first, otherwise "Add S/PDIF node to Tegra20 device-tree"
patch should have merge conflict. This is a note for Thierry.

[1] https://patchwork.ozlabs.org/project/linux-tegra/list/?series=273312
[2] https://patchwork.ozlabs.org/project/linux-tegra/list/?series=274534

Changelog:

v4: - Added patches that update multi_v7_defconfig with the enabled S/PDIF
      and APB DMA drivers.

v3: - Renamed S/PDIF device-tree clocks as was suggested by Rob Herring.

    - Added r-bs and acks that were given by Rob Herring to v2.

v2: - Corrected I2S yaml problem that was reported by the DT bot for v1
      by removing the non-existent required clock-names property.

    - Removed assigned-clocks property from S/PDIF yaml since this property
      is now inherited from the clocks property.

    - Reordered the "tegra20: spdif: Set FIFO trigger level" patch, making
      it the first sound/soc patch in the series, like it was suggested by
      Mark Brown in the comment to v1. Also reworded commit message of this
      patch to *not* make it looks like it should be backported to stable
      kernels.

Arnd Bergmann (1):
  ASoC: tegra20-spdif: stop setting slave_id

Dmitry Osipenko (21):
  ASoC: dt-bindings: Add binding for Tegra20 S/PDIF
  ASoC: dt-bindings: tegra20-i2s: Convert to schema
  ASoC: dt-bindings: tegra20-i2s: Document new nvidia,fixed-parent-rate
    property
  dt-bindings: host1x: Document optional HDMI sound-dai-cells
  ASoC: tegra20: spdif: Set FIFO trigger level
  ASoC: tegra20: spdif: Support device-tree
  ASoC: tegra20: spdif: Improve driver's code
  ASoC: tegra20: spdif: Use more resource-managed helpers
  ASoC: tegra20: spdif: Reset hardware
  ASoC: tegra20: spdif: Support system suspend
  ASoC: tegra20: spdif: Filter out unsupported rates
  ASoC: tegra20: i2s: Filter out unsupported rates
  drm/tegra: hdmi: Unwind tegra_hdmi_init() errors
  drm/tegra: hdmi: Register audio CODEC on Tegra20
  ARM: tegra_defconfig: Enable S/PDIF driver
  ARM: config: multi v7: Enable NVIDIA Tegra20 S/PDIF driver
  ARM: config: multi v7: Enable NVIDIA Tegra20 APB DMA driver
  ARM: tegra: Add S/PDIF node to Tegra20 device-tree
  ARM: tegra: Add HDMI audio graph to Tegra20 device-tree
  ARM: tegra: acer-a500: Enable S/PDIF and HDMI audio
  ARM: tegra: paz00: Enable S/PDIF and HDMI audio

 .../display/tegra/nvidia,tegra20-host1x.txt   |   1 +
 .../bindings/sound/nvidia,tegra20-i2s.txt     |  30 ---
 .../bindings/sound/nvidia,tegra20-i2s.yaml    |  77 +++++++
 .../bindings/sound/nvidia,tegra20-spdif.yaml  |  85 ++++++++
 .../boot/dts/tegra20-acer-a500-picasso.dts    |   8 +
 arch/arm/boot/dts/tegra20-paz00.dts           |   8 +
 arch/arm/boot/dts/tegra20.dtsi                |  40 +++-
 arch/arm/configs/multi_v7_defconfig           |   2 +
 arch/arm/configs/tegra_defconfig              |   1 +
 drivers/gpu/drm/tegra/Kconfig                 |   3 +
 drivers/gpu/drm/tegra/hdmi.c                  | 168 +++++++++++++--
 sound/soc/tegra/tegra20_i2s.c                 |  49 +++++
 sound/soc/tegra/tegra20_spdif.c               | 197 ++++++++++++------
 sound/soc/tegra/tegra20_spdif.h               |   1 +
 sound/soc/tegra/tegra_pcm.c                   |   6 +
 sound/soc/tegra/tegra_pcm.h                   |   1 +
 16 files changed, 574 insertions(+), 103 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra20-i2s.txt
 create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra20-i2s.yaml
 create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra20-spdif.yaml

--
2.33.1

2 years agoASoC: SOF: couple of cleanups
Mark Brown [Fri, 17 Dec 2021 17:32:45 +0000 (17:32 +0000)]
ASoC: SOF: couple of cleanups

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

Guennadi spotted inconsistencies with our 'const' handling, Ajit Kumar
flagged a missing check for a null pointer and we missed the
definition of debug zones.

2 years agoASoC: SOF: remove suport for TRIGGER_RESUME
Mark Brown [Fri, 17 Dec 2021 17:32:44 +0000 (17:32 +0000)]
ASoC: SOF: remove suport for TRIGGER_RESUME

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

None of the SOF platforms support INFO_RESUME, and rely on the
indirect path used by the ALSA core with the prepare and TRIGGER_START
steps.

Let's remove the left-over dead code.

2 years agoASoC: sh: rz-ssi: Check return value of pm_runtime_resume_and_get()
Heiner Kallweit [Fri, 17 Dec 2021 09:22:31 +0000 (10:22 +0100)]
ASoC: sh: rz-ssi: Check return value of pm_runtime_resume_and_get()

The return value of pm_runtime_resume_and_get() needs to be checked to
avoid a usage count imbalance in the error case. This fix is basically
the same as 92c959bae2e5 ("reset: renesas: Fix Runtime PM usage"),
and the last step before pm_runtime_resume_and_get() can be annotated
as __must_check.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/9fed506d-b780-55cd-45a4-9bd2407c910f@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: catpt: Streamline locals declaration for PCM-functions
Cezary Rojewski [Thu, 16 Dec 2021 11:57:41 +0000 (12:57 +0100)]
ASoC: Intel: catpt: Streamline locals declaration for PCM-functions

Group all the catpt_xxx structs together in PCM related functions so
they look more cohesive.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20211216115743.2130622-4-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: catpt: Reduce size of catpt_component_open()
Cezary Rojewski [Thu, 16 Dec 2021 11:57:40 +0000 (12:57 +0100)]
ASoC: Intel: catpt: Reduce size of catpt_component_open()

With some improved if-logy, function's size can be reduced slightly.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20211216115743.2130622-3-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: catpt: Test dmaengine_submit() result before moving on
Cezary Rojewski [Thu, 16 Dec 2021 11:57:39 +0000 (12:57 +0100)]
ASoC: Intel: catpt: Test dmaengine_submit() result before moving on

After calling dmaengine_submit(), the submitted transfer descriptor
belongs to the DMA engine. Pointer to that descriptor may no longer be
valid after the call and should be tested before awaiting transfer
completion.

Reported-by: Kevin Tian <kevin.tian@intel.com>
Suggested-by: Dave Jiang <dave.jiang@intel.com>
Fixes: 4fac9b31d0b9 ("ASoC: Intel: Add catpt base members")
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20211216115743.2130622-2-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: tegra20: i2s: Filter out unsupported rates
Dmitry Osipenko [Sat, 4 Dec 2021 14:37:16 +0000 (17:37 +0300)]
ASoC: tegra20: i2s: Filter out unsupported rates

Support new nvidia,fixed-parent-rate device-tree property which instructs
I2S that board wants parent clock rate to stay at a fixed rate. This allows
to play audio over S/PDIF and I2S simultaneously. The root of the problem
is that audio components on Tegra share the same audio PLL, and thus, only
a subset of rates can be supported if we want to play audio simultaneously.
Filter out audio rates that don't match parent clock rate if device-tree
has the nvidia,fixed-parent-rate property.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20211204143725.31646-14-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: tegra20: spdif: Filter out unsupported rates
Dmitry Osipenko [Sat, 4 Dec 2021 14:37:15 +0000 (17:37 +0300)]
ASoC: tegra20: spdif: Filter out unsupported rates

SPDIF and other SoC components share audio PLL on Tegra, thus only one
component may set the desired base clock rate. This creates problem for
HDMI audio because it uses SPDIF and audio may not work if SPDIF's clock
doesn't exactly match standard audio rate since some receivers may reject
audio in that case. Filter out audio rates which SPDIF output can't
support, assuming that other components won't change rate at runtime.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20211204143725.31646-13-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: tegra20: spdif: Support system suspend
Dmitry Osipenko [Sat, 4 Dec 2021 14:37:14 +0000 (17:37 +0300)]
ASoC: tegra20: spdif: Support system suspend

Support system suspend by enforcing runtime PM suspend/resume.
Now there is no doubt that h/w is indeed stopped during suspend
and that h/w state will be properly restored after resume.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20211204143725.31646-12-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: tegra20: spdif: Reset hardware
Dmitry Osipenko [Sat, 4 Dec 2021 14:37:13 +0000 (17:37 +0300)]
ASoC: tegra20: spdif: Reset hardware

Reset S/PDIF controller on runtime PM suspend/resume to ensure that we
always have a consistent hardware state.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20211204143725.31646-11-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: tegra20: spdif: Use more resource-managed helpers
Dmitry Osipenko [Sat, 4 Dec 2021 14:37:12 +0000 (17:37 +0300)]
ASoC: tegra20: spdif: Use more resource-managed helpers

Use resource-managed helpers to make code cleaner. Driver's remove callback
isn't needed anymore since driver is completely resource-managed now.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20211204143725.31646-10-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: tegra20: spdif: Improve driver's code
Dmitry Osipenko [Sat, 4 Dec 2021 14:37:11 +0000 (17:37 +0300)]
ASoC: tegra20: spdif: Improve driver's code

- Clean up whitespaces, defines and variables.

- Remove obsolete code.

- Adhere to upstream coding style.

- Don't override returned error code.

- Replace pr_err with dev_err.

No functional changes are made by this patch. This is a minor code's
refactoring that will ease further maintenance of the driver.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20211204143725.31646-9-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: tegra20: spdif: Support device-tree
Dmitry Osipenko [Sat, 4 Dec 2021 14:37:10 +0000 (17:37 +0300)]
ASoC: tegra20: spdif: Support device-tree

Tegra20 S/PDIF driver was added in a pre-DT era and was never used since
that time. Revive driver by adding device-tree support.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20211204143725.31646-8-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: tegra20: spdif: Set FIFO trigger level
Dmitry Osipenko [Sat, 4 Dec 2021 14:37:08 +0000 (17:37 +0300)]
ASoC: tegra20: spdif: Set FIFO trigger level

FIFO trigger level must be not less than the size of DMA burst, otherwise
audio will be played x4 faster that it should be because part of the DMA
data will be dropped on FIFO input buffer overflow.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20211204143725.31646-6-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: dt-bindings: tegra20-i2s: Document new nvidia,fixed-parent-rate property
Dmitry Osipenko [Sat, 4 Dec 2021 14:37:06 +0000 (17:37 +0300)]
ASoC: dt-bindings: tegra20-i2s: Document new nvidia,fixed-parent-rate property

Document new nvidia,fixed-parent-rate property which instructs that this
board wants parent clock to stay at a fixed rate. It allows to prevent
conflicts between audio components that share same parent PLL. For
instance, this property allows to have HDMI audio, speaker and headphones
in the system playing audio simultaneously, which is a common pattern for
consumer devices.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/20211204143725.31646-4-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: dt-bindings: tegra20-i2s: Convert to schema
Dmitry Osipenko [Sat, 4 Dec 2021 14:37:05 +0000 (17:37 +0300)]
ASoC: dt-bindings: tegra20-i2s: Convert to schema

Convert NVIDIA Tegra20 I2S binding to schema.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20211204143725.31646-3-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: dt-bindings: Add binding for Tegra20 S/PDIF
Dmitry Osipenko [Sat, 4 Dec 2021 14:37:04 +0000 (17:37 +0300)]
ASoC: dt-bindings: Add binding for Tegra20 S/PDIF

Add device-tree binding for Tegra20 S/PDIF controller.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20211204143725.31646-2-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoMerge tag 'dmaengine_topic_slave_id_removal_5.17' of git://git.kernel.org/pub/scm...
Mark Brown [Fri, 17 Dec 2021 11:13:39 +0000 (11:13 +0000)]
Merge tag 'dmaengine_topic_slave_id_removal_5.17' of git://git./linux/kernel/git/vkoul/dmaengine into v4_20211204_digetx_support_hdmi_audio_on_nvidia_tegra20

dmaengine_topic_slave_id_removal_5.17

Tag for dmaengine slave_id removal topic branch which should be merged
into v5.17

2 years agoASoC: SOF: Kconfig: Make the SOF_DEVELOPER_SUPPORT depend on SND_SOC_SOF
Peter Ujfalusi [Thu, 16 Dec 2021 23:03:50 +0000 (17:03 -0600)]
ASoC: SOF: Kconfig: Make the SOF_DEVELOPER_SUPPORT depend on SND_SOC_SOF

SND_SOC_SOF_DEVELOPER_SUPPORT contains options affecting how the built
SOF driver stack will behave, enables debug options and other features.

These options have no meaning if the SND_SOC_SOF is not even enabled.

If we have SOF client options under developer_support and debug they can
be selected to be built even without the core, but they do need symbols
from the core (the sof-client API) which can result build failure.

In Kconfig we can have
SND_SOC_SOF_TOPLEVEL=y
SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST=y

for example, which will make the flood client to be built, but the SOF core
is not as SND_SOC_SOF is not selected.

Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211216230350.343857-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: dt-bindings: audio-graph-port: enable both flag/phandle for bitclock/frame...
Kuninori Morimoto [Thu, 16 Dec 2021 00:00:18 +0000 (09:00 +0900)]
ASoC: dt-bindings: audio-graph-port: enable both flag/phandle for bitclock/frame-master

snd_soc_daifmt_parse_clock_provider_raw() is handling both
bitclock/frame-master, and is supporting both flag/phandle.
Current DT is assuming it is flag style.
This patch allows both case.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20211216000018.2641925-1-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoipc: debug: Add shared memory heap to memory scan
Karol Trzcinski [Thu, 16 Dec 2021 23:24:22 +0000 (17:24 -0600)]
ipc: debug: Add shared memory heap to memory scan

Newly added shared heap zones should be taken into account during
memory usage scanning.

Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211216232422.345164-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc: Add null pointer check for substream->runtime
Ajit Kumar Pandey [Thu, 16 Dec 2021 23:24:21 +0000 (17:24 -0600)]
ASoC: SOF: ipc: Add null pointer check for substream->runtime

When pcm stream is stopped "substream->runtime" pointer will be set
to NULL by ALSA core. In case host received an ipc msg from firmware
of type IPC_STREAM_POSITION after pcm stream is stopped, there will
be kernel NULL pointer exception in ipc_period_elapsed(). This patch
fixes it by adding NULL pointer check for "substream->runtime".

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211216232422.345164-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: avoid casting "const" attribute away
Guennadi Liakhovetski [Thu, 16 Dec 2021 23:24:20 +0000 (17:24 -0600)]
ASoC: SOF: avoid casting "const" attribute away

Casting "const" attribute away is dangerous, obtain a writable
pointer instead to avoid that.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211216232422.345164-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Intel: hda: remove support for RESUME in platform trigger
Ranjani Sridharan [Thu, 16 Dec 2021 23:16:28 +0000 (17:16 -0600)]
ASoC: SOF: Intel: hda: remove support for RESUME in platform trigger

The SOF driver removed the support for INFO_RESUME in the commit
"ASoC: SOF: pcm: do not add SNDRV_PCM_INFO_RESUME to runtime hw info".
And resuming is handled by the ALSA core with the .prepare and
.trigger_start stages. So, remove handling of RESUME trigger in the
component driver trigger op. So, remove handling the RESUME trigger in
the platform trigger op for HDA platforms.

Reviewed-by: Kai Vehmanen <kai.vehmanen@intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@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/20211216231628.344687-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Intel: hda: remove support for RESUME trigger
Ranjani Sridharan [Thu, 16 Dec 2021 23:16:27 +0000 (17:16 -0600)]
ASoC: SOF: Intel: hda: remove support for RESUME trigger

The SOF driver removed the support for INFO_RESUME in the commit
"ASoC: SOF: pcm: do not add SNDRV_PCM_INFO_RESUME to runtime hw info".
And resuming is handled by the ALSA core with the .prepare and
.trigger_start stages. So, remove handling of RESUME trigger in the
HDA DAI BE trigger op.

Reviewed-by: Kai Vehmanen <kai.vehmanen@intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@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/20211216231628.344687-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: pcm: remove support for RESUME trigger
Ranjani Sridharan [Thu, 16 Dec 2021 23:16:26 +0000 (17:16 -0600)]
ASoC: SOF: pcm: remove support for RESUME trigger

The SOF driver removed the support for INFO_RESUME in the commit
"ASoC: SOF: pcm: do not add SNDRV_PCM_INFO_RESUME to runtime hw info".
And resuming is handled by the ALSA core with the .prepare and
.trigger_start stages. So, remove handling of RESUME trigger in the
component driver trigger op.

Reviewed-by: Kai Vehmanen <kai.vehmanen@intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@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/20211216231628.344687-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agodmaengine: remove slave_id config field
Arnd Bergmann [Mon, 22 Nov 2021 22:22:03 +0000 (23:22 +0100)]
dmaengine: remove slave_id config field

All references to the slave_id field have been removed, so remove the
field as well to prevent new references from creeping in again.

Originally this allowed slave DMA drivers to configure which device
is accessed with the dmaengine_slave_config() call, but this was
inconsistent, as the same information is also passed while requesting
a channel, and never changes in practice.

In modern kernels, the device is always selected when requesting
the channel, so the .slave_id field is no longer useful.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20211122222203.4103644-12-arnd@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2 years agodmaengine: xilinx_dpdma: stop using slave_id field
Arnd Bergmann [Mon, 22 Nov 2021 22:22:01 +0000 (23:22 +0100)]
dmaengine: xilinx_dpdma: stop using slave_id field

The display driver wants to pass a custom flag to the DMA engine driver,
which it started doing by using the slave_id field that was traditionally
used for a different purpose.

As there is no longer a correct use for the slave_id field, it should
really be removed, and the remaining users changed over to something
different.

The new mechanism for passing nonstandard settings is using the
.peripheral_config field, so use that to pass a newly defined structure
here, making it clear that this will not work in portable drivers.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20211122222203.4103644-10-arnd@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2 years agodmaengine: qcom-adm: stop abusing slave_id config
Arnd Bergmann [Mon, 22 Nov 2021 22:22:00 +0000 (23:22 +0100)]
dmaengine: qcom-adm: stop abusing slave_id config

The slave_id was previously used to pick one DMA slave instead of another,
but this is now done through the DMA descriptors in device tree.

For the qcom_adm driver, the configuration is documented in the DT
binding to contain a tuple of device identifier and a "crci" field,
but the implementation ends up using only a single cell for identifying
the slave, with the crci getting passed in nonstandard properties of
the device, and passed through the dma driver using the old slave_id
field. Part of the problem apparently is that the nand driver ends up
using only a single DMA request ID, but requires distinct values for
"crci" depending on the type of transfer.

Change both the dmaengine driver and the two slave drivers to allow
the documented binding to work in addition to the ad-hoc passing
of crci values. In order to no longer abuse the slave_id field, pass
the data using the "peripheral_config" mechanism instead.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20211122222203.4103644-9-arnd@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2 years agodmaengine: sprd: stop referencing config->slave_id
Arnd Bergmann [Mon, 22 Nov 2021 22:21:59 +0000 (23:21 +0100)]
dmaengine: sprd: stop referencing config->slave_id

It appears that the code that reads the slave_id from the channel config
was copied incorrectly from other drivers. Nothing ever sets this field
on platforms that use this driver, so remove the reference.

Reviewed-by: Baolin Wang <baolin.wang7@gmail.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20211122222203.4103644-8-arnd@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2 years agodmaengine: pxa/mmp: stop referencing config->slave_id
Arnd Bergmann [Mon, 22 Nov 2021 22:21:58 +0000 (23:21 +0100)]
dmaengine: pxa/mmp: stop referencing config->slave_id

The last driver referencing the slave_id on Marvell PXA and MMP platforms
was the SPI driver, but this stopped doing so a long time ago, so the
TODO from the earlier patch can no be removed.

Fixes: b729bf34535e ("spi/pxa2xx: Don't use slave_id of dma_slave_config")
Fixes: 13b3006b8ebd ("dma: mmp_pdma: add filter function")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20211122222203.4103644-7-arnd@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2 years agodmaengine: shdma: remove legacy slave_id parsing
Arnd Bergmann [Mon, 22 Nov 2021 22:21:57 +0000 (23:21 +0100)]
dmaengine: shdma: remove legacy slave_id parsing

The slave device is picked through either devicetree or a filter
function, and any remaining out-of-tree drivers would have warned
about this usage since 2015.

Stop interpreting the field finally so it can be removed from
the interface.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20211122222203.4103644-6-arnd@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2 years agommc: bcm2835: stop setting chan_config->slave_id
Arnd Bergmann [Mon, 22 Nov 2021 22:21:56 +0000 (23:21 +0100)]
mmc: bcm2835: stop setting chan_config->slave_id

The field is not interpreted by the DMA engine driver, as all the data
is passed from devicetree instead. Remove the assignment so the field
can eventually be deleted.

Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20211122222203.4103644-5-arnd@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2 years agospi: pic32: stop setting dma_config->slave_id
Arnd Bergmann [Mon, 22 Nov 2021 22:21:55 +0000 (23:21 +0100)]
spi: pic32: stop setting dma_config->slave_id

Setting slave_id makes no sense with DT based probing, and
should eventually get removed entirely. Address this driver
by no longer setting the field here.

I could not find which DMA driver is used on PIC32, if it's
in the tree at all, but none of the obvious ones even care
about slave_id any more.

Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20211122222203.4103644-4-arnd@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2 years agoASoC: dai_dma: remove slave_id field
Arnd Bergmann [Mon, 22 Nov 2021 22:21:54 +0000 (23:21 +0100)]
ASoC: dai_dma: remove slave_id field

This field is no longer set from any driver now, so remove the
last references as well.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20211122222203.4103644-3-arnd@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2 years agodmaengine: tegra20-apb: stop checking config->slave_id
Arnd Bergmann [Mon, 22 Nov 2021 22:22:02 +0000 (23:22 +0100)]
dmaengine: tegra20-apb: stop checking config->slave_id

Nothing sets the slave_id field any more, so stop accessing
it to allow the removal of this field.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20211122222203.4103644-11-arnd@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2 years agoASoC: tegra20-spdif: stop setting slave_id
Arnd Bergmann [Mon, 22 Nov 2021 22:21:53 +0000 (23:21 +0100)]
ASoC: tegra20-spdif: stop setting slave_id

The DMA resource is never set up anywhere, and passing this as slave_id
has not been the proper procedure in a long time.

As a preparation for removing all slave_id references from the ALSA code,
remove this one.

According to Dmitry Osipenko, this driver has never been used and
the mechanism for configuring DMA would not work as it is implemented,
so this part will get rewritten when the driver gets put into use
again in the future.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20211122222203.4103644-2-arnd@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2 years ago ASoC: Changes to SOF kcontrol data set/get ops
Mark Brown [Thu, 16 Dec 2021 02:19:14 +0000 (02:19 +0000)]
 ASoC: Changes to SOF kcontrol data set/get ops

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

This set of patches deals with modifications to the signature of kcontrol
get/set data functions to make them more intuitive. The last patch deals
with initializing the binary control data size after boot up.

2 years agoASoC: AMD: fix depend/select mistake on SND_AMD_ACP_CONFIG
Pierre-Louis Bossart [Wed, 15 Dec 2021 16:35:11 +0000 (10:35 -0600)]
ASoC: AMD: fix depend/select mistake on SND_AMD_ACP_CONFIG

on i386 or x86_64:

when # CONFIG_ACPI is not set,
so SND_SOC_ACPI is not set:

WARNING: unmet direct dependencies detected for SND_AMD_ACP_CONFIG
  Depends on [n]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] &&
  SND_SOC_ACPI [=n]
  Selected by [y]:
  - SND_SOC_AMD_ACP_COMMON [=y] && SOUND [=y] && !UML && SND [=y] &&
  SND_SOC [=y] && X86 [=y] && PCI [=y]

This problem is due to the unconditional selection of
SND_AMD_ACP_CONFIG in other options. Using 'depends on' solved an
initial problem but exposed another, let's use select instead.

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Fixes: d9b994cd7641 ('ASoC: AMD: acp-config: fix missing dependency on SND_SOC_ACPI')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@intel.com>
Reviewed-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Link: https://lore.kernel.org/r/20211215163511.151286-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: nvidia,tegra-audio: Convert multiple txt bindings to yaml
David Heidelberg [Sat, 11 Dec 2021 22:49:44 +0000 (23:49 +0100)]
ASoC: nvidia,tegra-audio: Convert multiple txt bindings to yaml

Convert Tegra audio complex with the
  * ALC5632
  * MAX98090
  * RT5640
  * RT5677
  * SGTL5000
  * TrimSlice
  * WM8753
  * WM8903
  * WM9712
codec to the YAML format.

Additional changes:
 - added missing HPOUTL to the WM9712 codec.
 - extended rt5677 codec with multiple pins

Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: David Heidelberg <david@ixit.cz>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20211211224946.79875-1-david@ixit.cz
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: topology: read back control data from DSP
Ranjani Sridharan [Wed, 15 Dec 2021 18:04:04 +0000 (10:04 -0800)]
ASoC: SOF: topology: read back control data from DSP

Read back the control data from the DSP to initialize the control data
size to match that of the data in the DSP. This is particularly useful
for volatile read-only kcontrols in static pipelines.

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>
Link: https://lore.kernel.org/r/20211215180404.53254-9-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Drop ctrl_type parameter for snd_sof_ipc_set_get_comp_data()
Peter Ujfalusi [Wed, 15 Dec 2021 18:04:03 +0000 (10:04 -0800)]
ASoC: SOF: Drop ctrl_type parameter for snd_sof_ipc_set_get_comp_data()

The SOF_CTRL_TYPE_VALUE_COMP_* type is not used by the firmware nor in the
kernel side.
It is also not clear what action should be taken for such type.

With this in mind:
The correct ipc_cmd can be selected based on the `ctrl_cmd` and the `set`
parameters:
if the ctrl_cmd is SOF_CTRL_CMD_BINARY then SOF_CTRL_TYPE_DATA_*
otherwise SOF_CTRL_TYPE_VALUE_CHAN_*.

The SET or GET direction can be selected with the use of `set` parameter.

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: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211215180404.53254-8-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: control: Do not handle control notification with component type
Peter Ujfalusi [Wed, 15 Dec 2021 18:04:02 +0000 (10:04 -0800)]
ASoC: SOF: control: Do not handle control notification with component type

The component type is not used in firmware nor in the kernel currently and
it is not even clear how it should be handled.

Do not even try to handle it to avoid errors.

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: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211215180404.53254-7-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: sof-audio: Drop the `cmd` member from struct snd_sof_control
Peter Ujfalusi [Wed, 15 Dec 2021 18:04:01 +0000 (10:04 -0800)]
ASoC: SOF: sof-audio: Drop the `cmd` member from struct snd_sof_control

There is no need to use two variables to store and check the same
information, the scontrol->cmd is the same as scontrol->control_data->cmd.

Drop the former one and when it is needed, access the cmd from the
control_data.

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: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211215180404.53254-6-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Drop ctrl_cmd parameter for snd_sof_ipc_set_get_comp_data()
Peter Ujfalusi [Wed, 15 Dec 2021 18:04:00 +0000 (10:04 -0800)]
ASoC: SOF: Drop ctrl_cmd parameter for snd_sof_ipc_set_get_comp_data()

The scontrol->control_data->cmd has been configured during initialization
to the correct sof_ipc_ctrl_cmd.

No need to pass duplicated information, let's use the already available
one via scontrol.

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: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211215180404.53254-5-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: topology: Set control_data->cmd alongside scontrol->cmd
Peter Ujfalusi [Wed, 15 Dec 2021 18:03:59 +0000 (10:03 -0800)]
ASoC: SOF: topology: Set control_data->cmd alongside scontrol->cmd

Set the scontrol->control_data->cmd early to the same as scontrol->cmd.

This is a preparatory patch to remove the ctrl_cmd parameter for the
snd_sof_ipc_set_get_comp_data() 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>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211215180404.53254-4-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Drop ipc_cmd parameter for snd_sof_ipc_set_get_comp_data()
Peter Ujfalusi [Wed, 15 Dec 2021 18:03:58 +0000 (10:03 -0800)]
ASoC: SOF: Drop ipc_cmd parameter for snd_sof_ipc_set_get_comp_data()

The correct ipc_cmd can be selected based on the `ctrl_cmd` and the `set`
parameters:
if the ctrl_cmd is SOF_CTRL_CMD_BINARY then SOF_IPC_COMP_*_DATA
otherwise SOF_IPC_COMP_*_VALUE.

The SET or GET direction can be selected with the use of `set` parameter.

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: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211215180404.53254-3-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc: Rename send parameter in snd_sof_ipc_set_get_comp_data()
Peter Ujfalusi [Wed, 15 Dec 2021 18:03:57 +0000 (10:03 -0800)]
ASoC: SOF: ipc: Rename send parameter in snd_sof_ipc_set_get_comp_data()

Rename the send parameter to set in snd_sof_ipc_set_get_comp_data() and
sof_set_get_large_ctrl_data() to be more aligned with the function name.

No functional change.

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: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211215180404.53254-2-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: rt5663: Handle device_property_read_u32_array error codes
Jiasheng Jiang [Wed, 15 Dec 2021 03:15:50 +0000 (11:15 +0800)]
ASoC: rt5663: Handle device_property_read_u32_array error codes

The return value of device_property_read_u32_array() is not always 0.
To catch the exception in case that devm_kzalloc failed and the
rt5663->imp_table was NULL, which caused the failure of
device_property_read_u32_array.

Fixes: 450f0f6a8fb4 ("ASoC: rt5663: Add the manual offset field to compensate the DC offset")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20211215031550.70702-1-jiasheng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: OF: Avoid reverse module dependency
Daniel Baluta [Wed, 15 Dec 2021 08:57:03 +0000 (10:57 +0200)]
ASoC: SOF: OF: Avoid reverse module dependency

Similar with commit 8a49cd11e68ed0 ("ASoC: SOF: ACPI: avoid reverse
module dependency") we will be having hardware specific drivers that
link against a common "helper" framework.

sof-of-dev.c becomes a library with the interface defined in the newly
created file sof-of-dev.h.

This is the final step started with Kconfig simplification in
commit 7548a391c53ca ("ASoC: SOF: i.MX: simplify Kconfig")

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.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/20211215085703.137414-1-daniel.baluta@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC : soc-pcm: fix trigger race conditions with shared BE
Mark Brown [Wed, 15 Dec 2021 02:02:41 +0000 (02:02 +0000)]
ASoC : soc-pcm: fix trigger race conditions with shared BE

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

We've been adding a 'deep buffer' PCM device to several SOF topologies
in order to reduce power consumption. The typical use-case would be
music playback over a headset: this additional PCM device provides
more buffering and longer latencies, leaving the rest of the system
sleep for longer periods. Notifications and 'regular' low-latency
audio playback would still use the 'normal' PCM device and be mixed
with the 'deep buffer' before rendering on the headphone endpoint. The
tentative direction would be to expose this alternate device to
PulseAudio/PipeWire/CRAS via the UCM SectionModifier definitions.

That seemed a straightforward topology change until our automated
validation stress tests started reporting issues on SoundWire
platforms, when e.g. two START triggers might be send and conversely
the STOP trigger is never sent. The SoundWire stream state management
flagged inconsistent states when the two 'normal' and 'deep buffer'
devices are used concurrently with rapid play/stop/pause monkey
testing.

Looking at the soc-pcm.c code, it seems that the BE state
management needs a lot of love.

a) there is no consistent protection for the BE state. In some parts
of the code, the state updates are protected by a spinlock but in the
trigger they are not. When we open/play/close the two PCM devices in
stress tests, we end-up testing a state that is being modified. That
can't be good.

b) there is a conceptual deadlock: on stop we check the FE states to
see if a shared BE can be stopped, but since we trigger the BE first
the FE states have not been modified yet, so the TRIGGER_STOP is never
sent.

This patchset suggests the removal of the dedicated 'dpcm_lock' and
follows the design suggested by Takashi Iwai.  By default the
protection relies on the 'pcm_mutex', except for the FE and BE
triggers where the mutex cannot be used.  In this case, the FE PCM
lock is used instead. In the cases where a BE is added/removed, the
pcm_mutex and FE PCM lock are both taken.  In addition, the BE PCM
lock is used to serialize access to a shared BE.

With these patches I am able to run our entire validation suite
without any issues with this new 'deep buffer' topology, and no
regressions on existing solutions [1]. The tests were reproduced by
Bard Liao for SoundWire devices.

One might ask 'how come we didn't see this earlier'? The answer is
probably that the .trigger callbacks in most implementations seems to
perform DAPM operations, and sending the triggers multiple times is
not an issue. In the case of SoundWire, we do use the .trigger
callback to reconfigure the bus using the 'bank switch' mechanism. It
could be acceptable to tolerate a trigger multiple times, but the
deadlock on stop cannot be fixed at the SoundWire level alone.

Opens:

1) The issues reported by Nvidia on the RFCv3 may or may not be
present. We'd need test results to make sure the locking update does
not introduce a regression on Tegra.

2) There are other reports of kernel oopses [2] that seem related to
the lack of protection. I'd be good to confirm if this patchset solve
these problems as well.

[1] https://github.com/thesofproject/linux/pull/3146
[2] https://lore.kernel.org/alsa-devel/002f01d7b4f5$c030f4a0$4092dde0$@samsung.com/

changes since RFCv3:
Used two patches from Takashi. We now use the pcm_mutex, the FE stream
lock when adding and deleting a BE, and the BE stream lock to handle
concurrency between streams using the same BE.
Added a patch to use GFP_ATOMIC for the DPCM structure.
Fixed PAUSE_RELEASE transition (GitHub comment from Kai Vehmanen)

changes since RFCv2:
Removal of dpcm_lock to use FE PCM locks (credits to Takashi Iwai for
the suggestion). The FE PCM lock is now used before each use of
for_each_dpcm_be() - with the exception of the trigger where the lock
is already taken. This change is also applied in drivers which make
use of this loop (compress, SH, FSL).
Addition of BE PCM lock to deal with mutual exclusion between triggers
for the same BE.
Alignment of the BE atomicity on the FE on connections, this is
required to avoid sleeping in atomic context.
Additional cleanups (indentation, static functions)

changes since RFC v1:
Removed unused function
Removed exported symbols only used in soc-pcm.c, used static instead
Use a mutex instead of a spinlock
Protect all for_each_dpcm_be() loops
Fix bugs introduced in the refcount

Pierre-Louis Bossart (4):
  ASoC: soc-pcm: use GFP_ATOMIC for dpcm structure
  ASoC: soc-pcm: align BE 'atomicity' with that of the FE
  ASoC: soc-pcm: test refcount before triggering
  ASoC: soc-pcm: fix BE handling of PAUSE_RELEASE

Takashi Iwai (2):
  ASoC: soc-pcm: Fix and cleanup DPCM locking
  ASoC: soc-pcm: serialize BE triggers

 include/sound/soc-dpcm.h |   2 +
 include/sound/soc.h      |   2 -
 sound/soc/soc-core.c     |   1 -
 sound/soc/soc-pcm.c      | 351 +++++++++++++++++++++++++++------------
 4 files changed, 246 insertions(+), 110 deletions(-)

--
2.25.1

2 years agoASoC: qdsp6: Fix an IS_ERR() vs NULL bug
Miaoqian Lin [Sat, 11 Dec 2021 06:58:29 +0000 (06:58 +0000)]
ASoC: qdsp6: Fix an IS_ERR() vs NULL bug

The function gpr_alloc_port return ERR_PTR on errors, it doesn't return
null.

Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20211211065840.1221-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: qcom: Distinguish headset codec by codec_dai->name
Judy Hsiao [Tue, 14 Dec 2021 02:25:09 +0000 (10:25 +0800)]
ASoC: qcom: Distinguish headset codec by codec_dai->name

Distinguish which headset codec is on the board by codec_dai->name
instead of card->name.

It fixes the crash of being unable to handle kernel paging requests
at virtual address ADDR by initializing the correct audio codec on
the board.

Call stack of the crash:
```
 Unable to handle kernel paging request at virtual address ...
 ...
 Call trace:
  rt5682_set_component_pll+0xcc/0xb78 [snd_soc_rt5682]
  snd_soc_component_set_pll+0x90/0x154
  snd_soc_dai_set_pll+0xf4/0x1ac
  sc7180_snd_startup+0x268/0x3c0 [snd_soc_sc7180]
  snd_soc_link_startup+0xa4/0x180
  soc_pcm_open+0x35c/0x15c8
  snd_pcm_open_substream+0xa90/0x13b0
  snd_pcm_open+0x1a4/0x55c
  snd_pcm_capture_open+0x7c/0xe8
  snd_open+0x2b8/0x2e4
  chrdev_open+0x364/0x3d4
  do_dentry_open+0x66c/0xc58
  vfs_open+0x7c/0x8c
  path_openat+0x108c/0x2bbc
  do_filp_open+0x15c/0x258
  do_sys_open+0x278/0x62c
  __arm64_compat_sys_openat+0x9c/0xb0
  ...
```

Fixes: 425c5fce8a03 ("ASoC: qcom: Add support for ALC5682I-VS codec")
Signed-off-by: Judy Hsiao <judyhsiao@chromium.org>
Link: https://lore.kernel.org/r/20211214022509.1288245-1-judyhsiao@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: soc-pcm: fix BE handling of PAUSE_RELEASE
Pierre-Louis Bossart [Tue, 7 Dec 2021 17:37:45 +0000 (11:37 -0600)]
ASoC: soc-pcm: fix BE handling of PAUSE_RELEASE

A BE connected to more than one FE, e.g. in a mixer case, can go
through the following transitions.

play FE1    -> BE state is START
pause FE1   -> BE state is PAUSED
play FE2    -> BE state is START
stop FE2    -> BE state is STOP (see note [1] below)
release FE1 -> BE state is START
stop FE1    -> BE state is STOP

play FE1    -> BE state is START
pause FE1   -> BE state is PAUSED
play FE2    -> BE state is START
release FE1 -> BE state is START
stop FE2    -> BE state is START
stop FE1    -> BE state is STOP

play FE1    -> BE state is START
play FE2    -> BE state is START (no change)
pause FE1   -> BE state is START (no change)
pause FE2   -> BE state is PAUSED
release FE1 -> BE state is START
release FE2 -> BE state is START (no change)
stop FE1    -> BE state is START (no change)
stop FE2    -> BE state is STOP

The existing code for PAUSE_RELEASE only allows for the case where the
BE is paused, which clearly would not work in the sequences above.

Extend the allowed states to restart the BE when PAUSE_RELEASE is
received, and increase the refcount if the BE is already in START.

[1] the existing logic does not move the BE state back to PAUSED when
the FE2 is stopped. This patch does not change the logic; it would be
painful to keep a history of changes on the FE side, the state machine
is already rather complicated with transitions based on the last BE
state and the trigger type.

Reported-by: Bard Liao <bard.liao@intel.com>
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>
Link: https://lore.kernel.org/r/20211207173745.15850-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: soc-pcm: test refcount before triggering
Pierre-Louis Bossart [Tue, 7 Dec 2021 17:37:44 +0000 (11:37 -0600)]
ASoC: soc-pcm: test refcount before triggering

On start/pause_release/resume, when more than one FE is connected to
the same BE, it's possible that the trigger is sent more than
once. This is not desirable, we only want to trigger a BE once, which
is straightforward to implement with a refcount.

For stop/pause/suspend, the problem is more complicated: the check
implemented in snd_soc_dpcm_can_be_free_stop() may fail due to a
conceptual deadlock when we trigger the BE before the FE. In this
case, the FE states have not yet changed, so there are corner cases
where the TRIGGER_STOP is never sent - the dual case of start where
multiple triggers might be sent.

This patch suggests an unconditional trigger in all cases, without
checking the FE states, using a refcount protected by the BE PCM
stream lock.

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>
Link: https://lore.kernel.org/r/20211207173745.15850-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: soc-pcm: serialize BE triggers
Takashi Iwai [Tue, 7 Dec 2021 17:37:43 +0000 (11:37 -0600)]
ASoC: soc-pcm: serialize BE triggers

When more than one FE is connected to a BE, e.g. in a mixing use case,
the BE can be triggered multiple times when the FE are opened/started
concurrently. This race condition is problematic in the case of
SoundWire BE dailinks, and this is not desirable in a general
case.

This patch relies on the existing BE PCM lock, which takes atomicity into
account. The locking model assumes that all interactions start with
the FE, so that there is no deadlock between FE and BE locks.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
[test, checkpatch fix and clarification of commit message by plbossart]
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>
Link: https://lore.kernel.org/r/20211207173745.15850-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: soc-pcm: Fix and cleanup DPCM locking
Takashi Iwai [Tue, 7 Dec 2021 17:37:42 +0000 (11:37 -0600)]
ASoC: soc-pcm: Fix and cleanup DPCM locking

The existing locking for DPCM has several issues
a) a confusing mix of card->mutex and card->pcm_mutex.
b) a dpcm_lock spinlock added inconsistently and on paths that could
be recursively taken. The use of irqsave/irqrestore was also overkill.

The suggested model is:

1) The pcm_mutex is the top-most protection of BE links in the FE. The
pcm_mutex is applied always on either the top PCM callbacks or the
external call from DAPM, not taken in the internal functions.

2) the FE stream lock is taken in higher levels before invoking
dpcm_be_dai_trigger()

3) when adding and deleting a BE, both the pcm_mutex and FE stream
lock are taken.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
[clarification of commit message by plbossart]
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>
Link: https://lore.kernel.org/r/20211207173745.15850-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: soc-pcm: align BE 'atomicity' with that of the FE
Pierre-Louis Bossart [Tue, 7 Dec 2021 17:37:41 +0000 (11:37 -0600)]
ASoC: soc-pcm: align BE 'atomicity' with that of the FE

Since the flow for DPCM is based on taking a lock for the FE first, we
need to make sure during the connection between a BE and an FE that
they both use the same 'atomicity', otherwise we may sleep in atomic
context.

If the FE is nonatomic, this patch forces the BE to be nonatomic as
well. That should have no negative impact since the BE 'inherits' the
FE properties.

However, if the FE is atomic and the BE is not, then the configuration
is flagged as invalid.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
[ removed FE stream lock by tiwai ]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
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>
Link: https://lore.kernel.org/r/20211207173745.15850-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: soc-pcm: use GFP_ATOMIC for dpcm structure
Pierre-Louis Bossart [Tue, 7 Dec 2021 17:37:40 +0000 (11:37 -0600)]
ASoC: soc-pcm: use GFP_ATOMIC for dpcm structure

We allocate a structure in dpcm_be_connect(), which may be called in
atomic context. Using GFP_KERNEL is not quite right, we have to use
GFP_ATOMIC to prevent the allocator from sleeping.

Suggested-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
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>
Link: https://lore.kernel.org/r/20211207173745.15850-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: qcom: apq8016_sbc: Allow routing audio through QDSP6
Mark Brown [Tue, 14 Dec 2021 13:22:33 +0000 (13:22 +0000)]
ASoC: qcom: apq8016_sbc: Allow routing audio through QDSP6

Merge series from Stephan Gerhold <stephan@gerhold.net>:

This series makes it possible to route audio through the combined
audio/modem DSP on MSM8916/APQ8016 devices instead of bypassing it using
the LPASS drivers. This is necessary to support certain functionality such
as voice call audio. See PATCH 4/5 for details.

Also, qcom,apq8016-sbc.txt is converted to DT schema by adding it to the
existing qcom,sm8250.yaml. The bindings are similar enough that it is easier
to share a single schema instead of duplicating everything into multiple ones.

2 years agoASoC: mediatek: assign correct type to argument
Jiaxin Yu [Thu, 9 Dec 2021 07:32:24 +0000 (15:32 +0800)]
ASoC: mediatek: assign correct type to argument

Fix the following sparse warning: (new ones prefixed by >>)
>> sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c:370:33:
     sparse: sparse: incorrect type in argument 3 (different base types)
   sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c:370:33: sparse:
     expected unsigned int to
   sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c:370:33: sparse:
     got restricted snd_pcm_format_t [usertype]

Correct discription of format, use S32_LE and S24_LE to distinguish the
different 32bit.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20211209073224.21793-1-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: sof-probes: Constify sof_probe_compr_ops
Rikard Falkeborn [Sat, 4 Dec 2021 20:32:20 +0000 (21:32 +0100)]
ASoC: SOF: sof-probes: Constify sof_probe_compr_ops

The only usage of sof_probe_compr_ops is to assign its address to the
cops field in the snd_soc_dai_driver struct (in
sound/soc/sof/intel/hda-dai.c). 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/20211204203220.54712-1-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Remove pm_runtime_put_autosuspend() for SOF OF device
Allen-KH Cheng [Thu, 9 Dec 2021 20:08:30 +0000 (22:08 +0200)]
ASoC: SOF: Remove pm_runtime_put_autosuspend() for SOF OF device

In SOF OF device, pm_runtime_put_autosuspend() is not
matching any pm_runtime_get_sync().

This is imbalanced for PM runtime.

Also, for consistency we call pm_runtime_mark_last_busy()
before enabling PM runtime.

1. Remove pm_runtime_put_autosuspend() in probe_complete
2. Reorder PM runtime calls int probe_complete

Signed-off-by: Allen-KH Cheng <Allen-KH.Cheng@mediatek.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://lore.kernel.org/r/20211209200830.145005-1-daniel.baluta@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: qcom: apq8016_sbc: Allow routing audio through QDSP6
Stephan Gerhold [Thu, 2 Dec 2021 14:55:05 +0000 (15:55 +0100)]
ASoC: qcom: apq8016_sbc: Allow routing audio through QDSP6

The apq8016-sbc-sndcard is designed to be used with the LPASS drivers
(bypassing the combined audio/modem DSP in MSM8916/APQ8016).
Make it possible to use QDSP6 audio instead for the msm8916-qdsp6-sndcard.

This only requires adding some additional hooks that set up the DPCM
backends correctly. Similar code is already used in drivers for newer
SoCs such as apq8096.c, sdm845.c and sm8250.c.

A slightly different initialization sequence is used for the apq8016-sbc
and msm8916-qdsp6 sound card by defining the apq8016_sbc_add_ops()
function as device match data.

Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20211202145505.58852-6-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: dt-bindings: qcom: Document qcom,msm8916-qdsp6-sndcard compatible
Stephan Gerhold [Thu, 2 Dec 2021 14:55:04 +0000 (15:55 +0100)]
ASoC: dt-bindings: qcom: Document qcom,msm8916-qdsp6-sndcard compatible

There are two possible audio setups on MSM8916/APQ8016: Normally the audio
is routed through the audio/modem DSP (covered by the qdsp6 driver). During
upstreaming for the DragonBoard 410c it was decided to bypass it and
instead talk directly to the audio controller using the "lpass" driver.

Bypassing the DSP gives more control about the audio configuration but limits
the functionality: For example, routing audio through the audio/modem DSP is
strictly required for voice call audio. Also, without the special changes in
the DB410c firmware other MSM8916 devices can only use the bypass as long as
the modem DSP is not started. Otherwise, the firmware will assume control of
the LPASS hardware block and audio is no longer functional.

Add support for using the DSP audio setup instead using a new
"qcom,msm8916-qdsp6-sndcard" compatible. It is basically a mixture of
the apq8016-sbc-sndcard and the newer sm8250-sndcard, which uses
indirect QDSP6 DAI links instead of the direct LPASS DAI links.

Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20211202145505.58852-5-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: dt-bindings: qcom: apq8016-sbc: Move to qcom,sm8250 DT schema
Stephan Gerhold [Thu, 2 Dec 2021 14:55:03 +0000 (15:55 +0100)]
ASoC: dt-bindings: qcom: apq8016-sbc: Move to qcom,sm8250 DT schema

All the Qualcomm sound card drivers use the same common device tree
parsing code, so the allowed device tree nodes are almost the same
for all of them. Convert the qcom,apq8016-sbc-sndcard documentation
to a DT schema by adding it to the existing qcom,sm8250 schema.

The only speciality of qcom,apq8016-sbc-sndcard is that it has memory
resources for setting up an I/O mux. This can be handled using
a conditional if statement that only requires it for the apq8016-sbc
compatible.

Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20211202145505.58852-4-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: dt-bindings: qcom: sm8250: Document "aux-devs"
Stephan Gerhold [Thu, 2 Dec 2021 14:55:02 +0000 (15:55 +0100)]
ASoC: dt-bindings: qcom: sm8250: Document "aux-devs"

The sm8250 audio driver uses the common Qualcomm device tree parser and
therefore already supports the "aux-devs" property that allows adding
additional auxiliary devices to the sound card (e.g. analog speaker
amplifiers that can be connected using "audio-routing").

Document the property in the DT schema for sm8250 as well. The description
is taken from simple-card.yaml which has a very similar property.

Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20211202145505.58852-3-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: dt-bindings: qcom: sm8250: Drop redundant MultiMedia routes
Stephan Gerhold [Thu, 2 Dec 2021 14:55:01 +0000 (15:55 +0100)]
ASoC: dt-bindings: qcom: sm8250: Drop redundant MultiMedia routes

The MultiMedia audio routes can be deduced from other parts of the
device tree (e.g. the definitions of the MultiMedia DAIs) and therefore
specifying them again in "audio-routing" is redundant and prone to
mistakes. This is no longer necessary since commit 6fd8d2d275f7
("ASoC: qcom: qdsp6: Move frontend AIFs to q6asm-dai").

Let's drop them from the example in the DT schema as well
to avoid confusion.

Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20211202145505.58852-2-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Intel: add comment on JasperLake support
Pierre-Louis Bossart [Tue, 7 Dec 2021 19:39:47 +0000 (13:39 -0600)]
ASoC: SOF: Intel: add comment on JasperLake support

Explain why JasperLake is exposed in cnl.c instead of icl.c
No functionality change.

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>
Link: https://lore.kernel.org/r/20211207193947.71080-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>