]> www.infradead.org Git - users/dwmw2/linux.git/log
users/dwmw2/linux.git
9 months agoASoc: TAS2781: rename the tas2781_reset as tasdevice_reset
Shenghao Ding [Tue, 9 Jul 2024 04:33:40 +0000 (12:33 +0800)]
ASoc: TAS2781: rename the tas2781_reset as tasdevice_reset

Rename the tas2781_reset as tasdevice_reset in case of misunderstanding.
RESET register for both tas2563 and tas2781 is same and the use of reset
pin is also same.

Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
Link: https://patch.msgid.link/20240709043342.946-1-shenghao-ding@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: fsl-asoc-card: add S/PDIF controller support
Mark Brown [Mon, 8 Jul 2024 18:30:39 +0000 (19:30 +0100)]
ASoC: fsl-asoc-card: add S/PDIF controller support

Merge series from Elinor Montmasson <elinor.montmasson@savoirfairelinux.com>:

This is a series of patches aiming to make the machine driver
`fsl-asoc-card` compatible with S/PDIF controllers on imx boards.  The
main goal is to allow the use of S/PDIF controllers with ASRC modules.

The `imx-spdif` machine driver already has specific support for S/PDIF
controllers but doesn't support using an ASRC with it. However, the
`fsl-asoc-card` machine driver has the necessary code to create a sound
card which can use an ASRC module.
It is then possible to extend the support for S/PDIF audio cards by
merging the `imx-spdif` driver into `fsl-asoc-card`.

The first three patches adapt the `fsl-asoc-card` driver to support
multiple codec use cases.
The driver can get 2 codec phandles from the device tree, and
codec-related variables are doubled.
`for_each_codecs` macros are also used when possible to ease adding
other multi-codec use cases in the future.
It makes possible to use the two S/PDIF dummy codec drivers
`spdif_receiver` and `spdif_transmitter` instead of `snd-soc-dummy`,
which was used in `imx-spdif`.

The fourth patch merges the S/PDIF support from `imx-spdif` to
`fsl-asoc-card`.
`fsl-asoc-card` offers the same functionalities as `imx-spdif` did, but
this merge also extends the S/PDIF support with the possibility of using
an ASRC.
Compatible "fsl,imx-audio-spdif" is kept, but `fsl-asoc-card` uses
different DT properties compared to `imx-spdif`:
* The "spdif-controller" property from `imx-spdif` is named "audio-cpu"
  in `fsl-asoc-card`.
* `fsl-asoc-card` uses codecs explicitly declared in DT with
  "audio-codec". With an S/PDIF, codec drivers `spdif_transmitter` and
  `spdif_receiver` should be used. Driver `imx-spdif` used instead the
  dummy codec and a pair of boolean properties, "spdif-in" and
  "spdif-out".
Backward compatibility is therefore implemented in `fsl-asoc-card`.
However, it is recommended to use the new properties when needed.
Especially, declaring and using S/PDIF transmitter and/or receiver nodes
is better than using the dummy codec.

The last three patches update the device tree bindings of
`fsl-asoc-card` and update all in-tree device trees to use the
`fsl-asoc-card` properties.
Note that as the old properties are still supported:
* previous versions of in-tree device trees are still supported.
* out-of-tree device trees are still supported.

This series of patches was successfully built for arm64 and x86 on top
of the latest "for-next" branch of the ASoC git tree on the 26th of June
2024.
These modifications have also been tested on an i.MX8MN evaluation board
with a linux kernel RT v6.1.26-rt8.

9 months agoASoC: Simplify code with cleanup.h
Mark Brown [Mon, 8 Jul 2024 15:50:14 +0000 (16:50 +0100)]
ASoC: Simplify code with cleanup.h

Merge series from Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>:

Allocate the memory with scoped/cleanup.h to reduce error handling
(simpler error paths) and make the code a bit smaller.

9 months agoASoC: dt-bindings: update fsl-asoc-card bindings after imx-spdif merge
Elinor Montmasson [Thu, 27 Jun 2024 08:31:02 +0000 (10:31 +0200)]
ASoC: dt-bindings: update fsl-asoc-card bindings after imx-spdif merge

The S/PDIF audio card support with compatible "fsl,imx-audio-spdif"
was merged from imx-spdif into the fsl-asoc-card driver.
It makes possible to use an S/PDIF with an ASRC.

This merge introduces new DT bindings to use with compatible
"fsl,imx-audio-spdif" to follow the way fsl-asoc-card works:
* the "spdif-controller" property from imx-spdif is named "audio-cpu"
  in fsl-asoc-card.
* fsl-asoc-card uses codecs explicitly declared in DT
  with "audio-codec".
  With an SPDIF, codec drivers spdif_transmitter and
  spdif_receiver should be used.
  Driver imx-spdif used instead the dummy codec and a pair of
  boolean properties, "spdif-in" and "spdif-out".

In an upcoming commit, in-tree DTs will be modified to follow these new
properties:
* Property "spdif-controller" will be renamed "audio-cpu".
* spdif_transmitter and spdif_receiver nodes will be declared
  and linked to the fsl-asoc-card node with the property "audio-codec".

To keep backward compatibility with other DTs, support for
"spdif-controller", "spdif-in" and "spdif-out" properties is kept.
However, it is recommended to use the new properties if possible.
It is better to declare transmitter and/or receiver
in DT than using the dummy codec.

DTs using compatible "fsl,imx-audio-spdif" are still supported, and
fsl-asoc-card will behave the same as imx-spdif for these DTs.

Signed-off-by: Elinor Montmasson <elinor.montmasson@savoirfairelinux.com>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://patch.msgid.link/20240627083104.123357-6-elinor.montmasson@savoirfairelinux.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: fsl-asoc-card: merge spdif support from imx-spdif.c
Elinor Montmasson [Thu, 27 Jun 2024 08:31:01 +0000 (10:31 +0200)]
ASoC: fsl-asoc-card: merge spdif support from imx-spdif.c

The imx-spdif machine driver creates audio card to directly use an
S/PDIF device. However, it doesn't support interacting with an ASRC.
fsl-asoc-card already has the support to create audio card which can
use the ASRC.

Merge the S/PDIF support from imx-spdif into driver fsl-asoc-card
to extend the support of S/PDIF audio card with the use of ASRC devices.

fsl-asoc-card uses slightly different DT properties than imx-spdif:
* the "spdif-controller" property from imx-spdif is named "audio-cpu" in
  fsl-asoc-card.
* fsl-asoc-card uses codecs explicitly declared in DT
  with "audio-codec".
  With an SPDIF, codec drivers spdif_transmitter and
  spdif_receiver should be used.
  Driver imx-spdif used instead the dummy codec and a pair of
  boolean properties, "spdif-in" and "spdif-out".

To keep backward compatibility, support for "spdif-controller",
"spdif-in" and "spdif-out" is also added to fsl-asoc-card.
However, it is recommended to use the new properties if possible.
It is better to declare transmitter and/or receiver in DT
than using the dummy codec.

DTs using compatible "fsl,imx-audio-spdif" are still compatible, and
fsl-asoc-card will behave the same as imx-spdif
for these DTs.

Signed-off-by: Elinor Montmasson <elinor.montmasson@savoirfairelinux.com>
Link: https://patch.msgid.link/20240627083104.123357-5-elinor.montmasson@savoirfairelinux.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: fsl-asoc-card: add compatibility to use 2 codecs in dai-links
Elinor Montmasson [Thu, 27 Jun 2024 08:31:00 +0000 (10:31 +0200)]
ASoC: fsl-asoc-card: add compatibility to use 2 codecs in dai-links

Adapt the driver to work with configurations using two codecs or more.
Modify fsl_asoc_card_probe() to handle use cases where 2 codecs are
given in the device tree.
This will be needed to add support for the SPDIF.

Use cases using one codec will ignore any given codecs other than the
first.

