From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: Ankhit Vivekananda <ankhit.vivekananda@biscotti.com>,
alsa-devel@alsa-project.org
Subject: Re: Discarding the first few frames inside the kernel
Date: Tue, 19 Jan 2016 11:22:54 +0900 [thread overview]
Message-ID: <569D9DFE.5000503@sakamocchi.jp> (raw)
In-Reply-To: <CACaQK7CtpKQK_j5q+F6ekK_j+w3SLQ=RQ0yR76+81ETvsg1Qdg@mail.gmail.com>
Hi,
On Jan 19 2016 03:21, Ankhit Vivekananda wrote:
> I am interfacing the ICS43432 MEMS microphone with McBSP interface. The
> data sheet of the ICS43432 microphone shows that it takes about 4.5ms
> (16kHz sampling rate) for startup. Because of this, I hear a transient
> noise at the beginning of every stream. Is there in any way I can discard
> the frames inside the kernel space itself before reading the samples using
> snd_pcm_readi() call?
>
> I was able to mute the first few frames after the readi() call, but would
> want to know if I could do it before the readi() call itself inside the
> kernel space.
If the data transmission starts in 'struct snd_pcm_ops.prepare' callback
of the driver, we can wait what we want, because ALSA PCM core
guarantees to call it in process context.
In userspace, this looks like (here I describe in alsa-lib API):
- calling snd_pcm_hw_params()
- snd_pcm_prepare() is called library internal
* struct snd_pcm_ops.prepare() is called in kernel mode.
* mute
* start data transmission
* wait for the 4.5ms or somewhat
* return
* return
- return
- PCM frame operation such as snd_pcm_writei()
* snd_pcm_ops.trigger(TRIGGER_START) is called in kernel mode.
* demute
* PCM frames starts to be transferred from userspace.
Regards
Takashi Sakamoto
next prev parent reply other threads:[~2016-01-19 2:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-18 18:21 Discarding the first few frames inside the kernel Ankhit Vivekananda
2016-01-19 2:22 ` Takashi Sakamoto [this message]
2016-01-20 17:24 ` Ankhit Vivekananda
2016-01-21 2:18 ` Takashi Sakamoto
2016-01-21 16:28 ` Ankhit Vivekananda
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=569D9DFE.5000503@sakamocchi.jp \
--to=o-takashi@sakamocchi.jp \
--cc=alsa-devel@alsa-project.org \
--cc=ankhit.vivekananda@biscotti.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox