summaryrefslogtreecommitdiff
path: root/sound/soc/generic/simple-card.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2019-03-20 13:54:59 +0900
committerMark Brown <broonie@kernel.org>2019-03-21 14:51:03 +0000
commite59289cda8dec0153fa396864c8ba8092ec3b80d (patch)
treec819d352f0ce0b92c8bf2ee53887ac53e13da3d5 /sound/soc/generic/simple-card.c
parent0580dde59438686d60762b6da9229ebec693b94f (diff)
ASoC: simple_card_utils: share common priv for simple-card/audio-graph
Historically, simple-card/simple-scu-card/audio-graph/audio-graph-scu are similar but different generic sound card. simple-scu-card which was for DPCM was merged into simple-card, and audio-graph-scu which was for DPCM was merged into audio-graph. simple-card is for non OF graph sound card, and audio-graph is for OF graph sound card. And, small detail difference (= function parameter, naming, etc) between simple-card/audio-graph has been unified. So today, the difference between simple-card/audio-graph are just using OF graph style, or not. In other words, there should no difference other than OF graph sytle. simple-card/audio-graph are using own priv today , but we can merge it. This patch merge it at simple_card_utils. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/generic/simple-card.c')
-rw-r--r--sound/soc/generic/simple-card.c57
1 files changed, 17 insertions, 40 deletions
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 77899624787e..628c19a3aaff 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -15,24 +15,6 @@
#include <sound/soc-dai.h>
#include <sound/soc.h>
-struct simple_priv {
- struct snd_soc_card snd_card;
- struct simple_dai_props {
- struct asoc_simple_dai *cpu_dai;
- struct asoc_simple_dai *codec_dai;
- struct snd_soc_dai_link_component codecs; /* single codec */
- struct snd_soc_dai_link_component platforms;
- struct asoc_simple_card_data adata;
- struct snd_soc_codec_conf *codec_conf;
- unsigned int mclk_fs;
- } *dai_props;
- struct asoc_simple_jack hp_jack;
- struct asoc_simple_jack mic_jack;
- struct snd_soc_dai_link *dai_link;
- struct asoc_simple_dai *dais;
- struct snd_soc_codec_conf *codec_conf;
-};
-
struct link_info {
int dais; /* number of dai */
int link; /* number of link */
@@ -40,11 +22,6 @@ struct link_info {
int cpu; /* turn for CPU / Codec */
};
-#define simple_priv_to_card(priv) (&(priv)->snd_card)
-#define simple_priv_to_props(priv, i) ((priv)->dai_props + (i))
-#define simple_priv_to_dev(priv) (simple_priv_to_card(priv)->dev)
-#define simple_priv_to_link(priv, i) (simple_priv_to_card(priv)->dai_link + (i))
-
#define DAI "sound-dai"
#define CELL "#sound-dai-cells"
#define PREFIX "simple-audio-card,"
@@ -52,7 +29,7 @@ struct link_info {
static int simple_startup(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct simple_priv *priv = snd_soc_card_get_drvdata(rtd->card);
+ 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);
int ret;
@@ -71,7 +48,7 @@ static int simple_startup(struct snd_pcm_substream *substream)
static void simple_shutdown(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct simple_priv *priv = snd_soc_card_get_drvdata(rtd->card);
+ 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);
@@ -101,7 +78,7 @@ static int simple_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
- struct simple_priv *priv = snd_soc_card_get_drvdata(rtd->card);
+ 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);
unsigned int mclk, mclk_fs = 0;
@@ -144,7 +121,7 @@ static const struct snd_soc_ops simple_ops = {
static int simple_dai_init(struct snd_soc_pcm_runtime *rtd)
{
- struct simple_priv *priv = snd_soc_card_get_drvdata(rtd->card);
+ 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);
int ret;
@@ -164,7 +141,7 @@ static int simple_dai_init(struct snd_soc_pcm_runtime *rtd)
static int simple_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params)
{
- struct simple_priv *priv = snd_soc_card_get_drvdata(rtd->card);
+ 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_convert_fixup(&dai_props->adata, params);
@@ -207,7 +184,7 @@ static void simple_parse_mclk_fs(struct device_node *top,
of_node_put(node);
}
-static int simple_dai_link_of_dpcm(struct simple_priv *priv,
+static int simple_dai_link_of_dpcm(struct asoc_simple_priv *priv,
struct device_node *np,
struct device_node *codec,
struct link_info *li,
@@ -336,7 +313,7 @@ static int simple_dai_link_of_dpcm(struct simple_priv *priv,
return 0;
}
-static int simple_dai_link_of(struct simple_priv *priv,
+static int simple_dai_link_of(struct asoc_simple_priv *priv,
struct device_node *np,
struct device_node *codec,
struct link_info *li,
@@ -438,13 +415,13 @@ dai_link_of_err:
return ret;
}
-static int simple_for_each_link(struct simple_priv *priv,
+static int simple_for_each_link(struct asoc_simple_priv *priv,
struct link_info *li,
- int (*func_noml)(struct simple_priv *priv,
+ int (*func_noml)(struct asoc_simple_priv *priv,
struct device_node *np,
struct device_node *codec,
struct link_info *li, bool is_top),
- int (*func_dpcm)(struct simple_priv *priv,
+ int (*func_dpcm)(struct asoc_simple_priv *priv,
struct device_node *np,
struct device_node *codec,
struct link_info *li, bool is_top))
@@ -513,7 +490,7 @@ static int simple_for_each_link(struct simple_priv *priv,
}
static int simple_parse_aux_devs(struct device_node *node,
- struct simple_priv *priv)
+ struct asoc_simple_priv *priv)
{
struct device *dev = simple_priv_to_dev(priv);
struct device_node *aux_node;
@@ -543,7 +520,7 @@ static int simple_parse_aux_devs(struct device_node *node,
return 0;
}
-static int simple_parse_of(struct simple_priv *priv)
+static int simple_parse_of(struct asoc_simple_priv *priv)
{
struct device *dev = simple_priv_to_dev(priv);
struct device_node *top = dev->of_node;
@@ -593,7 +570,7 @@ static int simple_parse_of(struct simple_priv *priv)
return ret;
}
-static int simple_count_noml(struct simple_priv *priv,
+static int simple_count_noml(struct asoc_simple_priv *priv,
struct device_node *np,
struct device_node *codec,
struct link_info *li, bool is_top)
@@ -605,7 +582,7 @@ static int simple_count_noml(struct simple_priv *priv,
return 0;
}
-static int simple_count_dpcm(struct simple_priv *priv,
+static int simple_count_dpcm(struct asoc_simple_priv *priv,
struct device_node *np,
struct device_node *codec,
struct link_info *li, bool is_top)
@@ -618,7 +595,7 @@ static int simple_count_dpcm(struct simple_priv *priv,
return 0;
}
-static void simple_get_dais_count(struct simple_priv *priv,
+static void simple_get_dais_count(struct asoc_simple_priv *priv,
struct link_info *li)
{
struct device *dev = simple_priv_to_dev(priv);
@@ -687,7 +664,7 @@ static void simple_get_dais_count(struct simple_priv *priv,
static int simple_soc_probe(struct snd_soc_card *card)
{
- struct simple_priv *priv = snd_soc_card_get_drvdata(card);
+ struct asoc_simple_priv *priv = snd_soc_card_get_drvdata(card);
int ret;
ret = asoc_simple_card_init_hp(card, &priv->hp_jack, PREFIX);
@@ -703,7 +680,7 @@ static int simple_soc_probe(struct snd_soc_card *card)
static int simple_probe(struct platform_device *pdev)
{
- struct simple_priv *priv;
+ struct asoc_simple_priv *priv;
struct snd_soc_dai_link *dai_link;
struct simple_dai_props *dai_props;
struct asoc_simple_dai *dais;