platform/kernel/linux-rpi.git
20 months agoASoC: SOF: Intel: hda-codec: add hda_codec_device_remove() helper
Pierre-Louis Bossart [Thu, 27 Oct 2022 19:35:28 +0000 (15:35 -0400)]
ASoC: SOF: Intel: hda-codec: add hda_codec_device_remove() helper

Continue split between controller and codec.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20221027193540.259520-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Intel: hda-ctrl: add codec wakeup helper
Pierre-Louis Bossart [Thu, 27 Oct 2022 19:35:27 +0000 (15:35 -0400)]
ASoC: SOF: Intel: hda-ctrl: add codec wakeup helper

Add new helper in hda-codec.c for a clean split between controller and
codec.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20221027193540.259520-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Intel: move all RIRB/CMD_IO helpers to hda-codec.c
Pierre-Louis Bossart [Thu, 27 Oct 2022 19:35:26 +0000 (15:35 -0400)]
ASoC: SOF: Intel: move all RIRB/CMD_IO helpers to hda-codec.c

We need to split basic stream functionality from RIRB/CORB, which are
completely codec-related.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20221027193540.259520-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Intel: hda: add multi-link helper for LOSVID
Pierre-Louis Bossart [Thu, 27 Oct 2022 19:35:25 +0000 (15:35 -0400)]
ASoC: SOF: Intel: hda: add multi-link helper for LOSVID

Add new helper to deal with LOSVID.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20221027193540.259520-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Intel: start moving multi-link handling in dedicated file
Pierre-Louis Bossart [Thu, 27 Oct 2022 19:35:24 +0000 (15:35 -0400)]
ASoC: SOF: Intel: start moving multi-link handling in dedicated file

The multi-link handling needs to be handled with dedicated helpers
before cleanups and extensions.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20221027193540.259520-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Intel: move codec state change to hda-codec.c
Pierre-Louis Bossart [Thu, 27 Oct 2022 19:35:23 +0000 (15:35 -0400)]
ASoC: SOF: Intel: move codec state change to hda-codec.c

The codec_mask and codec-related handling should depend on
SOF_HDA_AUDIO_CODEC, not SOF_HDA.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20221027193540.259520-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Intel: hda-codec: simplify SND_SOC_SOF_HDA_AUDIO_CODEC handling
Pierre-Louis Bossart [Thu, 27 Oct 2022 19:35:22 +0000 (15:35 -0400)]
ASoC: SOF: Intel: hda-codec: simplify SND_SOC_SOF_HDA_AUDIO_CODEC handling

Now that we have removed the dependency on SND_SOC_HDAC_HDMI, we can
simplify the code and make the code conditional on a single #ifdef.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20221027193540.259520-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Intel: remove all dependencies on SND_SOC_HDAC_HDMI
Pierre-Louis Bossart [Thu, 27 Oct 2022 19:35:21 +0000 (15:35 -0400)]
ASoC: SOF: Intel: remove all dependencies on SND_SOC_HDAC_HDMI

remove all dependencies on SND_SOC_HDAC_HDMI and
clean-up ifdefs. The machine driver still supports this configuration
used by the Skylake driver.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20221027193540.259520-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Intel: remove option to disable the common_hdmi handling
Pierre-Louis Bossart [Thu, 27 Oct 2022 19:35:20 +0000 (15:35 -0400)]
ASoC: SOF: Intel: remove option to disable the common_hdmi handling

We've been using the same option for quite some time now, it's time to
remove the kernel parameter to disable the common HDaudio codec
handling.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20221027193540.259520-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: Intel: Fix typo in comments
Mark Brown [Wed, 26 Oct 2022 18:53:21 +0000 (19:53 +0100)]
ASoC: Intel: Fix typo in comments

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

There is a typo which keeps propagating through existing Intel machine
boards fix it with hope that fix stops it from appearing in new boards.

20 months agoASoC: SOF: Intel: HDaudio cleanups
Mark Brown [Wed, 26 Oct 2022 18:53:14 +0000 (19:53 +0100)]
ASoC: SOF: Intel: HDaudio cleanups

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

This is the part1 of my HDaudio cleanups, before the addition of
to-be-announced HDaudio extensions.

The patchset includes more consistent use of read/write/update
helpers, removal of useless waits, structure members and programming
sequences, removal of confusing sharing of private_data between FE and
BE.

Additional patches are coming to split the controller, codec and
multi-link management functionality in well-identified files.

Pierre-Louis Bossart (16):
  ASoC: SOF: ops: fallback to mmio in helpers
  ASoC: SOF: Intel: use mmio fallback for all platforms
  ASoC: SOF: ops: add readb/writeb helpers
  ASoC: SOF: ops: add snd_sof_dsp_updateb() helper
  ASoC: SOF: Intel: hda-dsp: use SOF helpers for consistency
  ASoC: SOF: Intel: hda-dai: start removing the use of
    runtime->private_data in BE
  ASoC: SOF: Intel: hda-dai: use component_get_drvdata to find hdac_bus
  ASoC: SOF: Intel: hda-dai: remove useless members in hda_pipe_params
  ASoC: SOF: Intel: hda-ctrl: remove useless sleep
  ASoC: SOF: Intel: hda: always do a full reset
  ASoC: SOF: Intel: hda: remove useless check on GCTL
  ASoC: SOF: Intel: hda-stream: use SOF helpers for consistency
  ASoC: SOF: Intel: hda-stream: rename CL_SD_CTL registers as SD_CTL
  ASoC: SOF: Intel: hda: use SOF helper for consistency
  ASoC: SOF: Intel: hda-stream: use snd_sof_dsp_updateb() helper
  ASoC: SOF: Intel: hda-stream: use readb/writeb for stream registers

 sound/soc/sof/intel/bdw.c            |  6 +---
 sound/soc/sof/intel/byt.c            | 12 ++-----
 sound/soc/sof/intel/hda-common-ops.c |  6 +---
 sound/soc/sof/intel/hda-ctrl.c       | 41 ++++++++--------------
 sound/soc/sof/intel/hda-dai.c        | 31 +++++++----------
 sound/soc/sof/intel/hda-dsp.c        | 12 ++++---
 sound/soc/sof/intel/hda-loader-skl.c | 30 ++++++++--------
 sound/soc/sof/intel/hda-loader.c     |  4 +--
 sound/soc/sof/intel/hda-stream.c     | 47 ++++++++++++-------------
 sound/soc/sof/intel/hda.c            |  5 ++-
 sound/soc/sof/intel/hda.h            | 25 +++++++-------
 sound/soc/sof/intel/pci-tng.c        |  6 +---
 sound/soc/sof/ops.h                  | 51 ++++++++++++++++++++--------
 sound/soc/sof/sof-priv.h             |  4 +++
 14 files changed, 136 insertions(+), 144 deletions(-)

--
2.34.1

20 months agoASoC: cleanups and improvements for jz4740-i2s
Mark Brown [Wed, 26 Oct 2022 18:29:28 +0000 (19:29 +0100)]
ASoC: cleanups and improvements for jz4740-i2s

