Skip to contentSkip to conversation

6-channel output and i2s

DISCUSSION Jon Smirl 2 participants 5 messages Apr 29, 2009

lore
Share & tools
lore

Jon Smirl

author
#0 lore raw

My hardware was has three stereo i2s lines. These three lines are all tied to the same external clock so they are synchronized. Because there are three i2s lines, each with it's own DMA queue and FIFO, I need three independent output buffers. What is the correct way to set this up in ALSA?

Signature · 2 lines
Jon Smirl
[email protected]
#1 lore raw

At Wed, 29 Apr 2009 08:58:52 -0400,

Quoted 6 lines · Jon Smirl

My hardware was has three stereo i2s lines. These three lines are all tied to the same external clock so they are synchronized. Because there are three i2s lines, each with it's own DMA queue and FIFO, I need three independent output buffers. What is the correct way to set this up in ALSA?

So I suppose it's three streams of 2-ch interleaved format? If so, an easier way would be to provide three substreams in a PCM, and bind 6 channels with alsa-lib plugin.

Another possible way would be to set up channel_info to point a proper offset for each channel. But, this is less common and maybe more problematic.

Takashi

author
#2 lore raw
Quoted 10 lines · Takashi Iwai

At Wed, 29 Apr 2009 08:58:52 -0400,

Quoted 6 lines · Jon Smirl

My hardware was has three stereo i2s lines. These three lines are all tied to the same external clock so they are synchronized. Because there are three i2s lines, each with it's own DMA queue and FIFO, I need three independent output buffers. What is the correct way to set this up in ALSA?

So I suppose it's three streams of 2-ch interleaved format?

Yes

Quoted 2 lines

If so, an easier way would be to provide three substreams in a PCM, and bind 6 channels with alsa-lib plugin.

How does ALSA start the streams synchronously?

Quoted 8 lines

Another possible way would be to set up channel_info to point a proper offset for each channel.  But, this is less common and maybe more problematic.

Takashi

Signature · 2 lines
Jon Smirl
[email protected]
author
#3 lore raw
Quoted 10 lines · Jon Smirl
Quoted 9 lines · Takashi Iwai

At Wed, 29 Apr 2009 08:58:52 -0400,

Quoted 6 lines · Jon Smirl

My hardware was has three stereo i2s lines. These three lines are all tied to the same external clock so they are synchronized. Because there are three i2s lines, each with it's own DMA queue and FIFO, I need three independent output buffers. What is the correct way to set this up in ALSA?

Quoted 8 lines
Quoted 1 line

So I suppose it's three streams of 2-ch interleaved format?

Yes

Quoted 2 lines

If so, an easier way would be to provide three substreams in a PCM, and bind 6 channels with alsa-lib plugin.

How does ALSA start the streams synchronously?

I can start the streams synchronously at the low level by waiting for the frame clock and then enabling the three DMA channels.

Quoted 16 lines
Quoted 9 lines

Another possible way would be to set up channel_info to point a proper offset for each channel.  But, this is less common and maybe more problematic.

Takashi

--
Jon Smirl
[email protected]

Signature · 2 lines
Jon Smirl
[email protected]
#4 lore raw

At Wed, 29 Apr 2009 10:37:17 -0400,

Quoted 16 lines · Jon Smirl
Quoted 14 lines · Jon Smirl
Quoted 10 lines · Takashi Iwai

At Wed, 29 Apr 2009 08:58:52 -0400,

Quoted 6 lines · Jon Smirl

My hardware was has three stereo i2s lines. These three lines are all tied to the same external clock so they are synchronized. Because there are three i2s lines, each with it's own DMA queue and FIFO, I need three independent output buffers. What is the correct way to set this up in ALSA?

So I suppose it's three streams of 2-ch interleaved format?

Yes

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

If so, an easier way would be to provide three substreams in a PCM, and bind 6 channels with alsa-lib plugin.

How does ALSA start the streams synchronously?

I can start the streams synchronously at the low level by waiting for the frame clock and then enabling the three DMA channels.

If the hardware supports the simultaneous triggering of multiple streams, add the sync support to the driver. Namely,
- Add SNDRV_PCM_INFO_SYNC_START flag to PCM info field
- Call snd_pcm_set_sync(substream) at each open callback
- In the trigger callback, check all bundled streams via snd_pcm_group_for_each_entry(). Mark all the streams but the current one via snd_pcm_trigger_done().
Then start all streams at once.
Ditto for stop and pause.

Takashi