diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2019-03-20 00:55:27 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-03-21 10:51:30 -0400 |
commit | 686911b46fb5a08df142fe22b6c06dc6fbd3ba65 (patch) | |
tree | 8550290ea62ee05305b5bf446e76c87f690e0ea4 /sound/soc/generic | |
parent | f38df5bf0c9cb905fa9d5abc86c3a00128cdbba5 (diff) |
ASoC: simple-card-utils: share asoc_simple_shutdown()
The difference between simple-card / audio-graph are just using
OF graph style, or not. In other words, other things should be same.
This means, simple-card/audio-graph common functions should be
implemented at simple-card-utils, and its own functions should be
implemented at each files.
Current simple-card / audio-graph have almost same functions.
This patch shares asoc_simple_shutdown() between in these 2 drivers.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/generic')
-rw-r--r-- | sound/soc/generic/audio-graph-card.c | 13 | ||||
-rw-r--r-- | sound/soc/generic/simple-card-utils.c | 16 | ||||
-rw-r--r-- | sound/soc/generic/simple-card.c | 14 |
3 files changed, 16 insertions, 27 deletions
diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c index 29ae71b427ec..f3577b5bf14c 100644 --- a/sound/soc/generic/audio-graph-card.c +++ b/sound/soc/generic/audio-graph-card.c | |||
@@ -56,17 +56,6 @@ static const struct snd_soc_dapm_widget graph_dapm_widgets[] = { | |||
56 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), | 56 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), |
57 | }; | 57 | }; |
58 | 58 | ||
59 | static void graph_shutdown(struct snd_pcm_substream *substream) | ||
60 | { | ||
61 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
62 | struct asoc_simple_priv *priv = snd_soc_card_get_drvdata(rtd->card); | ||
63 | struct simple_dai_props *dai_props = simple_priv_to_props(priv, rtd->num); | ||
64 | |||
65 | asoc_simple_card_clk_disable(dai_props->cpu_dai); | ||
66 | |||
67 | asoc_simple_card_clk_disable(dai_props->codec_dai); | ||
68 | } | ||
69 | |||
70 | static int graph_hw_params(struct snd_pcm_substream *substream, | 59 | static int graph_hw_params(struct snd_pcm_substream *substream, |
71 | struct snd_pcm_hw_params *params) | 60 | struct snd_pcm_hw_params *params) |
72 | { | 61 | { |
@@ -100,7 +89,7 @@ err: | |||
100 | 89 | ||
101 | static const struct snd_soc_ops graph_ops = { | 90 | static const struct snd_soc_ops graph_ops = { |
102 | .startup = asoc_simple_startup, | 91 | .startup = asoc_simple_startup, |
103 | .shutdown = graph_shutdown, | 92 | .shutdown = asoc_simple_shutdown, |
104 | .hw_params = graph_hw_params, | 93 | .hw_params = graph_hw_params, |
105 | }; | 94 | }; |
106 | 95 | ||
diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 83ea1afa3c72..7ede16347ea8 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c | |||
@@ -151,12 +151,11 @@ static int asoc_simple_card_clk_enable(struct asoc_simple_dai *dai) | |||
151 | return 0; | 151 | return 0; |
152 | } | 152 | } |
153 | 153 | ||
154 | void asoc_simple_card_clk_disable(struct asoc_simple_dai *dai) | 154 | static void asoc_simple_card_clk_disable(struct asoc_simple_dai *dai) |
155 | { | 155 | { |
156 | if (dai) | 156 | if (dai) |
157 | clk_disable_unprepare(dai->clk); | 157 | clk_disable_unprepare(dai->clk); |
158 | } | 158 | } |
159 | EXPORT_SYMBOL_GPL(asoc_simple_card_clk_disable); | ||
160 | 159 | ||
161 | int asoc_simple_card_parse_clk(struct device *dev, | 160 | int asoc_simple_card_parse_clk(struct device *dev, |
162 | struct device_node *node, | 161 | struct device_node *node, |
@@ -224,6 +223,19 @@ int asoc_simple_startup(struct snd_pcm_substream *substream) | |||
224 | } | 223 | } |
225 | EXPORT_SYMBOL_GPL(asoc_simple_startup); | 224 | EXPORT_SYMBOL_GPL(asoc_simple_startup); |
226 | 225 | ||
226 | void asoc_simple_shutdown(struct snd_pcm_substream *substream) | ||
227 | { | ||
228 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
229 | struct asoc_simple_priv *priv = snd_soc_card_get_drvdata(rtd->card); | ||
230 | struct simple_dai_props *dai_props = | ||
231 | simple_priv_to_props(priv, rtd->num); | ||
232 | |||
233 | asoc_simple_card_clk_disable(dai_props->cpu_dai); | ||
234 | |||
235 | asoc_simple_card_clk_disable(dai_props->codec_dai); | ||
236 | } | ||
237 | EXPORT_SYMBOL_GPL(asoc_simple_shutdown); | ||
238 | |||
227 | int asoc_simple_card_parse_dai(struct device_node *node, | 239 | int asoc_simple_card_parse_dai(struct device_node *node, |
228 | struct snd_soc_dai_link_component *dlc, | 240 | struct snd_soc_dai_link_component *dlc, |
229 | struct device_node **dai_of_node, | 241 | struct device_node **dai_of_node, |
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index d0ea5736889e..bb57c482eac8 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c | |||
@@ -26,18 +26,6 @@ struct link_info { | |||
26 | #define CELL "#sound-dai-cells" | 26 | #define CELL "#sound-dai-cells" |
27 | #define PREFIX "simple-audio-card," | 27 | #define PREFIX "simple-audio-card," |
28 | 28 | ||
29 | static void simple_shutdown(struct snd_pcm_substream *substream) | ||
30 | { | ||
31 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
32 | struct asoc_simple_priv *priv = snd_soc_card_get_drvdata(rtd->card); | ||
33 | struct simple_dai_props *dai_props = | ||
34 | simple_priv_to_props(priv, rtd->num); | ||
35 | |||
36 | asoc_simple_card_clk_disable(dai_props->cpu_dai); | ||
37 | |||
38 | asoc_simple_card_clk_disable(dai_props->codec_dai); | ||
39 | } | ||
40 | |||
41 | static int simple_set_clk_rate(struct asoc_simple_dai *simple_dai, | 29 | static int simple_set_clk_rate(struct asoc_simple_dai *simple_dai, |
42 | unsigned long rate) | 30 | unsigned long rate) |
43 | { | 31 | { |
@@ -96,7 +84,7 @@ err: | |||
96 | 84 | ||
97 | static const struct snd_soc_ops simple_ops = { | 85 | static const struct snd_soc_ops simple_ops = { |
98 | .startup = asoc_simple_startup, | 86 | .startup = asoc_simple_startup, |
99 | .shutdown = simple_shutdown, | 87 | .shutdown = asoc_simple_shutdown, |
100 | .hw_params = simple_hw_params, | 88 | .hw_params = simple_hw_params, |
101 | }; | 89 | }; |
102 | 90 | ||