Merge series from Aidan MacDonald <aidanmacdonald.0x0@gmail.com>:

This series is a preparatory cleanup of the jz4740-i2s driver before
adding support for a new SoC. The two improvements are lifting
unnecessary restrictions on sample rates and formats -- the existing
ones appear to be derived from the limitations of the JZ4740's internal
codec and don't reflect the actual capabilities of the I2S controller.

I'm unable to test the series on any JZ47xx SoCs, but I have tested
on an X1000 (which is the SoC I'll be adding in a followup series).

20 months agoASoC: dt-bindings: rt5682: Set sound-dai-cells to 1
Nícolas F. R. A. Prado [Mon, 24 Oct 2022 22:00:14 +0000 (18:00 -0400)]
ASoC: dt-bindings: rt5682: Set sound-dai-cells to 1

Commit 0adccaf1eac9 ("ASoC: dt-bindings: rt5682: Add #sound-dai-cells")
defined the sound-dai-cells property as 0. However, rt5682 has two DAIs,
AIF1 and AIF2, and therefore should have sound-dai-cells set to 1. Fix
it.

Fixes: 0adccaf1eac9 ("ASoC: dt-bindings: rt5682: Add #sound-dai-cells")
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20221024220015.1759428-4-nfraprado@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: dt-bindings: realtek,rt5682s: Add #sound-dai-cells
Nícolas F. R. A. Prado [Mon, 24 Oct 2022 22:00:12 +0000 (18:00 -0400)]
ASoC: dt-bindings: realtek,rt5682s: Add #sound-dai-cells

The rt5682s codec is a DAI provider with two interfaces - AIF1 and AIF2
- and therefore should have a #sound-dai-cells property that is equal to
1. Add it.

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20221024220015.1759428-2-nfraprado@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: ipc4-loader: Return ssize_t from sof_ipc4_fw_parse_ext_man()
Peter Ujfalusi [Tue, 25 Oct 2022 13:27:06 +0000 (16:27 +0300)]
ASoC: SOF: ipc4-loader: Return ssize_t from sof_ipc4_fw_parse_ext_man()

sof_ipc4_fw_parse_ext_man() can return negative error numbers which is not
correct for the used size_t type.

Change the return value to ssize_t and use the same type where the function
is called.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 73c091a2fe96 ("ASoC: SOF: ipc4-loader: Support for loading external libraries")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20221025132706.30356-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Intel: MTL: fix comment error
Yong Zhi [Mon, 24 Oct 2022 16:43:50 +0000 (11:43 -0500)]
ASoC: SOF: Intel: MTL: fix comment error

Fix small cut-and-paste error in comment.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20221024164350.234830-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: dt-bindings: mt8192-mt6359: Set maxItems, not type, for sound-dai
Nícolas F. R. A. Prado [Mon, 24 Oct 2022 23:06:57 +0000 (19:06 -0400)]
ASoC: dt-bindings: mt8192-mt6359: Set maxItems, not type, for sound-dai

sound-dai is a standard property whose type is already set to
phandle-array by sound-dai.yaml, so there's no need to set it (and
wrongly so for headset-codec) in this binding. What should be set
however is the maximum number of items, which for headset-codec should
be 1.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20221024230658.1772907-1-nfraprado@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: Intel: avs: boards: Fix typo in comments
Amadeusz Sławiński [Mon, 24 Oct 2022 19:08:41 +0000 (21:08 +0200)]
ASoC: Intel: avs: boards: Fix typo in comments

It keeps propagating through machine boards, fix it once and for all.

Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20221024190841.31572-3-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: Intel: boards: Fix typo in comments
Amadeusz Sławiński [Mon, 24 Oct 2022 19:08:40 +0000 (21:08 +0200)]
ASoC: Intel: boards: Fix typo in comments

It keeps propagating through machine boards, fix it once and for all.

Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20221024190841.31572-2-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: jz4740-i2s: Refactor DAI probe/remove ops as component ops
Aidan MacDonald [Sun, 23 Oct 2022 14:33:28 +0000 (15:33 +0100)]
ASoC: jz4740-i2s: Refactor DAI probe/remove ops as component ops

Move most of the DAI probe/remove logic into component ops.
This makes things more consistent because the AIC clock is
now managed solely from the component side. And it makes it
easier to add codec switching support later on.

Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
Link: https://lore.kernel.org/r/20221023143328.160866-10-aidanmacdonald.0x0@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: jz4740-i2s: Move component functions near the component driver
Aidan MacDonald [Sun, 23 Oct 2022 14:33:27 +0000 (15:33 +0100)]
ASoC: jz4740-i2s: Move component functions near the component driver

Move the component suspend/resume functions near the definition
of the component driver to emphasize that they're unrelated to
the DAI functions.

Acked-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
Link: https://lore.kernel.org/r/20221023143328.160866-9-aidanmacdonald.0x0@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: jz4740-i2s: Support continuous sample rate
Aidan MacDonald [Sun, 23 Oct 2022 14:33:26 +0000 (15:33 +0100)]
ASoC: jz4740-i2s: Support continuous sample rate

The I2S controller on JZ47xx SoCs doesn't impose restrictions on
sample rate and the driver doesn't make any assumptions about it,
so the DAI should advertise a continuous sample rate range.

Acked-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
Link: https://lore.kernel.org/r/20221023143328.160866-8-aidanmacdonald.0x0@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: jz4740-i2s: Support S20_LE and S24_LE sample formats
Aidan MacDonald [Sun, 23 Oct 2022 14:33:25 +0000 (15:33 +0100)]
ASoC: jz4740-i2s: Support S20_LE and S24_LE sample formats

The audio controller on JZ47xx SoCs can transfer 20- and 24-bit
samples in the FIFO, so allow those formats to be used with the
I2S driver. Although the FIFO doesn't care about the in-memory
sample format, we only support 4-byte format variants because the
DMA controller on these SoCs cannot transfer in 3-byte multiples.

Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
Link: https://lore.kernel.org/r/20221023143328.160866-7-aidanmacdonald.0x0@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: jz4740-i2s: Align macro values and sort includes
Aidan MacDonald [Sun, 23 Oct 2022 14:33:24 +0000 (15:33 +0100)]
ASoC: jz4740-i2s: Align macro values and sort includes

Some purely cosmetic changes: line up all the macro values to
make things easier to read and sort the includes alphabetically.

Acked-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
Link: https://lore.kernel.org/r/20221023143328.160866-6-aidanmacdonald.0x0@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: jz4740-i2s: Use FIELD_PREP() macros in hw_params callback
Aidan MacDonald [Sun, 23 Oct 2022 14:33:23 +0000 (15:33 +0100)]
ASoC: jz4740-i2s: Use FIELD_PREP() macros in hw_params callback

Get rid of a couple of macros and improve readability by using
FIELD_PREP() and GENMASK() for the sample size setting.

Acked-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
Link: https://lore.kernel.org/r/20221023143328.160866-5-aidanmacdonald.0x0@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: jz4740-i2s: Simplify using regmap fields
Aidan MacDonald [Sun, 23 Oct 2022 14:33:22 +0000 (15:33 +0100)]
ASoC: jz4740-i2s: Simplify using regmap fields

The differences between register fields on different SoC versions
can be abstracted away using the regmap field API. This is easier
to understand and extend than comparisons based on the version ID.
Since the version IDs are unused after this change, remove them at
the same time, and remove unused macros.

Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
Link: https://lore.kernel.org/r/20221023143328.160866-4-aidanmacdonald.0x0@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: jz4740-i2s: Convert to regmap API
Aidan MacDonald [Sun, 23 Oct 2022 14:33:21 +0000 (15:33 +0100)]
ASoC: jz4740-i2s: Convert to regmap API

Using regmap for accessing the AIC registers makes the driver a
little easier to read, and later refactors can take advantage of
regmap APIs to further simplify the driver.

Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
Link: https://lore.kernel.org/r/20221023143328.160866-3-aidanmacdonald.0x0@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: jz4740-i2s: Handle independent FIFO flush bits
Aidan MacDonald [Sun, 23 Oct 2022 14:33:20 +0000 (15:33 +0100)]
ASoC: jz4740-i2s: Handle independent FIFO flush bits

On the JZ4740, there is a single bit that flushes (empties) both
the transmit and receive FIFO. Later SoCs have independent flush
bits for each FIFO.

Independent FIFOs can be flushed before the snd_soc_dai_active()
check because it won't disturb other active streams. This ensures
that the FIFO we're about to use is always flushed before starting
up. With shared FIFOs we can't do that because if another substream
is active, flushing its FIFO would cause underrun errors.

This also fixes a bug: since we were only setting the JZ4740's
flush bit, which corresponds to the TX FIFO flush bit on other
SoCs, other SoCs were not having their RX FIFO flushed at all.

Fixes: 967beb2e8777 ("ASoC: jz4740: Add jz4780 support")
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Cc: stable@vger.kernel.org
Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
Link: https://lore.kernel.org/r/20221023143328.160866-2-aidanmacdonald.0x0@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Intel: hda-stream: use readb/writeb for stream registers
Pierre-Louis Bossart [Mon, 24 Oct 2022 16:53:10 +0000 (11:53 -0500)]
ASoC: SOF: Intel: hda-stream: use readb/writeb for stream registers

readb/writeb are used directly without any wrappers or references to
the BAR, as usually done for other registers.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20221024165310.246183-17-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Intel: hda-stream: use snd_sof_dsp_updateb() helper
Pierre-Louis Bossart [Mon, 24 Oct 2022 16:53:09 +0000 (11:53 -0500)]
ASoC: SOF: Intel: hda-stream: use snd_sof_dsp_updateb() helper

No functionality change, only code consistency.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20221024165310.246183-16-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Intel: hda: use SOF helper for consistency
Pierre-Louis Bossart [Mon, 24 Oct 2022 16:53:08 +0000 (11:53 -0500)]
ASoC: SOF: Intel: hda: use SOF helper for consistency

No functionality change, just more consistency in the code.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20221024165310.246183-15-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Intel: hda-stream: rename CL_SD_CTL registers as SD_CTL
Pierre-Louis Bossart [Mon, 24 Oct 2022 16:53:07 +0000 (11:53 -0500)]
ASoC: SOF: Intel: hda-stream: rename CL_SD_CTL registers as SD_CTL

The use of the CL prefix is misleading. HDaudio streams are used for
code loading since ApolloLake, but they are also used for regular
audio transfers.

No functionality change, pure rename.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20221024165310.246183-14-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Intel: hda-stream: use SOF helpers for consistency
Pierre-Louis Bossart [Mon, 24 Oct 2022 16:53:06 +0000 (11:53 -0500)]
ASoC: SOF: Intel: hda-stream: use SOF helpers for consistency

Not sure why we mixed sof and hdac helpers, this makes the code way
less readable.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20221024165310.246183-13-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Intel: hda: remove useless check on GCTL
Pierre-Louis Bossart [Mon, 24 Oct 2022 16:53:05 +0000 (11:53 -0500)]
ASoC: SOF: Intel: hda: remove useless check on GCTL

Now that we always do a full reset, there's no point in checking if
the controller is always out-of-reset. This is always true by
construction.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20221024165310.246183-12-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Intel: hda: always do a full reset
Pierre-Louis Bossart [Mon, 24 Oct 2022 16:53:04 +0000 (11:53 -0500)]
ASoC: SOF: Intel: hda: always do a full reset

There's no point in checking for a full-reset condition that is
always-true in the callers.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20221024165310.246183-11-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Intel: hda-ctrl: remove useless sleep
Pierre-Louis Bossart [Mon, 24 Oct 2022 16:53:03 +0000 (11:53 -0500)]
ASoC: SOF: Intel: hda-ctrl: remove useless sleep

The hda_dsp_ctrl_link_reset() already performs a usleep and a check that
GCTL has been modified, there's no point in waiting more.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20221024165310.246183-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Intel: hda-dai: remove useless members in hda_pipe_params
Pierre-Louis Bossart [Mon, 24 Oct 2022 16:53:02 +0000 (11:53 -0500)]
ASoC: SOF: Intel: hda-dai: remove useless members in hda_pipe_params

Some settings were never or are no longer used, remove useless
definitions and assignments.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20221024165310.246183-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Intel: hda-dai: use component_get_drvdata to find hdac_bus
Pierre-Louis Bossart [Mon, 24 Oct 2022 16:53:01 +0000 (11:53 -0500)]
ASoC: SOF: Intel: hda-dai: use component_get_drvdata to find hdac_bus

Remove the last usage of substream->runtime->private_data in the
HDAudio BE hw_params.

The SOF core saves the 'sdev' global context as component drvdata, and
we already save the bus information in sdev.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20221024165310.246183-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Intel: hda-dai: start removing the use of runtime->private_data in BE
Pierre-Louis Bossart [Mon, 24 Oct 2022 16:53:00 +0000 (11:53 -0500)]
ASoC: SOF: Intel: hda-dai: start removing the use of runtime->private_data in BE

The SOF HDAudio code stores the Host DMA hdac_stream structure in the
FE substream->runtime->private_data. The BE dailink also uses the
substream->runtime->private_data to allocate the link DMA stream tag.

This really works by accident: the DPCM core copies the FE runtime
information in the BE, which has the side-effect of sharing the
FE-specific private_data with the BE.

To avoid more uses of the private_data with potential issues such as
accessing stale information or use-after-free cases, this patch
removes most of the usages of this private_data at the BE level. We
can directly use the existing dma_data to access the relevant
information.

However the hw_params still uses the information, mainly to go back to
the 'bus' structure required for the link dma stream tag
allocation. This is safe in that the 'bus' is not stream or PCM
specific.

