From 2d08bb0b3553e6af879e5032911d7b2c24737e61 Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Wed, 5 Aug 2020 04:28:16 +0100 Subject: [PATCH] Revert "asoc_simple_card_init_dai is not exported, but asoc_simple_dai_init is, and does more" This reverts commit de22f922980be74249d0629be23236cfee1fe56a. That commit was wrong: seeed_priv_to_props() is not identical to simple_priv_props(). Conflicts: seeed-voicecard.c --- seeed-voicecard.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/seeed-voicecard.c b/seeed-voicecard.c index ee7e72a..8b0d1c3 100644 --- a/seeed-voicecard.c +++ b/seeed-voicecard.c @@ -304,6 +304,26 @@ static int asoc_simple_parse_dai(struct device_node *node, return 0; } +static int seeed_voice_card_dai_init(struct snd_soc_pcm_runtime *rtd) +{ + struct seeed_card_data *priv = snd_soc_card_get_drvdata(rtd->card); + struct snd_soc_dai *codec = rtd->codec_dai; + struct snd_soc_dai *cpu = rtd->cpu_dai; + struct seeed_dai_props *dai_props = + seeed_priv_to_props(priv, rtd->num); + int ret; + + ret = asoc_simple_init_dai(codec, &dai_props->codec_dai); + if (ret < 0) + return ret; + + ret = asoc_simple_init_dai(cpu, &dai_props->cpu_dai); + if (ret < 0) + return ret; + + return 0; +} + static int seeed_voice_card_dai_link_of(struct device_node *node, struct seeed_card_data *priv, int idx, @@ -425,7 +445,7 @@ static int seeed_voice_card_dai_link_of(struct device_node *node, goto dai_link_of_err; dai_link->ops = &seeed_voice_card_ops; - dai_link->init = asoc_simple_dai_init; + dai_link->init = seeed_voice_card_dai_init; dev_dbg(dev, "\tname : %s\n", dai_link->stream_name); dev_dbg(dev, "\tformat : %04x\n", dai_link->dai_fmt); @@ -652,7 +672,7 @@ static int seeed_voice_card_probe(struct platform_device *pdev) dai_link->name = cinfo->name; dai_link->stream_name = cinfo->name; dai_link->dai_fmt = cinfo->daifmt; - dai_link->init = asoc_simple_dai_init; + dai_link->init = seeed_voice_card_dai_init; memcpy(&priv->dai_props->cpu_dai, &cinfo->cpu_dai, sizeof(priv->dai_props->cpu_dai)); memcpy(&priv->dai_props->codec_dai, &cinfo->codec_dai,