diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2019-03-20 00:56:06 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-03-21 10:52:11 -0400 |
commit | 629f75440a68220a78aef9d8569831824890c47d (patch) | |
tree | 2e3da33cd6f26f464ed3a48acbcfcba5432ba67f /sound/soc/generic | |
parent | ad934ca8010843482d61fda46786449a9bc99e10 (diff) |
ASoC: simple-card-utils: share asoc_simple_be_hw_params_fixup()
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_be_hw_params_fixup() 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 | 12 | ||||
-rw-r--r-- | sound/soc/generic/simple-card.c | 13 |
3 files changed, 14 insertions, 24 deletions
diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c index b1ceefc60879..605126fb2810 100644 --- a/sound/soc/generic/audio-graph-card.c +++ b/sound/soc/generic/audio-graph-card.c | |||
@@ -62,17 +62,6 @@ static const struct snd_soc_ops graph_ops = { | |||
62 | .hw_params = asoc_simple_hw_params, | 62 | .hw_params = asoc_simple_hw_params, |
63 | }; | 63 | }; |
64 | 64 | ||
65 | static int graph_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, | ||
66 | struct snd_pcm_hw_params *params) | ||
67 | { | ||
68 | struct asoc_simple_priv *priv = snd_soc_card_get_drvdata(rtd->card); | ||
69 | struct simple_dai_props *dai_props = simple_priv_to_props(priv, rtd->num); | ||
70 | |||
71 | asoc_simple_card_convert_fixup(&dai_props->adata, params); | ||
72 | |||
73 | return 0; | ||
74 | } | ||
75 | |||
76 | static void graph_parse_convert(struct device *dev, | 65 | static void graph_parse_convert(struct device *dev, |
77 | struct device_node *ep, | 66 | struct device_node *ep, |
78 | struct asoc_simple_card_data *adata) | 67 | struct asoc_simple_card_data *adata) |
@@ -186,7 +175,7 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv, | |||
186 | 175 | ||
187 | /* BE settings */ | 176 | /* BE settings */ |
188 | dai_link->no_pcm = 1; | 177 | dai_link->no_pcm = 1; |
189 | dai_link->be_hw_params_fixup = graph_be_hw_params_fixup; | 178 | dai_link->be_hw_params_fixup = asoc_simple_be_hw_params_fixup; |
190 | 179 | ||
191 | dai = | 180 | dai = |
192 | dai_props->codec_dai = &priv->dais[li->dais++]; | 181 | dai_props->codec_dai = &priv->dais[li->dais++]; |
diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index c9b53b340028..ec4a010400a0 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c | |||
@@ -293,6 +293,18 @@ err: | |||
293 | } | 293 | } |
294 | EXPORT_SYMBOL_GPL(asoc_simple_hw_params); | 294 | EXPORT_SYMBOL_GPL(asoc_simple_hw_params); |
295 | 295 | ||
296 | int asoc_simple_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, | ||
297 | struct snd_pcm_hw_params *params) | ||
298 | { | ||
299 | struct asoc_simple_priv *priv = snd_soc_card_get_drvdata(rtd->card); | ||
300 | struct simple_dai_props *dai_props = simple_priv_to_props(priv, rtd->num); | ||
301 | |||
302 | asoc_simple_card_convert_fixup(&dai_props->adata, params); | ||
303 | |||
304 | return 0; | ||
305 | } | ||
306 | EXPORT_SYMBOL_GPL(asoc_simple_be_hw_params_fixup); | ||
307 | |||
296 | int asoc_simple_card_parse_dai(struct device_node *node, | 308 | int asoc_simple_card_parse_dai(struct device_node *node, |
297 | struct snd_soc_dai_link_component *dlc, | 309 | struct snd_soc_dai_link_component *dlc, |
298 | struct device_node **dai_of_node, | 310 | struct device_node **dai_of_node, |
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index bf4482ecfe3e..60a88a55c071 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c | |||
@@ -32,17 +32,6 @@ static const struct snd_soc_ops simple_ops = { | |||
32 | .hw_params = asoc_simple_hw_params, | 32 | .hw_params = asoc_simple_hw_params, |
33 | }; | 33 | }; |
34 | 34 | ||
35 | static int simple_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, | ||
36 | struct snd_pcm_hw_params *params) | ||
37 | { | ||
38 | struct asoc_simple_priv *priv = snd_soc_card_get_drvdata(rtd->card); | ||
39 | struct simple_dai_props *dai_props = simple_priv_to_props(priv, rtd->num); | ||
40 | |||
41 | asoc_simple_card_convert_fixup(&dai_props->adata, params); | ||
42 | |||
43 | return 0; | ||
44 | } | ||
45 | |||
46 | static void simple_parse_convert(struct device *dev, | 35 | static void simple_parse_convert(struct device *dev, |
47 | struct device_node *np, | 36 | struct device_node *np, |
48 | struct asoc_simple_card_data *adata) | 37 | struct asoc_simple_card_data *adata) |
@@ -154,7 +143,7 @@ static int simple_dai_link_of_dpcm(struct asoc_simple_priv *priv, | |||
154 | 143 | ||
155 | /* BE settings */ | 144 | /* BE settings */ |
156 | dai_link->no_pcm = 1; | 145 | dai_link->no_pcm = 1; |
157 | dai_link->be_hw_params_fixup = simple_be_hw_params_fixup; | 146 | dai_link->be_hw_params_fixup = asoc_simple_be_hw_params_fixup; |
158 | 147 | ||
159 | dai = | 148 | dai = |
160 | dai_props->codec_dai = &priv->dais[li->dais++]; | 149 | dai_props->codec_dai = &priv->dais[li->dais++]; |