alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Mark Brown <broonie@kernel.org>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>,
	Liam Girdwood <lgirdwood@gmail.com>, Simon <horms@verge.net.au>,
	linux-renesas-soc@vger.kernel.org
Subject: [PATCH 38/39 v2] ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase2
Date: Tue, 31 May 2016 09:14:11 +0000	[thread overview]
Message-ID: <87wpmappcs.wl%kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <87fusysjam.wl%kuninori.morimoto.gx@renesas.com>

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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 should be renamed to
simple-dpcm-card. In order to easy patch review, as 2nd step,
this patch renames compatible from "renesas,rsrc-car" to
"simple-dpcm-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>
---
 .../bindings/sound/renesas,rsrc-card.txt           | 56 +++++++++--------
 sound/soc/sh/rcar/rsrc-card.c                      | 71 +++++++---------------
 2 files changed, 52 insertions(+), 75 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt b/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt
index 255ece3..cfdf441 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt
@@ -1,38 +1,35 @@
-Renesas Sampling Rate Convert Sound Card:
+ASoC simple DPCM Sound Card
 
-Renesas Sampling Rate Convert Sound Card specifies audio DAI connections of SoC <-> codec.
+Simple-Card specifies audio DAI connections of SoC <-> codec.
 
 Required properties:
 
-- compatible				: "renesas,rsrc-card{,<board>}"
-					  Examples with boards are:
-					    - "renesas,rsrc-card"
-					    - "renesas,rsrc-card,lager"
-					    - "renesas,rsrc-card,koelsch"
+- compatible				: "simple-dpcm-audio-card"
+
 Optional properties:
 
-- card_name				: User specified audio sound card name, one string
+- simple-audio-card,name		: User specified audio sound card name, one string
 					  property.
-- cpu					: CPU   sub-node
-- codec					: CODEC sub-node
+- simple-audio-card,cpu			: CPU   sub-node
+- simple-audio-card,codec		: CODEC sub-node
 
 Optional subnode properties:
 
-- format				: CPU/CODEC common audio format.
+- simple-audio-card,format		: CPU/CODEC common audio format.
 					  "i2s", "right_j", "left_j" , "dsp_a"
 					  "dsp_b", "ac97", "pdm", "msb", "lsb"
-- frame-master				: Indicates dai-link frame master.
+- simple-audio-card,frame-master	: Indicates dai-link frame master.
 					  phandle to a cpu or codec subnode.
-- bitclock-master			: Indicates dai-link bit clock master.
+- simple-audio-card,bitclock-master	: Indicates dai-link bit clock master.
 					  phandle to a cpu or codec subnode.
-- bitclock-inversion			: bool property. Add this if the
+- simple-audio-card,bitclock-inversion	: bool property. Add this if the
 					  dai-link uses bit clock inversion.
-- frame-inversion			: bool property. Add this if the
+- simple-audio-card,frame-inversion	: bool property. Add this if the
 					  dai-link uses frame clock inversion.
-- convert-rate				: platform specified sampling rate convert
-- convert-channels			: platform specified converted channel size (2 - 8 ch)
-- audio-prefix				: see audio-routing
-- audio-routing				: A list of the connections between audio components.
+- simple-audio-card,convert-rate	: platform specified sampling rate convert
+- simple-audio-card,convert-channels	: platform specified converted channel size (2 - 8 ch)
+- simple-audio-card,prefix		: see audio-routing
+- simple-audio-card,routing		: A list of the connections between audio components.
 					  Each entry is a pair of strings, the first being the connection's sink,
 					  the second being the connection's source. Valid names for sources.
 					  use audio-prefix if some components is using same sink/sources naming.