Co-developed-by: Philip-Dylan Gleonec <philip-dylan.gleonec@savoirfairelinux.com>
Signed-off-by: Philip-Dylan Gleonec <philip-dylan.gleonec@savoirfairelinux.com>
Signed-off-by: Elinor Montmasson <elinor.montmasson@savoirfairelinux.com>
Link: https://patch.msgid.link/20240627083104.123357-4-elinor.montmasson@savoirfairelinux.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: fsl-asoc-card: add second dai link component for codecs
Elinor Montmasson [Thu, 27 Jun 2024 08:30:59 +0000 (10:30 +0200)]
ASoC: fsl-asoc-card: add second dai link component for codecs

Add a second dai link component for codecs that will be used for use
cases with 2 codecs.
It is needed for future integration of the SPDIF support, which will
use spdif_receiver and spdif_transmitter drivers.

To prevent deferring in use cases using only one codec, also set
by default the number of codecs to 1 for the relevant dai links.

Co-developed-by: Philip-Dylan Gleonec <philip-dylan.gleonec@savoirfairelinux.com>
Signed-off-by: Philip-Dylan Gleonec <philip-dylan.gleonec@savoirfairelinux.com>
Signed-off-by: Elinor Montmasson <elinor.montmasson@savoirfairelinux.com>
Link: https://patch.msgid.link/20240627083104.123357-3-elinor.montmasson@savoirfairelinux.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: fsl-asoc-card: add support for dai links with multiple codecs
Elinor Montmasson [Thu, 27 Jun 2024 08:30:58 +0000 (10:30 +0200)]
ASoC: fsl-asoc-card: add support for dai links with multiple codecs

Add support for dai links using multiple codecs for multi-codec
use cases.

Co-developed-by: Philip-Dylan Gleonec <philip-dylan.gleonec@savoirfairelinux.com>
Signed-off-by: Philip-Dylan Gleonec <philip-dylan.gleonec@savoirfairelinux.com>
Signed-off-by: Elinor Montmasson <elinor.montmasson@savoirfairelinux.com>
Link: https://patch.msgid.link/20240627083104.123357-2-elinor.montmasson@savoirfairelinux.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoc: TAS2781: replace beXX_to_cpup with get_unaligned_beXX for potentially broken...
Shenghao Ding [Sun, 7 Jul 2024 08:30:07 +0000 (16:30 +0800)]
ASoc: TAS2781: replace beXX_to_cpup with get_unaligned_beXX for potentially broken alignment

Use get_unaligned_be16 instead of be16_to_cpup and get_unaligned_be32
instead of be32_to_cpup for potentially broken alignment.

Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
Link: https://patch.msgid.link/20240707083011.98-1-shenghao-ding@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: dapm: Simplify snd_soc_dai_link_event_pre_pmu() with cleanup.h
Krzysztof Kozlowski [Wed, 3 Jul 2024 12:11:05 +0000 (14:11 +0200)]
ASoC: dapm: Simplify snd_soc_dai_link_event_pre_pmu() with cleanup.h

Allocate the memory with scoped/cleanup.h in
snd_soc_dai_link_event_pre_pmu() to reduce error handling (less error
paths) and make the code a bit simpler.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20240703-asoc-cleanup-h-v1-11-71219dfd0aef@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: dapm: Simplify dapm_cnew_widget() with cleanup.h
Krzysztof Kozlowski [Wed, 3 Jul 2024 12:11:04 +0000 (14:11 +0200)]
ASoC: dapm: Simplify dapm_cnew_widget() with cleanup.h

Allocate the memory with scoped/cleanup.h in dapm_cnew_widget() to
reduce error handling (less error paths) and make the code a bit
simpler.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20240703-asoc-cleanup-h-v1-10-71219dfd0aef@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: ops: Simplify with cleanup.h
Krzysztof Kozlowski [Wed, 3 Jul 2024 12:11:03 +0000 (14:11 +0200)]
ASoC: ops: Simplify with cleanup.h

Allocate the memory with scoped/cleanup.h to reduce error handling (less
error paths) and make the code a bit simpler.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20240703-asoc-cleanup-h-v1-9-71219dfd0aef@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: simple-card: Use cleanup.h instead of devm_kfree()
Krzysztof Kozlowski [Wed, 3 Jul 2024 12:11:02 +0000 (14:11 +0200)]
ASoC: simple-card: Use cleanup.h instead of devm_kfree()

Allocate the memory with scoped/cleanup.h, instead of devm interface, to
make the code more obvious that memory is not used outside this scope.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/20240703-asoc-cleanup-h-v1-8-71219dfd0aef@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: audio-graph-card2: Use cleanup.h instead of devm_kfree()
Krzysztof Kozlowski [Wed, 3 Jul 2024 12:11:01 +0000 (14:11 +0200)]
ASoC: audio-graph-card2: Use cleanup.h instead of devm_kfree()

Allocate the memory with scoped/cleanup.h, instead of devm interface, to
make the code more obvious that memory is not used outside this scope.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/20240703-asoc-cleanup-h-v1-7-71219dfd0aef@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: audio-graph-card: Use cleanup.h instead of devm_kfree()
Krzysztof Kozlowski [Wed, 3 Jul 2024 12:11:00 +0000 (14:11 +0200)]
ASoC: audio-graph-card: Use cleanup.h instead of devm_kfree()

Allocate the memory with scoped/cleanup.h, instead of devm interface, to
make the code more obvious that memory is not used outside this scope.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/20240703-asoc-cleanup-h-v1-6-71219dfd0aef@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: simple-card-utils: Simplify with cleanup.h
Krzysztof Kozlowski [Wed, 3 Jul 2024 12:10:59 +0000 (14:10 +0200)]
ASoC: simple-card-utils: Simplify with cleanup.h

Allocate the memory with scoped/cleanup.h to reduce error handling (less
error paths) and make the code a bit simpler.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/20240703-asoc-cleanup-h-v1-5-71219dfd0aef@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: codecs: wcd934x: Simplify with cleanup.h
Krzysztof Kozlowski [Wed, 3 Jul 2024 12:10:58 +0000 (14:10 +0200)]
ASoC: codecs: wcd934x: Simplify with cleanup.h

Allocate the memory with scoped/cleanup.h to reduce error handling (less
error paths) and make the code a bit simpler.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20240703-asoc-cleanup-h-v1-4-71219dfd0aef@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: codecs: wcd9335: Simplify with cleanup.h
Krzysztof Kozlowski [Wed, 3 Jul 2024 12:10:57 +0000 (14:10 +0200)]
ASoC: codecs: wcd9335: Simplify with cleanup.h

Allocate the memory with scoped/cleanup.h to reduce error handling (less
error paths) and make the code a bit simpler.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20240703-asoc-cleanup-h-v1-3-71219dfd0aef@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: codecs: audio-iio-aux: Simplify audio_iio_aux_probe() with cleanup.h
Krzysztof Kozlowski [Wed, 3 Jul 2024 12:10:56 +0000 (14:10 +0200)]
ASoC: codecs: audio-iio-aux: Simplify audio_iio_aux_probe() with cleanup.h

Allocate the memory with scoped/cleanup.h in audio_iio_aux_probe() to
reduce error handling (less error paths) and make the code a bit
simpler.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20240703-asoc-cleanup-h-v1-2-71219dfd0aef@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: codecs: audio-iio-aux: Simplify audio_iio_aux_add_dapms() with cleanup.h
Krzysztof Kozlowski [Wed, 3 Jul 2024 12:10:55 +0000 (14:10 +0200)]
ASoC: codecs: audio-iio-aux: Simplify audio_iio_aux_add_dapms() with cleanup.h

Allocate the memory with scoped/cleanup.h in audio_iio_aux_add_dapms()
to reduce error handling (less error paths) and make the code a bit
simpler.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20240703-asoc-cleanup-h-v1-1-71219dfd0aef@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoc: pcm6240: Remove unnecessary name-prefix for all the controls
Shenghao Ding [Fri, 5 Jul 2024 06:48:46 +0000 (14:48 +0800)]
ASoc: pcm6240: Remove unnecessary name-prefix for all the controls

