[PATCH 1/2] ASoC: fsl-asoc-card: Support configuring dai fmt from DT
Support same propeties as simple card for configuring fmt from DT. In order to make this change compatible with old DT, these properties are optional.
Signed-off-by: Shengjiu Wang shengjiu.wang@nxp.com --- sound/soc/fsl/fsl-asoc-card.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index ee80d02b56c6..4848ba61d083 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -531,11 +531,14 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) struct device_node *cpu_np, *codec_np, *asrc_np; struct device_node *np = pdev->dev.of_node; struct platform_device *asrc_pdev = NULL; + struct device_node *bitclkmaster = NULL; + struct device_node *framemaster = 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; + unsigned int daifmt; u32 width; int ret;
@@ -667,6 +670,31 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) goto asrc_fail; }
+ /* Format info from DT is optional. */ + daifmt = snd_soc_of_parse_daifmt(np, NULL, + &bitclkmaster, &framemaster); + daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK; + if (bitclkmaster || framemaster) { + if (codec_np == bitclkmaster) + daifmt |= (codec_np == framemaster) ? + SND_SOC_DAIFMT_CBM_CFM : SND_SOC_DAIFMT_CBM_CFS; + else + daifmt |= (codec_np == framemaster) ? + SND_SOC_DAIFMT_CBS_CFM : SND_SOC_DAIFMT_CBS_CFS; + + /* Override dai_fmt with value from DT */ + priv->dai_fmt = daifmt; + } + + /* Change direction according to format */ + if (priv->dai_fmt & SND_SOC_DAIFMT_CBM_CFM) { + priv->cpu_priv.sysclk_dir[TX] = SND_SOC_CLOCK_IN; + priv->cpu_priv.sysclk_dir[RX] = SND_SOC_CLOCK_IN; + } + + of_node_put(bitclkmaster); + of_node_put(framemaster); + if (!fsl_asoc_card_is_ac97(priv) && !codec_dev) { dev_err(&pdev->dev, "failed to find codec device\n"); ret = -EPROBE_DEFER;
In order to support configuring dai fmt through DT, add some properties. These properiese are same as the properties in simple card.
Signed-off-by: Shengjiu Wang shengjiu.wang@nxp.com --- Documentation/devicetree/bindings/sound/fsl-asoc-card.txt | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt b/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt index 8a6a3d0fda5e..63ebf52b43e8 100644 --- a/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt +++ b/Documentation/devicetree/bindings/sound/fsl-asoc-card.txt @@ -71,6 +71,11 @@ Optional properties:
- hp-det-gpio : The GPIO that detect headphones are plugged in - mic-det-gpio : The GPIO that detect microphones are plugged in + - bitclock-master : Indicates dai-link bit clock master; for details see simple-card.yaml. + - frame-master : Indicates dai-link frame master; for details see simple-card.yaml. + - dai-format : audio format, for details see simple-card.yaml. + - frame-inversion : dai-link uses frame clock inversion, for details see simple-card.yaml. + - bitclock-inversion : dai-link uses bit clock inversion, for details see simple-card.yaml.
Optional unless SSI is selected as a CPU DAI:
On Tue, Jul 21, 2020 at 11:41:49AM +0800, Shengjiu Wang wrote:
Support same propeties as simple card for configuring fmt from DT. In order to make this change compatible with old DT, these properties are optional.
Signed-off-by: Shengjiu Wang shengjiu.wang@nxp.com
For both changes: Acked-by: Nicolin Chen nicoleotsuka@gmail.com
On Tue, 21 Jul 2020 11:41:49 +0800, Shengjiu Wang wrote:
Support same propeties as simple card for configuring fmt from DT. In order to make this change compatible with old DT, these properties are optional.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/2] ASoC: fsl-asoc-card: Support configuring dai fmt from DT commit: 08b54b5e38e67b7e99f71b35cb8841b53e006759 [2/2] ASoC: bindings: fsl-asoc-card: Support properties for configuring dai fmt commit: ca168352cf94bbbc523794f2a2972adcf84d8639
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
participants (3)
-
Mark Brown
-
Nicolin Chen
-
Shengjiu Wang