All of lore.kernel.org
 help / color / mirror / Atom feed
* Q1: Linked streams and drivers
@ 2007-02-01  3:31 Eliot Blennerhassett
  2007-02-01 14:03 ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Eliot Blennerhassett @ 2007-02-01  3:31 UTC (permalink / raw)
  To: alsa-devel

Greetings,

I know there is some mechanism for linking streams together so that a
single trigger command starts/stops all streams.

Is the underlying driver notified of the link? and if so how?

Reason is that in our hardware we have the ability to link streams at
the hardware (on card firmware actually) level, so that one command
starts multiple streams.

thanks

Eliot
AudioScience Inc.

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Q1: Linked streams and drivers
  2007-02-01  3:31 Q1: Linked streams and drivers Eliot Blennerhassett
@ 2007-02-01 14:03 ` Takashi Iwai
  2007-02-01 20:19   ` Eliot Blennerhassett
  0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2007-02-01 14:03 UTC (permalink / raw)
  To: Eliot Blennerhassett; +Cc: alsa-devel

At Thu, 01 Feb 2007 16:31:01 +1300,
Eliot Blennerhassett wrote:
> 
> Greetings,
> 
> I know there is some mechanism for linking streams together so that a
> single trigger command starts/stops all streams.
> 
> Is the underlying driver notified of the link? and if so how?

A PCM substream has a linked list of link members (via struct
snd_pcm_group).  The macro, snd_pcm_group_for_each(), gives you the
loop for checking each list memeber.

When a driver supports the hardware-linked substreams, it needs to
check whether multiple streams exist in that substream.  Set
snd_pcm_trigger_done() at each stream, and trigger once.

You can see examples in the driver implementations.  Grep
snd_pcm_group_for_each() under alsa-kernel/pci directory.


Takashi

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Q1: Linked streams and drivers
  2007-02-01 14:03 ` Takashi Iwai
@ 2007-02-01 20:19   ` Eliot Blennerhassett
  2007-02-02 12:16     ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Eliot Blennerhassett @ 2007-02-01 20:19 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

On Friday 02 February 2007 03:03, Takashi Iwai wrote:
> At Thu, 01 Feb 2007 16:31:01 +1300,

>
> A PCM substream has a linked list of link members (via struct
> snd_pcm_group).  The macro, snd_pcm_group_for_each(), gives you the
> loop for checking each list memeber.
>
> When a driver supports the hardware-linked substreams, it needs to
> check whether multiple streams exist in that substream.  Set
> snd_pcm_trigger_done() at each stream, and trigger once.
>
> You can see examples in the driver implementations.  Grep
> snd_pcm_group_for_each() under alsa-kernel/pci directory.

Thanks Takashi,

I see that the above loops are in the trigger callbacks of the drivers.

But I wonder if the linked status known at hwparams or prepare callback.
This is because I need to send a message to our card to group each pair of 
streams,  I think this should not be in the trigger callback.

I.e.  group(stream0,stream1); group(stream0,stream2) etc

After this, start and stop commands on any stream in the group operate on them 
all simultaneously, and the simultaneous start is sample accurate.

I'd prefer to do this earlier in the setup process than at trigger callback.
-- 
--
Eliot Blennerhassett
AudioScience Inc.

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Q1: Linked streams and drivers
  2007-02-01 20:19   ` Eliot Blennerhassett
@ 2007-02-02 12:16     ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2007-02-02 12:16 UTC (permalink / raw)
  To: Eliot Blennerhassett; +Cc: alsa-devel

At Fri, 2 Feb 2007 09:19:34 +1300,
Eliot Blennerhassett wrote:
> 
> On Friday 02 February 2007 03:03, Takashi Iwai wrote:
> > At Thu, 01 Feb 2007 16:31:01 +1300,
> 
> >
> > A PCM substream has a linked list of link members (via struct
> > snd_pcm_group).  The macro, snd_pcm_group_for_each(), gives you the
> > loop for checking each list memeber.
> >
> > When a driver supports the hardware-linked substreams, it needs to
> > check whether multiple streams exist in that substream.  Set
> > snd_pcm_trigger_done() at each stream, and trigger once.
> >
> > You can see examples in the driver implementations.  Grep
> > snd_pcm_group_for_each() under alsa-kernel/pci directory.
> 
> Thanks Takashi,
> 
> I see that the above loops are in the trigger callbacks of the drivers.
> 
> But I wonder if the linked status known at hwparams or prepare callback.

Not at the prepare time.  Since snd_pcm_hw_params() in alsa-lib
invokes the prepare too, and usually snd_pcm_link() is called after
hw_params set up, the link state is practically unknown before
trigger.

> This is because I need to send a message to our card to group each pair of 
> streams,  I think this should not be in the trigger callback.
> 
> I.e.  group(stream0,stream1); group(stream0,stream2) etc
> 
> After this, start and stop commands on any stream in the group operate on them 
> all simultaneously, and the simultaneous start is sample accurate.
> 
> I'd prefer to do this earlier in the setup process than at trigger callback.

We'd need to introduce some notification in this case.

One way is to add a new callback for link notification.  This is
cleaner but would affect all drivers.

Another way is to call ops->ioctl callback from snd_pcm_link() with a
special type, SNDRV_PCM_IOCTL1_LINK, for example.

In both cases, handling an error from the notify callback is a bit
difficult because of complex locking and linked lists.  Otherwise, the
implementation would be relatively easy, I guess.

Anyways, snd_pcm_link() should check the PCM state more carefully,
accept linking only in either SETUP and PREPARE state, too.


Takashi

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-02-02 12:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-01  3:31 Q1: Linked streams and drivers Eliot Blennerhassett
2007-02-01 14:03 ` Takashi Iwai
2007-02-01 20:19   ` Eliot Blennerhassett
2007-02-02 12:16     ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.