Adding name-prefix for each audio controls is a redundant, because
name-prefix will be automatically added behind the control name when
creating a new control.

Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
Link: https://patch.msgid.link/20240705064846.1723-1-shenghao-ding@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoAdd support for non-interleaved mode in qmc_audio
Mark Brown [Thu, 4 Jul 2024 17:41:11 +0000 (18:41 +0100)]
Add support for non-interleaved mode in qmc_audio

Merge series from Herve Codina <herve.codina@bootlin.com>:

The qmc_audio driver supports only audio in interleaved mode.
Non-interleaved mode can be easily supported using several QMC channel
per DAI. In that case, data related to ch0 are sent to (received from)
the first QMC channel, data related to ch1 use the next QMC channel and
so on up to the last channel.

In terms of constraints and settings, the interleaved and
non-interleaved modes are slightly different.

In interleaved mode:
  - The sample size should fit in the number of time-slots available for
    the QMC channel.
  - The number of audio channels should fit in the number of time-slots
    (taking into account the sample size) available for the QMC channel.

In non-interleaved mode:
  - The number of audio channels is the number of available QMC
    channels.
  - Each QMC channel should have the same number of time-slots.
  - The sample size equals the number of time-slots of one QMC channel.

This series add support for the non-interleaved mode in the qmc_audio
driver and is composed of the following parts:
  - Patches 1 and 2: Fix some issues in the qmc_audio
  - Patches 3 to 6: Prepare qmc_audio for the non-interleaved mode
  - Patches 7 and 8: Extend the QMC driver API
  - Patches 9 and 10: The support for non-interleaved mode itself

Compared to the previous iteration, this v2 series mainly improves
qmc_audio_access_is_interleaved().

9 months agoASoC: codecs: lpass-rx-macro: Few code cleanups
Mark Brown [Thu, 4 Jul 2024 17:41:03 +0000 (18:41 +0100)]
ASoC: codecs: lpass-rx-macro: Few code cleanups

Merge series from Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>:

Improve a bit the Qualcomm LPASS RX macro driver and align similar parts
of code with LPASS WSA macro driver for consistency.

No external dependencies.

9 months agoASoc: tas2781: Set "Speaker Force Firmware Load" as the common kcontrol for both...
Shenghao Ding [Thu, 4 Jul 2024 09:49:37 +0000 (17:49 +0800)]
ASoc: tas2781: Set "Speaker Force Firmware Load" as the common kcontrol for both tas27871 and tas2563

Set "Speaker Force Firmware Load" as the common kcontrol
for both tas27871 and tas2563 and move it into newly-created
tasdevice_snd_controls, and keep the digital gain and analog
gain in tas2781_snd_controls.

Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
Link: https://patch.msgid.link/20240704094939.1824-1-shenghao-ding@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: amd: Adjust error handling in case of absent codec device
Aleksandr Mishin [Wed, 3 Jul 2024 19:10:07 +0000 (22:10 +0300)]
ASoC: amd: Adjust error handling in case of absent codec device

acpi_get_first_physical_node() can return NULL in several cases (no such
device, ACPI table error, reference count drop to 0, etc).
Existing check just emit error message, but doesn't perform return.
Then this NULL pointer is passed to devm_acpi_dev_add_driver_gpios()
where it is dereferenced.

Adjust this error handling by adding error code return.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 02527c3f2300 ("ASoC: amd: add Machine driver for Jadeite platform")
Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru>
Link: https://patch.msgid.link/20240703191007.8524-1-amishin@t-argos.ru
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: codecs: wcd939x: Fix typec mux and switch leak during device removal
Krzysztof Kozlowski [Mon, 1 Jul 2024 12:26:16 +0000 (14:26 +0200)]
ASoC: codecs: wcd939x: Fix typec mux and switch leak during device removal

Driver does not unregister typec structures (typec_mux_dev and
typec_switch_desc) during removal leading to leaks.  Fix this by moving
typec registering parts to separate function and using devm interface to
release them.  This also makes code a bit simpler:
 - Smaller probe() function with less error paths and no #ifdefs,
 - No need to store typec_mux_dev and typec_switch_desc in driver state
   container structure.

Cc: stable@vger.kernel.org
Fixes: 10f514bd172a ("ASoC: codecs: Add WCD939x Codec driver")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patch.msgid.link/20240701122616.414158-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: ak4458: remove "reset-gpios" property handler
Shengjiu Wang [Wed, 3 Jul 2024 12:26:15 +0000 (20:26 +0800)]
ASoC: ak4458: remove "reset-gpios" property handler

