diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2016-08-22 21:34:17 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-08-24 06:19:16 -0400 |
commit | 53e682b60019d501e00cfeb701f99ca027470e36 (patch) | |
tree | ae5808daf20501e31f4972b61d50c6d370831da2 | |
parent | a3235938308150fbd0f8b478e73d1e66e945937a (diff) |
ASoC: rsrc-card: rename rsrc-card to simple-scu-card phase1
rsrc-card which is using DPCM feature was created for Renesas sound.
But not only Renesas, but many SoC can use this driver, because
it is based on simple-card driver.
To use it as more open driver, rsrc-card will be renamed to
simple-scu-card. In order to easy patch review, as 1st step,
this patch renames "rsrc" function prefix to "asoc_simple".
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/sh/rcar/rsrc-card.c | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c index ce9f91143f1f..a0d0f3679eeb 100644 --- a/sound/soc/sh/rcar/rsrc-card.c +++ b/sound/soc/sh/rcar/rsrc-card.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Renesas Sampling Rate Convert Sound Card for DPCM | 2 | * ASoC simple SCU sound card support |
3 | * | 3 | * |
4 | * Copyright (C) 2015 Renesas Solutions Corp. | 4 | * Copyright (C) 2015 Renesas Solutions Corp. |
5 | * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 5 | * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> |
@@ -22,21 +22,21 @@ | |||
22 | #include <sound/soc-dai.h> | 22 | #include <sound/soc-dai.h> |
23 | #include <sound/simple_card_utils.h> | 23 | #include <sound/simple_card_utils.h> |
24 | 24 | ||
25 | struct rsrc_card_of_data { | 25 | struct asoc_simple_card_of_data { |
26 | const char *prefix; | 26 | const char *prefix; |
27 | const struct snd_soc_dapm_route *routes; | 27 | const struct snd_soc_dapm_route *routes; |
28 | int num_routes; | 28 | int num_routes; |
29 | }; | 29 | }; |
30 | 30 | ||
31 | static const struct of_device_id rsrc_card_of_match[] = { | 31 | static const struct of_device_id asoc_simple_card_of_match[] = { |
32 | { .compatible = "renesas,rsrc-card", }, | 32 | { .compatible = "renesas,rsrc-card", }, |
33 | {}, | 33 | {}, |
34 | }; | 34 | }; |
35 | MODULE_DEVICE_TABLE(of, rsrc_card_of_match); | 35 | MODULE_DEVICE_TABLE(of, asoc_simple_card_of_match); |
36 | 36 | ||
37 | #define IDX_CPU 0 | 37 | #define IDX_CPU 0 |
38 | #define IDX_CODEC 1 | 38 | #define IDX_CODEC 1 |
39 | struct rsrc_card_priv { | 39 | struct asoc_simple_card_priv { |
40 | struct snd_soc_card snd_card; | 40 | struct snd_soc_card snd_card; |
41 | struct snd_soc_codec_conf codec_conf; | 41 | struct snd_soc_codec_conf codec_conf; |
42 | struct asoc_simple_dai *dai_props; | 42 | struct asoc_simple_dai *dai_props; |
@@ -45,48 +45,48 @@ struct rsrc_card_priv { | |||
45 | u32 convert_channels; | 45 | u32 convert_channels; |
46 | }; | 46 | }; |
47 | 47 | ||
48 | #define rsrc_priv_to_dev(priv) ((priv)->snd_card.dev) | 48 | #define simple_priv_to_dev(priv) ((priv)->snd_card.dev) |
49 | #define rsrc_priv_to_link(priv, i) ((priv)->snd_card.dai_link + (i)) | 49 | #define simple_priv_to_link(priv, i) ((priv)->snd_card.dai_link + (i)) |
50 | #define rsrc_priv_to_props(priv, i) ((priv)->dai_props + (i)) | 50 | #define simple_priv_to_props(priv, i) ((priv)->dai_props + (i)) |
51 | 51 | ||
52 | #define DAI "sound-dai" | 52 | #define DAI "sound-dai" |
53 | #define CELL "#sound-dai-cells" | 53 | #define CELL "#sound-dai-cells" |
54 | 54 | ||
55 | static int rsrc_card_startup(struct snd_pcm_substream *substream) | 55 | static int asoc_simple_card_startup(struct snd_pcm_substream *substream) |
56 | { | 56 | { |
57 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 57 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
58 | struct rsrc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card); | 58 | struct asoc_simple_card_priv *priv = snd_soc_card_get_drvdata(rtd->card); |
59 | struct asoc_simple_dai *dai_props = | 59 | struct asoc_simple_dai *dai_props = |
60 | rsrc_priv_to_props(priv, rtd->num); | 60 | simple_priv_to_props(priv, rtd->num); |
61 | 61 | ||
62 | return clk_prepare_enable(dai_props->clk); | 62 | return clk_prepare_enable(dai_props->clk); |
63 | } | 63 | } |
64 | 64 | ||
65 | static void rsrc_card_shutdown(struct snd_pcm_substream *substream) | 65 | static void asoc_simple_card_shutdown(struct snd_pcm_substream *substream) |
66 | { | 66 | { |
67 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 67 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
68 | struct rsrc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card); | 68 | struct asoc_simple_card_priv *priv = snd_soc_card_get_drvdata(rtd->card); |
69 | struct asoc_simple_dai *dai_props = | 69 | struct asoc_simple_dai *dai_props = |
70 | rsrc_priv_to_props(priv, rtd->num); | 70 | simple_priv_to_props(priv, rtd->num); |
71 | 71 | ||
72 | clk_disable_unprepare(dai_props->clk); | 72 | clk_disable_unprepare(dai_props->clk); |
73 | } | 73 | } |
74 | 74 | ||
75 | static struct snd_soc_ops rsrc_card_ops = { | 75 | static struct snd_soc_ops asoc_simple_card_ops = { |
76 | .startup = rsrc_card_startup, | 76 | .startup = asoc_simple_card_startup, |
77 | .shutdown = rsrc_card_shutdown, | 77 | .shutdown = asoc_simple_card_shutdown, |
78 | }; | 78 | }; |
79 | 79 | ||
80 | static int rsrc_card_dai_init(struct snd_soc_pcm_runtime *rtd) | 80 | static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd) |
81 | { | 81 | { |
82 | struct rsrc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card); | 82 | struct asoc_simple_card_priv *priv = snd_soc_card_get_drvdata(rtd->card); |
83 | struct snd_soc_dai *dai; | 83 | struct snd_soc_dai *dai; |
84 | struct snd_soc_dai_link *dai_link; | 84 | struct snd_soc_dai_link *dai_link; |
85 | struct asoc_simple_dai *dai_props; | 85 | struct asoc_simple_dai *dai_props; |
86 | int num = rtd->num; | 86 | int num = rtd->num; |
87 | 87 | ||
88 | dai_link = rsrc_priv_to_link(priv, num); | 88 | dai_link = simple_priv_to_link(priv, num); |
89 | dai_props = rsrc_priv_to_props(priv, num); | 89 | dai_props = simple_priv_to_props(priv, num); |
90 | dai = dai_link->dynamic ? | 90 | dai = dai_link->dynamic ? |
91 | rtd->cpu_dai : | 91 | rtd->cpu_dai : |
92 | rtd->codec_dai; | 92 | rtd->codec_dai; |
@@ -94,10 +94,10 @@ static int rsrc_card_dai_init(struct snd_soc_pcm_runtime *rtd) | |||
94 | return asoc_simple_card_init_dai(dai, dai_props); | 94 | return asoc_simple_card_init_dai(dai, dai_props); |
95 | } | 95 | } |
96 | 96 | ||
97 | static int rsrc_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, | 97 | static int asoc_simple_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, |
98 | struct snd_pcm_hw_params *params) | 98 | struct snd_pcm_hw_params *params) |
99 | { | 99 | { |
100 | struct rsrc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card); | 100 | struct asoc_simple_card_priv *priv = snd_soc_card_get_drvdata(rtd->card); |
101 | struct snd_interval *rate = hw_param_interval(params, | 101 | struct snd_interval *rate = hw_param_interval(params, |
102 | SNDRV_PCM_HW_PARAM_RATE); | 102 | SNDRV_PCM_HW_PARAM_RATE); |
103 | struct snd_interval *channels = hw_param_interval(params, | 103 | struct snd_interval *channels = hw_param_interval(params, |
@@ -114,13 +114,13 @@ static int rsrc_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, | |||
114 | return 0; | 114 | return 0; |
115 | } | 115 | } |
116 | 116 | ||
117 | static int rsrc_card_parse_links(struct device_node *np, | 117 | static int asoc_simple_card_parse_links(struct device_node *np, |
118 | struct rsrc_card_priv *priv, | 118 | struct asoc_simple_card_priv *priv, |
119 | int idx, bool is_fe) | 119 | int idx, bool is_fe) |
120 | { | 120 | { |
121 | struct device *dev = rsrc_priv_to_dev(priv); | 121 | struct device *dev = simple_priv_to_dev(priv); |
122 | struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx); | 122 | struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx); |
123 | struct asoc_simple_dai *dai_props = rsrc_priv_to_props(priv, idx); | 123 | struct asoc_simple_dai *dai_props = simple_priv_to_props(priv, idx); |
124 | int ret; | 124 | int ret; |
125 | 125 | ||
126 | /* Parse TDM slot */ | 126 | /* Parse TDM slot */ |
@@ -161,7 +161,7 @@ static int rsrc_card_parse_links(struct device_node *np, | |||
161 | 161 | ||
162 | asoc_simple_card_canonicalize_cpu(dai_link, is_single_links); | 162 | asoc_simple_card_canonicalize_cpu(dai_link, is_single_links); |
163 | } else { | 163 | } else { |
164 | const struct rsrc_card_of_data *of_data; | 164 | const struct asoc_simple_card_of_data *of_data; |
165 | 165 | ||
166 | of_data = of_device_get_match_data(dev); | 166 | of_data = of_device_get_match_data(dev); |
167 | 167 | ||
@@ -172,7 +172,7 @@ static int rsrc_card_parse_links(struct device_node *np, | |||
172 | 172 | ||
173 | /* BE settings */ | 173 | /* BE settings */ |
174 | dai_link->no_pcm = 1; | 174 | dai_link->no_pcm = 1; |
175 | dai_link->be_hw_params_fixup = rsrc_card_be_hw_params_fixup; | 175 | dai_link->be_hw_params_fixup = asoc_simple_card_be_hw_params_fixup; |
176 | 176 | ||
177 | ret = asoc_simple_card_parse_codec(np, dai_link, DAI, CELL); | 177 | ret = asoc_simple_card_parse_codec(np, dai_link, DAI, CELL); |
178 | if (ret < 0) | 178 | if (ret < 0) |
@@ -206,8 +206,8 @@ static int rsrc_card_parse_links(struct device_node *np, | |||
206 | 206 | ||
207 | dai_link->dpcm_playback = 1; | 207 | dai_link->dpcm_playback = 1; |
208 | dai_link->dpcm_capture = 1; | 208 | dai_link->dpcm_capture = 1; |
209 | dai_link->ops = &rsrc_card_ops; | 209 | dai_link->ops = &asoc_simple_card_ops; |
210 | dai_link->init = rsrc_card_dai_init; | 210 | dai_link->init = asoc_simple_card_dai_init; |
211 | 211 | ||
212 | dev_dbg(dev, "\t%s / %04x / %d\n", | 212 | dev_dbg(dev, "\t%s / %04x / %d\n", |
213 | dai_link->name, | 213 | dai_link->name, |
@@ -217,10 +217,10 @@ static int rsrc_card_parse_links(struct device_node *np, | |||
217 | return 0; | 217 | return 0; |
218 | } | 218 | } |
219 | 219 | ||
220 | static int rsrc_card_dai_link_of(struct device_node *node, | 220 | static int asoc_simple_card_dai_link_of(struct device_node *node, |
221 | struct rsrc_card_priv *priv) | 221 | struct asoc_simple_card_priv *priv) |
222 | { | 222 | { |
223 | struct device *dev = rsrc_priv_to_dev(priv); | 223 | struct device *dev = simple_priv_to_dev(priv); |
224 | struct snd_soc_dai_link *dai_link; | 224 | struct snd_soc_dai_link *dai_link; |
225 | struct device_node *np; | 225 | struct device_node *np; |
226 | unsigned int daifmt = 0; | 226 | unsigned int daifmt = 0; |
@@ -230,7 +230,7 @@ static int rsrc_card_dai_link_of(struct device_node *node, | |||
230 | /* find 1st codec */ | 230 | /* find 1st codec */ |
231 | i = 0; | 231 | i = 0; |
232 | for_each_child_of_node(node, np) { | 232 | for_each_child_of_node(node, np) { |
233 | dai_link = rsrc_priv_to_link(priv, i); | 233 | dai_link = simple_priv_to_link(priv, i); |
234 | 234 | ||
235 | if (strcmp(np->name, "codec") == 0) { | 235 | if (strcmp(np->name, "codec") == 0) { |
236 | ret = asoc_simple_card_parse_daifmt(dev, node, np, | 236 | ret = asoc_simple_card_parse_daifmt(dev, node, np, |
@@ -244,14 +244,14 @@ static int rsrc_card_dai_link_of(struct device_node *node, | |||
244 | 244 | ||
245 | i = 0; | 245 | i = 0; |
246 | for_each_child_of_node(node, np) { | 246 | for_each_child_of_node(node, np) { |
247 | dai_link = rsrc_priv_to_link(priv, i); | 247 | dai_link = simple_priv_to_link(priv, i); |
248 | dai_link->dai_fmt = daifmt; | 248 | dai_link->dai_fmt = daifmt; |
249 | 249 | ||
250 | is_fe = false; | 250 | is_fe = false; |
251 | if (strcmp(np->name, "cpu") == 0) | 251 | if (strcmp(np->name, "cpu") == 0) |
252 | is_fe = true; | 252 | is_fe = true; |
253 | 253 | ||
254 | ret = rsrc_card_parse_links(np, priv, i, is_fe); | 254 | ret = asoc_simple_card_parse_links(np, priv, i, is_fe); |
255 | if (ret < 0) | 255 | if (ret < 0) |
256 | return ret; | 256 | return ret; |
257 | i++; | 257 | i++; |
@@ -260,11 +260,11 @@ static int rsrc_card_dai_link_of(struct device_node *node, | |||
260 | return 0; | 260 | return 0; |
261 | } | 261 | } |
262 | 262 | ||
263 | static int rsrc_card_parse_of(struct device_node *node, | 263 | static int asoc_simple_card_parse_of(struct device_node *node, |
264 | struct rsrc_card_priv *priv, | 264 | struct asoc_simple_card_priv *priv, |
265 | struct device *dev) | 265 | struct device *dev) |
266 | { | 266 | { |
267 | const struct rsrc_card_of_data *of_data = of_device_get_match_data(dev); | 267 | const struct asoc_simple_card_of_data *of_data = of_device_get_match_data(dev); |
268 | struct asoc_simple_dai *props; | 268 | struct asoc_simple_dai *props; |
269 | struct snd_soc_dai_link *links; | 269 | struct snd_soc_dai_link *links; |
270 | int ret; | 270 | int ret; |
@@ -309,7 +309,7 @@ static int rsrc_card_parse_of(struct device_node *node, | |||
309 | dev_dbg(dev, "SRC : convert_rate %d\n", priv->convert_rate); | 309 | dev_dbg(dev, "SRC : convert_rate %d\n", priv->convert_rate); |
310 | dev_dbg(dev, "CTU : convert_channels %d\n", priv->convert_channels); | 310 | dev_dbg(dev, "CTU : convert_channels %d\n", priv->convert_channels); |
311 | 311 | ||
312 | ret = rsrc_card_dai_link_of(node, priv); | 312 | ret = asoc_simple_card_dai_link_of(node, priv); |
313 | if (ret < 0) | 313 | if (ret < 0) |
314 | return ret; | 314 | return ret; |
315 | 315 | ||
@@ -320,9 +320,9 @@ static int rsrc_card_parse_of(struct device_node *node, | |||
320 | return 0; | 320 | return 0; |
321 | } | 321 | } |
322 | 322 | ||
323 | static int rsrc_card_probe(struct platform_device *pdev) | 323 | static int asoc_simple_card_probe(struct platform_device *pdev) |
324 | { | 324 | { |
325 | struct rsrc_card_priv *priv; | 325 | struct asoc_simple_card_priv *priv; |
326 | struct device_node *np = pdev->dev.of_node; | 326 | struct device_node *np = pdev->dev.of_node; |
327 | struct device *dev = &pdev->dev; | 327 | struct device *dev = &pdev->dev; |
328 | int ret; | 328 | int ret; |
@@ -332,7 +332,7 @@ static int rsrc_card_probe(struct platform_device *pdev) | |||
332 | if (!priv) | 332 | if (!priv) |
333 | return -ENOMEM; | 333 | return -ENOMEM; |
334 | 334 | ||
335 | ret = rsrc_card_parse_of(np, priv, dev); | 335 | ret = asoc_simple_card_parse_of(np, priv, dev); |
336 | if (ret < 0) { | 336 | if (ret < 0) { |
337 | if (ret != -EPROBE_DEFER) | 337 | if (ret != -EPROBE_DEFER) |
338 | dev_err(dev, "parse error %d\n", ret); | 338 | dev_err(dev, "parse error %d\n", ret); |
@@ -350,25 +350,25 @@ err: | |||
350 | return ret; | 350 | return ret; |
351 | } | 351 | } |
352 | 352 | ||
353 | static int rsrc_card_remove(struct platform_device *pdev) | 353 | static int asoc_simple_card_remove(struct platform_device *pdev) |
354 | { | 354 | { |
355 | struct snd_soc_card *card = platform_get_drvdata(pdev); | 355 | struct snd_soc_card *card = platform_get_drvdata(pdev); |
356 | 356 | ||
357 | return asoc_simple_card_clean_reference(card); | 357 | return asoc_simple_card_clean_reference(card); |
358 | } | 358 | } |
359 | 359 | ||
360 | static struct platform_driver rsrc_card = { | 360 | static struct platform_driver asoc_simple_card = { |
361 | .driver = { | 361 | .driver = { |
362 | .name = "renesas-src-audio-card", | 362 | .name = "renesas-src-audio-card", |
363 | .of_match_table = rsrc_card_of_match, | 363 | .of_match_table = asoc_simple_card_of_match, |
364 | }, | 364 | }, |
365 | .probe = rsrc_card_probe, | 365 | .probe = asoc_simple_card_probe, |
366 | .remove = rsrc_card_remove, | 366 | .remove = asoc_simple_card_remove, |
367 | }; | 367 | }; |
368 | 368 | ||
369 | module_platform_driver(rsrc_card); | 369 | module_platform_driver(asoc_simple_card); |
370 | 370 | ||
371 | MODULE_ALIAS("platform:renesas-src-audio-card"); | 371 | MODULE_ALIAS("platform:asoc-simple-scu-card"); |
372 | MODULE_LICENSE("GPL"); | 372 | MODULE_LICENSE("GPL"); |
373 | MODULE_DESCRIPTION("Renesas Sampling Rate Convert Sound Card"); | 373 | MODULE_DESCRIPTION("ASoC Simple SCU Sound Card"); |
374 | MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>"); | 374 | MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>"); |