[alsa-devel] [PATCH 4/5] ASoC: simple-card: remove pointless struct asoc_simple_dai_init_info

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Wed Dec 26 07:52:54 CET 2012


Current simple-card driver calls asoc_simple_card_dai_init()
if platform had a asoc_simple_card_dai_init pointer.
And, this initialization function works only
when platform has an applicable initial value
for each snd_soc_dai_set_xxx().
And basically, almost all sound card requires certain initialization.
This means that almost all platform has initialization settings,
and driver do nothing if it doesn't have settings.
Thus, this patch removed pointless struct asoc_simple_dai_init_info
which was trigger of calling asoc_simple_card_dai_init().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
 arch/arm/mach-shmobile/board-ap4evb.c          |   18 +++++-------------
 arch/arm/mach-shmobile/board-armadillo800eva.c |   18 +++++-------------
 arch/arm/mach-shmobile/board-kzm9g.c           |   12 ++++--------
 arch/arm/mach-shmobile/board-mackerel.c        |   18 +++++-------------
 arch/sh/boards/mach-ecovec24/setup.c           |   10 +++-------
 arch/sh/boards/mach-se/7724/setup.c            |   12 ++++--------
 include/sound/simple_card.h                    |   11 ++++-------
 sound/soc/generic/simple-card.c                |    8 ++------
 8 files changed, 32 insertions(+), 75 deletions(-)

diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index 60e6be4..1af1129 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -686,13 +686,6 @@ static struct platform_device fsi_device = {
 	},
 };
 
