OSDN Git Service

ASoC: rt5677: Add a PCM device for streaming hotword via SPI
authorBen Zhang <benzh@chromium.org>
Fri, 18 Oct 2019 20:04:38 +0000 (13:04 -0700)
committerMark Brown <broonie@kernel.org>
Tue, 22 Oct 2019 16:55:16 +0000 (17:55 +0100)
commita0e0d135427cf699fe2dee77da0924e0b47f3170
tree1f45a46e942304e18a7ad11fd5490b570c76c8c3
parentb2d6ee75312649d55b41386d1d80cdbca48e3cf0
ASoC: rt5677: Add a PCM device for streaming hotword via SPI

This patch implements a PCM interface for streaming hotword
phrases over SPI. Userspace can open the PCM device at anytime.
The stream is blocked when no hotword is detected. The mic
audio buffer on the DSP is a ~128KByte ring buffer that holds
~4sec of audio samples recorded from the DMIC (S16_LE, mono,
16KHz). After a hotword is detected, previous 2 seconds of audio
(containing the detected hotword) is streamed first, then live
capture continues until userspace closes the PCM stream.

When transferring, copy one period at a time then call
snd_pcm_period_elapsed(). This reduces the latency of transferring
the initial ~2sec of audio after hotword detect since audio samples
are available for userspace earlier.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Link: https://lore.kernel.org/r/20191018200449.141123-2-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/rt5677-spi.c
sound/soc/codecs/rt5677-spi.h