Skip to contentSkip to conversation

ASoC Blackfin and API updates

PATCH In review Mark Brown 2 participants 9 messages Sep 29, 2008

Subsystems (4)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

cover ASoC Blackfin and API updates

The following changes since commit ad7f41b60efde140df0f929e8d408ebe2e59cb0e:
Jean Delvare (1):
ALSA: Drop Vladimir Barinov's e-mail address

adding the Blackfin updates Brian posted over the weekend plus some more usage of snd_soc_dapm_nc_pin() are available in the git repository at:

git://opensource.wolfsonmicro.com/linux-2.6-asoc for-tiwai

Cliff Cai (4):
ASoC codec: AD73311 audio codec driver
ASoC Blackfin: add I2S DAI support for AD73311
ASoC Blackfin: add asoc ad73311 driver supporting in Blackfin boards ASoC Blackfin: fix bug - Audio Latency on AD1981 with MMAP enabled

Mark Brown (2):
ASoC: Use snd_soc_dapm_nc_pin() in Zaurus machine drivers
ASoC: Use snd_soc_dapm_nc_pin() in N810 machine driver

 sound/soc/blackfin/Kconfig          |   16 +++
 sound/soc/blackfin/Makefile         |    3 +-
 sound/soc/blackfin/bf5xx-ac97-pcm.c |   42 +++++-
 sound/soc/blackfin/bf5xx-ac97.c     |    1 -
 sound/soc/blackfin/bf5xx-ad73311.c  |  240 +++++++++++++++++++++++++++++++++++
 sound/soc/blackfin/bf5xx-i2s.c      |   47 +++++--
 sound/soc/blackfin/bf5xx-sport.h    |    2 +
 sound/soc/codecs/Kconfig            |    4 +
 sound/soc/codecs/Makefile           |    2 +
 sound/soc/codecs/ad73311.c          |  107 ++++++++++++++++
 sound/soc/codecs/ad73311.h          |   90 +++++++++++++
 sound/soc/omap/n810.c               |    6 +-
 sound/soc/pxa/corgi.c               |    4 +-
 sound/soc/pxa/poodle.c              |    4 +-
 sound/soc/pxa/spitz.c               |   14 +-
 sound/soc/pxa/tosa.c                |    4 +-
 16 files changed, 547 insertions(+), 39 deletions(-)
 create mode 100644 sound/soc/blackfin/bf5xx-ad73311.c
 create mode 100644 sound/soc/codecs/ad73311.c
 create mode 100644 sound/soc/codecs/ad73311.h
author
#1 lore raw

PATCH 1/6 ASoC codec: AD73311 audio codec driver

From: Cliff Cai <[email protected]>

---
 sound/soc/codecs/Kconfig   |    4 ++
 sound/soc/codecs/Makefile  |    2 +
 sound/soc/codecs/ad73311.c |  107 ++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/ad73311.h |   90 +++++++++++++++++++++++++++++++++++++
 4 files changed, 203 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/codecs/ad73311.c
 create mode 100644 sound/soc/codecs/ad73311.h
sound/soc/codecs/Kconfig +4 -0
index e0b9869..0507fcf 100644
@@ -3,6 +3,7 @@ config SND_SOC_ALL_CODECS
 	depends on I2C
 	select SPI
 	select SPI_MASTER
+	select SND_SOC_AD73311
 	select SND_SOC_AK4535
 	select SND_SOC_CS4270
 	select SND_SOC_SSM2602
@@ -34,6 +35,9 @@ config SND_SOC_AC97_CODEC
 config SND_SOC_AD1980
 	tristate
 
+config SND_SOC_AD73311
+	tristate
+
 config SND_SOC_AK4535
 	tristate
 
sound/soc/codecs/Makefile +2 -0
index f977978..0731844 100644
@@ -1,5 +1,6 @@
 snd-soc-ac97-objs := ac97.o
 snd-soc-ad1980-objs := ad1980.o
+snd-soc-ad73311-objs := ad73311.o
 snd-soc-ak4535-objs := ak4535.o
 snd-soc-cs4270-objs := cs4270.o
 snd-soc-ssm2602-objs := ssm2602.o
