On Tue, 2006-03-28 at 15:36 +0200, Takashi Iwai wrote: > > Because the pcm is created by my i2s bus driver (which knows it can only > > have one pcm per i2s bus). > > What do you mean one pcm? One PCM substream, one-directional stream, > or both one pcm instance containing playback and capture streams? I can have at most one pcm instance containing one playback and one capture stream per i2s bus. > The question is rather the flow of creation. > Usually, the registration occurs at the very last of initialization > stage, i.e. all devices are probed and initialized to be ready for > use. Then the driver calls register function. > > If the registration _must_ be done dynamically, one by one, the > situation becomes a bit more complicated. It's not only to the driver > but to the user-space things. Yes. It must be done dynamically. > > Right now it's even more broken requiring me to create both the playback > > and capture stream without knowing if there's anything on the bus that > > can handle it. > > You don't have to create an empty PCM, but create a PCM on demand, as > usbaudio.c does. It doesn't create both streams. Right. Let me explain the control flow: First, i2s busses are discovered, but no pcm instances created for them yet. Then, codecs are discovered, and each on registers with the i2s bus it sits on. At that point, the codec could support input only, and it announces this to the i2s bus. Thus, the i2s bus creates a pcm with just a capture stream, and registers it. Now, another codec is discovered, and it is on the same i2s bus, but supports playback and capture. Now, my i2s layer handles switching between which one of them gets to capture, so that's fine, but when I now try to add a playback stream to my pcm, this playback stream never shows up. [the actual situation is slightly different, but this serves well to illustrate it and might actually happen this way in the future] Now, I cannot defer registration of the pcm until the second codec is discovered because there's no way to know if a second codec even exists, and even if it exists if the user compiled the module for it. johannes