alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] ASoC: simple-card: sync and cleanup
@ 2016-10-28  3:36 Kuninori Morimoto
  2016-10-28  3:37 ` [PATCH 1/4] ASoC: simple-scu-card: code sync: follow to simple family style Kuninori Morimoto
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Kuninori Morimoto @ 2016-10-28  3:36 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Simon


Hi Mark

These are simple-card synchronize and cleanup.
simple-card will be more readable

Kuninori Morimoto (4):
      1) ASoC: simple-scu-card: code sync: follow to simple family style
      2) ASoC: simple-scu-card: code sync: rename asoc_simple_card_priv
      3) ASoC: simple-scu-card: code sync: tidyup props/link naming
      4) ASoC: simple-card-utils: remove unnecessary cpu/codec pointer check

 sound/soc/generic/simple-card-utils.c |   3 ---
 sound/soc/generic/simple-scu-card.c   | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------
 2 files changed, 50 insertions(+), 66 deletions(-)

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/4] ASoC: simple-scu-card: code sync: follow to simple family style
  2016-10-28  3:36 [PATCH 0/4] ASoC: simple-card: sync and cleanup Kuninori Morimoto
@ 2016-10-28  3:37 ` Kuninori Morimoto
  2016-10-28  3:37 ` [PATCH 2/4] ASoC: simple-scu-card: code sync: rename asoc_simple_card_priv Kuninori Morimoto
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Kuninori Morimoto @ 2016-10-28  3:37 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Simon

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

simple sound card family are using very similar style, but because of its
historical reason, there are small differences. For example pointer style,
function name, caller postion etc...
This patch synchronized simple card style to other simple card family

Current simple-scu-card function naming is different from other simple card
family. And related to it, the necessary operation position is also
different. This patch synchronize these to other simple card family.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-scu-card.c | 99 ++++++++++++++++---------------------
 1 file changed, 43 insertions(+), 56 deletions(-)

diff --git a/sound/soc/generic/simple-scu-card.c b/sound/soc/generic/simple-scu-card.c
index b9973a5..b8d8437 100644
--- a/sound/soc/generic/simple-scu-card.c
+++ b/sound/soc/generic/simple-scu-card.c
@@ -101,7 +101,7 @@ static int asoc_simple_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
 	return 0;
 }
 
-static int asoc_simple_card_parse_links(struct device_node *np,
+static int asoc_simple_card_dai_link_of(struct device_node *np,
 					struct asoc_simple_card_priv *priv,
 					unsigned int daifmt,
 					int idx, bool is_fe)
@@ -195,22 +195,35 @@ static int asoc_simple_card_parse_links(struct device_node *np,
 	return 0;
 }
 
-static int asoc_simple_card_dai_link_of(struct device_node *node,
-				 struct asoc_simple_card_priv *priv)
+static int asoc_simple_card_parse_of(struct device_node *node,
+				     struct asoc_simple_card_priv *priv)
+
 {
 	struct device *dev = simple_priv_to_dev(priv);
 	struct device_node *np;
 	unsigned int daifmt = 0;
-	int ret, i;
 	bool is_fe;
+	int ret, i;
+
+	if (!node)
+		return -EINVAL;
+
+	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, PREFIX "convert-rate", &priv->convert_rate);
+
+	/* channels transfer */
+	of_property_read_u32(node, PREFIX "convert-channels", &priv->convert_channels);
 
 	/* find 1st codec */
 	np = of_get_child_by_name(node, PREFIX "codec");
 	if (!np)
 		return -ENODEV;
 
-	ret = asoc_simple_card_parse_daifmt(dev, node, np,
-					    PREFIX, &daifmt);
+	ret = asoc_simple_card_parse_daifmt(dev, node, np, PREFIX, &daifmt);
 	if (ret < 0)
 		return ret;
 
@@ -220,58 +233,12 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 		if (strcmp(np->name, PREFIX "cpu") == 0)
 			is_fe = true;
 
-		ret = asoc_simple_card_parse_links(np, priv, daifmt, i, is_fe);
+		ret = asoc_simple_card_dai_link_of(np, priv, daifmt, i, is_fe);
 		if (ret < 0)
 			return ret;
 		i++;
 	}
 
-	return 0;
-}
-
-static int asoc_simple_card_parse_of(struct device_node *node,
-			      struct asoc_simple_card_priv *priv,
-			      struct device *dev)
-{
-	struct asoc_simple_dai *props;
-	struct snd_soc_dai_link *links;
-	int ret;
-	int num;
-
-	if (!node)
-		return -EINVAL;
-
-	num = of_get_child_count(node);
-	props = devm_kzalloc(dev, sizeof(*props) * num, GFP_KERNEL);
-	links = devm_kzalloc(dev, sizeof(*links) * num, GFP_KERNEL);
-	if (!props || !links)
-		return -ENOMEM;
-
-	priv->dai_props	= props;
-	priv->dai_link	= links;
-
-	/* Init snd_soc_card */
-	priv->snd_card.owner			= THIS_MODULE;
-	priv->snd_card.dev			= dev;
-	priv->snd_card.dai_link			= priv->dai_link;
-	priv->snd_card.num_links		= num;
-	priv->snd_card.codec_conf		= &priv->codec_conf;
-	priv->snd_card.num_configs		= 1;
-
-	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, PREFIX "convert-rate", &priv->convert_rate);
-
-	/* channels transfer */
-	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, PREFIX);
 	if (ret < 0)
 		return ret;
@@ -287,16 +254,36 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 static int asoc_simple_card_probe(struct platform_device *pdev)
 {
 	struct asoc_simple_card_priv *priv;
-	struct device_node *np = pdev->dev.of_node;
+	struct snd_soc_dai_link *links;
+	struct asoc_simple_dai *props;
 	struct device *dev = &pdev->dev;
-	int ret;
+	struct device_node *np = pdev->dev.of_node;
+	int num, ret;
 
 	/* Allocate the private data */
 	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;
 
-	ret = asoc_simple_card_parse_of(np, priv, dev);
+	num = of_get_child_count(np);
+
+	props = devm_kzalloc(dev, sizeof(*props) * num, GFP_KERNEL);
+	links = devm_kzalloc(dev, sizeof(*links) * num, GFP_KERNEL);
+	if (!props || !links)
+		return -ENOMEM;
+
+	priv->dai_props				= props;
+	priv->dai_link				= links;
+
+	/* Init snd_soc_card */
+	priv->snd_card.owner			= THIS_MODULE;
+	priv->snd_card.dev			= dev;
+	priv->snd_card.dai_link			= priv->dai_link;
+	priv->snd_card.num_links		= num;
+	priv->snd_card.codec_conf		= &priv->codec_conf;
+	priv->snd_card.num_configs		= 1;
+
+	ret = asoc_simple_card_parse_of(np, priv);
 	if (ret < 0) {
 		if (ret != -EPROBE_DEFER)
 			dev_err(dev, "parse error %d\n", ret);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/4] ASoC: simple-scu-card: code sync: rename asoc_simple_card_priv
  2016-10-28  3:36 [PATCH 0/4] ASoC: simple-card: sync and cleanup Kuninori Morimoto
  2016-10-28  3:37 ` [PATCH 1/4] ASoC: simple-scu-card: code sync: follow to simple family style Kuninori Morimoto
