ASoC: wm_adsp: Specifically propagate voice trigger event to caller
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Fri, 13 May 2016 15:45:17 +0000 (16:45 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 30 May 2016 15:14:59 +0000 (16:14 +0100)
The DSP uses an IRQ to indicate data is available on the compressed
stream. For voice trigger use-cases the first such IRQ can be considered
an indication that the user has spoken the key phrase triggering the
firmware. Provide a means for the ADSP code to communicate back to the
calling driver whether an IRQ should be considered as trigger event or
not.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/wm_adsp.c
sound/soc/codecs/wm_adsp.h

index a07bd7c..378ec30 100644 (file)
@@ -394,6 +394,7 @@ static const struct {
        int compr_direction;
        int num_caps;
        const struct wm_adsp_fw_caps *caps;
+       bool voice_trigger;
 } wm_adsp_fw[WM_ADSP_NUM_FW] = {
        [WM_ADSP_FW_MBC_VSS] =  { .file = "mbc-vss" },
        [WM_ADSP_FW_HIFI] =     { .file = "hifi" },
@@ -406,6 +407,7 @@ static const struct {
                .compr_direction = SND_COMPRESS_CAPTURE,
                .num_caps = ARRAY_SIZE(ctrl_caps),
                .caps = ctrl_caps,
+               .voice_trigger = true,
        },
        [WM_ADSP_FW_ASR] =      { .file = "asr" },
        [WM_ADSP_FW_TRACE] =    {
@@ -2998,6 +3000,9 @@ int wm_adsp_compr_handle_irq(struct wm_adsp *dsp)
                goto out;
        }
 
+       if (wm_adsp_fw[dsp->fw].voice_trigger && buf->irq_count == 2)
+               ret = WM_ADSP_COMPR_VOICE_TRIGGER;
+
 out_notify:
        if (compr && compr->stream)
                snd_compr_fragment_elapsed(compr->stream);
index feb61e2..be3b5bc 100644 (file)
 
 #include "wmfw.h"
 
+/* Return values for wm_adsp_compr_handle_irq */
+#define WM_ADSP_COMPR_OK                 0
+#define WM_ADSP_COMPR_VOICE_TRIGGER      1
+
 struct wm_adsp_region {
        int type;
        unsigned int base;