aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/generic
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/generic')
-rw-r--r--sound/soc/generic/simple-card.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index fb9240fdc9b7..cb3998d96cca 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -39,6 +39,37 @@ struct simple_card_data {
39#define simple_priv_to_link(priv, i) ((priv)->snd_card.dai_link + i) 39#define simple_priv_to_link(priv, i) ((priv)->snd_card.dai_link + i)
40#define simple_priv_to_props(priv, i) ((priv)->dai_props + i) 40#define simple_priv_to_props(priv, i) ((priv)->dai_props + i)
41 41
42static int asoc_simple_card_startup(struct snd_pcm_substream *substream)
43{
44 struct snd_soc_pcm_runtime *rtd = substream->private_data;
45 struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card);
46 struct simple_dai_props *dai_props =
47 &priv->dai_props[rtd - rtd->card->rtd];
48 int ret;
49
50 ret = clk_prepare_enable(dai_props->cpu_dai.clk);
51 if (ret)
52 return ret;
53
54 ret = clk_prepare_enable(dai_props->codec_dai.clk);
55 if (ret)
56 clk_disable_unprepare(dai_props->cpu_dai.clk);
57
58 return ret;
59}
60
61static void asoc_simple_card_shutdown(struct snd_pcm_substream *substream)
62{
63 struct snd_soc_pcm_runtime *rtd = substream->private_data;
64 struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card);
65 struct simple_dai_props *dai_props =
66 &priv->dai_props[rtd - rtd->card->rtd];
67
68 clk_disable_unprepare(dai_props->cpu_dai.clk);
69
70 clk_disable_unprepare(dai_props->codec_dai.clk);
71}
72
42static int asoc_simple_card_hw_params(struct snd_pcm_substream *substream, 73static int asoc_simple_card_hw_params(struct snd_pcm_substream *substream,
43 struct snd_pcm_hw_params *params) 74 struct snd_pcm_hw_params *params)
44{ 75{
@@ -58,6 +89,8 @@ static int asoc_simple_card_hw_params(struct snd_pcm_substream *substream,
58} 89}
59 90
60static struct snd_soc_ops asoc_simple_card_ops = { 91static struct snd_soc_ops asoc_simple_card_ops = {
92 .startup = asoc_simple_card_startup,
93 .shutdown = asoc_simple_card_shutdown,
61 .hw_params = asoc_simple_card_hw_params, 94 .hw_params = asoc_simple_card_hw_params,
62}; 95};
63 96
@@ -219,6 +252,7 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
219 } 252 }
220 253
221 dai->sysclk = clk_get_rate(clk); 254 dai->sysclk = clk_get_rate(clk);
255 dai->clk = clk;
222 } else if (!of_property_read_u32(np, "system-clock-frequency", &val)) { 256 } else if (!of_property_read_u32(np, "system-clock-frequency", &val)) {
223 dai->sysclk = val; 257 dai->sysclk = val;
224 } else { 258 } else {