All of lore.kernel.org
 help / color / mirror / Atom feed
* Driver Programming
@ 2004-11-25 16:43 Klaus Fetscher
  2004-11-26  8:47 ` Giuliano Pochini
  2004-11-26 11:39 ` Clemens Ladisch
  0 siblings, 2 replies; 7+ messages in thread
From: Klaus Fetscher @ 2004-11-25 16:43 UTC (permalink / raw)
  To: alsa-devel

Hi,

I want to programm an driver for the Cirrus CS42516. This Codec 
communicates with an ARM9 CPU over 3 I2S channels. I want to use 3 
stereo channels for playing and two stereo channels for receiving the 
data. All three channels are working with the same clock-rate.

I have read the documentation "Writing an Alsa Driver" but I am confused 
about the meaning of PCM Streams and Substreams. What must I declare, 
one PCM Stream with three Substreams or 3 PCM Streams ?

Is there any existing driver with a similar configuration (more than one 
channel)?


Thanks

Klaus



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/

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

* RE: Driver Programming
  2004-11-25 16:43 Driver Programming Klaus Fetscher
@ 2004-11-26  8:47 ` Giuliano Pochini
  2004-11-26 11:39 ` Clemens Ladisch
  1 sibling, 0 replies; 7+ messages in thread
From: Giuliano Pochini @ 2004-11-26  8:47 UTC (permalink / raw)
  To:  (Klaus Fetscher); +Cc: alsa-devel


On 25-Nov-2004 Klaus Fetscher wrote:

> I have read the documentation "Writing an Alsa Driver" but I am confused 
> about the meaning of PCM Streams and Substreams. What must I declare, 
> one PCM Stream with three Substreams or 3 PCM Streams ?

How does your chip work ?  If I inderstood you correcty, it has three
independent stereo outputs and two inputs.

snd_pcm_new(chip->card, "name", DEV_0, THREE_OUT, TWO_IN, &pcm);

If each substream can be either mono or stereo, in the
.open() callback you'll set

runtime->hw->channels_min = 1;
runtime->hw->channels_max = 2;


--
Giuliano.


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/

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

* Re: Driver Programming
  2004-11-25 16:43 Driver Programming Klaus Fetscher
  2004-11-26  8:47 ` Giuliano Pochini
@ 2004-11-26 11:39 ` Clemens Ladisch
  2004-11-28 22:06   ` Klaus Fetscher
  1 sibling, 1 reply; 7+ messages in thread
From: Clemens Ladisch @ 2004-11-26 11:39 UTC (permalink / raw)
  To: Klaus Fetscher; +Cc: alsa-devel

Klaus Fetscher wrote:
> I want to programm an driver for the Cirrus CS42516. This Codec
> communicates with an ARM9 CPU over 3 I2S channels. I want to use 3
> stereo channels for playing and two stereo channels for receiving the
> data. All three channels are working with the same clock-rate.
>
> I have read the documentation "Writing an Alsa Driver" but I am confused
> about the meaning of PCM Streams and Substreams. What must I declare,
> one PCM Stream with three Substreams or 3 PCM Streams ?

When an application opens a PCM device without specifying a substream
(the standard case), ALSA chooses the first free substream.
Therefore, substreams are usually only used with chips that do
hardware mixing on them and route them to the same output.

If the channels are independent, it's better to use separate streams.

> Is there any existing driver with a similar configuration (more than one
> channel)?

The cmipci driver handles cards with two DACs.


HTH
Clemens



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/

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

* Re: Driver Programming
  2004-11-26 11:39 ` Clemens Ladisch
@ 2004-11-28 22:06   ` Klaus Fetscher
  2004-11-29  3:27     ` Paul Davis
  0 siblings, 1 reply; 7+ messages in thread
From: Klaus Fetscher @ 2004-11-28 22:06 UTC (permalink / raw)
  To: Clemens Ladisch, Giuliano Pochini, alsa-devel

Thanks Clemens and Giuliano for the answers !

>>I want to programm an driver for the Cirrus CS42516. This Codec
>>communicates with an ARM9 CPU over 3 I2S channels. I want to use 3
>>stereo channels for playing and two stereo channels for receiving the
>>data. All three channels are working with the same clock-rate.
>>
>>I have read the documentation "Writing an Alsa Driver" but I am confused
>>about the meaning of PCM Streams and Substreams. What must I declare,
>>one PCM Stream with three Substreams or 3 PCM Streams ?
>>    
>>
>How does your chip work ?  If I inderstood you correcty, it has three
>independent stereo outputs and two inputs.
>
>  
>
Yes, but all stereo channels must work with the same sampling rate.

>snd_pcm_new(chip->card, "name", DEV_0, THREE_OUT, TWO_IN, &pcm);
>
>If each substream can be either mono or stereo, in the
>.open() callback you'll set
>
>runtime->hw->channels_min = 1;
>runtime->hw->channels_max = 2;
>
>  
>
Okay, I am using these parameters for the function snd_pcm_new(  ).

Is it possible to detect (in the functions xxx_playback_prepare, 
xxx_capture_prepare ...), which substream will be used.
I need to know the number of the substream, because I have three FIFO's 
for transmitting and two FIFO's for receiving and I want to program a 
dedicated DMA-Controllers for every substream.

Is it possible, to select a substream with aplay ?


Thanks

Klaus



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/

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

* Re: Driver Programming
  2004-11-28 22:06   ` Klaus Fetscher
@ 2004-11-29  3:27     ` Paul Davis
  2004-11-29  8:37       ` Klaus Fetscher
  0 siblings, 1 reply; 7+ messages in thread
From: Paul Davis @ 2004-11-29  3:27 UTC (permalink / raw)
  To: Klaus Fetscher; +Cc: Clemens Ladisch, Giuliano Pochini, alsa-devel

>Is it possible, to select a substream with aplay ?

aplay -D hw:stream,substream


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/

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

* Re: Driver Programming
  2004-11-29  3:27     ` Paul Davis
@ 2004-11-29  8:37       ` Klaus Fetscher
  2004-11-29  9:19         ` Giuliano Pochini
  0 siblings, 1 reply; 7+ messages in thread
From: Klaus Fetscher @ 2004-11-29  8:37 UTC (permalink / raw)
  To: Paul Davis; +Cc: Klaus Fetscher, Clemens Ladisch, Giuliano Pochini, alsa-devel

Paul Davis schrieb:

>>Is it possible, to select a substream with aplay ?
>>    
>>
>
>aplay -D hw:stream,substream
>
>  
>
Okay, I found my error. No, I am calling snd_pcm_new(chip->card, "name", 
DEV_x, ONE_OUT, ONE_IN, &pcm); three times. During the last call, the 
parameter ONE_IN is 0 (because I only have three output channels and two 
input channels).

When I list the /proc/asound/card0 directory, I can see pcm0c, pcm1c, 
pcm0p, pcm1p, pcm2p. And with substream->pcm->device I can detect, which 
device I am using. All seems to be okay.

Another question belonging to the Control names of the mixer. Is it 
correct, to use "Master Volume" three times for the different output 
channels (the channels are independent from each other) ?

Thanks,

Klaus



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/

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

* Re: Driver Programming
  2004-11-29  8:37       ` Klaus Fetscher
@ 2004-11-29  9:19         ` Giuliano Pochini
  0 siblings, 0 replies; 7+ messages in thread
From: Giuliano Pochini @ 2004-11-29  9:19 UTC (permalink / raw)
  To: Klaus Fetscher; +Cc: Paul Davis, Clemens Ladisch, alsa-devel



On Mon, 29 Nov 2004, Klaus Fetscher wrote:

> Okay, I found my error. No, I am calling snd_pcm_new(chip->card, "name",
> DEV_x, ONE_OUT, ONE_IN, &pcm); three times. During the last call, the
> parameter ONE_IN is 0 (because I only have three output channels and two
> input channels).
>
> When I list the /proc/asound/card0 directory, I can see pcm0c, pcm1c,
> pcm0p, pcm1p, pcm2p. And with substream->pcm->device I can detect, which
> device I am using. All seems to be okay.

If you want to play a 6-channel track you have to open all tree devices
and the hw should support sync-start. (There was a typo in the my message:
THREE_OUT and TWO_IN should have been 6 and 4).


> Another question belonging to the Control names of the mixer. Is it
> correct, to use "Master Volume" three times for the different output
> channels (the channels are independent from each other) ?

I don't think so.  IMO you should register one "Master Volume" as an
int[6]. or maybe you can register three "Master Volume n". Applications
will have problems accessing them anyway :)


--
Giuliano.


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/

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

end of thread, other threads:[~2004-11-29  9:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-25 16:43 Driver Programming Klaus Fetscher
2004-11-26  8:47 ` Giuliano Pochini
2004-11-26 11:39 ` Clemens Ladisch
2004-11-28 22:06   ` Klaus Fetscher
2004-11-29  3:27     ` Paul Davis
2004-11-29  8:37       ` Klaus Fetscher
2004-11-29  9:19         ` Giuliano Pochini

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.