@@ -20,6 +21,7 @@ snd-soc-wm9713-objs := wm9713.o
 
 obj-$(CONFIG_SND_SOC_AC97_CODEC)	+= snd-soc-ac97.o
 obj-$(CONFIG_SND_SOC_AD1980)	+= snd-soc-ad1980.o
+obj-$(CONFIG_SND_SOC_AD73311) += snd-soc-ad73311.o
 obj-$(CONFIG_SND_SOC_AK4535)	+= snd-soc-ak4535.o
 obj-$(CONFIG_SND_SOC_CS4270)	+= snd-soc-cs4270.o
 obj-$(CONFIG_SND_SOC_SSM2602)	+= snd-soc-ssm2602.o
sound/soc/codecs/ad73311.c new file +107 -0

107 lines not on this page · raw message

sound/soc/codecs/ad73311.h new file +90 -0

90 lines not on this page · raw message

Signature · 1 line
1.5.6.5
author
#2 lore raw

PATCH 2/6 ASoC Blackfin: add I2S DAI support for AD73311

From: Cliff Cai <[email protected]>

---
 sound/soc/blackfin/bf5xx-i2s.c |   47 ++++++++++++++++++++++++++++------------
 1 files changed, 33 insertions(+), 14 deletions(-)
sound/soc/blackfin/bf5xx-i2s.c +33 -14
index 43a4092..827587f 100644
@@ -70,6 +70,13 @@ static struct sport_param sport_params[2] = {
 	}
 };
 
