Commit 7ba06110 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: sof: use modern dai_link style

ASoC is now supporting modern style dai_link
(= snd_soc_dai_link_component) for CPU/Codec/Platform.
This patch switches to use it.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 0467d8ef
...@@ -21,6 +21,7 @@ static int sof_nocodec_bes_setup(struct device *dev, ...@@ -21,6 +21,7 @@ static int sof_nocodec_bes_setup(struct device *dev,
struct snd_soc_dai_link *links, struct snd_soc_dai_link *links,
int link_num, struct snd_soc_card *card) int link_num, struct snd_soc_card *card)
{ {
struct snd_soc_dai_link_component *dlc;
int i; int i;
if (!ops || !links || !card) if (!ops || !links || !card)
...@@ -28,17 +29,29 @@ static int sof_nocodec_bes_setup(struct device *dev, ...@@ -28,17 +29,29 @@ static int sof_nocodec_bes_setup(struct device *dev,
/* set up BE dai_links */ /* set up BE dai_links */
for (i = 0; i < link_num; i++) { for (i = 0; i < link_num; i++) {
dlc = devm_kzalloc(dev, 3 * sizeof(*dlc), GFP_KERNEL);
if (!dlc)
return -ENOMEM;
links[i].name = devm_kasprintf(dev, GFP_KERNEL, links[i].name = devm_kasprintf(dev, GFP_KERNEL,
"NoCodec-%d", i); "NoCodec-%d", i);
if (!links[i].name) if (!links[i].name)
return -ENOMEM; return -ENOMEM;
links[i].cpus = &dlc[0];
links[i].codecs = &dlc[1];
links[i].platforms = &dlc[2];
links[i].num_cpus = 1;
links[i].num_codecs = 1;
links[i].num_platforms = 1;
links[i].id = i; links[i].id = i;
links[i].no_pcm = 1; links[i].no_pcm = 1;
links[i].cpu_dai_name = ops->drv[i].name; links[i].cpus->dai_name = ops->drv[i].name;
links[i].platform_name = dev_name(dev); links[i].platforms->name = dev_name(dev);
links[i].codec_dai_name = "snd-soc-dummy-dai"; links[i].codecs->dai_name = "snd-soc-dummy-dai";
links[i].codec_name = "snd-soc-dummy"; links[i].codecs->name = "snd-soc-dummy";
links[i].dpcm_playback = 1; links[i].dpcm_playback = 1;
links[i].dpcm_capture = 1; links[i].dpcm_capture = 1;
} }
......
...@@ -2639,7 +2639,6 @@ static int sof_link_hda_load(struct snd_soc_component *scomp, int index, ...@@ -2639,7 +2639,6 @@ static int sof_link_hda_load(struct snd_soc_component *scomp, int index,
struct sof_ipc_dai_config *config) struct sof_ipc_dai_config *config)
{ {
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp);
struct snd_soc_dai_link_component dai_component;
struct snd_soc_tplg_private *private = &cfg->priv; struct snd_soc_tplg_private *private = &cfg->priv;
struct snd_soc_dai *dai; struct snd_soc_dai *dai;
u32 size = sizeof(*config); u32 size = sizeof(*config);
...@@ -2650,7 +2649,6 @@ static int sof_link_hda_load(struct snd_soc_component *scomp, int index, ...@@ -2650,7 +2649,6 @@ static int sof_link_hda_load(struct snd_soc_component *scomp, int index,
int ret; int ret;
/* init IPC */ /* init IPC */
memset(&dai_component, 0, sizeof(dai_component));
memset(&config->hda, 0, sizeof(struct sof_ipc_dai_hda_params)); memset(&config->hda, 0, sizeof(struct sof_ipc_dai_hda_params));
config->hdr.size = size; config->hdr.size = size;
...@@ -2664,11 +2662,10 @@ static int sof_link_hda_load(struct snd_soc_component *scomp, int index, ...@@ -2664,11 +2662,10 @@ static int sof_link_hda_load(struct snd_soc_component *scomp, int index,
return ret; return ret;
} }
dai_component.dai_name = link->cpu_dai_name; dai = snd_soc_find_dai(link->cpus);
dai = snd_soc_find_dai(&dai_component);
if (!dai) { if (!dai) {
dev_err(sdev->dev, "error: failed to find dai %s in %s", dev_err(sdev->dev, "error: failed to find dai %s in %s",
dai_component.dai_name, __func__); link->cpus->dai_name, __func__);
return -EINVAL; return -EINVAL;
} }
...@@ -2708,7 +2705,11 @@ static int sof_link_load(struct snd_soc_component *scomp, int index, ...@@ -2708,7 +2705,11 @@ static int sof_link_load(struct snd_soc_component *scomp, int index,
int ret; int ret;
int i = 0; int i = 0;
link->platform_name = dev_name(sdev->dev); if (!link->platforms) {
dev_err(sdev->dev, "error: no platforms\n");
return -EINVAL;
}
link->platforms->name = dev_name(sdev->dev);
/* /*
* Set nonatomic property for FE dai links as their trigger action * Set nonatomic property for FE dai links as their trigger action
...@@ -2801,16 +2802,13 @@ static int sof_link_load(struct snd_soc_component *scomp, int index, ...@@ -2801,16 +2802,13 @@ static int sof_link_load(struct snd_soc_component *scomp, int index,
static int sof_link_hda_unload(struct snd_sof_dev *sdev, static int sof_link_hda_unload(struct snd_sof_dev *sdev,
struct snd_soc_dai_link *link) struct snd_soc_dai_link *link)
{ {
struct snd_soc_dai_link_component dai_component;
struct snd_soc_dai *dai; struct snd_soc_dai *dai;
int ret = 0; int ret = 0;
memset(&dai_component, 0, sizeof(dai_component)); dai = snd_soc_find_dai(link->cpus);
dai_component.dai_name = link->cpu_dai_name;
dai = snd_soc_find_dai(&dai_component);
if (!dai) { if (!dai) {
dev_err(sdev->dev, "error: failed to find dai %s in %s", dev_err(sdev->dev, "error: failed to find dai %s in %s",
dai_component.dai_name, __func__); link->cpus->dai_name, __func__);
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment