From af8668ff972d50a7d63776a75d2a38f9f166965d Mon Sep 17 00:00:00 2001 From: Hin-Tak Leung Date: Wed, 5 Aug 2020 04:42:41 +0100 Subject: [PATCH] copy asoc_simple_card_init_dai() from v5.7:sound/soc/generic/simple-card-utils.c It was made private in v5.2: commit ad934ca8010843482d61fda46786449a9bc99e10 Author: Kuninori Morimoto Date: Wed Mar 20 13:55:52 2019 +0900 ASoC: simple-card-utils: share asoc_simple_dai_init() --- seeed-voicecard.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/seeed-voicecard.c b/seeed-voicecard.c index 8b0d1c3..c8afe51 100644 --- a/seeed-voicecard.c +++ b/seeed-voicecard.c @@ -304,6 +304,38 @@ static int asoc_simple_parse_dai(struct device_node *node, return 0; } +static int asoc_simple_init_dai(struct snd_soc_dai *dai, + struct asoc_simple_dai *simple_dai) +{ + int ret; + + if (!simple_dai) + return 0; + + if (simple_dai->sysclk) { + ret = snd_soc_dai_set_sysclk(dai, 0, simple_dai->sysclk, + simple_dai->clk_direction); + if (ret && ret != -ENOTSUPP) { + dev_err(dai->dev, "simple-card: set_sysclk error\n"); + return ret; + } + } + + if (simple_dai->slots) { + ret = snd_soc_dai_set_tdm_slot(dai, + simple_dai->tx_slot_mask, + simple_dai->rx_slot_mask, + simple_dai->slots, + simple_dai->slot_width); + if (ret && ret != -ENOTSUPP) { + dev_err(dai->dev, "simple-card: set_tdm_slot error\n"); + return ret; + } + } + + 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);