+static u16 sport_req[][7] = {
+		{ P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
+		  P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0},
+		{ P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
+		  P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0},
+};
+
 static int bf5xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai,
 		unsigned int fmt)
 {
@@ -78,6 +85,14 @@ static int bf5xx_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai,
 	/* interface format:support I2S,slave mode */
 	switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
 	case SND_SOC_DAIFMT_I2S:
+		bf5xx_i2s.tcr1 |= TFSR | TCKFE;
+		bf5xx_i2s.rcr1 |= RFSR | RCKFE;
+		bf5xx_i2s.tcr2 |= TSFSE;
+		bf5xx_i2s.rcr2 |= RSFSE;
+		break;
+	case SND_SOC_DAIFMT_DSP_A:
+		bf5xx_i2s.tcr1 |= TFSR;
+		bf5xx_i2s.rcr1 |= RFSR;
 		break;
 	case SND_SOC_DAIFMT_LEFT_J:
 		ret = -EINVAL;
@@ -127,14 +142,17 @@ static int bf5xx_i2s_hw_params(struct snd_pcm_substream *substream,
 	case SNDRV_PCM_FORMAT_S16_LE:
 		bf5xx_i2s.tcr2 |= 15;
 		bf5xx_i2s.rcr2 |= 15;
+		sport_handle->wdsize = 2;
 		break;
 	case SNDRV_PCM_FORMAT_S24_LE:
 		bf5xx_i2s.tcr2 |= 23;
 		bf5xx_i2s.rcr2 |= 23;
+		sport_handle->wdsize = 3;
 		break;
 	case SNDRV_PCM_FORMAT_S32_LE:
 		bf5xx_i2s.tcr2 |= 31;
 		bf5xx_i2s.rcr2 |= 31;
+		sport_handle->wdsize = 4;
 		break;
 	}
 
@@ -145,17 +163,17 @@ static int bf5xx_i2s_hw_params(struct snd_pcm_substream *substream,
 		 * need to configure both of them at the time when the first
 		 * stream is opened.
 		 *
-		 * CPU DAI format:I2S, slave mode.
+		 * CPU DAI:slave mode.
 		 */
-		ret = sport_config_rx(sport_handle, RFSR | RCKFE,
-				      RSFSE|bf5xx_i2s.rcr2, 0, 0);
+		ret = sport_config_rx(sport_handle, bf5xx_i2s.rcr1,
+				      bf5xx_i2s.rcr2, 0, 0);
 		if (ret) {
 			pr_err("SPORT is busy!\n");
 			return -EBUSY;
 		}
 
-		ret = sport_config_tx(sport_handle, TFSR | TCKFE,
-				      TSFSE|bf5xx_i2s.tcr2, 0, 0);
+		ret = sport_config_tx(sport_handle, bf5xx_i2s.tcr1,
+				      bf5xx_i2s.tcr2, 0, 0);
 		if (ret) {
 			pr_err("SPORT is busy!\n");
 			return -EBUSY;
@@ -174,13 +192,6 @@ static void bf5xx_i2s_shutdown(struct snd_pcm_substream *substream)
 static int bf5xx_i2s_probe(struct platform_device *pdev,
 			   struct snd_soc_dai *dai)
 {
-	u16 sport_req[][7] = {
-		{ P_SPORT0_DTPRI, P_SPORT0_TSCLK, P_SPORT0_RFS,
-		  P_SPORT0_DRPRI, P_SPORT0_RSCLK, 0},
-		{ P_SPORT1_DTPRI, P_SPORT1_TSCLK, P_SPORT1_RFS,
-		  P_SPORT1_DRPRI, P_SPORT1_RSCLK, 0},
-	};
-
 	pr_debug("%s enter\n", __func__);
 	if (peripheral_request_list(&sport_req[sport_num][0], "soc-audio")) {
 		pr_err("Requesting Peripherals failed\n");
@@ -198,6 +209,13 @@ static int bf5xx_i2s_probe(struct platform_device *pdev,
 	return 0;
 }
 
+static void bf5xx_i2s_remove(struct platform_device *pdev,
+			   struct snd_soc_dai *dai)
+{
+	pr_debug("%s enter\n", __func__);
+	peripheral_free_list(&sport_req[sport_num][0]);
+}
+
 #ifdef CONFIG_PM
 static int bf5xx_i2s_suspend(struct platform_device *dev,
 			     struct snd_soc_dai *dai)
@@ -263,15 +281,16 @@ struct snd_soc_dai bf5xx_i2s_dai = {
 	.id = 0,
 	.type = SND_SOC_DAI_I2S,
 	.probe = bf5xx_i2s_probe,
+	.remove = bf5xx_i2s_remove,
 	.suspend = bf5xx_i2s_suspend,
 	.resume = bf5xx_i2s_resume,
 	.playback = {
-		.channels_min = 2,
+		.channels_min = 1,
 		.channels_max = 2,
 		.rates = BF5XX_I2S_RATES,
 		.formats = BF5XX_I2S_FORMATS,},
 	.capture = {
-		.channels_min = 2,
+		.channels_min = 1,
 		.channels_max = 2,
 		.rates = BF5XX_I2S_RATES,
 		.formats = BF5XX_I2S_FORMATS,},
Signature · 1 line
1.5.6.5
author
#3 lore raw

PATCH 3/6 ASoC Blackfin: add asoc ad73311 driver supporting in Blackfin boards

From: Cliff Cai <[email protected]>

---
 sound/soc/blackfin/Kconfig         |   16 +++
 sound/soc/blackfin/Makefile        |    3 +-
 sound/soc/blackfin/bf5xx-ad73311.c |  240 ++++++++++++++++++++++++++++++++++++
 3 files changed, 258 insertions(+), 1 deletions(-)
 create mode 100644 sound/soc/blackfin/bf5xx-ad73311.c
sound/soc/blackfin/Kconfig +16 -0
index f98331d..dc00620 100644
@@ -17,6 +17,22 @@ config SND_BF5XX_SOC_SSM2602
 	help
 	  Say Y if you want to add support for SoC audio on BF527-EZKIT.
 
+config SND_BF5XX_SOC_AD73311
+	tristate "SoC AD73311 Audio support for Blackfin"
+	depends on SND_BF5XX_I2S
+	select SND_BF5XX_SOC_I2S
+	select SND_SOC_AD73311
+	help
+	  Say Y if you want to add support for AD73311 codec on Blackfin.
+
+config SND_BFIN_AD73311_SE
+	int "PF pin for AD73311L Chip Select"
+	depends on SND_BF5XX_SOC_AD73311
+	default 4
+	help
+	  Enter the GPIO used to control AD73311's SE pin. Acceptable
+	  values are 0 to 7
+
 config SND_BF5XX_AC97
 	tristate "SoC AC97 Audio for the ADI BF5xx chip"
 	depends on BLACKFIN && SND_SOC
sound/soc/blackfin/Makefile +2 -1
index 9ea8bd9..97bb37a 100644
@@ -14,7 +14,8 @@ obj-$(CONFIG_SND_BF5XX_SOC_I2S) += snd-soc-bf5xx-i2s.o
 # Blackfin Machine Support
 snd-ad1980-objs := bf5xx-ad1980.o
 snd-ssm2602-objs := bf5xx-ssm2602.o
-
+snd-ad73311-objs := bf5xx-ad73311.o
 
 obj-$(CONFIG_SND_BF5XX_SOC_AD1980) += snd-ad1980.o
 obj-$(CONFIG_SND_BF5XX_SOC_SSM2602) += snd-ssm2602.o
+obj-$(CONFIG_SND_BF5XX_SOC_AD73311) += snd-ad73311.o
sound/soc/blackfin/bf5xx-ad73311.c new file +240 -0

240 lines not on this page · raw message

Signature · 1 line
1.5.6.5
author
#4 lore raw

PATCH 4/6 ASoC Blackfin: fix bug - Audio Latency on AD1981 with MMAP enabled

From: Cliff Cai <[email protected]>

With MMAP enabled (DMA mode) on the AD1981, there is +/- 250ms of delay between writing data to alsa and audio starts coming out of the AD1981.

Copy more data to local buffer before starting DMA

---
 sound/soc/blackfin/bf5xx-ac97-pcm.c |   42 +++++++++++++++++++++++++++++-----
 sound/soc/blackfin/bf5xx-ac97.c     |    1 -
 sound/soc/blackfin/bf5xx-sport.h    |    2 +
 3 files changed, 37 insertions(+), 8 deletions(-)
sound/soc/blackfin/bf5xx-ac97-pcm.c +35 -7
index 51f4907..25e50d2 100644
@@ -56,6 +56,7 @@ static void bf5xx_mmap_copy(struct snd_pcm_substream *substream,
 		sport->tx_pos += runtime->period_size;
 		if (sport->tx_pos >= runtime->buffer_size)
 			sport->tx_pos %= runtime->buffer_size;
+		sport->tx_delay_pos = sport->tx_pos;
 	} else {
 		bf5xx_ac97_to_pcm(
 			(struct ac97_frame *)sport->rx_dma_buf + sport->rx_pos,
@@ -72,7 +73,15 @@ static void bf5xx_dma_irq(void *data)
 	struct snd_pcm_substream *pcm = data;
 #if defined(CONFIG_SND_MMAP_SUPPORT)
 	struct snd_pcm_runtime *runtime = pcm->runtime;
+	struct sport_device *sport = runtime->private_data;
 	bf5xx_mmap_copy(pcm, runtime->period_size);
+	if (pcm->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+		if (sport->once == 0) {
+			snd_pcm_period_elapsed(pcm);
+			bf5xx_mmap_copy(pcm, runtime->period_size);
+			sport->once = 1;
+		}
+	}
 #endif
 	snd_pcm_period_elapsed(pcm);
 }
@@ -114,6 +123,10 @@ static int bf5xx_pcm_hw_params(struct snd_pcm_substream *substream,
 
 static int bf5xx_pcm_hw_free(struct snd_pcm_substream *substream)
 {
+	struct snd_pcm_runtime *runtime = substream->runtime;
+
+	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	memset(runtime->dma_area, 0, runtime->buffer_size);
 	snd_pcm_lib_free_pages(substream);
 	return 0;
 }
@@ -127,16 +140,11 @@ static int bf5xx_pcm_prepare(struct snd_pcm_substream *substream)
 	 * SPORT working in TMD mode(include AC97).
 	 */
 #if defined(CONFIG_SND_MMAP_SUPPORT)
-	size_t size = bf5xx_pcm_hardware.buffer_bytes_max
-			* sizeof(struct ac97_frame) / 4;
-	/*clean up intermediate buffer*/
 	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
-		memset(sport->tx_dma_buf, 0, size);
 		sport_set_tx_callback(sport, bf5xx_dma_irq, substream);
 		sport_config_tx_dma(sport, sport->tx_dma_buf, runtime->periods,
 			runtime->period_size * sizeof(struct ac97_frame));
 	} else {
-		memset(sport->rx_dma_buf, 0, size);
 		sport_set_rx_callback(sport, bf5xx_dma_irq, substream);
 		sport_config_rx_dma(sport, sport->rx_dma_buf, runtime->periods,
 			runtime->period_size * sizeof(struct ac97_frame));
@@ -164,8 +172,12 @@ static int bf5xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
 	pr_debug("%s enter\n", __func__);
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_START:
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+			bf5xx_mmap_copy(substream, runtime->period_size);
+			snd_pcm_period_elapsed(substream);
+			sport->tx_delay_pos = 0;
 			sport_tx_start(sport);
+		}
 		else
 			sport_rx_start(sport);
 		break;
@@ -198,7 +210,7 @@ static snd_pcm_uframes_t bf5xx_pcm_pointer(struct snd_pcm_substream *substream)
 
 #if defined(CONFIG_SND_MMAP_SUPPORT)
 	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
-		curr = sport->tx_pos;
+		curr = sport->tx_delay_pos;
 	else
 		curr = sport->rx_pos;
 #else
@@ -237,6 +249,21 @@ static int bf5xx_pcm_open(struct snd_pcm_substream *substream)
 	return ret;
 }
 
+static int bf5xx_pcm_close(struct snd_pcm_substream *substream)
+{
+	struct snd_pcm_runtime *runtime = substream->runtime;
+	struct sport_device *sport = runtime->private_data;
+
+	pr_debug("%s enter\n", __func__);
+	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+		sport->once = 0;
+		memset(sport->tx_dma_buf, 0, runtime->buffer_size * sizeof(struct ac97_frame));
+	} else
+		memset(sport->rx_dma_buf, 0, runtime->buffer_size * sizeof(struct ac97_frame));
+
+	return 0;
+}
+
 #ifdef CONFIG_SND_MMAP_SUPPORT
 static int bf5xx_pcm_mmap(struct snd_pcm_substream *substream,
 	struct vm_area_struct *vma)
@@ -272,6 +299,7 @@ static	int bf5xx_pcm_copy(struct snd_pcm_substream *substream, int channel,
 
 struct snd_pcm_ops bf5xx_pcm_ac97_ops = {
 	.open		= bf5xx_pcm_open,
+	.close		= bf5xx_pcm_close,
 	.ioctl		= snd_pcm_lib_ioctl,
 	.hw_params	= bf5xx_pcm_hw_params,
 	.hw_free	= bf5xx_pcm_hw_free,
sound/soc/blackfin/bf5xx-ac97.c +0 -1
index c782e31..5e5aafb 100644
@@ -129,7 +129,6 @@ static void enqueue_cmd(struct snd_ac97 *ac97, __u16 addr, __u16 data)
 	struct ac97_frame *nextwrite;
 
 	sport_incfrag(sport, &nextfrag, 1);
-	sport_incfrag(sport, &nextfrag, 1);
 
 	nextwrite = (struct ac97_frame *)(sport->tx_buf + \
 			nextfrag * sport->tx_fragsize);
sound/soc/blackfin/bf5xx-sport.h +2 -0
index 4c16345..fcadcc0 100644
@@ -123,6 +123,8 @@ struct sport_device {
 	int rx_pos;
 	unsigned int tx_buffer_size;
 	unsigned int rx_buffer_size;
+	int tx_delay_pos;
+	int once;
 #endif
 	void *private_data;
 };
Signature · 1 line
1.5.6.5
author
#5 lore raw

PATCH 5/6 ASoC: Use snd_soc_dapm_nc_pin() in Zaurus machine drivers

---
 sound/soc/pxa/corgi.c  |    4 ++--
 sound/soc/pxa/poodle.c |    4 ++--
 sound/soc/pxa/spitz.c  |   14 +++++++-------
 sound/soc/pxa/tosa.c   |    4 ++--
 4 files changed, 13 insertions(+), 13 deletions(-)
sound/soc/pxa/corgi.c +2 -2
index 72b7a51..0bceaf6 100644
@@ -289,8 +289,8 @@ static int corgi_wm8731_init(struct snd_soc_codec *codec)
 {
 	int i, err;
 
-	snd_soc_dapm_disable_pin(codec, "LLINEIN");
-	snd_soc_dapm_disable_pin(codec, "RLINEIN");
+	snd_soc_dapm_nc_pin(codec, "LLINEIN");
+	snd_soc_dapm_nc_pin(codec, "RLINEIN");
 
 	/* Add corgi specific controls */
 	for (i = 0; i < ARRAY_SIZE(wm8731_corgi_controls); i++) {
sound/soc/pxa/poodle.c +2 -2
index f84f7d8..e5adb0e 100644
@@ -242,8 +242,8 @@ static int poodle_wm8731_init(struct snd_soc_codec *codec)
 {
 	int i, err;
 
-	snd_soc_dapm_disable_pin(codec, "LLINEIN");
-	snd_soc_dapm_disable_pin(codec, "RLINEIN");
+	snd_soc_dapm_nc_pin(codec, "LLINEIN");
+	snd_soc_dapm_nc_pin(codec, "RLINEIN");
 	snd_soc_dapm_enable_pin(codec, "MICIN");
 
 	/* Add poodle specific controls */
sound/soc/pxa/spitz.c +7 -7
index 3d4738c..e0bcc42 100644
@@ -291,13 +291,13 @@ static int spitz_wm8750_init(struct snd_soc_codec *codec)
 	int i, err;
 
 	/* NC codec pins */
-	snd_soc_dapm_disable_pin(codec, "RINPUT1");
-	snd_soc_dapm_disable_pin(codec, "LINPUT2");
-	snd_soc_dapm_disable_pin(codec, "RINPUT2");
-	snd_soc_dapm_disable_pin(codec, "LINPUT3");
-	snd_soc_dapm_disable_pin(codec, "RINPUT3");
-	snd_soc_dapm_disable_pin(codec, "OUT3");
-	snd_soc_dapm_disable_pin(codec, "MONO1");
+	snd_soc_dapm_nc_pin(codec, "RINPUT1");
+	snd_soc_dapm_nc_pin(codec, "LINPUT2");
+	snd_soc_dapm_nc_pin(codec, "RINPUT2");
+	snd_soc_dapm_nc_pin(codec, "LINPUT3");
+	snd_soc_dapm_nc_pin(codec, "RINPUT3");
+	snd_soc_dapm_nc_pin(codec, "OUT3");
+	snd_soc_dapm_nc_pin(codec, "MONO1");
 
 	/* Add spitz specific controls */
 	for (i = 0; i < ARRAY_SIZE(wm8750_spitz_controls); i++) {
sound/soc/pxa/tosa.c +2 -2
index 2baaa75..eae2a0f 100644
@@ -190,8 +190,8 @@ static int tosa_ac97_init(struct snd_soc_codec *codec)
 {
 	int i, err;
 
-	snd_soc_dapm_disable_pin(codec, "OUT3");
-	snd_soc_dapm_disable_pin(codec, "MONOOUT");
+	snd_soc_dapm_nc_pin(codec, "OUT3");
+	snd_soc_dapm_nc_pin(codec, "MONOOUT");
 
 	/* add tosa specific controls */
 	for (i = 0; i < ARRAY_SIZE(tosa_controls); i++) {
Signature · 1 line
1.5.6.5
author
#6 lore raw

PATCH 6/6 ASoC: Use snd_soc_dapm_nc_pin() in N810 machine driver

---
 sound/soc/omap/n810.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
sound/soc/omap/n810.c +3 -3
index d166b6b..fae3ad3 100644
@@ -247,9 +247,9 @@ static int n810_aic33_init(struct snd_soc_codec *codec)
 	int i, err;
 
 	/* Not connected */
-	snd_soc_dapm_disable_pin(codec, "MONO_LOUT");
-	snd_soc_dapm_disable_pin(codec, "HPLCOM");
-	snd_soc_dapm_disable_pin(codec, "HPRCOM");
+	snd_soc_dapm_nc_pin(codec, "MONO_LOUT");
+	snd_soc_dapm_nc_pin(codec, "HPLCOM");
+	snd_soc_dapm_nc_pin(codec, "HPRCOM");
 
 	/* Add N810 specific controls */
 	for (i = 0; i < ARRAY_SIZE(aic33_n810_controls); i++) {
Signature · 1 line
1.5.6.5
#7 lore raw

Re: [PATCH 4/6] ASoC Blackfin: fix bug - Audio Latency on AD1981 with MMAP enabled

In reply to Mark Brown

Hi,

I already pulled it, but below are some comments.

At Mon, 29 Sep 2008 14:44:31 +0100,

Quoted 14 lines · Mark Brown

From: Cliff Cai <[email protected]>

With MMAP enabled (DMA mode) on the AD1981, there is +/- 250ms of delay between writing data to alsa and audio starts coming out of the AD1981.

Copy more data to local buffer before starting DMA

sound/soc/blackfin/bf5xx-ac97-pcm.c +0 -0
 	snd_pcm_period_elapsed(pcm);
 }

sound/soc/blackfin/bf5xx-ac97-pcm.c static int bf5xx_pcm_hw_params(struct snd_pcm_substream *substream, · line 129

Quoted 7 lines
sound/soc/blackfin/bf5xx-ac97-pcm.c +4 -0
@@ -114,6 +123,10 @@ static int bf5xx_pcm_hw_params(struct snd_pcm_substream *substream,
 
 static int bf5xx_pcm_hw_free(struct snd_pcm_substream *substream)
 {
+	struct snd_pcm_runtime *runtime = substream->runtime;
+
+	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+	memset(runtime->dma_area, 0, runtime->buffer_size);

Missing indentation here.

sound/soc/blackfin/bf5xx-ac97-pcm.c static int bf5xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) · line 177

Quoted 8 lines
sound/soc/blackfin/bf5xx-ac97-pcm.c +3 -1
@@ -164,8 +172,12 @@ static int bf5xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
 	pr_debug("%s enter\n", __func__);
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_START:
-		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+			bf5xx_mmap_copy(substream, runtime->period_size);
+			snd_pcm_period_elapsed(substream);

Calling this in the trigger callback is pretty tricky.
I guess this could be implemented without involving snd_pcm_period_elapsed(), but rather only inside this machine driver, if it's only the question of dummy data handling at the beginning.

Quoted 8 lines
sound/soc/blackfin/bf5xx-ac97-pcm.c +4 -0
@@ -237,6 +249,21 @@ static int bf5xx_pcm_open(struct snd_pcm_substream *substream)
 	return ret;
 }
 
+static int bf5xx_pcm_close(struct snd_pcm_substream *substream)
+{
+	struct snd_pcm_runtime *runtime = substream->runtime;
+	struct sport_device *sport = runtime->private_data;

sound/soc/blackfin/bf5xx-ac97-pcm.c static int bf5xx_pcm_open(struct snd_pcm_substream *substream) · line 265

Quoted 10 lines
sound/soc/blackfin/bf5xx-ac97-pcm.c +10 -0
+
+	pr_debug("%s enter\n", __func__);
+	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+		sport->once = 0;
+		memset(sport->tx_dma_buf, 0, runtime->buffer_size * sizeof(struct ac97_frame));
+	} else
+		memset(sport->rx_dma_buf, 0, runtime->buffer_size * sizeof(struct ac97_frame));
+
+	return 0;
+}

Better to clear buffers in hw_free in both playback and capture cases (unless you have any issue against it).
The hw_free is supposed to be called anyway before closing, so you don't need the same thing in multiple places.

As mentioned, I already pulled the patches, so please make changes against the latest tree.

thanks,

Takashi

#8 lore raw
In reply to Mark Brown

At Mon, 29 Sep 2008 14:39:51 +0100,

Quoted 9 lines · Mark Brown

The following changes since commit ad7f41b60efde140df0f929e8d408ebe2e59cb0e:
Jean Delvare (1):
ALSA: Drop Vladimir Barinov's e-mail address

adding the Blackfin updates Brian posted over the weekend plus some more usage of snd_soc_dapm_nc_pin() are available in the git repository at:

git://opensource.wolfsonmicro.com/linux-2.6-asoc for-tiwai

Thanks, pulled in now.

Takashi