* [PATCHv5 1/9] ASoC: fsl-asoc-card: set priv->pdev before using it
2024-06-20 13:25 [PATCHv5 0/9] ASoC: fsl-asoc-card: add S/PDIF controller Elinor Montmasson
@ 2024-06-20 13:25 ` Elinor Montmasson
2024-06-20 13:25 ` [PATCHv5 2/9] ASoC: fsl-asoc-card: add support for dai links with multiple codecs Elinor Montmasson
` (8 subsequent siblings)
9 siblings, 0 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
priv->pdev pointer was set after being used in
fsl_asoc_card_audmux_init().
Move this assignment at the start of the probe function, so
sub-functions can correctly use pdev through priv.
fsl_asoc_card_audmux_init() dereferences priv->pdev to get access to the
dev struct, used with dev_err macros.
As priv is zero-initialised, there would be a NULL pointer dereference.
Note that if priv->dev is dereferenced before assignment but never used,
for example if there is no error to be printed, the driver won't crash
probably due to compiler optimisations.
Fixes: 708b4351f08c ("ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support")
Signed-off-by: Elinor Montmasson <elinor.montmasson@savoirfairelinux.com>
---
sound/soc/fsl/fsl-asoc-card.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c
index 5ddc0c2fe53f..eb67689dcd6e 100644
--- a/sound/soc/fsl/fsl-asoc-card.c
+++ b/sound/soc/fsl/fsl-asoc-card.c
@@ -559,6 +559,8 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
if (!priv)
return -ENOMEM;
+ priv->pdev = pdev;
+
cpu_np = of_parse_phandle(np, "audio-cpu", 0);
/* Give a chance to old DT binding */
if (!cpu_np)
@@ -787,7 +789,6 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
}
/* Initialize sound card */
- priv->pdev = pdev;
priv->card.dev = &pdev->dev;
priv->card.owner = THIS_MODULE;
ret = snd_soc_of_parse_card_name(&priv->card, "model");
--
2.34.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCHv5 2/9] ASoC: fsl-asoc-card: add support for dai links with multiple codecs
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 ` Elinor Montmasson
2024-06-20 13:25 ` [PATCHv5 3/9] ASoC: fsl-asoc-card: add second dai link component for codecs Elinor Montmasson
` (7 subsequent siblings)
9 siblings, 0 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
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] 21+ messages in thread* [PATCHv5 3/9] ASoC: fsl-asoc-card: add second dai link component for codecs
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 ` 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
` (6 subsequent siblings)
9 siblings, 0 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
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] 21+ messages in thread* [PATCHv5 4/9] ASoC: fsl-asoc-card: add compatibility to use 2 codecs in dai-links
2024-06-20 13:25 [PATCHv5 0/9] ASoC: fsl-asoc-card: add S/PDIF controller Elinor Montmasson
` (2 preceding siblings ...)
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 ` Elinor Montmasson
2024-06-20 13:25 ` [PATCHv5 5/9] ASoC: fsl-asoc-card: merge spdif support from imx-spdif.c Elinor Montmasson
` (5 subsequent siblings)
9 siblings, 0 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
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] 21+ messages in thread* [PATCHv5 5/9] ASoC: fsl-asoc-card: merge spdif support from imx-spdif.c
2024-06-20 13:25 [PATCHv5 0/9] ASoC: fsl-asoc-card: add S/PDIF controller Elinor Montmasson
` (3 preceding siblings ...)
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 ` Elinor Montmasson
2024-06-20 13:25 ` [PATCHv5 6/9] ASoC: dt-bindings: fsl-asoc-card: add compatible string for spdif Elinor Montmasson
` (4 subsequent siblings)
9 siblings, 0 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
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 fsl-asoc-card to extend
the support of S/PDIF audio card with the use of ASRC devices.
It also substitutes the use of the dummy codec in imx-spdif with the
existing spdif_transmitter and spdif_receiver codec drivers.
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 | 58 +++++++++++++++
sound/soc/fsl/imx-spdif.c | 103 ---------------------------
6 files changed, 59 insertions(+), 116 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..c0e600525680 100644
--- a/sound/soc/fsl/fsl-asoc-card.c
+++ b/sound/soc/fsl/fsl-asoc-card.c
@@ -477,6 +477,59 @@ 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;
+
+ 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";
+ }
+ }
+
+ 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);
+ }
+
+ 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)
{
@@ -748,6 +801,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;
@@ -992,6 +1049,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] 21+ messages in thread* [PATCHv5 6/9] ASoC: dt-bindings: fsl-asoc-card: add compatible string for spdif
2024-06-20 13:25 [PATCHv5 0/9] ASoC: fsl-asoc-card: add S/PDIF controller Elinor Montmasson
` (4 preceding siblings ...)
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 ` Elinor Montmasson
2024-06-23 11:07 ` Krzysztof Kozlowski
2024-06-20 13:25 ` [PATCHv5 7/9] ASoC: dt-bindings: imx-audio-spdif: remove binding Elinor Montmasson
` (3 subsequent siblings)
9 siblings, 1 reply; 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
The S/PDIF audio card support was merged from imx-spdif into the
fsl-asoc-card driver, making it possible to use an S/PDIF with an ASRC.
Add the new compatible and update properties.
Signed-off-by: Elinor Montmasson <elinor.montmasson@savoirfairelinux.com>
---
.../bindings/sound/fsl-asoc-card.yaml | 30 ++++++++++++++++---
1 file changed, 26 insertions(+), 4 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/fsl-asoc-card.yaml b/Documentation/devicetree/bindings/sound/fsl-asoc-card.yaml
index 9922664d5ccc..f2e28b32808e 100644
--- a/Documentation/devicetree/bindings/sound/fsl-asoc-card.yaml
+++ b/Documentation/devicetree/bindings/sound/fsl-asoc-card.yaml
@@ -33,6 +33,7 @@ properties:
- items:
- enum:
- fsl,imx-sgtl5000
+ - fsl,imx-sabreauto-spdif
- fsl,imx25-pdk-sgtl5000
- fsl,imx53-cpuvo-sgtl5000
- fsl,imx51-babbage-sgtl5000
@@ -54,6 +55,7 @@ properties:
- fsl,imx6q-ventana-sgtl5000
- fsl,imx6sl-evk-wm8962
- fsl,imx6sx-sdb-mqs
+ - fsl,imx6sx-sdb-spdif
- fsl,imx6sx-sdb-wm8962
- fsl,imx7d-evk-wm8960
- karo,tx53-audio-sgtl5000
@@ -65,6 +67,7 @@ properties:
- fsl,imx-audio-sgtl5000
- fsl,imx-audio-wm8960
- fsl,imx-audio-wm8962
+ - fsl,imx-audio-spdif
- items:
- enum:
- fsl,imx-audio-ac97
@@ -81,6 +84,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 +97,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 +161,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
@@ -195,3 +208,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] 21+ messages in thread* Re: [PATCHv5 6/9] ASoC: dt-bindings: fsl-asoc-card: add compatible string for spdif
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
0 siblings, 1 reply; 21+ messages in thread
From: Krzysztof Kozlowski @ 2024-06-23 11:07 UTC (permalink / raw)
To: Elinor Montmasson, 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,
Philip-Dylan, Pengutronix Kernel Team, linuxppc-dev,
linux-arm-kernel
On 20/06/2024 15:25, Elinor Montmasson wrote:
> The S/PDIF audio card support was merged from imx-spdif into the
> fsl-asoc-card driver, making it possible to use an S/PDIF with an ASRC.
> Add the new compatible and update properties.
Please use standard email subjects, so with the PATCH keyword in the
title. `git format-patch -v5` helps here to create proper versioned
patches. Another useful tool is b4.
>
> Signed-off-by: Elinor Montmasson <elinor.montmasson@savoirfairelinux.com>
> ---
> .../bindings/sound/fsl-asoc-card.yaml | 30 ++++++++++++++++---
> 1 file changed, 26 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/sound/fsl-asoc-card.yaml b/Documentation/devicetree/bindings/sound/fsl-asoc-card.yaml
> index 9922664d5ccc..f2e28b32808e 100644
> --- a/Documentation/devicetree/bindings/sound/fsl-asoc-card.yaml
> +++ b/Documentation/devicetree/bindings/sound/fsl-asoc-card.yaml
> @@ -33,6 +33,7 @@ properties:
> - items:
> - enum:
> - fsl,imx-sgtl5000
> + - fsl,imx-sabreauto-spdif
> - fsl,imx25-pdk-sgtl5000
> - fsl,imx53-cpuvo-sgtl5000
> - fsl,imx51-babbage-sgtl5000
> @@ -54,6 +55,7 @@ properties:
> - fsl,imx6q-ventana-sgtl5000
> - fsl,imx6sl-evk-wm8962
> - fsl,imx6sx-sdb-mqs
> + - fsl,imx6sx-sdb-spdif
> - fsl,imx6sx-sdb-wm8962
> - fsl,imx7d-evk-wm8960
> - karo,tx53-audio-sgtl5000
> @@ -65,6 +67,7 @@ properties:
> - fsl,imx-audio-sgtl5000
> - fsl,imx-audio-wm8960
> - fsl,imx-audio-wm8962
> + - fsl,imx-audio-spdif
This does not look right. It's quite generic, so now you allow any
variant to be used with this fallback.
Please do not grow more this list of all possible combinations and
instead add specific lists. Otherwise, please explain why this is valid
hardware:
"fsl,imx7d-evk-wm8960", "fsl,imx-audio-spdif"
> - items:
> - enum:
> - fsl,imx-audio-ac97
> @@ -81,6 +84,7 @@ properties:
> - fsl,imx-audio-wm8960
> - fsl,imx-audio-wm8962
> - fsl,imx-audio-wm8958
> + - fsl,imx-audio-spdif
Fallbacks should not be used alone. Why this is needed? The compatible
is already documented, so now you create duplicated binding.
This is very confusing.
>
> model:
> $ref: /schemas/types.yaml#/definitions/string
> @@ -93,8 +97,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 +161,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
> @@ -195,3 +208,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>;
> + };
Do not introduce another indentation style. Look what is above.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [PATCHv5 6/9] ASoC: dt-bindings: fsl-asoc-card: add compatible string for spdif
2024-06-23 11:07 ` Krzysztof Kozlowski
@ 2024-06-24 8:51 ` Elinor Montmasson
2024-06-24 8:56 ` Krzysztof Kozlowski
0 siblings, 1 reply; 21+ messages in thread
From: Elinor Montmasson @ 2024-06-24 8:51 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: imx, alsa-devel, Xiubo Lee, Catalin Marinas, linux-kernel,
Philip-Dylan Gleonec, 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
From: "Krzysztof Kozlowski" <krzk@kernel.org>
Sent: Sunday, 23 June, 2024 13:07:46
> On 20/06/2024 15:25, Elinor Montmasson wrote:
>> The S/PDIF audio card support was merged from imx-spdif into the
>> fsl-asoc-card driver, making it possible to use an S/PDIF with an ASRC.
>> Add the new compatible and update properties.
>
> Please use standard email subjects, so with the PATCH keyword in the
> title. `git format-patch -v5` helps here to create proper versioned
> patches. Another useful tool is b4.
>
Acknowledged, I did not know this option and will be careful about it
for next versions.
>> @@ -33,6 +33,7 @@ properties:
>> - items:
>> - enum:
>> - fsl,imx-sgtl5000
>> + - fsl,imx-sabreauto-spdif
>> - fsl,imx25-pdk-sgtl5000
>> - fsl,imx53-cpuvo-sgtl5000
>> - fsl,imx51-babbage-sgtl5000
>> @@ -54,6 +55,7 @@ properties:
>> - fsl,imx6q-ventana-sgtl5000
>> - fsl,imx6sl-evk-wm8962
>> - fsl,imx6sx-sdb-mqs
>> + - fsl,imx6sx-sdb-spdif
>> - fsl,imx6sx-sdb-wm8962
>> - fsl,imx7d-evk-wm8960
>> - karo,tx53-audio-sgtl5000
>> @@ -65,6 +67,7 @@ properties:
>> - fsl,imx-audio-sgtl5000
>> - fsl,imx-audio-wm8960
>> - fsl,imx-audio-wm8962
>> + - fsl,imx-audio-spdif
>
> This does not look right. It's quite generic, so now you allow any
> variant to be used with this fallback.
>
> Please do not grow more this list of all possible combinations and
> instead add specific lists. Otherwise, please explain why this is valid
> hardware:
> "fsl,imx7d-evk-wm8960", "fsl,imx-audio-spdif"
I wanted to follow the current style of this documentation file,
but I agree it's better to prevent using "fsl,imx-audio-spdif"
with any compatible, I can use a specific list for the next version.
>
>
>> - items:
>> - enum:
>> - fsl,imx-audio-ac97
>> @@ -81,6 +84,7 @@ properties:
>> - fsl,imx-audio-wm8960
>> - fsl,imx-audio-wm8962
>> - fsl,imx-audio-wm8958
>> + - fsl,imx-audio-spdif
>
> Fallbacks should not be used alone. Why this is needed?
"fsl,imx-audio-spdif" is used alone in most DTS files.
"fsl,imx-sabreauto-spdif" and "fsl,imx6sx-sdb-spdif" are used with
"fsl,imx-audio-spdif" in only 2 specific DTS files.
> The compatible is already documented, so now you create duplicated binding.
>
> This is very confusing.
The double compatible documentation is only temporary, next commit (7/9)
removes the previous binding in "fsl,imx-audio-spdif.yaml".
I separated these changes in multiple commit to ease git history searching
by subject/file.
If required, I can merge commits 6/9 and 7/9.
>> @@ -195,3 +208,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>;
>> + };
>
> Do not introduce another indentation style. Look what is above.
Ack, I'll correct this for next version.
Best regards,
Elinor Montmasson
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [PATCHv5 6/9] ASoC: dt-bindings: fsl-asoc-card: add compatible string for spdif
2024-06-24 8:51 ` Elinor Montmasson
@ 2024-06-24 8:56 ` Krzysztof Kozlowski
0 siblings, 0 replies; 21+ messages in thread
From: Krzysztof Kozlowski @ 2024-06-24 8:56 UTC (permalink / raw)
To: Elinor Montmasson
Cc: imx, alsa-devel, Xiubo Lee, Catalin Marinas, linux-kernel,
Philip-Dylan Gleonec, 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 24/06/2024 10:51, Elinor Montmasson wrote:
>
>> The compatible is already documented, so now you create duplicated binding.
>>
>> This is very confusing.
>
>
> The double compatible documentation is only temporary, next commit (7/9)
> removes the previous binding in "fsl,imx-audio-spdif.yaml".
> I separated these changes in multiple commit to ease git history searching
> by subject/file.
> If required, I can merge commits 6/9 and 7/9.
Yeah, squash them so it will be obvious.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCHv5 7/9] ASoC: dt-bindings: imx-audio-spdif: remove binding
2024-06-20 13:25 [PATCHv5 0/9] ASoC: fsl-asoc-card: add S/PDIF controller Elinor Montmasson
` (5 preceding siblings ...)
2024-06-20 13:25 ` [PATCHv5 6/9] ASoC: dt-bindings: fsl-asoc-card: add compatible string for spdif Elinor Montmasson
@ 2024-06-20 13:25 ` Elinor Montmasson
2024-06-23 11:09 ` Krzysztof Kozlowski
2024-06-20 13:25 ` [PATCHv5 8/9] arm64: dts: imx8m: update spdif sound card node properties Elinor Montmasson
` (2 subsequent siblings)
9 siblings, 1 reply; 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
imx-audio-spdif was merged into the fsl-asoc-card driver, and therefore
removed.
Signed-off-by: Elinor Montmasson <elinor.montmasson@savoirfairelinux.com>
---
.../bindings/sound/fsl,imx-audio-spdif.yaml | 66 -------------------
1 file changed, 66 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;
- };
--
2.34.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [PATCHv5 7/9] ASoC: dt-bindings: imx-audio-spdif: remove binding
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
0 siblings, 1 reply; 21+ messages in thread
From: Krzysztof Kozlowski @ 2024-06-23 11:09 UTC (permalink / raw)
To: Elinor Montmasson, 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,
Philip-Dylan, Pengutronix Kernel Team, linuxppc-dev,
linux-arm-kernel
On 20/06/2024 15:25, Elinor Montmasson wrote:
> imx-audio-spdif was merged into the fsl-asoc-card driver, and therefore
> removed.
So what happens with all existing users (e.g. DTS)? They become
invalid/not supported?
After quick look, I do not see backwards compatibility in the driver and
above commit msg tells me nothing about ABI break.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCHv5 7/9] ASoC: dt-bindings: imx-audio-spdif: remove binding
2024-06-23 11:09 ` Krzysztof Kozlowski
@ 2024-06-24 8:51 ` Elinor Montmasson
2024-06-24 8:55 ` Krzysztof Kozlowski
0 siblings, 1 reply; 21+ messages in thread
From: Elinor Montmasson @ 2024-06-24 8:51 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: imx, alsa-devel, Xiubo Lee, Catalin Marinas, linux-kernel,
Philip-Dylan Gleonec, 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
From: "Krzysztof Kozlowski" <krzk@kernel.org>
Sent: Sunday, 23 June, 2024 13:09:33
> On 20/06/2024 15:25, Elinor Montmasson wrote:
>> imx-audio-spdif was merged into the fsl-asoc-card driver, and therefore
>> removed.
>
> So what happens with all existing users (e.g. DTS)? They become
> invalid/not supported?
Next commits, 8/9 and 9/9, update all DTS files that currently use
the "fsl,imx-audio-spdif" compatible.
From the users point of view, currently configured spdif audio cards
will behave just the same.
> After quick look, I do not see backwards compatibility in the driver and
> above commit msg tells me nothing about ABI break.
For the next version I will state in this commit message the upcoming modifications to DTS
and compatibility, why it will be done, and that support for existing DTS is not dropped.
Previous `imx-spdif` driver used the dummy codec instead of
using declared spdif codecs. It was discussed in previous version of this contribution
that using the dummy codec isn't good practice. So one to one backward compatibility
isn't really possible.
Best regards,
Elinor Montmasson
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCHv5 7/9] ASoC: dt-bindings: imx-audio-spdif: remove binding
2024-06-24 8:51 ` Elinor Montmasson
@ 2024-06-24 8:55 ` Krzysztof Kozlowski
2024-06-24 9:18 ` Elinor Montmasson
0 siblings, 1 reply; 21+ messages in thread
From: Krzysztof Kozlowski @ 2024-06-24 8:55 UTC (permalink / raw)
To: Elinor Montmasson
Cc: imx, alsa-devel, Xiubo Lee, Catalin Marinas, linux-kernel,
Philip-Dylan Gleonec, 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 24/06/2024 10:51, Elinor Montmasson wrote:
> From: "Krzysztof Kozlowski" <krzk@kernel.org>
> Sent: Sunday, 23 June, 2024 13:09:33
>> On 20/06/2024 15:25, Elinor Montmasson wrote:
>>> imx-audio-spdif was merged into the fsl-asoc-card driver, and therefore
>>> removed.
>>
>> So what happens with all existing users (e.g. DTS)? They become
>> invalid/not supported?
>
>
> Next commits, 8/9 and 9/9, update all DTS files that currently use
> the "fsl,imx-audio-spdif" compatible.
You mean in-tree. I mean all users, in- and out-of-tree. Other projects.
> From the users point of view, currently configured spdif audio cards
> will behave just the same.
>
>
>> After quick look, I do not see backwards compatibility in the driver and
>> above commit msg tells me nothing about ABI break.
>
>
> For the next version I will state in this commit message the upcoming modifications to DTS
> and compatibility, why it will be done, and that support for existing DTS is not dropped.
>
> Previous `imx-spdif` driver used the dummy codec instead of
> using declared spdif codecs. It was discussed in previous version of this contribution
> that using the dummy codec isn't good practice. So one to one backward compatibility
> isn't really possible.
Heh, that's not good. This is improvement, cleanup. While it is
important and useful, it should also not break existing users.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCHv5 7/9] ASoC: dt-bindings: imx-audio-spdif: remove binding
2024-06-24 8:55 ` Krzysztof Kozlowski
@ 2024-06-24 9:18 ` Elinor Montmasson
2024-06-24 9:24 ` Krzysztof Kozlowski
0 siblings, 1 reply; 21+ messages in thread
From: Elinor Montmasson @ 2024-06-24 9:18 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: imx, alsa-devel, Xiubo Lee, Catalin Marinas, linux-kernel,
Philip-Dylan Gleonec, 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
From: "Krzysztof Kozlowski" <krzk@kernel.org>
Sent: Monday, 24 June, 2024 10:55:31
> On 24/06/2024 10:51, Elinor Montmasson wrote:
>> From: "Krzysztof Kozlowski" <krzk@kernel.org>
>> Sent: Sunday, 23 June, 2024 13:09:33
>>> On 20/06/2024 15:25, Elinor Montmasson wrote:
>>>> imx-audio-spdif was merged into the fsl-asoc-card driver, and therefore
>>>> removed.
>>>
>>> So what happens with all existing users (e.g. DTS)? They become
>>> invalid/not supported?
>>
>>
>> Next commits, 8/9 and 9/9, update all DTS files that currently use
>> the "fsl,imx-audio-spdif" compatible.
>
> You mean in-tree. I mean all users, in- and out-of-tree. Other projects.
Oh you're right
>> From the users point of view, currently configured spdif audio cards
>> will behave just the same.
>>
>>
>>> After quick look, I do not see backwards compatibility in the driver and
>>> above commit msg tells me nothing about ABI break.
>>
>>
>> For the next version I will state in this commit message the upcoming
>> modifications to DTS
>> and compatibility, why it will be done, and that support for existing DTS is not
>> dropped.
>>
>> Previous `imx-spdif` driver used the dummy codec instead of
>> using declared spdif codecs. It was discussed in previous version of this
>> contribution
>> that using the dummy codec isn't good practice. So one to one backward
>> compatibility
>> isn't really possible.
>
> Heh, that's not good. This is improvement, cleanup. While it is
> important and useful, it should also not break existing users.
Should I introduce then the use of the dummy codec in `fsl-asoc-card` to
assure backward compatibility at least for a time ?
With maybe warning messages in code to indicate that spdif codecs drivers
should be declared and used in the future ?
Best regards,
Elinor Montmasson
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCHv5 7/9] ASoC: dt-bindings: imx-audio-spdif: remove binding
2024-06-24 9:18 ` Elinor Montmasson
@ 2024-06-24 9:24 ` Krzysztof Kozlowski
0 siblings, 0 replies; 21+ messages in thread
From: Krzysztof Kozlowski @ 2024-06-24 9:24 UTC (permalink / raw)
To: Elinor Montmasson
Cc: imx, alsa-devel, Xiubo Lee, Catalin Marinas, linux-kernel,
Philip-Dylan Gleonec, 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 24/06/2024 11:18, Elinor Montmasson wrote:
>>>
>>> Previous `imx-spdif` driver used the dummy codec instead of
>>> using declared spdif codecs. It was discussed in previous version of this
>>> contribution
>>> that using the dummy codec isn't good practice. So one to one backward
>>> compatibility
>>> isn't really possible.
>>
>> Heh, that's not good. This is improvement, cleanup. While it is
>> important and useful, it should also not break existing users.
>
>
> Should I introduce then the use of the dummy codec in `fsl-asoc-card` to
> assure backward compatibility at least for a time ?
> With maybe warning messages in code to indicate that spdif codecs drivers
> should be declared and used in the future ?
>
If it is doable (reasonable code), then yes, please keep backwards
compatibility with old DTS.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCHv5 8/9] arm64: dts: imx8m: update spdif sound card node properties
2024-06-20 13:25 [PATCHv5 0/9] ASoC: fsl-asoc-card: add S/PDIF controller Elinor Montmasson
` (6 preceding siblings ...)
2024-06-20 13:25 ` [PATCHv5 7/9] ASoC: dt-bindings: imx-audio-spdif: remove binding Elinor Montmasson
@ 2024-06-20 13:25 ` Elinor Montmasson
2024-06-23 11:10 ` Krzysztof Kozlowski
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
9 siblings, 1 reply; 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
Following merge of imx-spdif driver into fsl-asoc-card:
* update properties to match those used by fsl-asoc-card.
* S/PDIF in/out dummy codecs must now be declared explicitly, add and
use them.
These modifications were tested only on an imx8mn-evk board.
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] 21+ messages in thread* Re: [PATCHv5 8/9] arm64: dts: imx8m: update spdif sound card node properties
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
0 siblings, 1 reply; 21+ messages in thread
From: Krzysztof Kozlowski @ 2024-06-23 11:10 UTC (permalink / raw)
To: Elinor Montmasson, 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,
Philip-Dylan, Pengutronix Kernel Team, linuxppc-dev,
linux-arm-kernel
On 20/06/2024 15:25, Elinor Montmasson wrote:
> Following merge of imx-spdif driver into fsl-asoc-card:
> * update properties to match those used by fsl-asoc-card.
> * S/PDIF in/out dummy codecs must now be declared explicitly, add and
> use them.
>
> These modifications were tested only on an imx8mn-evk board.
So new DTS will not work on old kernel... Can you at least explain why
this is needed and what benefits this make? You change hardware
description, so whatever you merged in drivers is not really relevant, I
would say.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCHv5 8/9] arm64: dts: imx8m: update spdif sound card node properties
2024-06-23 11:10 ` Krzysztof Kozlowski
@ 2024-06-24 8:51 ` Elinor Montmasson
0 siblings, 0 replies; 21+ messages in thread
From: Elinor Montmasson @ 2024-06-24 8:51 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: imx, alsa-devel, Xiubo Lee, Catalin Marinas, linux-kernel,
Philip-Dylan Gleonec, 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
From: "Krzysztof Kozlowski" <krzk@kernel.org>
Sent: Sunday, 23 June, 2024 13:10:48
> On 20/06/2024 15:25, Elinor Montmasson wrote:
>> Following merge of imx-spdif driver into fsl-asoc-card:
>> * update properties to match those used by fsl-asoc-card.
>> * S/PDIF in/out dummy codecs must now be declared explicitly, add and
>> use them.
>>
>> These modifications were tested only on an imx8mn-evk board.
>
> So new DTS will not work on old kernel... Can you at least explain why
> this is needed and what benefits this make? You change hardware
> description, so whatever you merged in drivers is not really relevant, I
> would say.
Ack, I will explain the reasons in the commit message,
which are in my answer to your review of commit 7/9.
Best regards,
Elinor Montmasson
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCHv5 9/9] ARM: dts: imx6: update spdif sound card node properties
2024-06-20 13:25 [PATCHv5 0/9] ASoC: fsl-asoc-card: add S/PDIF controller Elinor Montmasson
` (7 preceding siblings ...)
2024-06-20 13:25 ` [PATCHv5 8/9] arm64: dts: imx8m: update spdif sound card node properties Elinor Montmasson
@ 2024-06-20 13:25 ` Elinor Montmasson
2024-06-21 0:06 ` (subset) [PATCHv5 0/9] ASoC: fsl-asoc-card: add S/PDIF controller Mark Brown
9 siblings, 0 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
Following merge of imx-spdif driver into fsl-asoc-card:
* update properties to match those used by fsl-asoc-card.
* S/PDIF in/out dummy codecs must now be declared explicitly, add and
use them.
These modifications were tested only on an imx8mn-evk board.
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] 21+ messages in thread* Re: (subset) [PATCHv5 0/9] ASoC: fsl-asoc-card: add S/PDIF controller
2024-06-20 13:25 [PATCHv5 0/9] ASoC: fsl-asoc-card: add S/PDIF controller Elinor Montmasson
` (8 preceding siblings ...)
2024-06-20 13:25 ` [PATCHv5 9/9] ARM: dts: imx6: " Elinor Montmasson
@ 2024-06-21 0:06 ` Mark Brown
9 siblings, 0 replies; 21+ messages in thread
From: Mark Brown @ 2024-06-21 0:06 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, 20 Jun 2024 15:25:02 +0200, Elinor Montmasson wrote:
> 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`.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/9] ASoC: fsl-asoc-card: set priv->pdev before using it
commit: 90f3feb24172185f1832636264943e8b5e289245
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] 21+ messages in thread