Message ID | 20230901144550.520072-2-elinor.montmasson@savoirfairelinux.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [01/10] ASoC: fsl-asoc-card: add new compatible for dummy codec | expand |
On Fri, Sep 1, 2023 at 10:46 PM <elinor.montmasson@savoirfairelinux.com> wrote: > > From: Elinor Montmasson <elinor.montmasson@savoirfairelinux.com> > > Add support for the new compatible fsl,imx-audio-dummy-codec. > It allows using the fsl-asoc-card driver with the dummy codec provided > by the kernel utilities instead of a real codec. > For now the compatible is recognised and the codec driver names are set, > but a sound card with this compatible will still be deferred during > initialisation. Add Mark In the "Question about simple-audio-card with dummy CODEC" Mark said dummy codec may not be used. we should have a driver to describe the codec. Best regards wang shengjiu > > Signed-off-by: Elinor Montmasson <elinor.montmasson@savoirfairelinux.com> > Co-authored-by: Philip-Dylan Gleonec <philip-dylan.gleonec@savoirfairelinux.com> > --- > sound/soc/fsl/fsl-asoc-card.c | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c > index 76b5bfc288fd..c12a356a86d5 100644 > --- a/sound/soc/fsl/fsl-asoc-card.c > +++ b/sound/soc/fsl/fsl-asoc-card.c > @@ -575,7 +575,11 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) > goto fail; > } > > - codec_np = of_parse_phandle(np, "audio-codec", 0); > + if (of_device_is_compatible(np, "fsl,imx-audio-dummy-codec")) > + codec_np = NULL; > + else > + codec_np = of_parse_phandle(np, "audio-codec", 0); > + > if (codec_np) { > struct platform_device *codec_pdev; > struct i2c_client *codec_i2c; > @@ -705,6 +709,8 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) > priv->dai_fmt |= SND_SOC_DAIFMT_CBM_CFM; > if (codec_dev) > priv->codec_priv.mclk = devm_clk_get(codec_dev, NULL); > + } else if (of_device_is_compatible(np, "fsl,imx-audio-dummy-codec")) { > + codec_dai_name = "snd-soc-dummy-dai"; > } else { > dev_err(&pdev->dev, "unknown Device Tree compatible\n"); > ret = -EINVAL; > @@ -806,7 +812,9 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) > priv->dai_link[0].cpus->of_node = cpu_np; > priv->dai_link[0].codecs->dai_name = codec_dai_name; > > - if (!fsl_asoc_card_is_ac97(priv)) > + if (of_device_is_compatible(np, "fsl,imx-audio-dummy-codec")) > + priv->dai_link[0].codecs->name = "snd-soc-dummy"; > + else if (!fsl_asoc_card_is_ac97(priv)) > priv->dai_link[0].codecs->of_node = codec_np; > else { > u32 idx; > @@ -931,6 +939,7 @@ static const struct of_device_id fsl_asoc_card_dt_ids[] = { > { .compatible = "fsl,imx-audio-si476x", }, > { .compatible = "fsl,imx-audio-wm8958", }, > { .compatible = "fsl,imx-audio-nau8822", }, > + { .compatible = "fsl,imx-audio-dummy-codec", }, > {} > }; > MODULE_DEVICE_TABLE(of, fsl_asoc_card_dt_ids); > -- > 2.25.1 >
On lundi 11 septembre 2023 10:21:17 CEST Shengjiu Wang wrote: > Add Mark > > In the "Question about simple-audio-card with dummy CODEC" > Mark said dummy codec may not be used. we should have a driver > to describe the codec. > > Best regards > wang shengjiu Hello, I'm following up since Elinor is currently absent. I had the opportunity to meet Mark and asked for his advice: we will modify the patchset to use the spdif_receiver and spdif_transceiver codecs instead of the dummy codec. Thanks for the review. Best regards, Philip-Dylan Gleonec
diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index 76b5bfc288fd..c12a356a86d5 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -575,7 +575,11 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) goto fail; } - codec_np = of_parse_phandle(np, "audio-codec", 0); + if (of_device_is_compatible(np, "fsl,imx-audio-dummy-codec")) + codec_np = NULL; + else + codec_np = of_parse_phandle(np, "audio-codec", 0); + if (codec_np) { struct platform_device *codec_pdev; struct i2c_client *codec_i2c; @@ -705,6 +709,8 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) priv->dai_fmt |= SND_SOC_DAIFMT_CBM_CFM; if (codec_dev) priv->codec_priv.mclk = devm_clk_get(codec_dev, NULL); + } else if (of_device_is_compatible(np, "fsl,imx-audio-dummy-codec")) { + codec_dai_name = "snd-soc-dummy-dai"; } else { dev_err(&pdev->dev, "unknown Device Tree compatible\n"); ret = -EINVAL; @@ -806,7 +812,9 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) priv->dai_link[0].cpus->of_node = cpu_np; priv->dai_link[0].codecs->dai_name = codec_dai_name; - if (!fsl_asoc_card_is_ac97(priv)) + if (of_device_is_compatible(np, "fsl,imx-audio-dummy-codec")) + priv->dai_link[0].codecs->name = "snd-soc-dummy"; + else if (!fsl_asoc_card_is_ac97(priv)) priv->dai_link[0].codecs->of_node = codec_np; else { u32 idx; @@ -931,6 +939,7 @@ static const struct of_device_id fsl_asoc_card_dt_ids[] = { { .compatible = "fsl,imx-audio-si476x", }, { .compatible = "fsl,imx-audio-wm8958", }, { .compatible = "fsl,imx-audio-nau8822", }, + { .compatible = "fsl,imx-audio-dummy-codec", }, {} }; MODULE_DEVICE_TABLE(of, fsl_asoc_card_dt_ids);