commit c721f189e89c0 ("reset: Instantiate reset GPIO controller for
shared reset-gpios") check if there is no "resets" property
will fallback to "reset-gpios".

So don't need to handle "reset-gpios" separately in the driver,
the "reset-gpios" handler is duplicated with "resets" control handler,
remove it.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://patch.msgid.link/1720009575-11677-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: SOF: ipc4-topology: Use single token list for the copiers
Peter Ujfalusi [Thu, 4 Jul 2024 08:59:44 +0000 (10:59 +0200)]
ASoC: SOF: ipc4-topology: Use single token list for the copiers

There is no need to keep separate token list for dai and 'common' copier
token list when the 'common' list is actually the aif list, the
SOF_COPIER_DEEP_BUFFER_TOKENS are not applicable for buffers.

We could have separate lists for all types but it is probably simpler to
just use a single list for all types of copiers. Function specific tokens
will be only parsed by function specific code anyways.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://patch.msgid.link/20240704085944.371450-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: fsl: fsl_qmc_audio: Add support for non-interleaved mode.
Herve Codina [Mon, 1 Jul 2024 11:30:37 +0000 (13:30 +0200)]
ASoC: fsl: fsl_qmc_audio: Add support for non-interleaved mode.

The current fsl_qmc_audio works in interleaved mode. The audio samples
are interleaved and all data are sent to (received from) one QMC
channel.

Using several QMC channels, non interleaved mode can be easily
supported. In that case, data related to ch0 are sent to (received from)
the first QMC channel, data related to ch1 use the next QMC channel and
so on up to the last channel.

In terms of constraints and settings, the two modes are slightly
different:
- Interleaved mode:
    - The sample size should fit in the number of time-slots available
      for the QMC channel.
    - The number of audio channels should fit in the number of
      time-slots (taking into account the sample size) available for the
      QMC channel.
- Non-interleaved mode:
    - The number of audio channels is the number of available QMC
      channels.
    - Each QMC channel should have the same number of time-slots.
    - The sample size equals the number of time-slots of one QMC
      channel.

Add support for the non-interleaved mode allowing multiple QMC channel
per DAI. The DAI switches in non-interleaved mode when more that one QMC
channel is available.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Link: https://patch.msgid.link/20240701113038.55144-11-herve.codina@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agodt-bindings: sound: fsl,qmc-audio: Add support for multiple QMC channels per DAI
Herve Codina [Mon, 1 Jul 2024 11:30:36 +0000 (13:30 +0200)]
dt-bindings: sound: fsl,qmc-audio: Add support for multiple QMC channels per DAI

The QMC audio uses one QMC channel per DAI and uses this QMC channel to
transmit interleaved audio channel samples.

In order to work in non-interleave mode, a QMC audio DAI needs to use
multiple QMC channels. In that case, the DAI maps each QMC channel to
exactly one audio channel.

Allow QMC audio DAIs with multiple QMC channels attached.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://patch.msgid.link/20240701113038.55144-10-herve.codina@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agosoc: fsl: cpm1: qmc: Introduce qmc_chan_count_phandles()
Herve Codina [Mon, 1 Jul 2024 11:30:35 +0000 (13:30 +0200)]
soc: fsl: cpm1: qmc: Introduce qmc_chan_count_phandles()

No function in the QMC API is available to get the number of phandles
present in a phandle list.

Fill this lack introducing qmc_chan_count_phandles().

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Link: https://patch.msgid.link/20240701113038.55144-9-herve.codina@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agosoc: fsl: cpm1: qmc: Introduce functions to get a channel from a phandle list
Herve Codina [Mon, 1 Jul 2024 11:30:34 +0000 (13:30 +0200)]
soc: fsl: cpm1: qmc: Introduce functions to get a channel from a phandle list

qmc_chan_get_byphandle() and the resource managed version retrieve a
channel from a simple phandle.

Extend the API and introduce qmc_chan_get_byphandles_index() and the
resource managed version in order to retrieve a channel from a phandle
list using the provided index to identify the phandle in the list.

Also update qmc_chan_get_byphandle() and the resource managed version to
use qmc_chan_get_byphandles_index() and so avoid code duplication.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Link: https://patch.msgid.link/20240701113038.55144-8-herve.codina@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: fsl: fsl_qmc_audio: Introduce qmc_dai_constraints_interleaved()
Herve Codina [Mon, 1 Jul 2024 11:30:33 +0000 (13:30 +0200)]
ASoC: fsl: fsl_qmc_audio: Introduce qmc_dai_constraints_interleaved()

Constraints are set by qmc_dai_startup(). These constraints are specific
to the interleaved mode.

With the future introduction of support for non-interleaved mode, a new
set of constraints will be set. To make the code clear and keep
qmc_dai_startup() simple, extract the current interleaved mode
constraints settings to a specific function.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Link: https://patch.msgid.link/20240701113038.55144-7-herve.codina@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: fsl: fsl_qmc_audio: Introduce qmc_audio_pcm_{read,write}_submit()
Herve Codina [Mon, 1 Jul 2024 11:30:32 +0000 (13:30 +0200)]
ASoC: fsl: fsl_qmc_audio: Introduce qmc_audio_pcm_{read,write}_submit()

Submitting data to QMC channels is done in several places: transfer
completions and DAI start. The operation done is simple and consist in
one function call.

With the future introduction of support for non-interleaved mode,
submitting data will be more complex.

To avoid copy/paste of code in several places, introduce
qmc_audio_pcm_{read,write}_submit() whose goal is to handle this
data submission.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Link: https://patch.msgid.link/20240701113038.55144-6-herve.codina@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: fsl: fsl_qmc_audio: Identify the QMC channel involved in completion routines
Herve Codina [Mon, 1 Jul 2024 11:30:31 +0000 (13:30 +0200)]
ASoC: fsl: fsl_qmc_audio: Identify the QMC channel involved in completion routines

The current QMC audio driver uses only one QMC channel per DAI. The
context used by QMC channel transfer (read and write) completion
routines does not contains any QMC channel and the only one available
per DAI is used to schedule the next transfer.
This works pretty well with only one QMC channel per DAI.

The future support for non-inlerleave mode will use several QMC channel
per DAI. In that case, QMC channel transfer completion routines need to
identify the QMC channel related to the completion.

In order to fill this lack, even if identifying the current QMC channel
among several QMC channels is not needed for the current code, add one
indirection level and introduce the qmc_dai_chan data structrure.
This structure contains the QMC channel involved in the completion and
refererences to the runtime context (capture and playback) used by the
DAI.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Link: https://patch.msgid.link/20240701113038.55144-5-herve.codina@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: fsl: fsl_qmc_audio: Split channel buffer and PCM pointer handling
Herve Codina [Mon, 1 Jul 2024 11:30:30 +0000 (13:30 +0200)]
ASoC: fsl: fsl_qmc_audio: Split channel buffer and PCM pointer handling

The driver mixes some internal values for channel DMA buffer handling
and PCM pointer handling. In the currently supported interleaved mode,
this mix does not lead to any issues but in order to prepare the
support for the non-interleaved mode, having them clearly separated will
ease the support and avoid additional computation to convert values used
in channel DMA buffer management in values usable for PCM pointer.

Use a specific set of variable for PCM pointer handling and an other set
for channel DMA buffer.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Link: https://patch.msgid.link/20240701113038.55144-4-herve.codina@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: fsl: fsl_qmc_audio: Fix issues detected by checkpatch
Herve Codina [Mon, 1 Jul 2024 11:30:29 +0000 (13:30 +0200)]
ASoC: fsl: fsl_qmc_audio: Fix issues detected by checkpatch

./scripts/checkpatch.pl --strict --codespell detected several issues
when running on the fsl_qmc_audio.c file:
  - CHECK: spaces preferred around that '*' (ctx:VxV)
  - CHECK: Alignment should match open parenthesis
  - CHECK: Comparison to NULL could be written "!prtd"
  - CHECK: spaces preferred around that '/' (ctx:VxV)
  - CHECK: Lines should not end with a '('
  - CHECK: Please don't use multiple blank lines
Some of them are present several times.

Fix all of these issues without any functional changes.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Link: https://patch.msgid.link/20240701113038.55144-3-herve.codina@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: fsl: fsl_qmc_audio: Check devm_kasprintf() returned value
Herve Codina [Mon, 1 Jul 2024 11:30:28 +0000 (13:30 +0200)]
ASoC: fsl: fsl_qmc_audio: Check devm_kasprintf() returned value

devm_kasprintf() can return a NULL pointer on failure but this returned
value is not checked.

Fix this lack and check the returned value.

Fixes: 075c7125b11c ("ASoC: fsl: Add support for QMC audio")
Cc: stable@vger.kernel.org
Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Link: https://patch.msgid.link/20240701113038.55144-2-herve.codina@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: codecs: lpass-wsa-macro: Simplify with cleanup.h
Krzysztof Kozlowski [Mon, 1 Jul 2024 07:39:38 +0000 (09:39 +0200)]
ASoC: codecs: lpass-wsa-macro: Simplify with cleanup.h

Driver's probe() has two allocations which are needed only within the
probe() itself - for devm_regmap_init_mmio().

Usage of devm interface is a bit misleading here, because these can be
freed right after each scope finishes.

This makes the code a bit more obvious and self documenting.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20240701-b4-qcom-audio-lpass-codec-cleanups-v3-6-6d98d4dd1ef5@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: codecs: lpass-rx-macro: Use unsigned for number of widgets
Krzysztof Kozlowski [Mon, 1 Jul 2024 07:39:37 +0000 (09:39 +0200)]
ASoC: codecs: lpass-rx-macro: Use unsigned for number of widgets

Driver uses ARRAY_SIZE() to get number of widgets later passed to
snd_soc_dapm_new_controls(), which is an 'unsigned int'.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20240701-b4-qcom-audio-lpass-codec-cleanups-v3-5-6d98d4dd1ef5@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: dapm: Use unsigned for number of widgets in snd_soc_dapm_new_controls()
Krzysztof Kozlowski [Mon, 1 Jul 2024 07:39:36 +0000 (09:39 +0200)]
ASoC: dapm: Use unsigned for number of widgets in snd_soc_dapm_new_controls()

Number of widgets in array passed to snd_soc_dapm_new_controls() cannot
be negative, so make it explicit by using 'unsigned int', just like
snd_soc_add_component_controls() is doing.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20240701-b4-qcom-audio-lpass-codec-cleanups-v3-4-6d98d4dd1ef5@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: codecs: lpass-rx-macro: Keep static regmap_config as const
Krzysztof Kozlowski [Mon, 1 Jul 2024 07:39:35 +0000 (09:39 +0200)]
ASoC: codecs: lpass-rx-macro: Keep static regmap_config as const

The driver has static 'struct regmap_config', which is then customized
depending on device version.  This works fine, because there should not
be two devices in a system simultaneously and even less likely that such
two devices would have different versions, thus different regmap config.
However code is cleaner and more obvious when static data in the driver
is also const - it serves as a template.

Mark the 'struct regmap_config' as const and duplicate it in the probe()
with kmemdup to allow customizing per detected device variant.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20240701-b4-qcom-audio-lpass-codec-cleanups-v3-3-6d98d4dd1ef5@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: codecs: lpass-rx-macro: Simplify with cleanup.h
Krzysztof Kozlowski [Mon, 1 Jul 2024 07:39:34 +0000 (09:39 +0200)]
ASoC: codecs: lpass-rx-macro: Simplify with cleanup.h

Allocate the default register values array with scoped/cleanup.h to
reduce number of error paths and make code a bit simpler.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20240701-b4-qcom-audio-lpass-codec-cleanups-v3-2-6d98d4dd1ef5@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: codecs: lpass-rx-macro: Simplify PDS cleanup with devm
Krzysztof Kozlowski [Mon, 1 Jul 2024 07:39:33 +0000 (09:39 +0200)]
ASoC: codecs: lpass-rx-macro: Simplify PDS cleanup with devm

Eliminate PDS cleanup by using devm_add_action_or_reset() which results
in one less error path and smaller cleanup in remove().

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20240701-b4-qcom-audio-lpass-codec-cleanups-v3-1-6d98d4dd1ef5@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: tas5086: Convert to GPIO descriptors
Linus Walleij [Mon, 1 Jul 2024 07:02:12 +0000 (09:02 +0200)]
ASoC: tas5086: Convert to GPIO descriptors

Switch the driver to use GPIO descriptors.

Notice that we let the gpiolib handle line inversion for the
active low reset line (nreset !reset).

There are no upstream device trees using the tas5086 compatible
string, if there were, we would need to ascertain that they all
set the GPIO_ACTIVE_LOW flag on their GPIO lines.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patch.msgid.link/20240701-asoc-tas-gpios-v1-1-d69ec5d79939@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: wsa884x: Constify struct regmap_config
Javier Carrasco [Wed, 3 Jul 2024 16:21:05 +0000 (18:21 +0200)]
ASoC: wsa884x: Constify struct regmap_config

`wsa884x_regmap_config` is not modified and can be declared as const to
move its data to a read-only section.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20240703-sound-const-regmap_config-v1-9-2e379b0446a7@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: wsa883x: Constify struct regmap_config
Javier Carrasco [Wed, 3 Jul 2024 16:21:04 +0000 (18:21 +0200)]
ASoC: wsa883x: Constify struct regmap_config

`wsa883x_regmap_config` is not modified and can be declared as const to
move its data to a read-only section.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20240703-sound-const-regmap_config-v1-8-2e379b0446a7@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: wsa881x: Constify struct regmap_config
Javier Carrasco [Wed, 3 Jul 2024 16:21:03 +0000 (18:21 +0200)]
ASoC: wsa881x: Constify struct regmap_config

`wsa881x_regmap_config` is not modified and can be declared as const to
move its data to a read-only section.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20240703-sound-const-regmap_config-v1-7-2e379b0446a7@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: jz4770: Constify struct regmap_config
Javier Carrasco [Wed, 3 Jul 2024 16:21:02 +0000 (18:21 +0200)]
ASoC: jz4770: Constify struct regmap_config

`jz4760_codec_regmap_config` is not modified and can be declared as
const to move its data to a read-only section.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20240703-sound-const-regmap_config-v1-6-2e379b0446a7@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: jz4760: Constify struct regmap_config
Javier Carrasco [Wed, 3 Jul 2024 16:21:01 +0000 (18:21 +0200)]
ASoC: jz4760: Constify struct regmap_config

`jz4760_codec_regmap_config` is not modified and can be declared as
const to move its data to a read-only section.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20240703-sound-const-regmap_config-v1-5-2e379b0446a7@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: cs53l30: Constify struct regmap_config
Javier Carrasco [Wed, 3 Jul 2024 16:21:00 +0000 (18:21 +0200)]
ASoC: cs53l30: Constify struct regmap_config

`cs53l30_regmap` is not modified and can be declared as const to move
its data to a read-only section.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20240703-sound-const-regmap_config-v1-4-2e379b0446a7@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: cs35l36: Constify struct regmap_config
Javier Carrasco [Wed, 3 Jul 2024 16:20:59 +0000 (18:20 +0200)]
ASoC: cs35l36: Constify struct regmap_config

`cs35l36_regmap` is not modified and can be declared as const to move
its data to a read-only section.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20240703-sound-const-regmap_config-v1-3-2e379b0446a7@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: cs35l35: Constify struct regmap_config
Javier Carrasco [Wed, 3 Jul 2024 16:20:58 +0000 (18:20 +0200)]
ASoC: cs35l35: Constify struct regmap_config

`cs35l35_regmap` is not modified and can be declared as const to move
its data to a read-only section.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20240703-sound-const-regmap_config-v1-2-2e379b0446a7@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: cs35l34: Constify struct regmap_config
Javier Carrasco [Wed, 3 Jul 2024 16:20:57 +0000 (18:20 +0200)]
ASoC: cs35l34: Constify struct regmap_config

`cs35l34_regmap` is not modified and can be declared as const to move
its data to a read-only section.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://patch.msgid.link/20240703-sound-const-regmap_config-v1-1-2e379b0446a7@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: cs35l56: Set correct upper volume limit
Mark Brown [Wed, 3 Jul 2024 16:30:47 +0000 (17:30 +0100)]
ASoC: cs35l56: Set correct upper volume limit

Merge series from Richard Fitzgerald <rf@opensource.cirrus.com>:

These two commits set the upper limit of the Speaker Volume control
to +12dB instead of +100dB.

This should have been a simple 1-line change to the #define in the
header file, but only the HDA cs35l56 driver is using this define.
The ASoC cs35l56 driver was using hardcoded numbers instead of the
header defines.

So the first commit changes the ASoC driver to use the #defined
constants. The second commit corrects the value of the constant.

9 months agoASoC: fsl_xcvr: Improve suspend/resume flow in fsl_xcvr_trigger()
Chancel Liu [Fri, 28 Jun 2024 09:43:54 +0000 (18:43 +0900)]
ASoC: fsl_xcvr: Improve suspend/resume flow in fsl_xcvr_trigger()

In the current flow all interrupts are disabled in runtime suspend
phase. However interrupts enablement only exists in fsl_xcvr_prepare().
After resume fsl_xcvr_prepare() may not be called so it will cause all
interrupts still disabled even if resume from suspend. Interrupts
should be explictily enabled after resume.

Also, DPATH reset setting only exists in fsl_xcvr_prepare(). After
resume from suspend DPATH should be reset otherwise there'll be channel
swap issue.

Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Link: https://patch.msgid.link/20240628094354.780720-1-chancel.liu@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: cs35l56: Limit Speaker Volume to +12dB maximum
Richard Fitzgerald [Wed, 3 Jul 2024 09:55:17 +0000 (10:55 +0100)]
ASoC: cs35l56: Limit Speaker Volume to +12dB maximum

Change CS35L56_MAIN_RENDER_USER_VOLUME_MAX to 48, to limit the maximum
value of the Speaker Volume control to +12dB. The minimum value is
unchanged so that the default 0dB has the same integer control value.

The original maximum of 400 (+100dB) was the largest value that can be
mathematically handled by the DSP. The actual maximum amplification is
+12dB.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://patch.msgid.link/20240703095517.208077-3-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: cs35l56: Use header defines for Speaker Volume control definition
Richard Fitzgerald [Wed, 3 Jul 2024 09:55:16 +0000 (10:55 +0100)]
ASoC: cs35l56: Use header defines for Speaker Volume control definition

The "Speaker Volume" control was being defined using four hardcoded magic
numbers. There are #defines in the cs35l56.h header for these numbers, so
change the code to use the defined constants.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://patch.msgid.link/20240703095517.208077-2-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: tas2781: Use of_property_read_reg()
Rob Herring (Arm) [Tue, 2 Jul 2024 21:54:01 +0000 (15:54 -0600)]
ASoC: tas2781: Use of_property_read_reg()

Replace the open-coded parsing of "reg" with of_property_read_reg().
The #ifdef is also easily replaced with IS_ENABLED().

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://patch.msgid.link/20240702215402.839673-1-robh@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: PCM6240: Use of_property_read_reg()
Rob Herring (Arm) [Tue, 2 Jul 2024 21:53:49 +0000 (15:53 -0600)]
ASoC: PCM6240: Use of_property_read_reg()

Replace the open-coded parsing of "reg" with of_property_read_reg().
The #ifdef is also easily replaced with IS_ENABLED().

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://patch.msgid.link/20240702215349.839350-1-robh@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: topology: kcontrol registration cleanup
Mark Brown [Tue, 2 Jul 2024 20:32:07 +0000 (21:32 +0100)]
ASoC: topology: kcontrol registration cleanup

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

Code used to create standalone and widget controls is mostly same, with
with exception that in standalone case dynamic object needs to be
registered and control created directly.

Following patches clean up and unify kcontrol creation code in topology
code.

9 months agoAdd master clock handling for nau8824
Mark Brown [Tue, 2 Jul 2024 19:26:51 +0000 (20:26 +0100)]
Add master clock handling for nau8824

Merge series from Maxim Kochetkov <fido_max@inbox.ru>:

nau8824 has external MCLK pin. So add enable/disable external clock
management.

9 months agoASoC: dt-bindings: realtek,rt5645: Convert to dtschema
Animesh Agarwal [Tue, 2 Jul 2024 12:00:58 +0000 (17:30 +0530)]
ASoC: dt-bindings: realtek,rt5645: Convert to dtschema

Convert the RT5650/RT5645 audio CODEC bindings to DT schema.

Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Animesh Agarwal <animeshagarwal28@gmail.com>
Cc: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://patch.msgid.link/20240702120106.17100-1-animeshagarwal28@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: topology: Unify code for creating standalone and widget enum control
Amadeusz Sławiński [Thu, 27 Jun 2024 10:18:50 +0000 (12:18 +0200)]
ASoC: topology: Unify code for creating standalone and widget enum control

Code used to create standalone and widget enum control is same, with
exception that in standalone case dynamic object needs to be registered
and control created directly.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://patch.msgid.link/20240627101850.2191513-14-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: topology: Unify code for creating standalone and widget mixer control
Amadeusz Sławiński [Thu, 27 Jun 2024 10:18:49 +0000 (12:18 +0200)]
ASoC: topology: Unify code for creating standalone and widget mixer control

Code used to create standalone and widget mixer control is same, with
exception that in standalone case dynamic object needs to be registered
and control created directly.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://patch.msgid.link/20240627101850.2191513-13-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: topology: Unify code for creating standalone and widget bytes control
Amadeusz Sławiński [Thu, 27 Jun 2024 10:18:48 +0000 (12:18 +0200)]
ASoC: topology: Unify code for creating standalone and widget bytes control

Code used to create standalone and widget bytes control is same, with
exception that in standalone case dynamic object needs to be registered
and control created directly.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://patch.msgid.link/20240627101850.2191513-12-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: topology: Reshuffle function placement
Amadeusz Sławiński [Thu, 27 Jun 2024 10:18:47 +0000 (12:18 +0200)]
ASoC: topology: Reshuffle function placement

In preparation for following cleanups move functions around.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://patch.msgid.link/20240627101850.2191513-11-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: topology: Rename function creating widget kcontrol
Amadeusz Sławiński [Thu, 27 Jun 2024 10:18:46 +0000 (12:18 +0200)]
ASoC: topology: Rename function creating widget kcontrol

In following patches it will be reused to also create standalone
kcontrol, so it makes sense to name it in more generic way.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://patch.msgid.link/20240627101850.2191513-10-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: topology: Align dynamic object initialization for controls
Amadeusz Sławiński [Thu, 27 Jun 2024 10:18:45 +0000 (12:18 +0200)]
ASoC: topology: Align dynamic object initialization for controls

soc_tplg_dbytes_create() missed se->dobj.index initialization, so add it
there. Additionally separate dynamic object initialization into separate
logical block code.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://patch.msgid.link/20240627101850.2191513-9-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: topology: Correctly set shift_r in soc_tplg_denum_create()
Amadeusz Sławiński [Thu, 27 Jun 2024 10:18:44 +0000 (12:18 +0200)]
ASoC: topology: Correctly set shift_r in soc_tplg_denum_create()

This aligns soc_tplg_denum_create() with
soc_tplg_dapm_widget_denum_create(), as there is no reason for
difference in behavior.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://patch.msgid.link/20240627101850.2191513-8-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: topology: Cleanup soc_tplg_dapm_widget_denum_create
Amadeusz Sławiński [Thu, 27 Jun 2024 10:18:43 +0000 (12:18 +0200)]
ASoC: topology: Cleanup soc_tplg_dapm_widget_denum_create

Minor cleanups to increase readability.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://patch.msgid.link/20240627101850.2191513-7-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: topology: Cleanup soc_tplg_dapm_widget_dmixer_create
Amadeusz Sławiński [Thu, 27 Jun 2024 10:18:42 +0000 (12:18 +0200)]
ASoC: topology: Cleanup soc_tplg_dapm_widget_dmixer_create

Minor cleanups to increase readability.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://patch.msgid.link/20240627101850.2191513-6-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: topology: Cleanup soc_tplg_dapm_widget_dbytes_create
Amadeusz Sławiński [Thu, 27 Jun 2024 10:18:41 +0000 (12:18 +0200)]
ASoC: topology: Cleanup soc_tplg_dapm_widget_dbytes_create

Minor cleanups to increase readability.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://patch.msgid.link/20240627101850.2191513-5-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: topology: Properly initialize soc_enum values
Amadeusz Sławiński [Thu, 27 Jun 2024 10:18:40 +0000 (12:18 +0200)]
ASoC: topology: Properly initialize soc_enum values

soc_tplg_denum_create_values() should properly set its values field.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://patch.msgid.link/20240627101850.2191513-4-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: topology: Do not do unnecessary dobj management
Amadeusz Sławiński [Thu, 27 Jun 2024 10:18:39 +0000 (12:18 +0200)]
ASoC: topology: Do not do unnecessary dobj management

Widget kcontrols do not need to be managed as topology dynamic objects
with an index and a linked list. As they are always associated with a
widget which is already a topology dynamic object, thus all
addition/removals of a widget will by design manage the kcontrol.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://patch.msgid.link/20240627101850.2191513-3-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: topology: Simplify code
Amadeusz Sławiński [Thu, 27 Jun 2024 10:18:38 +0000 (12:18 +0200)]
ASoC: topology: Simplify code

Instead of using goto, when there is no controls, just do a loop when
there are. Overall the check seems to be a bit redundant as
num_kcontrols will only be above 0 if kcontrols are set anyway, but
let's keep it, while simplifying code.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://patch.msgid.link/20240627101850.2191513-2-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agofirmware: cs_dsp: Don't allow writes to read-only controls
Richard Fitzgerald [Tue, 2 Jul 2024 11:08:09 +0000 (12:08 +0100)]
firmware: cs_dsp: Don't allow writes to read-only controls

Add a check to cs_dsp_coeff_write_ctrl() to abort if the control
is not writeable.

The cs_dsp code originated as an ASoC driver (wm_adsp) where all
controls were exported as ALSA controls. It relied on ALSA to
enforce the read-only permission. Now that the code has been
separated from ALSA/ASoC it must perform its own permission check.

This isn't currently causing any problems so there shouldn't be any
need to backport this. If the client of cs_dsp exposes the control as
an ALSA control, it should set permissions on that ALSA control to
protect it. The few uses of cs_dsp_coeff_write_ctrl() inside drivers
are for writable controls.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://patch.msgid.link/20240702110809.16836-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: codecs: nau8824: Add master clock handling
Maxim Kochetkov [Mon, 1 Jul 2024 21:16:22 +0000 (00:16 +0300)]
ASoC: codecs: nau8824: Add master clock handling

Use master clock "mclk" if provided through device tree.

Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>
Link: https://patch.msgid.link/20240701211631.92384-3-fido_max@inbox.ru
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: dt-bindings: nau8824: Add master clock handling
Maxim Kochetkov [Mon, 1 Jul 2024 21:16:21 +0000 (00:16 +0300)]
ASoC: dt-bindings: nau8824: Add master clock handling

Use master clock "mclk" if provided through device tree.

Signed-off-by: Maxim Kochetkov <fido_max@inbox.ru>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20240701211631.92384-2-fido_max@inbox.ru
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: simple-audio-mux: add state-labels
Mark Brown [Tue, 2 Jul 2024 12:03:13 +0000 (13:03 +0100)]
ASoC: simple-audio-mux: add state-labels

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

simple-audio-mux is designed to be used generally, thus "Input 1" or
"Input 2" are used to selecting MUX input. This numbered inputs would work,
but might be not user friendly in some case, for example in case of system
hardware design has some clear labels.
Adds new "state-labels" property and enable to select MUX by own state names.

Original
> amixer set "MUX" "Input 1"
> amixer set "MUX" "Input 2"

Use mux-names
sound_mux: mux {
compatible = "simple-audio-mux";
mux-gpios = <...>;
=> state-labels = "Label_A", "Label_B";
};

> amixer set "MUX" "Label_A"
> amixer set "MUX" "Label_B"

9 months agoASoC: cs35l56: Remove obsolete and redundant code
Mark Brown [Tue, 2 Jul 2024 12:03:05 +0000 (13:03 +0100)]
ASoC: cs35l56: Remove obsolete and redundant code

Merge series from Richard Fitzgerald <rf@opensource.cirrus.com>:

These commits remove various code that is either no longer needed,
or is redundant.

9 months agoASoC: codecs: wsa88xx: add support for static port
Mark Brown [Tue, 2 Jul 2024 12:02:57 +0000 (13:02 +0100)]
ASoC: codecs: wsa88xx: add support for static port

Merge series from srinivas.kandagatla@linaro.org:

Existing way of allocating soundwire master ports on Qualcommm platforms is
dynamic, and in linear order starting from 1 to MAX_PORTS.
This will work as long as soundwire device ports are 1:1 mapped
linearly. However on most Qcom SoCs like SM8550, SM8650, x1e80100, these
are NOT mapped in that order.

The result of this is that only one speaker among the pair of speakers
is always silent, With recent changes for WSA codec to support codec
versions and along with these patches we are able to get all speakers
working on these SoCs.

9 months agoASoC: codecs: lpass-wsa-macro: Fix using NULL pointer in probe() dev_err
Krzysztof Kozlowski [Fri, 28 Jun 2024 09:58:31 +0000 (11:58 +0200)]
ASoC: codecs: lpass-wsa-macro: Fix using NULL pointer in probe() dev_err

The 'wsa->dev' is assigned closer to the end of the probe() function, so
the dev_err() must not use it - it is still NULL at this point.  Instead
there is already a local 'dev' variable.

Fixes: 727de4fbc546 ("ASoC: codecs: lpass-wsa-macro: Correct support for newer v2.5 version")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://patch.msgid.link/20240628095831.207942-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: codecs: lpass-rx-macro: Fix using NULL pointer in probe() dev_err
Krzysztof Kozlowski [Fri, 28 Jun 2024 09:58:30 +0000 (11:58 +0200)]
ASoC: codecs: lpass-rx-macro: Fix using NULL pointer in probe() dev_err

The 'rx->dev' is assigned closer to the end of the probe() function, so
the dev_err() must not use it - it is still NULL at this point.  Instead
there is already a local 'dev' variable.

Fixes: dbacef05898d ("ASoC: codec: lpass-rx-macro: prepare driver to accomdate new codec versions")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://patch.msgid.link/20240628095831.207942-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: fsl: lpc3xxx-i2s: Include bitfield.h for FIELD_PREP
Nathan Chancellor [Mon, 1 Jul 2024 18:26:38 +0000 (11:26 -0700)]
ASoC: fsl: lpc3xxx-i2s: Include bitfield.h for FIELD_PREP

bitfield.h is not explicitly included but it is required for FIELD_PREP
to be expanded by the preprocessor. If it is not implicitly included,
there will be a compiler error (as seen with ARCH=hexagon allmodconfig):

  sound/soc/fsl/lpc3xxx-i2s.c:169:10: error: call to undeclared function 'FIELD_PREP'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    169 |                 tmp |= LPC3XXX_I2S_WW8 | LPC3XXX_I2S_WS_HP(LPC3XXX_I2S_WW8_HP);
        |                        ^
  sound/soc/fsl/lpc3xxx-i2s.h:42:30: note: expanded from macro 'LPC3XXX_I2S_WW8'
     42 | #define LPC3XXX_I2S_WW8      FIELD_PREP(0x3, 0) /* Word width is 8bit */
        |                              ^
  sound/soc/fsl/lpc3xxx-i2s.c:205:34: error: call to undeclared function 'FIELD_PREP'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    205 |                              LPC3XXX_I2S_DMA1_TX_EN | LPC3XXX_I2S_DMA0_TX_DEPTH(4));
        |                                                       ^
  sound/soc/fsl/lpc3xxx-i2s.h:65:38: note: expanded from macro 'LPC3XXX_I2S_DMA0_TX_DEPTH'
     65 | #define LPC3XXX_I2S_DMA0_TX_DEPTH(s) FIELD_PREP(0xF0000, s) /* Set the DMA1 TX Request level */
        |                                      ^
  sound/soc/fsl/lpc3xxx-i2s.c:210:34: error: call to undeclared function 'FIELD_PREP'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    210 |                              LPC3XXX_I2S_DMA0_RX_EN | LPC3XXX_I2S_DMA1_RX_DEPTH(4));
        |                                                       ^
  sound/soc/fsl/lpc3xxx-i2s.h:70:38: note: expanded from macro 'LPC3XXX_I2S_DMA1_RX_DEPTH'
     70 | #define LPC3XXX_I2S_DMA1_RX_DEPTH(s) FIELD_PREP(0x700, s) /* Set the DMA1 RX Request level */
        |                                      ^

