Skip to content

Commit

Permalink
MLK-24175: ASoC: fsl_sai: instantiate snd_soc_dai_driver
Browse files Browse the repository at this point in the history
instantiate snd_soc_dai_driver for independent symmetric control.

Signed-off-by: Shengjiu Wang <[email protected]>
Reviewed-by: Viorel Suman <[email protected]>
  • Loading branch information
TE-N-ShengjiuWang committed May 27, 2020
1 parent baaa061 commit 2ea70e5
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 @@ -1028,7 +1028,7 @@ static int fsl_sai_dai_resume(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 @@ -1382,6 +1382,9 @@ static int fsl_sai_probe(struct platform_device *pdev)
if (sai->soc->reg_offset == 8)
fsl_sai_regmap_config = fsl_sai_v3_regmap_config;

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

sai->regmap = devm_regmap_init_mmio_clk(&pdev->dev,
NULL, base, &fsl_sai_regmap_config);
if (IS_ERR(sai->regmap)) {
Expand Down Expand Up @@ -1467,9 +1470,9 @@ static int fsl_sai_probe(struct platform_device *pdev)
/* 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 @@ -1486,9 +1489,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;
}

platform_set_drvdata(pdev, sai);
Expand Down Expand Up @@ -1554,7 +1557,7 @@ static int fsl_sai_probe(struct platform_device *pdev)
regcache_cache_only(sai->regmap, true);

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

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 @@ -288,6 +288,7 @@ struct fsl_sai {

struct fsl_sai_verid verid;
struct fsl_sai_param param;
struct snd_soc_dai_driver cpu_dai_drv;
};

const struct attribute_group *fsl_sai_get_dev_attribute_group(bool monitor_spdif);
Expand Down

0 comments on commit 2ea70e5

Please sign in to comment.