linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv5 0/9] ASoC: fsl-asoc-card: add S/PDIF controller
@ 2024-06-20 13:25 Elinor Montmasson
  2024-06-20 13:25 ` [PATCHv5 1/9] ASoC: fsl-asoc-card: set priv->pdev before using it Elinor Montmasson
                   ` (9 more replies)
  0 siblings, 10 replies; 21+ messages in thread
From: Elinor Montmasson @ 2024-06-20 13:25 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Shawn Guo, Sascha Hauer, Fabio Estevam,
	Russell King, Catalin Marinas, Will Deacon, Jaroslav Kysela,
	Takashi Iwai, Shengjiu Wang, Xiubo Li, Nicolin Chen
  Cc: devicetree, alsa-devel, imx, linux-kernel, linux-sound,
	Elinor Montmasson, Philip-Dylan, Pengutronix Kernel Team,
	linuxppc-dev, linux-arm-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=quoted-printable, Size: 7638 bytes --]

Hello,

This is the v5 of the 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 patch fixes a NULL pointer dereference in `fsl-asoc-card`
which occurs when the function "fsl_asoc_card_audmux_init()" prints
error logs.

The next 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.
This 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 fifth 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 some DT properties have to
be updated in device trees to match those of `fsl-asoc-card`:
* "spdif-controller" is now "audio-cpu" in `fsl-asoc-card`.
* "spdif-in" and "spdif-out" are now replaced by the "audio-codec"
  property of `fsl-asoc-card`. S/PDIF specific dummy codecs should be
  used with `fsl-asoc-card`, and therefore declared in device trees.

The last four patches update the device tree bindings of
`fsl-asoc-card`, remove the now obsolete binding of `imx-spdif`, and
update all device trees using the `fsl,imx-audio-spdif` compatible.

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 19th of June
2024.
These modifications have also been tested on an i.MX8MN evaluation board
with a linux kernel RT v6.1.26-rt8.

If you have any questions or remarks about these commits, don't hesitate
to reply to this message.

Best regards,
Elinor Montmasson

Changelog:
v4 -> v5:
* Focus the contribution to bringing S/PDIF / ASRC support.
* Instead of creating a new compatible for the S/PDIF `fsl-asoc-card`
  support, merge the driver `imx-spdif` into `fsl-asoc-card`, and keep
  the compatible. It preserves the base S/PDIF audio card support but
  also extends it with the possibility to use an ASRC.
  It also reduces code and driver duplication.
* Following driver merge, adapt device trees using "fsl,imx-audio-spdif"
  compatible. 
* Use more `for_each_codecs` macros in `fsl-asoc-card` when adding
  multi-codec support.
* Remove patches about new device-tree bindings that were not relevant
  for an S/PDIF specific support.
* Improve DT schema changes.
* Move `priv->pdev` assignment earlier in "fsl_asoc_card_probe()" to fix
  a NULL pointer dereference in "fsl_asoc_card_audmux_init()".
* v4 patch series at :
https://lore.kernel.org/all/20240515135411.343333-1-elinor.montmasson@savoirfairelinux.com/

v3 -> v4:
* Use the standard TDM bidings, as defined in "tdm-slot.txt", for the
  new optional DT bindings setting the TDM slots number and width.
* Use the clock DT bindings to optionally specify the CPU DAI system
  clock frequency, instead of a dedicated new binding.
* Rename the new DT binding "cpu-sysclk-dir-out" to
  "cpu-system-clock-direction-out" to better follow the style of the
  simple-card driver.
* Merge TX an RX bindings for CPU DAI system-clock, to better follow the
  style of the simple-card driver, and also as there was no use case in
  fsl-asoc-card where TX and RX settings had to be different.
* Add the documentation for the new bindings in the new DT schema
  bindings documentation. Also add an example with the generic codec.
* v3 patch series at :
https://lore.kernel.org/alsa-devel/20231218124058.2047167-1-elinor.montmasson@savoirfairelinux.com/

v2 -> v3:
* When the bitmaster or framemaster are retrieved from the device tree,
  the driver will now compare them with the two codecs possibly given in
  device tree, and not just the first codec.
* Improve driver modifications to use multiple codecs for better
  integration of future multi-codec use cases:
    * Use `for_each_codec` macros when possible.
    * `fsl_asoc_card_priv` struct now has 2 `codec_priv` as the driver
      can currently retrieve 2 codec phandles from the device tree.
* Fix subject of patch 10/10 to follow the style of the subsystem
* v2 patch series at:
https://lore.kernel.org/alsa-devel/20231027144734.3654829-1-elinor.montmasson@savoirfairelinux.com/

v1 -> v2:
* Replace use of the dummy codec by the pair of codecs spdif_receiver /
  spdif_transmitter.
* Adapt how dai links codecs are used to take into account the
  possibility for multiple codecs per link.
* Change compatible name.
* Adapt driver to be able to register two codecs given in the device
  tree.
* v1 patch series at:
https://lore.kernel.org/alsa-devel/20230901144550.520072-1-elinor.montmasson@savoirfairelinux.com/