Include bitfield.h explicitly, so that FIELD_PREP is always expanded,
clearing up the compiler error.

Fixes: 0959de657a10 ("ASoC: fsl: Add i2s and pcm drivers for LPC32xx CPUs")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Link: https://patch.msgid.link/20240701-lpc32xx-asoc-fix-include-for-field_prep-v1-1-0c5d7f71921b@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: fsl: lpc3xxx-i2s: Avoid using ret uninitialized in lpc32xx_i2s_probe()
Nathan Chancellor [Mon, 1 Jul 2024 16:24:16 +0000 (09:24 -0700)]
ASoC: fsl: lpc3xxx-i2s: Avoid using ret uninitialized in lpc32xx_i2s_probe()

clang points out that ret may be used uninitialized in
lpc32xx_i2s_probe() in an error pointer path (which becomes fatal with
CONFIG_WERROR):

  sound/soc/fsl/lpc3xxx-i2s.c:326:47: error: variable 'ret' is uninitialized when used here [-Werror,-Wuninitialized]
    326 |                                      "failed to init register map: %d\n", ret);
        |                                                                           ^~~
  sound/soc/fsl/lpc3xxx-i2s.c:310:9: note: initialize the variable 'ret' to silence this warning
    310 |         int ret;
        |                ^
        |                 = 0
  1 error generated.