@@ -57,18 +54,25 @@ Optional CPU/CODEC subnodes properties:
 Example
 
 sound {
-	compatible = "renesas,rsrc-card,lager";
+	compatible = "simple-dpcm-audio-card";
+
+	simple-audio-card,name = "rsnd-ak4643";
+	simple-audio-card,format = "left_j";
+	simple-audio-card,format = "left_j";
+	simple-audio-card,bitclock-master = <&sndcodec>;
+	simple-audio-card,frame-master = <&sndcodec>;
+
+	simple-audio-card,convert-rate = <48000>; /* see audio_clk_a */
 
-	card-name = "rsnd-ak4643";
-	format = "left_j";
-	bitclock-master = <&sndcodec>;
-	frame-master = <&sndcodec>;
+	simple-audio-card,prefix = "ak4642";
+	simple-audio-card,routing = "ak4642 Playback", "DAI0 Playback",
+			"DAI0 Capture", "ak4642 Capture";
 
-	sndcpu: cpu {
+	sndcpu: simple-audio-card,cpu {
 		sound-dai = <&rcar_sound>;
 	};
 
-	sndcodec: codec {
+	sndcodec: simple-audio-card,codec {
 		sound-dai = <&ak4643>;
 		system-clock-frequency = <11289600>;
 	};
diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index e409b46..cef7ff5 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -28,21 +28,8 @@ struct asoc_simple_card_of_data {
 	int num_routes;
 };
 
-static const struct snd_soc_dapm_route routes_ssi0_ak4642[] = {
-	{"ak4642 Playback", NULL, "DAI0 Playback"},
-	{"DAI0 Capture", NULL, "ak4642 Capture"},
-};
-
-static const struct asoc_simple_card_of_data routes_of_ssi0_ak4642 = {
-	.prefix		= "ak4642",
-	.routes		= routes_ssi0_ak4642,
-	.num_routes	= ARRAY_SIZE(routes_ssi0_ak4642),
-};
-
 static const struct of_device_id asoc_simple_card_of_match[] = {
-	{ .compatible = "renesas,rsrc-card,lager",	.data = &routes_of_ssi0_ak4642 },
-	{ .compatible = "renesas,rsrc-card,koelsch",	.data = &routes_of_ssi0_ak4642 },
-	{ .compatible = "renesas,rsrc-card", },
+	{ .compatible = "simple-dpcm-audio-card", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, asoc_simple_card_of_match);
@@ -64,6 +51,7 @@ struct asoc_simple_card_priv {
 
 #define DAI	"sound-dai"
 #define CELL	"#sound-dai-cells"
+#define PREFIX	"simple-audio-card,"
 
 static int asoc_simple_card_startup(struct snd_pcm_substream *substream)
 {
@@ -157,10 +145,6 @@ static int asoc_simple_card_parse_links(struct device_node *np,
 			return ret;
 
 	} else {
-		const struct asoc_simple_card_of_data *of_data;
-
-		of_data = of_device_get_match_data(dev);
-
 		/* FE is dummy */
 		dai_link->cpu_of_node		= NULL;
 		dai_link->cpu_dai_name		= "snd-soc-dummy-dai";
@@ -178,17 +162,11 @@ static int asoc_simple_card_parse_links(struct device_node *np,
 		if (ret < 0)
 			return ret;
 
-		/* additional name prefix */
-		if (of_data) {
-			priv->codec_conf.of_node = dai_link->codec_of_node;
-			priv->codec_conf.name_prefix = of_data->prefix;
-		} else {
-			ret = asoc_simple_card_parse_card_prefix(&priv->snd_card,
-						dai_link, &priv->codec_conf,
-						"audio-");
-			if (ret < 0)
-				return ret;
-		}
+		ret = asoc_simple_card_parse_card_prefix(&priv->snd_card,
+						 dai_link, &priv->codec_conf,
+						 PREFIX);
+		if (ret < 0)
+			return ret;
 	}
 
 	ret = asoc_simple_card_parse_tdm(np, dai_props);
@@ -236,9 +214,9 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	for_each_child_of_node(node, np) {
 		dai_link = simple_priv_to_link(priv, i);
 
-		if (strcmp(np->name, "codec") == 0) {
+		if (strcmp(np->name, PREFIX "codec") == 0) {
 			ret = asoc_simple_card_parse_daifmt(dev, node, np,
-							    NULL, &daifmt);
+							    PREFIX, &daifmt);
 			if (ret < 0)
 				return ret;
 			break;
@@ -252,7 +230,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 		dai_link->dai_fmt = daifmt;
 
 		is_fe = false;
-		if (strcmp(np->name, "cpu") == 0)
+		if (strcmp(np->name, PREFIX "cpu") == 0)
 			is_fe = true;
 
 		ret = asoc_simple_card_parse_links(np, priv, i, is_fe);
@@ -268,7 +246,6 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 			      struct asoc_simple_card_priv *priv,
 			      struct device *dev)
 {
-	const struct asoc_simple_card_of_data *of_data = of_device_get_match_data(dev);
 	struct asoc_simple_dai *props;
 	struct snd_soc_dai_link *links;
 	int ret;
@@ -294,33 +271,29 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	priv->snd_card.codec_conf		= &priv->codec_conf;
 	priv->snd_card.num_configs		= 1;
 
-	if (of_data) {
-		priv->snd_card.of_dapm_routes		= of_data->routes;
-		priv->snd_card.num_of_dapm_routes	= of_data->num_routes;
-	} else {
-		snd_soc_of_parse_audio_routing(&priv->snd_card,
-					       "audio-routing");
-	}
+	ret = snd_soc_of_parse_audio_routing(&priv->snd_card, PREFIX "routing");
+	if (ret < 0)
+		return ret;
 
 	/* sampling rate convert */
-	of_property_read_u32(node, "convert-rate", &priv->convert_rate);
+	of_property_read_u32(node, PREFIX "convert-rate", &priv->convert_rate);
 
 	/* channels transfer */
-	of_property_read_u32(node, "convert-channels", &priv->convert_channels);
-
-	dev_dbg(dev, "New rsrc-audio-card: %s\n",
-		priv->snd_card.name ? priv->snd_card.name : "");
-	dev_dbg(dev, "SRC : convert_rate     %d\n", priv->convert_rate);
-	dev_dbg(dev, "CTU : convert_channels %d\n", priv->convert_channels);
+	of_property_read_u32(node, PREFIX "convert-channels", &priv->convert_channels);
 
 	ret = asoc_simple_card_dai_link_of(node, priv);
 	if (ret < 0)
 		return ret;
 
-	ret = asoc_simple_card_parse_card_name(&priv->snd_card, "card-");
+	ret = asoc_simple_card_parse_card_name(&priv->snd_card, PREFIX);
 	if (ret < 0)
 		return ret;
 
+	dev_dbg(dev, "New card: %s\n",
+		priv->snd_card.name ? priv->snd_card.name : "");
+	dev_dbg(dev, "convert_rate     %d\n", priv->convert_rate);
+	dev_dbg(dev, "convert_channels %d\n", priv->convert_channels);
+
 	return 0;
 }
 
@@ -363,7 +336,7 @@ static int asoc_simple_card_remove(struct platform_device *pdev)
 
 static struct platform_driver asoc_simple_card = {
 	.driver = {
-		.name = "renesas-src-audio-card",
+		.name = "simple-dpcm-audio-card",
 		.of_match_table = asoc_simple_card_of_match,
 	},
 	.probe = asoc_simple_card_probe,
-- 
1.9.1

  parent reply	other threads:[~2016-05-31  9:14 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-31  8:56 [PATCH 00/39 v2] ASoC: add simple-card-core and standardize "simple" card Kuninori Morimoto
2016-05-31  8:58 ` [PATCH 01/39 v2] ASoC: rsrc-card: remove unused dai_num Kuninori Morimoto
2016-05-31  8:59 ` [PATCH 02/39 v2] ASoC: simple-card: use common PREFIX for each DT property Kuninori Morimoto
2016-06-13 15:47   ` Applied "ASoC: simple-card: use common PREFIX for each DT property" to the asoc tree Mark Brown
2016-05-31  8:59 ` [PATCH 03/39 v2] ASoC: simple-card: add new asoc_simple_jack and use it Kuninori Morimoto
2016-06-29 18:20   ` Applied "ASoC: simple-card: add new asoc_simple_jack and use it" to the asoc tree Mark Brown
2016-05-31  9:00 ` [PATCH 04/39 v2] ASoC: add new simple-card-utils.c Kuninori Morimoto
2016-06-29 18:20   ` Applied "ASoC: add new simple-card-utils.c" to the asoc tree Mark Brown
2016-05-31  9:00 ` [PATCH 05/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_tdm() Kuninori Morimoto
2016-06-29 18:11   ` Mark Brown
2016-06-30  0:03     ` Kuninori Morimoto
2016-05-31  9:01 ` [PATCH 06/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_dailink_name() Kuninori Morimoto
2016-06-29 18:14   ` Mark Brown
2016-06-30  5:32     ` Kuninori Morimoto
2016-05-31  9:01 ` [PATCH 07/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_card_name() Kuninori Morimoto
2016-06-29 18:15   ` Mark Brown
2016-06-30  2:55     ` Kuninori Morimoto
2016-07-01  9:52       ` Mark Brown
2016-07-03 23:54         ` Kuninori Morimoto
2016-07-04  0:20           ` Kuninori Morimoto
2016-07-04  8:50             ` Mark Brown
2016-07-04  8:59               ` Kuninori Morimoto
2016-07-05 12:10                 ` Mark Brown
2016-07-05 23:12                   ` Kuninori Morimoto
2016-05-31  9:01 ` [PATCH 08/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_card_prefix() Kuninori Morimoto
2016-06-29 18:17   ` Mark Brown
2016-05-31  9:02 ` [PATCH 09/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_clk() Kuninori Morimoto
2016-06-29 18:18   ` Mark Brown
2016-06-30  0:25     ` Kuninori Morimoto
2016-06-30  0:39       ` Kuninori Morimoto
2016-07-01  9:55         ` Mark Brown
2016-07-03 23:58           ` Kuninori Morimoto
2016-05-31  9:03 ` [PATCH 10/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_endpoint() Kuninori Morimoto
2016-06-29 18:34   ` Mark Brown
2016-05-31  9:03 ` [PATCH 11/39 v2] ASoC: simple-card-utils: add asoc_simple_card_init_dai() Kuninori Morimoto
2016-05-31  9:03 ` [PATCH 12/39 v2] ASoC: simple-card-utils: add asoc_simple_card_canonicalize_dailink() Kuninori Morimoto
2016-05-31  9:04 ` [PATCH 13/39 v2] ASoC: simple-card-utils: add asoc_simple_card_canonicalize_cpu() Kuninori Morimoto
2016-05-31  9:04 ` [PATCH 14/39 v2] ASoC: simple-card-utils: add asoc_simple_card_clean_reference() Kuninori Morimoto
2016-05-31  9:05 ` [PATCH 15/39 v2] ASoC: simple-card: use asoc_simple_card_parse_daifmt() Kuninori Morimoto
2016-05-31  9:05 ` [PATCH 16/39 v2] ASoC: simple-card: use asoc_simple_card_parse_clk() Kuninori Morimoto
2016-05-31  9:05 ` [PATCH 17/39 v2] ASoC: simple-card: use asoc_simple_card_parse_endpoint() Kuninori Morimoto
2016-05-31  9:06 ` [PATCH 18/39 v2] ASoC: simple-card: use asoc_simple_card_parse_tdm() Kuninori Morimoto
2016-05-31  9:06 ` [PATCH 19/39 v2] ASoC: simple-card: use asoc_simple_card_parse_card_name() Kuninori Morimoto
2016-07-16 12:03   ` Applied "ASoC: simple-card: use asoc_simple_card_parse_card_name()" to the asoc tree Mark Brown
2016-05-31  9:07 ` [PATCH 20/39 v2] ASoC: simple-card: use asoc_simple_card_parse_dailink_name() Kuninori Morimoto
2016-05-31  9:07 ` [PATCH 21/39 v2] ASoC: simple-card: use asoc_simple_card_init_dai() Kuninori Morimoto
2016-05-31  9:07 ` [PATCH 22/39 v2] ASoC: simple-card: use asoc_simple_card_canonicalize_dailink() Kuninori Morimoto
2016-05-31  9:08 ` [PATCH 23/39 v2] ASoC: simple-card: use asoc_simple_card_canonicalize_cpu() Kuninori Morimoto
2016-05-31  9:08 ` [PATCH 24/39 v2] ASoC: simple-card: use asoc_simple_card_clean_reference() Kuninori Morimoto
2016-05-31  9:09 ` [PATCH 25/39 v2] ASoC: rsrc-card: use asoc_simple_card_parse_daifmt() Kuninori Morimoto
2016-07-01 15:59   ` Applied "ASoC: rsrc-card: use asoc_simple_card_parse_daifmt()" to the asoc tree Mark Brown
2016-05-31  9:09 ` [PATCH 26/39 v2] ASoC: rsrc-card: use asoc_simple_card_parse_dailink_name() Kuninori Morimoto
2016-05-31  9:09 ` [PATCH 27/39 v2] ASoC: rsrc-card: use asoc_simple_dai instead of rsrc_card_dai Kuninori Morimoto
2016-05-31  9:10 ` [PATCH 28/39 v2] ASoC: rsrc-card: use asoc_simple_card_parse_clk() Kuninori Morimoto
2016-05-31  9:10 ` [PATCH 29/39 v2] ASoC: rsrc-card: use asoc_simple_card_parse_endpoint() Kuninori Morimoto
2016-05-31  9:11 ` [PATCH 30/39 v2] ASoC: rsrc-card: use asoc_simple_card_parse_card_name() Kuninori Morimoto
2016-05-31  9:11 ` [PATCH 31/39 v2] ASoC: rsrc-card: use asoc_simple_card_parse_card_prefix() Kuninori Morimoto
2016-05-31  9:11 ` [PATCH 32/39 v2] ASoC: rsrc-card: use asoc_simple_card_parse_tdm() Kuninori Morimoto
2016-05-31  9:12 ` [PATCH 33/39 v2] ASoC: rsrc-card: use asoc_simple_card_init_dai() Kuninori Morimoto
2016-05-31  9:12 ` [PATCH 34/39 v2] ASoC: rsrc-card: use asoc_simple_card_canonicalize_cpu() Kuninori Morimoto
2016-05-31  9:13 ` [PATCH 35/39 v2] ASoC: rsrc-card: use asoc_simple_card_canonicalize_dailink() Kuninori Morimoto
2016-05-31  9:13 ` [PATCH 36/39 v2] ASoC: rsrc-card: use asoc_simple_card_clean_reference() Kuninori Morimoto
2016-05-31  9:13 ` [PATCH 37/39 v2] ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase1 Kuninori Morimoto
2016-05-31  9:14 ` Kuninori Morimoto [this message]
2016-05-31  9:14 ` [PATCH 39/39 v2] ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase3 Kuninori Morimoto
2016-06-20  1:49 ` [PATCH 00/39 v2] ASoC: add simple-card-core and standardize "simple" card Kuninori Morimoto
2016-06-29 18:16 ` Mark Brown
2016-06-30  5:34   ` Kuninori Morimoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wpmappcs.wl%kuninori.morimoto.gx@renesas.com \
    --to=kuninori.morimoto.gx@renesas.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=horms@verge.net.au \
    --cc=lgirdwood@gmail.com \
    --cc=linux-renesas-soc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).