The next patch will completely remove this last use of private_data by
using the component_drvdata - which is how SOF passes a global context
around.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20221024165310.246183-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Intel: hda-dsp: use SOF helpers for consistency
Pierre-Louis Bossart [Mon, 24 Oct 2022 16:52:59 +0000 (11:52 -0500)]
ASoC: SOF: Intel: hda-dsp: use SOF helpers for consistency

No functionality change.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20221024165310.246183-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: ops: add snd_sof_dsp_updateb() helper
Pierre-Louis Bossart [Mon, 24 Oct 2022 16:52:58 +0000 (11:52 -0500)]
ASoC: SOF: ops: add snd_sof_dsp_updateb() helper

Add missing helper in SOF toolbox.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20221024165310.246183-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: ops: add readb/writeb helpers
Pierre-Louis Bossart [Mon, 24 Oct 2022 16:52:57 +0000 (11:52 -0500)]
ASoC: SOF: ops: add readb/writeb helpers

These will be used to add more consistency in the SOF core and
drivers.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20221024165310.246183-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Intel: use mmio fallback for all platforms
Pierre-Louis Bossart [Mon, 24 Oct 2022 16:52:56 +0000 (11:52 -0500)]
ASoC: SOF: Intel: use mmio fallback for all platforms

No need to expose an indirection when we can use the fallback.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20221024165310.246183-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: ops: fallback to mmio in helpers
Pierre-Louis Bossart [Mon, 24 Oct 2022 16:52:55 +0000 (11:52 -0500)]
ASoC: SOF: ops: fallback to mmio in helpers

Returning an error when a read/write is not implemented makes no
sense, especially on read where no return value makes sense.

Change the logic to directly fallback to mmio. If a platform truly
wants other read/writes that are not plain vanilla mmio, it needs to
implement its own routines.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20221024165310.246183-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: sun50i-dmic: avoid unused variable warning for sun50i_dmic_of_match
Ban Tao [Sun, 23 Oct 2022 07:44:45 +0000 (00:44 -0700)]
ASoC: sun50i-dmic: avoid unused variable warning for sun50i_dmic_of_match

In configurations with CONFIG_OF=n, we get a harmless build warning:

sound/soc/sunxi/sun50i-dmic.c:268:34: warning: unused variable
'sun50i_dmic_of_match' [-Wunused-const-variable]

Signed-off-by: Ban Tao <fengzheng923@gmail.com>
Reported-by: kernel test robot <lkp@intel.com>
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Link: https://lore.kernel.org/r/1666511085-2748-1-git-send-email-fengzheng923@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: dt-bindings: Convert dmic-codec to DT schema
Rob Herring [Fri, 21 Oct 2022 17:57:21 +0000 (12:57 -0500)]
ASoC: dt-bindings: Convert dmic-codec to DT schema

Convert the dmic-codec binding to DT schema format.

The '#sound-dai-cells' and 'sound-name-prefix' properties were not
documented, but are in use, so add them.

Reviewed-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20221021175721.4005601-1-robh@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Intel/IPC4: Support for external firmware libraries
Mark Brown [Fri, 21 Oct 2022 19:04:19 +0000 (20:04 +0100)]
ASoC: SOF: Intel/IPC4: Support for external firmware libraries

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

In IPC4 all DSP loadable executable is a 'library' containing modules. The main
or basefw is also a library which contains multiple modules.
IPC4 allows to use loadable libraries to extend the functionality of the booted
basefw.

This series adds support for loading external libraries in case they are needed
by the loaded topology file.

The libraries must be placed to a specific firmware directory (fw_lib_prefix),
which is:
intel/avs-lib|sof-ipc4-lib/ followed by the platform name and in case of
community key use a 'community' directory.

For example for upx-i11 (community key): intel/avs-lib/tgl/community is the
default path.

The name of the library should be the UUID of the module it contains since the
library loading is going to look for the file as <module_UUID>.bin
In case there is a need to bundle multiple modules into single library, symlinks
can be used to point to the file:

module_boundle.bin
<UUID1>.bin -> module_boundle.bin
<UUID2>.bin -> module_boundle.bin
<UUID3>.bin -> module_boundle.bin

But note that in this case all modules will be loaded to the DSP since only the
whole library can be loaded, not individual modules.

20 months agoASoC: SOF: ipc4-loader: Support for loading external libraries
Peter Ujfalusi [Thu, 20 Oct 2022 12:12:38 +0000 (15:12 +0300)]
ASoC: SOF: ipc4-loader: Support for loading external libraries

In case the requested module is not available among the loaded libraries,
try to load it as external library.

The kernel will try to load the file from <fw_lib_prefix>/<module_uuid>.bin

If the file found, then the ext manifest of it is parsed, placed it under
XArray and the pointer to the module is returned to the caller.

Releasing the firmware will be done on ipc cleanup time.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20221020121238.18339-20-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: loader: Remove the query_fw_configuration ops
Peter Ujfalusi [Thu, 20 Oct 2022 12:12:37 +0000 (15:12 +0300)]
ASoC: SOF: loader: Remove the query_fw_configuration ops

The query_fw_configuration callback is redundant and the only user of it
was converted to use the generic post_fw_boot ops.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20221020121238.18339-19-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: ipc4: Stop using the query_fw_configuration fw_loader ops
Peter Ujfalusi [Thu, 20 Oct 2022 12:12:36 +0000 (15:12 +0300)]
ASoC: SOF: ipc4: Stop using the query_fw_configuration fw_loader ops

Execute the configuration query from the generic post_fw_boot callback and
do not set the query_fw_configuration ops to allow it's removal.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20221020121238.18339-18-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: loader: Add support for IPC dependent post firmware boot ops
Peter Ujfalusi [Thu, 20 Oct 2022 12:12:35 +0000 (15:12 +0300)]
ASoC: SOF: loader: Add support for IPC dependent post firmware boot ops

Add support for executing IPC dependent tasks after a successful firmware
boot.

The new post_fw_boot ops can make the fw_loader query_fw_configuration
callback redundant as IPC code can handle the first boot internally.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20221020121238.18339-17-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Intel: Add ipc4 library loading implementation
Peter Ujfalusi [Thu, 20 Oct 2022 12:12:34 +0000 (15:12 +0300)]
ASoC: SOF: Intel: Add ipc4 library loading implementation

On Intel HDA platforms the library loading is done via DMA and an IPC
message is also need to be sent to initiate the downloading of the new
library.

Co-developed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20221020121238.18339-16-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Intel: hda: Add flag to indicate that the firmware is IMR booted
Peter Ujfalusi [Thu, 20 Oct 2022 12:12:33 +0000 (15:12 +0300)]
ASoC: SOF: Intel: hda: Add flag to indicate that the firmware is IMR booted

Dynamic loading of external libraries should not be done if the firmware
was booted from IMR since in that case the libraries will be restored along
with the basefw.

The booted_from_imr flag is introduced and set to true if the IMR boot was
successful and to false if cold booting is executed.

The reason for the new flag is that guessing from existing flags, used to
decide if we should try booting from IMR or not is not going to be robust
as the IMR boot itself can fail and in that case a full, cold boot is
executed.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20221020121238.18339-15-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: ipc4: Define platform dependent library loading callback
Peter Ujfalusi [Thu, 20 Oct 2022 12:12:32 +0000 (15:12 +0300)]
ASoC: SOF: ipc4: Define platform dependent library loading callback

