linux-2.6-block.git
5 months agoASoC: nau8821: Remove redundant ADC controls
Seven Lee [Mon, 15 Apr 2024 07:06:49 +0000 (15:06 +0800)]
ASoC: nau8821: Remove redundant ADC controls

Remove redundant left/right adc channel enable controls.

Signed-off-by: Seven Lee <wtli@nuvoton.com>
Link: https://lore.kernel.org/r/20240415070649.3496487-4-wtli@nuvoton.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: nau8821: Add delay control for ADC
Seven Lee [Mon, 15 Apr 2024 07:06:48 +0000 (15:06 +0800)]
ASoC: nau8821: Add delay control for ADC

Change the original fixed delay to the assignment from the property.
It will make it more flexible to different platforms to avoid pop
noise at the beginning of recording.

Signed-off-by: Seven Lee <wtli@nuvoton.com>
Link: https://lore.kernel.org/r/20240415070649.3496487-3-wtli@nuvoton.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: dt-bindings: nau8821: Add delay control for ADC
Seven Lee [Mon, 15 Apr 2024 07:06:47 +0000 (15:06 +0800)]
ASoC: dt-bindings: nau8821: Add delay control for ADC

Change the original fixed delay to the assignment from the property. It
will make it more flexible to different platforms to avoid pop noise at
the beginning of recording.

Signed-off-by: Seven Lee <wtli@nuvoton.com>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://lore.kernel.org/r/20240415070649.3496487-2-wtli@nuvoton.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: Intel: avs: Refactor IRQ handling
Mark Brown [Sat, 20 Apr 2024 01:05:16 +0000 (10:05 +0900)]
ASoC: Intel: avs: Refactor IRQ handling

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

The existing code can be both improved and simplified. To make this
change easier to manage, first add new implementation and then remove
deadcode in a separate patch.

Simplification achieved with:

- reduce the amount of resources requested by the driver i.e.: IPC and
  CLDMA request_irq() merged into one
- reduce the number of DSP ops from 2 to 1:
  irq_handler/thread() vs dsp_interrupt()
- drop ambiguity around CLDMA interrupt, let skl.c handle that
  explicitly as it is the only user

With that done, switch to the new implementation and remove unused
members. While the change is non-trivial, from functional perspective
status quo is achieved.

5 months agoASoC: Intel: avs: Remove unused IRQ-related code
Cezary Rojewski [Fri, 19 Apr 2024 08:48:57 +0000 (10:48 +0200)]
ASoC: Intel: avs: Remove unused IRQ-related code

Most IRQ-related code is duplicated in the driver. Switch to the new
implementation and remove unused members.

While the change is non-trivial, from functional perspective status quo
is achieved.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20240419084857.2719593-3-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: Intel: avs: New IRQ handling implementation
Cezary Rojewski [Fri, 19 Apr 2024 08:48:56 +0000 (10:48 +0200)]
ASoC: Intel: avs: New IRQ handling implementation

The existing code can be both improved and simplified. To make this
change easier to manage, first add new implementation and then remove
deadcode in a separate patch.

Simplification achieved with:
- reduce the amount of resources requested by the driver i.e.: IPC and
  CLDMA request_irq() merged into one
- reduce the number of DSP ops from 2 to 1:
  irq_handler/thread() vs dsp_interrupt()
- drop ambiguity around CLDMA interrupt, let skl.c handle that
  explicitly as it is the only user

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20240419084857.2719593-2-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: dt-bindings: tegra20-das: Convert to schema
Mohammad Shehar Yaar Tausif [Thu, 18 Apr 2024 16:33:24 +0000 (22:03 +0530)]
ASoC: dt-bindings: tegra20-das: Convert to schema

Convert NVIDIA Tegra20 DAS (Digital Audio Switch) binding to schema.

Signed-off-by: Mohammad Shehar Yaar Tausif <sheharyaar48@gmail.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20240418163326.58365-1-sheharyaar48@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: sunxi: sun4i-i2s: Fix pcm_formats type specification
John Watts [Wed, 17 Apr 2024 05:14:43 +0000 (15:14 +1000)]
ASoC: sunxi: sun4i-i2s: Fix pcm_formats type specification

pcm_formats should be a u64 as it is a SNDRV_PCM_FMTBIT_* not a
SNDRV_PCM_FORMAT_*.

Also fix a small grammar error while we're here.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202404170103.ySYwieqi-lkp@intel.com/
Signed-off-by: John Watts <contact@jookia.org>
Link: https://lore.kernel.org/r/20240417-sunxi_s32_fix-v1-1-d82e451565c0@jookia.org
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: dt-bindings: fsl-esai: Add ref: dai-common.yaml
Frank Li [Tue, 16 Apr 2024 14:47:48 +0000 (10:47 -0400)]
ASoC: dt-bindings: fsl-esai: Add ref: dai-common.yaml

Add ref: dai-common.yaml to fix below warning.
arch/arm/boot/dts/nxp/imx/imx6q-sabreauto.dtb: esai@2024000: Unevaluated properties are not allowed ('#sound-dai-cells' was unexpected)

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Frank Li <Frank.Li@nxp.com>
Link: https://lore.kernel.org/r/20240416-esai_arm_dts_warning-v2-2-879e59c0c3b8@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: dt-bindings: fsl-esai: Remove 'fsl,*' from required list
Frank Li [Tue, 16 Apr 2024 14:47:47 +0000 (10:47 -0400)]
ASoC: dt-bindings: fsl-esai: Remove 'fsl,*' from required list

fsl,fifo-depth have default value 64 in driver(sound/soc/fsl/fsl_esai.c).

fsl,esai-synchronous is flag(bool) type. It doesn't make sense to put flag
type into 'required'.

Fix warning:

arch/arm/boot/dts/nxp/imx/imx6q-sabreauto.dtb: esai@2024000: 'fsl,fifo-depth' is a required property
arch/arm/boot/dts/nxp/imx/imx6q-sabreauto.dtb: esai@2024000: 'fsl,esai-synchronous' is a required property

Signed-off-by: Frank Li <Frank.Li@nxp.com>
Link: https://lore.kernel.org/r/20240416-esai_arm_dts_warning-v2-1-879e59c0c3b8@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: Cleanup MediaTek soundcard machine drivers
Mark Brown [Wed, 17 Apr 2024 00:12:11 +0000 (09:12 +0900)]
ASoC: Cleanup MediaTek soundcard machine drivers

Merge series from AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>:

Changes in v5:
 - Cleaned up MT8186 soundcard migration commit which erroneously
   had leftovers from development
 - Changed the mtk_pcm_constraints_data structure to hold pointers
   to snd_pcm_hw_constraint_list, as to really reuse the const data
 - Tested again on all of the listed MTK platforms.

Changes in v4:
 - Rebased over next-20240409
 - Dropped the first 4 patches from v3 as were already picked by Mark
 - Fixed W=1 build issue

Changes in v3:
 - Added audio-routing names in enum in all yaml files
 - Added mention of disallowing old and new properties together in
   commit message of bindings patches
 - Fixed validation errors with sound-card-common.yaml inclusion
   due to missing model property in examples
 - Removed `else` enforcing headset-codec/speaker-codecs requirement
   if xxx-dai-link not present to avoid future commit noise as the
   deprecated statement will disallow deprecated properties as required

Changes in v2:
 - Bindings: Changed link-name/codec/clk-provider to remove `items`
   and leave just the enum
 - Moved .*-dai-link pattern additionalProperties after `type: object`
 - Added ref to sound-card-common.yaml
 - Fixed dai-link-xxx -> xxx-dai-link typo in example comment

This series performs a cleanup of most of the MediaTek AFE drivers and
soundcard machine drivers, reducing code duplication and setting a base
to be consistent with their devicetree bindings, as many of those are
using different properties and nodes for no good reason.

Summarizing:
 - Commonizes functions and ops where possible
 - Adds a common probe mechanism, increasing maintainability of
   soundcard drivers for older MediaTek SoCs
 - Migrates all drivers to support the new bindings
   - Obviously retains compatibility with old device trees
 - Reduces machine-specific parameters hardcoding in drivers
   - Can now set machine-specific params in device tree
   - Uses the `audio-routing` and `dai-link` nodes like some
     other non-MediaTek SoC sound drivers
 - Imposes consistency between MediaTek ASoC machine soundcard
   drivers bindings
 - Reduces code size and greatly reduces the amount of code that
   will be required for newer drivers (retaining compatibility with
   the old bindings was costly in terms of code size, otherwise
   this series would've removed ~1000 more lines, or something
   along that line).