One solution would be a small refactoring of the second parameter in
dev_err_probe(), PTR_ERR(i2s_info_p->regs), to be the value of ret in
the if statement. However, a nicer solution for debugging purposes,
which is the point of this statement, would be to use the '%pe'
specifier to symbolically print the error pointer value. Do so, which
eliminates the uninitialized use of ret, clearing up the warning.

Fixes: 0959de657a10 ("ASoC: fsl: Add i2s and pcm drivers for LPC32xx CPUs")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Link: https://patch.msgid.link/20240701-lpc32xx-asoc-fix-uninitialized-ret-v1-1-985d86189739@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: dt-bindings: realtek,rt5677: Convert to dtschema
Animesh Agarwal [Thu, 27 Jun 2024 10:50:26 +0000 (16:20 +0530)]
ASoC: dt-bindings: realtek,rt5677: Convert to dtschema

Convert the RT5677 audio CODEC bindings to DT schema.

Signed-off-by: Animesh Agarwal <animeshagarwal28@gmail.com>
Cc: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://patch.msgid.link/20240627105030.14360-1-animeshagarwal28@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoc: tas2781: Add name_prefix as the prefix name of DSP firmwares and calibrated...
Shenghao Ding [Sat, 29 Jun 2024 10:11:10 +0000 (18:11 +0800)]
ASoc: tas2781: Add name_prefix as the prefix name of DSP firmwares and calibrated data files

