From: "Alexander E. Patrakov" <patrakov@ums.usu.ru>
To: Trent Piepho <xyzzy@speakeasy.org>
Cc: Takashi Iwai <tiwai@suse.de>,
alsa-devel@alsa-project.org, video4linux-list@redhat.com
Subject: Re: mmap support in saa7134-alsa (was: Sample format coversion bug?)
Date: Tue, 30 Oct 2007 21:24:44 +0500 [thread overview]
Message-ID: <47275ACC.5080801@ums.usu.ru> (raw)
In-Reply-To: <Pine.LNX.4.58.0710291141280.16052@shell4.speakeasy.net>
Trent Piepho wrote:
> On Mon, 29 Oct 2007, Alexander E. Patrakov wrote:
>
>> Even though mmap seems to be supported in the driver source (judging
>> from .info = SNDRV_PCM_INFO_MMAP | other flags), I could not figure out
>> the parameters that work. Moreover, the driver seems to accept the same
>> hardware parameters without the mmap, and I could not find parameters
>> that the driver accepts for mmap.
>>
>
> I do not think the saa7134-alsa driver supports mmap. The cx88-alsa driver
> also claimed to support mmap, but it never worked until I fixed it. It's
> pretty clear that the code in saa7134-alsa was based on the same code as
> cx88-alsa, so it's likely it has the same bug.
>
You are right. The patch below (based on your cx88 patch, but I don't
really understand it) fixes mmap support in saa7134-alsa for me.
Recording via mmap (arecord -M -f S16_LE -c 2 -r 32000 -D hw:1) didn't
work at all before, works now, tested for at least 20 minutes (but,
unfortunately, with one overrun at least 0.719 ms long).
Signed-off-by: Alexander E. Patrakov <patrakov@ums.usu.ru>
--- saa7134-alsa.c 2007-10-12 22:43:44.000000000 +0600
+++ saa7134-alsa.c 2007-10-30 21:01:10.000000000 +0500
@@ -544,8 +544,10 @@
V4L functions, and force ALSA to use that as the DMA area */
substream->runtime->dma_area = dev->dmasound.dma.vmalloc;
+ substream->runtime->dma_bytes = dev->dmasound.bufsize;
+ substream->runtime->dma_addr = 0;
- return 1;
+ return 0;
}
@@ -653,6 +655,17 @@
}
/*
+ * page callback (needed for mmap)
+ */
+
+static struct page *snd_card_saa7134_page(struct snd_pcm_substream *substream,
+ unsigned long offset)
+{
+ void *pageptr = substream->runtime->dma_area + offset;
+ return vmalloc_to_page(pageptr);
+}
+
+/*
* ALSA capture callbacks definition
*/
@@ -665,6 +678,7 @@
.prepare = snd_card_saa7134_capture_prepare,
.trigger = snd_card_saa7134_capture_trigger,
.pointer = snd_card_saa7134_capture_pointer,
+ .page = snd_card_saa7134_page,
};
/*
--
Alexander E. Patrakov
next prev parent reply other threads:[~2007-10-30 16:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-26 13:18 Sample format coversion bug? Alexander E. Patrakov
2007-10-29 8:08 ` Takashi Iwai
2007-10-29 11:01 ` Alexander E. Patrakov
2007-10-29 9:05 ` Takashi Iwai
2007-10-29 11:21 ` Alexander E. Patrakov
2007-10-29 15:04 ` Alexander E. Patrakov
2007-10-29 18:47 ` Trent Piepho
2007-10-30 16:24 ` Alexander E. Patrakov [this message]
2007-10-31 8:34 ` mmap support in saa7134-alsa (was: Sample format coversion bug?) Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47275ACC.5080801@ums.usu.ru \
--to=patrakov@ums.usu.ru \
--cc=alsa-devel@alsa-project.org \
--cc=tiwai@suse.de \
--cc=video4linux-list@redhat.com \
--cc=xyzzy@speakeasy.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.