Skip to contentSkip to conversation

PATCH In review Bryan Wu 3 participants 13 messages Nov 18, 2008

Subsystems (3)
lore
Share & tools
lore
author
#1 lore raw

PATCH 1/8 ASoC: Blackfin: updates Kconfig for SPORT

From: Mike Frysinger <[email protected]>

tweak SPORT range for non-BF54x so we get proper behavior for BF52x parts

---
 sound/soc/blackfin/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/blackfin/Kconfig +1 -1
index dc00620..3fce187 100644
@@ -80,7 +80,7 @@ config SND_BF5XX_SPORT_NUM
 	int "Set a SPORT for Sound chip"
 	depends on (SND_BF5XX_I2S || SND_BF5XX_AC97)
 	range 0 3 if BF54x
-	range 0 1 if (BF53x || BF561)
+	range 0 1 if !BF54x
 	default 0
 	help
 	  Set the correct SPORT for sound chip.
Signature · 1 line
1.5.6.3
author
#2 lore raw

PATCH 2/8 ASoC: AD1980 codec: add multi-channel function support

In reply to Bryan Wu

From: Cliff Cai <[email protected]>

We added multi-channel function to this codec driver and Blackfin ASoC driver as well. It was tested on Blackfin hardware.

---
 sound/soc/codecs/ad1980.c |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)
sound/soc/codecs/ad1980.c +15 -4
index 1397b8e..410fed9 100644
@@ -85,6 +85,9 @@ SOC_DOUBLE("Line HP Swap Switch", AC97_AD_MISC, 10, 5, 1, 0),
 SOC_DOUBLE("Surround Playback Volume", AC97_SURROUND_MASTER, 8, 0, 31, 1),
 SOC_DOUBLE("Surround Playback Switch", AC97_SURROUND_MASTER, 15, 7, 1, 1),
 
+SOC_DOUBLE("Center/LFE Playback Volume", AC97_CENTER_LFE_MASTER, 8, 0, 31, 1),
+SOC_DOUBLE("Center/LFE Playback Switch", AC97_CENTER_LFE_MASTER, 15, 7, 1, 1),
+
 SOC_ENUM("Capture Source", ad1980_cap_src),
 
 SOC_SINGLE("Mic Boost Switch", AC97_MIC, 6, 1, 0),
@@ -145,7 +148,7 @@ struct snd_soc_dai ad1980_dai = {
 	.playback = {
 		.stream_name = "Playback",
 		.channels_min = 2,
-		.channels_max = 2,
+		.channels_max = 6,
 		.rates = SNDRV_PCM_RATE_48000,
 		.formats = SNDRV_PCM_FMTBIT_S16_LE, },
 	.capture = {
@@ -192,6 +195,7 @@ static int ad1980_soc_probe(struct platform_device *pdev)
 	struct snd_soc_codec *codec;
 	int ret = 0;
 	u16 vendor_id2;
+	u16 ext_status;
 
 	printk(KERN_INFO "AD1980 SoC Audio Codec\n");
 
@@ -253,9 +257,16 @@ static int ad1980_soc_probe(struct platform_device *pdev)
 				"supported\n");
 	}
 
-	ac97_write(codec, AC97_MASTER, 0x0000); /* unmute line out volume */
-	ac97_write(codec, AC97_PCM, 0x0000);	/* unmute PCM out volume */
-	ac97_write(codec, AC97_REC_GAIN, 0x0000);/* unmute record volume */
+	/* unmute captures and playbacks volume */
+	ac97_write(codec, AC97_MASTER, 0x0000);
+	ac97_write(codec, AC97_PCM, 0x0000);
+	ac97_write(codec, AC97_REC_GAIN, 0x0000);
+	ac97_write(codec, AC97_CENTER_LFE_MASTER, 0x0000);
+	ac97_write(codec, AC97_SURROUND_MASTER, 0x0000);
+
+	/*power on LFE/CENTER/Surround DACs*/
+	ext_status = ac97_read(codec, AC97_EXTENDED_STATUS);
+	ac97_write(codec, AC97_EXTENDED_STATUS, ext_status&~0x3800);
 
 	ad1980_add_controls(codec);
 	ret = snd_soc_register_card(socdev);
Signature · 1 line
1.5.6.3
author
#3 lore raw

PATCH 3/8 ASoC: Blackfin: add multi-channel function support

In reply to Bryan Wu

From: Cliff Cai <[email protected]>

This patch provides a option for users to enable multi-channel function support in Blackfin ASoC driver. Because Blackfin is without MMU, it is easy for us and the user to enable this function at compiling stage not dynamically on the fly.

---
 sound/soc/blackfin/Kconfig          |   14 +++-
 sound/soc/blackfin/bf5xx-ac97-pcm.c |   80 +++++++++++-------
 sound/soc/blackfin/bf5xx-ac97.c     |  156 +++++++++++++++++++++--------------
 sound/soc/blackfin/bf5xx-ac97.h     |   35 +++++++-
 sound/soc/blackfin/bf5xx-sport.h    |    2 +-
 5 files changed, 184 insertions(+), 103 deletions(-)
sound/soc/blackfin/Kconfig +11 -3
index 3fce187..43d89fc 100644
@@ -47,7 +47,7 @@ config SND_BF5XX_AC97
 	  properly with this driver. This driver is known to work with the
 	  Analog Devices line of AC97 codecs.
 
-config SND_MMAP_SUPPORT
+config SND_BF5XX_MMAP_SUPPORT
 	bool "Enable MMAP Support"
 	depends on SND_BF5XX_AC97
 	default y
@@ -55,9 +55,17 @@ config SND_MMAP_SUPPORT
 	  Say y if you want AC97 driver to support mmap mode.
 	  We introduce an intermediate buffer to simulate mmap.
 
+config SND_BF5XX_MULTICHAN_SUPPORT
+	bool "Enable Multichannel Support"
+	depends on SND_BF5XX_AC97
+	default n
+	help
+	  Say y if you want AC97 driver to support up to 5.1 channel audio.
+	  this mode will consume much more memory for DMA.
+
 config SND_BF5XX_SOC_SPORT
 	tristate
-	
+
 config SND_BF5XX_SOC_I2S
 	tristate
 	select SND_BF5XX_SOC_SPORT
@@ -90,7 +98,7 @@ config SND_BF5XX_HAVE_COLD_RESET
 	depends on SND_BF5XX_AC97
 	default y if BFIN548_EZKIT
 	default n if !BFIN548_EZKIT
-	
+
 config SND_BF5XX_RESET_GPIO_NUM
 	int "Set a GPIO for cold reset"
 	depends on SND_BF5XX_HAVE_COLD_RESET
sound/soc/blackfin/bf5xx-ac97-pcm.c +49 -31

189 lines not on this page · raw message

sound/soc/blackfin/bf5xx-ac97.c +93 -63

258 lines not on this page · raw message

sound/soc/blackfin/bf5xx-ac97.h +30 -5
index 3f77cc5..3f2a911 100644
@@ -16,21 +16,46 @@ struct ac97_frame {
 	u16 ac97_tag;		/* slot 0 */
 	u16 ac97_addr;		/* slot 1 */
 	u16 ac97_data;		/* slot 2 */
-	u32 ac97_pcm;		/* slot 3 and 4: left and right pcm data */
+	u16 ac97_pcm_l;		/*slot 3:front left*/
+	u16 ac97_pcm_r;		/*slot 4:front left*/
+#if defined(CONFIG_SND_BF5XX_MULTICHAN_SUPPORT)
+	u16 ac97_mdm_l1;
+	u16 ac97_center;	/*slot 6:center*/
+	u16 ac97_sl;		/*slot 7:surround left*/
+	u16 ac97_sr;		/*slot 8:surround right*/
+	u16 ac97_lfe;		/*slot 9:lfe*/
+#endif
 } __attribute__ ((packed));
 
+/* Speaker location */
+#define SP_FL		0x0001
+#define SP_FR		0x0010
+#define SP_FC		0x0002
+#define SP_LFE		0x0020
+#define SP_SL		0x0004
+#define SP_SR		0x0040
+
+#define SP_STEREO	(SP_FL | SP_FR)
+#define SP_2DOT1	(SP_FL | SP_FR | SP_LFE)
+#define SP_QUAD		(SP_FL | SP_FR | SP_SL | SP_SR)
+#define SP_5DOT1	(SP_FL | SP_FR | SP_FC | SP_LFE | SP_SL | SP_SR)
+
 #define TAG_VALID		0x8000
 #define TAG_CMD			0x6000
 #define TAG_PCM_LEFT		0x1000
 #define TAG_PCM_RIGHT		0x0800
