aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2016-08-22 21:34:43 -0400
committerMark Brown <broonie@kernel.org>2016-08-24 06:19:16 -0400
commit64df0e6842925311d74f6944710495981d5a0ace (patch)
tree8b49dfc1a8c26f29cc5ef57638f4c9e75e302dfc
parent53e682b60019d501e00cfeb701f99ca027470e36 (diff)
ASoC: rsrc-card: rename rsrc-card to simple-scu-card phase2
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 2nd step, this patch adds new compatible "simple-scu-audio-card"; rcar-card used specific property, not "simple-audio-card", but it should be now. Actually, rsrc-card is upstreamed driver, but noone is using it on upstream. The user is only local, and it is only me. Thus, there is no compatible break by this patch. This patch uses "simple-audio-card" prefix. And it removes rcar-card specifix compatible too. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt52
-rw-r--r--sound/soc/sh/rcar/rsrc-card.c55
2 files changed, 51 insertions, 56 deletions
diff --git a/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt b/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt
index f148bf27723b..ecb4a249fe6e 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt
@@ -1,35 +1,36 @@
1Renesas Sampling Rate Convert Sound Card: 1ASoC simple SCU Sound Card
2 2
3Renesas Sampling Rate Convert Sound Card specifies audio DAI connections of SoC <-> codec. 3Simple-Card specifies audio DAI connections of SoC <-> codec.
4 4
5Required properties: 5Required properties:
6 6
7- compatible : "renesas,rsrc-card" 7- compatible : "simple-scu-audio-card"
8 "renesas,rsrc-card"
8 9
9Optional properties: 10Optional properties:
10 11
11- card_name : User specified audio sound card name, one string 12- simple-audio-card,name : User specified audio sound card name, one string
12 property. 13 property.
13- cpu : CPU sub-node 14- simple-audio-card,cpu : CPU sub-node
14- codec : CODEC sub-node 15- simple-audio-card,codec : CODEC sub-node
15 16
16Optional subnode properties: 17Optional subnode properties:
17 18
18- format : CPU/CODEC common audio format. 19- simple-audio-card,format : CPU/CODEC common audio format.
19 "i2s", "right_j", "left_j" , "dsp_a" 20 "i2s", "right_j", "left_j" , "dsp_a"
20 "dsp_b", "ac97", "pdm", "msb", "lsb" 21 "dsp_b", "ac97", "pdm", "msb", "lsb"
21- frame-master : Indicates dai-link frame master. 22- simple-audio-card,frame-master : Indicates dai-link frame master.
22 phandle to a cpu or codec subnode. 23 phandle to a cpu or codec subnode.
23- bitclock-master : Indicates dai-link bit clock master. 24- simple-audio-card,bitclock-master : Indicates dai-link bit clock master.
24 phandle to a cpu or codec subnode. 25 phandle to a cpu or codec subnode.
25- bitclock-inversion : bool property. Add this if the 26- simple-audio-card,bitclock-inversion : bool property. Add this if the
26 dai-link uses bit clock inversion. 27 dai-link uses bit clock inversion.
27- frame-inversion : bool property. Add this if the 28- simple-audio-card,frame-inversion : bool property. Add this if the
28 dai-link uses frame clock inversion. 29 dai-link uses frame clock inversion.
29- convert-rate : platform specified sampling rate convert 30- simple-audio-card,convert-rate : platform specified sampling rate convert
30- convert-channels : platform specified converted channel size (2 - 8 ch) 31- simple-audio-card,convert-channels : platform specified converted channel size (2 - 8 ch)
31- audio-prefix : see audio-routing 32- simple-audio-card,prefix : see audio-routing
32- audio-routing : A list of the connections between audio components. 33- simple-audio-card,routing : A list of the connections between audio components.
33 Each entry is a pair of strings, the first being the connection's sink, 34 Each entry is a pair of strings, the first being the connection's sink,
34 the second being the connection's source. Valid names for sources. 35 the second being the connection's source. Valid names for sources.
35 use audio-prefix if some components is using same sink/sources naming. 36 use audio-prefix if some components is using same sink/sources naming.
@@ -54,18 +55,25 @@ Optional CPU/CODEC subnodes properties:
54Example 55Example
55 56
56sound { 57sound {
57 compatible = "renesas,rsrc-card,lager"; 58 compatible = "simple-scu-audio-card";
58 59
59 card-name = "rsnd-ak4643"; 60 simple-audio-card,name = "rsnd-ak4643";
60 format = "left_j"; 61 simple-audio-card,format = "left_j";
61 bitclock-master = <&sndcodec>; 62 simple-audio-card,format = "left_j";
62 frame-master = <&sndcodec>; 63 simple-audio-card,bitclock-master = <&sndcodec>;
64 simple-audio-card,frame-master = <&sndcodec>;
63 65
64 sndcpu: cpu { 66 simple-audio-card,convert-rate = <48000>; /* see audio_clk_a */
67
68 simple-audio-card,prefix = "ak4642";
69 simple-audio-card,routing = "ak4642 Playback", "DAI0 Playback",
70 "DAI0 Capture", "ak4642 Capture";
71
72 sndcpu: simple-audio-card,cpu {
65 sound-dai = <&rcar_sound>; 73 sound-dai = <&rcar_sound>;
66 }; 74 };
67 75
68 sndcodec: codec { 76 sndcodec: simple-audio-card,codec {
69 sound-dai = <&ak4643>; 77 sound-dai = <&ak4643>;
70 system-clock-frequency = <11289600>; 78 system-clock-frequency = <11289600>;
71 }; 79 };
diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index a0d0f3679eeb..3fa19084e326 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -30,6 +30,7 @@ struct asoc_simple_card_of_data {
30 30
31static const struct of_device_id asoc_simple_card_of_match[] = { 31static const struct of_device_id asoc_simple_card_of_match[] = {
32 { .compatible = "renesas,rsrc-card", }, 32 { .compatible = "renesas,rsrc-card", },
33 { .compatible = "simple-scu-audio-card", },
33 {}, 34 {},
34}; 35};
35MODULE_DEVICE_TABLE(of, asoc_simple_card_of_match); 36MODULE_DEVICE_TABLE(of, asoc_simple_card_of_match);
@@ -51,6 +52,7 @@ struct asoc_simple_card_priv {
51 52
52#define DAI "sound-dai" 53#define DAI "sound-dai"
53#define CELL "#sound-dai-cells" 54#define CELL "#sound-dai-cells"
55#define PREFIX "simple-audio-card,"
54 56
55static int asoc_simple_card_startup(struct snd_pcm_substream *substream) 57static int asoc_simple_card_startup(struct snd_pcm_substream *substream)
56{ 58{
@@ -161,10 +163,6 @@ static int asoc_simple_card_parse_links(struct device_node *np,
161 163
162 asoc_simple_card_canonicalize_cpu(dai_link, is_single_links); 164 asoc_simple_card_canonicalize_cpu(dai_link, is_single_links);
163 } else { 165 } else {
164 const struct asoc_simple_card_of_data *of_data;
165
166 of_data = of_device_get_match_data(dev);
167
168 /* FE is dummy */ 166 /* FE is dummy */
169 dai_link->cpu_of_node = NULL; 167 dai_link->cpu_of_node = NULL;
170 dai_link->cpu_dai_name = "snd-soc-dummy-dai"; 168 dai_link->cpu_dai_name = "snd-soc-dummy-dai";
@@ -188,16 +186,10 @@ static int asoc_simple_card_parse_links(struct device_node *np,
188 if (ret < 0) 186 if (ret < 0)
189 return ret; 187 return ret;
190 188
191 /* additional name prefix */ 189 snd_soc_of_parse_audio_prefix(&priv->snd_card,
192 if (of_data) { 190 &priv->codec_conf,
193 priv->codec_conf.of_node = dai_link->codec_of_node; 191 dai_link->codec_of_node,
194 priv->codec_conf.name_prefix = of_data->prefix; 192 PREFIX "prefix");
195 } else {
196 snd_soc_of_parse_audio_prefix(&priv->snd_card,
197 &priv->codec_conf,
198 dai_link->codec_of_node,
199 "audio-prefix");
200 }
201 } 193 }
202 194
203 ret = asoc_simple_card_canonicalize_dailink(dai_link); 195 ret = asoc_simple_card_canonicalize_dailink(dai_link);
@@ -232,9 +224,9 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
232 for_each_child_of_node(node, np) { 224 for_each_child_of_node(node, np) {
233 dai_link = simple_priv_to_link(priv, i); 225 dai_link = simple_priv_to_link(priv, i);
234 226
235 if (strcmp(np->name, "codec") == 0) { 227 if (strcmp(np->name, PREFIX "codec") == 0) {
236 ret = asoc_simple_card_parse_daifmt(dev, node, np, 228 ret = asoc_simple_card_parse_daifmt(dev, node, np,
237 NULL, &daifmt); 229 PREFIX, &daifmt);
238 if (ret < 0) 230 if (ret < 0)
239 return ret; 231 return ret;
240 break; 232 break;
@@ -248,7 +240,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
248 dai_link->dai_fmt = daifmt; 240 dai_link->dai_fmt = daifmt;
249 241
250 is_fe = false; 242 is_fe = false;
251 if (strcmp(np->name, "cpu") == 0) 243 if (strcmp(np->name, PREFIX "cpu") == 0)
252 is_fe = true; 244 is_fe = true;
253 245
254 ret = asoc_simple_card_parse_links(np, priv, i, is_fe); 246 ret = asoc_simple_card_parse_links(np, priv, i, is_fe);
@@ -264,7 +256,6 @@ static int asoc_simple_card_parse_of(struct device_node *node,
264 struct asoc_simple_card_priv *priv, 256 struct asoc_simple_card_priv *priv,
265 struct device *dev) 257 struct device *dev)
266{ 258{
267 const struct asoc_simple_card_of_data *of_data = of_device_get_match_data(dev);
268 struct asoc_simple_dai *props; 259 struct asoc_simple_dai *props;
269 struct snd_soc_dai_link *links; 260 struct snd_soc_dai_link *links;
270 int ret; 261 int ret;
@@ -290,33 +281,29 @@ static int asoc_simple_card_parse_of(struct device_node *node,
290 priv->snd_card.codec_conf = &priv->codec_conf; 281 priv->snd_card.codec_conf = &priv->codec_conf;
291 priv->snd_card.num_configs = 1; 282 priv->snd_card.num_configs = 1;
292 283
293 if (of_data) { 284 ret = snd_soc_of_parse_audio_routing(&priv->snd_card, PREFIX "routing");
294 priv->snd_card.of_dapm_routes = of_data->routes; 285 if (ret < 0)
295 priv->snd_card.num_of_dapm_routes = of_data->num_routes; 286 return ret;
296 } else {
297 snd_soc_of_parse_audio_routing(&priv->snd_card,
298 "audio-routing");
299 }
300 287
301 /* sampling rate convert */ 288 /* sampling rate convert */
302 of_property_read_u32(node, "convert-rate", &priv->convert_rate); 289 of_property_read_u32(node, PREFIX "convert-rate", &priv->convert_rate);
303 290
304 /* channels transfer */ 291 /* channels transfer */
305 of_property_read_u32(node, "convert-channels", &priv->convert_channels); 292 of_property_read_u32(node, PREFIX "convert-channels", &priv->convert_channels);
306
307 dev_dbg(dev, "New rsrc-audio-card: %s\n",
308 priv->snd_card.name ? priv->snd_card.name : "");
309 dev_dbg(dev, "SRC : convert_rate %d\n", priv->convert_rate);
310 dev_dbg(dev, "CTU : convert_channels %d\n", priv->convert_channels);
311 293
312 ret = asoc_simple_card_dai_link_of(node, priv); 294 ret = asoc_simple_card_dai_link_of(node, priv);
313 if (ret < 0) 295 if (ret < 0)
314 return ret; 296 return ret;
315 297
316 ret = asoc_simple_card_parse_card_name(&priv->snd_card, "card-"); 298 ret = asoc_simple_card_parse_card_name(&priv->snd_card, PREFIX);
317 if (ret < 0) 299 if (ret < 0)
318 return ret; 300 return ret;
319 301
302 dev_dbg(dev, "New card: %s\n",
303 priv->snd_card.name ? priv->snd_card.name : "");
304 dev_dbg(dev, "convert_rate %d\n", priv->convert_rate);
305 dev_dbg(dev, "convert_channels %d\n", priv->convert_channels);
306
320 return 0; 307 return 0;
321} 308}
322 309
@@ -359,7 +346,7 @@ static int asoc_simple_card_remove(struct platform_device *pdev)
359 346
360static struct platform_driver asoc_simple_card = { 347static struct platform_driver asoc_simple_card = {
361 .driver = { 348 .driver = {
362 .name = "renesas-src-audio-card", 349 .name = "simple-scu-audio-card",
363 .of_match_table = asoc_simple_card_of_match, 350 .of_match_table = asoc_simple_card_of_match,
364 }, 351 },
365 .probe = asoc_simple_card_probe, 352 .probe = asoc_simple_card_probe,