summaryrefslogtreecommitdiffstats
path: root/sound/soc/generic/simple-scu-card.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/generic/simple-scu-card.c')
-rw-r--r--sound/soc/generic/simple-scu-card.c54
1 files changed, 36 insertions, 18 deletions
diff --git a/sound/soc/generic/simple-scu-card.c b/sound/soc/generic/simple-scu-card.c
index 16a83bc51e0e..85b46f0eae0f 100644
--- a/sound/soc/generic/simple-scu-card.c
+++ b/sound/soc/generic/simple-scu-card.c
@@ -22,7 +22,11 @@
struct simple_card_data {
struct snd_soc_card snd_card;
struct snd_soc_codec_conf codec_conf;
- struct asoc_simple_dai *dai_props;
+ struct simple_dai_props {
+ struct asoc_simple_dai dai;
+ struct snd_soc_dai_link_component codecs;
+ struct snd_soc_dai_link_component platform;
+ } *dai_props;
struct snd_soc_dai_link *dai_link;
struct asoc_simple_card_data adata;
};
@@ -40,20 +44,20 @@ static int asoc_simple_card_startup(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card);
- struct asoc_simple_dai *dai_props =
+ struct simple_dai_props *dai_props =
simple_priv_to_props(priv, rtd->num);
- return asoc_simple_card_clk_enable(dai_props);
+ return asoc_simple_card_clk_enable(&dai_props->dai);
}
static void asoc_simple_card_shutdown(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card);
- struct asoc_simple_dai *dai_props =
+ struct simple_dai_props *dai_props =
simple_priv_to_props(priv, rtd->num);
- asoc_simple_card_clk_disable(dai_props);
+ asoc_simple_card_clk_disable(&dai_props->dai);
}
static const struct snd_soc_ops asoc_simple_card_ops = {
@@ -66,7 +70,7 @@ static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card);
struct snd_soc_dai *dai;
struct snd_soc_dai_link *dai_link;
- struct asoc_simple_dai *dai_props;
+ struct simple_dai_props *dai_props;
int num = rtd->num;
dai_link = simple_priv_to_link(priv, num);
@@ -75,7 +79,7 @@ static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
rtd->cpu_dai :
rtd->codec_dai;
- return asoc_simple_card_init_dai(dai, dai_props);
+ return asoc_simple_card_init_dai(dai, &dai_props->dai);
}
static int asoc_simple_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
@@ -95,17 +99,19 @@ static int asoc_simple_card_dai_link_of(struct device_node *np,
{
struct device *dev = simple_priv_to_dev(priv);
struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx);
- struct asoc_simple_dai *dai_props = simple_priv_to_props(priv, idx);
+ struct simple_dai_props *dai_props = simple_priv_to_props(priv, idx);
struct snd_soc_card *card = simple_priv_to_card(priv);
int ret;
if (is_fe) {
int is_single_links = 0;
+ struct snd_soc_dai_link_component *codecs;
/* BE is dummy */
- dai_link->codec_of_node = NULL;
- dai_link->codec_dai_name = "snd-soc-dummy-dai";
- dai_link->codec_name = "snd-soc-dummy";
+ codecs = dai_link->codecs;
+ codecs->of_node = NULL;
+ codecs->dai_name = "snd-soc-dummy-dai";
+ codecs->name = "snd-soc-dummy";
/* FE settings */
dai_link->dynamic = 1;
@@ -116,7 +122,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *np,
if (ret)
return ret;
- ret = asoc_simple_card_parse_clk_cpu(dev, np, dai_link, dai_props);
+ ret = asoc_simple_card_parse_clk_cpu(dev, np, dai_link, &dai_props->dai);
if (ret < 0)
return ret;
@@ -141,23 +147,23 @@ static int asoc_simple_card_dai_link_of(struct device_node *np,
if (ret < 0)
return ret;
- ret = asoc_simple_card_parse_clk_codec(dev, np, dai_link, dai_props);
+ ret = asoc_simple_card_parse_clk_codec(dev, np, dai_link, &dai_props->dai);
if (ret < 0)
return ret;
ret = asoc_simple_card_set_dailink_name(dev, dai_link,
"be.%s",
- dai_link->codec_dai_name);
+ dai_link->codecs->dai_name);
if (ret < 0)
return ret;
snd_soc_of_parse_audio_prefix(card,
&priv->codec_conf,
- dai_link->codec_of_node,
+ dai_link->codecs->of_node,
PREFIX "prefix");
}
- ret = asoc_simple_card_of_parse_tdm(np, dai_props);
+ ret = asoc_simple_card_of_parse_tdm(np, &dai_props->dai);
if (ret)
return ret;
@@ -230,11 +236,11 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
{
struct simple_card_data *priv;
struct snd_soc_dai_link *dai_link;
- struct asoc_simple_dai *dai_props;
+ struct simple_dai_props *dai_props;
struct snd_soc_card *card;
struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
- int num, ret;
+ int num, ret, i;
/* Allocate the private data */
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
@@ -248,6 +254,18 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
if (!dai_props || !dai_link)
return -ENOMEM;
+ /*
+ * Use snd_soc_dai_link_component instead of legacy style
+ * It is codec only. but cpu/platform will be supported in the future.
+ * see
+ * soc-core.c :: snd_soc_init_multicodec()
+ */
+ for (i = 0; i < num; i++) {
+ dai_link[i].codecs = &dai_props[i].codecs;
+ dai_link[i].num_codecs = 1;
+ dai_link[i].platform = &dai_props[i].platform;
+ }
+
priv->dai_props = dai_props;
priv->dai_link = dai_link;