Platforms where external libraries can be supported should set the
load_library callback to implement this functionality.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20221020121238.18339-14-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Intel: Set the default firmware library path for IPC4
Peter Ujfalusi [Thu, 20 Oct 2022 12:12:31 +0000 (15:12 +0300)]
ASoC: SOF: Intel: Set the default firmware library path for IPC4

The default path for the external firmware libraries are:
intel/avs-lib/<platform>
or
intel/sof-ipc4-lib/<platform>

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20221020121238.18339-13-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Add path definition for external firmware libraries
Peter Ujfalusi [Thu, 20 Oct 2022 12:12:30 +0000 (15:12 +0300)]
ASoC: SOF: Add path definition for external firmware libraries

IPC4 based firmware supports dynamically loaded external libraries.
The libraries will be not stored alongside of the firmware or tplg files.

For intel platforms the default path will be:
intel/avs-lib|sof-ipc4-lib/<platform>/ if a community key is used on the
given machine then the libraries will be under 'community' directory, like
it is done for the firmware itself.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20221020121238.18339-12-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: IPC4: Add helper for looking up module by UUID
Peter Ujfalusi [Thu, 20 Oct 2022 12:12:29 +0000 (15:12 +0300)]
ASoC: SOF: IPC4: Add helper for looking up module by UUID

Add a simple helper to walk the loaded libraries and their modules to make
the ipc4-topology not aware of the underlying infrastructure and simplify
the code.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20221020121238.18339-11-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: ipc4: Convert the firmware handling (loader) to library convention
Peter Ujfalusi [Thu, 20 Oct 2022 12:12:28 +0000 (15:12 +0300)]
ASoC: SOF: ipc4: Convert the firmware handling (loader) to library convention

With IPC4 each DSP loadable binary is a library, which contains
ext_manifest section and loadable modules.
The basefw is no exception, it is always library 0 and it can contain
several modules, depending on the firmware build.

The current code assumes only one binary, which is the basefw and has no
concept of libraries.
This patch introduces the library+modules abstraction and represents the
basefw as library for the IPC4 loader codebase.
The basefw loading and handling is not changing, it is still done by the
generic code, but it's information is cloned under the library
representation.

The libraries are managed via XArray to offload the list and ID management.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20221020121238.18339-10-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: ipc4-loader: Save the maximum number of libraries supported
Peter Ujfalusi [Thu, 20 Oct 2022 12:12:27 +0000 (15:12 +0300)]
ASoC: SOF: ipc4-loader: Save the maximum number of libraries supported

The firmware supports external libraries (containing modules) to be loaded
runtime.
The firmware configuration contains the maximum number of libraries
supported, including the base firmware (which is library 0).

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20221020121238.18339-9-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: ipc: ops: Add support for optional init and exit callbacks
Peter Ujfalusi [Thu, 20 Oct 2022 12:12:26 +0000 (15:12 +0300)]
ASoC: SOF: ipc: ops: Add support for optional init and exit callbacks

Add support for IPC specific initialization (init) and cleanup (exit)
callback.

These callbacks can be used by IPC implementation to do basic
initialization and cleanup.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20221020121238.18339-8-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Drop the firmware and fw_offset from snd_sof_pdata
Peter Ujfalusi [Thu, 20 Oct 2022 12:12:25 +0000 (15:12 +0300)]
ASoC: SOF: Drop the firmware and fw_offset from snd_sof_pdata

The SOF stack now uses the sdev->basefw to work with the SOF firmware, the
information from plat_data can be dropped.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20221020121238.18339-7-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Intel: hda-loader-skl: Use the basefw firmware container directly
Peter Ujfalusi [Thu, 20 Oct 2022 12:12:24 +0000 (15:12 +0300)]
ASoC: SOF: Intel: hda-loader-skl: Use the basefw firmware container directly

Switch to access to the firmware struct via sdev->basefw container to
unblock the removal of the firmware information from plat_data.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20221020121238.18339-6-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Intel: hda-loader: Use the basefw firmware container directly
Peter Ujfalusi [Thu, 20 Oct 2022 12:12:23 +0000 (15:12 +0300)]
ASoC: SOF: Intel: hda-loader: Use the basefw firmware container directly

Switch to access to the firmware struct via sdev->basefw container to
unblock the removal of the firmware information from plat_data.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20221020121238.18339-5-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: amd: Use the basefw firmware container directly
Peter Ujfalusi [Thu, 20 Oct 2022 12:12:22 +0000 (15:12 +0300)]
ASoC: SOF: amd: Use the basefw firmware container directly

Switch to access to the firmware struct via sdev->basefw container to
unblock the removal of the firmware information from plat_data.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20221020121238.18339-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Introduce container struct for SOF firmware
Peter Ujfalusi [Thu, 20 Oct 2022 12:12:21 +0000 (15:12 +0300)]
ASoC: SOF: Introduce container struct for SOF firmware

Move the firmware related information under a new struct (sof_firmware)
and add it to the high level snd_sof_dev struct.

Convert the generic code to use this new container when working with the
basefw and for compatibility reasons set the old plat_data members used by
the platforms.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20221020121238.18339-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: loader: Set complete state before post_fw_run op
Ranjani Sridharan [Thu, 20 Oct 2022 12:12:20 +0000 (15:12 +0300)]
ASoC: SOF: loader: Set complete state before post_fw_run op

Set the FW state to complete right after boot is complete. This enables
sending IPC's in the post_fw_run op. This will be needed to support
reloading 3rd party module libraries after firmware boot.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20221020121238.18339-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: Merge HDA/ext cleanup
Mark Brown [Fri, 21 Oct 2022 11:22:32 +0000 (12:22 +0100)]
ASoC: Merge HDA/ext cleanup

Merge branch 'topic/hda-ext-cleanup' of
https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound into
asoc-6.2 for further AVS work.

20 months agoALSA/ASoC: hda: move SPIB/DRMS functionality from ext layer
Pierre-Louis Bossart [Wed, 19 Oct 2022 16:21:15 +0000 (11:21 -0500)]
ALSA/ASoC: hda: move SPIB/DRMS functionality from ext layer

The SPIB and DRMS capabilities are orthogonal to the DSP enablement
and can be used whether the stream is coupled or not.

The existing code partitioning makes limited sense, the capabilities
are parsed at the sound/hda level but helpers are located in
sound/hda/ext.

This patch moves all the SPIB/DRMS functionality to the sound/hda
layer. This reduces the complexity of the sound/hda/ext layer which is
now limited to handling the multi-link extensions and stream
coupling/decoupling helpers.

Note that this is an iso-functionality code move and rename, the
HDaudio legacy driver would need additional changes to make use of
these capabilities.

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 <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20221019162115.185917-11-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
20 months agoALSA: hda: hdac_ext_controller: remove useless loop
Pierre-Louis Bossart [Wed, 19 Oct 2022 16:21:14 +0000 (11:21 -0500)]
ALSA: hda: hdac_ext_controller: remove useless loop

