Skip to contentSkip to conversation

ASoC: DaVinci: i2s, reduce underruns by combining into 1 element

PATCH In review Troy Kisky 8 participants 33 messages Aug 31, 2009 – Oct 1, 2009 10 messages not in the archive

Subsystems (5)
lore
Share & tools
lore

Troy Kisky

author
#0 lore raw

PATCH 1/3 ASoC: DaVinci: i2s, reduce underruns by combining into 1 element

Allow the left and right 16 bit samples to be shifted out as 1 32 bit sample.

--
This applies to Kevin's temp/asoc branch

---
 arch/arm/mach-davinci/include/mach/asp.h |    6 ++
 sound/soc/davinci/davinci-i2s.c          |   74 ++++++++++++++++++++++--------
 2 files changed, 61 insertions(+), 19 deletions(-)
arch/arm/mach-davinci/include/mach/asp.h +6 -0
index 18e4ce3..a3d2aa1 100644
@@ -51,6 +51,12 @@ struct snd_platform_data {
 	u32 rx_dma_offset;
 	enum dma_event_q eventq_no;	/* event queue number */
 	unsigned int codec_fmt;
+	/*
+	 * Allowing this is more efficient and eliminates left and right swaps
+	 * caused by underruns, but will swap the left and right channels
+	 * when compared to previous behavior.
+	 */
+	unsigned disable_channel_combine:1;
 
 	/* McASP specific fields */
 	int tdm_slots;
sound/soc/davinci/davinci-i2s.c +55 -19

107 lines not on this page · raw message

Signature · 1 line
1.5.6.3
author
#1 lore raw

PATCH 2/3 ASoC: DaVinci: pcm, rename variables in prep for ping/pong

Rename variable master_lch to asp_master_lch
Rename variable slave_lch to asp_link_lch[0]
Rename local variables:
count to asp_count
src to asp_src
dst to asp_dst

---
 sound/soc/davinci/davinci-pcm.c |   48 +++++++++++++++++++-------------------
 1 files changed, 24 insertions(+), 24 deletions(-)
sound/soc/davinci/davinci-pcm.c +24 -24
index 2f7da49..a96655c 100644
@@ -51,8 +51,8 @@ static struct snd_pcm_hardware davinci_pcm_hardware = {
 struct davinci_runtime_data {
 	spinlock_t lock;
 	int period;		/* current DMA period */
-	int master_lch;		/* Master DMA channel */
-	int slave_lch;		/* linked parameter RAM reload slot */
+	int asp_master_lch;	/* Master DMA channel */
+	int asp_link_lch[2];	/* asp parameter link channel, ping/pong */
 	struct davinci_pcm_dma_params *params;	/* DMA params */
 };
 
@@ -60,7 +60,7 @@ static void davinci_pcm_enqueue_dma(struct snd_pcm_substream *substream)
 {
 	struct davinci_runtime_data *prtd = substream->runtime->private_data;
 	struct snd_pcm_runtime *runtime = substream->runtime;
-	int lch = prtd->slave_lch;
+	int lch = prtd->asp_link_lch[0];
 	unsigned int period_size;
 	unsigned int dma_offset;
 	dma_addr_t dma_pos;
@@ -142,15 +142,15 @@ static int davinci_pcm_dma_request(struct snd_pcm_substream *substream)
 				  EVENTQ_0);
 	if (ret < 0)
 		return ret;
-	prtd->master_lch = ret;
+	prtd->asp_master_lch = ret;
 
 	/* Request parameter RAM reload slot */
-	ret = edma_alloc_slot(EDMA_CTLR(prtd->master_lch), EDMA_SLOT_ANY);
+	ret = edma_alloc_slot(EDMA_CTLR(prtd->asp_master_lch), EDMA_SLOT_ANY);
 	if (ret < 0) {
-		edma_free_channel(prtd->master_lch);
+		edma_free_channel(prtd->asp_master_lch);
 		return ret;
 	}
-	prtd->slave_lch = ret;
+	prtd->asp_link_lch[0] = ret;
 
 	/* Issue transfer completion IRQ when the channel completes a
 	 * transfer, then always reload from the same slot (by a kind
@@ -161,10 +161,10 @@ static int davinci_pcm_dma_request(struct snd_pcm_substream *substream)
 	 * the buffer and its length (ccnt) ... use it as a template
 	 * so davinci_pcm_enqueue_dma() takes less time in IRQ.
 	 */
-	edma_read_slot(prtd->slave_lch, &p_ram);
-	p_ram.opt |= TCINTEN | EDMA_TCC(EDMA_CHAN_SLOT(prtd->master_lch));
-	p_ram.link_bcntrld = EDMA_CHAN_SLOT(prtd->slave_lch) << 5;
-	edma_write_slot(prtd->slave_lch, &p_ram);
+	edma_read_slot(prtd->asp_link_lch[0], &p_ram);
+	p_ram.opt |= TCINTEN | EDMA_TCC(EDMA_CHAN_SLOT(prtd->asp_master_lch));
+	p_ram.link_bcntrld = EDMA_CHAN_SLOT(prtd->asp_link_lch[0]) << 5;
+	edma_write_slot(prtd->asp_link_lch[0], &p_ram);
 
 	return 0;
 }
@@ -180,12 +180,12 @@ static int davinci_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
 	case SNDRV_PCM_TRIGGER_START:
 	case SNDRV_PCM_TRIGGER_RESUME:
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
-		edma_start(prtd->master_lch);
+		edma_start(prtd->asp_master_lch);
 		break;
 	case SNDRV_PCM_TRIGGER_STOP:
 	case SNDRV_PCM_TRIGGER_SUSPEND:
 	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
-		edma_stop(prtd->master_lch);
+		edma_stop(prtd->asp_master_lch);
 		break;
 	default:
 		ret = -EINVAL;
@@ -206,8 +206,8 @@ static int davinci_pcm_prepare(struct snd_pcm_substream *substream)
 	davinci_pcm_enqueue_dma(substream);
 
 	/* Copy self-linked parameter RAM entry into master channel */
-	edma_read_slot(prtd->slave_lch, &temp);
-	edma_write_slot(prtd->master_lch, &temp);
+	edma_read_slot(prtd->asp_link_lch[0], &temp);
+	edma_write_slot(prtd->asp_master_lch, &temp);
 	davinci_pcm_enqueue_dma(substream);
 
 	return 0;
@@ -219,20 +219,20 @@ davinci_pcm_pointer(struct snd_pcm_substream *substream)
 	struct snd_pcm_runtime *runtime = substream->runtime;
 	struct davinci_runtime_data *prtd = runtime->private_data;
 	unsigned int offset;
-	dma_addr_t count;
-	dma_addr_t src, dst;
+	int asp_count;
+	dma_addr_t asp_src, asp_dst;
 
 	spin_lock(&prtd->lock);
 
-	edma_get_position(prtd->master_lch, &src, &dst);
+	edma_get_position(prtd->asp_master_lch, &asp_src, &asp_dst);
 	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
-		count = src - runtime->dma_addr;
+		asp_count = asp_src - runtime->dma_addr;
 	else
-		count = dst - runtime->dma_addr;
+		asp_count = asp_dst - runtime->dma_addr;
 
 	spin_unlock(&prtd->lock);
 
-	offset = bytes_to_frames(runtime, count);
+	offset = bytes_to_frames(runtime, asp_count);
 	if (offset >= runtime->buffer_size)
 		offset = 0;
 
@@ -274,10 +274,10 @@ static int davinci_pcm_close(struct snd_pcm_substream *substream)
 	struct snd_pcm_runtime *runtime = substream->runtime;
 	struct davinci_runtime_data *prtd = runtime->private_data;
 
-	edma_unlink(prtd->slave_lch);
+	edma_unlink(prtd->asp_link_lch[0]);
 
-	edma_free_slot(prtd->slave_lch);
-	edma_free_channel(prtd->master_lch);
+	edma_free_slot(prtd->asp_link_lch[0]);
+	edma_free_channel(prtd->asp_master_lch);
 
 	kfree(prtd);
 
Signature · 1 line
1.5.6.3
author
#2 lore raw

PATCH 3/3 ASoC: DaVinci: pcm, fix underrun by using sram

Fix underruns by using dma to copy 1st to sram in a ping/pong buffer style and then copying from the sram to the ASP. This also has the advantage of tolerating very long interrupt latency on dma completion.

---
 arch/arm/mach-davinci/include/mach/asp.h |    2 +
 sound/soc/davinci/davinci-i2s.c          |    5 +-
 sound/soc/davinci/davinci-pcm.c          |  513 +++++++++++++++++++++++++++---
 sound/soc/davinci/davinci-pcm.h          |    1 +
 4 files changed, 474 insertions(+), 47 deletions(-)
arch/arm/mach-davinci/include/mach/asp.h +2 -0
index a3d2aa1..f0f3b27 100644
@@ -57,6 +57,8 @@ struct snd_platform_data {
 	 * when compared to previous behavior.
 	 */
 	unsigned disable_channel_combine:1;
+	unsigned sram_size_playback;
+	unsigned sram_size_capture;
 
 	/* McASP specific fields */
 	int tdm_slots;
sound/soc/davinci/davinci-i2s.c +4 -1
index 081b2d4..863313f 100644
@@ -559,8 +559,11 @@ static int davinci_i2s_probe(struct platform_device *pdev)
 		ret = -ENOMEM;
 		goto err_release_region;
 	}
-	if (pdata)
+	if (pdata) {
 		dev->disable_channel_combine = pdata->disable_channel_combine;
+		davinci_i2s_pcm_out.sram_size = pdata->sram_size_playback;
+		davinci_i2s_pcm_in.sram_size = pdata->sram_size_capture;
+	}
 	dev->clk = clk_get(&pdev->dev, NULL);
 	if (IS_ERR(dev->clk)) {
 		ret = -ENODEV;
sound/soc/davinci/davinci-pcm.c +467 -46

660 lines not on this page · raw message

sound/soc/davinci/davinci-pcm.h +1 -0
index 63d9625..7caba3c 100644
@@ -21,6 +21,7 @@ struct davinci_pcm_dma_params {
 	int channel;			/* sync dma channel ID */
 	unsigned short acnt;
 	dma_addr_t dma_addr;		/* device physical address for DMA */
+	unsigned sram_size;
 	enum dma_event_q eventq_no;	/* event queue number */
 	unsigned char data_type;	/* xfer data type */
 	unsigned char convert_mono_stereo;
Signature · 1 line
1.5.6.3
#3 lore raw

Re: [PATCH 2/3] ASoC: DaVinci: pcm, rename variables in prep for ping/pong

In reply to Troy Kisky
Quoted 6 lines · Troy Kisky

Rename variable master_lch to asp_master_lch
Rename variable slave_lch to asp_link_lch[0]
Rename local variables:
count to asp_count
src to asp_src
dst to asp_dst

These other two patches are OK but I'll wait for after the merge window to apply them partly due to the dependency on the merged tree and also since it's very near to the merge window opening and there's already been a fair bit of churn and testing with the DaVinci drivers for 2.6.32.

I'll probably also apply the first patch since nobody else seems to care one way or another, but I would urge you to look at changing the default for the platform data to at most select the workaround only on CPUs that have problems with channel swapping - it's going to cause confusion for people to have it on by default.

author
#4 lore raw

Re: [PATCH 2/3] ASoC: DaVinci: pcm, rename variables in prep for ping/pong

Quoted 14 lines · Mark Brown
Quoted 6 lines · Troy Kisky

Rename variable master_lch to asp_master_lch
Rename variable slave_lch to asp_link_lch[0]
Rename local variables:
count to asp_count
src to asp_src
dst to asp_dst

These other two patches are OK but I'll wait for after the merge window to apply them partly due to the dependency on the merged tree and also since it's very near to the merge window opening and there's already been a fair bit of churn and testing with the DaVinci drivers for 2.6.32.

Quoted 6 lines

I'll probably also apply the first patch since nobody else seems to care one way or another, but I would urge you to look at changing the default for the platform data to at most select the workaround only on CPUs that have problems with channel swapping - it's going to cause confusion for people to have it on by default.

I think the ones without a problem use davinci-mcasp instead of davinci-i2s but share davinci-pcm. So, I don't know of any machines to exclude in davinci-i2s. But if someone else knows, speak up.

Thanks
Troy

#5 lore raw

Re: [PATCH 2/3] ASoC: DaVinci: pcm, rename variables in prep for ping/pong

Quoted 9 lines · Troy Kisky
Quoted 3 lines · Mark Brown

for the platform data to at most select the workaround only on CPUs that have problems with channel swapping - it's going to cause confusion for people to have it on by default.

I think the ones without a problem use davinci-mcasp instead of davinci-i2s but share davinci-pcm. So, I don't know of any machines to exclude in davinci-i2s. But if someone else knows, speak up.

Oh, right. That wasn't clear from what you were saying about newer chips not being affected - if the fix was top drop the original IP block in favour of the McASP that's OK.

A message that is not in the archive (sent off-list or not yet received): 4A9F0A8C.1040509-Q5RJGjKts06CY9SHAMCTRUEOCMrvLtNR@public.gmane.org

#7 lore raw

RE: [alsa-devel] [PATCH 2/3] ASoC: DaVinci: pcm, rename variables in prep for ping/pong

Quoted 2 lines · Troy Kisky
Quoted 1 line · Mark Brown

On Mon, Aug 31, 2009 at 04:31:44PM -0700, Troy Kisky wrote:

[...]

Quoted 11 lines
Quoted 7 lines

I'll probably also apply the first patch since nobody else seems to care one way or another, but I would urge you to look at changing the default for the platform data to at most select the workaround only on CPUs that have problems with channel swapping - it's going to cause confusion for people to have it on by default.

I think the ones without a problem use davinci-mcasp instead of davinci-i2s but share davinci-pcm. So, I don't know of any machines to exclude in davinci-i2s. But if someone else knows, speak up.

In my experience too, the channel swap issues got reported only with ASP (aka McBSP) and not with McASP.

The swap was almost always at the start of playback, and supposedly because of the errata "2.1.5 ASP: Initialization Procedure When External Device is Frame-Sync Master" in http://focus.ti.com/lit/er/sprz241l/sprz241l.pdf

Using EDMA acount=4 instead of 2 (32-bit transfers) did fix that issue on the OSS drivers but I don't recall the problem morphing into an "always channel swapped" case.

Have you tested your patch (1/3) with DM644x EVM? If not, we can do that and see if it leads to channels being always swapped on that hardware as well.

One feedback we have received on this solution is that it does not work for 24-bit audio. In which case, implementing the workaround described in the errata is the only way around.

Thanks,
Sekhar

author
#8 lore raw

Re: [PATCH 2/3] ASoC: DaVinci: pcm, rename variables in prep for ping/pong

Quoted 15 lines · Sekhar
Quoted 2 lines · Troy Kisky
Quoted 1 line · Mark Brown

On Mon, Aug 31, 2009 at 04:31:44PM -0700, Troy Kisky wrote:

[...]

Quoted 10 lines
Quoted 6 lines

I'll probably also apply the first patch since nobody else seems to care one way or another, but I would urge you to look at changing the default for the platform data to at most select the workaround only on CPUs that have problems with channel swapping - it's going to cause confusion for people to have it on by default.

I think the ones without a problem use davinci-mcasp instead of davinci-i2s but share davinci-pcm. So, I don't know of any machines to exclude in davinci-i2s. But if someone else knows, speak up.

Quoted 6 lines

In my experience too, the channel swap issues got reported only with ASP (aka McBSP) and not with McASP.

The swap was almost always at the start of playback, and supposedly because of the errata "2.1.5 ASP: Initialization Procedure When External Device is Frame-Sync Master" in http://focus.ti.com/lit/er/sprz241l/sprz241l.pdf

This should have been fixed when I added

davinci_i2s_prepare because it will call davinci_mcbsp_start if the codec is master, giving plenty of time for the first dma to be serviced.

So, all that ugly code in davinci_mcbsp_start to "/* wait for any unexpected frame sync error to occur */" can probably be removed. But since I didn't know the reason for it, I haven't tried. If you can give this a try I'd like to know the results.

Quoted 7 lines

Using EDMA acount=4 instead of 2 (32-bit transfers) did fix that issue on the OSS drivers but I don't recall the problem morphing into an "always channel swapped" case.

Have you tested your patch (1/3) with DM644x EVM? If not, we can do that and see if it leads to channels being always swapped on that hardware as well.

Yes, I have tested with dm644x, not evm. I haven't tried to hear the channel swap, but I have no doubt that it is.

Quoted 4 lines

One feedback we have received on this solution is that it does not work for 24-bit audio. In which case, implementing the workaround described in the errata is the only way around.

Yes, you cannot shift more than 32 bits at once, so 48 bits is out. Although 24 bit format would be easy to add, currently only 8, 16, and 32 are supported by davinci-i2s.

Quoted 5 lines

Thanks,
Sekhar

A message that is not in the archive (sent off-list or not yet received): 4AA0113D.9030605-Q5RJGjKts06CY9SHAMCTRUEOCMrvLtNR@public.gmane.org

#10 lore raw

RE: [alsa-devel] [PATCH 2/3] ASoC: DaVinci: pcm, rename variables in prep for ping/pong

Quoted 15 lines · Troy Kisky
Quoted 14 lines · Sekhar
Quoted 2 lines · Troy Kisky
Quoted 1 line · Mark Brown

On Mon, Aug 31, 2009 at 04:31:44PM -0700, Troy Kisky wrote:

[...]

Quoted 10 lines
Quoted 6 lines

I'll probably also apply the first patch since nobody else seems to care one way or another, but I would urge you to look at changing the default for the platform data to at most select the workaround only on CPUs that have problems with channel swapping - it's going to cause confusion for people to have it on by default.

I think the ones without a problem use davinci-mcasp instead of davinci-i2s but share davinci-pcm. So, I don't know of any machines to exclude in davinci-i2s. But if someone else knows, speak up.

[...]

Quoted 11 lines
Quoted 8 lines

Using EDMA acount=4 instead of 2 (32-bit transfers) did fix that issue on the OSS drivers but I don't recall the problem morphing into an "always channel swapped" case.

Have you tested your patch (1/3) with DM644x EVM? If not, we can do that and see if it leads to channels being always swapped on that hardware as well.

Yes, I have tested with dm644x, not evm. I haven't tried to hear the channel swap, but I have no doubt that it is.

I finally got around to testing your patch 1/3 on DM6446 EVM.

Without your patch, channel swap is quite easy to reproduce using audio loopback:

arecord -fcd | aplay -fcd

The audio source is a PC which speaker balance set to an extreme. By starting and stopping this command repeatedly, you can see the audio moving from one channel to the other.

Applying your patch fixes this issue.

Also, I did not notice any permanent channel swap. Used aplay to play data which was first left-only and then right-only. Plays the same way on a Linux PC.

I will test on couple of other platform using davinci-i2s (DM355 etc) before acking the patch.

However, with or without your patch, I noticed a segmentation fault for the first time the 'arecord | aplay' loop is created. There is no fault the second time around. I haven't spent time debugging this yet.

root@arago:~# arecord -fcd | aplay -fcd
Recording WAVE 'stdin' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Division by zero in kernel.
Backtrace:
[<c002b784>] (dump_backtrace+0x0/0x114) from [<c0248cf0>] (dump_stack+0x18/0x1c)
 r7:86a60000 r6:c77cdae0 r5:00000040 r4:00000000
[<c0248cd8>] (dump_stack+0x0/0x1c) from [<c002b8cc>] (__div0+0x18/0x20)
[<c002b8b4>] (__div0+0x0/0x20) from [<c014b0fc>] (Ldiv0+0x8/0x10)
[<c01bad64>] (davinci_pcm_enqueue_dma+0x0/0x110) from [<c01baea0>] (davinci_pcm_
prepare+0x2c/0x58)
[<c01bae74>] (davinci_pcm_prepare+0x0/0x58) from [<c01b5260>] (soc_pcm_prepare+0
x84/0x184)
 r7:c030df38 r6:c030d1b8 r5:c70d3900 r4:00000000
[<c01b51dc>] (soc_pcm_prepare+0x0/0x184) from [<c01aac3c>] (snd_pcm_do_prepare+0
x1c/0x34)
[<c01aac20>] (snd_pcm_do_prepare+0x0/0x34) from [<c01aa87c>] (snd_pcm_action_sin
gle+0x40/0x7c)
 r5:c70d3900 r4:c030cbc8
[<c01aa83c>] (snd_pcm_action_single+0x0/0x7c) from [<c01abd80>] (snd_pcm_action_
nonatomic+0x58/0x70)
 r7:c70d3900 r6:00000002 r5:c030cbc8 r4:c70d3900
[<c01abd28>] (snd_pcm_action_nonatomic+0x0/0x70) from [<c01ae2cc>] (snd_pcm_comm
on_ioctl1+0x814/0x1308)
 r7:c70d3900 r6:0002a690 r5:0002a690 r4:c77b6c80
[<c01adab8>] (snd_pcm_common_ioctl1+0x0/0x1308) from [<c01af20c>] (snd_pcm_captu
re_ioctl1+0x44c/0x470)
[<c01aedc0>] (snd_pcm_capture_ioctl1+0x0/0x470) from [<c01af268>] (snd_pcm_captu
re_ioctl+0x38/0x3c)
 r7:c77b6c80 r6:00004140 r5:0002a690 r4:c77b6c80
[<c01af230>] (snd_pcm_capture_ioctl+0x0/0x3c) from [<c00a2680>] (vfs_ioctl+0x34/
0x94)
[<c00a264c>] (vfs_ioctl+0x0/0x94) from [<c00a2d44>] (do_vfs_ioctl+0x56c/0x5c8)
 r7:c77b6c80 r6:00000004 r5:c77b6c80 r4:c6b8c8a8
[<c00a27d8>] (do_vfs_ioctl+0x0/0x5c8) from [<c00a2de0>] (sys_ioctl+0x40/0x64)
[<c00a2da0>] (sys_ioctl+0x0/0x64) from [<c0027ea0>] (ret_fast_syscall+0x0/0x2c)
 r7:00000036 r6:bec987d8 r5:0002a468 r4:000b567f
Division by zero in kernel.
Backtrace:
[<c002b784>] (dump_backtrace+0x0/0x114) from [<c0248cf0>] (dump_stack+0x18/0x1c)
 r7:86a62000 r6:c77cdae0 r5:00000040 r4:00000000
[<c0248cd8>] (dump_stack+0x0/0x1c) from [<c002b8cc>] (__div0+0x18/0x20)
[<c002b8b4>] (__div0+0x0/0x20) from [<c014b0fc>] (Ldiv0+0x8/0x10)
[<c01bad64>] (davinci_pcm_enqueue_dma+0x0/0x110) from [<c01baec0>] (davinci_pcm_
prepare+0x4c/0x58)
[<c01bae74>] (davinci_pcm_prepare+0x0/0x58) from [<c01b5260>] (soc_pcm_prepare+0
x84/0x184)
 r7:c030df38 r6:c030d1b8 r5:c70d3900 r4:00000000
[<c01b51dc>] (soc_pcm_prepare+0x0/0x184) from [<c01aac3c>] (snd_pcm_do_prepare+0
x1c/0x34)
[<c01aac20>] (snd_pcm_do_prepare+0x0/0x34) from [<c01aa87c>] (snd_pcm_action_sin
gle+0x40/0x7c)
 r5:c70d3900 r4:c030cbc8
[<c01aa83c>] (snd_pcm_action_single+0x0/0x7c) from [<c01abd80>] (snd_pcm_action_
nonatomic+0x58/0x70)
 r7:c70d3900 r6:00000002 r5:c030cbc8 r4:c70d3900
[<c01abd28>] (snd_pcm_action_nonatomic+0x0/0x70) from [<c01ae2cc>] (snd_pcm_comm
on_ioctl1+0x814/0x1308)
 r7:c70d3900 r6:0002a690 r5:0002a690 r4:c77b6c80
[<c01adab8>] (snd_pcm_common_ioctl1+0x0/0x1308) from [<c01af20c>] (snd_pcm_captu
re_ioctl1+0x44c/0x470)
[<c01aedc0>] (snd_pcm_capture_ioctl1+0x0/0x470) from [<c01af268>] (snd_pcm_captu
re_ioctl+0x38/0x3c)
 r7:c77b6c80 r6:00004140 r5:0002a690 r4:c77b6c80
[<c01af230>] (snd_pcm_capture_ioctl+0x0/0x3c) from [<c00a2680>] (vfs_ioctl+0x34/
0x94)
[<c00a264c>] (vfs_ioctl+0x0/0x94) from [<c00a2d44>] (do_vfs_ioctl+0x56c/0x5c8)
 r7:c77b6c80 r6:00000004 r5:c77b6c80 r4:c6b8c8a8
[<c00a27d8>] (do_vfs_ioctl+0x0/0x5c8) from [<c00a2de0>] (sys_ioctl+0x40/0x64)
[<c00a2da0>] (sys_ioctl+0x0/0x64) from [<c0027ea0>] (ret_fast_syscall+0x0/0x2c)
 r7:00000036 r6:bec987d8 r5:0002a468 r4:000b567f
Division by zero in kernel.
Playing WAVE 'stBacktrace: din' : Signed 16
 bit Little Endi[<c002b784>] an, Rate 44100 H(dump_backtrace+0x0/0x114) z, Stere
o
from [<c0248cf0>] (dump_stack+0x18/0x1c)
 r7:86a64000 r6:c77cdae0 r5:00000040 r4:00000000
[<c0248cd8>] (dump_stack+0x0/0x1c) from [<c002b8cc>] (__div0+0x18/0x20)
[<c002b8b4>] (__div0+0x0/0x20) from [<c014b0fc>] (Ldiv0+0x8/0x10)
[<c01bad64>] (davinci_pcm_enqueue_dma+0x0/0x110) from [<c01bb0bc>] (davinci_pcm_
dma_irq+0x58/0x80)
[<c01bb064>] (davinci_pcm_dma_irq+0x0/0x80) from [<c0031904>] (dma_irq_handler+0
xec/0x12c)
 r5:00000003 r4:00000004
[<c0031818>] (dma_irq_handler+0x0/0x12c) from [<c0068ee8>] (handle_IRQ_event+0x4
4/0x114)
[<c0068ea4>] (handle_IRQ_event+0x0/0x114) from [<c006ab74>] (handle_edge_irq+0x1
48/0x1b4)
 r7:c7007440 r6:00000010 r5:c02ff060 r4:c6baa000
[<c006aa2c>] (handle_edge_irq+0x0/0x1b4) from [<c0027070>] (_text+0x70/0x8c)
 r7:00000002 r6:00000800 r5:00000000 r4:00000010
[<c0027000>] (_text+0x0/0x8c) from [<c0027aac>] (__irq_svc+0x4c/0x90)
Exception stack(0xc6babdf0 to 0xc6babe38)
bde0:                                     00000001 00000000 c6baa000 40000013
be00: 00000800 c76f2800 00000800 c70d3900 00000000 00000800 00000000 c6babe8c
be20: c6baa000 c6babe38 c01b16f4 c01b1714 40000013 ffffffff
 r5:fec48000 r4:ffffffff
[<c01b1548>] (snd_pcm_lib_read1+0x0/0x30c) from [<c01b1934>] (snd_pcm_lib_read+0
x60/0x6c)
[<c01b18d4>] (snd_pcm_lib_read+0x0/0x6c) from [<c01aee8c>] (snd_pcm_capture_ioct
l1+0xcc/0x470)
 r6:bec98ab4 r5:bec98ab4 r4:00000000
[<c01aedc0>] (snd_pcm_capture_ioctl1+0x0/0x470) from [<c01af268>] (snd_pcm_captu
re_ioctl+0x38/0x3c)
 r7:c77b6c80 r6:800c4151 r5:bec98ab4 r4:c77b6c80
[<c01af230>] (snd_pcm_capture_ioctl+0x0/0x3c) from [<c00a2680>] (vfs_ioctl+0x34/
0x94)
[<c00a264c>] (vfs_ioctl+0x0/0x94) from [<c00a2d44>] (do_vfs_ioctl+0x56c/0x5c8)
 r7:c77b6c80 r6:00000004 r5:c77b6c80 r4:c6b8c8a8
[<c00a27d8>] (do_vfs_ioctl+0x0/0x5c8) from [<c00a2de0>] (sys_ioctl+0x40/0x64)
[<c00a2da0>] (sys_ioctl+0x0/0x64) from [<c0027ea0>] (ret_fast_syscall+0x0/0x2c)
 r7:00000036 r6:00000000 r5:0002a4b8 r4:0002a468
arecord: pcm_read:1529: read error: Input/output error
root@arago:~#

Thanks,
Sekhar

Quoted 18 lines
Quoted 5 lines

One feedback we have received on this solution is that it does not work for 24-bit audio. In which case, implementing the workaround described in the errata is the only way around.

Yes, you cannot shift more than 32 bits at once, so 48 bits is out. Although 24 bit format would be easy to add, currently only 8, 16, and 32 are supported by davinci-i2s.

Quoted 5 lines

Thanks,
Sekhar

A message that is not in the archive (sent off-list or not yet received): B85A65D85D7EB246BE421B3FB0FBB59301DD74F519-/tLxBxkBPtCIQmiDNMet8wC/[email protected]

#12 lore raw

Re: [alsa-devel] [PATCH 2/3] ASoC: DaVinci: pcm, rename variables in prep for ping/pong

Quoted 48 lines · Sekhar
Quoted 16 lines · Troy Kisky
Quoted 15 lines · Sekhar
Quoted 2 lines · Troy Kisky
Quoted 1 line · Mark Brown

On Mon, Aug 31, 2009 at 04:31:44PM -0700, Troy Kisky wrote:

[...]

Quoted 9 lines
Quoted 5 lines

I'll probably also apply the first patch since nobody else seems to care one way or another, but I would urge you to look at changing the default for the platform data to at most select the workaround only on CPUs that have problems with channel swapping - it's going to cause confusion for people to have it on by default.

I think the ones without a problem use davinci-mcasp instead of davinci-i2s but share davinci-pcm. So, I don't know of any machines to exclude in davinci-i2s. But if someone else knows, speak up.

[...]

Quoted 10 lines
Quoted 7 lines

Using EDMA acount=4 instead of 2 (32-bit transfers) did fix that issue on the OSS drivers but I don't recall the problem morphing into an "always channel swapped" case.

Have you tested your patch (1/3) with DM644x EVM? If not, we can do that and see if it leads to channels being always swapped on that hardware as well.

Yes, I have tested with dm644x, not evm. I haven't tried to hear the channel swap, but I have no doubt that it is.

I finally got around to testing your patch 1/3 on DM6446 EVM.

Without your patch, channel swap is quite easy to reproduce using audio loopback:

arecord -fcd | aplay -fcd

The audio source is a PC which speaker balance set to an extreme. By starting and stopping this command repeatedly, you can see the audio moving from one channel to the other.

Applying your patch fixes this issue.

Also, I did not notice any permanent channel swap. Used aplay to play data which was first left-only and then right-only. Plays the same way on a Linux PC.

Quoted 7 lines

I will test on couple of other platform using davinci-i2s (DM355 etc) before acking the patch.

However, with or without your patch, I noticed a segmentation fault for the first time the 'arecord | aplay' loop is created. There is no fault the second time around. I haven't spent time debugging this yet.

This is due to these lines in davinci_pcm_enqueue_dma:

	data_type = prtd->params->data_type;	
	count = period_size / data_type;

First time running data_type is set to 0. This is a long time issue, I remember modifying my kernels to check for zero before this division..

Regards,
Caglar

Quoted 133 lines
root@arago:~# arecord -fcd | aplay -fcd
Recording WAVE 'stdin' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Division by zero in kernel.
Backtrace:
[<c002b784>] (dump_backtrace+0x0/0x114) from [<c0248cf0>]
(dump_stack+0x18/0x1c) r7:86a60000 r6:c77cdae0 r5:00000040 r4:00000000
[<c0248cd8>] (dump_stack+0x0/0x1c) from [<c002b8cc>] (__div0+0x18/0x20)
[<c002b8b4>] (__div0+0x0/0x20) from [<c014b0fc>] (Ldiv0+0x8/0x10)
[<c01bad64>] (davinci_pcm_enqueue_dma+0x0/0x110) from [<c01baea0>]
(davinci_pcm_ prepare+0x2c/0x58)
[<c01bae74>] (davinci_pcm_prepare+0x0/0x58) from [<c01b5260>]
(soc_pcm_prepare+0 x84/0x184)
 r7:c030df38 r6:c030d1b8 r5:c70d3900 r4:00000000
[<c01b51dc>] (soc_pcm_prepare+0x0/0x184) from [<c01aac3c>]
(snd_pcm_do_prepare+0 x1c/0x34)
[<c01aac20>] (snd_pcm_do_prepare+0x0/0x34) from [<c01aa87c>]
(snd_pcm_action_sin gle+0x40/0x7c)
 r5:c70d3900 r4:c030cbc8
[<c01aa83c>] (snd_pcm_action_single+0x0/0x7c) from [<c01abd80>]
(snd_pcm_action_ nonatomic+0x58/0x70)
 r7:c70d3900 r6:00000002 r5:c030cbc8 r4:c70d3900
[<c01abd28>] (snd_pcm_action_nonatomic+0x0/0x70) from [<c01ae2cc>]
(snd_pcm_comm on_ioctl1+0x814/0x1308)
 r7:c70d3900 r6:0002a690 r5:0002a690 r4:c77b6c80
[<c01adab8>] (snd_pcm_common_ioctl1+0x0/0x1308) from [<c01af20c>]
(snd_pcm_captu re_ioctl1+0x44c/0x470)
[<c01aedc0>] (snd_pcm_capture_ioctl1+0x0/0x470) from [<c01af268>]
(snd_pcm_captu re_ioctl+0x38/0x3c)
 r7:c77b6c80 r6:00004140 r5:0002a690 r4:c77b6c80
[<c01af230>] (snd_pcm_capture_ioctl+0x0/0x3c) from [<c00a2680>]
(vfs_ioctl+0x34/ 0x94)
[<c00a264c>] (vfs_ioctl+0x0/0x94) from [<c00a2d44>]
(do_vfs_ioctl+0x56c/0x5c8) r7:c77b6c80 r6:00000004 r5:c77b6c80 r4:c6b8c8a8
[<c00a27d8>] (do_vfs_ioctl+0x0/0x5c8) from [<c00a2de0>]
(sys_ioctl+0x40/0x64) [<c00a2da0>] (sys_ioctl+0x0/0x64) from [<c0027ea0>]
(ret_fast_syscall+0x0/0x2c) r7:00000036 r6:bec987d8 r5:0002a468 r4:000b567f
Division by zero in kernel.
Backtrace:
[<c002b784>] (dump_backtrace+0x0/0x114) from [<c0248cf0>]
(dump_stack+0x18/0x1c) r7:86a62000 r6:c77cdae0 r5:00000040 r4:00000000
[<c0248cd8>] (dump_stack+0x0/0x1c) from [<c002b8cc>] (__div0+0x18/0x20)
[<c002b8b4>] (__div0+0x0/0x20) from [<c014b0fc>] (Ldiv0+0x8/0x10)
[<c01bad64>] (davinci_pcm_enqueue_dma+0x0/0x110) from [<c01baec0>]
(davinci_pcm_ prepare+0x4c/0x58)
[<c01bae74>] (davinci_pcm_prepare+0x0/0x58) from [<c01b5260>]
(soc_pcm_prepare+0 x84/0x184)
 r7:c030df38 r6:c030d1b8 r5:c70d3900 r4:00000000
[<c01b51dc>] (soc_pcm_prepare+0x0/0x184) from [<c01aac3c>]
(snd_pcm_do_prepare+0 x1c/0x34)
[<c01aac20>] (snd_pcm_do_prepare+0x0/0x34) from [<c01aa87c>]
(snd_pcm_action_sin gle+0x40/0x7c)
 r5:c70d3900 r4:c030cbc8
[<c01aa83c>] (snd_pcm_action_single+0x0/0x7c) from [<c01abd80>]
(snd_pcm_action_ nonatomic+0x58/0x70)
 r7:c70d3900 r6:00000002 r5:c030cbc8 r4:c70d3900
[<c01abd28>] (snd_pcm_action_nonatomic+0x0/0x70) from [<c01ae2cc>]
(snd_pcm_comm on_ioctl1+0x814/0x1308)
 r7:c70d3900 r6:0002a690 r5:0002a690 r4:c77b6c80
[<c01adab8>] (snd_pcm_common_ioctl1+0x0/0x1308) from [<c01af20c>]
(snd_pcm_captu re_ioctl1+0x44c/0x470)
[<c01aedc0>] (snd_pcm_capture_ioctl1+0x0/0x470) from [<c01af268>]
(snd_pcm_captu re_ioctl+0x38/0x3c)
 r7:c77b6c80 r6:00004140 r5:0002a690 r4:c77b6c80
[<c01af230>] (snd_pcm_capture_ioctl+0x0/0x3c) from [<c00a2680>]
(vfs_ioctl+0x34/ 0x94)
[<c00a264c>] (vfs_ioctl+0x0/0x94) from [<c00a2d44>]
(do_vfs_ioctl+0x56c/0x5c8) r7:c77b6c80 r6:00000004 r5:c77b6c80 r4:c6b8c8a8
[<c00a27d8>] (do_vfs_ioctl+0x0/0x5c8) from [<c00a2de0>]
(sys_ioctl+0x40/0x64) [<c00a2da0>] (sys_ioctl+0x0/0x64) from [<c0027ea0>]
(ret_fast_syscall+0x0/0x2c) r7:00000036 r6:bec987d8 r5:0002a468 r4:000b567f
Division by zero in kernel.
Playing WAVE 'stBacktrace: din' : Signed 16
 bit Little Endi[<c002b784>] an, Rate 44100 H(dump_backtrace+0x0/0x114) z,
Stere o
from [<c0248cf0>] (dump_stack+0x18/0x1c)
 r7:86a64000 r6:c77cdae0 r5:00000040 r4:00000000
[<c0248cd8>] (dump_stack+0x0/0x1c) from [<c002b8cc>] (__div0+0x18/0x20)
[<c002b8b4>] (__div0+0x0/0x20) from [<c014b0fc>] (Ldiv0+0x8/0x10)
[<c01bad64>] (davinci_pcm_enqueue_dma+0x0/0x110) from [<c01bb0bc>]
(davinci_pcm_ dma_irq+0x58/0x80)
[<c01bb064>] (davinci_pcm_dma_irq+0x0/0x80) from [<c0031904>]
(dma_irq_handler+0 xec/0x12c)
 r5:00000003 r4:00000004
[<c0031818>] (dma_irq_handler+0x0/0x12c) from [<c0068ee8>]
(handle_IRQ_event+0x4 4/0x114)
[<c0068ea4>] (handle_IRQ_event+0x0/0x114) from [<c006ab74>]
(handle_edge_irq+0x1 48/0x1b4)
 r7:c7007440 r6:00000010 r5:c02ff060 r4:c6baa000
[<c006aa2c>] (handle_edge_irq+0x0/0x1b4) from [<c0027070>]
(_text+0x70/0x8c) r7:00000002 r6:00000800 r5:00000000 r4:00000010
[<c0027000>] (_text+0x0/0x8c) from [<c0027aac>] (__irq_svc+0x4c/0x90)
Exception stack(0xc6babdf0 to 0xc6babe38)
bde0:                                     00000001 00000000 c6baa000
40000013 be00: 00000800 c76f2800 00000800 c70d3900 00000000 00000800
00000000 c6babe8c be20: c6baa000 c6babe38 c01b16f4 c01b1714 40000013
ffffffff
 r5:fec48000 r4:ffffffff
[<c01b1548>] (snd_pcm_lib_read1+0x0/0x30c) from [<c01b1934>]
(snd_pcm_lib_read+0 x60/0x6c)
[<c01b18d4>] (snd_pcm_lib_read+0x0/0x6c) from [<c01aee8c>]
(snd_pcm_capture_ioct l1+0xcc/0x470)
 r6:bec98ab4 r5:bec98ab4 r4:00000000
[<c01aedc0>] (snd_pcm_capture_ioctl1+0x0/0x470) from [<c01af268>]
(snd_pcm_captu re_ioctl+0x38/0x3c)
 r7:c77b6c80 r6:800c4151 r5:bec98ab4 r4:c77b6c80
[<c01af230>] (snd_pcm_capture_ioctl+0x0/0x3c) from [<c00a2680>]
(vfs_ioctl+0x34/ 0x94)
[<c00a264c>] (vfs_ioctl+0x0/0x94) from [<c00a2d44>]
(do_vfs_ioctl+0x56c/0x5c8) r7:c77b6c80 r6:00000004 r5:c77b6c80 r4:c6b8c8a8
[<c00a27d8>] (do_vfs_ioctl+0x0/0x5c8) from [<c00a2de0>]
(sys_ioctl+0x40/0x64) [<c00a2da0>] (sys_ioctl+0x0/0x64) from [<c0027ea0>]
(ret_fast_syscall+0x0/0x2c) r7:00000036 r6:00000000 r5:0002a4b8 r4:0002a468
arecord: pcm_read:1529: read error: Input/output error
root@arago:~#

Thanks,
Sekhar

Quoted 10 lines
Quoted 3 lines

One feedback we have received on this solution is that it does not work for 24-bit audio. In which case, implementing the workaround described in the errata is the only way around.

Yes, you cannot shift more than 32 bits at once, so 48 bits is out. Although 24 bit format would be easy to add, currently only 8, 16, and 32 are supported by davinci-i2s.

Quoted 2 lines

Thanks,
Sekhar

_______________________________________________
Davinci-linux-open-source mailing list Davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

A message that is not in the archive (sent off-list or not yet received): 200909091533.58702.caglarakyuz-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#14 lore raw

RE: [alsa-devel] [PATCH 2/3] ASoC: DaVinci: pcm, rename variables in prep for ping/pong

Quoted 1 line · Caglar Akyuz

On Wednesday 09 September 2009 15:08:42 Nori, Sekhar wrote:

[...]

Quoted 6 lines
Quoted 5 lines

However, with or without your patch, I noticed a segmentation fault for the first time the 'arecord | aplay' loop is created. There is no fault the second time around. I haven't spent time debugging this yet.

Quoted 7 lines

This is due to these lines in davinci_pcm_enqueue_dma:

      data_type = prtd->params->data_type;
      count = period_size / data_type;

First time running data_type is set to 0. This is a long time issue, I remember modifying my kernels to check for zero before this division..

Ah, thanks! Planning to submit a fix for this? We can work on the patch if you are busy otherwise.

Regards,
Sekhar

A message that is not in the archive (sent off-list or not yet received): B85A65D85D7EB246BE421B3FB0FBB59301DD74F59E-/tLxBxkBPtCIQmiDNMet8wC/[email protected]

#16 lore raw

RE: [alsa-devel] [PATCH 2/3] ASoC: DaVinci: pcm, rename variables in prep for ping/pong

Quoted 27 lines

-----Original Message-----
From: davinci-linux-open-source-bounces-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org [mailto:davinci-linux-open-source-bounces-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org] On Behalf
Of Nori, Sekhar
Sent: Wednesday, September 09, 2009 9:06 AM
To: [email protected]; davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org
Cc: alsa-devel-K7yf7f+aM1XWsZ/[email protected]; Mark Brown
Subject: RE: [alsa-devel] [PATCH 2/3] ASoC: DaVinci: pcm, rename variables
in prep for ping/pong

Quoted 1 line · Caglar Akyuz

On Wednesday 09 September 2009 15:08:42 Nori, Sekhar wrote:

[...]

Quoted 2 lines
Quoted 2 lines

However, with or without your patch, I noticed a segmentation fault

for the

Quoted 1 line
Quoted 1 line

first time the 'arecord | aplay' loop is created. There is no fault

the

Quoted 5 lines
Quoted 2 lines

second time around. I haven't spent time debugging this yet.

This is due to these lines in davinci_pcm_enqueue_dma:

Quoted 8 lines
Quoted 5 lines
      data_type = prtd->params->data_type;
      count = period_size / data_type;

First time running data_type is set to 0. This is a long time issue, I remember modifying my kernels to check for zero before this division..

Ah, thanks! Planning to submit a fix for this? We can work on the patch if you are busy otherwise.

There was a patch from Arun Mani on Arago linux-davinci staging tree -

http://arago-project.org/git/projects/?p=linux-davinci.git;a=commitdiff;h=0025e7d8024e9b03bada7a1d65f1aa7b7dfec061

Thanks
Sneha

Quoted 7 lines

Regards,
Sekhar
_______________________________________________
Davinci-linux-open-source mailing list Davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Tested-by
#18 lore raw

RE: [alsa-devel] [PATCH 2/3] ASoC: DaVinci: pcm, rename variables in prep for ping/pong

In reply to a message not in the archive
Quoted 42 lines · Sekhar
Quoted 15 lines · Troy Kisky
Quoted 14 lines · Sekhar
Quoted 2 lines · Troy Kisky
Quoted 1 line · Mark Brown

On Mon, Aug 31, 2009 at 04:31:44PM -0700, Troy Kisky wrote:

[...]

Quoted 10 lines
Quoted 6 lines

I'll probably also apply the first patch since nobody else seems to care one way or another, but I would urge you to look at changing the default for the platform data to at most select the workaround only on CPUs that have problems with channel swapping - it's going to cause confusion for people to have it on by default.

I think the ones without a problem use davinci-mcasp instead of davinci-i2s but share davinci-pcm. So, I don't know of any machines to exclude in davinci-i2s. But if someone else knows, speak up.

[...]

Quoted 11 lines
Quoted 8 lines

Using EDMA acount=4 instead of 2 (32-bit transfers) did fix that issue on the OSS drivers but I don't recall the problem morphing into an "always channel swapped" case.

Have you tested your patch (1/3) with DM644x EVM? If not, we can do that and see if it leads to channels being always swapped on that hardware as well.

Yes, I have tested with dm644x, not evm. I haven't tried to hear the channel swap, but I have no doubt that it is.

I finally got around to testing your patch 1/3 on DM6446 EVM.

Without your patch, channel swap is quite easy to reproduce using audio loopback:

arecord -fcd | aplay -fcd

The audio source is a PC which speaker balance set to an extreme. By starting and stopping this command repeatedly, you can see the audio moving from one channel to the other.

Quoted 7 lines

Applying your patch fixes this issue.

Also, I did not notice any permanent channel swap. Used aplay to play data which was first left-only and then right-only. Plays the same way on a Linux PC.

I will test on couple of other platform using davinci-i2s (DM355 etc) before acking the patch.

Even on the DM355 EVM this patch fixes the random channel swap on audio loopback 'arecord -fcd | aplay -fcd'.

However, on playback, the channels do seem to be permanently swapped. This cannot surely be blamed on this patch because, without it, the channels get randomly swapped.

Since this was not observed on DM6446 EVM, I have to see if the DM355 EVM hardware swaps the channels. I briefly compared the schematics of the two EVMs, but nothing seems to be wrong there.

Troy, do you have any theory yet on why your patch should permanently swap channels?

Anyway, the patch surely improves the situation on the EVMs, so, for patch 1/3 of this series:

[tested on DM6446 and DM355 EVMs]

Thanks,
Sekhar

A message that is not in the archive (sent off-list or not yet received): B85A65D85D7EB246BE421B3FB0FBB59301DDAB3EB5-/tLxBxkBPtCIQmiDNMet8wC/[email protected]

#20 lore raw

RE: [alsa-devel] [PATCH 2/3] ASoC: DaVinci: pcm, rename variables in prep for ping/pong

Hi Sekhar,
DM355 uses MCBSP 1 instead of 0 as in DM644x. Do you think this will affect the channel swapping? Another thing is I was able to run aplay and arecord without Troy's patches, but seems like gstreamer still fails with his patches.

Thanks,
Arun

Quoted 106 lines

-----Original Message-----
From: davinci-linux-open-source-bounces+avm=ti.com-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org [mailto:davinci-linux-open-source-bounces+avm=ti.com-VycZQUHpC/PFrsHnngEfi/[email protected]] On Behalf Of Nori, Sekhar
Sent: Tuesday, September 29, 2009 6:46 AM
To: Nori, Sekhar; Troy Kisky
Cc: davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org; Mark Brown; alsa- devel-K7yf7f+aM1XWsZ/[email protected]
Subject: RE: [alsa-devel] [PATCH 2/3] ASoC: DaVinci: pcm, rename variables
in prep for ping/pong

Quoted 7 lines · Sekhar
Quoted 6 lines · Troy Kisky
Quoted 5 lines · Sekhar
Quoted 2 lines · Troy Kisky
Quoted 1 line · Mark Brown

On Mon, Aug 31, 2009 at 04:31:44PM -0700, Troy Kisky wrote:

[...]

Quoted 1 line
Quoted 1 line

I'll probably also apply the first patch since nobody else seems

to care

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

one way or another, but I would urge you to look at changing the

default

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

for the platform data to at most select the workaround only on

CPUs that

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

have problems with channel swapping - it's going to cause

confusion for

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines

people to have it on by default.

I think the ones without a problem use davinci-mcasp instead of

davinci-i2s

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

but share davinci-pcm. So, I don't know of any machines to exclude

in davinci-i2s.

Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

But if someone else knows, speak up.

[...]

Quoted 3 lines
Quoted 3 lines

Using EDMA acount=4 instead of 2 (32-bit transfers) did fix that

issue on the

Quoted 1 line
Quoted 1 line
Quoted 1 line

OSS drivers but I don't recall the problem morphing into an "always

channel

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

swapped" case.

Have you tested your patch (1/3) with DM644x EVM? If not, we can do

that and

Quoted 1 line
Quoted 1 line
Quoted 1 line

see if it leads to channels being always swapped on that hardware as

well.

Quoted 2 lines
Quoted 2 lines

Yes, I have tested with dm644x, not evm. I haven't tried to hear the

channel swap,

Quoted 9 lines
Quoted 1 line

but I have no doubt that it is.

I finally got around to testing your patch 1/3 on DM6446 EVM.

Without your patch, channel swap is quite easy to reproduce using audio loopback:

arecord -fcd | aplay -fcd

Quoted 7 lines

The audio source is a PC which speaker balance set to an extreme. By starting and stopping this command repeatedly, you can see the audio moving from one channel to the other.

Applying your patch fixes this issue.

Also, I did not notice any permanent channel swap. Used aplay to play

data

Quoted 1 line

which was first left-only and then right-only. Plays the same way on a

Linux PC.

Quoted 2 lines

I will test on couple of other platform using davinci-i2s (DM355 etc)

before

Quoted 1 line

acking the patch.

Even on the DM355 EVM this patch fixes the random channel swap on audio loopback 'arecord -fcd | aplay -fcd'.

However, on playback, the channels do seem to be permanently swapped. This cannot
surely be blamed on this patch because, without it, the channels get randomly
swapped.

Since this was not observed on DM6446 EVM, I have to see if the DM355 EVM hardware swaps the channels. I briefly compared the schematics of the two EVMs,
but nothing seems to be wrong there.

Troy, do you have any theory yet on why your patch should permanently swap channels?

Anyway, the patch surely improves the situation on the EVMs, so, for patch 1/3
of this series:

[tested on DM6446 and DM355 EVMs]

Thanks,
Sekhar
_______________________________________________
Davinci-linux-open-source mailing list Davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

A message that is not in the archive (sent off-list or not yet received): 7A436F7769CA33409C6B44B358BFFF0C012A458365-EovWT4A8QTWIQmiDNMet8wC/[email protected]

#22 lore raw

RE: [alsa-devel] [PATCH 2/3] ASoC: DaVinci: pcm, rename variables in prep for ping/pong

Hi Arun,

Quoted 3 lines · Arun

Hi Sekhar,
DM355 uses MCBSP 1 instead of 0 as in DM644x. Do you think this will affect the channel swapping?

I don't think this would have a bearing.

Quoted 2 lines

Another thing is I was able to run aplay and arecord without Troy's patches, but seems like gstreamer still fails with his patches.

I haven't tried gstreamer, but that's surprising. Can you post the error logs? Maybe someone familiar with gstreamer could comment.

Thanks,
Sekhar

Quoted 111 lines

Thanks,
Arun

Quoted 106 lines

-----Original Message-----
From: davinci-linux-open-source-bounces+avm=ti.com-VycZQUHpC/PFrsHnngEfi/[email protected] [mailto:davinci-linux-open-source-bounces+avm=ti.com-VycZQUHpC/[email protected]] On Behalf Of Nori, Sekhar
Sent: Tuesday, September 29, 2009 6:46 AM
To: Nori, Sekhar; Troy Kisky
Cc: davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org; Mark Brown; alsa- devel-K7yf7f+aM1XWsZ/[email protected]
Subject: RE: [alsa-devel] [PATCH 2/3] ASoC: DaVinci: pcm, rename variables
in prep for ping/pong

Quoted 7 lines · Sekhar
Quoted 6 lines · Troy Kisky
Quoted 5 lines · Sekhar
Quoted 2 lines · Troy Kisky
Quoted 1 line · Mark Brown

On Mon, Aug 31, 2009 at 04:31:44PM -0700, Troy Kisky wrote:

[...]

Quoted 1 line
Quoted 1 line

I'll probably also apply the first patch since nobody else seems

to care

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

one way or another, but I would urge you to look at changing the

default

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

for the platform data to at most select the workaround only on

CPUs that

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

have problems with channel swapping - it's going to cause

confusion for

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 2 lines

people to have it on by default.

I think the ones without a problem use davinci-mcasp instead of

davinci-i2s

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

but share davinci-pcm. So, I don't know of any machines to exclude

in davinci-i2s.

Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

But if someone else knows, speak up.

[...]

Quoted 3 lines
Quoted 3 lines

Using EDMA acount=4 instead of 2 (32-bit transfers) did fix that

issue on the

Quoted 1 line
Quoted 1 line
Quoted 1 line

OSS drivers but I don't recall the problem morphing into an "always

channel

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

swapped" case.

Have you tested your patch (1/3) with DM644x EVM? If not, we can do

that and

Quoted 1 line
Quoted 1 line
Quoted 1 line

see if it leads to channels being always swapped on that hardware as

well.

Quoted 2 lines
Quoted 2 lines

Yes, I have tested with dm644x, not evm. I haven't tried to hear the

channel swap,

Quoted 9 lines
Quoted 1 line

but I have no doubt that it is.

I finally got around to testing your patch 1/3 on DM6446 EVM.

Without your patch, channel swap is quite easy to reproduce using audio loopback:

arecord -fcd | aplay -fcd

Quoted 7 lines

The audio source is a PC which speaker balance set to an extreme. By starting and stopping this command repeatedly, you can see the audio moving from one channel to the other.

Applying your patch fixes this issue.

Also, I did not notice any permanent channel swap. Used aplay to play

data

Quoted 1 line

which was first left-only and then right-only. Plays the same way on a

Linux PC.

Quoted 2 lines

I will test on couple of other platform using davinci-i2s (DM355 etc)

before

Quoted 1 line

acking the patch.

Even on the DM355 EVM this patch fixes the random channel swap on audio loopback 'arecord -fcd | aplay -fcd'.

However, on playback, the channels do seem to be permanently swapped. This cannot
surely be blamed on this patch because, without it, the channels get randomly
swapped.

Since this was not observed on DM6446 EVM, I have to see if the DM355 EVM hardware swaps the channels. I briefly compared the schematics of the two EVMs,
but nothing seems to be wrong there.

Troy, do you have any theory yet on why your patch should permanently swap channels?

Anyway, the patch surely improves the situation on the EVMs, so, for patch 1/3
of this series:

[tested on DM6446 and DM355 EVMs]

Thanks,
Sekhar
_______________________________________________
Davinci-linux-open-source mailing list Davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

A message that is not in the archive (sent off-list or not yet received): B85A65D85D7EB246BE421B3FB0FBB59301DDB71445-/tLxBxkBPtCIQmiDNMet8wC/[email protected]

#24 lore raw

RE: [alsa-devel] [PATCH 2/3] ASoC: DaVinci: pcm, rename variables in prep for ping/pong

Quoted 7 lines · Sekhar

Hi Arun,

Quoted 3 lines · Arun

Hi Sekhar,
DM355 uses MCBSP 1 instead of 0 as in DM644x. Do you think this will affect the channel swapping?

Quoted 8 lines

I don't think this would have a bearing.

Quoted 2 lines

Another thing is I was able to run aplay and arecord without Troy's patches, but seems like gstreamer still fails with his patches.

I haven't tried gstreamer, but that's surprising. Can you post the error logs? Maybe someone familiar with gstreamer could comment.

Arun,

Do you observe any errors when playing sound file through ALSA's OSS emulation layer (ie. using waeplay or similar applications)? Based on the options, gstreamer may (or may not) use the OSS emulation. May want to try it out to see if that makes a difference.

Regards,

Steve

author
#25 lore raw

Re: [PATCH 2/3] ASoC: DaVinci: pcm, rename variables in prep for ping/pong

In reply to Nori, Sekhar
Quoted 4 lines

Troy, do you have any theory yet on why your patch should permanently swap channels?

Memory in 16 bit samples
L1,R1,L2,R2

Shifting out in 16 bit samples
L1,R1,L2,R2

Memory in 32 bit samples
R1L1,R2L2,R3L3

Shifting out in 32 bit samples
R1L1,R2L2

Codec sees 16 bit samples
R1,L1,R2,L2

A message that is not in the archive (sent off-list or not yet received): 4AC28588.9030802-Q5RJGjKts06CY9SHAMCTRUEOCMrvLtNR@public.gmane.org

#27 lore raw

Re: [alsa-devel] [PATCH 2/3] ASoC: DaVinci: pcm, rename variables in prep for ping/pong

Quoted 11 lines · Troy Kisky
Quoted 4 lines

Troy, do you have any theory yet on why your patch should permanently swap channels?

Memory in 16 bit samples
L1,R1,L2,R2

Shifting out in 16 bit samples
L1,R1,L2,R2

Quoted 9 lines

Memory in 32 bit samples
R1L1,R2L2,R3L3

Shifting out in 32 bit samples
R1L1,R2L2

Codec sees 16 bit samples
R1,L1,R2,L2

If that is the case, wouldn't we see the channel swap on DM644x as well?

Quoted 1 line

From Sekhar's earlier e-mail, the channel swap appears specific to DM355

EVM.

Steve

author
#28 lore raw

Re: [PATCH 2/3] ASoC: DaVinci: pcm, rename variables in prep for ping/pong

Quoted 21 lines · Steve Chen
Quoted 10 lines · Troy Kisky
Quoted 3 lines

Troy, do you have any theory yet on why your patch should permanently swap channels?

Memory in 16 bit samples
L1,R1,L2,R2

Shifting out in 16 bit samples
L1,R1,L2,R2

Quoted 9 lines

Memory in 32 bit samples
R1L1,R2L2,R3L3

Shifting out in 32 bit samples
R1L1,R2L2

Codec sees 16 bit samples
R1,L1,R2,L2

Quoted 7 lines

If that is the case, wouldn't we see the channel swap on DM644x as well?

Quoted 1 line

From Sekhar's earlier e-mail, the channel swap appears specific to DM355

EVM.

Steve

Yes, unless an underrun causes the 1st 16 bit sample to be delayed when transmitting out 16 bit samples at a time. That is why the 16 bit shift leads to random swaps and 32 bit shifts leads to always swapped. When an underrun happens with 32 bit shifts the last sample (both left AND right) is merely shifted again. When an underrun happens with 16 bit shifts only the immediately preceding left OR right channel sample is repeated leading to a random swap.

Troy

A message that is not in the archive (sent off-list or not yet received): 4AC28AD0.7000600-Q5RJGjKts06CY9SHAMCTRUEOCMrvLtNR@public.gmane.org

#30 lore raw

Re: [alsa-devel] [PATCH 2/3] ASoC: DaVinci: pcm, rename variables in prep for ping/pong

Quoted 29 lines · Troy Kisky
Quoted 21 lines · Steve Chen
Quoted 10 lines · Troy Kisky
Quoted 3 lines

Troy, do you have any theory yet on why your patch should permanently swap channels?

Memory in 16 bit samples
L1,R1,L2,R2

Shifting out in 16 bit samples
L1,R1,L2,R2

Quoted 9 lines

Memory in 32 bit samples
R1L1,R2L2,R3L3

Shifting out in 32 bit samples
R1L1,R2L2

Codec sees 16 bit samples
R1,L1,R2,L2

Quoted 7 lines

If that is the case, wouldn't we see the channel swap on DM644x as well?

Quoted 1 line

From Sekhar's earlier e-mail, the channel swap appears specific to DM355

EVM.

Steve

Quoted 7 lines

Yes, unless an underrun causes the 1st 16 bit sample to be delayed when transmitting out 16 bit samples at a time. That is why the 16 bit shift leads to random swaps and 32 bit shifts leads to always swapped. When an underrun happens with 32 bit shifts the last sample (both left AND right) is merely shifted again. When an underrun happens with 16 bit shifts only the immediately preceding left OR right channel sample is repeated leading to a random swap.

I see, so "random" channel swap only happens for 16 bit shift and only after an underrun. So if underrun does not happen, we should not see any channel swap right?

As for the 32 bit shift, if the channels are always swapped, can we not configure the DMA engine to automatically swap the upper and lower 16 bits to get around the issue? Am I missing something?

Steve

#31 lore raw

Re: [PATCH 2/3] ASoC: DaVinci: pcm, rename variables in prep for ping/pong

In reply to Troy Kisky
Quoted 4 lines · Troy Kisky

-       int master_lch;         /* Master DMA channel */
-       int slave_lch;          /* linked parameter RAM reload slot */ +       int asp_master_lch;     /* Master DMA channel */
+       int asp_link_lch[2];    /* asp parameter link channel, ping/pong */

If you're going to rename things, may I suggest getting rid of "lch" ... use either "channel" or "link", since those are the two basic hardware roles in EDMA.

The original "lch" ("logical channel") terminology was an IMO misguded attempt to hide the distinction between channels and links. But links can not be used when a channel is required, so that attempt was doomed to fail. (Channels could double as links, but as a rule that's not done since they're relatively scarce.)

- Dave

author
#32 lore raw

Re: [PATCH 2/3] ASoC: DaVinci: pcm, rename variables in prep for ping/pong

Quoted 10 lines · David Brownell

sound/soc/davinci/davinci-pcm.c static struct snd_pcm_hardware davinci_pcm_hardware = { · line 55

Quoted 4 lines · Troy Kisky
sound/soc/davinci/davinci-pcm.c +2 -2
-       int master_lch;         /* Master DMA channel */
-       int slave_lch;          /* linked parameter RAM reload slot */
+       int asp_master_lch;     /* Master DMA channel */
+       int asp_link_lch[2];    /* asp parameter link channel, ping/pong */

If you're going to rename things, may I suggest getting rid of "lch" ... use either "channel" or "link", since those are the two basic hardware roles in EDMA.

Quoted 11 lines

The original "lch" ("logical channel") terminology was an IMO misguded attempt to hide the distinction between channels and links. But links can not be used when a channel is required, so that attempt was doomed to fail. (Channels could double as links, but as a rule that's not done since they're relatively scarce.)

- Dave

I agree, but can that be a separate patch...

#33 lore raw

Re: [PATCH 2/3] ASoC: DaVinci: pcm, rename variables in prep for ping/pong

Quoted 7 lines · Troy Kisky
Quoted 6 lines · David Brownell
Quoted 4 lines · Troy Kisky
sound/soc/davinci/davinci-pcm.c +2 -2
-       int master_lch;         /* Master DMA channel */
-       int slave_lch;          /* linked parameter RAM reload slot */
+       int asp_master_lch;     /* Master DMA channel */
+       int asp_link_lch[2];    /* asp parameter link channel, ping/pong */
Quoted 5 lines
Quoted 3 lines

If you're going to rename things, may I suggest getting rid of "lch" ... use either "channel" or "link", since those are the two basic hardware roles in EDMA.

I agree, but can that be a separate patch...

However you like; I'd just suggest that *one* rename-things patch is normally preferred. If this one's already in the merge queue that might be awkward.

author
#34 lore raw

Re: [PATCH 2/3] ASoC: DaVinci: pcm, rename variables in prep for ping/pong

Quoted 7 lines · David Brownell
Quoted 6 lines · Troy Kisky
Quoted 5 lines · David Brownell
Quoted 4 lines · Troy Kisky
sound/soc/davinci/davinci-pcm.c +2 -2
-       int master_lch;         /* Master DMA channel */
-       int slave_lch;          /* linked parameter RAM reload slot */
+       int asp_master_lch;     /* Master DMA channel */
+       int asp_link_lch[2];    /* asp parameter link channel, ping/pong */
Quoted 9 lines
Quoted 4 lines
Quoted 3 lines

If you're going to rename things, may I suggest getting rid of "lch" ... use either "channel" or "link", since those are the two basic hardware roles in EDMA.

I agree, but can that be a separate patch...

However you like; I'd just suggest that *one* rename-things patch is normally preferred. If this one's already in the merge queue that might be awkward.

Kevin,

Is the window too close, or is there time to change this?

Troy

#35 lore raw
In reply to Troy Kisky

arch/arm/mach-davinci/include/mach/asp.h struct snd_platform_data { · line 59

Quoted 6 lines · Troy Kisky
arch/arm/mach-davinci/include/mach/asp.h +6 -0
+	/*
+	 * Allowing this is more efficient and eliminates left and right swaps
+	 * caused by underruns, but will swap the left and right channels
+	 * when compared to previous behavior.
+	 */
+	unsigned disable_channel_combine:1;

Last time you submitted this I suggested changing this to make the default the other way round so that there's no breakage on existing boards which aren't designed for this channel swap behaviour. Is there some reason not to do that?

author
#36 lore raw
Quoted 14 lines · Mark Brown

arch/arm/mach-davinci/include/mach/asp.h struct snd_platform_data { · line 59

Quoted 6 lines · Troy Kisky
arch/arm/mach-davinci/include/mach/asp.h +6 -0
+	/*
+	 * Allowing this is more efficient and eliminates left and right swaps
+	 * caused by underruns, but will swap the left and right channels
+	 * when compared to previous behavior.
+	 */
+	unsigned disable_channel_combine:1;

Last time you submitted this I suggested changing this to make the default the other way round so that there's no breakage on existing boards which aren't designed for this channel swap behaviour. Is there some reason not to do that?

I think that it is better to make sure that they know the possible problems disabling this may cause. Channels always swapped seems a lot better than channels randomly swapped.

Troy

#37 lore raw
Quoted 10 lines · Troy Kisky
Quoted 4 lines · Mark Brown

Last time you submitted this I suggested changing this to make the default the other way round so that there's no breakage on existing boards which aren't designed for this channel swap behaviour. Is there some reason not to do that?

I think that it is better to make sure that they know the possible problems disabling this may cause. Channels always swapped seems a lot better than channels randomly swapped.

Of course, the other way of looking at it is that with the channel swapping you've got guaranteed breakage - it sounds less good if you say it that way :) How common are the channel swaps?

author
#38 lore raw
Quoted 8 lines · Mark Brown
Quoted 6 lines · Troy Kisky
Quoted 4 lines · Mark Brown

Last time you submitted this I suggested changing this to make the default the other way round so that there's no breakage on existing boards which aren't designed for this channel swap behaviour. Is there some reason not to do that?

Quoted 8 lines
Quoted 3 lines

I think that it is better to make sure that they know the possible problems disabling this may cause. Channels always swapped seems a lot better than channels randomly swapped.

Of course, the other way of looking at it is that with the channel swapping you've got guaranteed breakage - it sounds less good if you say it that way :) How common are the channel swaps?

I was getting a lot when playing videos. It mainly just sounded bad until I got a stereo audio file with different frequency sine waves to understand better what was happening. Then, you could hear the channels swap frequently, more than once per second. If using sram, it is not an issue unless another device is using the same TC. But sram isn't on by default either. And probably shouldn't be since the newer chips don't have an underrun problem.

Does anyone else want to share their thoughts/ experience?

Thanks
Troy

#39 lore raw
Quoted 10 lines · Troy Kisky
Quoted 3 lines · Mark Brown

Of course, the other way of looking at it is that with the channel swapping you've got guaranteed breakage - it sounds less good if you say it that way :) How common are the channel swaps?

I was getting a lot when playing videos. It mainly just sounded bad until I got a stereo audio file with different frequency sine waves to understand better what was happening. Then, you could hear the channels swap frequently, more than once per second. If using sram, it is not an issue unless another device

So, very often under heavy load then? That'd be consistent with simlar
problems on other devices. Part of the trouble here is that things like video can make the channel swap more noticable - if stereo is used to track the movement of an object on screen the channel swap would stop the effect tying in with the visuals.

Quoted 2 lines

is using the same TC. But sram isn't on by default either. And probably shouldn't be since the newer chips don't have an underrun problem.

Hrm, that suggests that if it's enabled at all the default should depend on the chip in use?

author
#40 lore raw
Quoted 18 lines · Mark Brown
Quoted 10 lines · Troy Kisky
Quoted 3 lines · Mark Brown

Of course, the other way of looking at it is that with the channel swapping you've got guaranteed breakage - it sounds less good if you say it that way :) How common are the channel swaps?

I was getting a lot when playing videos. It mainly just sounded bad until I got a stereo audio file with different frequency sine waves to understand better what was happening. Then, you could hear the channels swap frequently, more than once per second. If using sram, it is not an issue unless another device

So, very often under heavy load then? That'd be consistent with simlar
problems on other devices. Part of the trouble here is that things like video can make the channel swap more noticable - if stereo is used to track the movement of an object on screen the channel swap would stop the effect tying in with the visuals.

Quoted 6 lines
Quoted 2 lines

is using the same TC. But sram isn't on by default either. And probably shouldn't be since the newer chips don't have an underrun problem.

Hrm, that suggests that if it's enabled at all the default should depend on the chip in use?

That seems unnecessarily complex to me. As long as platform data can specify what you need, you'll eventually get it right. If tracking of an object is always wrong because of a channel swap, that is easier to notice, and debug, and fix, then if the tracking is only occasionally wrong. I'd much rather have a repeatable bug. And most codecs do allow you to swap the left and right channels. So, for most people, the fix will not be to disable channel combining.

Troy

#41 lore raw
Quoted 8 lines · Troy Kisky
Quoted 5 lines · Mark Brown
Quoted 2 lines

is using the same TC. But sram isn't on by default either. And probably shouldn't be since the newer chips don't have an underrun problem.

Hrm, that suggests that if it's enabled at all the default should depend on the chip in use?

Quoted 7 lines

That seems unnecessarily complex to me. As long as platform data can specify what you need, you'll eventually get it right. If tracking of an object is always wrong because of a channel swap, that is easier to notice, and debug, and fix, then if the tracking is only occasionally wrong. I'd much rather have a repeatable bug. And most codecs do allow you to swap the left and right channels. So, for most people, the fix will not be to disable channel combining.

My thinking was that if the newer chips don't have the underrun issue at all then it seems like a bad move to enable the workaround for them since they're currently fine. There should be no intermittent problems if the underrun issue isn't present.

author
#42 lore raw
Quoted 17 lines · Mark Brown
Quoted 8 lines · Troy Kisky
Quoted 5 lines · Mark Brown
Quoted 2 lines

is using the same TC. But sram isn't on by default either. And probably shouldn't be since the newer chips don't have an underrun problem.

Hrm, that suggests that if it's enabled at all the default should depend on the chip in use?

Quoted 7 lines

That seems unnecessarily complex to me. As long as platform data can specify what you need, you'll eventually get it right. If tracking of an object is always wrong because of a channel swap, that is easier to notice, and debug, and fix, then if the tracking is only occasionally wrong. I'd much rather have a repeatable bug. And most codecs do allow you to swap the left and right channels. So, for most people, the fix will not be to disable channel combining.

Quoted 5 lines

My thinking was that if the newer chips don't have the underrun issue at all then it seems like a bad move to enable the workaround for them since they're currently fine. There should be no intermittent problems if the underrun issue isn't present.

True, there shouldn't be a problem. However, from a efficiency point of view, it is still better to have the workaround. Fewer memory accesses may free a little bandwidth for other uses.

Troy