This series was (manually) tested on MT8173, MT8192, MT8195 and MT8186
Chromebooks.

AngeloGioacchino Del Regno (18):
  ASoC: mediatek: Add common machine soundcard driver probe mechanism
  ASoC: mediatek: common: Constify struct mtk_sof_priv
  ASoC: mediatek: mt8188: Migrate to mtk_soundcard_common_probe
  ASoC: mediatek: mt8195: Migrate to mtk_soundcard_common_probe
  ASoC: mediatek: mt8192: Migrate to mtk_soundcard_common_probe
  ASoC: mediatek: mt8186: Migrate to mtk_soundcard_common_probe
  ASoC: mediatek: Add common snd_soc_ops .startup() callback
  ASoC: mediatek: mt8195: Migrate to the common mtk_soundcard_startup
  ASoC: mediatek: mt8192: Migrate to the common mtk_soundcard_startup
  ASoC: mediatek: mt8186-rt1019: Migrate to the common
    mtk_soundcard_startup
  ASoC: mediatek: Add common mtk_afe_component_probe callback
  ASoC: mediatek: Use common mtk_afe_pcm_platform with common probe cb
  ASoC: mediatek: mt8186: Unify mt8186-mt6366 machine drivers
  ASoC: dt-bindings: mt8195: Document audio-routing and dai-link subnode
  ASoC: dt-bindings: mt8192: Document audio-routing and dai-link subnode
  ASoC: dt-bindings: mt8186: Document audio-routing and dai-link subnode
  arm64: dts: mediatek: mt8195-cherry: Specify sound DAI links and
    routing
  arm64: dts: mediatek: mt8186-corsola: Specify sound DAI links and
    routing

 .../sound/mt8186-mt6366-da7219-max98357.yaml  |  131 +-
 .../sound/mt8186-mt6366-rt1019-rt5682s.yaml   |  120 +-
 .../sound/mt8192-mt6359-rt1015-rt5682.yaml    |  139 +-
 .../bindings/sound/mt8195-mt6359.yaml         |  134 ++
 .../boot/dts/mediatek/mt8186-corsola.dtsi     |   42 +-
 .../boot/dts/mediatek/mt8195-cherry.dtsi      |   45 +
 sound/soc/mediatek/Kconfig                    |   24 +-
 .../mediatek/common/mtk-afe-platform-driver.c |   18 +
 .../soc/mediatek/common/mtk-dsp-sof-common.c  |   15 +-
 .../soc/mediatek/common/mtk-dsp-sof-common.h  |    1 -
 sound/soc/mediatek/common/mtk-soc-card.h      |    7 +-
 .../mediatek/common/mtk-soundcard-driver.c    |  199 +++
 .../mediatek/common/mtk-soundcard-driver.h    |   42 +
 sound/soc/mediatek/mt6797/mt6797-afe-pcm.c    |   14 +-
 sound/soc/mediatek/mt7986/mt7986-afe-pcm.c    |   14 +-
 sound/soc/mediatek/mt8183/mt8183-afe-pcm.c    |   14 +-
 sound/soc/mediatek/mt8186/Makefile            |    3 +-
 .../mt8186/mt8186-mt6366-da7219-max98357.c    | 1189 -----------------
 ...t6366-rt1019-rt5682s.c => mt8186-mt6366.c} |  578 ++++----
 sound/soc/mediatek/mt8188/mt8188-afe-pcm.c    |   21 +-
 sound/soc/mediatek/mt8188/mt8188-mt6359.c     |  203 +--
 sound/soc/mediatek/mt8192/mt8192-afe-pcm.c    |   25 +-
 .../mt8192/mt8192-mt6359-rt1015-rt5682.c      |  301 ++---
 sound/soc/mediatek/mt8195/mt8195-afe-pcm.c    |   21 +-
 sound/soc/mediatek/mt8195/mt8195-mt6359.c     |  487 +++----
 25 files changed, 1597 insertions(+), 2190 deletions(-)
 delete mode 100644 sound/soc/mediatek/mt8186/mt8186-mt6366-da7219-max98357.c
 rename sound/soc/mediatek/mt8186/{mt8186-mt6366-rt1019-rt5682s.c => mt8186-mt6366.c} (72%)

--
2.44.0

5 months agoASoC: tracing: Export SND_SOC_DAPM_DIR_OUT to its value
Steven Rostedt [Tue, 16 Apr 2024 04:03:03 +0000 (00:03 -0400)]
ASoC: tracing: Export SND_SOC_DAPM_DIR_OUT to its value

The string SND_SOC_DAPM_DIR_OUT is printed in the snd_soc_dapm_path trace
event instead of its value:

   (((REC->path_dir) == SND_SOC_DAPM_DIR_OUT) ? "->" : "<-")

User space cannot parse this, as it has no idea what SND_SOC_DAPM_DIR_OUT
is. Use TRACE_DEFINE_ENUM() to convert it to its value:

   (((REC->path_dir) == 1) ? "->" : "<-")

So that user space tools, such as perf and trace-cmd, can parse it
correctly.

Reported-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Fixes: 6e588a0d839b5 ("ASoC: dapm: Consolidate path trace events")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Link: https://lore.kernel.org/r/20240416000303.04670cdf@rorschach.local.home
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: dt-bindings: mt8186: Document audio-routing and dai-link subnode
AngeloGioacchino Del Regno [Tue, 16 Apr 2024 07:14:08 +0000 (09:14 +0200)]
ASoC: dt-bindings: mt8186: Document audio-routing and dai-link subnode

Document the dai-link subnodes and the audio-routing property, allowing
to describe machine specific audio hardware and links in device tree.

While at it, also deprecate the old properties which were previously
used with the driver's partially hardcoded configuration.

Also, since describing machine specific audio hardware and links replaces
the now deprecated old logic doing the same in a driver hardcoded fashion,
it is not allowed to have both the old and new properties together.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20240416071410.75620-17-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: dt-bindings: mt8192: Document audio-routing and dai-link subnode
AngeloGioacchino Del Regno [Tue, 16 Apr 2024 07:14:07 +0000 (09:14 +0200)]
ASoC: dt-bindings: mt8192: Document audio-routing and dai-link subnode

Document the dai-link subnodes and the audio-routing property, allowing
to describe machine specific audio hardware and links in device tree.

While at it, also deprecate the old properties which were previously
used with the driver's partially hardcoded configuration.

Also, since describing machine specific audio hardware and links replaces
the now deprecated old logic doing the same in a driver hardcoded fashion,
it is not allowed to have both the old and new properties together.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20240416071410.75620-16-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: dt-bindings: mt8195: Document audio-routing and dai-link subnode
AngeloGioacchino Del Regno [Tue, 16 Apr 2024 07:14:06 +0000 (09:14 +0200)]
ASoC: dt-bindings: mt8195: Document audio-routing and dai-link subnode

Document the dai-link subnodes and the audio-routing property, allowing
to describe machine specific audio hardware and links in device tree.

While at it, also deprecate the old properties which were previously
used with driver hardcoded configuration.

Also, since describing machine specific audio hardware and links replaces
the now deprecated old logic doing the same in a driver hardcoded fashion,
it is not allowed to have both the old and new properties together.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20240416071410.75620-15-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: mediatek: mt8186: Unify mt8186-mt6366 machine drivers
AngeloGioacchino Del Regno [Tue, 16 Apr 2024 07:14:05 +0000 (09:14 +0200)]
ASoC: mediatek: mt8186: Unify mt8186-mt6366 machine drivers

Copy the few differences from mt8186-mt6166-da7219-max98357 in the
mt8186-mt6366-rt1019-rt5682s driver to greatly reduce code duplication;
since now the driver is meant to support MT8186 with the MT6366 PMIC
codec and various combinations of I2S codecs, rename the driver to
mt8186-mt6366 for consistency with MT8195 and MT8188, and rename
the configuration option to SND_SOC_MT8186_MT6366.

Since right now there is no machine using the da7219-max98357 yet, the
snd_soc_dapm_route array was omitted as it's now possible to specify
the audio routing in device trees instead.

While at it, also add the missing sentinel comment to the last entry
of the of_device_id array.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20240416071410.75620-14-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: mediatek: Use common mtk_afe_pcm_platform with common probe cb
AngeloGioacchino Del Regno [Tue, 16 Apr 2024 07:14:04 +0000 (09:14 +0200)]
ASoC: mediatek: Use common mtk_afe_pcm_platform with common probe cb