-#define TAG_PCM			(TAG_PCM_LEFT | TAG_PCM_RIGHT)
+#define TAG_PCM_MDM_L1		0x0400
+#define TAG_PCM_CENTER		0x0200
+#define TAG_PCM_SL		0x0100
+#define TAG_PCM_SR		0x0080
+#define TAG_PCM_LFE		0x0040
 
 extern struct snd_soc_dai bfin_ac97_dai;
 
-void bf5xx_pcm_to_ac97(struct ac97_frame *dst, const __u32 *src, \
-		size_t count);
+void bf5xx_pcm_to_ac97(struct ac97_frame *dst, const __u16 *src, \
+		size_t count, unsigned int chan_mask);
 
-void bf5xx_ac97_to_pcm(const struct ac97_frame *src, __u32 *dst, \
+void bf5xx_ac97_to_pcm(const struct ac97_frame *src, __u16 *dst, \
 		size_t count);
 
 #endif
sound/soc/blackfin/bf5xx-sport.h +1 -1
index fcadcc0..2e63dea 100644
@@ -116,7 +116,7 @@ struct sport_device {
 	void *err_data;
 	unsigned char *tx_dma_buf;
 	unsigned char *rx_dma_buf;
-#ifdef CONFIG_SND_MMAP_SUPPORT
+#ifdef CONFIG_SND_BF5XX_MMAP_SUPPORT
 	dma_addr_t tx_dma_phy;
 	dma_addr_t rx_dma_phy;
 	int tx_pos;/*pcm sample count*/
Signature · 1 line
1.5.6.3
author
#4 lore raw

PATCH 4/8 ASoC: Blackfin: fix bug - AD1980/1 SOC Audio driver fails to build in case MMAP support is turned off

In reply to Bryan Wu

From: Cliff Cai <[email protected]>

clean up redudent code and correct building problem in non-mmap mode

---
 sound/soc/blackfin/bf5xx-ac97-pcm.c |   22 +++-------------------
 1 files changed, 3 insertions(+), 19 deletions(-)
sound/soc/blackfin/bf5xx-ac97-pcm.c +3 -19
index 4be1a49..4d25f73 100644
@@ -193,8 +193,10 @@ static int bf5xx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_START:
 		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT)
 			bf5xx_mmap_copy(substream, runtime->period_size);
 			sport->tx_delay_pos = 0;
+#endif
 			sport_tx_start(sport);
 		} else
 			sport_rx_start(sport);
@@ -267,23 +269,6 @@ 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;
-}
-
 #if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT)
 static int bf5xx_pcm_mmap(struct snd_pcm_substream *substream,
 	struct vm_area_struct *vma)
