[alsa-devel] Applied "ASoC: sof: use modern dai_link style" to the asoc tree
Mark Brown
broonie at kernel.org
Thu Jun 6 23:26:13 CEST 2019
The patch
ASoC: sof: use modern dai_link style
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.3
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
>From 7ba06110de2628137554cf4da849ef08f255f385 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
Date: Thu, 6 Jun 2019 13:19:24 +0900
Subject: [PATCH] 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: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
Signed-off-by: Mark Brown <broonie at kernel.org>
---
sound/soc/sof/nocodec.c | 21 +++++++++++++++++----
sound/soc/sof/topology.c | 20 +++++++++-----------
2 files changed, 26 insertions(+), 15 deletions(-)
diff --git a/sound/soc/sof/nocodec.c b/sound/soc/sof/nocodec.c
index f84b4344dcc3..3d128e5a132c 100644
--- a/sound/soc/sof/nocodec.c
+++ b/sound/soc/sof/nocodec.c
@@ -21,6 +21,7 @@ static int sof_nocodec_bes_setup(struct device *dev,
struct snd_soc_dai_link *links,
int link_num, struct snd_soc_card *card)
{
+ struct snd_soc_dai_link_component *dlc;
int i;
if (!ops || !links || !card)
@@ -28,17 +29,29 @@ static int sof_nocodec_bes_setup(struct device *dev,
/* set up BE dai_links */
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,
"NoCodec-%d", i);
if (!links[i].name)
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].no_pcm = 1;
- links[i].cpu_dai_name = ops->drv[i].name;
- links[i].platform_name = dev_name(dev);
- links[i].codec_dai_name = "snd-soc-dummy-dai";
- links[i].codec_name = "snd-soc-dummy";
+ links[i].cpus->dai_name = ops->drv[i].name;
+ links[i].platforms->name = dev_name(dev);
+ links[i].codecs->dai_name = "snd-soc-dummy-dai";
+ links[i].codecs->name = "snd-soc-dummy";
links[i].dpcm_playback = 1;
links[i].dpcm_capture = 1;
}
diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
index b969686f954f..a13233ae6d0e 100644
--- a/sound/soc/sof/topology.c
+++ b/sound/soc/sof/topology.c
@@ -2639,7 +2639,6 @@ static int sof_link_hda_load(struct snd_soc_component *scomp, int index,
struct sof_ipc_dai_config *config)
{
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_dai *dai;
u32 size = sizeof(*config);
@@ -2650,7 +2649,6 @@ static int sof_link_hda_load(struct snd_soc_component *scomp, int index,
int ret;
/* init IPC */
- memset(&dai_component, 0, sizeof(dai_component));
memset(&config->hda, 0, sizeof(struct sof_ipc_dai_hda_params));
config->hdr.size = size;
@@ -2664,11 +2662,10 @@ static int sof_link_hda_load(struct snd_soc_component *scomp, int index,
return ret;
}
- dai_component.dai_name = link->cpu_dai_name;
- dai = snd_soc_find_dai(&dai_component);
+ dai = snd_soc_find_dai(link->cpus);
if (!dai) {
dev_err(sdev->dev, "error: failed to find dai %s in %s",
- dai_component.dai_name, __func__);
+ link->cpus->dai_name, __func__);
return -EINVAL;
}
@@ -2708,7 +2705,11 @@ static int sof_link_load(struct snd_soc_component *scomp, int index,
int ret;
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
@@ -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,
struct snd_soc_dai_link *link)
{
- struct snd_soc_dai_link_component dai_component;
struct snd_soc_dai *dai;
int ret = 0;
- memset(&dai_component, 0, sizeof(dai_component));
- dai_component.dai_name = link->cpu_dai_name;
- dai = snd_soc_find_dai(&dai_component);
+ dai = snd_soc_find_dai(link->cpus);
if (!dai) {
dev_err(sdev->dev, "error: failed to find dai %s in %s",
- dai_component.dai_name, __func__);
+ link->cpus->dai_name, __func__);
return -EINVAL;
}
--
2.20.1
More information about the Alsa-devel
mailing list