Since the mtk-afe-platform-driver generic mtk_afe_pcm_platform now has
a common .probe() callback, there is no reason to keep duplicating this
function over and over in the SoC specific AFE-PCM drivers: switch over
to register with the common bits instead.

Note that MT8186 was left out of this because it is registering some
extra sinegen controls in the AFE-PCM probe callback and needs extra
cleanups to be able to use the common bits.

Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20240416071410.75620-13-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: mediatek: Add common mtk_afe_component_probe callback
AngeloGioacchino Del Regno [Tue, 16 Apr 2024 07:14:03 +0000 (09:14 +0200)]
ASoC: mediatek: Add common mtk_afe_component_probe callback

Multiple MediaTek AFE PCM component drivers are using their own .probe()
callback, but most of those are simply duplicated functions as they are
doing exactly the same thing over and over.

Add a common probe callback for this component to reduce duplication.

Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20240416071410.75620-12-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: mediatek: mt8186-rt1019: Migrate to the common mtk_soundcard_startup
AngeloGioacchino Del Regno [Tue, 16 Apr 2024 07:14:02 +0000 (09:14 +0200)]
ASoC: mediatek: mt8186-rt1019: Migrate to the common mtk_soundcard_startup

Add a const mtk_pcm_constraints_data struct array with all of the
(again, constant) constraints for all of the supported usecases,
remove the duplicated functions and call mtk_soundcard_startup()
instead in all of the .startup() callbacks.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20240416071410.75620-11-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: mediatek: mt8192: Migrate to the common mtk_soundcard_startup
AngeloGioacchino Del Regno [Tue, 16 Apr 2024 07:14:01 +0000 (09:14 +0200)]
ASoC: mediatek: mt8192: Migrate to the common mtk_soundcard_startup

Add a const mtk_pcm_constraints_data struct array with all of the
(again, constant) constraints for all of the supported usecases,
remove the duplicated functions and call mtk_soundcard_startup()
instead in all of the .startup() callbacks.

Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20240416071410.75620-10-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: mediatek: mt8195: Migrate to the common mtk_soundcard_startup
AngeloGioacchino Del Regno [Tue, 16 Apr 2024 07:14:00 +0000 (09:14 +0200)]
ASoC: mediatek: mt8195: Migrate to the common mtk_soundcard_startup

Add a const mtk_pcm_constraints_data struct array with all of the
(again, constant) constraints for all of the supported usecases,
remove the duplicated functions and call mtk_soundcard_startup()
instead in all of the .startup() callbacks.

Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20240416071410.75620-9-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: mediatek: Add common snd_soc_ops .startup() callback
AngeloGioacchino Del Regno [Tue, 16 Apr 2024 07:13:59 +0000 (09:13 +0200)]
ASoC: mediatek: Add common snd_soc_ops .startup() callback

MediaTek platforms are typically setting PCM rate and channels
constraints for playback, capture and HDMI/DisplayPort playback:
commonize the startup callback by adding the PCM constraints data
to the mtk_platform_card_data structure and by reusing the common
mtk_soundcard_startup() function for all of them by getting back
the parameters from the aforementioned struct.

Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20240416071410.75620-8-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: mediatek: mt8186: Migrate to mtk_soundcard_common_probe
AngeloGioacchino Del Regno [Tue, 16 Apr 2024 07:13:58 +0000 (09:13 +0200)]
ASoC: mediatek: mt8186: Migrate to mtk_soundcard_common_probe

Add mtk_soundcard_pdata platform data for the MediaTek common sound card
probe mechanism, including a driver/soc-specific probe extension (used
for bits that cannot be commonized  hence specific to this driver), and
change the probe function to mtk_soundcard_common_probe.

This is also adding the possibility of specifying the links and routing
with the audio-routing property and (x)-dai-link nodes in device trees
to stop hardcoding machine specific links in the card driver assupported
by the common probe function, but support for legacy device trees is
retained with a legacy_probe function, which is used only in case the
new properties are not found.

Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20240416071410.75620-7-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: mediatek: mt8192: Migrate to mtk_soundcard_common_probe
AngeloGioacchino Del Regno [Tue, 16 Apr 2024 07:13:57 +0000 (09:13 +0200)]
ASoC: mediatek: mt8192: Migrate to mtk_soundcard_common_probe

Add mtk_soundcard_pdata platform data for the MediaTek common sound card
probe mechanism, including a driver/soc-specific probe extension (used
for bits that cannot be commonized  hence specific to this driver), and
change the probe function to mtk_soundcard_common_probe.

This is also adding the possibility of specifying the links and routing
with the audio-routing property and (x)-dai-link nodes in device trees
to stop hardcoding machine specific links in the card driver assupported
by the common probe function, but support for legacy device trees is
retained with a legacy_probe function, which is used only in case the
new properties are not found.

Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20240416071410.75620-6-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: mediatek: mt8195: Migrate to mtk_soundcard_common_probe
AngeloGioacchino Del Regno [Tue, 16 Apr 2024 07:13:56 +0000 (09:13 +0200)]
ASoC: mediatek: mt8195: Migrate to mtk_soundcard_common_probe

Add mtk_soundcard_pdata platform data for the MediaTek common sound card
probe mechanism, including a driver/soc-specific probe extension (used
for bits that cannot be commonized  hence specific to this driver), and
change the probe function to mtk_soundcard_common_probe.

This is also adding the possibility of specifying the links and routing
with the audio-routing property and (x)-dai-link nodes in device trees
to stop hardcoding machine specific links in the card driver assupported
by the common probe function, but support for legacy device trees is
retained with a legacy_probe function, which is used only in case the
new properties are not found.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20240416071410.75620-5-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: mediatek: mt8188: Migrate to mtk_soundcard_common_probe
AngeloGioacchino Del Regno [Tue, 16 Apr 2024 07:13:55 +0000 (09:13 +0200)]
ASoC: mediatek: mt8188: Migrate to mtk_soundcard_common_probe

Add mtk_soundcard_pdata platform data for the MediaTek common sound card
probe mechanism, including a driver/soc-specific probe extension (used
for bits that cannot be commonized  hence specific to this driver), and
change the probe function to mtk_soundcard_common_probe.

Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20240416071410.75620-4-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: mediatek: common: Constify struct mtk_sof_priv
AngeloGioacchino Del Regno [Tue, 16 Apr 2024 07:13:54 +0000 (09:13 +0200)]
ASoC: mediatek: common: Constify struct mtk_sof_priv

Apart from a dai_link_list variable, the mtk_sof_priv currently holds
data that never gets modified during runtime.

Constify the mtk_sof_priv structure and move the SOF dai_link_list as
sof_dai_link_list in struct mtk_soc_card_data, which is a structure
that already holds the card's machine specific, runtime modified data.

This allows to safely pass the mtk_sof_priv structure as platform data
for the commonized card probe mechanism.

Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20240416071410.75620-3-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: mediatek: Add common machine soundcard driver probe mechanism
AngeloGioacchino Del Regno [Tue, 16 Apr 2024 07:13:53 +0000 (09:13 +0200)]
ASoC: mediatek: Add common machine soundcard driver probe mechanism

Add a common machine soundcard driver probe function that supports both
DSP and AFE-direct usecases and also provides a hook for legacy machine
soundcard driver probe mechanisms.

Note that the hook is there because, even for legacy probe, a lot of the
actual code can still be commonized, hence still reducing duplication
for the legacy devicetree retrocompatibility cases.

This common probe function deprecates all of the inconsistent previous
probe mechanisms and aims to settle all of the MediaTek card drivers on
consistent and common devicetree properties describing wanted DAIs,
device specific DAI configuration and DAI links to codecs found on
each device/board.

Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20240416071410.75620-2-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: dt-bindings: fsl-asoc-card: Add compatbile string for wm8904 codec
Shengjiu Wang [Mon, 15 Apr 2024 07:17:36 +0000 (15:17 +0800)]
ASoC: dt-bindings: fsl-asoc-card: Add compatbile string for wm8904 codec

The wm8904 codec is used on an i.MX95 Toradex board.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1713165456-3494-3-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: fsl-asoc-card: add wm8904 codec support
Shengjiu Wang [Mon, 15 Apr 2024 07:17:35 +0000 (15:17 +0800)]
ASoC: fsl-asoc-card: add wm8904 codec support

wm8904 codec is used on i.MX95 Toradex board

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1713165456-3494-2-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: sunxi: sun4i-i2s: Support 32-bit audio formats
John Watts [Wed, 3 Apr 2024 03:47:35 +0000 (14:47 +1100)]
ASoC: sunxi: sun4i-i2s: Support 32-bit audio formats

The I2S cores used in the H3 onwards support 32-bit sample rates.
Support these by adding a per-variant PCM format list.

Signed-off-by: John Watts <contact@jookia.org>
Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Link: https://lore.kernel.org/r/20240403-sunxi_s32-v2-1-29ebf6ad590a@jookia.org
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: amd: acp-da7219-max98357a: Constify regulator_ops
Krzysztof Kozlowski [Sun, 14 Apr 2024 16:47:03 +0000 (18:47 +0200)]
ASoC: amd: acp-da7219-max98357a: Constify regulator_ops

Neither core nor the driver modifes 'struct regulator_ops', so it can be
const for code safety.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20240414164703.239851-1-krzk@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: samsung: i2s: Drop unneeded MODULE_ALIAS
Krzysztof Kozlowski [Sun, 14 Apr 2024 15:48:39 +0000 (17:48 +0200)]
ASoC: samsung: i2s: Drop unneeded MODULE_ALIAS

The ID table already has respective entry and MODULE_DEVICE_TABLE and
creates proper alias for platform driver.  Having another MODULE_ALIAS
causes the alias to be duplicated.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20240414154839.126852-2-krzk@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: wcd934x: Drop unneeded MODULE_ALIAS
Krzysztof Kozlowski [Sun, 14 Apr 2024 15:48:38 +0000 (17:48 +0200)]
ASoC: wcd934x: Drop unneeded MODULE_ALIAS

The ID table already has respective entry and MODULE_DEVICE_TABLE and
creates proper alias for platform driver.  Having another MODULE_ALIAS
causes the alias to be duplicated.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20240414154839.126852-1-krzk@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: amd: Support microphone from Acer Aspire A315-24P
end.to.start [Fri, 12 Apr 2024 07:55:33 +0000 (10:55 +0300)]
ASoC: amd: Support microphone from Acer Aspire A315-24P

Add support microphone from Acer Aspire A315-24P and for some other similar devices with such vendor

Signed-off-by: "end.to.start" <end.to.start@mail.ru>
Link: https://lore.kernel.org/r/20240412075533.10214-1-end.to.start@mail.ru
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: Intel: updates for 6.10 - part4
Mark Brown [Mon, 15 Apr 2024 01:14:58 +0000 (10:14 +0900)]
ASoC: Intel: updates for 6.10 - part4

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

More cleanups from Brent, notably the removal of the redundant
cml_rt1011_rt5682 machine driver, fixes for SoundWire platforms and
changes to sof_rt5682 to allow for 96+ sampling rates.

For the rest of this kernel cycle, we are still working on SoundWire
updates for MeteorLake (usual missing ACPI signature required for
topology selection and jack detection information). We'll provide
those patches as soon as they are reviewed/validated.

5 months agoASoC: dt-bindings: renesas,rsnd: add missing renesas,rcar_sound-gen4
Kuninori Morimoto [Fri, 12 Apr 2024 05:45:43 +0000 (05:45 +0000)]
ASoC: dt-bindings: renesas,rsnd: add missing renesas,rcar_sound-gen4

It is missing generic compatible for R-Car Gen4

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/8734rrcewo.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: dt-bindings: renesas: add R8A779H0 V4M
Kuninori Morimoto [Fri, 12 Apr 2024 05:46:03 +0000 (05:46 +0000)]
ASoC: dt-bindings: renesas: add R8A779H0 V4M

Add document for R-Car V4M (R8A779H0).

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/871q7bcew5.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: soc-card: soc-card-test: Fix some error handling in init()
Dan Carpenter [Fri, 12 Apr 2024 12:07:01 +0000 (15:07 +0300)]
ASoC: soc-card: soc-card-test: Fix some error handling in init()

There are two issues here:
1) The get_device() needs a matching put_device() on error paths.
2) The "if (!ret)" was supposed to be "if (ret)".

I re-arranged the code a bit to do the allocation before the
get_device().

Fixes: ef7784e41db7 ("ASoC: soc-card: Add KUnit test case for snd_soc_card_get_kcontrol")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/450dd21a-b24b-48ba-9aa4-c02e4617852f@moroto.mountain
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: dt-bindings: fsl-asoc-card: Document fsl,imx25-pdk-sgtl5000
Fabio Estevam [Fri, 12 Apr 2024 12:14:10 +0000 (09:14 -0300)]
ASoC: dt-bindings: fsl-asoc-card: Document fsl,imx25-pdk-sgtl5000

Document fsl,imx25-pdk-sgtl5000 to fix the following dt-schema warning:

imx25-pdk.dtb: sound: compatible: 'oneOf' conditional failed, one must be fixed:
['fsl,imx25-pdk-sgtl5000', 'fsl,imx-audio-sgtl5000'] is too long

Fixes: 4189b54220e5 ("ASoC: dt-bindings: fsl-asoc-card: convert to YAML")
Signed-off-by: Fabio Estevam <festevam@denx.de>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20240412121410.2948048-1-festevam@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: Intel: sof_rt5682: use RT5682S_PLL1 if needed
Bard Liao [Thu, 11 Apr 2024 22:03:47 +0000 (17:03 -0500)]
ASoC: Intel: sof_rt5682: use RT5682S_PLL1 if needed

When 96KHz sample rate is used, and MCLK is 24.576MHz, we will need
pll_in = 24576000 and pll_out = 49152000 which is not supported by
RT5682S_PLL2. Use RT5682S_PLL1 in this case.
We don't test sample rate because RT5682S_PLL2 doesn't support 24.576MHz
input and in the MCLK = 24.576MHz, sample rate = 48KHz case, i.e.
pll_in == pll_out, PLL will not be used at all.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240411220347.131267-13-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: Intel: cml_rt1011_rt5682: delete driver
Brent Lu [Thu, 11 Apr 2024 22:03:46 +0000 (17:03 -0500)]
ASoC: Intel: cml_rt1011_rt5682: delete driver

Delete this driver and use sof_rt5682 machine driver instead.

Reviewed-by: Chao Song <chao.song@linux.intel.com>
Signed-off-by: Brent Lu <brent.lu@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240411220347.131267-12-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: Intel: sof_rt5682: support ALC1011 on cml boards
Brent Lu [Thu, 11 Apr 2024 22:03:45 +0000 (17:03 -0500)]
ASoC: Intel: sof_rt5682: support ALC1011 on cml boards

For cml boards, ALC1011 speaker amplifier is supported by machine
driver cml_rt1011_rt5682. Use same driver name for backward
compatibility with existing devices on market.

Reviewed-by: Chao Song <chao.song@linux.intel.com>
Signed-off-by: Brent Lu <brent.lu@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240411220347.131267-11-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: Intel: sof_realtek_common: support 4xALC1011 amplifier
Brent Lu [Thu, 11 Apr 2024 22:03:44 +0000 (17:03 -0500)]
ASoC: Intel: sof_realtek_common: support 4xALC1011 amplifier

Add support for boards with four ALC1011 amplifiers. Configuration is
copied from cml_rt1011_rt5682 machine driver for backward
compatibility with existing cml devices.

Reviewed-by: Chao Song <chao.song@linux.intel.com>
Signed-off-by: Brent Lu <brent.lu@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240411220347.131267-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: Intel: sof_da7219: add mtl_da7219_def for mtl boards
Brent Lu [Thu, 11 Apr 2024 22:03:43 +0000 (17:03 -0500)]
ASoC: Intel: sof_da7219: add mtl_da7219_def for mtl boards

Add the board config mtl_da7219_def to da7219 machine driver for all
mtl boards using default SSP port allocation (headphone codec on SSP2,
speaker amplifiers on SSP0, and BT offload on SSP1).

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Brent Lu <brent.lu@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240411220347.131267-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: Intel: sof_da7219: mach cleanup for rpl boards
Brent Lu [Thu, 11 Apr 2024 22:03:42 +0000 (17:03 -0500)]
ASoC: Intel: sof_da7219: mach cleanup for rpl boards

Add a common entry in enumeration table for all da7219 boards
with/without speaker amplifier. All other rpl_da7219_def entries
become redundant so get removed.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Brent Lu <brent.lu@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240411220347.131267-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: Intel: sof_da7219: mach cleanup for adl boards
Brent Lu [Thu, 11 Apr 2024 22:03:41 +0000 (17:03 -0500)]
ASoC: Intel: sof_da7219: mach cleanup for adl boards

Add a common entry in enumeration table for all da7219 boards
with/without speaker amplifier. All other adl_da7219_def entries
become redundant so get removed.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Brent Lu <brent.lu@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240411220347.131267-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: Intel: sof_sdw: remove FOUR_SPEAKER quirks
Pierre-Louis Bossart [Thu, 11 Apr 2024 22:03:40 +0000 (17:03 -0500)]
ASoC: Intel: sof_sdw: remove FOUR_SPEAKER quirks

This patch removes a confusion between speakers and amplifiers.

The existing code keeps track of the number of amplifiers and reports
it in the 'cfg-amp' component string.

The number of speakers is defined with quirks, but those quirks are
not consistently added: in the MeteorLake case, none of the supported
platforms used such a quirk, and UCM does not use the values reported
anyways. The notion of 'FOUR_SPEAKERS' is also obsolete now with some
platforms having more than four speakers.

Let's just remove all this and only report the number of amplifiers.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20240411220347.131267-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: Intel: sof_sdw: add quirk for Dell SKU 0C0F
Pierre-Louis Bossart [Thu, 11 Apr 2024 22:03:39 +0000 (17:03 -0500)]
ASoC: Intel: sof_sdw: add quirk for Dell SKU 0C0F

The JD1 jack detection doesn't seem to work, use JD2.
Also use the 4 speaker configuration.

Link: https://github.com/thesofproject/linux/issues/4900
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20240411220347.131267-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: Intel: sof_sdw: add JD2 quirk for HP Omen 14
Pierre-Louis Bossart [Thu, 11 Apr 2024 22:03:38 +0000 (17:03 -0500)]
ASoC: Intel: sof_sdw: add JD2 quirk for HP Omen 14

The default JD1 does not seem to work, use JD2 instead.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240411220347.131267-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: Intel: soc-acpi: add support for HP Omen14 SoundWire configuration
Pierre-Louis Bossart [Thu, 11 Apr 2024 22:03:37 +0000 (17:03 -0500)]
ASoC: Intel: soc-acpi: add support for HP Omen14 SoundWire configuration

This platform has an RT711-sdca on link0 and RT1316 on link3

Closes: https://github.com/thesofproject/linux/issues/4880
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240411220347.131267-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: Intel: sof_sdw: add missing sof_sdw_rt_amp_init for Realtek multi-function...
Bard Liao [Thu, 11 Apr 2024 22:03:36 +0000 (17:03 -0500)]
ASoC: Intel: sof_sdw: add missing sof_sdw_rt_amp_init for Realtek multi-function codecs

We do need "info->amp_num++;" for the speaker dai.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240411220347.131267-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: dt-bindings: imx-audio-spdif: convert to YAML
Shengjiu Wang [Thu, 11 Apr 2024 10:11:44 +0000 (18:11 +0800)]
ASoC: dt-bindings: imx-audio-spdif: convert to YAML

Convert the imx-audio-spdif binding to YAML.

When testing dtbs_check, found below compatible strings
are not listed in document:

fsl,imx-sabreauto-spdif
fsl,imx6sx-sdb-spdif

So add them in yaml file to pass the test.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://msgid.link/r/1712830305-31350-2-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: codecs: tas2780: remove redundant assignments to variable ret
Colin Ian King [Thu, 11 Apr 2024 08:33:32 +0000 (09:33 +0100)]
ASoC: codecs: tas2780: remove redundant assignments to variable ret

Variable ret is being assigned a value that is never read in a couple
of places. The variable is being re-assigned later on. The assignments
are redundant and can be removed.

Cleans up clang scan build warning:
sound/soc/codecs/tas2780.c:84:2: warning: Value stored to 'ret' is
never read [deadcode.DeadStores]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://msgid.link/r/20240411083332.304887-1-colin.i.king@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: cs35l56: Include array_size.h
Richard Fitzgerald [Wed, 10 Apr 2024 16:08:33 +0000 (17:08 +0100)]
ASoC: cs35l56: Include array_size.h

Explicitly #include array_size.h for the source files that use
ARRAY_SIZE().

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://msgid.link/r/20240410160833.20837-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: wm_adsp: Include array_size.h
Richard Fitzgerald [Wed, 10 Apr 2024 16:13:12 +0000 (17:13 +0100)]
ASoC: wm_adsp: Include array_size.h

Explicitly #include array_size.h for the ARRAY_SIZE() macro.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://msgid.link/r/20240410161312.22313-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: ti: davinci-i2s: Add features to McBSP
Mark Brown [Tue, 9 Apr 2024 22:27:01 +0000 (23:27 +0100)]
ASoC: ti: davinci-i2s: Add features to McBSP

Merge series from Bastien Curutchet <bastien.curutchet@bootlin.com>:

This series aims to add some features to McBSP driver.

Convert bindings from .txt to .yaml.
Add possibility to use an external clock as sample rate generator's
input.
Add handling of new formats (TDM, S24_LE, BP_FC).
Enable the detection of unexpected frame pulses.
Set the clock free-running mode according to SND_SOC_DAIFMT_[GATED/CONT]
configuration in DAI format.
Add ti,T1-framing[tx/rx] properties in DT. They allow to set the data
delay to two bit-clock periods.

This has been tested on a platform designed off of the DAVINCI/OMAP-L138
connected to 3 daisy-chained AD7767. An external clock drives the
sample rate generator through the CLKS pin.
The hardware I have only allowed me to test acquisition side of McBSP.
It is connected to a 6 channels TDM and acts as Bit clock provider and
Frame clock consumer.

5 months agoASoC: SOF: Intel: Add fw_regs area to debugfs map for
Mark Brown [Tue, 9 Apr 2024 22:26:49 +0000 (23:26 +0100)]
ASoC: SOF: Intel: Add fw_regs area to debugfs map for

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

The beginning of the first SRAM window contains various fw registers and
additional information which can be very beneficial to read to gather
information on the current states to debug issues.

5 months agoASoC: pcm: perform power-down delay checks a bit faster
Dragan Simic [Tue, 9 Apr 2024 17:56:36 +0000 (19:56 +0200)]
ASoC: pcm: perform power-down delay checks a bit faster

When checking whether the power-down delay should be ignored for a specific
PCM runtime, there's no need to keep going through all DAI link components
after any of them is found to be configured to use the power-down delay.

While there, fix a small typo in one of the comment blocks.

Signed-off-by: Dragan Simic <dsimic@manjaro.org>
Link: https://msgid.link/r/90ae761a5b99640ece48363a7099ac2cf402bd37.1712684592.git.dsimic@manjaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: amd: fix for soundwire build dependencies for legacy stack
Vijendar Mukunda [Mon, 8 Apr 2024 18:02:26 +0000 (23:32 +0530)]
ASoC: amd: fix for soundwire build dependencies for legacy stack

The SND_SOC_AMD_SOUNDWIRE Kconfig symbol has build dependency on
SOUNDWIRE_AMD. It gets it wrong for a configuration involving
SND_SOC_AMD_SOUNDWIRE_LINK_BASELINE=y,SND_SOC_AMD_PS=y and SOUNDWIRE_AMD=m,
which results in a link failure:

ld: vmlinux.o: in function `amd_sdw_probe':
>> sound/soc/amd/ps/pci-ps.c:271:(.text+0x1d51eff):
undefined reference to `sdw_amd_probe'
ld: vmlinux.o: in function `acp63_sdw_machine_select':
>> sound/soc/amd/ps/pci-ps.c:294:(.text+0x1d525d5):
undefined reference to `sdw_amd_get_slave_info'
ld: vmlinux.o: in function `amd_sdw_exit':
>> sound/soc/amd/ps/pci-ps.c:280:(.text+0x1d538ce):
undefined reference to `sdw_amd_exit'

Add a top level check config that forbids any of the AMD ACP drivers
with version >= 6.3 from being built-in with CONFIG_SOUNDWIRE_AMD=m.
Move SND_AMD_ACP_CONFIG common dependency config to
SND_SOC_AMD_ACP63_TOPLEVEL config.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202404061257.khJml82D-lkp@intel.com/
Fixes: a806793f231e ("ASoC: amd: simplify soundwire dependencies for legacy stack")
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://msgid.link/r/20240408180229.3287220-1-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: ti: davinci-i2s: Add T1 framing support
Bastien Curutchet [Tue, 2 Apr 2024 07:12:13 +0000 (09:12 +0200)]
ASoC: ti: davinci-i2s: Add T1 framing support

