Commit 686911b4 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: simple-card-utils: share asoc_simple_shutdown()

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: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent f38df5bf
...@@ -84,8 +84,8 @@ int asoc_simple_card_parse_clk(struct device *dev, ...@@ -84,8 +84,8 @@ int asoc_simple_card_parse_clk(struct device *dev,
struct asoc_simple_dai *simple_dai, struct asoc_simple_dai *simple_dai,
const char *dai_name, const char *dai_name,
struct snd_soc_dai_link_component *dlc); 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); 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, \ #define asoc_simple_card_parse_cpu(node, dai_link, \
list_name, cells_name, is_single_link) \ list_name, cells_name, is_single_link) \
......
...@@ -56,17 +56,6 @@ static const struct snd_soc_dapm_widget graph_dapm_widgets[] = { ...@@ -56,17 +56,6 @@ static const struct snd_soc_dapm_widget graph_dapm_widgets[] = {
SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), 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, static int graph_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params) struct snd_pcm_hw_params *params)
{ {
...@@ -100,7 +89,7 @@ static int graph_hw_params(struct snd_pcm_substream *substream, ...@@ -100,7 +89,7 @@ static int graph_hw_params(struct snd_pcm_substream *substream,
static const struct snd_soc_ops graph_ops = { static const struct snd_soc_ops graph_ops = {
.startup = asoc_simple_startup, .startup = asoc_simple_startup,
.shutdown = graph_shutdown, .shutdown = asoc_simple_shutdown,
.hw_params = graph_hw_params, .hw_params = graph_hw_params,
}; };
......
...@@ -151,12 +151,11 @@ static int asoc_simple_card_clk_enable(struct asoc_simple_dai *dai) ...@@ -151,12 +151,11 @@ static int asoc_simple_card_clk_enable(struct asoc_simple_dai *dai)
return 0; 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) if (dai)
clk_disable_unprepare(dai->clk); clk_disable_unprepare(dai->clk);
} }
EXPORT_SYMBOL_GPL(asoc_simple_card_clk_disable);
int asoc_simple_card_parse_clk(struct device *dev, int asoc_simple_card_parse_clk(struct device *dev,
struct device_node *node, struct device_node *node,
...@@ -224,6 +223,19 @@ int asoc_simple_startup(struct snd_pcm_substream *substream) ...@@ -224,6 +223,19 @@ int asoc_simple_startup(struct snd_pcm_substream *substream)
} }
EXPORT_SYMBOL_GPL(asoc_simple_startup); 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, int asoc_simple_card_parse_dai(struct device_node *node,
struct snd_soc_dai_link_component *dlc, struct snd_soc_dai_link_component *dlc,
struct device_node **dai_of_node, struct device_node **dai_of_node,
......
...@@ -26,18 +26,6 @@ struct link_info { ...@@ -26,18 +26,6 @@ struct link_info {
#define CELL "#sound-dai-cells" #define CELL "#sound-dai-cells"
#define PREFIX "simple-audio-card," #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, static int simple_set_clk_rate(struct asoc_simple_dai *simple_dai,
unsigned long rate) unsigned long rate)
{ {
...@@ -96,7 +84,7 @@ static int simple_hw_params(struct snd_pcm_substream *substream, ...@@ -96,7 +84,7 @@ static int simple_hw_params(struct snd_pcm_substream *substream,
static const struct snd_soc_ops simple_ops = { static const struct snd_soc_ops simple_ops = {
.startup = asoc_simple_startup, .startup = asoc_simple_startup,
.shutdown = simple_shutdown, .shutdown = asoc_simple_shutdown,
.hw_params = simple_hw_params, .hw_params = simple_hw_params,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment