Driver Programming
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/
Quoted 3 lines · 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/
Quoted 8 lines · Klaus Fetscher
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.
Quoted 2 lines
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/
Thanks Clemens and Giuliano for the answers !
Quoted 5 lines
Quoted 5 lines
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.
Quoted 10 lines
Quoted 5 lines
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.
Quoted 10 lines
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/
Quoted 1 line
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/
Quoted 8 lines · Paul Davis
Quoted 3 lines
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/
Quoted 8 lines · Klaus Fetscher
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 parameterONE_INis 0 (because I only have three output channels and two input channels).When I list the
/proc/asound/card0directory, I can see pcm0c, pcm1c, pcm0p, pcm1p, pcm2p. And withsubstream->pcm->deviceI 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).
Quoted 3 lines
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/