McBSP's data delay can be configured from 0 to 2 bit clock periods. 0 is
used for DSP_B format, 1 is used for DSP_A format, 2 is unused.

A data delay of 2 bit clock periods can be used to interface to
'T1 framing' devices where data stream is preceded by a 'framing bit'. On
transmission, McBSP inserts a blank period (high-impedance period)
before the first data bit to leave an opportunity for other devices to
set this 'framing bit'. On reception, McBSP discards the 'framing bit'
that precedes the data stream.

Add support for the 'framing bit' according to the
'ti,T1-framing-[tx/rx]' device-tree properties. If a flag is present,
the data delay is set to 2 bit clock periods regardless of the selected
DAI format.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://msgid.link/r/20240402071213.11671-14-bastien.curutchet@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: dt-bindings: davinci-mcbsp: Add the 'ti,T1-framing-{rx/tx}' flags
Bastien Curutchet [Tue, 2 Apr 2024 07:12:12 +0000 (09:12 +0200)]
ASoC: dt-bindings: davinci-mcbsp: Add the 'ti,T1-framing-{rx/tx}' flags

McBSP's data delay can be configured from 0 to 2 bit clock periods. 0 is
used for DSP_B format, 1 for DSP_A format. A data delay of 2 bit clock
periods can be used to interface to 'T1 framing' devices where data
stream is preceded by a 'framing bit'. This 2 bit clock data delay is
not described in the bindings.

Add two flags 'ti,T1-framing-[rx/tx]' to enable a data delay of 2
bit clock periods in reception or transmission.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://msgid.link/r/20240402071213.11671-13-bastien.curutchet@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: ti: davinci-i2s: Add S24_LE to supported formats
Bastien Curutchet [Tue, 2 Apr 2024 07:12:11 +0000 (09:12 +0200)]
ASoC: ti: davinci-i2s: Add S24_LE to supported formats

S24_LE is supported by McBSP but not by the driver.

Add S24_LE to driver's supported formats. Using it enables the sign
extension in DRR (Data Receive Register). The other formats are kept
with the zero extension in DRR.

Remove data_type table as it is no longer used.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://msgid.link/r/20240402071213.11671-12-bastien.curutchet@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: ti: davinci-i2s: Link free-run mode to SND_SOC_DAIFMT_[GATED/CONT]
Bastien Curutchet [Tue, 2 Apr 2024 07:12:10 +0000 (09:12 +0200)]
ASoC: ti: davinci-i2s: Link free-run mode to SND_SOC_DAIFMT_[GATED/CONT]

McBSP has free-running mode where serial clocks continue to run during
emulation halts. This mode is always enabled by the driver.

Set free-running mode when SND_SOC_DAIFMT_CONT is selected by DAI
format, unset it when SND_SOC_DAIFMT_GATED is selected.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://msgid.link/r/20240402071213.11671-11-bastien.curutchet@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: ti: davinci-i2s: Enable unexpected frame pulses detection
Bastien Curutchet [Tue, 2 Apr 2024 07:12:09 +0000 (09:12 +0200)]
ASoC: ti: davinci-i2s: Enable unexpected frame pulses detection

McBSP can generate a SYNCERR when unexpected frame pulses are
detected. The driver always disables this feature and ignore the
unexpected frame pulses.

Enable the generation of SYNCERR by the McBSP. Unexpected frame
pulses are not ignored anymore.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://msgid.link/r/20240402071213.11671-10-bastien.curutchet@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: ti: davinci-i2s: Add handling of BP_FC format
Bastien Curutchet [Tue, 2 Apr 2024 07:12:08 +0000 (09:12 +0200)]
ASoC: ti: davinci-i2s: Add handling of BP_FC format

McBSP is able to drive bit clock and consume frame clock but BP_FC
format is not handled by McBSP driver.

Add BP_FC format support.
When BP_FC is selected:
  - CLKX and CLKR are configured as outputs
  - The sample rate generator is configured to be able to provide bit
    clock.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://msgid.link/r/20240402071213.11671-9-bastien.curutchet@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: ti: davinci-i2s: Add TDM support
Bastien Curutchet [Tue, 2 Apr 2024 07:12:07 +0000 (09:12 +0200)]
ASoC: ti: davinci-i2s: Add TDM support

TDM is not supported by the McBSP driver. The McBSP datasheet does not
name explicitly TDM as a supported format but it is possible to configure
the McBSP to do TDM if all slots are used by McBSP.

Add TDM support. It uses single-phase frame. Slot width is used to
compute the McBSP's word length.

Implement the set_tdm_slot() hook of snd_soc_dai_ops struct. It only
supports TDM if all slots are used by McBSP.

The snd_soc_dai_driver's channels_max is updated from 2 to 128.

This was tested with BP_FC format on a platform designed off of
DAVINCI/OMAP_L138. A check is done in davinci_i2s_set_dai_fmt() to
prevent TDM to be used with BC_FC and BC_FP formats.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://msgid.link/r/20240402071213.11671-8-bastien.curutchet@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: ti: davinci-i2s: Delete unnecessary assignment
Bastien Curutchet [Tue, 2 Apr 2024 07:12:06 +0000 (09:12 +0200)]
ASoC: ti: davinci-i2s: Delete unnecessary assignment

In davinci_i2s_hw_params(), mcbsp_word_length is set twice to
asp_word_length[fmt].

Remove second unnecessary assignment.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://msgid.link/r/20240402071213.11671-7-bastien.curutchet@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: ti: davinci-i2s: Use external clock to drive sample rate generator
Bastien Curutchet [Tue, 2 Apr 2024 07:12:05 +0000 (09:12 +0200)]
ASoC: ti: davinci-i2s: Use external clock to drive sample rate generator

McBSP's internal sample rate generator can be programed to be driven by
its internal clock or by an external clock source located on CLKS pin.
The external clock source case is not handled by the driver.

Handle an optional clock related to this external clock source. If
present, the driver uses the clock located on CLKS pin as input for the
sample rate generator. Thus, the external clock rate is used to compute
divisors. If this optional clock is not present, the sample rate
generator is driven by the McBSP's functional clock.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://msgid.link/r/20240402071213.11671-6-bastien.curutchet@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: ti: davinci-i2s: Replace dev_err with dev_err_probe
Bastien Curutchet [Tue, 2 Apr 2024 07:12:04 +0000 (09:12 +0200)]
ASoC: ti: davinci-i2s: Replace dev_err with dev_err_probe

In probe(), the dev_err() is used for every returned error.

Replace dev_err() with dev_err_probe() where -EPROBE_DEFER can be
returned.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://msgid.link/r/20240402071213.11671-5-bastien.curutchet@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: ti: davinci-i2s: Remove the unused clk_input_pin attribute
Bastien Curutchet [Tue, 2 Apr 2024 07:12:03 +0000 (09:12 +0200)]
ASoC: ti: davinci-i2s: Remove the unused clk_input_pin attribute

The clk_input_pin attribute of davinci_mcbsp_dev struct is not set since
commit 257ade78b601 ("ASoC: davinci-i2s: Convert to use edma-pcm").

