Skip to contentSkip to conversation

ASoC: Use dai_fmt in corgi machine driver

PATCH Applied Axel Lin 3 participants 7 messages Dec 30, 2011 – Jan 2, 2012

Subsystems (5)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/3 ASoC: Use dai_fmt in corgi machine driver

---
 sound/soc/pxa/corgi.c |   14 ++------------
 1 files changed, 2 insertions(+), 12 deletions(-)
sound/soc/pxa/corgi.c +2 -12
index 5e5004a..5ff6dac 100644
@@ -142,18 +142,6 @@ static int corgi_hw_params(struct snd_pcm_substream *substream,
 		break;
 	}
 
-	/* set codec DAI configuration */
-	ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
-		SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
-	if (ret < 0)
-		return ret;
-
-	/* set cpu DAI configuration */
-	ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
-		SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
-	if (ret < 0)
-		return ret;
-
 	/* set the codec system clock for DAC and ADC */
 	ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL, clk,
 		SND_SOC_CLOCK_IN);
@@ -311,6 +299,8 @@ static struct snd_soc_dai_link corgi_dai = {
 	.platform_name = "pxa-pcm-audio",
 	.codec_name = "wm8731.0-001b",
 	.init = corgi_wm8731_init,
+	.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
+		   SND_SOC_DAIFMT_CBS_CFS,
 	.ops = &corgi_ops,
 };
 
Signature · 1 line
1.7.5.4
author
#1 lore raw

PATCH 2/3 ASoC: Convert corgi to table based DAPM and control init

---
 sound/soc/pxa/corgi.c |   23 ++++++++---------------
 1 files changed, 8 insertions(+), 15 deletions(-)
sound/soc/pxa/corgi.c +8 -15
index 5ff6dac..30ebce2 100644
@@ -227,7 +227,7 @@ SND_SOC_DAPM_HP("Headset Jack", NULL),
 };
 
 /* Corgi machine audio map (connections to the codec pins) */
-static const struct snd_soc_dapm_route audio_map[] = {
+static const struct snd_soc_dapm_route corgi_audio_map[] = {
 
 	/* headset Jack  - in = micin, out = LHPOUT*/
 	{"Headset Jack", NULL, "LHPOUT"},
@@ -269,24 +269,10 @@ static int corgi_wm8731_init(struct snd_soc_pcm_runtime *rtd)
 {
 	struct snd_soc_codec *codec = rtd->codec;
 	struct snd_soc_dapm_context *dapm = &codec->dapm;
-	int err;
 
 	snd_soc_dapm_nc_pin(dapm, "LLINEIN");
 	snd_soc_dapm_nc_pin(dapm, "RLINEIN");
 
-	/* Add corgi specific controls */
-	err = snd_soc_add_controls(codec, wm8731_corgi_controls,
-				ARRAY_SIZE(wm8731_corgi_controls));
-	if (err < 0)
-		return err;
-
-	/* Add corgi specific widgets */
-	snd_soc_dapm_new_controls(dapm, wm8731_dapm_widgets,
-				  ARRAY_SIZE(wm8731_dapm_widgets));
-
-	/* Set up corgi specific audio path audio_map */
-	snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
-
 	return 0;
 }
 
@@ -310,6 +296,13 @@ static struct snd_soc_card snd_soc_corgi = {
 	.owner = THIS_MODULE,
 	.dai_link = &corgi_dai,
 	.num_links = 1,
+
+	.controls = wm8731_corgi_controls,
+	.num_controls = ARRAY_SIZE(wm8731_corgi_controls),
+	.dapm_widgets = wm8731_dapm_widgets,
+	.num_dapm_widgets = ARRAY_SIZE(wm8731_dapm_widgets),
+	.dapm_routes = corgi_audio_map,
+	.num_dapm_routes = ARRAY_SIZE(corgi_audio_map),
 };
 
 static struct platform_device *corgi_snd_device;
Signature · 1 line
1.7.5.4
author
#3 lore raw

PATCH 3/3 ASoC: pxa: Convert corgi to use snd_soc_register_card()

In reply to Axel Lin

Use snd_soc_register_card() instead of creating a "soc-audio" platform device.

---
 arch/arm/mach-pxa/corgi.c |    9 +++++++++
 sound/soc/pxa/corgi.c     |   43 +++++++++++++++++++++++--------------------
 2 files changed, 32 insertions(+), 20 deletions(-)
arch/arm/mach-pxa/corgi.c +9 -0
index 66600f0..11f1e73 100644
@@ -436,6 +436,14 @@ static struct platform_device corgiled_device = {
 };
 
 /*
+ * Corgi Audio
+ */
+static struct platform_device corgi_audio_device = {
+	.name	= "corgi-audio",
+	.id	= -1,
+};
+
+/*
  * MMC/SD Device
  *
  * The card detect interrupt isn't debounced so we delay it by 250ms
@@ -641,6 +649,7 @@ static struct platform_device *devices[] __initdata = {
 	&corgifb_device,
 	&corgikbd_device,
 	&corgiled_device,
+	&corgi_audio_device,
 	&sharpsl_nand_device,
 	&sharpsl_rom_device,
 };
sound/soc/pxa/corgi.c +23 -20

68 lines not on this page · raw message

Signature · 1 line
1.7.5.4
maintainer Acked-by on v1 3/3
#4 lore raw

Re: [alsa-devel] [PATCH 3/3] ASoC: pxa: Convert corgi to use snd_soc_register_card()

arch/arm/mach-pxa/corgi.c

Quoted 9 lines · Axel Lin

Use snd_soc_register_card() instead of creating a "soc-audio" platform device.

---
 arch/arm/mach-pxa/corgi.c |    9 +++++++++
 sound/soc/pxa/corgi.c     |   43 +++++++++++++++++++++++--------------------

 2 files changed, 32 insertions(+), 20 deletions(-)
arch/arm/mach-pxa/corgi.c +0 -0
Applied
#5 lore raw

Re: [PATCH 3/3] ASoC: pxa: Convert corgi to use snd_soc_register_card()

In reply to Axel Lin
Quoted 1 line · Axel Lin

Use snd_soc_register_card() instead of creating a "soc-audio" platform device.

Applied, thanks.