Commit 23b16df6 authored by Mark Brown's avatar Mark Brown

Merge series "ASoC: audio-graph: cleanups" from Kuninori Morimoto...

Merge series "ASoC: audio-graph: cleanups" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

Hi Mark

These patches cleanups audio-graph.
This is part of prepare for new audio-graph-card2.

Kuninori Morimoto (6):
  ASoC: audio-graph: move audio_graph_card_probe() to simple-card-utils.c
  ASoC: audio-graph: move audio_graph_remove() to simple-card-utils.c
  ASoC: audio-graph: check ports if exists
  ASoC: audio-graph: remove "audio-graph-card," preix support
  ASoC: audio-graph: remove unused "node" from graph_parse_mclk_fs()
  ASoC: audio-graph: remove Platform support

 include/sound/graph_card.h               |  4 --
 include/sound/simple_card_utils.h        |  3 ++
 sound/soc/generic/audio-graph-card.c     | 52 ++++--------------------
 sound/soc/generic/simple-card-utils.c    | 25 ++++++++++++
 sound/soc/generic/simple-card.c          |  7 ----
 sound/soc/tegra/tegra_audio_graph_card.c |  4 +-
 6 files changed, 38 insertions(+), 57 deletions(-)

--
2.25.1

Thank you for your help !!

Best regards
---
Kuninori Morimoto
parents 7342db3c 63f2f9cc
...@@ -9,10 +9,6 @@ ...@@ -9,10 +9,6 @@
#include <sound/simple_card_utils.h> #include <sound/simple_card_utils.h>
int audio_graph_card_probe(struct snd_soc_card *card);
int audio_graph_parse_of(struct asoc_simple_priv *priv, struct device *dev); int audio_graph_parse_of(struct asoc_simple_priv *priv, struct device *dev);
int audio_graph_remove(struct platform_device *pdev);
#endif /* __GRAPH_CARD_H */ #endif /* __GRAPH_CARD_H */
...@@ -177,6 +177,9 @@ int asoc_simple_init_jack(struct snd_soc_card *card, ...@@ -177,6 +177,9 @@ int asoc_simple_init_jack(struct snd_soc_card *card,
int is_hp, char *prefix, char *pin); int is_hp, char *prefix, char *pin);
int asoc_simple_init_priv(struct asoc_simple_priv *priv, int asoc_simple_init_priv(struct asoc_simple_priv *priv,
struct link_info *li); struct link_info *li);
int asoc_simple_remove(struct platform_device *pdev);
int asoc_graph_card_probe(struct snd_soc_card *card);
#ifdef DEBUG #ifdef DEBUG
static inline void asoc_simple_debug_dai(struct asoc_simple_priv *priv, static inline void asoc_simple_debug_dai(struct asoc_simple_priv *priv,
......
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
#define DPCM_SELECTABLE 1 #define DPCM_SELECTABLE 1
#define PREFIX "audio-graph-card,"
static int graph_outdrv_event(struct snd_soc_dapm_widget *w, static int graph_outdrv_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, struct snd_kcontrol *kcontrol,
int event) int event)
...@@ -181,8 +179,8 @@ static void graph_parse_convert(struct device *dev, ...@@ -181,8 +179,8 @@ static void graph_parse_convert(struct device *dev,
struct device_node *node = of_graph_get_port_parent(ep); struct device_node *node = of_graph_get_port_parent(ep);
asoc_simple_parse_convert(top, NULL, adata); asoc_simple_parse_convert(top, NULL, adata);
asoc_simple_parse_convert(node, PREFIX, adata); if (of_node_name_eq(ports, "ports"))
asoc_simple_parse_convert(ports, NULL, adata); asoc_simple_parse_convert(ports, NULL, adata);
asoc_simple_parse_convert(port, NULL, adata); asoc_simple_parse_convert(port, NULL, adata);
asoc_simple_parse_convert(ep, NULL, adata); asoc_simple_parse_convert(ep, NULL, adata);
...@@ -197,16 +195,15 @@ static void graph_parse_mclk_fs(struct device_node *top, ...@@ -197,16 +195,15 @@ static void graph_parse_mclk_fs(struct device_node *top,
{ {
struct device_node *port = of_get_parent(ep); struct device_node *port = of_get_parent(ep);
struct device_node *ports = of_get_parent(port); struct device_node *ports = of_get_parent(port);
struct device_node *node = of_graph_get_port_parent(ep);
of_property_read_u32(top, "mclk-fs", &props->mclk_fs); of_property_read_u32(top, "mclk-fs", &props->mclk_fs);
of_property_read_u32(ports, "mclk-fs", &props->mclk_fs); if (of_node_name_eq(ports, "ports"))
of_property_read_u32(ports, "mclk-fs", &props->mclk_fs);
of_property_read_u32(port, "mclk-fs", &props->mclk_fs); of_property_read_u32(port, "mclk-fs", &props->mclk_fs);
of_property_read_u32(ep, "mclk-fs", &props->mclk_fs); of_property_read_u32(ep, "mclk-fs", &props->mclk_fs);
of_node_put(port); of_node_put(port);
of_node_put(ports); of_node_put(ports);
of_node_put(node);
} }
static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv, static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv,
...@@ -226,7 +223,6 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv, ...@@ -226,7 +223,6 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv,
struct asoc_simple_dai *dai; struct asoc_simple_dai *dai;
struct snd_soc_dai_link_component *cpus = asoc_link_to_cpu(dai_link, 0); struct snd_soc_dai_link_component *cpus = asoc_link_to_cpu(dai_link, 0);
struct snd_soc_dai_link_component *codecs = asoc_link_to_codec(dai_link, 0); struct snd_soc_dai_link_component *codecs = asoc_link_to_codec(dai_link, 0);
struct snd_soc_dai_link_component *platforms = asoc_link_to_platform(dai_link, 0);
int ret; int ret;
port = of_get_parent(ep); port = of_get_parent(ep);
...@@ -278,7 +274,6 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv, ...@@ -278,7 +274,6 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv,
/* card->num_links includes Codec */ /* card->num_links includes Codec */
asoc_simple_canonicalize_cpu(cpus, is_single_links); asoc_simple_canonicalize_cpu(cpus, is_single_links);
asoc_simple_canonicalize_platform(platforms, cpus);
} else { } else {
struct snd_soc_codec_conf *cconf; struct snd_soc_codec_conf *cconf;
...@@ -309,10 +304,8 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv, ...@@ -309,10 +304,8 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv,
/* check "prefix" from top node */ /* check "prefix" from top node */
snd_soc_of_parse_node_prefix(top, cconf, codecs->of_node, snd_soc_of_parse_node_prefix(top, cconf, codecs->of_node,
"prefix"); "prefix");
snd_soc_of_parse_node_prefix(node, cconf, codecs->of_node, if (of_node_name_eq(ports, "ports"))
PREFIX "prefix"); snd_soc_of_parse_node_prefix(ports, cconf, codecs->of_node, "prefix");
snd_soc_of_parse_node_prefix(ports, cconf, codecs->of_node,
"prefix");
snd_soc_of_parse_node_prefix(port, cconf, codecs->of_node, snd_soc_of_parse_node_prefix(port, cconf, codecs->of_node,
"prefix"); "prefix");
} }
...@@ -359,7 +352,6 @@ static int graph_dai_link_of(struct asoc_simple_priv *priv, ...@@ -359,7 +352,6 @@ static int graph_dai_link_of(struct asoc_simple_priv *priv,
struct asoc_simple_dai *codec_dai = simple_props_to_dai_codec(dai_props, 0); struct asoc_simple_dai *codec_dai = simple_props_to_dai_codec(dai_props, 0);
struct snd_soc_dai_link_component *cpus = asoc_link_to_cpu(dai_link, 0); struct snd_soc_dai_link_component *cpus = asoc_link_to_cpu(dai_link, 0);
struct snd_soc_dai_link_component *codecs = asoc_link_to_codec(dai_link, 0); struct snd_soc_dai_link_component *codecs = asoc_link_to_codec(dai_link, 0);
struct snd_soc_dai_link_component *platforms = asoc_link_to_platform(dai_link, 0);
int ret, single_cpu = 0; int ret, single_cpu = 0;
dev_dbg(dev, "link_of (%pOF)\n", cpu_ep); dev_dbg(dev, "link_of (%pOF)\n", cpu_ep);
...@@ -410,7 +402,6 @@ static int graph_dai_link_of(struct asoc_simple_priv *priv, ...@@ -410,7 +402,6 @@ static int graph_dai_link_of(struct asoc_simple_priv *priv,
dai_link->init = asoc_simple_dai_init; dai_link->init = asoc_simple_dai_init;
asoc_simple_canonicalize_cpu(cpus, single_cpu); asoc_simple_canonicalize_cpu(cpus, single_cpu);
asoc_simple_canonicalize_platform(platforms, cpus);
return 0; return 0;
} }
...@@ -630,7 +621,6 @@ static int graph_count_noml(struct asoc_simple_priv *priv, ...@@ -630,7 +621,6 @@ static int graph_count_noml(struct asoc_simple_priv *priv,
li->num[li->link].cpus = 1; li->num[li->link].cpus = 1;
li->num[li->link].codecs = 1; li->num[li->link].codecs = 1;
li->num[li->link].platforms = 1;
li->link += 1; /* 1xCPU-Codec */ li->link += 1; /* 1xCPU-Codec */
...@@ -653,7 +643,6 @@ static int graph_count_dpcm(struct asoc_simple_priv *priv, ...@@ -653,7 +643,6 @@ static int graph_count_dpcm(struct asoc_simple_priv *priv,
if (li->cpu) { if (li->cpu) {
li->num[li->link].cpus = 1; li->num[li->link].cpus = 1;
li->num[li->link].platforms = 1;
li->link++; /* 1xCPU-dummy */ li->link++; /* 1xCPU-dummy */
} else { } else {
...@@ -721,23 +710,6 @@ static int graph_get_dais_count(struct asoc_simple_priv *priv, ...@@ -721,23 +710,6 @@ static int graph_get_dais_count(struct asoc_simple_priv *priv,
graph_count_dpcm); graph_count_dpcm);
} }
int audio_graph_card_probe(struct snd_soc_card *card)
{
struct asoc_simple_priv *priv = snd_soc_card_get_drvdata(card);
int ret;
ret = asoc_simple_init_hp(card, &priv->hp_jack, NULL);
if (ret < 0)
return ret;
ret = asoc_simple_init_mic(card, &priv->mic_jack, NULL);
if (ret < 0)
return ret;
return 0;
}
EXPORT_SYMBOL_GPL(audio_graph_card_probe);
static int graph_probe(struct platform_device *pdev) static int graph_probe(struct platform_device *pdev)
{ {
struct asoc_simple_priv *priv; struct asoc_simple_priv *priv;
...@@ -752,7 +724,7 @@ static int graph_probe(struct platform_device *pdev) ...@@ -752,7 +724,7 @@ static int graph_probe(struct platform_device *pdev)
card = simple_priv_to_card(priv); card = simple_priv_to_card(priv);
card->dapm_widgets = graph_dapm_widgets; card->dapm_widgets = graph_dapm_widgets;
card->num_dapm_widgets = ARRAY_SIZE(graph_dapm_widgets); card->num_dapm_widgets = ARRAY_SIZE(graph_dapm_widgets);
card->probe = audio_graph_card_probe; card->probe = asoc_graph_card_probe;
if (of_device_get_match_data(dev)) if (of_device_get_match_data(dev))
priv->dpcm_selectable = 1; priv->dpcm_selectable = 1;
...@@ -760,14 +732,6 @@ static int graph_probe(struct platform_device *pdev) ...@@ -760,14 +732,6 @@ static int graph_probe(struct platform_device *pdev)
return audio_graph_parse_of(priv, dev); return audio_graph_parse_of(priv, dev);
} }
int audio_graph_remove(struct platform_device *pdev)
{
struct snd_soc_card *card = platform_get_drvdata(pdev);
return asoc_simple_clean_reference(card);
}
EXPORT_SYMBOL_GPL(audio_graph_remove);
static const struct of_device_id graph_of_match[] = { static const struct of_device_id graph_of_match[] = {
{ .compatible = "audio-graph-card", }, { .compatible = "audio-graph-card", },
{ .compatible = "audio-graph-scu-card", { .compatible = "audio-graph-scu-card",
...@@ -783,7 +747,7 @@ static struct platform_driver graph_card = { ...@@ -783,7 +747,7 @@ static struct platform_driver graph_card = {
.of_match_table = graph_of_match, .of_match_table = graph_of_match,
}, },
.probe = graph_probe, .probe = graph_probe,
.remove = audio_graph_remove, .remove = asoc_simple_remove,
}; };
module_platform_driver(graph_card); module_platform_driver(graph_card);
......
...@@ -740,6 +740,31 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv, ...@@ -740,6 +740,31 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv,
} }
EXPORT_SYMBOL_GPL(asoc_simple_init_priv); EXPORT_SYMBOL_GPL(asoc_simple_init_priv);
int asoc_simple_remove(struct platform_device *pdev)
{
struct snd_soc_card *card = platform_get_drvdata(pdev);
return asoc_simple_clean_reference(card);
}
EXPORT_SYMBOL_GPL(asoc_simple_remove);
int asoc_graph_card_probe(struct snd_soc_card *card)
{
struct asoc_simple_priv *priv = snd_soc_card_get_drvdata(card);
int ret;
ret = asoc_simple_init_hp(card, &priv->hp_jack, NULL);
if (ret < 0)
return ret;
ret = asoc_simple_init_mic(card, &priv->mic_jack, NULL);
if (ret < 0)
return ret;
return 0;
}
EXPORT_SYMBOL_GPL(asoc_graph_card_probe);
/* Module information */ /* Module information */
MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>"); MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>");
MODULE_DESCRIPTION("ALSA SoC Simple Card Utils"); MODULE_DESCRIPTION("ALSA SoC Simple Card Utils");
......
...@@ -708,13 +708,6 @@ static int asoc_simple_probe(struct platform_device *pdev) ...@@ -708,13 +708,6 @@ static int asoc_simple_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int asoc_simple_remove(struct platform_device *pdev)
{
struct snd_soc_card *card = platform_get_drvdata(pdev);
return asoc_simple_clean_reference(card);
}
static const struct of_device_id simple_of_match[] = { static const struct of_device_id simple_of_match[] = {
{ .compatible = "simple-audio-card", }, { .compatible = "simple-audio-card", },
{ .compatible = "simple-scu-audio-card", { .compatible = "simple-scu-audio-card",
......
...@@ -184,7 +184,7 @@ static int tegra_audio_graph_card_probe(struct snd_soc_card *card) ...@@ -184,7 +184,7 @@ static int tegra_audio_graph_card_probe(struct snd_soc_card *card)
return PTR_ERR(priv->clk_plla_out0); return PTR_ERR(priv->clk_plla_out0);
} }
return audio_graph_card_probe(card); return asoc_graph_card_probe(card);
} }
static int tegra_audio_graph_probe(struct platform_device *pdev) static int tegra_audio_graph_probe(struct platform_device *pdev)
...@@ -244,7 +244,7 @@ static struct platform_driver tegra_audio_graph_card = { ...@@ -244,7 +244,7 @@ static struct platform_driver tegra_audio_graph_card = {
.of_match_table = graph_of_tegra_match, .of_match_table = graph_of_tegra_match,
}, },
.probe = tegra_audio_graph_probe, .probe = tegra_audio_graph_probe,
.remove = audio_graph_remove, .remove = asoc_simple_remove,
}; };
module_platform_driver(tegra_audio_graph_card); module_platform_driver(tegra_audio_graph_card);
......
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