-static struct asoc_simple_dai_init_info fsi2_ak4643_init_info = {
-	.daifmt			= SND_SOC_DAIFMT_LEFT_J,
-	.cpu_set.daifmt		= SND_SOC_DAIFMT_CBS_CFS,
-	.codec_set.daifmt	= SND_SOC_DAIFMT_CBM_CFM,
-	.codec_set.sysclk	= 11289600,
-};
-
 static struct asoc_simple_card_info fsi2_ak4643_info = {
 	.name		= "AK4643",
 	.card		= "FSI2A-AK4643",
@@ -700,7 +693,10 @@ static struct asoc_simple_card_info fsi2_ak4643_info = {
 	.codec		= "ak4642-codec.0-0013",
 	.platform	= "sh_fsi2",
 	.codec_dai	= "ak4642-hifi",
-	.init		= &fsi2_ak4643_init_info,
+	.daifmt			= SND_SOC_DAIFMT_LEFT_J,
+	.cpu_set.daifmt		= SND_SOC_DAIFMT_CBS_CFS,
+	.codec_set.daifmt	= SND_SOC_DAIFMT_CBM_CFM,
+	.codec_set.sysclk	= 11289600,
 };
 
 static struct platform_device fsi_ak4643_device = {
@@ -809,10 +805,6 @@ static struct platform_device lcdc1_device = {
 	},
 };
 
-static struct asoc_simple_dai_init_info fsi2_hdmi_init_info = {
-	.cpu_set.daifmt	= SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF,
-};
-
 static struct asoc_simple_card_info fsi2_hdmi_info = {
 	.name		= "HDMI",
 	.card		= "FSI2B-HDMI",
@@ -820,7 +812,7 @@ static struct asoc_simple_card_info fsi2_hdmi_info = {
 	.codec		= "sh-mobile-hdmi",
 	.platform	= "sh_fsi2",
 	.codec_dai	= "sh_mobile_hdmi-hifi",
-	.init		= &fsi2_hdmi_init_info,
+	.cpu_set.daifmt	= SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF,
 };
 
 static struct platform_device fsi_hdmi_device = {
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index 278324c..5d833f0 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -807,13 +807,6 @@ static struct platform_device fsi_device = {
 };
 
 /* FSI-WM8978 */
-static struct asoc_simple_dai_init_info fsi_wm8978_init_info = {
-	.daifmt			= SND_SOC_DAIFMT_I2S,
-	.cpu_set.daifmt		= SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_IB_NF,
-	.codec_set.daifmt	= SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_NB_NF,
-	.codec_set.sysclk	= 12288000,
-};
-
 static struct asoc_simple_card_info fsi_wm8978_info = {
 	.name		= "wm8978",
 	.card		= "FSI2A-WM8978",
@@ -821,7 +814,10 @@ static struct asoc_simple_card_info fsi_wm8978_info = {
 	.codec		= "wm8978.0-001a",
 	.platform	= "sh_fsi2",
 	.codec_dai	= "wm8978-hifi",
-	.init		= &fsi_wm8978_init_info,
+	.daifmt			= SND_SOC_DAIFMT_I2S,
+	.cpu_set.daifmt		= SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_IB_NF,
+	.codec_set.daifmt	= SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_NB_NF,
+	.codec_set.sysclk	= 12288000,
 };
 
 static struct platform_device fsi_wm8978_device = {
@@ -833,10 +829,6 @@ static struct platform_device fsi_wm8978_device = {
 };
 
 /* FSI-HDMI */
-static struct asoc_simple_dai_init_info fsi2_hdmi_init_info = {
-	.cpu_set.daifmt	= SND_SOC_DAIFMT_CBM_CFM,
-};
-
 static struct asoc_simple_card_info fsi2_hdmi_info = {
 	.name		= "HDMI",
 	.card		= "FSI2B-HDMI",
@@ -844,7 +836,7 @@ static struct asoc_simple_card_info fsi2_hdmi_info = {
 	.codec		= "sh-mobile-hdmi",
 	.platform	= "sh_fsi2",
 	.codec_dai	= "sh_mobile_hdmi-hifi",
-	.init		= &fsi2_hdmi_init_info,
+	.cpu_set.daifmt	= SND_SOC_DAIFMT_CBM_CFM,
 };
 
 static struct platform_device fsi_hdmi_device = {
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
index 59a6dc3..1c1be72 100644
--- a/arch/arm/mach-shmobile/board-kzm9g.c
+++ b/arch/arm/mach-shmobile/board-kzm9g.c
@@ -526,13 +526,6 @@ static struct platform_device fsi_device = {
 	},
 };
 
-static struct asoc_simple_dai_init_info fsi2_ak4648_init_info = {
-	.daifmt			= SND_SOC_DAIFMT_LEFT_J,
-	.cpu_set.daifmt		= SND_SOC_DAIFMT_CBS_CFS,
-	.codec_set.daifmt	= SND_SOC_DAIFMT_CBM_CFM,
-	.codec_set.sysclk	= 11289600,
-};
-
 static struct asoc_simple_card_info fsi2_ak4648_info = {
 	.name		= "AK4648",
 	.card		= "FSI2A-AK4648",
@@ -540,7 +533,10 @@ static struct asoc_simple_card_info fsi2_ak4648_info = {
 	.codec		= "ak4642-codec.0-0012",
 	.platform	= "sh_fsi2",
 	.codec_dai	= "ak4642-hifi",
-	.init		= &fsi2_ak4648_init_info,
+	.daifmt			= SND_SOC_DAIFMT_LEFT_J,
+	.cpu_set.daifmt		= SND_SOC_DAIFMT_CBS_CFS,
+	.codec_set.daifmt	= SND_SOC_DAIFMT_CBM_CFM,
+	.codec_set.sysclk	= 11289600,
 };
 
 static struct platform_device fsi_ak4648_device = {
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index d6380be..93e144f 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -502,10 +502,6 @@ static struct platform_device hdmi_lcdc_device = {
 	},
 };
 
-static struct asoc_simple_dai_init_info fsi2_hdmi_init_info = {
-	.cpu_set.daifmt	= SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF,
-};
-
 static struct asoc_simple_card_info fsi2_hdmi_info = {
 	.name		= "HDMI",
 	.card		= "FSI2B-HDMI",
@@ -513,7 +509,7 @@ static struct asoc_simple_card_info fsi2_hdmi_info = {
 	.codec		= "sh-mobile-hdmi",
 	.platform	= "sh_fsi2",
 	.codec_dai	= "sh_mobile_hdmi-hifi",
-	.init		= &fsi2_hdmi_init_info,
+	.cpu_set.daifmt	= SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF,
 };
 
 static struct platform_device fsi_hdmi_device = {
@@ -892,13 +888,6 @@ static struct platform_device fsi_device = {
 	},
 };
 
-static struct asoc_simple_dai_init_info fsi2_ak4643_init_info = {
-	.daifmt			= SND_SOC_DAIFMT_LEFT_J,
-	.cpu_set.daifmt		= SND_SOC_DAIFMT_CBS_CFS,
-	.codec_set.daifmt	= SND_SOC_DAIFMT_CBM_CFM,
-	.codec_set.sysclk	= 11289600,
-};
-
 static struct asoc_simple_card_info fsi2_ak4643_info = {
 	.name		= "AK4643",
 	.card		= "FSI2A-AK4643",
@@ -906,7 +895,10 @@ static struct asoc_simple_card_info fsi2_ak4643_info = {
 	.codec		= "ak4642-codec.0-0013",
 	.platform	= "sh_fsi2",
 	.codec_dai	= "ak4642-hifi",
-	.init		= &fsi2_ak4643_init_info,
+	.daifmt			= SND_SOC_DAIFMT_LEFT_J,
+	.cpu_set.daifmt		= SND_SOC_DAIFMT_CBS_CFS,
+	.codec_set.daifmt	= SND_SOC_DAIFMT_CBM_CFM,
+	.codec_set.sysclk	= 11289600,
 };
 
 static struct platform_device fsi_ak4643_device = {
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index 8e68d79..6e534e3 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -897,12 +897,6 @@ static struct platform_device fsi_device = {
 	.resource	= fsi_resources,
 };
 
-static struct asoc_simple_dai_init_info fsi_da7210_init_info = {
-	.daifmt			= SND_SOC_DAIFMT_I2S,
-	.codec_set.daifmt	= SND_SOC_DAIFMT_CBM_CFM,
-	.cpu_set.daifmt		= SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_IB_NF,
-};
-
 static struct asoc_simple_card_info fsi_da7210_info = {
 	.name		= "DA7210",
 	.card		= "FSIB-DA7210",
@@ -910,7 +904,9 @@ static struct asoc_simple_card_info fsi_da7210_info = {
 	.codec		= "da7210.0-001a",
 	.platform	= "sh_fsi.0",
 	.codec_dai	= "da7210-hifi",
-	.init		= &fsi_da7210_init_info,
+	.daifmt			= SND_SOC_DAIFMT_I2S,
+	.codec_set.daifmt	= SND_SOC_DAIFMT_CBM_CFM,
+	.cpu_set.daifmt		= SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_IB_NF,
 };
 
 static struct platform_device fsi_da7210_device = {
diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c
index 8bf853f..eb87bd4 100644
--- a/arch/sh/boards/mach-se/7724/setup.c
+++ b/arch/sh/boards/mach-se/7724/setup.c
@@ -299,13 +299,6 @@ static struct platform_device fsi_device = {
 	.resource	= fsi_resources,
 };
 
-static struct asoc_simple_dai_init_info fsi2_ak4642_init_info = {
-	.daifmt			= SND_SOC_DAIFMT_LEFT_J,
-	.cpu_set.daifmt		= SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_IB_NF,
-	.codec_set.daifmt	= SND_SOC_DAIFMT_CBM_CFM,
-	.codec_set.sysclk	= 11289600,
-};
-
 static struct asoc_simple_card_info fsi_ak4642_info = {
 	.name		= "AK4642",
 	.card		= "FSIA-AK4642",
@@ -313,7 +306,10 @@ static struct asoc_simple_card_info fsi_ak4642_info = {
 	.codec		= "ak4642-codec.0-0012",
 	.platform	= "sh_fsi.0",
 	.codec_dai	= "ak4642-hifi",
-	.init		= &fsi2_ak4642_init_info,
+	.daifmt			= SND_SOC_DAIFMT_LEFT_J,
+	.cpu_set.daifmt		= SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_IB_NF,
+	.codec_set.daifmt	= SND_SOC_DAIFMT_CBM_CFM,
+	.codec_set.sysclk	= 11289600,
 };
 
 static struct platform_device fsi_ak4642_device = {
diff --git a/include/sound/simple_card.h b/include/sound/simple_card.h
index f99b586..124cedc 100644
--- a/include/sound/simple_card.h
+++ b/include/sound/simple_card.h
@@ -19,12 +19,6 @@ struct asoc_simple_dai_set {
 	unsigned int sysclk;
 };
 
-struct asoc_simple_dai_init_info {
-	unsigned int daifmt;
-	struct asoc_simple_dai_set cpu_set;
-	struct asoc_simple_dai_set codec_set;
-};
-
 struct asoc_simple_card_info {
 	const char *name;
 	const char *card;
@@ -32,7 +26,10 @@ struct asoc_simple_card_info {
 	const char *codec;
 	const char *platform;
 	const char *codec_dai;
-	struct asoc_simple_dai_init_info *init; /* for snd_link.init */
+
+	unsigned int daifmt;
+	struct asoc_simple_dai_set cpu_set;
+	struct asoc_simple_dai_set codec_set;
 
 	/* used in simple-card.c */
 	struct snd_soc_dai_link snd_link;
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index aba6290..94faeb5 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -35,8 +35,7 @@ static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai,
 
 static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 {
-	struct asoc_simple_card_info *cinfo = asoc_simple_get_card_info(rtd);
-	struct asoc_simple_dai_init_info *info = cinfo->init;
+	struct asoc_simple_card_info *info = asoc_simple_get_card_info(rtd);
 	struct snd_soc_dai *codec = rtd->codec_dai;
 	struct snd_soc_dai *cpu = rtd->cpu_dai;
 	unsigned int daifmt = info->daifmt;
@@ -82,10 +81,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 	cinfo->snd_link.platform_name	= cinfo->platform;
 	cinfo->snd_link.codec_name	= cinfo->codec;
 	cinfo->snd_link.codec_dai_name	= cinfo->codec_dai;
-
-	/* enable snd_link.init if cinfo has settings */
-	if (cinfo->init)
-		cinfo->snd_link.init	= asoc_simple_card_dai_init;
+	cinfo->snd_link.init		= asoc_simple_card_dai_init;
 
 	/*
 	 * init snd_soc_card
-- 
1.7.9.5



More information about the Alsa-devel mailing list