All of lore.kernel.org
 help / color / mirror / Atom feed
* How to support multiple open in low-level driver
@ 2003-01-03 22:37 Anders Torger
  2003-01-05 14:34 ` Jaroslav Kysela
  0 siblings, 1 reply; 10+ messages in thread
From: Anders Torger @ 2003-01-03 22:37 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: alsa-devel@alsa-project.org


I have noticed that some (most) low level drivers support multiple open, 
that is a sound card which is already opened, can be opened again.

I noticed that also my rme96 driver supported this sort of, although it 
probably does not feel very good about it. If the sound card is in ADAT 
mode, it is not so good if it is reopened in SPDIF mode from another 
application for example.

I'd like to just return -EBUSY if it is already open, is that ok?

/Anders Torger


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

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

* Re: How to support multiple open in low-level driver
  2003-01-03 22:37 How to support multiple open in low-level driver Anders Torger
@ 2003-01-05 14:34 ` Jaroslav Kysela
  2003-01-05 14:48   ` Anders Torger
  0 siblings, 1 reply; 10+ messages in thread
From: Jaroslav Kysela @ 2003-01-05 14:34 UTC (permalink / raw)
  To: Anders Torger; +Cc: alsa-devel@alsa-project.org

On Fri, 3 Jan 2003, Anders Torger wrote:

> I have noticed that some (most) low level drivers support multiple open, 
> that is a sound card which is already opened, can be opened again.

Yes, but hardware must support this feature (it must mix multiple streams 
in hardware and have appropriate amount of DMA engines).

> I noticed that also my rme96 driver supported this sort of, although it 
> probably does not feel very good about it. If the sound card is in ADAT 
> mode, it is not so good if it is reopened in SPDIF mode from another 
> application for example.
> 
> I'd like to just return -EBUSY if it is already open, is that ok?

If you pass value one to snd_pcm_new() - substream counts, then the 
midlevel code takes care about this constraint. No special code is 
required on the driver side.

						Jaroslav

-----
Jaroslav Kysela <perex@suse.cz>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

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

* Re: Re: How to support multiple open in low-level driver
  2003-01-05 14:34 ` Jaroslav Kysela
@ 2003-01-05 14:48   ` Anders Torger
  2003-01-05 15:05     ` Jaroslav Kysela
  2003-01-06 13:57     ` Justin Cormack
  0 siblings, 2 replies; 10+ messages in thread
From: Anders Torger @ 2003-01-05 14:48 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: alsa-devel@alsa-project.org

On Sunday 05 January 2003 15.34, Jaroslav Kysela wrote:
> > I noticed that also my rme96 driver supported this sort of,
> > although it probably does not feel very good about it. If the sound
> > card is in ADAT mode, it is not so good if it is reopened in SPDIF
> > mode from another application for example.
> >
> > I'd like to just return -EBUSY if it is already open, is that ok?
>
> If you pass value one to snd_pcm_new() - substream counts, then the
> midlevel code takes care about this constraint. No special code is
> required on the driver side.

Ok, thanks for the information, you are being most helpful.

I have another question. The rme96 driver provides two sub devices, one 
which is the card in adat mode, and one which is the card in spdif 
mode. These cannot be run at the same time.

If I had written the driver today, I suppose I would have had only one 
device, which supports 2 or 8 channels. Do you agree that it would be a 
better design, than the two sub-devices I have now? I don't think I 
will change that now though, if you don't insist that I should (I think 
it will be quite easy to do the change).

If I keep the two sub-devices, I suppose then returning EBUSY in the 
open function is the correct way if the card is busy running the ADAT 
subdevice when trying to open the SPDIF subdevice (or the other way 
around).

/Anders Torger


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

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

* Re: Re: How to support multiple open in low-level driver
  2003-01-05 14:48   ` Anders Torger
