Skip to contentSkip to conversation

AC97 slot information

DISCUSSION Russell King - ARM Linux 3 participants 3 messages Nov 29, 2009 – Nov 30, 2009

lore
Share & tools
lore
#0 lore raw

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?

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?

#1 lore raw

At Sun, 29 Nov 2009 16:50:58 +0000,

Quoted 4 lines · Russell King - ARM Linux

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.

Quoted 8 lines

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

#2 lore raw
Quoted 20 lines · Takashi Iwai

At Sun, 29 Nov 2009 16:50:58 +0000,

Quoted 4 lines · Russell King - ARM Linux

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.

Quoted 8 lines

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?

Quoted 7 lines

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?

The slot management is left to the lowlevel driver - see ac97_pcm_defs in intel8x0.c driver for example (all slots are configured in the snd_ac97_pcm_open() call - even if less channels are requested). The cfg value is not used for channel count handling (because we really do not know the ac97 slot -> real channel position mapping in the universal ac97 routines - it depends how the ac97 controller is set). Actually, I don't have any idea to simplify this mapping and if it's worth to add handling of this mapping to the AC97 driver tree.

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.