commit 0b00a5615dc40 ("ALSA: hdac_ext: add hdac extended controller")
introduced a for() loop on the number of HDaudio codecs that seems
completely useless.

a) the body of the loop does not make use of the loop index, and
b) the LSDIID register is related to the SDI line, so there can only
be one codec per multi-link descriptor.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20221019162115.185917-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
20 months agoALSA: hda: ext: reduce ambiguity between 'multi-link' and 'link' DMA
Pierre-Louis Bossart [Wed, 19 Oct 2022 16:21:13 +0000 (11:21 -0500)]
ALSA: hda: ext: reduce ambiguity between 'multi-link' and 'link' DMA

My esteemed colleagues keep using the same words for different things.

The multi-link structure needs to be handled whether the DSP is
enabled or not.

The host and link DMAs are only relevant when the DSP is enabled.

Things get convoluted when there's an ambiguity between the LOSIDV
settings in the multi-link register space and the selection of the
stream_tag for the link DMA.

Clarify with a rename that the static functions used are related to
the host and link DMAs only.

No functionality change, pure rename.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20221019162115.185917-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
20 months agoALSA/ASoC: hda: ext: add 'bus' prefix for multi-link stream setting
Pierre-Louis Bossart [Wed, 19 Oct 2022 16:21:12 +0000 (11:21 -0500)]
ALSA/ASoC: hda: ext: add 'bus' prefix for multi-link stream setting

All the helpers dealing with multi-link configurations are located in
the hdac_ext_controller.c, except the two set/clear routines that
modify the LOSIDV registers.

For consistency, move the two helpers and add the 'bus' prefix. One
could argue that the 'ml' prefix might be more relevant but that would
be a larger code change.

No functionality change, just move and rename.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20221019162115.185917-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
20 months agoALSA/ASoC: hda: ext: remove 'link' prefix for stream-related operations
Pierre-Louis Bossart [Wed, 19 Oct 2022 16:21:11 +0000 (11:21 -0500)]
ALSA/ASoC: hda: ext: remove 'link' prefix for stream-related operations

We should only use 'link' in the context of multi-link
configurations. Streams are configured from a different register space
and are not dependent on link except for LOSIDV settings.

Not functionality change, just pure rename.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20221019162115.185917-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
20 months agoALSA/ASoC: hda: ext: add 'ext' prefix to snd_hdac_link_free_all
Pierre-Louis Bossart [Wed, 19 Oct 2022 16:21:10 +0000 (11:21 -0500)]
ALSA/ASoC: hda: ext: add 'ext' prefix to snd_hdac_link_free_all

No functionality change, just prefix addition to clearly identify that
the helper only applies to the 'ext' part for Intel platforms.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20221019162115.185917-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
20 months agoALSA/ASoC: hda: clarify bus_get_link() and bus_link_get() helpers
Pierre-Louis Bossart [Wed, 19 Oct 2022 16:21:09 +0000 (11:21 -0500)]
ALSA/ASoC: hda: clarify bus_get_link() and bus_link_get() helpers

We have two helpers with confusing names and different purposes.

Rename bus_get_link() and bus_get_link_at() as bus_get_hlink_by_name()
and bus_get_hlink_by_addr() respectively.

No functionality change

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20221019162115.185917-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
20 months agoASoC: SOF: Intel: hda-dai: use hlink variable/parameter
Pierre-Louis Bossart [Wed, 19 Oct 2022 16:21:08 +0000 (11:21 -0500)]
ASoC: SOF: Intel: hda-dai: use hlink variable/parameter

Follow the convention and use hlink for consistency.
No functionality change.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20221019162115.185917-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
20 months agoALSA: hda: ext: hda_ext_controller: use hlink variable/parameter
Pierre-Louis Bossart [Wed, 19 Oct 2022 16:21:07 +0000 (11:21 -0500)]
ALSA: hda: ext: hda_ext_controller: use hlink variable/parameter

Follow the convention and use hlink for consistency.
No functionality change.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20221019162115.185917-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
20 months agoALSA: hda: ext: hdac_ext_controller: use helpers in loop
Pierre-Louis Bossart [Wed, 19 Oct 2022 16:21:06 +0000 (11:21 -0500)]
ALSA: hda: ext: hdac_ext_controller: use helpers in loop

No need to copy/paste code, use helper instead.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20221019162115.185917-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
20 months agoASoC: SOF: Intel: pci-tgl: fix ADL-N descriptor
Pierre-Louis Bossart [Wed, 19 Oct 2022 15:49:26 +0000 (10:49 -0500)]
ASoC: SOF: Intel: pci-tgl: fix ADL-N descriptor

ADL-N uses a different signing key, which means we can't reuse the
regular ADL descriptor used for ADL-P/M/S.

Fixes: cd57eb3c403cb ("ASoC: SOF: Intel: pci-tgl: add ADL-N support")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20221019154926.163539-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: soc-dapm.c random cleanups
Mark Brown [Wed, 19 Oct 2022 16:38:59 +0000 (17:38 +0100)]
ASoC: soc-dapm.c random cleanups

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

These are v2 of random cleanup for soc-dpam.c/h.
Basically, these are just cleanup, nothing changed.

20 months agoASoC: qcom: lpass-cpu: Mark HDMI TX parity register as volatile
Srinivasa Rao Mandadapu [Sat, 15 Oct 2022 09:18:50 +0000 (14:48 +0530)]
ASoC: qcom: lpass-cpu: Mark HDMI TX parity register as volatile

Update LPASS_HDMI_TX_PARITY_ADDR register as volatile, to fix
dp audio failures observed with some of external monitors.

Fixes: 7cb37b7bd0d3 ("ASoC: qcom: Add support for lpass hdmi driver")

Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/1665825530-7593-1-git-send-email-quic_srivasam@quicinc.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: amd: yc: Adding Lenovo ThinkBook 14 Gen 4+ ARA and Lenovo ThinkBook 16 Gen...
linkt [Tue, 11 Oct 2022 02:51:36 +0000 (10:51 +0800)]
ASoC: amd: yc: Adding Lenovo ThinkBook 14 Gen 4+ ARA and Lenovo ThinkBook 16 Gen 4+ ARA to the Quirks List

Lenovo ThinkBook 14 Gen 4+ ARA and ThinkBook 16 Gen 4+ ARA
need to be added to the list of quirks for the microphone to work properly.

Signed-off-by: linkt <xazrael@hotmail.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/MEYPR01MB8397A3C27DE6206FA3EF834DB6239@MEYPR01MB8397.ausprd01.prod.outlook.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: jz4752b: Capture fixes
Mark Brown [Wed, 19 Oct 2022 15:37:01 +0000 (16:37 +0100)]
ASoC: jz4752b: Capture fixes

Merge series from Siarhei Volkau <lis8215@gmail.com>:

The patchset fixes:
 - Line In path stays powered off during capturing or
   bypass to mixer.
 - incorrectly represented dB values in alsamixer, et al.
 - incorrect represented Capture input selector in alsamixer
   in Playback tab.
 - wrong control selected as Capture Master

20 months agoASoC: amd: acp: Add setbias level for rt5682s codec in machine driver
Venkata Prasad Potturu [Wed, 21 Sep 2022 09:07:44 +0000 (14:37 +0530)]
ASoC: amd: acp: Add setbias level for rt5682s codec in machine driver

Add set_bais_level function for rt5682s codec to enable bclk and lrclk
before codec widgets power on and disable bclk and lrclk after widgets
power down, to avoid pop noise

Signed-off-by: Venkata Prasad Potturu <venkataprasad.potturu@amd.com>
Link: https://lore.kernel.org/r/20220921090750.3833256-1-venkataprasad.potturu@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: SOF: Intel: Harden the IPC4 low level sequencing
Mark Brown [Wed, 19 Oct 2022 14:13:17 +0000 (15:13 +0100)]
ASoC: SOF: Intel: Harden the IPC4 low level sequencing

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

Hi,

The IPC4 use of doorbell registers leaves some corner cases not well defined
and the 'correct sequences' are subjective in a sense.
The DSP doorbell registers are used as separate and independent channels and
the sequences for host -> DSP -> host (reply) can be racy.

For example:
The ACKing of a received message can happen before the firmware sends the reply
or it can as well happen after the reply has been sent and received by the host.
Both can be considered 'correct sequences' but they need different handling.

This series will allow the kernel to service any interpretation of the
sequencing on the firmware side.

20 months agoASoC: codecs: jz4725b: Fix spelling mistake "Sourc" -> "Source", "Routee" -> "Route"
Colin Ian King [Wed, 19 Oct 2022 07:16:39 +0000 (08:16 +0100)]
ASoC: codecs: jz4725b: Fix spelling mistake "Sourc" -> "Source", "Routee" -> "Route"

There are two spelling mistakes in codec routing description. Fix it.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Acked-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20221019071639.1003730-1-colin.i.king@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: simple-card: Fix up checks for HW param fixups
Aidan MacDonald [Wed, 19 Oct 2022 01:23:02 +0000 (02:23 +0100)]
ASoC: simple-card: Fix up checks for HW param fixups

The "convert-xxx" properties only have an effect for DPCM DAI links.
A DAI link is only created as DPCM if the device tree requires it;
part of this involves checking for the use of "convert-xxx" properties.

When the convert-sample-format property was added, the checks got out
of sync. A DAI link that specified only convert-sample-format but did
not pass any of the other DPCM checks would not go into DPCM mode and
the convert-sample-format property would be silently ignored.

Fix this by adding a function to do the "convert-xxx" property checks,
instead of open-coding it in simple-card and audio-graph-card. And add
"convert-sample-format" to the check function so that DAI links using
it will be initialized correctly.

Fixes: 047a05366f4b ("ASoC: simple-card-utils: Fixup DAI sample format")
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
Acked-by: Sameer Pujar <spujar@nvidia.com>
Link: https://lore.kernel.org/r/20221019012302.633830-1-aidanmacdonald.0x0@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: rt1308-sdw: add the default value of some registers
Shuming Fan [Wed, 19 Oct 2022 09:57:15 +0000 (17:57 +0800)]
ASoC: rt1308-sdw: add the default value of some registers

The driver missed the default value of register 0xc070/0xc360.
This patch adds that default value to avoid invalid register access
when the device doesn't be enumerated yet.
BugLink: https://github.com/thesofproject/linux/issues/3924
Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20221019095715.31082-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: rt1308-sdw: update the preset settings
Shuming Fan [Wed, 19 Oct 2022 09:57:31 +0000 (17:57 +0800)]
ASoC: rt1308-sdw: update the preset settings

This patch updates the pad control and checks the
hardware version to set the different preset settings.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20221019095731.31101-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: soc-dpcm.h: remove snd_soc_dpcm::hw_param
Kuninori Morimoto [Wed, 19 Oct 2022 00:37:26 +0000 (00:37 +0000)]
ASoC: soc-dpcm.h: remove snd_soc_dpcm::hw_param

Current soc-pcm.c is coping fe hw_param to dpcm->hw_param (A),
fixup it (B), and copy it to be (C).

int dpcm_be_dai_hw_params(...)
{
...
for_each_dpcm_be(fe, stream, dpcm) {
...
/* copy params for each dpcm */
(A) memcpy(&dpcm->hw_params, &fe->dpcm[stream].hw_params, ...) ;

/* perform any hw_params fixups */
(B) ret = snd_soc_link_be_hw_params_fixup(be, &dpcm->hw_params);
...

/* copy the fixed-up hw params for BE dai */
(C) memcpy(&be->dpcm[stream].hw_params, &dpcm->hw_params, ...);
...
}
...
}

But here, (1) it is coping hw_params without caring stream (Playback/Capture),
(2) we can get same value from be. We don't need to have dpcm->hw_params.
This patch removes it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/87v8ogsl6h.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: soc-dapm.h: fixup comment for snd_soc_dapm_widget_for_each_path()
Kuninori Morimoto [Wed, 19 Oct 2022 00:37:20 +0000 (00:37 +0000)]
ASoC: soc-dapm.h: fixup comment for snd_soc_dapm_widget_for_each_path()

The comment of snd_soc_dapm_widget_for_each_path() (= X) has
"_sink_" (= s), but this is typo.
With "_sink_" is already exist at (A). This patch fixup it.

/**
(s)  * snd_soc_dapm_widget_for_each_sink_path - ...
 *                              ****
 */
(X) #define snd_soc_dapm_widget_for_each_path(w, dir, p)

/**
(s)  * snd_soc_dapm_widget_for_each_sink_path_safe - ...
 *                              ****
 */
(X) #define snd_soc_dapm_widget_for_each_path_safe(w, dir, p, next_p)

(A) #define snd_soc_dapm_widget_for_each_sink_path(w, p)
                                     ****

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/87wn8wsl6n.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: soc-dapm.h: cleanup white space
Kuninori Morimoto [Wed, 19 Oct 2022 00:37:13 +0000 (00:37 +0000)]
ASoC: soc-dapm.h: cleanup white space

soc-dapm.h defines many things, but it is using
randam white space and tag.
This patch do nothing, but cleanup its white space.
This patch cleanup also 100 char in 1 line.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/87y1tcsl6u.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: soc-dapm.c: numerical order for dapm_up_seq
Kuninori Morimoto [Wed, 19 Oct 2022 00:37:07 +0000 (00:37 +0000)]
ASoC: soc-dapm.c: numerical order for dapm_up_seq

dapm_up_seq is arranged in numerical order, but _dai_link
is out of order. This patch tidyup it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/87zgdssl70.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: soc-dapm.c: cleanup snd_soc_dapm_new_dai()
Kuninori Morimoto [Wed, 19 Oct 2022 00:37:00 +0000 (00:37 +0000)]
ASoC: soc-dapm.c: cleanup snd_soc_dapm_new_dai()