@ 2003-01-05 15:05     ` Jaroslav Kysela
  2003-01-06 14:09       ` Fred Gleason
  2003-01-06 13:57     ` Justin Cormack
  1 sibling, 1 reply; 10+ messages in thread
From: Jaroslav Kysela @ 2003-01-05 15:05 UTC (permalink / raw)
  To: Anders Torger; +Cc: alsa-devel@alsa-project.org

On Sun, 5 Jan 2003, Anders Torger wrote:

> On Sunday 05 January 2003 15.34, Jaroslav Kysela wrote:
> > > I noticed that also my rme96 driver supported this sort of,
> > > although it probably does not feel very good about it. If the sound
> > > card is in ADAT mode, it is not so good if it is reopened in SPDIF
> > > mode from another application for example.
> > >
> > > I'd like to just return -EBUSY if it is already open, is that ok?
> >
> > If you pass value one to snd_pcm_new() - substream counts, then the
> > midlevel code takes care about this constraint. No special code is
> > required on the driver side.
> 
> Ok, thanks for the information, you are being most helpful.
> 
> I have another question. The rme96 driver provides two sub devices, one 
> which is the card in adat mode, and one which is the card in spdif 
> mode. These cannot be run at the same time.
> 
> If I had written the driver today, I suppose I would have had only one 
> device, which supports 2 or 8 channels. Do you agree that it would be a 
> better design, than the two sub-devices I have now? I don't think I 
> will change that now though, if you don't insist that I should (I think 
> it will be quite easy to do the change).
> 
> If I keep the two sub-devices, I suppose then returning EBUSY in the 
> open function is the correct way if the card is busy running the ADAT 
> subdevice when trying to open the SPDIF subdevice (or the other way 
> around).

Well, you're talking about PCM devices (subdevices are one level after 
devices):

cards -> pcm devices -> pcm subdevices

I think that current implementation is good when hardware has S/PDIF and
ADAT outputs completely separate. If S/PDIF can be somehow used
simultaneously in ADAT mode (8 channels) or versa vice, then it would be
better to use only one device with two available channel counts (2 and 8).

Anyway, selecting this implementation detail is completely on the driver's 
author.

						Jaroslav

-----
Jaroslav Kysela <perex@suse.cz>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

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

* Re: Re: How to support multiple open in low-level driver
  2003-01-05 14:48   ` Anders Torger
  2003-01-05 15:05     ` Jaroslav Kysela
@ 2003-01-06 13:57     ` Justin Cormack
  1 sibling, 0 replies; 10+ messages in thread
From: Justin Cormack @ 2003-01-06 13:57 UTC (permalink / raw)
  To: Anders Torger; +Cc: Jaroslav Kysela, alsa-devel@alsa-project.org

On Sun, 2003-01-05 at 14:48, Anders Torger wrote:
> I have another question. The rme96 driver provides two sub devices, one 
> which is the card in adat mode, and one which is the card in spdif 
> mode. These cannot be run at the same time.
> 
> If I had written the driver today, I suppose I would have had only one 
> device, which supports 2 or 8 channels. Do you agree that it would be a 
> better design, than the two sub-devices I have now? I don't think I 
> will change that now though, if you don't insist that I should (I think 
> it will be quite easy to do the change).

It means that you have to define software devices for adat and spdif,
which output always to 8 or 2 channels hw, as the general plughw device
will sometimes open one sometimes the other depending on how many
channels your sound source is. As they are on the same output and most
people only have one kind of DA converter attached this may not be that
convenient. I dont mind the current scheme.

Justin




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

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

* Re: Re: How to support multiple open in low-level driver
  2003-01-05 15:05     ` Jaroslav Kysela
@ 2003-01-06 14:09       ` Fred Gleason
  2003-01-06 14:26         ` Jaroslav Kysela
  0 siblings, 1 reply; 10+ messages in thread
From: Fred Gleason @ 2003-01-06 14:09 UTC (permalink / raw)
  To: alsa-devel@alsa-project.org

On Sunday 05 January 2003 10:05, Jaroslav Kysela wrote:

> Well, you're talking about PCM devices (subdevices are one level after
> devices):
>
> cards -> pcm devices -> pcm subdevices

What are the differences between a "device" and a "subdevice" in general?  Is 
this indicative of some underlying hardware architecture, or is it a purely 
logical/virtual artifact?

Cheers!


|-------------------------------------------------------------------------|
|      Frederick F. Gleason, Jr.      |         Salem Radio Labs          |
|       Voice: 1-(540)-341-2880       |      87 Lee Highway, Suite 11     |
|        FAX: 1-(540)-341-7176        |        Warrenton, VA 20188        |
|-------------------------------------------------------------------------|
|    The real problem with hunting elephants is carrying the decoys.      |
|                                             -- Anonymous                |
|-------------------------------------------------------------------------|



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

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

* Re: Re: How to support multiple open in low-level driver
  2003-01-06 14:09       ` Fred Gleason
@ 2003-01-06 14:26         ` Jaroslav Kysela
  2003-01-06 15:52           ` Patrick Shirkey
  0 siblings, 1 reply; 10+ messages in thread
From: Jaroslav Kysela @ 2003-01-06 14:26 UTC (permalink / raw)
  To: Fred Gleason; +Cc: alsa-devel@alsa-project.org

On Mon, 6 Jan 2003, Fred Gleason wrote:

> On Sunday 05 January 2003 10:05, Jaroslav Kysela wrote:
> 
> > Well, you're talking about PCM devices (subdevices are one level after
> > devices):
> >
> > cards -> pcm devices -> pcm subdevices
> 
> What are the differences between a "device" and a "subdevice" in general?  Is 
> this indicative of some underlying hardware architecture, or is it a purely 
> logical/virtual artifact?

We use subdevices mainly for hardware which can mix several streams 
together. It's quite impractical to have 32 devices with exactly same 
capabilities. The subdevices can be opened without a specific address, so 
the first free subdevice is opened. Also, we temporary use subdevices for 
hardware with alot of streams (I/O connectors) - for example MIDI. There 
are several limits given by used minor numbers (8 PCM devices per card, 8 
MIDI devices per card etc.).

						Jaroslav

-----
Jaroslav Kysela <perex@suse.cz>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

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