Elinor Montmasson (9):
  ASoC: fsl-asoc-card: set priv->pdev before using it
  ASoC: fsl-asoc-card: add support for dai links with multiple codecs
  ASoC: fsl-asoc-card: add second dai link component for codecs
  ASoC: fsl-asoc-card: add compatibility to use 2 codecs in dai-links
  ASoC: fsl-asoc-card: merge spdif support from imx-spdif.c
  ASoC: dt-bindings: fsl-asoc-card: add compatible string for spdif
  ASoC: dt-bindings: imx-audio-spdif: remove binding
  arm64: dts: imx8m: update spdif sound card node properties
  ARM: dts: imx6: update spdif sound card node properties

 .../bindings/sound/fsl,imx-audio-spdif.yaml   |  66 ----
 .../bindings/sound/fsl-asoc-card.yaml         |  30 +-
 arch/arm/boot/dts/nxp/imx/imx6q-cm-fx6.dts    |  15 +-
 arch/arm/boot/dts/nxp/imx/imx6q-prti6q.dts    |  15 +-
 arch/arm/boot/dts/nxp/imx/imx6q-tbs2910.dts   |   9 +-
 arch/arm/boot/dts/nxp/imx/imx6qdl-apalis.dtsi |  15 +-
 .../arm/boot/dts/nxp/imx/imx6qdl-apf6dev.dtsi |   9 +-
 .../arm/boot/dts/nxp/imx/imx6qdl-colibri.dtsi |  15 +-
 .../arm/boot/dts/nxp/imx/imx6qdl-cubox-i.dtsi |   9 +-
 .../dts/nxp/imx/imx6qdl-hummingboard.dtsi     |   9 +-
 .../boot/dts/nxp/imx/imx6qdl-sabreauto.dtsi   |   9 +-
 .../boot/dts/nxp/imx/imx6qdl-wandboard.dtsi   |   9 +-
 .../arm/boot/dts/nxp/imx/imx6sx-sabreauto.dts |   9 +-
 arch/arm/boot/dts/nxp/imx/imx6sx-sdb.dtsi     |   9 +-
 arch/arm/configs/imx_v6_v7_defconfig          |   1 -
 arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi |  15 +-
 arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi |  15 +-
 arch/arm64/boot/dts/freescale/imx8mq-evk.dts  |  24 +-
 arch/arm64/configs/defconfig                  |   1 -
 sound/soc/fsl/Kconfig                         |  10 +-
 sound/soc/fsl/Makefile                        |   2 -
 sound/soc/fsl/fsl-asoc-card.c                 | 361 ++++++++++++------
 sound/soc/fsl/imx-spdif.c                     | 103 -----
 23 files changed, 408 insertions(+), 352 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/sound/fsl,imx-audio-spdif.yaml
 delete mode 100644 sound/soc/fsl/imx-spdif.c

-- 
2.34.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2024-06-24  9:25 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-20 13:25 [PATCHv5 0/9] ASoC: fsl-asoc-card: add S/PDIF controller Elinor Montmasson
2024-06-20 13:25 ` [PATCHv5 1/9] ASoC: fsl-asoc-card: set priv->pdev before using it Elinor Montmasson
2024-06-20 13:25 ` [PATCHv5 2/9] ASoC: fsl-asoc-card: add support for dai links with multiple codecs Elinor Montmasson
2024-06-20 13:25 ` [PATCHv5 3/9] ASoC: fsl-asoc-card: add second dai link component for codecs Elinor Montmasson
2024-06-20 13:25 ` [PATCHv5 4/9] ASoC: fsl-asoc-card: add compatibility to use 2 codecs in dai-links Elinor Montmasson
2024-06-20 13:25 ` [PATCHv5 5/9] ASoC: fsl-asoc-card: merge spdif support from imx-spdif.c Elinor Montmasson
2024-06-20 13:25 ` [PATCHv5 6/9] ASoC: dt-bindings: fsl-asoc-card: add compatible string for spdif Elinor Montmasson
2024-06-23 11:07   ` Krzysztof Kozlowski
2024-06-24  8:51     ` Elinor Montmasson
2024-06-24  8:56       ` Krzysztof Kozlowski
2024-06-20 13:25 ` [PATCHv5 7/9] ASoC: dt-bindings: imx-audio-spdif: remove binding Elinor Montmasson
2024-06-23 11:09   ` Krzysztof Kozlowski
2024-06-24  8:51     ` Elinor Montmasson
2024-06-24  8:55       ` Krzysztof Kozlowski
2024-06-24  9:18         ` Elinor Montmasson
2024-06-24  9:24           ` Krzysztof Kozlowski
2024-06-20 13:25 ` [PATCHv5 8/9] arm64: dts: imx8m: update spdif sound card node properties Elinor Montmasson
2024-06-23 11:10   ` Krzysztof Kozlowski
2024-06-24  8:51     ` Elinor Montmasson
2024-06-20 13:25 ` [PATCHv5 9/9] ARM: dts: imx6: " Elinor Montmasson
2024-06-21  0:06 ` (subset) [PATCHv5 0/9] ASoC: fsl-asoc-card: add S/PDIF controller Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).