@ 2016-10-28  3:37 ` Kuninori Morimoto
  2016-10-28  3:38 ` [PATCH 3/4] ASoC: simple-scu-card: code sync: tidyup props/link naming Kuninori Morimoto
  2016-10-28  3:38 ` [PATCH 4/4] ASoC: simple-card-utils: remove unnecessary cpu/codec pointer check Kuninori Morimoto
  3 siblings, 0 replies; 5+ messages in thread
From: Kuninori Morimoto @ 2016-10-28  3:37 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Simon

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

simple sound card family are using very similar style, but because of its
historical reason, there are small differences. For example pointer style,
function name, caller postion etc...
This patch synchronized simple card style to other simple card family

This patch renames asoc_simple_card_priv to simple_card_data,
same as other simple card family.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-scu-card.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/sound/soc/generic/simple-scu-card.c b/sound/soc/generic/simple-scu-card.c
index b8d8437..1704b18 100644
--- a/sound/soc/generic/simple-scu-card.c
+++ b/sound/soc/generic/simple-scu-card.c
@@ -22,7 +22,7 @@
 #include <sound/soc-dai.h>
 #include <sound/simple_card_utils.h>
 
-struct asoc_simple_card_priv {
+struct simple_card_data {
 	struct snd_soc_card snd_card;
 	struct snd_soc_codec_conf codec_conf;
 	struct asoc_simple_dai *dai_props;
@@ -42,7 +42,7 @@ struct asoc_simple_card_priv {
 static int asoc_simple_card_startup(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct asoc_simple_card_priv *priv =	snd_soc_card_get_drvdata(rtd->card);
+	struct simple_card_data *priv =	snd_soc_card_get_drvdata(rtd->card);
 	struct asoc_simple_dai *dai_props =
 		simple_priv_to_props(priv, rtd->num);
 
@@ -52,7 +52,7 @@ static int asoc_simple_card_startup(struct snd_pcm_substream *substream)
 static void asoc_simple_card_shutdown(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct asoc_simple_card_priv *priv =	snd_soc_card_get_drvdata(rtd->card);
+	struct simple_card_data *priv =	snd_soc_card_get_drvdata(rtd->card);
 	struct asoc_simple_dai *dai_props =
 		simple_priv_to_props(priv, rtd->num);
 
@@ -66,7 +66,7 @@ static void asoc_simple_card_shutdown(struct snd_pcm_substream *substream)
 
 static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 {
-	struct asoc_simple_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
+	struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card);
 	struct snd_soc_dai *dai;
 	struct snd_soc_dai_link *dai_link;
 	struct asoc_simple_dai *dai_props;
@@ -84,7 +84,7 @@ static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 static int asoc_simple_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
 					struct snd_pcm_hw_params *params)
 {
-	struct asoc_simple_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
+	struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card);
 	struct snd_interval *rate = hw_param_interval(params,
 						      SNDRV_PCM_HW_PARAM_RATE);
 	struct snd_interval *channels = hw_param_interval(params,
@@ -102,7 +102,7 @@ static int asoc_simple_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
 }
 
 static int asoc_simple_card_dai_link_of(struct device_node *np,
-					struct asoc_simple_card_priv *priv,
+					struct simple_card_data *priv,
 					unsigned int daifmt,
 					int idx, bool is_fe)
 {
@@ -196,7 +196,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *np,
 }
 
 static int asoc_simple_card_parse_of(struct device_node *node,
-				     struct asoc_simple_card_priv *priv)
+				     struct simple_card_data *priv)
 
 {
 	struct device *dev = simple_priv_to_dev(priv);
@@ -253,7 +253,7 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 
 static int asoc_simple_card_probe(struct platform_device *pdev)
 {
-	struct asoc_simple_card_priv *priv;
+	struct simple_card_data *priv;
 	struct snd_soc_dai_link *links;
 	struct asoc_simple_dai *props;
 	struct device *dev = &pdev->dev;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/4] ASoC: simple-scu-card: code sync: tidyup props/link naming
  2016-10-28  3:36 [PATCH 0/4] ASoC: simple-card: sync and cleanup Kuninori Morimoto
  2016-10-28  3:37 ` [PATCH 1/4] ASoC: simple-scu-card: code sync: follow to simple family style Kuninori Morimoto
  2016-10-28  3:37 ` [PATCH 2/4] ASoC: simple-scu-card: code sync: rename asoc_simple_card_priv Kuninori Morimoto
@ 2016-10-28  3:38 ` Kuninori Morimoto
  2016-10-28  3:38 ` [PATCH 4/4] ASoC: simple-card-utils: remove unnecessary cpu/codec pointer check Kuninori Morimoto
  3 siblings, 0 replies; 5+ messages in thread
From: Kuninori Morimoto @ 2016-10-28  3:38 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Simon

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

simple sound card family are using very similar style, but because of its
historical reason, there are small differences. For example pointer style,
function name, caller postion etc...
This patch synchronizes style to other simple card family so that be enable
to easy reviewing.

This patch uses dai_link/dai_props instead of links/props.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-scu-card.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/sound/soc/generic/simple-scu-card.c b/sound/soc/generic/simple-scu-card.c
index 1704b18..348e9a7 100644
--- a/sound/soc/generic/simple-scu-card.c
+++ b/sound/soc/generic/simple-scu-card.c
@@ -254,8 +254,8 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 static int asoc_simple_card_probe(struct platform_device *pdev)
 {
 	struct simple_card_data *priv;
-	struct snd_soc_dai_link *links;
-	struct asoc_simple_dai *props;
+	struct snd_soc_dai_link *dai_link;
+	struct asoc_simple_dai *dai_props;
 	struct device *dev = &pdev->dev;
 	struct device_node *np = pdev->dev.of_node;
 	int num, ret;
@@ -267,13 +267,13 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 
 	num = of_get_child_count(np);
 
-	props = devm_kzalloc(dev, sizeof(*props) * num, GFP_KERNEL);
-	links = devm_kzalloc(dev, sizeof(*links) * num, GFP_KERNEL);
-	if (!props || !links)
+	dai_props = devm_kzalloc(dev, sizeof(*dai_props) * num, GFP_KERNEL);
+	dai_link  = devm_kzalloc(dev, sizeof(*dai_link)  * num, GFP_KERNEL);
+	if (!dai_props || !dai_link)
 		return -ENOMEM;
 
-	priv->dai_props				= props;
-	priv->dai_link				= links;
+	priv->dai_props				= dai_props;
+	priv->dai_link				= dai_link;
 
 	/* Init snd_soc_card */
 	priv->snd_card.owner			= THIS_MODULE;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 4/4] ASoC: simple-card-utils: remove unnecessary cpu/codec pointer check
  2016-10-28  3:36 [PATCH 0/4] ASoC: simple-card: sync and cleanup Kuninori Morimoto
                   ` (2 preceding siblings ...)
  2016-10-28  3:38 ` [PATCH 3/4] ASoC: simple-scu-card: code sync: tidyup props/link naming Kuninori Morimoto
@ 2016-10-28  3:38 ` Kuninori Morimoto
  3 siblings, 0 replies; 5+ messages in thread
From: Kuninori Morimoto @ 2016-10-28  3:38 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Simon

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

Remove cpu/codec pointer check from asoc_simple_card_canonicalize_dailink()
This is verbose check, and will be issue if CPU name was created by
fmt_single_name() on simple-scu-card.c.
see also asoc_simple_card_canonicalize_cpu()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card-utils.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index 1cb3930..e5b80f5 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -195,9 +195,6 @@ int asoc_simple_card_init_dai(struct snd_soc_dai *dai,
 
 int asoc_simple_card_canonicalize_dailink(struct snd_soc_dai_link *dai_link)
 {
-	if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name)
-		return -EINVAL;
-
 	/* Assumes platform == cpu */
 	if (!dai_link->platform_of_node)
 		dai_link->platform_of_node = dai_link->cpu_of_node;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-10-28  3:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-28  3:36 [PATCH 0/4] ASoC: simple-card: sync and cleanup Kuninori Morimoto
2016-10-28  3:37 ` [PATCH 1/4] ASoC: simple-scu-card: code sync: follow to simple family style Kuninori Morimoto
2016-10-28  3:37 ` [PATCH 2/4] ASoC: simple-scu-card: code sync: rename asoc_simple_card_priv Kuninori Morimoto
2016-10-28  3:38 ` [PATCH 3/4] ASoC: simple-scu-card: code sync: tidyup props/link naming Kuninori Morimoto
2016-10-28  3:38 ` [PATCH 4/4] ASoC: simple-card-utils: remove unnecessary cpu/codec pointer check Kuninori Morimoto

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).