Remove the attribute.
Keep the behaviour of the MCBSP_CLKR case as MCBSP_CLKR == 0.
I can't test the BC_FP format so I added back the initial comment that
was removed by commit ec6375533748 ("ASoC: DaVinci: Added selection of
clk input pin for McBSP"). This was the last dependency to
linux/platform_data/davinci_asp.h so it is not included anymore.

Remove the enum mcbsp_clk_input_pin from davinci_asp.h as it is not used
anywhere else.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://msgid.link/r/20240402071213.11671-4-bastien.curutchet@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: dt-bindings: davinci-mcbsp: Add optional clock
Bastien Curutchet [Tue, 2 Apr 2024 07:12:02 +0000 (09:12 +0200)]
ASoC: dt-bindings: davinci-mcbsp: Add optional clock

The McBSP uses an internal sample rate generator to provide bit clock
or frame clock. This sample rate generator can be programmed to be
driven by McBSP's internal clock source or by an external clock source
(located on CLKS pin). The external clock source is not described in
the bindings.

Add an optional clock item that allows to select an external clock as
sample rate generator's input.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://msgid.link/r/20240402071213.11671-3-bastien.curutchet@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: dt-bindings: davinci-mcbsp: convert McBSP bindings to yaml schema
Bastien Curutchet [Tue, 2 Apr 2024 07:12:01 +0000 (09:12 +0200)]
ASoC: dt-bindings: davinci-mcbsp: convert McBSP bindings to yaml schema

Convert the binding for McBSP controllers for TI SoCs from txt
to YAML schema.

Add properties 'clocks', 'clock-names', 'power-domains' and
'#sound-dai-cells' which were missing from the txt file.
Add '#sound-dai-cells' and 'clocks' in the example which were missing
from the txt file.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://msgid.link/r/20240402071213.11671-2-bastien.curutchet@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: codecs: Rockchip on-SoC codecs should depend on ARCH_ROCKCHIP
Geert Uytterhoeven [Tue, 9 Apr 2024 15:34:56 +0000 (17:34 +0200)]
ASoC: codecs: Rockchip on-SoC codecs should depend on ARCH_ROCKCHIP

The various Rockchip embedded audio codecs are only present on Rockchip
SoCs.  Hence add dependencies on ARCH_ROCKCHIP, to prevent asking the
user about these drivers when configuring a kernel without Rockchip SoC
support.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://msgid.link/r/6cdbaf4afcf4d2059b257f6cb3a8a61bf5e17688.1712676714.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: SOF: Intel: lnl: Add fw_regs area to debugfs map
Peter Ujfalusi [Tue, 9 Apr 2024 11:33:49 +0000 (14:33 +0300)]
ASoC: SOF: Intel: lnl: Add fw_regs area to debugfs map

Expose the firmware registers via debugfs. it can be of great help while
debugging complex issues.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://msgid.link/r/20240409113349.21623-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: SOF: Intel: mtl: Add fw_regs area to debugfs map
Peter Ujfalusi [Tue, 9 Apr 2024 11:33:48 +0000 (14:33 +0300)]
ASoC: SOF: Intel: mtl: Add fw_regs area to debugfs map

Expose the firmware registers via debugfs. it can be of great help while
debugging complex issues.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://msgid.link/r/20240409113349.21623-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: SOF: Intel: tgl: Add fw_regs area to debugfs map for IPC4
Peter Ujfalusi [Tue, 9 Apr 2024 11:33:47 +0000 (14:33 +0300)]
ASoC: SOF: Intel: tgl: Add fw_regs area to debugfs map for IPC4

Expose the firmware registers via debugfs. it can be of great help while
debugging complex issues.
The area is only available with IPC4.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://msgid.link/r/20240409113349.21623-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: Intel: sof_rt5682: Fix uninitialized variable in probe
Dan Carpenter [Mon, 8 Apr 2024 07:35:59 +0000 (10:35 +0300)]
ASoC: Intel: sof_rt5682: Fix uninitialized variable in probe

Initialize "is_legacy_cpu" to false to prevent an uninitialized variable
bug.

Fixes: 8efcd4864652 ("ASoC: Intel: sof_rt5682: use common module for sof_card_private initialization")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://msgid.link/r/6e16433f-1897-46a2-b3ee-e177e7d846b8@moroto.mountain
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoAdd support for QCM6490 and QCS6490
Mark Brown [Mon, 8 Apr 2024 17:11:23 +0000 (18:11 +0100)]
Add support for QCM6490 and QCS6490

Merge series from Mohammad Rafi Shaik <quic_mohs@quicinc.com>:

This patchset adds support for sound card on Qualcomm QCM6490 IDP and
QCS6490 RB3Gen2 boards.

5 months agoASoC: dt-bindings: ti,pcm1681: Convert to dtschema
Animesh Agarwal [Sat, 6 Apr 2024 14:14:49 +0000 (19:44 +0530)]
ASoC: dt-bindings: ti,pcm1681: Convert to dtschema

Convert the Texas Instruments PCM1681 bindings to DT schema.
Make bindings complete by adding #sound-dai-cells.

Signed-off-by: Animesh Agarwal <animeshagarwal28@gmail.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://msgid.link/r/20240406141454.45529-1-animeshagarwal28@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: qcom: sc8280xp: Add support for QCM6490 and QCS6490
Mohammad Rafi Shaik [Mon, 8 Apr 2024 04:23:31 +0000 (09:53 +0530)]
ASoC: qcom: sc8280xp: Add support for QCM6490 and QCS6490

Add compatibles for sound card on Qualcomm QCM6490 IDP and
QCS6490 RB3Gen2 boards.

Signed-off-by: Mohammad Rafi Shaik <quic_mohs@quicinc.com>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://msgid.link/r/20240408042331.403103-3-quic_mohs@quicinc.com
Signed-off-by: Mark Brown <broonie@kernel.org>
5 months agoASoC: dt-bindings: qcom,sm8250: Add QCM6490 snd QCS6490 sound card
Mohammad Rafi Shaik [Mon, 8 Apr 2024 04:23:30 +0000 (09:53 +0530)]
ASoC: dt-bindings: qcom,sm8250: Add QCM6490 snd QCS6490 sound card

Document the bindings for the Qualcomm QCM6490 IDP and QCS6490 RB3Gen2
board specific sound card.

The bindings are the same as for other newer Qualcomm ADSP sound cards,
thus keep them in existing qcom,sm8250.yaml file, even though Linux driver
is separate.

Signed-off-by: Mohammad Rafi Shaik <quic_mohs@quicinc.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://msgid.link/r/20240408042331.403103-2-quic_mohs@quicinc.com
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agoASoC: SOF: Intel: improve and extend HDaudio-based
Mark Brown [Fri, 5 Apr 2024 22:15:55 +0000 (23:15 +0100)]
ASoC: SOF: Intel: improve and extend HDaudio-based

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

For LunarLake, the SoundWire in-band wake detection is reported with
the HDAudio WAKE_EN/WAKE_STS registers. In the existing code, these
registers are only handled for HDaudio codecs. Now the same registers
have to be handled with care as shared resources.

The in-band wake detection mainly used for jack detection. Without
this patchset, the SoundWire headset codecs signal an event that would
be ignored and not reported.

6 months agoASoC: Intel: avs: Fixes and cleanups for 6.10
Mark Brown [Fri, 5 Apr 2024 22:15:43 +0000 (23:15 +0100)]
ASoC: Intel: avs: Fixes and cleanups for 6.10

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

Set of changes targeting the avs-driver only. No new features, patchset
either fixes or fortifies existing code.

Patchset starts off with a fix for debugbility on ICL+ platforms which I
have forgotten to fixup when providing support for these initially.
The next two address copier module initialization, most importantly,
silence the gcc 'field-spanning write' false-positive.

The following four:
6/13 ASoC: Intel: avs: Replace risky functions with safer variants
7/13 ASoC: Intel: avs: Fix potential integer overflow
8/13 ASoC: Intel: avs: Test result of avs_get_module_entry()
9/13 ASoC: Intel: avs: Remove dead code

address problems found out by Coverity static analysis tool.

The last two worth mentioning are: recommendation from the firmware team
to wake subsystem from D0ix when starting any pipeline -and- shielding
against invalid period/buffer sizes. Audio format shall be taken into
consideration when calculating either of these.

Amadeusz Sławiński (2):
  ASoC: Intel: avs: Restore stream decoupling on prepare
  ASoC: Intel: avs: Add assert_static to guarantee ABI sizes

Cezary Rojewski (11):
  ASoC: Intel: avs: Fix debug-slot offset calculation
  ASoC: Intel: avs: Silence false-positive memcpy() warnings
  ASoC: Intel: avs: Fix config_length for config-less copiers
  ASoC: Intel: avs: Fix ASRC module initialization
  ASoC: Intel: avs: Replace risky functions with safer variants
  ASoC: Intel: avs: Fix potential integer overflow
  ASoC: Intel: avs: Test result of avs_get_module_entry()
  ASoC: Intel: avs: Remove dead code
  ASoC: Intel: avs: Wake from D0ix when starting streaming
  ASoC: Intel: avs: Init debugfs before booting firmware
  ASoC: Intel: avs: Rule invalid buffer and period sizes out

 sound/soc/intel/avs/avs.h      |  1 +
 sound/soc/intel/avs/cldma.c    |  2 +-
 sound/soc/intel/avs/core.c     |  4 +--
 sound/soc/intel/avs/icl.c      | 12 ++++++---
 sound/soc/intel/avs/loader.c   |  6 +++--
 sound/soc/intel/avs/messages.h | 47 ++++++++++++++++++++++++++++++++--
 sound/soc/intel/avs/path.c     | 13 ++++------
 sound/soc/intel/avs/pcm.c      | 34 +++++++++++++++++++++++-
 sound/soc/intel/avs/probes.c   | 14 ++++++----
 9 files changed, 109 insertions(+), 24 deletions(-)

--
2.25.1

6 months agoASoC: Intel: avs: Rule invalid buffer and period sizes out
Cezary Rojewski [Fri, 5 Apr 2024 09:09:29 +0000 (11:09 +0200)]
ASoC: Intel: avs: Rule invalid buffer and period sizes out

While HDAudio controller supports buffer packets up to 128 bytes low,
audio format shall be taken into consideration when calculating buffer
and period sizes to avoid undesired xruns.

As *_size in ALSA terms means frames (channels times bit-depth-bytes),
hw_rules can calculate minimal buffer and period sizes solely from
sample rate and the number of milliseconds commonly used on the
AudioDSP firmware side.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240405090929.1184068-14-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agoASoC: Intel: avs: Add assert_static to guarantee ABI sizes
Amadeusz Sławiński [Fri, 5 Apr 2024 09:09:28 +0000 (11:09 +0200)]
ASoC: Intel: avs: Add assert_static to guarantee ABI sizes

In order to make sure that IPC interface is stable use assert_static to
check union and struct sizes that describe communication interface.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240405090929.1184068-13-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agoASoC: Intel: avs: Init debugfs before booting firmware
Cezary Rojewski [Fri, 5 Apr 2024 09:09:27 +0000 (11:09 +0200)]
ASoC: Intel: avs: Init debugfs before booting firmware

When bringing up setups it's vital to have access to debug functionality
even if firmware boot fails. As order of probe()ing operations is
changed, update remove() procedure accordingly.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240405090929.1184068-12-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agoASoC: Intel: avs: Wake from D0ix when starting streaming
Cezary Rojewski [Fri, 5 Apr 2024 09:09:26 +0000 (11:09 +0200)]
ASoC: Intel: avs: Wake from D0ix when starting streaming

It is recommended to keep the DSP domain in full-power when starting DMA
engines.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240405090929.1184068-11-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agoASoC: Intel: avs: Remove dead code
Cezary Rojewski [Fri, 5 Apr 2024 09:09:25 +0000 (11:09 +0200)]
ASoC: Intel: avs: Remove dead code

The result of list_next_entry()/list_last_entry() is never null.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240405090929.1184068-10-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agoASoC: Intel: avs: Test result of avs_get_module_entry()
Cezary Rojewski [Fri, 5 Apr 2024 09:09:24 +0000 (11:09 +0200)]
ASoC: Intel: avs: Test result of avs_get_module_entry()

While PROBE_MOD_UUID is always part of the base AudioDSP firmware
manifest, from maintenance point of view it is better to check the
result.

Fixes: dab8d000e25c ("ASoC: Intel: avs: Add data probing requests")
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240405090929.1184068-9-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agoASoC: Intel: avs: Fix potential integer overflow
Cezary Rojewski [Fri, 5 Apr 2024 09:09:23 +0000 (11:09 +0200)]
ASoC: Intel: avs: Fix potential integer overflow

While stream_tag for CLDMA on SKL-based platforms is always 1, function
hda_cldma_setup() uses AZX_SD_CTL_STRM() macro which does:
stream_tag << 20

what combined with stream_tag type of 'unsigned int' generates a
potential overflow issue. Update the field type to fix that.

Fixes: 45864e49a05a ("ASoC: Intel: avs: Implement CLDMA transfer")
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240405090929.1184068-8-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agoASoC: Intel: avs: Replace risky functions with safer variants
Cezary Rojewski [Fri, 5 Apr 2024 09:09:22 +0000 (11:09 +0200)]
ASoC: Intel: avs: Replace risky functions with safer variants

strscpy() and snprintf() are the recommended equivalents of their
riskier friends.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240405090929.1184068-7-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agoASoC: Intel: avs: Fix ASRC module initialization
Cezary Rojewski [Fri, 5 Apr 2024 09:09:21 +0000 (11:09 +0200)]
ASoC: Intel: avs: Fix ASRC module initialization

The ASRC module configuration consists of several reserved fields. Zero
them out when initializing the module to avoid sending invalid data.

Fixes: 274d79e51875 ("ASoC: Intel: avs: Configure modules according to their type")
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240405090929.1184068-6-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agoASoC: Intel: avs: Fix config_length for config-less copiers
Cezary Rojewski [Fri, 5 Apr 2024 09:09:20 +0000 (11:09 +0200)]
ASoC: Intel: avs: Fix config_length for config-less copiers

Copier's config_length shall always be at least one even if there is no
configuration payload to carry. While the firmware treats
config_length=0 or 1 in the same manner, the driver shall initialize the
module properly.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240405090929.1184068-5-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agoASoC: Intel: avs: Silence false-positive memcpy() warnings
Cezary Rojewski [Fri, 5 Apr 2024 09:09:19 +0000 (11:09 +0200)]
ASoC: Intel: avs: Silence false-positive memcpy() warnings

Commit df8fc4e934c1 ("kbuild: Enable -fstrict-flex-arrays=3") enforced
strict flex array declarations. This generates false-positive in form of:
"memcpy: detected field-spanning write". Avoid it by utilizing the
DECLARE_FLEX_ARRAY() macro.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240405090929.1184068-4-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agoASoC: Intel: avs: Fix debug-slot offset calculation
Cezary Rojewski [Fri, 5 Apr 2024 09:09:18 +0000 (11:09 +0200)]
ASoC: Intel: avs: Fix debug-slot offset calculation

For resources with ID other than 0 the current calculus is incorrect.

Fixes: 275b583d047a ("ASoC: Intel: avs: ICL-based platforms support")
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240405090929.1184068-3-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agoASoC: Intel: avs: Restore stream decoupling on prepare
Amadeusz Sławiński [Fri, 5 Apr 2024 09:09:17 +0000 (11:09 +0200)]
ASoC: Intel: avs: Restore stream decoupling on prepare

Revert changes from commit b87b8f43afd5 ("ASoC: Intel: avs: Drop
superfluous stream decoupling") to restore working streaming during S3.

Fixes: b87b8f43afd5 ("ASoC: Intel: avs: Drop superfluous stream decoupling")
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240405090929.1184068-2-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agoASoC: SOF: Intel: hda-ctrl: only clear WAKESTS for HDaudio codecs
Pierre-Louis Bossart [Thu, 4 Apr 2024 19:03:57 +0000 (14:03 -0500)]
ASoC: SOF: Intel: hda-ctrl: only clear WAKESTS for HDaudio codecs

When a PME wake happens due to a SoundWire wake, we currently clear
all WAKESTS bits during the resume operation initiated by the PCI
subsystem. As a result, we are unable to identify which SoundWire
links need to be resumed and don't properly handle jack detection.

This patch only clears the WAKESTS bits for the HDaudio codecs
detected earlier.

Note that we still clear all WAKESTS bits unconditionally in
hda_dsp_ctrl_stop_chip(). The existing behavior is potentially racy if
e.g. a jack event happens during a suspend routine, but there's a risk
of breaking shutdown or reboot sequences so the code is left as is for
now.

Closes: https://github.com/thesofproject/linux/issues/4687
Co-developed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Keqiao Zhang <keqiao.zhang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://msgid.link/r/20240404190357.138073-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agoASoC: SOF: Intel: hda-codec: preserve WAKEEN values
Pierre-Louis Bossart [Thu, 4 Apr 2024 19:03:56 +0000 (14:03 -0500)]
ASoC: SOF: Intel: hda-codec: preserve WAKEEN values

Since LunarLake, we use the HDadio WAKEEN/WAKESTS to detect wakes for
SoundWire codecs. Unfortunately, the existing code in
hda_codec_jack_wake_enable() unconditionally resets the WAKEEN bits.

This patch changes the initialization to preserve SoundWire WAKEEN
bits. For HDAudio codecs the same strategy is used, WAKEEN is only set
when the jacktbl.used property is set.

Closes: https://github.com/thesofproject/linux/issues/4687
Co-developed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Keqiao Zhang <keqiao.zhang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://msgid.link/r/20240404190357.138073-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
6 months agoASoC: SOF: Intel: lnl: add helper to detect SoundWire wakes
Pierre-Louis Bossart [Thu, 4 Apr 2024 19:03:55 +0000 (14:03 -0500)]
ASoC: SOF: Intel: lnl: add helper to detect SoundWire wakes

The global STATESTS register will provide information on all
links. Rather than iterate on all possible links, the helpers only
filters the range of possible bits for a quick lookup. The
process_wakeen() helper will walk through all the links and deal with
wakes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://msgid.link/r/20240404190357.138073-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>