snd_soc_dapm_new_dai() setups local variable "template" at (X) and (Y),
which is used at (Z). But these are difficult to read.

static struct snd_soc_dapm_widget * snd_soc_dapm_new_dai()
{
...

 ^ template.reg = ...
 | template.id = ...
(X) template.name = ...
 | template.event = ...
 | template.event_flags = ...
 v template.kcontrol_news = ...

if (rtd->dai_link->num_params > 1) {
...
 ^ template.num_kcontrols = ...
(Y) template.kcontrol_news = ...
 v ...
}

...
(Z) w = snd_soc_dapm_new_control_unlocked(..., &template);

}

And this function has error message, but not for all cases.
This patch (1) setups "template" in one place, and indicate error message
for all cases. This patch cleanup the code, but nothing changed for
meaning.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/871qr4tzro.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: soc-dapm.c: merge dapm_power_one_widget() and dapm_widget_set_power()
Kuninori Morimoto [Wed, 19 Oct 2022 00:36:51 +0000 (00:36 +0000)]
ASoC: soc-dapm.c: merge dapm_power_one_widget() and dapm_widget_set_power()

dapm_widget_set_power() (= X) is called only from
dapm_power_one_widget() (= Y), and total purpose of these functions are
calling dapm_seq_insert() (= a) accordingly for each widget.

(X) static void dapm_widget_set_power(...)
{
...
if (power)
(a) dapm_seq_insert(w, up_list, true);
else
(a) dapm_seq_insert(w, down_list, false);
}

(Y) static void dapm_power_one_widget(...)
{
..

switch (w->id) {
case snd_soc_dapm_pre:
(a) dapm_seq_insert(w, down_list, false);
break;
case snd_soc_dapm_post:
(a) dapm_seq_insert(w, up_list, true);
break;

default:
power = dapm_widget_power_check(w);

(X) dapm_widget_set_power(w, power, up_list, down_list);
break;
}
}

It should be more simple, but the code is unnecessarily complicated,
and difficult to read/understand. This patch merge these into one.

Link: https://lore.kernel.org/all/87tu42owdd.wl-kuninori.morimoto.gx@renesas.com/
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/8735bktzrx.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: soc-dapm.c: cleanup dapm_widget_set_power()
Kuninori Morimoto [Wed, 19 Oct 2022 00:36:30 +0000 (00:36 +0000)]
ASoC: soc-dapm.c: cleanup dapm_widget_set_power()

This patch cleanup dapm_widget_set_power() comment, parenthesis,
and 100 chars. It has no meaning, nothing will be changed.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/874jw0tzsh.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: soc-dapm.c: ignore parameter NULL at snd_soc_dapm_free_widget()
Kuninori Morimoto [Wed, 19 Oct 2022 00:36:21 +0000 (00:36 +0000)]
ASoC: soc-dapm.c: ignore parameter NULL at snd_soc_dapm_free_widget()

Currently snd_soc_dapm_free_widget() is assuming input parameter is
non NULL. Thus, caller need to care about it.
This patch care it at snd_soc_dapm_free_widget().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/875yggtzsq.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: soc-dapm.c: remove no meaning variable from snd_soc_dapm_add_path()
Kuninori Morimoto [Wed, 19 Oct 2022 00:36:14 +0000 (00:36 +0000)]
ASoC: soc-dapm.c: remove no meaning variable from snd_soc_dapm_add_path()

snd_soc_dapm_add_path() is using local variable "widgets[]", but it is
same as path->node[].
This is no meaning and duplicate operation. This patch removes "widgets[]".

path->node[SND_SOC_DAPM_DIR_IN] = wsource;
path->node[SND_SOC_DAPM_DIR_OUT] = wsink;
widgets[SND_SOC_DAPM_DIR_IN] = wsource;
widgets[SND_SOC_DAPM_DIR_OUT] = wsink;

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/877d0wtzsx.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: soc-dapm.c: tidyup error handling on snd_soc_dapm_add_route()
Kuninori Morimoto [Wed, 19 Oct 2022 00:36:06 +0000 (00:36 +0000)]
ASoC: soc-dapm.c: tidyup error handling on snd_soc_dapm_add_route()

Current error handling on snd_soc_dapm_add_route() has some wastes.
It indicates *own* error message *only* for sink or source,
and return error directly at (A). OTOH, it has similar error message at
(B) which indicates *both* sink/source.

And more, (A) is using dev_err(), (B) is using dev_warn().
(B) is caring prefix, but (A) is not.

(X) int snd_soc_dapm_add_route(...)
{
...
if (wsource == NULL) {
(A) dev_err(...);
return -ENODEV;
}
if (wsink == NULL) {
(A) dev_err(...);
return -ENODEV;
}

...

ret = snd_soc_dapm_add_path(...);
if (ret)
(B) goto err;

return 0;
err:
(B) dev_warn(...);
return ret;
}

Above snd_soc_dapm_add_route() (= X) is called from
snd_soc_dapm_add_routes() (= Y).
(X) will indicate error message by itself, but (Y) will indicate
own error message at (C). (C) is duplicated.

(Y) int snd_soc_dapm_add_routes(...)
{
...
for (...) {
(X) int r = snd_soc_dapm_add_route(...);
if (r < 0) {
(C) dev_err(...);
ret = r;
}
...
}
...
}

This patch (1) merges these error message (= A,B) into one,
(2) use dev_err(), (3) remove duplicate error message (= C) from
snd_soc_dapm_add_routes().

By this patch, it will indicate error message like this.

- error message with prefix
- not found widget will have "(*)" mark
- it indicates [control] if exists.

ex)
[if no sink with control]

ASoC: Failed to add route SOURCE -> [CTRL] -> SINK(*)

[if no source without control]

ASoC: Failed to add route SOURCE(*) -> SINK

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/878rlctzt5.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: soc-dapm.c: replace snd_soc_dapm_wcache to snd_soc_dapm_widget
Kuninori Morimoto [Wed, 19 Oct 2022 00:35:57 +0000 (00:35 +0000)]
ASoC: soc-dapm.c: replace snd_soc_dapm_wcache to snd_soc_dapm_widget

Current ASoC has snd_soc_dapm_wcache, but its member is only
snd_soc_dapm_widget.

struct snd_soc_dapm_wcache {
struct snd_soc_dapm_widget *widget;
};

It is no meaning for now, and makes code unreadable.
This patch replace snd_soc_dapm_wcache to snd_soc_dapm_widget directly.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/87a65stztf.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
20 months agoASoC: meson: axg-pdm: Fix double word in comments
Shaomin Deng [Mon, 17 Oct 2022 14:18:12 +0000 (10:18 -0400)]
ASoC: meson: axg-pdm: Fix double word in comments

Delete the doubled word "for" in comments.

Signed-off-by: Shaomin Deng <dengshaomin@cdjrlc.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20221017141812.6867-1-dengshaomin@cdjrlc.com
Signed-off-by: Mark Brown <broonie@kernel.org>