Skip to content

Commit

Permalink
ASoC: fsl_sai: Instantiate snd_soc_dai_driver
Browse files Browse the repository at this point in the history
[ Upstream commit 22a1614 ]

Instantiate snd_soc_dai_driver for independent symmetric control.
Otherwise the symmetric setting may be overwritten by other
instance.

Fixes: 08fdf65 ("ASoC: fsl_sai: Add asynchronous mode support")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1600424760-32071-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
TE-N-ShengjiuWang authored and gregkh committed Oct 29, 2020
1 parent 56c1c45 commit 1ad7f52
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
19 changes: 11 additions & 8 deletions sound/soc/fsl/fsl_sai.c
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ static int fsl_sai_dai_probe(struct snd_soc_dai *cpu_dai)
return 0;
}

static struct snd_soc_dai_driver fsl_sai_dai = {
static struct snd_soc_dai_driver fsl_sai_dai_template = {
.probe = fsl_sai_dai_probe,
.playback = {
.stream_name = "CPU-Playback",
Expand Down Expand Up @@ -965,12 +965,15 @@ static int fsl_sai_probe(struct platform_device *pdev)
return ret;
}

memcpy(&sai->cpu_dai_drv, &fsl_sai_dai_template,
sizeof(fsl_sai_dai_template));

/* Sync Tx with Rx as default by following old DT binding */
sai->synchronous[RX] = true;
sai->synchronous[TX] = false;
fsl_sai_dai.symmetric_rates = 1;
fsl_sai_dai.symmetric_channels = 1;
fsl_sai_dai.symmetric_samplebits = 1;
sai->cpu_dai_drv.symmetric_rates = 1;
sai->cpu_dai_drv.symmetric_channels = 1;
sai->cpu_dai_drv.symmetric_samplebits = 1;

if (of_find_property(np, "fsl,sai-synchronous-rx", NULL) &&
of_find_property(np, "fsl,sai-asynchronous", NULL)) {
Expand All @@ -987,9 +990,9 @@ static int fsl_sai_probe(struct platform_device *pdev)
/* Discard all settings for asynchronous mode */
sai->synchronous[RX] = false;
sai->synchronous[TX] = false;
fsl_sai_dai.symmetric_rates = 0;
fsl_sai_dai.symmetric_channels = 0;
fsl_sai_dai.symmetric_samplebits = 0;
sai->cpu_dai_drv.symmetric_rates = 0;
sai->cpu_dai_drv.symmetric_channels = 0;
sai->cpu_dai_drv.symmetric_samplebits = 0;
}

if (of_find_property(np, "fsl,sai-mclk-direction-output", NULL) &&
Expand Down Expand Up @@ -1018,7 +1021,7 @@ static int fsl_sai_probe(struct platform_device *pdev)
pm_runtime_enable(&pdev->dev);

ret = devm_snd_soc_register_component(&pdev->dev, &fsl_component,
&fsl_sai_dai, 1);
&sai->cpu_dai_drv, 1);
if (ret)
goto err_pm_disable;

Expand Down
1 change: 1 addition & 0 deletions sound/soc/fsl/fsl_sai.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ struct fsl_sai {
unsigned int bclk_ratio;

const struct fsl_sai_soc_data *soc_data;
struct snd_soc_dai_driver cpu_dai_drv;
struct snd_dmaengine_dai_dma_data dma_params_rx;
struct snd_dmaengine_dai_dma_data dma_params_tx;
};
Expand Down

0 comments on commit 1ad7f52

Please sign in to comment.