* Re: Re: How to support multiple open in low-level driver
  2003-01-06 14:26         ` Jaroslav Kysela
@ 2003-01-06 15:52           ` Patrick Shirkey
  2003-01-06 16:25             ` Paul Davis
  2003-01-06 17:30             ` Jaroslav Kysela
  0 siblings, 2 replies; 10+ messages in thread
From: Patrick Shirkey @ 2003-01-06 15:52 UTC (permalink / raw)
  Cc: alsa-devel@alsa-project.org

Jaroslav Kysela wrote:

> 
> We use subdevices mainly for hardware which can mix several streams 
> together. It's quite impractical to have 32 devices with exactly same 
> capabilities. The subdevices can be opened without a specific address, so 
> the first free subdevice is opened. Also, we temporary use subdevices for 
> hardware with alot of streams (I/O connectors) - for example MIDI. There 
> are several limits given by used minor numbers (8 PCM devices per card, 8 
> MIDI devices per card etc.).
> 

In the interest of correct documentation how is this explained:

hw:0,0

The first zero is the card number?
The second zero is the device number?

What happens for sound devices that are not cards? For example the usb 
quattro.

Up until now I have rationalised it as the first zero is the device, the 
second zero is the subdevice and the number of streams that the 
subdevice can do hardware mixing for would become the subsubdevices.

 From your message above do I understand we should call every sound 
device a sound card.

-- 
Patrick Shirkey - Boost Hardware Ltd.
For the discerning hardware connoisseur
Http://www.boosthardware.com
Http://www.djcj.org - The Linux Audio Users guide
========================================

Being on stage with the band in front of crowds shouting, "Get off! No! 
We want normal music!", I think that was more like acting than anything 
I've ever done.

Goldie, 8 Nov, 2002
The Scotsman



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

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

* Re: Re: How to support multiple open in low-level driver
  2003-01-06 15:52           ` Patrick Shirkey
@ 2003-01-06 16:25             ` Paul Davis
  2003-01-06 17:30             ` Jaroslav Kysela
  1 sibling, 0 replies; 10+ messages in thread
From: Paul Davis @ 2003-01-06 16:25 UTC (permalink / raw)
  To: Patrick Shirkey; +Cc: alsa-devel@alsa-project.org

>In the interest of correct documentation how is this explained:
>
>hw:0,0
>
>The first zero is the card number?
>The second zero is the device number?

the first index is the card number, the second is the device and the
third (rarely used) is the subdevice.

>What happens for sound devices that are not cards? For example the usb 
>quattro.

its still a "card" in the sense that its a specific driver controlling
a specific piece of hardware. perhaps "device" is a better term. it
corresponds to the index shown in /proc/asound/cards.

--p


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

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

* Re: Re: How to support multiple open in low-level driver
  2003-01-06 15:52           ` Patrick Shirkey
  2003-01-06 16:25             ` Paul Davis
@ 2003-01-06 17:30             ` Jaroslav Kysela
  1 sibling, 0 replies; 10+ messages in thread
From: Jaroslav Kysela @ 2003-01-06 17:30 UTC (permalink / raw)
  To: Patrick Shirkey; +Cc: alsa-devel@alsa-project.org

On Tue, 7 Jan 2003, Patrick Shirkey wrote:

> Jaroslav Kysela wrote:
> 
> > 
> > We use subdevices mainly for hardware which can mix several streams 
> > together. It's quite impractical to have 32 devices with exactly same 
> > capabilities. The subdevices can be opened without a specific address, so 
> > the first free subdevice is opened. Also, we temporary use subdevices for 
> > hardware with alot of streams (I/O connectors) - for example MIDI. There 
> > are several limits given by used minor numbers (8 PCM devices per card, 8 
> > MIDI devices per card etc.).
> > 
> 
> In the interest of correct documentation how is this explained:
> 
> hw:0,0
> 
> The first zero is the card number?
> The second zero is the device number?
> 
> What happens for sound devices that are not cards? For example the usb 
> quattro.
> 
> Up until now I have rationalised it as the first zero is the device, the 
> second zero is the subdevice and the number of streams that the 
> subdevice can do hardware mixing for would become the subsubdevices.
> 
>  From your message above do I understand we should call every sound 
> device a sound card.

Yes, it might be confusing, but subsubdevice is not very good term. A card 
is in my eyes a compact hardware unit with several sound related devices.

						Jaroslav

-----
Jaroslav Kysela <perex@suse.cz>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

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

end of thread, other threads:[~2003-01-06 17:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-03 22:37 How to support multiple open in low-level driver Anders Torger
2003-01-05 14:34 ` Jaroslav Kysela
2003-01-05 14:48   ` Anders Torger
2003-01-05 15:05     ` Jaroslav Kysela
2003-01-06 14:09       ` Fred Gleason
2003-01-06 14:26         ` Jaroslav Kysela
2003-01-06 15:52           ` Patrick Shirkey
2003-01-06 16:25             ` Paul Davis
2003-01-06 17:30             ` Jaroslav Kysela
2003-01-06 13:57     ` Justin Cormack

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.