@@ -301,7 +286,7 @@ static	int bf5xx_pcm_copy(struct snd_pcm_substream *substream, int channel,
 		    void __user *buf, snd_pcm_uframes_t count)
 {
 	struct snd_pcm_runtime *runtime = substream->runtime;
-
+	unsigned int chan_mask = ac97_chan_mask[runtime->channels - 1];
 	pr_debug("%s copy pos:0x%lx count:0x%lx\n",
 			substream->stream ? "Capture" : "Playback", pos, count);
 
@@ -317,7 +302,6 @@ 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,
Signature · 1 line
1.5.6.3
#5 lore raw

Re: [alsa-devel] [PATCH 4/8] ASoC: Blackfin: fix bug - AD1980/1 SOC Audio driver fails to build in case MMAP support is turned off

Quoted 3 lines · Bryan Wu

From: Cliff Cai <[email protected]>

clean up redudent code and correct building problem in non-mmap mode

This doesn't apply against 2.6.28 - does the same issue apply there? If so then a patch for 2.6.28 fixing *only* the build issue would probably be a good idea.

Alos, please try to ensure that the short log for your patch is less than 80 characters (it should normally be much less).

author
#6 lore raw

PATCH 5/8 ASoC: Fix BUGS in Blackfin AC97 DAI

In reply to Bryan Wu

From: Michael Hennerich <[email protected]>

sport_handle is a global and not allocated my kmalloc. A probe function should have a clean return 0 path.

---
 sound/soc/blackfin/bf5xx-ac97.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
sound/soc/blackfin/bf5xx-ac97.c +2 -0
index 65c162c..5dcd3f6 100644
@@ -378,6 +378,8 @@ static int bf5xx_ac97_probe(struct platform_device *pdev,
 		goto sport_config_err;
 	}
 
+	return 0;
+
 sport_config_err:
 	kfree(sport_handle);
 sport_err:
Signature · 1 line
1.5.6.3
#7 lore raw

Re: [alsa-devel] [PATCH 5/8] ASoC: Fix BUGS in Blackfin AC97 DAI

Quoted 3 lines · Bryan Wu

From: Michael Hennerich <[email protected]>

sport_handle is a global and not allocated my kmalloc.

There's no reference to sport_handle in the patch...

Quoted 1 line

A probe function should have a clean return 0 path.

...only this.

#8 lore raw

RE: [alsa-devel] [PATCH 5/8] ASoC: Fix BUGS in Blackfin AC97 DAI

Quoted 3 lines
Quoted 1 line

sport_handle is a global and not allocated my kmalloc.

There's no reference to sport_handle in the patch...

Sorry - spurious comment please ignore.

-Michael

Quoted 7 lines

-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Tuesday, November 18, 2008 12:54 PM
To: Bryan Wu
Cc: [email protected]; Cliff Cai; [email protected]; linux- [email protected]; Michael Hennerich
Subject: Re: [alsa-devel] [PATCH 5/8] ASoC: Fix BUGS in Blackfin AC97

DAI

Quoted 11 lines · Bryan Wu
Quoted 3 lines

From: Michael Hennerich <[email protected]>

sport_handle is a global and not allocated my kmalloc.

There's no reference to sport_handle in the patch...

Quoted 1 line

A probe function should have a clean return 0 path.

...only this.

author
#9 lore raw

PATCH 6/8 ASoC: Blackfin: do not force TWI bus for ssm2602 codec

In reply to Bryan Wu

From: Mike Frysinger <[email protected]>

---
 sound/soc/blackfin/Kconfig |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
sound/soc/blackfin/Kconfig +0 -1
index 43d89fc..f0fd235 100644
@@ -13,7 +13,6 @@ config SND_BF5XX_SOC_SSM2602
 	select SND_BF5XX_SOC_I2S
 	select SND_SOC_SSM2602
 	select I2C
-	select I2C_BLACKFIN_TWI
 	help
 	  Say Y if you want to add support for SoC audio on BF527-EZKIT.
 
Signature · 1 line
1.5.6.3
author
#10 lore raw

PATCH 7/8 ASoC: Blackfin: Simplify the MMAP_SUPPORT macros protected code

In reply to Bryan Wu
---
 sound/soc/blackfin/bf5xx-ac97-pcm.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
sound/soc/blackfin/bf5xx-ac97-pcm.c +3 -6
index 4d25f73..d3d51bc 100644
@@ -100,17 +100,14 @@ static void bf5xx_dma_irq(void *data)
  * The total rx/tx buffer is for ac97 frame to hold all pcm data
  * is  0x20000 * sizeof(struct ac97_frame) / 4.
  */
-#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT)
 static const struct snd_pcm_hardware bf5xx_pcm_hardware = {
 	.info			= SNDRV_PCM_INFO_INTERLEAVED |
+#if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT)
 				   SNDRV_PCM_INFO_MMAP |
 				   SNDRV_PCM_INFO_MMAP_VALID |
-				   SNDRV_PCM_INFO_BLOCK_TRANSFER,
-#else
-static const struct snd_pcm_hardware bf5xx_pcm_hardware = {
-	.info			= SNDRV_PCM_INFO_INTERLEAVED |
-				  SNDRV_PCM_INFO_BLOCK_TRANSFER,
 #endif
+				   SNDRV_PCM_INFO_BLOCK_TRANSFER,
+
 	.formats		= SNDRV_PCM_FMTBIT_S16_LE,
 	.period_bytes_min	= 32,
 	.period_bytes_max	= 0x10000,
Signature · 1 line
1.5.6.3
author
#11 lore raw

PATCH 8/8 ASoC: Blackfin: always set a default value for that GPIO range

In reply to Bryan Wu

From: Mike Frysinger <[email protected]>

---
 sound/soc/blackfin/Kconfig |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
sound/soc/blackfin/Kconfig +1 -0
index f0fd235..e162cbb 100644
@@ -104,5 +104,6 @@ config SND_BF5XX_RESET_GPIO_NUM
 	range 0 159
 	default 19 if BFIN548_EZKIT
 	default 5 if BFIN537_STAMP
+	default 0
 	help
 	  Set the correct GPIO for RESET the sound chip.
Signature · 1 line
1.5.6.3
#12 lore raw

Re: [alsa-devel] (no subject)

In reply to Bryan Wu

On Tue, Nov 18, 2008 at 04:18:14PM +0800, Bryan Wu wrote:

...nothing. :)

All patches look OK, a couple of comments to follow.