All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@intel.com>
To: Dylan Reid <dgreid@google.com>
Cc: Oder Chiou <oder_chiou@realtek.com>, Takashi Iwai <tiwai@suse.de>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	Mark Brown <broonie@kernel.org>
Subject: Re: Streaming wake-up buffer from DSP to SoC over SPI
Date: Tue, 16 Dec 2014 10:11:15 +0530	[thread overview]
Message-ID: <20141216044115.GU16827@intel.com> (raw)
In-Reply-To: <CAEUnVG6n15vNYgZoZXzRZvgAqej1Lb3bHDEy9cyQ+UCJbuv2kg@mail.gmail.com>

On Mon, Dec 15, 2014 at 06:45:37PM -0800, Dylan Reid wrote:
> What is the right way to model a bursty, SPI based audio transfer?
> There could be hours between samples, then several seconds of audio
> will be ready.
> 
> The codec, an rt5677, is attached to the SoC with both an IIS bus and
> a SPI bus.  The IIS bus is used for normal audio playback and record.
> The SPI bus is used for transferring audio that caused a voice wake,
> "OK Google" in this case.
> 
> When the codec detects the wake up phrase, the SoC will read out two
> plus seconds of buffered data over the SPI bus and continue to stream
> audio data over SPI for the rest of the query.  Nexus 9 has a custom
> ioctl to access rt5677-spi and some user-space smarts to poll for more
> data.
why do we need custom ioctls :( current framework can address all your
needs..

> I was thinking of making a separate PCM device.  The odd things are
> that it would have to originate from soc/codecs, the codec would own
> the codec and cpu end of the link, and the hw_ptr position would need
> to be queried over SPI.  But it would make userspace access to it more
> standard looking.
okay here we have two things and they need to be decoupled. First is
detection by the codec for "OK Google". And second is getting the data (some
buffered while things are setup) to usermode.

For the former, the codec should implement a 'sink' for voice wake, so
essentially connecting the voice wake widget to MIC pins will power up codec
and codec can do the detection while rest of the system is sleeping

Once the event is detected, codec should send an interrupt to host, thereby
waking up the system. The driver will figure out that it is voice wake event
and should set the alsa kcontrol status, on which usermode needs to listen.

Now usermode knows the event occurred so lets read the data. During all the
activation, wakeup etc some data would be buffered, in you case 2 secs. IMO
PCM devices aren't suited for this, so you need to use a compressed device.
The data can come from SPI port (we can get all the buffered data in one big
burst". I know one vendor has implemented such a mechanism.

The device here wont be any different than regular PCM/Compressed devices.
Assume the data path is SPI rather than I2S so things would be modelled that
way. You still need to setup SPI port, DMAs like you would do on I2S.

HTH
-- 
~Vinod

  reply	other threads:[~2014-12-16  4:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-16  2:45 Streaming wake-up buffer from DSP to SoC over SPI Dylan Reid
2014-12-16  4:41 ` Vinod Koul [this message]
2014-12-16  8:16   ` Dylan Reid
2014-12-16 11:40     ` Mark Brown
2014-12-16 11:42 ` Mark Brown

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=20141216044115.GU16827@intel.com \
    --to=vinod.koul@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=dgreid@google.com \
    --cc=oder_chiou@realtek.com \
    --cc=tiwai@suse.de \
    /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.