All of lore.kernel.org
 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>
Subject: [PATCH 08/15] ASoC: simple-card-utils: share asoc_simple_shutdown()
Date: 18 Mar 2019 13:53:42 +0900	[thread overview]
Message-ID: <87tvg0yeu8.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <875zsgztld.wl-kuninori.morimoto.gx@renesas.com>


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

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_shutdown() between in these 2 drivers.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_utils.h     |  2 +-
 sound/soc/generic/audio-graph-card.c  | 13 +------------
 sound/soc/generic/simple-card-utils.c | 16 ++++++++++++++--
 sound/soc/generic/simple-card.c       | 14 +-------------
 4 files changed, 17 insertions(+), 28 deletions(-)

diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h
index 0653fb9..edda646 100644
--- a/include/sound/simple_card_utils.h
+++ b/include/sound/simple_card_utils.h
@@ -84,8 +84,8 @@ int asoc_simple_card_parse_clk(struct device *dev,
 			       struct asoc_simple_dai *simple_dai,
 			       const char *dai_name,
 			       struct snd_soc_dai_link_component *dlc);
-void asoc_simple_card_clk_disable(struct asoc_simple_dai *dai);
 int asoc_simple_startup(struct snd_pcm_substream *substream);
+void asoc_simple_shutdown(struct snd_pcm_substream *substream);
 
 #define asoc_simple_card_parse_cpu(node, dai_link,				\
 				   list_name, cells_name, is_single_link)	\
diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c
index 29ae71b..f3577b5 100644
--- a/sound/soc/generic/audio-graph-card.c
+++ b/sound/soc/generic/audio-graph-card.c
@@ -56,17 +56,6 @@ static const struct snd_soc_dapm_widget graph_dapm_widgets[] = {
 			       SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
 };
 