Add name_prefix as the prefix name of DSP firmwares
and calibrated data files which stored speaker
calibrated impedance.

Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
Link: https://patch.msgid.link/20240629101112.628-1-shenghao-ding@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: codecs: wsa884x: parse port-mapping information
Srinivas Kandagatla [Thu, 27 Jun 2024 14:44:41 +0000 (15:44 +0100)]
ASoC: codecs: wsa884x: parse port-mapping information

Add support to parse static master port map information from device tree.
This is required for correct port mapping between soundwire device and
master ports.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Tested-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-HDK
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://patch.msgid.link/20240626-port-map-v2-4-6cc1c5608cdd@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: dt-bindings: wsa8840: Document port mapping property
Srinivas Kandagatla [Thu, 27 Jun 2024 14:44:40 +0000 (15:44 +0100)]
ASoC: dt-bindings: wsa8840: Document port mapping property

Document port mapping property for wsa884x. Port mapping is required
to be able map correct master ports.

All the device ports are not mapped in same order as master ports, so
there is a need for having static port mapping for WSA codecs.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-HDK
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://patch.msgid.link/20240626-port-map-v2-3-6cc1c5608cdd@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: codecs: wsa883x: parse port-mapping information
Srinivas Kandagatla [Thu, 27 Jun 2024 14:44:39 +0000 (15:44 +0100)]
ASoC: codecs: wsa883x: parse port-mapping information

