From: Takashi Iwai Subject: Re: 6-channel output and i2s Date: Wed, 29 Apr 2009 16:52:17 +0200 Message-ID: References: <9e4733910904290558n60f71bbdn8b85d64e1c0ad4dd@mail.gmail.com> <9e4733910904290735n1dc680b4pdccfb13970363109@mail.gmail.com> <9e4733910904290737j35e5f25chd5d7992c9cb55ab7@mail.gmail.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id D5E9F103893 for ; Wed, 29 Apr 2009 16:52:23 +0200 (CEST) In-Reply-To: <9e4733910904290737j35e5f25chd5d7992c9cb55ab7@mail.gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Jon Smirl Cc: alsa-devel mailing list List-Id: alsa-devel@alsa-project.org At Wed, 29 Apr 2009 10:37:17 -0400, Jon Smirl wrote: > > On Wed, Apr 29, 2009 at 10:35 AM, Jon Smirl wrote: > > On Wed, Apr 29, 2009 at 9:04 AM, Takashi Iwai wrote: > >> At Wed, 29 Apr 2009 08:58:52 -0400, > >> Jon Smirl wrote: > >>> > >>> 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 > > > >> 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