-static void graph_shutdown(struct snd_pcm_substream *substream)
-{
-	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct asoc_simple_priv *priv = snd_soc_card_get_drvdata(rtd->card);
-	struct simple_dai_props *dai_props = simple_priv_to_props(priv, rtd->num);
-
-	asoc_simple_card_clk_disable(dai_props->cpu_dai);
-
-	asoc_simple_card_clk_disable(dai_props->codec_dai);
-}
-
 static int graph_hw_params(struct snd_pcm_substream *substream,
 			   struct snd_pcm_hw_params *params)
 {
@@ -100,7 +89,7 @@ static int graph_hw_params(struct snd_pcm_substream *substream,
 
 static const struct snd_soc_ops graph_ops = {
 	.startup	= asoc_simple_startup,
-	.shutdown	= graph_shutdown,
+	.shutdown	= asoc_simple_shutdown,
 	.hw_params	= graph_hw_params,
 };
 
diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index 83ea1af..7ede163 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -151,12 +151,11 @@ static int asoc_simple_card_clk_enable(struct asoc_simple_dai *dai)
 	return 0;
 }
 
-void asoc_simple_card_clk_disable(struct asoc_simple_dai *dai)
+static void asoc_simple_card_clk_disable(struct asoc_simple_dai *dai)
 {
 	if (dai)
 		clk_disable_unprepare(dai->clk);
 }
-EXPORT_SYMBOL_GPL(asoc_simple_card_clk_disable);
 
 int asoc_simple_card_parse_clk(struct device *dev,
 			       struct device_node *node,
@@ -224,6 +223,19 @@ int asoc_simple_startup(struct snd_pcm_substream *substream)
 }
 EXPORT_SYMBOL_GPL(asoc_simple_startup);
 
+void asoc_simple_shutdown(struct snd_pcm_substream *substream)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	struct asoc_simple_priv *priv = snd_soc_card_get_drvdata(rtd->card);
+	struct simple_dai_props *dai_props =
+		simple_priv_to_props(priv, rtd->num);
+
+	asoc_simple_card_clk_disable(dai_props->cpu_dai);
+
+	asoc_simple_card_clk_disable(dai_props->codec_dai);
+}
+EXPORT_SYMBOL_GPL(asoc_simple_shutdown);
+
 int asoc_simple_card_parse_dai(struct device_node *node,
 				    struct snd_soc_dai_link_component *dlc,
 				    struct device_node **dai_of_node,
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index d0ea573..bb57c48 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -26,18 +26,6 @@ struct link_info {
 #define CELL	"#sound-dai-cells"
 #define PREFIX	"simple-audio-card,"
 
-static void simple_shutdown(struct snd_pcm_substream *substream)
-{
-	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct asoc_simple_priv *priv = snd_soc_card_get_drvdata(rtd->card);
-	struct simple_dai_props *dai_props =
-		simple_priv_to_props(priv, rtd->num);
-
-	asoc_simple_card_clk_disable(dai_props->cpu_dai);
-
-	asoc_simple_card_clk_disable(dai_props->codec_dai);
-}
-
 static int simple_set_clk_rate(struct asoc_simple_dai *simple_dai,
 			       unsigned long rate)
 {
@@ -96,7 +84,7 @@ static int simple_hw_params(struct snd_pcm_substream *substream,
 
 static const struct snd_soc_ops simple_ops = {
 	.startup	= asoc_simple_startup,
-	.shutdown	= simple_shutdown,
+	.shutdown	= asoc_simple_shutdown,
 	.hw_params	= simple_hw_params,
 };
 
-- 
2.7.4

  parent reply	other threads:[~2019-03-18  4:53 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-18  4:49 [PATCH 00/15] ASoC: simple-card: share similar function Kuninori Morimoto
2019-03-18  4:50 ` [PATCH 01/15] ASoC: simple-card: rename simple_get_conversion() to simple_parse_convert() Kuninori Morimoto
2019-03-18 14:51   ` Applied "ASoC: simple-card: rename simple_get_conversion() to simple_parse_convert()" to the asoc tree Mark Brown
2019-03-18  4:50 ` [PATCH 02/15] ASoC: simple-card: add simple_parse_mclk_fs() Kuninori Morimoto
2019-03-18 14:50   ` Applied "ASoC: simple-card: add simple_parse_mclk_fs()" to the asoc tree Mark Brown
2019-03-18  4:50 ` [PATCH 03/15] ASoC: audio-graph: rename graph_get_conversion() to graph_parse_convert() Kuninori Morimoto
2019-03-18 14:50   ` Applied "ASoC: audio-graph: rename graph_get_conversion() to graph_parse_convert()" to the asoc tree Mark Brown
2019-03-18  4:50 ` [PATCH 04/15] ASoC: audio-graph: add graph_parse_mclk_fs() Kuninori Morimoto
2019-03-18 14:50   ` Applied "ASoC: audio-graph: add graph_parse_mclk_fs()" to the asoc tree Mark Brown
2019-03-18  4:53 ` [PATCH 05/15] ASoC: simple-card-utils: add asoc_simple_debug_info() Kuninori Morimoto
2019-03-18  4:53 ` [PATCH 06/15] ASoC: simple_card_utils: share common priv for simple-card/audio-graph Kuninori Morimoto
2019-03-18  4:53 ` [PATCH 07/15] ASoC: simple-card-utils: share asoc_simple_startup() Kuninori Morimoto
2019-03-18  4:53 ` Kuninori Morimoto [this message]
2019-03-18  4:53 ` [PATCH 09/15] ASoC: simple-card-utils: share asoc_simple_hw_param() Kuninori Morimoto
2019-03-18  4:54 ` [PATCH 10/15] ASoC: simple-card-utils: share asoc_simple_dai_init() Kuninori Morimoto
2019-03-18  4:54 ` [PATCH 11/15] ASoC: simple-card-utils: share asoc_simple_be_hw_params_fixup() Kuninori Morimoto
2019-03-18  4:54 ` [PATCH 12/15] ASoC: simple-card-utils: share asoc_simple_card_init_priv() Kuninori Morimoto
2019-03-18  4:55 ` [PATCH 13/15] ASoC: simple-card-utils: separate asoc_simple_card_parse_dai() Kuninori Morimoto
2019-03-18  4:55 ` [PATCH 14/15] ASoC: simple-card-utils: rename asoc_simple_card_xxx() to asoc_simple_() Kuninori Morimoto
2019-03-18  4:55 ` [PATCH 15/15] ASoC: simple-card-utils: test memory allocation Kuninori Morimoto
2019-03-20  4:49 ` [PATCH 00/15] ASoC: simple-card: share similar function 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=87tvg0yeu8.wl-kuninori.morimoto.gx@renesas.com \
    --to=kuninori.morimoto.gx@renesas.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.