From bf5984992bfcc2e5d3f8a61ca3a485bdc2b6596c Mon Sep 17 00:00:00 2001 From: XiaoTan Luo Date: Mon, 5 Sep 2022 10:15:42 +0800 Subject: [PATCH] ASoC: rockchip: mdais: add prepare ops Signed-off-by: XiaoTan Luo Change-Id: I795e9d32ea51a4bf0f229d4e052b52aaeb34df2f --- sound/soc/rockchip/rockchip_multi_dais.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/sound/soc/rockchip/rockchip_multi_dais.c b/sound/soc/rockchip/rockchip_multi_dais.c index d08ee4353de1..88fb11c709bc 100644 --- a/sound/soc/rockchip/rockchip_multi_dais.c +++ b/sound/soc/rockchip/rockchip_multi_dais.c @@ -129,6 +129,25 @@ static void rockchip_mdais_shutdown(struct snd_pcm_substream *substream, } } +static int rockchip_mdais_prepare(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + struct rk_mdais_dev *mdais = to_info(dai); + struct snd_soc_dai *child; + int ret = 0, i = 0; + + for (i = 0; i < mdais->num_dais; i++) { + child = mdais->dais[i].dai; + if (child->driver->ops && child->driver->ops->prepare) { + ret = child->driver->ops->prepare(substream, child); + if (ret < 0) + return ret; + } + } + + return 0; +} + static int rockchip_mdais_set_sysclk(struct snd_soc_dai *cpu_dai, int clk_id, unsigned int freq, int dir) { @@ -220,6 +239,7 @@ static const struct snd_soc_dai_ops rockchip_mdais_dai_ops = { .trigger = rockchip_mdais_trigger, .startup = rockchip_mdais_startup, .shutdown = rockchip_mdais_shutdown, + .prepare = rockchip_mdais_prepare, }; static const struct snd_soc_component_driver rockchip_mdais_component = {