* Card driver: device or resource busy
@ 2011-01-15 18:11 torsten.schenk
2011-01-16 1:13 ` Raymond Yau
2011-01-17 7:46 ` Clemens Ladisch
0 siblings, 2 replies; 3+ messages in thread
From: torsten.schenk @ 2011-01-15 18:11 UTC (permalink / raw)
To: alsa-devel
Hello,
I'm currently developing a driver for a card. PCM playback works so far, I just encountered some playback issues when firefox (flash) and another alsa client wanted to play back at the same time. I figured out that the difference between my driver and existing ones is, that my driver only allows one client and others multiple. I get a "Device or resource busy" when I play back two times the same file (also different ones of course) with mplayer f.ex.
I was able to track this down to the fact, that (only) the O_APPEND Flag is missing in file->f_flags (snd_pcm_attach_substream), but was completely unable to find out where this flag comes from in other drivers.
Another point (perhaps not unrelated to this) is, that I get a bug (see below) that seems to tell me, that prepare cannot schedule. Contrary to the documentation that says that prepare is now non-atomic. It is useful to wait in the prepare function since I need to set the sample rate and wait for a reply (USB device). Before I rewrite it, i wanted to ask about atomicity in prepare on this ML.
Greetings,
Torsten
[ 3662.318321] usb 1-2: unlink qh0-00ff/f69a5300 start 0 [2/0 us]
[ 3662.318434] BUG: scheduling while atomic: aplay/17902/0x00000002
[ 3662.318435] Modules linked in: snd_usb_6fire snd_rawmidi snd_seq_device snd_pcm snd_timer snd soundcore snd_page_alloc nvidia(P) [last unloaded: soundcore]
[ 3662.318443] Pid: 17902, comm: aplay Tainted: P 2.6.36-gentoo-r5 #3
[ 3662.318445] Call Trace:
[ 3662.318448] [<c1025fa0>] __schedule_bug+0x48/0x4d
[ 3662.318451] [<c136f438>] schedule+0x9d/0x6b6
[ 3662.318454] [<c10383f6>] ? __mod_timer+0xf5/0x100
[ 3662.318457] [<c136fc83>] schedule_timeout+0x73/0x90
[ 3662.318460] [<c1037ffe>] ? process_timeout+0x0/0xa
[ 3662.318463] [<fa335622>] pcm_alsa_prepare+0x353/0x3a5 [snd_usb_6fire]
[ 3662.318467] [<c1043121>] ? autoremove_wake_function+0x0/0x2f
[ 3662.318472] [<fa2fb700>] snd_pcm_do_prepare+0xc/0x1c [snd_pcm]
[ 3662.318476] [<fa2fb4d3>] snd_pcm_action_single+0x25/0x4b [snd_pcm]
[ 3662.318481] [<fa2fc4cc>] snd_pcm_action_nonatomic+0x42/0x55 [snd_pcm]
[ 3662.318486] [<fa2fe0c9>] snd_pcm_common_ioctl1+0x379/0xa19 [snd_pcm]
[ 3662.318489] [<c1086437>] ? find_get_page+0x6b/0x74
[ 3662.318492] [<c10259f4>] ? get_parent_ip+0xb/0x31
[ 3662.318497] [<fa2fed24>] snd_pcm_playback_ioctl1+0x2d4/0x2eb [snd_pcm]
[ 3662.318500] [<c1168866>] ? file_has_perm+0x7c/0x85
[ 3662.318505] [<fa2fed5b>] snd_pcm_playback_ioctl+0x20/0x2d [snd_pcm]
[ 3662.318513] [<fa2fed3b>] ? snd_pcm_playback_ioctl+0x0/0x2d [snd_pcm]
[ 3662.318515] [<c10b9e1a>] do_vfs_ioctl+0x43c/0x481
[ 3662.318519] [<c1168a26>] ? selinux_file_ioctl+0x3e/0x41
[ 3662.318522] [<c10b9ea0>] sys_ioctl+0x41/0x61
[ 3662.318525] [<c100278c>] sysenter_do_call+0x12/0x22
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Card driver: device or resource busy
2011-01-15 18:11 Card driver: device or resource busy torsten.schenk
@ 2011-01-16 1:13 ` Raymond Yau
2011-01-17 7:46 ` Clemens Ladisch
1 sibling, 0 replies; 3+ messages in thread
From: Raymond Yau @ 2011-01-16 1:13 UTC (permalink / raw)
To: ALSA Development Mailing List
2011/1/16 torsten.schenk <torsten.schenk@zoho.com>
> Hello,
>
> I'm currently developing a driver for a card. PCM playback works so far, I
> just encountered some playback issues when firefox (flash) and another alsa
> client wanted to play back at the same time. I figured out that the
> difference between my driver and existing ones is, that my driver only
> allows one client and others multiple. I get a "Device or resource busy"
> when I play back two times the same file (also different ones of course)
> with mplayer f.ex.
>
if your sound card 's DSP can mix more than one audio stream, you need to
specify the number of playback streams in snd_pcm_new()
int snd_pcm_new(struct snd_card *card, const char *id, int device,
int playback_count, int capture_count,
struct snd_pcm **rpcm);
otherwise you will need to use a sound server or dmix for software mixing
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Card driver: device or resource busy
2011-01-15 18:11 Card driver: device or resource busy torsten.schenk
2011-01-16 1:13 ` Raymond Yau
@ 2011-01-17 7:46 ` Clemens Ladisch
1 sibling, 0 replies; 3+ messages in thread
From: Clemens Ladisch @ 2011-01-17 7:46 UTC (permalink / raw)
To: torsten.schenk; +Cc: alsa-devel
torsten.schenk wrote:
> I figured out that the difference between my driver and existing ones
> is, that my driver only allows one client and others multiple.
Very few devices can mix streams in hardware.
To get software mixing, you have to add the dmix plugin to the default
device for your card; see alsa-lib/src/conf/cards/.
> Another point (perhaps not unrelated to this) is, that I get a bug
> (see below) that seems to tell me, that prepare cannot schedule.
ALSA doesn't prevent the prepare callback from scheduling, but I'd guess
that your code disables interrupts somewhere.
Regards,
Clemens
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-01-17 7:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-15 18:11 Card driver: device or resource busy torsten.schenk
2011-01-16 1:13 ` Raymond Yau
2011-01-17 7:46 ` Clemens Ladisch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).