Add support to parse static master port map information from device tree.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Tested-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-HDK
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://patch.msgid.link/20240626-port-map-v2-2-6cc1c5608cdd@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: dt-bindings: wsa883x: Document port mapping property
Manikantan R [Thu, 27 Jun 2024 14:44:38 +0000 (15:44 +0100)]
ASoC: dt-bindings: wsa883x: Document port mapping property

Document port mapping property for wsa883x. Port mapping is required
to be able map correct master ports for VI feedback.

All the device ports are not mapped in same order as master ports, so
there is a need for having static port mapping for WSA codecs.

Signed-off-by: Manikantan R <quic_manrav@quicinc.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-HDK
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://patch.msgid.link/20240626-port-map-v2-1-6cc1c5608cdd@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: dt-bindings: simple-audio-mux: add state-labels property
Kuninori Morimoto [Mon, 1 Jul 2024 00:38:59 +0000 (00:38 +0000)]
ASoC: dt-bindings: simple-audio-mux: add state-labels property

simple-audio-mux is designed to be used generally, thus "Input 1" or
"Input 2" are used to selecting MUX input. This numbered inputs would
work, but might be not user friendly in some case, for example in case
of system hardware design has some clear labels.
Adds new "state-labels" property and enable to select MUX by own state
names.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/87le2m7xp8.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: simple-audio-mux: enable to select MUX names
Kuninori Morimoto [Mon, 1 Jul 2024 00:38:51 +0000 (00:38 +0000)]
ASoC: simple-audio-mux: enable to select MUX names

simple-audio-mux is designed to be used generally, thus "Input 1" or
"Input 2" are used to selecting MUX input. This numbered inputs would
work, but might be not user friendly in some case, for example in case
of system hardware design has some clear labels.
Adds new "state-labels" property and enable to select MUX by own state
names.

Original
> amixer set "MUX" "Input 1"

Use mux-names
sound_mux: mux {
compatible = "simple-audio-mux";
mux-gpios = <...>;
state-labels = "Label_A", "Label_B";
};

> amixer set "MUX" "Label_A"

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/87msn27xpg.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: dt-bindings: realtek,rt5659: Convert to dtschema
Animesh Agarwal [Mon, 24 Jun 2024 13:29:44 +0000 (18:59 +0530)]
ASoC: dt-bindings: realtek,rt5659: Convert to dtschema

Convert the RT5659/RT5658 audio CODEC bindings to DT schema.

Signed-off-by: Animesh Agarwal <animeshagarwal28@gmail.com>
Cc: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://patch.msgid.link/20240624132949.124228-1-animeshagarwal28@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: fsl_rpmsg: Add support for i.MX95 platform
Chancel Liu [Wed, 26 Jun 2024 07:12:02 +0000 (16:12 +0900)]
ASoC: fsl_rpmsg: Add support for i.MX95 platform

Add compatible string and specific soc data to support rpmsg sound card
on i.MX95 platform.

Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Link: https://patch.msgid.link/20240626071202.7149-2-chancel.liu@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: dt-bindings: fsl_rpmsg: Add compatible string for i.MX95
Chancel Liu [Wed, 26 Jun 2024 07:12:01 +0000 (16:12 +0900)]
ASoC: dt-bindings: fsl_rpmsg: Add compatible string for i.MX95

Add compatible string for i.MX95 platform which supports audio
function through rpmsg channel between Cortex-A and Cortex-M core.

Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://patch.msgid.link/20240626071202.7149-1-chancel.liu@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: cs35l56: Remove redundant clearing of clk_stop_mode1
Richard Fitzgerald [Mon, 1 Jul 2024 10:44:44 +0000 (11:44 +0100)]
ASoC: cs35l56: Remove redundant clearing of clk_stop_mode1

struct sdw_slave_prop is zero-initialized by the SoundWire core so there
is no need to clear clk_stop_mode1 to false. Removing this also avoids
having an unnecessary build dependency on a struct member.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://patch.msgid.link/20240701104444.172556-4-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: cs35l56: Remove support for A1 silicon
Richard Fitzgerald [Mon, 1 Jul 2024 10:44:43 +0000 (11:44 +0100)]
ASoC: cs35l56: Remove support for A1 silicon

No product was ever released with A1 silicon so there is no
need for the driver to include support for it.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://patch.msgid.link/20240701104444.172556-3-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
9 months agoASoC: cs35l56: Revert support for dual-ownership of ASP registers
Richard Fitzgerald [Mon, 1 Jul 2024 10:44:42 +0000 (11:44 +0100)]
ASoC: cs35l56: Revert support for dual-ownership of ASP registers

This patch reverts a series of commits that allowed for the ASP
registers to be owned by either the driver or the firmware. Nothing
currently depends on the functionality that is being reverted, so
it is safe to remove.

The commits being reverted are (last 3 are bugfixes to the first 2):
commit 72a77d7631c6
("ASoC: cs35l56: Fix to ensure ASP1 registers match cache")
commit 07f7d6e7a124
("ASoC: cs35l56: Fix for initializing ASP1 mixer registers")
commit 4703b014f28b
("ASoC: cs35l56: fix reversed if statement in cs35l56_dspwait_asp1tx_put()")
commit c14f09f010cc
("ASoC: cs35l56: Fix deadlock in ASP1 mixer register initialization")
commit dfd2ffb37399
("ASoC: cs35l56: Prevent overwriting firmware ASP config")

These reverts have been squashed into a single commit because there
would be no reason to revert only some of them (which would just
reintroduce bugs).

The changes introduced by the commits were well-intentioned but
somewhat misguided. ACPI does not provide any information about how
audio hardware is linked together, so that information has to be
hardcoded into drivers. On Windows the firmware is customized to
statically setup appropriate configuration of the audio links,
and the intent of the commits was to re-use this information if the
Linux host drivers aren't taking control of the ASP. This would
avoid having to hardcode the ASP config into the machine driver on
some systems.

However, this added complexity and race conditions into the driver.
It also complicates implementation of new code.

The only case where the ASP is used but the host is not taking
ownership is when CS35L56 is used in SoundWire mode with the ASP
as a reference audio interconnect. But even in that case it's not
necessarily required even if the firmware initialized it. Typically
it is used to avoid the host SDCA drivers having to be capable of
aggregating capture paths from multiple SoundWire peripherals. But
the SOF SoundWire support is capable of doing that aggregation.

Reverting all these commits significantly simplifies the driver.
Let's just use the normal Linux mechanisms of the machine driver and
ALSA controls to set things up instead of trying to use the firmware
to do use-case setup.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://patch.msgid.link/20240701104444.172556-2-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>