At Sun, 29 Nov 2009 16:50:58 +0000, Russell King - ARM Linux wrote:
When opening an AC'97 codec under ALSA using snd_ac97_pcm_open(), specifying the number of channels desired (2, 4 or 6) is there a way to read back which slots will be in use?
Hm, a quick look through the code, there seems no such way right now. Actually, slots subsets are determined in snd_ac97_pcm_assign(), and the open function just accepts the reduced slots in there.
Currently, in the AACI driver, I use a lookup table to convert from channels to a slot mask - if this information is already available from ALSA, I'd much rather use it rather than inventing keeping my own solution.
Also, should the 'slots' value passed to snd_ac97_pcm_open() be those in pcm->r[].slots or should it be selected from the number of channels?
pcm->r[].slots, I suppose. Well, but snd_ac97_pcm_open() behaves a bit differently from what I thought. It doesn't check cfg value (usually the number of channels (2, 4 or 6) is passed) to reduce the assigned slots, so it'll try always the full slots. Then reducing the slots bits in the caller look mandatory right now...
Jaroslav, is it the intended behavior, or just a missing piece?
thanks,
Takashi