* [PATCH v6 0/7] ASoC: fsl-asoc-card: add S/PDIF controller support
@ 2024-06-27 8:30 Elinor Montmasson
2024-06-27 8:30 ` [PATCH v6 1/7] ASoC: fsl-asoc-card: add support for dai links with multiple codecs Elinor Montmasson
` (7 more replies)
0 siblings, 8 replies; 12+ messages in thread
From: Elinor Montmasson @ 2024-06-27 8:30 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: 8519 bytes --]
Hello,
This is the v6 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 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.
If you have any questions or remarks about these commits, don't hesitate
to reply to this message.
Best regards,
Elinor Montmasson
Changelog:
v5 -> v6:
* Remove applied patch "ASoC: fsl-asoc-card: set priv->pdev before using
it".
* Add backward compatibility with `imx-spdif` DT properties.
* Squash removal of `imx-spdif.yaml` into patch updating
`fsl-asoc-card.yaml`.
* `fsl-asoc-card.yaml`: fix indentation, document use of compatible
"fsl,imx-audio-spdif" only with "fsl,imx-sabreauto-spdif" or
"fsl,imx6sx-sdb-spdif".
* Explain better in commit messages why there are new DT properties that
can be used with "fsl,imx-audio-spdif" and what are the benefits to
use them.
* v5 patch series at :
https://lore.kernel.org/all/20240620132511.4291-1-elinor.montmasson@savoirfairelinux.com/
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 (7):
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: update fsl-asoc-card bindings after imx-spdif merge
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 | 53 ++-
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 | 383 ++++++++++++------
sound/soc/fsl/imx-spdif.c | 103 -----
23 files changed, 453 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] 12+ messages in thread
* [PATCH v6 1/7] ASoC: fsl-asoc-card: add support for dai links with multiple codecs
2024-06-27 8:30 [PATCH v6 0/7] ASoC: fsl-asoc-card: add S/PDIF controller support Elinor Montmasson
@ 2024-06-27 8:30 ` Elinor Montmasson
2024-06-27 8:30 ` [PATCH v6 2/7] ASoC: fsl-asoc-card: add second dai link component for codecs Elinor Montmasson
` (6 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Elinor Montmasson @ 2024-06-27 8:30 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
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>
---
sound/soc/fsl/fsl-asoc-card.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c
index eb67689dcd6e..e8003fbc8092 100644
--- a/sound/soc/fsl/fsl-asoc-card.c
+++ b/sound/soc/fsl/fsl-asoc-card.c
@@ -542,6 +542,7 @@ static int fsl_asoc_card_late_probe(struct snd_soc_card *card)
static int fsl_asoc_card_probe(struct platform_device *pdev)
{
struct device_node *cpu_np, *codec_np, *asrc_np;
+ struct snd_soc_dai_link_component *codec_comp;
struct device_node *np = pdev->dev.of_node;
struct platform_device *asrc_pdev = NULL;
struct device_node *bitclkprovider = NULL;
@@ -552,6 +553,7 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
const char *codec_dai_name;
const char *codec_dev_name;
u32 asrc_fmt = 0;
+ int codec_idx;
u32 width;
int ret;
@@ -816,10 +818,10 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
/* Normal DAI Link */
priv->dai_link[0].cpus->of_node = cpu_np;
- priv->dai_link[0].codecs->dai_name = codec_dai_name;
+ priv->dai_link[0].codecs[0].dai_name = codec_dai_name;
if (!fsl_asoc_card_is_ac97(priv))
- priv->dai_link[0].codecs->of_node = codec_np;
+ priv->dai_link[0].codecs[0].of_node = codec_np;
else {
u32 idx;
@@ -830,11 +832,11 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
goto asrc_fail;
}
- priv->dai_link[0].codecs->name =
+ priv->dai_link[0].codecs[0].name =
devm_kasprintf(&pdev->dev, GFP_KERNEL,
"ac97-codec.%u",
(unsigned int)idx);
- if (!priv->dai_link[0].codecs->name) {
+ if (!priv->dai_link[0].codecs[0].name) {
ret = -ENOMEM;
goto asrc_fail;
}
@@ -848,10 +850,11 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
/* DPCM DAI Links only if ASRC exists */
priv->dai_link[1].cpus->of_node = asrc_np;
priv->dai_link[1].platforms->of_node = asrc_np;
- priv->dai_link[2].codecs->dai_name = codec_dai_name;
- priv->dai_link[2].codecs->of_node = codec_np;
- priv->dai_link[2].codecs->name =
- priv->dai_link[0].codecs->name;
+ for_each_link_codecs((&(priv->dai_link[2])), codec_idx, codec_comp) {
+ codec_comp->dai_name = priv->dai_link[0].codecs[codec_idx].dai_name;
+ codec_comp->of_node = priv->dai_link[0].codecs[codec_idx].of_node;
+ codec_comp->name = priv->dai_link[0].codecs[codec_idx].name;
+ }
priv->dai_link[2].cpus->of_node = cpu_np;
priv->dai_link[2].dai_fmt = priv->dai_fmt;
priv->card.num_links = 3;
--
2.34.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v6 2/7] ASoC: fsl-asoc-card: add second dai link component for codecs
2024-06-27 8:30 [PATCH v6 0/7] ASoC: fsl-asoc-card: add S/PDIF controller support Elinor Montmasson
2024-06-27 8:30 ` [PATCH v6 1/7] ASoC: fsl-asoc-card: add support for dai links with multiple codecs Elinor Montmasson
@ 2024-06-27 8:30 ` Elinor Montmasson
2024-06-27 8:31 ` [PATCH v6 3/7] ASoC: fsl-asoc-card: add compatibility to use 2 codecs in dai-links Elinor Montmasson
` (5 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Elinor Montmasson @ 2024-06-27 8:30 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
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>
---
sound/soc/fsl/fsl-asoc-card.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c
index e8003fbc8092..805e2030bde4 100644
--- a/sound/soc/fsl/fsl-asoc-card.c
+++ b/sound/soc/fsl/fsl-asoc-card.c
@@ -296,7 +296,7 @@ static int be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
SND_SOC_DAILINK_DEFS(hifi,
DAILINK_COMP_ARRAY(COMP_EMPTY()),
- DAILINK_COMP_ARRAY(COMP_EMPTY()),
+ DAILINK_COMP_ARRAY(COMP_EMPTY(), COMP_EMPTY()),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
SND_SOC_DAILINK_DEFS(hifi_fe,
@@ -306,7 +306,7 @@ SND_SOC_DAILINK_DEFS(hifi_fe,
SND_SOC_DAILINK_DEFS(hifi_be,
DAILINK_COMP_ARRAY(COMP_EMPTY()),
- DAILINK_COMP_ARRAY(COMP_EMPTY()));
+ DAILINK_COMP_ARRAY(COMP_EMPTY(), COMP_EMPTY()));
static const struct snd_soc_dai_link fsl_asoc_card_dai[] = {
/* Default ASoC DAI Link*/
@@ -622,6 +622,8 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
memcpy(priv->dai_link, fsl_asoc_card_dai,
sizeof(struct snd_soc_dai_link) * ARRAY_SIZE(priv->dai_link));
+ priv->dai_link[0].num_codecs = 1;
+ priv->dai_link[2].num_codecs = 1;
priv->card.dapm_routes = audio_map;
priv->card.num_dapm_routes = ARRAY_SIZE(audio_map);
--
2.34.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v6 3/7] ASoC: fsl-asoc-card: add compatibility to use 2 codecs in dai-links
2024-06-27 8:30 [PATCH v6 0/7] ASoC: fsl-asoc-card: add S/PDIF controller support Elinor Montmasson
2024-06-27 8:30 ` [PATCH v6 1/7] ASoC: fsl-asoc-card: add support for dai links with multiple codecs Elinor Montmasson
2024-06-27 8:30 ` [PATCH v6 2/7] ASoC: fsl-asoc-card: add second dai link component for codecs Elinor Montmasson
@ 2024-06-27 8:31 ` Elinor Montmasson
2024-06-27 8:31 ` [PATCH v6 4/7] ASoC: fsl-asoc-card: merge spdif support from imx-spdif.c Elinor Montmasson
` (4 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Elinor Montmasson @ 2024-06-27 8:31 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
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>
---
sound/soc/fsl/fsl-asoc-card.c | 279 ++++++++++++++++++++--------------
1 file changed, 161 insertions(+), 118 deletions(-)
diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c
index 805e2030bde4..87329731e02d 100644
--- a/sound/soc/fsl/fsl-asoc-card.c
+++ b/sound/soc/fsl/fsl-asoc-card.c
@@ -99,7 +99,7 @@ struct fsl_asoc_card_priv {
struct simple_util_jack hp_jack;
struct simple_util_jack mic_jack;
struct platform_device *pdev;
- struct codec_priv codec_priv;
+ struct codec_priv codec_priv[2];
struct cpu_priv cpu_priv;
struct snd_soc_card card;
u8 streams;
@@ -172,10 +172,12 @@ static int fsl_asoc_card_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct fsl_asoc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
- struct codec_priv *codec_priv = &priv->codec_priv;
+ struct codec_priv *codec_priv;
+ struct snd_soc_dai *codec_dai;
struct cpu_priv *cpu_priv = &priv->cpu_priv;
struct device *dev = rtd->card->dev;
unsigned int pll_out;
+ int codec_idx;
int ret;
priv->sample_rate = params_rate(params);
@@ -208,28 +210,32 @@ static int fsl_asoc_card_hw_params(struct snd_pcm_substream *substream,
}
/* Specific configuration for PLL */
- if (codec_priv->pll_id >= 0 && codec_priv->fll_id >= 0) {
- if (priv->sample_format == SNDRV_PCM_FORMAT_S24_LE)
- pll_out = priv->sample_rate * 384;
- else
- pll_out = priv->sample_rate * 256;
+ for_each_rtd_codec_dais(rtd, codec_idx, codec_dai) {
+ codec_priv = &priv->codec_priv[codec_idx];
- ret = snd_soc_dai_set_pll(snd_soc_rtd_to_codec(rtd, 0),
- codec_priv->pll_id,
- codec_priv->mclk_id,
- codec_priv->mclk_freq, pll_out);
- if (ret) {
- dev_err(dev, "failed to start FLL: %d\n", ret);
- goto fail;
- }
+ if (codec_priv->pll_id >= 0 && codec_priv->fll_id >= 0) {
+ if (priv->sample_format == SNDRV_PCM_FORMAT_S24_LE)
+ pll_out = priv->sample_rate * 384;
+ else
+ pll_out = priv->sample_rate * 256;
- ret = snd_soc_dai_set_sysclk(snd_soc_rtd_to_codec(rtd, 0),
- codec_priv->fll_id,
- pll_out, SND_SOC_CLOCK_IN);
+ ret = snd_soc_dai_set_pll(codec_dai,
+ codec_priv->pll_id,
+ codec_priv->mclk_id,
+ codec_priv->mclk_freq, pll_out);
+ if (ret) {
+ dev_err(dev, "failed to start FLL: %d\n", ret);
+ goto fail;
+ }
- if (ret && ret != -ENOTSUPP) {
- dev_err(dev, "failed to set SYSCLK: %d\n", ret);
- goto fail;
+ ret = snd_soc_dai_set_sysclk(codec_dai,
+ codec_priv->fll_id,
+ pll_out, SND_SOC_CLOCK_IN);
+
+ if (ret && ret != -ENOTSUPP) {
+ dev_err(dev, "failed to set SYSCLK: %d\n", ret);
+ goto fail;
+ }
}
}
@@ -244,28 +250,34 @@ static int fsl_asoc_card_hw_free(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct fsl_asoc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
- struct codec_priv *codec_priv = &priv->codec_priv;
+ struct codec_priv *codec_priv;
+ struct snd_soc_dai *codec_dai;
struct device *dev = rtd->card->dev;
+ int codec_idx;
int ret;
priv->streams &= ~BIT(substream->stream);
- if (!priv->streams && codec_priv->pll_id >= 0 && codec_priv->fll_id >= 0) {
- /* Force freq to be free_freq to avoid error message in codec */
- ret = snd_soc_dai_set_sysclk(snd_soc_rtd_to_codec(rtd, 0),
- codec_priv->mclk_id,
- codec_priv->free_freq,
- SND_SOC_CLOCK_IN);
- if (ret) {
- dev_err(dev, "failed to switch away from FLL: %d\n", ret);
- return ret;
- }
+ for_each_rtd_codec_dais(rtd, codec_idx, codec_dai) {
+ codec_priv = &priv->codec_priv[codec_idx];
- ret = snd_soc_dai_set_pll(snd_soc_rtd_to_codec(rtd, 0),
- codec_priv->pll_id, 0, 0, 0);
- if (ret && ret != -ENOTSUPP) {
- dev_err(dev, "failed to stop FLL: %d\n", ret);
- return ret;
+ if (!priv->streams && codec_priv->pll_id >= 0 && codec_priv->fll_id >= 0) {
+ /* Force freq to be free_freq to avoid error message in codec */
+ ret = snd_soc_dai_set_sysclk(codec_dai,
+ codec_priv->mclk_id,
+ codec_priv->free_freq,
+ SND_SOC_CLOCK_IN);
+ if (ret) {
+ dev_err(dev, "failed to switch away from FLL: %d\n", ret);
+ return ret;
+ }
+
+ ret = snd_soc_dai_set_pll(codec_dai,
+ codec_priv->pll_id, 0, 0, 0);
+ if (ret && ret != -ENOTSUPP) {
+ dev_err(dev, "failed to stop FLL: %d\n", ret);
+ return ret;
+ }
}
}
@@ -504,9 +516,10 @@ static int fsl_asoc_card_late_probe(struct snd_soc_card *card)
struct fsl_asoc_card_priv *priv = snd_soc_card_get_drvdata(card);
struct snd_soc_pcm_runtime *rtd = list_first_entry(
&card->rtd_list, struct snd_soc_pcm_runtime, list);
- struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
- struct codec_priv *codec_priv = &priv->codec_priv;
+ struct snd_soc_dai *codec_dai;
+ struct codec_priv *codec_priv;
struct device *dev = card->dev;
+ int codec_idx;
int ret;
if (fsl_asoc_card_is_ac97(priv)) {
@@ -526,32 +539,37 @@ static int fsl_asoc_card_late_probe(struct snd_soc_card *card)
return 0;
}
- ret = snd_soc_dai_set_sysclk(codec_dai, codec_priv->mclk_id,
- codec_priv->mclk_freq, SND_SOC_CLOCK_IN);
- if (ret && ret != -ENOTSUPP) {
- dev_err(dev, "failed to set sysclk in %s\n", __func__);
- return ret;
- }
+ for_each_rtd_codec_dais(rtd, codec_idx, codec_dai) {
+ codec_priv = &priv->codec_priv[codec_idx];
- if (!IS_ERR_OR_NULL(codec_priv->mclk))
- clk_prepare_enable(codec_priv->mclk);
+ ret = snd_soc_dai_set_sysclk(codec_dai, codec_priv->mclk_id,
+ codec_priv->mclk_freq, SND_SOC_CLOCK_IN);
+ if (ret && ret != -ENOTSUPP) {
+ dev_err(dev, "failed to set sysclk in %s\n", __func__);
+ return ret;
+ }
+
+ if (!IS_ERR_OR_NULL(codec_priv->mclk))
+ clk_prepare_enable(codec_priv->mclk);
+ }
return 0;
}
static int fsl_asoc_card_probe(struct platform_device *pdev)
{
- struct device_node *cpu_np, *codec_np, *asrc_np;
+ struct device_node *cpu_np, *asrc_np;
struct snd_soc_dai_link_component *codec_comp;
+ struct device_node *codec_np[2];
struct device_node *np = pdev->dev.of_node;
struct platform_device *asrc_pdev = NULL;
struct device_node *bitclkprovider = NULL;
struct device_node *frameprovider = NULL;
struct platform_device *cpu_pdev;
struct fsl_asoc_card_priv *priv;
- struct device *codec_dev = NULL;
- const char *codec_dai_name;
- const char *codec_dev_name;
+ struct device *codec_dev[2] = { NULL, NULL };
+ const char *codec_dai_name[2];
+ const char *codec_dev_name[2];
u32 asrc_fmt = 0;
int codec_idx;
u32 width;
@@ -580,21 +598,25 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
goto fail;
}
- codec_np = of_parse_phandle(np, "audio-codec", 0);
- if (codec_np) {
- struct platform_device *codec_pdev;
- struct i2c_client *codec_i2c;
+ codec_np[0] = of_parse_phandle(np, "audio-codec", 0);
+ codec_np[1] = of_parse_phandle(np, "audio-codec", 1);
- codec_i2c = of_find_i2c_device_by_node(codec_np);
- if (codec_i2c) {
- codec_dev = &codec_i2c->dev;
- codec_dev_name = codec_i2c->name;
- }
- if (!codec_dev) {
- codec_pdev = of_find_device_by_node(codec_np);
- if (codec_pdev) {
- codec_dev = &codec_pdev->dev;
- codec_dev_name = codec_pdev->name;
+ for (codec_idx = 0; codec_idx < 2; codec_idx++) {
+ if (codec_np[codec_idx]) {
+ struct platform_device *codec_pdev;
+ struct i2c_client *codec_i2c;
+
+ codec_i2c = of_find_i2c_device_by_node(codec_np[codec_idx]);
+ if (codec_i2c) {
+ codec_dev[codec_idx] = &codec_i2c->dev;
+ codec_dev_name[codec_idx] = codec_i2c->name;
+ }
+ if (!codec_dev[codec_idx]) {
+ codec_pdev = of_find_device_by_node(codec_np[codec_idx]);
+ if (codec_pdev) {
+ codec_dev[codec_idx] = &codec_pdev->dev;
+ codec_dev_name[codec_idx] = codec_pdev->name;
+ }
}
}
}
@@ -604,12 +626,14 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
asrc_pdev = of_find_device_by_node(asrc_np);
/* Get the MCLK rate only, and leave it controlled by CODEC drivers */
- if (codec_dev) {
- struct clk *codec_clk = clk_get(codec_dev, NULL);
+ for (codec_idx = 0; codec_idx < 2; codec_idx++) {
+ if (codec_dev[codec_idx]) {
+ struct clk *codec_clk = clk_get(codec_dev[codec_idx], NULL);
- if (!IS_ERR(codec_clk)) {
- priv->codec_priv.mclk_freq = clk_get_rate(codec_clk);
- clk_put(codec_clk);
+ if (!IS_ERR(codec_clk)) {
+ priv->codec_priv[codec_idx].mclk_freq = clk_get_rate(codec_clk);
+ clk_put(codec_clk);
+ }
}
}
@@ -629,31 +653,33 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
priv->card.num_dapm_routes = ARRAY_SIZE(audio_map);
priv->card.driver_name = DRIVER_NAME;
- priv->codec_priv.fll_id = -1;
- priv->codec_priv.pll_id = -1;
+ for (codec_idx = 0; codec_idx < 2; codec_idx++) {
+ priv->codec_priv[codec_idx].fll_id = -1;
+ priv->codec_priv[codec_idx].pll_id = -1;
+ }
/* Diversify the card configurations */
if (of_device_is_compatible(np, "fsl,imx-audio-cs42888")) {
- codec_dai_name = "cs42888";
- priv->cpu_priv.sysclk_freq[TX] = priv->codec_priv.mclk_freq;
- priv->cpu_priv.sysclk_freq[RX] = priv->codec_priv.mclk_freq;
+ codec_dai_name[0] = "cs42888";
+ priv->cpu_priv.sysclk_freq[TX] = priv->codec_priv[0].mclk_freq;
+ priv->cpu_priv.sysclk_freq[RX] = priv->codec_priv[0].mclk_freq;
priv->cpu_priv.sysclk_dir[TX] = SND_SOC_CLOCK_OUT;
priv->cpu_priv.sysclk_dir[RX] = SND_SOC_CLOCK_OUT;
priv->cpu_priv.slot_width = 32;
priv->dai_fmt |= SND_SOC_DAIFMT_CBC_CFC;
} else if (of_device_is_compatible(np, "fsl,imx-audio-cs427x")) {
- codec_dai_name = "cs4271-hifi";
- priv->codec_priv.mclk_id = CS427x_SYSCLK_MCLK;
+ codec_dai_name[0] = "cs4271-hifi";
+ priv->codec_priv[0].mclk_id = CS427x_SYSCLK_MCLK;
priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP;
} else if (of_device_is_compatible(np, "fsl,imx-audio-sgtl5000")) {
- codec_dai_name = "sgtl5000";
- priv->codec_priv.mclk_id = SGTL5000_SYSCLK;
+ codec_dai_name[0] = "sgtl5000";
+ priv->codec_priv[0].mclk_id = SGTL5000_SYSCLK;
priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP;
} else if (of_device_is_compatible(np, "fsl,imx-audio-tlv320aic32x4")) {
- codec_dai_name = "tlv320aic32x4-hifi";
+ codec_dai_name[0] = "tlv320aic32x4-hifi";
priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP;
} else if (of_device_is_compatible(np, "fsl,imx-audio-tlv320aic31xx")) {
- codec_dai_name = "tlv320dac31xx-hifi";
+ codec_dai_name[0] = "tlv320dac31xx-hifi";
priv->dai_fmt |= SND_SOC_DAIFMT_CBS_CFS;
priv->dai_link[1].dpcm_capture = 0;
priv->dai_link[2].dpcm_capture = 0;
@@ -662,23 +688,23 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
priv->card.dapm_routes = audio_map_tx;
priv->card.num_dapm_routes = ARRAY_SIZE(audio_map_tx);
} else if (of_device_is_compatible(np, "fsl,imx-audio-wm8962")) {
- codec_dai_name = "wm8962";
- priv->codec_priv.mclk_id = WM8962_SYSCLK_MCLK;
- priv->codec_priv.fll_id = WM8962_SYSCLK_FLL;
- priv->codec_priv.pll_id = WM8962_FLL;
+ codec_dai_name[0] = "wm8962";
+ priv->codec_priv[0].mclk_id = WM8962_SYSCLK_MCLK;
+ priv->codec_priv[0].fll_id = WM8962_SYSCLK_FLL;
+ priv->codec_priv[0].pll_id = WM8962_FLL;
priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP;
} else if (of_device_is_compatible(np, "fsl,imx-audio-wm8960")) {
- codec_dai_name = "wm8960-hifi";
- priv->codec_priv.fll_id = WM8960_SYSCLK_AUTO;
- priv->codec_priv.pll_id = WM8960_SYSCLK_AUTO;
+ codec_dai_name[0] = "wm8960-hifi";
+ priv->codec_priv[0].fll_id = WM8960_SYSCLK_AUTO;
+ priv->codec_priv[0].pll_id = WM8960_SYSCLK_AUTO;
priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP;
} else if (of_device_is_compatible(np, "fsl,imx-audio-ac97")) {
- codec_dai_name = "ac97-hifi";
+ codec_dai_name[0] = "ac97-hifi";
priv->dai_fmt = SND_SOC_DAIFMT_AC97;
priv->card.dapm_routes = audio_map_ac97;
priv->card.num_dapm_routes = ARRAY_SIZE(audio_map_ac97);
} else if (of_device_is_compatible(np, "fsl,imx-audio-mqs")) {
- codec_dai_name = "fsl-mqs-dai";
+ codec_dai_name[0] = "fsl-mqs-dai";
priv->dai_fmt = SND_SOC_DAIFMT_LEFT_J |
SND_SOC_DAIFMT_CBC_CFC |
SND_SOC_DAIFMT_NB_NF;
@@ -687,7 +713,7 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
priv->card.dapm_routes = audio_map_tx;
priv->card.num_dapm_routes = ARRAY_SIZE(audio_map_tx);
} else if (of_device_is_compatible(np, "fsl,imx-audio-wm8524")) {
- codec_dai_name = "wm8524-hifi";
+ codec_dai_name[0] = "wm8524-hifi";
priv->dai_fmt |= SND_SOC_DAIFMT_CBC_CFC;
priv->dai_link[1].dpcm_capture = 0;
priv->dai_link[2].dpcm_capture = 0;
@@ -695,32 +721,32 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
priv->card.dapm_routes = audio_map_tx;
priv->card.num_dapm_routes = ARRAY_SIZE(audio_map_tx);
} else if (of_device_is_compatible(np, "fsl,imx-audio-si476x")) {
- codec_dai_name = "si476x-codec";
+ codec_dai_name[0] = "si476x-codec";
priv->dai_fmt |= SND_SOC_DAIFMT_CBC_CFC;
priv->card.dapm_routes = audio_map_rx;
priv->card.num_dapm_routes = ARRAY_SIZE(audio_map_rx);
} else if (of_device_is_compatible(np, "fsl,imx-audio-wm8958")) {
- codec_dai_name = "wm8994-aif1";
+ codec_dai_name[0] = "wm8994-aif1";
priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP;
- priv->codec_priv.mclk_id = WM8994_FLL_SRC_MCLK1;
- priv->codec_priv.fll_id = WM8994_SYSCLK_FLL1;
- priv->codec_priv.pll_id = WM8994_FLL1;
- priv->codec_priv.free_freq = priv->codec_priv.mclk_freq;
+ priv->codec_priv[0].mclk_id = WM8994_FLL_SRC_MCLK1;
+ priv->codec_priv[0].fll_id = WM8994_SYSCLK_FLL1;
+ priv->codec_priv[0].pll_id = WM8994_FLL1;
+ priv->codec_priv[0].free_freq = priv->codec_priv[0].mclk_freq;
priv->card.dapm_routes = NULL;
priv->card.num_dapm_routes = 0;
} else if (of_device_is_compatible(np, "fsl,imx-audio-nau8822")) {
- codec_dai_name = "nau8822-hifi";
- priv->codec_priv.mclk_id = NAU8822_CLK_MCLK;
- priv->codec_priv.fll_id = NAU8822_CLK_PLL;
- priv->codec_priv.pll_id = NAU8822_CLK_PLL;
+ codec_dai_name[0] = "nau8822-hifi";
+ priv->codec_priv[0].mclk_id = NAU8822_CLK_MCLK;
+ priv->codec_priv[0].fll_id = NAU8822_CLK_PLL;
+ priv->codec_priv[0].pll_id = NAU8822_CLK_PLL;
priv->dai_fmt |= SND_SOC_DAIFMT_CBM_CFM;
- if (codec_dev)
- priv->codec_priv.mclk = devm_clk_get(codec_dev, NULL);
+ if (codec_dev[0])
+ priv->codec_priv[0].mclk = devm_clk_get(codec_dev[0], NULL);
} else if (of_device_is_compatible(np, "fsl,imx-audio-wm8904")) {
- codec_dai_name = "wm8904-hifi";
- priv->codec_priv.mclk_id = WM8904_FLL_MCLK;
- priv->codec_priv.fll_id = WM8904_CLK_FLL;
- priv->codec_priv.pll_id = WM8904_FLL_MCLK;
+ codec_dai_name[0] = "wm8904-hifi";
+ priv->codec_priv[0].mclk_id = WM8904_FLL_MCLK;
+ priv->codec_priv[0].fll_id = WM8904_CLK_FLL;
+ priv->codec_priv[0].pll_id = WM8904_FLL_MCLK;
priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP;
} else {
dev_err(&pdev->dev, "unknown Device Tree compatible\n");
@@ -732,18 +758,30 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
* Allow setting mclk-id from the device-tree node. Otherwise, the
* default value for each card configuration is used.
*/
- of_property_read_u32(np, "mclk-id", &priv->codec_priv.mclk_id);
+ for_each_link_codecs((&(priv->dai_link[0])), codec_idx, codec_comp) {
+ of_property_read_u32_index(np, "mclk-id", codec_idx,
+ &priv->codec_priv[codec_idx].mclk_id);
+ }
/* Format info from DT is optional. */
snd_soc_daifmt_parse_clock_provider_as_phandle(np, NULL, &bitclkprovider, &frameprovider);
if (bitclkprovider || frameprovider) {
unsigned int daifmt = snd_soc_daifmt_parse_format(np, NULL);
+ bool codec_bitclkprovider = false;
+ bool codec_frameprovider = false;
+
+ for_each_link_codecs((&(priv->dai_link[0])), codec_idx, codec_comp) {
+ if (bitclkprovider && codec_np[codec_idx] == bitclkprovider)
+ codec_bitclkprovider = true;
+ if (frameprovider && codec_np[codec_idx] == frameprovider)
+ codec_frameprovider = true;
+ }
- if (codec_np == bitclkprovider)
- daifmt |= (codec_np == frameprovider) ?
+ if (codec_bitclkprovider)
+ daifmt |= (codec_frameprovider) ?
SND_SOC_DAIFMT_CBP_CFP : SND_SOC_DAIFMT_CBP_CFC;
else
- daifmt |= (codec_np == frameprovider) ?
+ daifmt |= (codec_frameprovider) ?
SND_SOC_DAIFMT_CBC_CFP : SND_SOC_DAIFMT_CBC_CFC;
/* Override dai_fmt with value from DT */
@@ -759,7 +797,7 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
of_node_put(bitclkprovider);
of_node_put(frameprovider);
- if (!fsl_asoc_card_is_ac97(priv) && !codec_dev) {
+ if (!fsl_asoc_card_is_ac97(priv) && !codec_dev[0]) {
dev_dbg(&pdev->dev, "failed to find codec device\n");
ret = -EPROBE_DEFER;
goto asrc_fail;
@@ -798,7 +836,7 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
ret = snd_soc_of_parse_card_name(&priv->card, "model");
if (ret) {
snprintf(priv->name, sizeof(priv->name), "%s-audio",
- fsl_asoc_card_is_ac97(priv) ? "ac97" : codec_dev_name);
+ fsl_asoc_card_is_ac97(priv) ? "ac97" : codec_dev_name[0]);
priv->card.name = priv->name;
}
priv->card.dai_link = priv->dai_link;
@@ -820,11 +858,15 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
/* Normal DAI Link */
priv->dai_link[0].cpus->of_node = cpu_np;
- priv->dai_link[0].codecs[0].dai_name = codec_dai_name;
+ for_each_link_codecs((&(priv->dai_link[0])), codec_idx, codec_comp) {
+ codec_comp->dai_name = codec_dai_name[codec_idx];
+ }
- if (!fsl_asoc_card_is_ac97(priv))
- priv->dai_link[0].codecs[0].of_node = codec_np;
- else {
+ if (!fsl_asoc_card_is_ac97(priv)) {
+ for_each_link_codecs((&(priv->dai_link[0])), codec_idx, codec_comp) {
+ codec_comp->of_node = codec_np[codec_idx];
+ }
+ } else {
u32 idx;
ret = of_property_read_u32(cpu_np, "cell-index", &idx);
@@ -926,7 +968,8 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
asrc_fail:
of_node_put(asrc_np);
- of_node_put(codec_np);
+ of_node_put(codec_np[0]);
+ of_node_put(codec_np[1]);
put_device(&cpu_pdev->dev);
fail:
of_node_put(cpu_np);
--
2.34.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v6 4/7] ASoC: fsl-asoc-card: merge spdif support from imx-spdif.c
2024-06-27 8:30 [PATCH v6 0/7] ASoC: fsl-asoc-card: add S/PDIF controller support Elinor Montmasson
` (2 preceding siblings ...)
2024-06-27 8:31 ` [PATCH v6 3/7] ASoC: fsl-asoc-card: add compatibility to use 2 codecs in dai-links Elinor Montmasson
@ 2024-06-27 8:31 ` Elinor Montmasson
2024-06-27 8:31 ` [PATCH v6 5/7] ASoC: dt-bindings: update fsl-asoc-card bindings after imx-spdif merge Elinor Montmasson
` (3 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Elinor Montmasson @ 2024-06-27 8:31 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
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>
---
arch/arm/configs/imx_v6_v7_defconfig | 1 -
arch/arm64/configs/defconfig | 1 -
sound/soc/fsl/Kconfig | 10 +--
sound/soc/fsl/Makefile | 2 -
sound/soc/fsl/fsl-asoc-card.c | 85 +++++++++++++++++++++-
sound/soc/fsl/imx-spdif.c | 103 ---------------------------
6 files changed, 84 insertions(+), 118 deletions(-)
delete mode 100644 sound/soc/fsl/imx-spdif.c
diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig
index cf2480dce285..ac5ae621b2af 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -311,7 +311,6 @@ CONFIG_SND_IMX_SOC=y
CONFIG_SND_SOC_EUKREA_TLV320=y
CONFIG_SND_SOC_IMX_ES8328=y
CONFIG_SND_SOC_IMX_SGTL5000=y
-CONFIG_SND_SOC_IMX_SPDIF=y
CONFIG_SND_SOC_FSL_ASOC_CARD=y
CONFIG_SND_SOC_AC97_CODEC=y
CONFIG_SND_SOC_CS42XX8_I2C=y
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 57a9abe78ee4..a6c9688fee0e 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -940,7 +940,6 @@ CONFIG_SND_SOC_FSL_MICFIL=m
CONFIG_SND_SOC_FSL_EASRC=m
CONFIG_SND_IMX_SOC=m
CONFIG_SND_SOC_IMX_SGTL5000=m
-CONFIG_SND_SOC_IMX_SPDIF=m
CONFIG_SND_SOC_FSL_ASOC_CARD=m
CONFIG_SND_SOC_IMX_AUDMIX=m
CONFIG_SND_SOC_MT8183=m
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index 9a371d4496c2..e3b2bfb016c8 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -296,15 +296,6 @@ config SND_SOC_IMX_SGTL5000
SND_SOC_FSL_ASOC_CARD and SND_SOC_SGTL5000 to use the newer
driver.
-config SND_SOC_IMX_SPDIF
- tristate "SoC Audio support for i.MX boards with S/PDIF"
- select SND_SOC_IMX_PCM_DMA
- select SND_SOC_FSL_SPDIF
- help
- SoC Audio support for i.MX boards with S/PDIF
- Say Y if you want to add support for SoC audio on an i.MX board with
- a S/DPDIF.
-
config SND_SOC_FSL_ASOC_CARD
tristate "Generic ASoC Sound Card with ASRC support"
depends on OF && I2C
@@ -316,6 +307,7 @@ config SND_SOC_FSL_ASOC_CARD
select SND_SOC_FSL_ESAI
select SND_SOC_FSL_SAI
select SND_SOC_FSL_SSI
+ select SND_SOC_FSL_SPDIF
select SND_SOC_TLV320AIC31XX
select SND_SOC_WM8994
select MFD_WM8994
diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile
index 2fe78eed3a48..1ae181b24a88 100644
--- a/sound/soc/fsl/Makefile
+++ b/sound/soc/fsl/Makefile
@@ -65,7 +65,6 @@ obj-$(CONFIG_SND_SOC_IMX_PCM_RPMSG) += imx-pcm-rpmsg.o
snd-soc-eukrea-tlv320-y := eukrea-tlv320.o
snd-soc-imx-es8328-y := imx-es8328.o
snd-soc-imx-sgtl5000-y := imx-sgtl5000.o
-snd-soc-imx-spdif-y := imx-spdif.o
snd-soc-imx-audmix-y := imx-audmix.o
snd-soc-imx-hdmi-y := imx-hdmi.o
snd-soc-imx-rpmsg-y := imx-rpmsg.o
@@ -74,7 +73,6 @@ snd-soc-imx-card-y := imx-card.o
obj-$(CONFIG_SND_SOC_EUKREA_TLV320) += snd-soc-eukrea-tlv320.o
obj-$(CONFIG_SND_SOC_IMX_ES8328) += snd-soc-imx-es8328.o
obj-$(CONFIG_SND_SOC_IMX_SGTL5000) += snd-soc-imx-sgtl5000.o
-obj-$(CONFIG_SND_SOC_IMX_SPDIF) += snd-soc-imx-spdif.o
obj-$(CONFIG_SND_SOC_IMX_AUDMIX) += snd-soc-imx-audmix.o
obj-$(CONFIG_SND_SOC_IMX_HDMI) += snd-soc-imx-hdmi.o
obj-$(CONFIG_SND_SOC_IMX_RPMSG) += snd-soc-imx-rpmsg.o
diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c
index 87329731e02d..82df887b3af5 100644
--- a/sound/soc/fsl/fsl-asoc-card.c
+++ b/sound/soc/fsl/fsl-asoc-card.c
@@ -477,6 +477,75 @@ static int fsl_asoc_card_audmux_init(struct device_node *np,
return 0;
}
+static int fsl_asoc_card_spdif_init(struct device_node *codec_np[],
+ struct device_node *cpu_np,
+ const char *codec_dai_name[],
+ struct fsl_asoc_card_priv *priv)
+{
+ struct device *dev = &priv->pdev->dev;
+ struct device_node *np = dev->of_node;
+
+ if (!of_node_name_eq(cpu_np, "spdif")) {
+ dev_err(dev, "CPU phandle invalid, should be an SPDIF device\n");
+ return -EINVAL;
+ }
+
+ priv->dai_link[0].playback_only = true;
+ priv->dai_link[0].capture_only = true;
+
+ for (int i = 0; i < 2; i++) {
+ if (!codec_np[i])
+ break;
+
+ if (of_device_is_compatible(codec_np[i], "linux,spdif-dit")) {
+ priv->dai_link[0].capture_only = false;
+ codec_dai_name[i] = "dit-hifi";
+ } else if (of_device_is_compatible(codec_np[i], "linux,spdif-dir")) {
+ priv->dai_link[0].playback_only = false;
+ codec_dai_name[i] = "dir-hifi";
+ }
+ }
+
+ // Old SPDIF DT binding
+ if (!codec_np[0]) {
+ codec_dai_name[0] = snd_soc_dummy_dlc.dai_name;
+ if (of_property_read_bool(np, "spdif-out"))
+ priv->dai_link[0].capture_only = false;
+ if (of_property_read_bool(np, "spdif-in"))
+ priv->dai_link[0].playback_only = false;
+ }
+
+ if (priv->dai_link[0].playback_only && priv->dai_link[0].capture_only) {
+ dev_err(dev, "no enabled S/PDIF DAI link\n");
+ return -EINVAL;
+ }
+
+ if (priv->dai_link[0].playback_only) {
+ priv->dai_link[1].dpcm_capture = false;
+ priv->dai_link[2].dpcm_capture = false;
+ priv->card.dapm_routes = audio_map_tx;
+ priv->card.num_dapm_routes = ARRAY_SIZE(audio_map_tx);
+ } else if (priv->dai_link[0].capture_only) {
+ priv->dai_link[1].dpcm_playback = false;
+ priv->dai_link[2].dpcm_playback = false;
+ priv->card.dapm_routes = audio_map_rx;
+ priv->card.num_dapm_routes = ARRAY_SIZE(audio_map_rx);
+ }
+
+ // No DAPM routes with old bindings and dummy codec
+ if (!codec_np[0]) {
+ priv->card.dapm_routes = NULL;
+ priv->card.num_dapm_routes = 0;
+ }
+
+ if (codec_np[0] && codec_np[1]) {
+ priv->dai_link[0].num_codecs = 2;
+ priv->dai_link[2].num_codecs = 2;
+ }
+
+ return 0;
+}
+
static int hp_jack_event(struct notifier_block *nb, unsigned long event,
void *data)
{
@@ -582,9 +651,11 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
priv->pdev = pdev;
cpu_np = of_parse_phandle(np, "audio-cpu", 0);
- /* Give a chance to old DT binding */
+ /* Give a chance to old DT bindings */
if (!cpu_np)
cpu_np = of_parse_phandle(np, "ssi-controller", 0);
+ if (!cpu_np)
+ cpu_np = of_parse_phandle(np, "spdif-controller", 0);
if (!cpu_np) {
dev_err(&pdev->dev, "CPU phandle missing or invalid\n");
ret = -EINVAL;
@@ -748,6 +819,10 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
priv->codec_priv[0].fll_id = WM8904_CLK_FLL;
priv->codec_priv[0].pll_id = WM8904_FLL_MCLK;
priv->dai_fmt |= SND_SOC_DAIFMT_CBP_CFP;
+ } else if (of_device_is_compatible(np, "fsl,imx-audio-spdif")) {
+ ret = fsl_asoc_card_spdif_init(codec_np, cpu_np, codec_dai_name, priv);
+ if (ret)
+ goto asrc_fail;
} else {
dev_err(&pdev->dev, "unknown Device Tree compatible\n");
ret = -EINVAL;
@@ -797,7 +872,8 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
of_node_put(bitclkprovider);
of_node_put(frameprovider);
- if (!fsl_asoc_card_is_ac97(priv) && !codec_dev[0]) {
+ if (!fsl_asoc_card_is_ac97(priv) && !codec_dev[0]
+ && codec_dai_name[0] != snd_soc_dummy_dlc.dai_name) {
dev_dbg(&pdev->dev, "failed to find codec device\n");
ret = -EPROBE_DEFER;
goto asrc_fail;
@@ -862,6 +938,10 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
codec_comp->dai_name = codec_dai_name[codec_idx];
}
+ // Old SPDIF DT binding support
+ if (codec_dai_name[0] == snd_soc_dummy_dlc.dai_name)
+ priv->dai_link[0].codecs[0].name = snd_soc_dummy_dlc.name;
+
if (!fsl_asoc_card_is_ac97(priv)) {
for_each_link_codecs((&(priv->dai_link[0])), codec_idx, codec_comp) {
codec_comp->of_node = codec_np[codec_idx];
@@ -992,6 +1072,7 @@ static const struct of_device_id fsl_asoc_card_dt_ids[] = {
{ .compatible = "fsl,imx-audio-wm8958", },
{ .compatible = "fsl,imx-audio-nau8822", },
{ .compatible = "fsl,imx-audio-wm8904", },
+ { .compatible = "fsl,imx-audio-spdif", },
{}
};
MODULE_DEVICE_TABLE(of, fsl_asoc_card_dt_ids);
diff --git a/sound/soc/fsl/imx-spdif.c b/sound/soc/fsl/imx-spdif.c
deleted file mode 100644
index 1e57939a7e29..000000000000
--- a/sound/soc/fsl/imx-spdif.c
+++ /dev/null
@@ -1,103 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-//
-// Copyright (C) 2013 Freescale Semiconductor, Inc.
-
-#include <linux/module.h>
-#include <linux/of_platform.h>
-#include <sound/soc.h>
-
-struct imx_spdif_data {
- struct snd_soc_dai_link dai;
- struct snd_soc_card card;
-};
-
-static int imx_spdif_audio_probe(struct platform_device *pdev)
-{
- struct device_node *spdif_np, *np = pdev->dev.of_node;
- struct imx_spdif_data *data;
- struct snd_soc_dai_link_component *comp;
- int ret = 0;
-
- spdif_np = of_parse_phandle(np, "spdif-controller", 0);
- if (!spdif_np) {
- dev_err(&pdev->dev, "failed to find spdif-controller\n");
- ret = -EINVAL;
- goto end;
- }
-
- data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
- comp = devm_kzalloc(&pdev->dev, sizeof(*comp), GFP_KERNEL);
- if (!data || !comp) {
- ret = -ENOMEM;
- goto end;
- }
-
- /*
- * CPU == Platform
- * platform is using soc-generic-dmaengine-pcm
- */
- data->dai.cpus =
- data->dai.platforms = comp;
- data->dai.codecs = &snd_soc_dummy_dlc;
-
- data->dai.num_cpus = 1;
- data->dai.num_codecs = 1;
- data->dai.num_platforms = 1;
-
- data->dai.name = "S/PDIF PCM";
- data->dai.stream_name = "S/PDIF PCM";
- data->dai.cpus->of_node = spdif_np;
- data->dai.playback_only = true;
- data->dai.capture_only = true;
-
- if (of_property_read_bool(np, "spdif-out"))
- data->dai.capture_only = false;
-
- if (of_property_read_bool(np, "spdif-in"))
- data->dai.playback_only = false;
-
- if (data->dai.playback_only && data->dai.capture_only) {
- dev_err(&pdev->dev, "no enabled S/PDIF DAI link\n");
- goto end;
- }
-
- data->card.dev = &pdev->dev;
- data->card.dai_link = &data->dai;
- data->card.num_links = 1;
- data->card.owner = THIS_MODULE;
-
- ret = snd_soc_of_parse_card_name(&data->card, "model");
- if (ret)
- goto end;
-
- ret = devm_snd_soc_register_card(&pdev->dev, &data->card);
- if (ret)
- dev_err_probe(&pdev->dev, ret, "snd_soc_register_card failed\n");
-
-end:
- of_node_put(spdif_np);
-
- return ret;
-}
-
-static const struct of_device_id imx_spdif_dt_ids[] = {
- { .compatible = "fsl,imx-audio-spdif", },
- { /* sentinel */ }
-};
-MODULE_DEVICE_TABLE(of, imx_spdif_dt_ids);
-
-static struct platform_driver imx_spdif_driver = {
- .driver = {
- .name = "imx-spdif",
- .pm = &snd_soc_pm_ops,
- .of_match_table = imx_spdif_dt_ids,
- },
- .probe = imx_spdif_audio_probe,
-};
-
-module_platform_driver(imx_spdif_driver);
-
-MODULE_AUTHOR("Freescale Semiconductor, Inc.");
-MODULE_DESCRIPTION("Freescale i.MX S/PDIF machine driver");
-MODULE_LICENSE("GPL v2");
-MODULE_ALIAS("platform:imx-spdif");
--
2.34.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v6 5/7] ASoC: dt-bindings: update fsl-asoc-card bindings after imx-spdif merge
2024-06-27 8:30 [PATCH v6 0/7] ASoC: fsl-asoc-card: add S/PDIF controller support Elinor Montmasson
` (3 preceding siblings ...)
2024-06-27 8:31 ` [PATCH v6 4/7] ASoC: fsl-asoc-card: merge spdif support from imx-spdif.c Elinor Montmasson
@ 2024-06-27 8:31 ` Elinor Montmasson
2024-07-08 14:47 ` Rob Herring (Arm)
2024-06-27 8:31 ` [PATCH v6 6/7] arm64: dts: imx8m: update spdif sound card node properties Elinor Montmasson
` (2 subsequent siblings)
7 siblings, 1 reply; 12+ messages in thread
From: Elinor Montmasson @ 2024-06-27 8:31 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
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>
---
.../bindings/sound/fsl,imx-audio-spdif.yaml | 66 -------------------
.../bindings/sound/fsl-asoc-card.yaml | 53 +++++++++++++--
2 files changed, 49 insertions(+), 70 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/sound/fsl,imx-audio-spdif.yaml
diff --git a/Documentation/devicetree/bindings/sound/fsl,imx-audio-spdif.yaml b/Documentation/devicetree/bindings/sound/fsl,imx-audio-spdif.yaml
deleted file mode 100644
index 5fc543d02ecb..000000000000
--- a/Documentation/devicetree/bindings/sound/fsl,imx-audio-spdif.yaml
+++ /dev/null
@@ -1,66 +0,0 @@
-# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
-%YAML 1.2
----
-$id: http://devicetree.org/schemas/sound/fsl,imx-audio-spdif.yaml#
-$schema: http://devicetree.org/meta-schemas/core.yaml#
-
-title: Freescale i.MX audio complex with S/PDIF transceiver
-
-maintainers:
- - Shengjiu Wang <shengjiu.wang@nxp.com>
-
-properties:
- compatible:
- oneOf:
- - items:
- - enum:
- - fsl,imx-sabreauto-spdif
- - fsl,imx6sx-sdb-spdif
- - const: fsl,imx-audio-spdif
- - enum:
- - fsl,imx-audio-spdif
-
- model:
- $ref: /schemas/types.yaml#/definitions/string
- description: User specified audio sound card name
-
- spdif-controller:
- $ref: /schemas/types.yaml#/definitions/phandle
- description: The phandle of the i.MX S/PDIF controller
-
- spdif-out:
- type: boolean
- description:
- If present, the transmitting function of S/PDIF will be enabled,
- indicating there's a physical S/PDIF out connector or jack on the
- board or it's connecting to some other IP block, such as an HDMI
- encoder or display-controller.
-
- spdif-in:
- type: boolean
- description:
- If present, the receiving function of S/PDIF will be enabled,
- indicating there is a physical S/PDIF in connector/jack on the board.
-
-required:
- - compatible
- - model
- - spdif-controller
-
-anyOf:
- - required:
- - spdif-in
- - required:
- - spdif-out
-
-additionalProperties: false
-
-examples:
- - |
- sound-spdif {
- compatible = "fsl,imx-audio-spdif";
- model = "imx-spdif";
- spdif-controller = <&spdif>;
- spdif-out;
- spdif-in;
- };
diff --git a/Documentation/devicetree/bindings/sound/fsl-asoc-card.yaml b/Documentation/devicetree/bindings/sound/fsl-asoc-card.yaml
index 9922664d5ccc..92aa47ec72c7 100644
--- a/Documentation/devicetree/bindings/sound/fsl-asoc-card.yaml
+++ b/Documentation/devicetree/bindings/sound/fsl-asoc-card.yaml
@@ -65,6 +65,11 @@ properties:
- fsl,imx-audio-sgtl5000
- fsl,imx-audio-wm8960
- fsl,imx-audio-wm8962
+ - items:
+ - enum:
+ - fsl,imx-sabreauto-spdif
+ - fsl,imx6sx-sdb-spdif
+ - const: fsl,imx-audio-spdif
- items:
- enum:
- fsl,imx-audio-ac97
@@ -81,6 +86,7 @@ properties:
- fsl,imx-audio-wm8960
- fsl,imx-audio-wm8962
- fsl,imx-audio-wm8958
+ - fsl,imx-audio-spdif
model:
$ref: /schemas/types.yaml#/definitions/string
@@ -93,8 +99,15 @@ properties:
need to add ASRC support via DPCM.
audio-codec:
- $ref: /schemas/types.yaml#/definitions/phandle
- description: The phandle of an audio codec
+ $ref: /schemas/types.yaml#/definitions/phandle-array
+ description: |
+ The phandle of an audio codec.
+ With "fsl,imx-audio-spdif", either SPDIF audio codec spdif_transmitter,
+ spdif_receiver or both.
+ minItems: 1
+ maxItems: 2
+ items:
+ maxItems: 1
audio-cpu:
$ref: /schemas/types.yaml#/definitions/phandle
@@ -150,8 +163,10 @@ properties:
description: dai-link uses bit clock inversion.
mclk-id:
- $ref: /schemas/types.yaml#/definitions/uint32
- description: main clock id, specific for each card configuration.
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+ description: Main clock id for each codec, specific for each card configuration.
+ minItems: 1
+ maxItems: 2
mux-int-port:
$ref: /schemas/types.yaml#/definitions/uint32
@@ -167,6 +182,27 @@ properties:
$ref: /schemas/types.yaml#/definitions/phandle
description: The phandle of an CPU DAI controller
+ spdif-controller:
+ $ref: /schemas/types.yaml#/definitions/phandle
+ deprecated: true
+ description: The phandle of an S/PDIF CPU DAI controller.
+
+ spdif-out:
+ type: boolean
+ deprecated: true
+ description: |
+ If present, the transmitting function of S/PDIF will be enabled,
+ indicating there's a physical S/PDIF out connector or jack on the
+ board or it's connecting to some other IP block, such as an HDMI
+ encoder or display-controller.
+
+ spdif-in:
+ type: boolean
+ deprecated: true
+ description: |
+ If present, the receiving function of S/PDIF will be enabled,
+ indicating there is a physical S/PDIF in connector/jack on the board.
+
required:
- compatible
- model
@@ -195,3 +231,12 @@ examples:
"AIN2L", "Line In Jack",
"AIN2R", "Line In Jack";
};
+
+ - |
+ sound-spdif-asrc {
+ compatible = "fsl,imx-audio-spdif";
+ model = "spdif-asrc-audio";
+ audio-cpu = <&spdif>;
+ audio-asrc = <&easrc>;
+ audio-codec = <&spdifdit>, <&spdifdir>;
+ };
--
2.34.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v6 6/7] arm64: dts: imx8m: update spdif sound card node properties
2024-06-27 8:30 [PATCH v6 0/7] ASoC: fsl-asoc-card: add S/PDIF controller support Elinor Montmasson
` (4 preceding siblings ...)
2024-06-27 8:31 ` [PATCH v6 5/7] ASoC: dt-bindings: update fsl-asoc-card bindings after imx-spdif merge Elinor Montmasson
@ 2024-06-27 8:31 ` Elinor Montmasson
2024-08-04 14:31 ` Shawn Guo
2024-06-27 8:31 ` [PATCH v6 7/7] ARM: dts: imx6: " Elinor Montmasson
2024-07-08 19:14 ` (subset) [PATCH v6 0/7] ASoC: fsl-asoc-card: add S/PDIF controller support Mark Brown
7 siblings, 1 reply; 12+ messages in thread
From: Elinor Montmasson @ 2024-06-27 8:31 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
The merge of imx-spdif driver into fsl-asoc-card brought
new DT properties that can be used with the "fsl,imx-audio-spdif"
compatible:
* 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".
While backward compatibility is kept to support properties
"spdif-controller", "spdif-in" and "spdif-out", using new properties has
several benefits:
* "audio-cpu" and "audio-codec" are more generic names reflecting
that the fsl-asoc-card driver supports multiple hardware.
They are properties already used by devices using the
fsl-asoc-card driver.
They are also similar to properties of simple-card: "cpu" and "codec".
* "spdif-in" and "spdif-out" imply the use of the dummy codec in the
driver. However, there are already two codec drivers for the S/PDIF,
spdif_transmitter and spdif_receiver.
It is better to declare S/PDIF Tx and Rx devices in a DT, and then
reference them with "audio-codec" than using the dummy codec.
For those reasons, this commit updates in-tree DTs to use the new
properties:
* Rename "spdif-controller" property to "audio-cpu".
* Declare S/PDIF transmitter and/or receiver devices, and use them with
the "audio-codec" property instead of "spdif-out" and/or "spdif-in".
These modifications were tested only on an imx8mn-evk board.
Note that out-of-tree and old DTs are still supported.
Signed-off-by: Elinor Montmasson <elinor.montmasson@savoirfairelinux.com>
---
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 +++++++++++++++----
3 files changed, 43 insertions(+), 11 deletions(-)
diff --git a/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi b/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi
index 90d1901df2b1..348855a41852 100644
--- a/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi
@@ -180,12 +180,21 @@ cpu {
};
};
+ spdif_out: spdif-out {
+ #sound-dai-cells = <0>;
+ compatible = "linux,spdif-dit";
+ };
+
+ spdif_in: spdif-in {
+ #sound-dai-cells = <0>;
+ compatible = "linux,spdif-dir";
+ };
+
sound-spdif {
compatible = "fsl,imx-audio-spdif";
model = "imx-spdif";
- spdif-controller = <&spdif1>;
- spdif-out;
- spdif-in;
+ audio-cpu = <&spdif1>;
+ audio-codec = <&spdif_out>, <&spdif_in>;
};
};
diff --git a/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi b/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
index 9e0259ddf4bc..6a47e09703a7 100644
--- a/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
@@ -124,12 +124,21 @@ sound-wm8524 {
"Line Out Jack", "LINEVOUTR";
};
+ spdif_out: spdif-out {
+ #sound-dai-cells = <0>;
+ compatible = "linux,spdif-dit";
+ };
+
+ spdif_in: spdif-in {
+ #sound-dai-cells = <0>;
+ compatible = "linux,spdif-dir";
+ };
+
sound-spdif {
compatible = "fsl,imx-audio-spdif";
model = "imx-spdif";
- spdif-controller = <&spdif1>;
- spdif-out;
- spdif-in;
+ audio-cpu = <&spdif1>;
+ audio-codec = <&spdif_out>, <&spdif_in>;
};
sound-micfil {
diff --git a/arch/arm64/boot/dts/freescale/imx8mq-evk.dts b/arch/arm64/boot/dts/freescale/imx8mq-evk.dts
index 7507548cdb16..b953865f0b46 100644
--- a/arch/arm64/boot/dts/freescale/imx8mq-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mq-evk.dts
@@ -125,19 +125,33 @@ link_codec: simple-audio-card,codec {
};
};
+ spdif_out: spdif-out {
+ #sound-dai-cells = <0>;
+ compatible = "linux,spdif-dit";
+ };
+
+ spdif_in: spdif-in {
+ #sound-dai-cells = <0>;
+ compatible = "linux,spdif-dir";
+ };
+
sound-spdif {
compatible = "fsl,imx-audio-spdif";
model = "imx-spdif";
- spdif-controller = <&spdif1>;
- spdif-out;
- spdif-in;
+ audio-cpu = <&spdif1>;
+ audio-codec = <&spdif_out>, <&spdif_in>;
+ };
+
+ hdmi_arc_in: hdmi-arc-in {
+ #sound-dai-cells = <0>;
+ compatible = "linux,spdif-dir";
};
sound-hdmi-arc {
compatible = "fsl,imx-audio-spdif";
model = "imx-hdmi-arc";
- spdif-controller = <&spdif2>;
- spdif-in;
+ audio-cpu = <&spdif2>;
+ audio-codec = <&hdmi_arc_in>;
};
};
--
2.34.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v6 7/7] ARM: dts: imx6: update spdif sound card node properties
2024-06-27 8:30 [PATCH v6 0/7] ASoC: fsl-asoc-card: add S/PDIF controller support Elinor Montmasson
` (5 preceding siblings ...)
2024-06-27 8:31 ` [PATCH v6 6/7] arm64: dts: imx8m: update spdif sound card node properties Elinor Montmasson
@ 2024-06-27 8:31 ` Elinor Montmasson
2024-07-08 19:14 ` (subset) [PATCH v6 0/7] ASoC: fsl-asoc-card: add S/PDIF controller support Mark Brown
7 siblings, 0 replies; 12+ messages in thread
From: Elinor Montmasson @ 2024-06-27 8:31 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
The merge of imx-spdif driver into fsl-asoc-card brought
new DT properties that can be used with the "fsl,imx-audio-spdif"
compatible:
* 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".
While backward compatibility is kept to support properties
"spdif-controller", "spdif-in" and "spdif-out", using new properties has
several benefits:
* "audio-cpu" and "audio-codec" are more generic names reflecting
that the fsl-asoc-card driver supports multiple hardware.
They are properties already used by devices using the
fsl-asoc-card driver.
They are also similar to properties of simple-card: "cpu" and "codec".
* "spdif-in" and "spdif-out" imply the use of the dummy codec in the
driver. However, there are already two codec drivers for the S/PDIF,
spdif_transmitter and spdif_receiver.
It is better to declare S/PDIF Tx and Rx devices in a DT, and then
reference them with "audio-codec" than using the dummy codec.
For those reasons, this commit updates in-tree DTs to use the new
properties:
* Rename "spdif-controller" property to "audio-cpu".
* Declare S/PDIF transmitter and/or receiver devices, and use them with
the "audio-codec" property instead of "spdif-out" and/or "spdif-in".
These modifications were tested only on an imx8mn-evk board.
Note that out-of-tree and old DTs are still supported.
Signed-off-by: Elinor Montmasson <elinor.montmasson@savoirfairelinux.com>
---
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 ++++++++++++---
arch/arm/boot/dts/nxp/imx/imx6qdl-apf6dev.dtsi | 9 +++++++--
arch/arm/boot/dts/nxp/imx/imx6qdl-colibri.dtsi | 15 ++++++++++++---
arch/arm/boot/dts/nxp/imx/imx6qdl-cubox-i.dtsi | 9 +++++++--
.../boot/dts/nxp/imx/imx6qdl-hummingboard.dtsi | 9 +++++++--
arch/arm/boot/dts/nxp/imx/imx6qdl-sabreauto.dtsi | 9 +++++++--
arch/arm/boot/dts/nxp/imx/imx6qdl-wandboard.dtsi | 9 +++++++--
arch/arm/boot/dts/nxp/imx/imx6sx-sabreauto.dts | 9 +++++++--
arch/arm/boot/dts/nxp/imx/imx6sx-sdb.dtsi | 9 +++++++--
12 files changed, 104 insertions(+), 28 deletions(-)
diff --git a/arch/arm/boot/dts/nxp/imx/imx6q-cm-fx6.dts b/arch/arm/boot/dts/nxp/imx/imx6q-cm-fx6.dts
index 95b49fc83f7b..5c664c0f2169 100644
--- a/arch/arm/boot/dts/nxp/imx/imx6q-cm-fx6.dts
+++ b/arch/arm/boot/dts/nxp/imx/imx6q-cm-fx6.dts
@@ -127,12 +127,21 @@ simple-audio-card,codec {
};
};
+ spdif_out: spdif-out {
+ #sound-dai-cells = <0>;
+ compatible = "linux,spdif-dit";
+ };
+
+ spdif_in: spdif-in {
+ #sound-dai-cells = <0>;
+ compatible = "linux,spdif-dir";
+ };
+
sound-spdif {
compatible = "fsl,imx-audio-spdif";
model = "imx-spdif";
- spdif-controller = <&spdif>;
- spdif-out;
- spdif-in;
+ audio-cpu = <&spdif>;
+ audio-codec = <&spdif_out>, <&spdif_in>;
};
};
diff --git a/arch/arm/boot/dts/nxp/imx/imx6q-prti6q.dts b/arch/arm/boot/dts/nxp/imx/imx6q-prti6q.dts
index a7d5693c5ab7..8491d656ef17 100644
--- a/arch/arm/boot/dts/nxp/imx/imx6q-prti6q.dts
+++ b/arch/arm/boot/dts/nxp/imx/imx6q-prti6q.dts
@@ -111,12 +111,21 @@ simple-audio-card,codec {
};
};
+ spdif_out: spdif-out {
+ #sound-dai-cells = <0>;
+ compatible = "linux,spdif-dit";
+ };
+
+ spdif_in: spdif-in {
+ #sound-dai-cells = <0>;
+ compatible = "linux,spdif-dir";
+ };
+
sound-spdif {
compatible = "fsl,imx-audio-spdif";
model = "imx-spdif";
- spdif-controller = <&spdif>;
- spdif-in;
- spdif-out;
+ audio-cpu = <&spdif>;
+ audio-codec = <&spdif_out>, <&spdif_in>;
};
};
diff --git a/arch/arm/boot/dts/nxp/imx/imx6q-tbs2910.dts b/arch/arm/boot/dts/nxp/imx/imx6q-tbs2910.dts
index 7c298d9aa21e..ea9a98887c7b 100644
--- a/arch/arm/boot/dts/nxp/imx/imx6q-tbs2910.dts
+++ b/arch/arm/boot/dts/nxp/imx/imx6q-tbs2910.dts
@@ -90,11 +90,16 @@ sound-sgtl5000 {
ssi-controller = <&ssi1>;
};
+ spdif_out: spdif-out {
+ #sound-dai-cells = <0>;
+ compatible = "linux,spdif-dit";
+ };
+
sound-spdif {
compatible = "fsl,imx-audio-spdif";
model = "On-board SPDIF";
- spdif-controller = <&spdif>;
- spdif-out;
+ audio-cpu = <&spdif>;
+ audio-codec = <&spdif_out>;
};
};
diff --git a/arch/arm/boot/dts/nxp/imx/imx6qdl-apalis.dtsi b/arch/arm/boot/dts/nxp/imx/imx6qdl-apalis.dtsi
index ea40623d12e5..6f4546c59d38 100644
--- a/arch/arm/boot/dts/nxp/imx/imx6qdl-apalis.dtsi
+++ b/arch/arm/boot/dts/nxp/imx/imx6qdl-apalis.dtsi
@@ -197,11 +197,20 @@ sound {
ssi-controller = <&ssi1>;
};
+ spdif_out: spdif-out {
+ #sound-dai-cells = <0>;
+ compatible = "linux,spdif-dit";
+ };
+
+ spdif_in: spdif-in {
+ #sound-dai-cells = <0>;
+ compatible = "linux,spdif-dir";
+ };
+
sound_spdif: sound-spdif {
compatible = "fsl,imx-audio-spdif";
- spdif-controller = <&spdif>;
- spdif-in;
- spdif-out;
+ audio-cpu = <&spdif>;
+ audio-codec = <&spdif_out>, <&spdif_in>;
model = "imx-spdif";
status = "disabled";
};
diff --git a/arch/arm/boot/dts/nxp/imx/imx6qdl-apf6dev.dtsi b/arch/arm/boot/dts/nxp/imx/imx6qdl-apf6dev.dtsi
index 3a46ade3b6bd..6aa6b152c3ae 100644
--- a/arch/arm/boot/dts/nxp/imx/imx6qdl-apf6dev.dtsi
+++ b/arch/arm/boot/dts/nxp/imx/imx6qdl-apf6dev.dtsi
@@ -121,11 +121,16 @@ sound {
mux-ext-port = <3>;
};
+ spdif_out: spdif-out {
+ #sound-dai-cells = <0>;
+ compatible = "linux,spdif-dit";
+ };
+
sound-spdif {
compatible = "fsl,imx-audio-spdif";
model = "imx-spdif";
- spdif-controller = <&spdif>;
- spdif-out;
+ audio-cpu = <&spdif>;
+ audio-codec = <&spdif_out>;
};
};
diff --git a/arch/arm/boot/dts/nxp/imx/imx6qdl-colibri.dtsi b/arch/arm/boot/dts/nxp/imx/imx6qdl-colibri.dtsi
index d3a7a6eeb8e0..07f15726f203 100644
--- a/arch/arm/boot/dts/nxp/imx/imx6qdl-colibri.dtsi
+++ b/arch/arm/boot/dts/nxp/imx/imx6qdl-colibri.dtsi
@@ -142,12 +142,21 @@ sound {
ssi-controller = <&ssi1>;
};
+ spdif_out: spdif-out {
+ #sound-dai-cells = <0>;
+ compatible = "linux,spdif-dit";
+ };
+
+ spdif_in: spdif-in {
+ #sound-dai-cells = <0>;
+ compatible = "linux,spdif-dir";
+ };
+
/* Optional S/PDIF in on SODIMM 88 and out on SODIMM 90, 137 or 168 */
sound_spdif: sound-spdif {
compatible = "fsl,imx-audio-spdif";
- spdif-controller = <&spdif>;
- spdif-in;
- spdif-out;
+ audio-cpu = <&spdif>;
+ audio-codec = <&spdif_out>, <&spdif_in>;
model = "imx-spdif";
status = "disabled";
};
diff --git a/arch/arm/boot/dts/nxp/imx/imx6qdl-cubox-i.dtsi b/arch/arm/boot/dts/nxp/imx/imx6qdl-cubox-i.dtsi
index 761566ae3cf5..28afa8a0188b 100644
--- a/arch/arm/boot/dts/nxp/imx/imx6qdl-cubox-i.dtsi
+++ b/arch/arm/boot/dts/nxp/imx/imx6qdl-cubox-i.dtsi
@@ -100,12 +100,17 @@ v_usb1: regulator-v-usb1 {
vin-supply = <&v_5v0>;
};
+ spdif_out: spdif-out {
+ #sound-dai-cells = <0>;
+ compatible = "linux,spdif-dit";
+ };
+
sound-spdif {
compatible = "fsl,imx-audio-spdif";
model = "Integrated SPDIF";
/* IMX6 doesn't implement this yet */
- spdif-controller = <&spdif>;
- spdif-out;
+ audio-cpu = <&spdif>;
+ audio-codec = <&spdif_out>;
};
gpio-keys {
diff --git a/arch/arm/boot/dts/nxp/imx/imx6qdl-hummingboard.dtsi b/arch/arm/boot/dts/nxp/imx/imx6qdl-hummingboard.dtsi
index a955c77cd499..67f2a007a592 100644
--- a/arch/arm/boot/dts/nxp/imx/imx6qdl-hummingboard.dtsi
+++ b/arch/arm/boot/dts/nxp/imx/imx6qdl-hummingboard.dtsi
@@ -140,12 +140,17 @@ sound_codec: simple-audio-card,codec {
};
};
+ spdif_out: spdif-out {
+ #sound-dai-cells = <0>;
+ compatible = "linux,spdif-dit";
+ };
+
sound-spdif {
compatible = "fsl,imx-audio-spdif";
model = "On-board SPDIF";
/* IMX6 doesn't implement this yet */
- spdif-controller = <&spdif>;
- spdif-out;
+ audio-cpu = <&spdif>;
+ audio-codec = <&spdif_out>;
};
};
diff --git a/arch/arm/boot/dts/nxp/imx/imx6qdl-sabreauto.dtsi b/arch/arm/boot/dts/nxp/imx/imx6qdl-sabreauto.dtsi
index 6656e2e762a1..48dfd8151150 100644
--- a/arch/arm/boot/dts/nxp/imx/imx6qdl-sabreauto.dtsi
+++ b/arch/arm/boot/dts/nxp/imx/imx6qdl-sabreauto.dtsi
@@ -143,12 +143,17 @@ sound-cs42888 {
"AIN2R", "Line In Jack";
};
+ spdif_in: spdif-in {
+ #sound-dai-cells = <0>;
+ compatible = "linux,spdif-dir";
+ };
+
sound-spdif {
compatible = "fsl,imx-sabreauto-spdif",
"fsl,imx-audio-spdif";
model = "imx-spdif";
- spdif-controller = <&spdif>;
- spdif-in;
+ audio-cpu = <&spdif>;
+ audio-codec = <&spdif_in>;
};
backlight {
diff --git a/arch/arm/boot/dts/nxp/imx/imx6qdl-wandboard.dtsi b/arch/arm/boot/dts/nxp/imx/imx6qdl-wandboard.dtsi
index 38abb6b50f6c..5a4b9ced297a 100644
--- a/arch/arm/boot/dts/nxp/imx/imx6qdl-wandboard.dtsi
+++ b/arch/arm/boot/dts/nxp/imx/imx6qdl-wandboard.dtsi
@@ -26,11 +26,16 @@ sound {
mux-ext-port = <3>;
};
+ spdif_out: spdif-out {
+ #sound-dai-cells = <0>;
+ compatible = "linux,spdif-dit";
+ };
+
sound-spdif {
compatible = "fsl,imx-audio-spdif";
model = "imx-spdif";
- spdif-controller = <&spdif>;
- spdif-out;
+ audio-cpu = <&spdif>;
+ audio-codec = <&spdif_out>;
};
reg_1p5v: regulator-1p5v {
diff --git a/arch/arm/boot/dts/nxp/imx/imx6sx-sabreauto.dts b/arch/arm/boot/dts/nxp/imx/imx6sx-sabreauto.dts
index b0c27b9b0244..d2cc8b4e8b00 100644
--- a/arch/arm/boot/dts/nxp/imx/imx6sx-sabreauto.dts
+++ b/arch/arm/boot/dts/nxp/imx/imx6sx-sabreauto.dts
@@ -97,11 +97,16 @@ sound-cs42888 {
"AIN2R", "Line In Jack";
};
+ spdif_in: spdif-in {
+ #sound-dai-cells = <0>;
+ compatible = "linux,spdif-dir";
+ };
+
sound-spdif {
compatible = "fsl,imx-audio-spdif";
model = "imx-spdif";
- spdif-controller = <&spdif>;
- spdif-in;
+ audio-cpu = <&spdif>;
+ audio-codec = <&spdif_in>;
};
};
diff --git a/arch/arm/boot/dts/nxp/imx/imx6sx-sdb.dtsi b/arch/arm/boot/dts/nxp/imx/imx6sx-sdb.dtsi
index 7d4170c27732..a8c1fc02eddb 100644
--- a/arch/arm/boot/dts/nxp/imx/imx6sx-sdb.dtsi
+++ b/arch/arm/boot/dts/nxp/imx/imx6sx-sdb.dtsi
@@ -183,12 +183,17 @@ panel_in: endpoint {
};
};
+ spdif_out: spdif-out {
+ #sound-dai-cells = <0>;
+ compatible = "linux,spdif-dit";
+ };
+
sound-spdif {
compatible = "fsl,imx6sx-sdb-spdif",
"fsl,imx-audio-spdif";
model = "imx-spdif";
- spdif-controller = <&spdif>;
- spdif-out;
+ audio-cpu = <&spdif>;
+ audio-codec = <&spdif_out>;
};
};
--
2.34.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v6 5/7] ASoC: dt-bindings: update fsl-asoc-card bindings after imx-spdif merge
2024-06-27 8:31 ` [PATCH v6 5/7] ASoC: dt-bindings: update fsl-asoc-card bindings after imx-spdif merge Elinor Montmasson
@ 2024-07-08 14:47 ` Rob Herring (Arm)
0 siblings, 0 replies; 12+ messages in thread
From: Rob Herring (Arm) @ 2024-07-08 14:47 UTC (permalink / raw)
To: Elinor Montmasson
Cc: imx, alsa-devel, Xiubo Li, Catalin Marinas, Jaroslav Kysela,
Philip-Dylan, Shengjiu Wang, Will Deacon, Takashi Iwai,
Russell King, devicetree, Conor Dooley, Sascha Hauer, linux-sound,
Nicolin Chen, Mark Brown, Fabio Estevam, linux-arm-kernel,
linuxppc-dev, Liam Girdwood, linux-kernel,
Pengutronix Kernel Team, Krzysztof Kozlowski, Shawn Guo
On Thu, 27 Jun 2024 10:31:02 +0200, Elinor Montmasson wrote:
> 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>
> ---
> .../bindings/sound/fsl,imx-audio-spdif.yaml | 66 -------------------
> .../bindings/sound/fsl-asoc-card.yaml | 53 +++++++++++++--
> 2 files changed, 49 insertions(+), 70 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/sound/fsl,imx-audio-spdif.yaml
>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: (subset) [PATCH v6 0/7] ASoC: fsl-asoc-card: add S/PDIF controller support
2024-06-27 8:30 [PATCH v6 0/7] ASoC: fsl-asoc-card: add S/PDIF controller support Elinor Montmasson
` (6 preceding siblings ...)
2024-06-27 8:31 ` [PATCH v6 7/7] ARM: dts: imx6: " Elinor Montmasson
@ 2024-07-08 19:14 ` Mark Brown
7 siblings, 0 replies; 12+ messages in thread
From: Mark Brown @ 2024-07-08 19:14 UTC (permalink / raw)
To: Liam Girdwood, 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, Elinor Montmasson
Cc: devicetree, alsa-devel, imx, linux-kernel, linux-sound,
Philip-Dylan, Pengutronix Kernel Team, linuxppc-dev,
linux-arm-kernel
On Thu, 27 Jun 2024 10:30:57 +0200, Elinor Montmasson wrote:
> This is the v6 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`.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/7] ASoC: fsl-asoc-card: add support for dai links with multiple codecs
commit: a613b63db233b6e7d46ec72f009c1cbb7db8be66
[2/7] ASoC: fsl-asoc-card: add second dai link component for codecs
commit: c68fa0d9b0f8cc7c3ae7d29c02adbc97622a73f5
[3/7] ASoC: fsl-asoc-card: add compatibility to use 2 codecs in dai-links
commit: fcc6ace84f1f6ce2211af25c3c8fb30a0fb2bb2c
[4/7] ASoC: fsl-asoc-card: merge spdif support from imx-spdif.c
commit: 6d174cc4f22461ad3fe383570527e86bf1948a2e
[5/7] ASoC: dt-bindings: update fsl-asoc-card bindings after imx-spdif merge
commit: 4359caadd17fbde64d656c10bd6f2dc91b675a11
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v6 6/7] arm64: dts: imx8m: update spdif sound card node properties
2024-06-27 8:31 ` [PATCH v6 6/7] arm64: dts: imx8m: update spdif sound card node properties Elinor Montmasson
@ 2024-08-04 14:31 ` Shawn Guo
2024-08-19 11:43 ` Elinor Montmasson
0 siblings, 1 reply; 12+ messages in thread
From: Shawn Guo @ 2024-08-04 14:31 UTC (permalink / raw)
To: Elinor Montmasson
Cc: imx, alsa-devel, Xiubo Li, Catalin Marinas, linux-kernel,
Philip-Dylan, Shengjiu Wang, Rob Herring, Will Deacon,
Russell King, devicetree, Conor Dooley, Liam Girdwood,
Sascha Hauer, linux-sound, Nicolin Chen, Mark Brown,
Fabio Estevam, Jaroslav Kysela, linux-arm-kernel, linuxppc-dev,
Takashi Iwai, Pengutronix Kernel Team, Krzysztof Kozlowski,
Shawn Guo
On Thu, Jun 27, 2024 at 10:31:03AM +0200, Elinor Montmasson wrote:
> The merge of imx-spdif driver into fsl-asoc-card brought
> new DT properties that can be used with the "fsl,imx-audio-spdif"
> compatible:
> * 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".
>
> While backward compatibility is kept to support properties
> "spdif-controller", "spdif-in" and "spdif-out", using new properties has
> several benefits:
> * "audio-cpu" and "audio-codec" are more generic names reflecting
> that the fsl-asoc-card driver supports multiple hardware.
> They are properties already used by devices using the
> fsl-asoc-card driver.
> They are also similar to properties of simple-card: "cpu" and "codec".
> * "spdif-in" and "spdif-out" imply the use of the dummy codec in the
> driver. However, there are already two codec drivers for the S/PDIF,
> spdif_transmitter and spdif_receiver.
> It is better to declare S/PDIF Tx and Rx devices in a DT, and then
> reference them with "audio-codec" than using the dummy codec.
>
> For those reasons, this commit updates in-tree DTs to use the new
> properties:
> * Rename "spdif-controller" property to "audio-cpu".
> * Declare S/PDIF transmitter and/or receiver devices, and use them with
> the "audio-codec" property instead of "spdif-out" and/or "spdif-in".
>
> These modifications were tested only on an imx8mn-evk board.
>
> Note that out-of-tree and old DTs are still supported.
>
> Signed-off-by: Elinor Montmasson <elinor.montmasson@savoirfairelinux.com>
> ---
> 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 +++++++++++++++----
> 3 files changed, 43 insertions(+), 11 deletions(-)
>
> diff --git a/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi b/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi
> index 90d1901df2b1..348855a41852 100644
> --- a/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi
> +++ b/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi
> @@ -180,12 +180,21 @@ cpu {
> };
> };
>
> + spdif_out: spdif-out {
> + #sound-dai-cells = <0>;
> + compatible = "linux,spdif-dit";
It's recommended that the property list begins with 'compatible'. Could
you flip them?
Shawn
> + };
> +
> + spdif_in: spdif-in {
> + #sound-dai-cells = <0>;
> + compatible = "linux,spdif-dir";
> + };
> +
> sound-spdif {
> compatible = "fsl,imx-audio-spdif";
> model = "imx-spdif";
> - spdif-controller = <&spdif1>;
> - spdif-out;
> - spdif-in;
> + audio-cpu = <&spdif1>;
> + audio-codec = <&spdif_out>, <&spdif_in>;
> };
> };
>
> diff --git a/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi b/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
> index 9e0259ddf4bc..6a47e09703a7 100644
> --- a/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
> +++ b/arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi
> @@ -124,12 +124,21 @@ sound-wm8524 {
> "Line Out Jack", "LINEVOUTR";
> };
>
> + spdif_out: spdif-out {
> + #sound-dai-cells = <0>;
> + compatible = "linux,spdif-dit";
> + };
> +
> + spdif_in: spdif-in {
> + #sound-dai-cells = <0>;
> + compatible = "linux,spdif-dir";
> + };
> +
> sound-spdif {
> compatible = "fsl,imx-audio-spdif";
> model = "imx-spdif";
> - spdif-controller = <&spdif1>;
> - spdif-out;
> - spdif-in;
> + audio-cpu = <&spdif1>;
> + audio-codec = <&spdif_out>, <&spdif_in>;
> };
>
> sound-micfil {
> diff --git a/arch/arm64/boot/dts/freescale/imx8mq-evk.dts b/arch/arm64/boot/dts/freescale/imx8mq-evk.dts
> index 7507548cdb16..b953865f0b46 100644
> --- a/arch/arm64/boot/dts/freescale/imx8mq-evk.dts
> +++ b/arch/arm64/boot/dts/freescale/imx8mq-evk.dts
> @@ -125,19 +125,33 @@ link_codec: simple-audio-card,codec {
> };
> };
>
> + spdif_out: spdif-out {
> + #sound-dai-cells = <0>;
> + compatible = "linux,spdif-dit";
> + };
> +
> + spdif_in: spdif-in {
> + #sound-dai-cells = <0>;
> + compatible = "linux,spdif-dir";
> + };
> +
> sound-spdif {
> compatible = "fsl,imx-audio-spdif";
> model = "imx-spdif";
> - spdif-controller = <&spdif1>;
> - spdif-out;
> - spdif-in;
> + audio-cpu = <&spdif1>;
> + audio-codec = <&spdif_out>, <&spdif_in>;
> + };
> +
> + hdmi_arc_in: hdmi-arc-in {
> + #sound-dai-cells = <0>;
> + compatible = "linux,spdif-dir";
> };
>
> sound-hdmi-arc {
> compatible = "fsl,imx-audio-spdif";
> model = "imx-hdmi-arc";
> - spdif-controller = <&spdif2>;
> - spdif-in;
> + audio-cpu = <&spdif2>;
> + audio-codec = <&hdmi_arc_in>;
> };
> };
>
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v6 6/7] arm64: dts: imx8m: update spdif sound card node properties
2024-08-04 14:31 ` Shawn Guo
@ 2024-08-19 11:43 ` Elinor Montmasson
0 siblings, 0 replies; 12+ messages in thread
From: Elinor Montmasson @ 2024-08-19 11:43 UTC (permalink / raw)
To: Shawn Guo
Cc: 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 Lee, Nicolin Chen,
Pengutronix Kernel Team, linux-sound, devicetree, imx,
linux-arm-kernel, linux-kernel, alsa-devel, linuxppc-dev,
Philip-Dylan Gleonec
> From: "Shawn Guo" <shawnguo2@yeah.net>
> Sent: Sunday, 4 August, 2024 16:31:11
> On Thu, Jun 27, 2024 at 10:31:03AM +0200, Elinor Montmasson wrote:
>> The merge of imx-spdif driver into fsl-asoc-card brought
>> new DT properties that can be used with the "fsl,imx-audio-spdif"
>> compatible:
>> * 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".
>>
>> While backward compatibility is kept to support properties
>> "spdif-controller", "spdif-in" and "spdif-out", using new properties has
>> several benefits:
>> * "audio-cpu" and "audio-codec" are more generic names reflecting
>> that the fsl-asoc-card driver supports multiple hardware.
>> They are properties already used by devices using the
>> fsl-asoc-card driver.
>> They are also similar to properties of simple-card: "cpu" and "codec".
>> * "spdif-in" and "spdif-out" imply the use of the dummy codec in the
>> driver. However, there are already two codec drivers for the S/PDIF,
>> spdif_transmitter and spdif_receiver.
>> It is better to declare S/PDIF Tx and Rx devices in a DT, and then
>> reference them with "audio-codec" than using the dummy codec.
>>
>> For those reasons, this commit updates in-tree DTs to use the new
>> properties:
>> * Rename "spdif-controller" property to "audio-cpu".
>> * Declare S/PDIF transmitter and/or receiver devices, and use them with
>> the "audio-codec" property instead of "spdif-out" and/or "spdif-in".
>>
>> These modifications were tested only on an imx8mn-evk board.
>>
>> Note that out-of-tree and old DTs are still supported.
>>
>> Signed-off-by: Elinor Montmasson <elinor.montmasson@savoirfairelinux.com>
>> ---
>> 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 +++++++++++++++----
>> 3 files changed, 43 insertions(+), 11 deletions(-)
>>
>> diff --git a/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi
>> b/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi
>> index 90d1901df2b1..348855a41852 100644
>> --- a/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi
>> +++ b/arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi
>> @@ -180,12 +180,21 @@ cpu {
>> };
>> };
>>
>> + spdif_out: spdif-out {
>> + #sound-dai-cells = <0>;
>> + compatible = "linux,spdif-dit";
>
> It's recommended that the property list begins with 'compatible'. Could
> you flip them?
>
Yes I'll will do this quickly, thank you.
Regards,
Elinor Montmasson
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2024-08-19 11:56 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-27 8:30 [PATCH v6 0/7] ASoC: fsl-asoc-card: add S/PDIF controller support Elinor Montmasson
2024-06-27 8:30 ` [PATCH v6 1/7] ASoC: fsl-asoc-card: add support for dai links with multiple codecs Elinor Montmasson
2024-06-27 8:30 ` [PATCH v6 2/7] ASoC: fsl-asoc-card: add second dai link component for codecs Elinor Montmasson
2024-06-27 8:31 ` [PATCH v6 3/7] ASoC: fsl-asoc-card: add compatibility to use 2 codecs in dai-links Elinor Montmasson
2024-06-27 8:31 ` [PATCH v6 4/7] ASoC: fsl-asoc-card: merge spdif support from imx-spdif.c Elinor Montmasson
2024-06-27 8:31 ` [PATCH v6 5/7] ASoC: dt-bindings: update fsl-asoc-card bindings after imx-spdif merge Elinor Montmasson
2024-07-08 14:47 ` Rob Herring (Arm)
2024-06-27 8:31 ` [PATCH v6 6/7] arm64: dts: imx8m: update spdif sound card node properties Elinor Montmasson
2024-08-04 14:31 ` Shawn Guo
2024-08-19 11:43 ` Elinor Montmasson
2024-06-27 8:31 ` [PATCH v6 7/7] ARM: dts: imx6: " Elinor Montmasson
2024-07-08 19:14 ` (subset) [PATCH v6 0/7] ASoC: fsl-asoc-card: add S/PDIF controller support 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).