Add support for trigger only voice recognition
Subsystems (6)
PATCH 3/5 ASoC: wm_adsp: Specifically propagate voice trigger event to caller
In reply to Charles KeepaxThe 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.
--- sound/soc/codecs/wm_adsp.c | 5 +++++ sound/soc/codecs/wm_adsp.h | 4 ++++ 2 files changed, 9 insertions(+)
sound/soc/codecs/wm_adsp.c +5 -0
@@ -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);
sound/soc/codecs/wm_adsp.h +4 -0
@@ -19,6 +19,10 @@#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;
Signature · 1 line
2.1.4
PATCH 4/5 ASoC: arizona: Add a notifier chain for CODEC events
In reply to Charles KeepaxAdd a notifier chain that can be used from the machine driver to catch events generated by the CODEC.
--- include/linux/mfd/arizona/core.h | 10 ++++++++++ sound/soc/codecs/arizona.c | 35 +++++++++++++++++++++++++++++++++++ sound/soc/codecs/arizona.h | 10 ++++++++++ sound/soc/codecs/cs47l24.c | 1 + sound/soc/codecs/wm5110.c | 1 + 5 files changed, 57 insertions(+)
include/linux/mfd/arizona/core.h +10 -0
@@ -14,6 +14,7 @@#define _WM_ARIZONA_CORE_H#include <linux/interrupt.h> +#include <linux/notifier.h> #include <linux/regmap.h> #include <linux/regulator/consumer.h> #include <linux/mfd/arizona/pdata.h>
@@ -148,8 +149,17 @@ struct arizona {uint16_t dac_comp_coeff;uint8_t dac_comp_enabled;struct mutex dac_comp_lock; + +struct blocking_notifier_head notifier; }; +static inline int arizona_call_notifiers (struct arizona *arizona, +unsigned long event, +void *data) +{ +return blocking_notifier_call_chain (&arizona->notifier, event, data); +} +int arizona_clk32k_enable (struct arizona *arizona);int arizona_clk32k_disable (struct arizona *arizona);
sound/soc/codecs/arizona.c +35 -0
@@ -324,6 +324,17 @@ int arizona_init_gpio(struct snd_soc_codec *codec) }EXPORT_SYMBOL_GPL (arizona_init_gpio); +int arizona_init_notifiers (struct snd_soc_codec *codec) +{ +struct arizona_priv *priv =snd_soc_codec_get_drvdata (codec); +struct arizona *arizona = priv->arizona; + +BLOCKING_INIT_NOTIFIER_HEAD (&arizona->notifier); + +return 0 ; +} +EXPORT_SYMBOL_GPL (arizona_init_notifiers); +const char *const arizona_mixer_texts[ARIZONA_NUM_MIXER_INPUTS ] = {"None" ,"Tone Generator 1" ,
@@ -2581,6 +2592,30 @@ int arizona_lhpf_coeff_put(struct snd_kcontrol *kcontrol, }EXPORT_SYMBOL_GPL (arizona_lhpf_coeff_put); +int arizona_register_notifier (struct snd_soc_codec *codec, +struct notifier_block *nb, +int (*notify)(struct notifier_block *nb, +unsigned long action,void *data)) +{ +struct arizona_priv *priv =snd_soc_codec_get_drvdata (codec); +struct arizona *arizona = priv->arizona; + + nb->notifier_call = notify; + +return blocking_notifier_chain_register (&arizona->notifier, nb); +} +EXPORT_SYMBOL_GPL (arizona_register_notifier); + +int arizona_unregister_notifier (struct snd_soc_codec *codec, +struct notifier_block *nb) +{ +struct arizona_priv *priv =snd_soc_codec_get_drvdata (codec); +struct arizona *arizona = priv->arizona; + +return blocking_notifier_chain_unregister (&arizona->notifier, nb); +} +EXPORT_SYMBOL_GPL (arizona_unregister_notifier); +MODULE_DESCRIPTION ("ASoC Wolfson Arizona class device support" );MODULE_AUTHOR ("Mark Brown <[email protected]>" );MODULE_LICENSE ("GPL" );
sound/soc/codecs/arizona.h +10 -0
@@ -308,6 +308,7 @@ extern int arizona_set_fll(struct arizona_fll *fll, int source,extern int arizona_init_spk (struct snd_soc_codec *codec);extern int arizona_init_gpio (struct snd_soc_codec *codec);extern int arizona_init_mono (struct snd_soc_codec *codec); +extern int arizona_init_notifiers (struct snd_soc_codec *codec);extern int arizona_free_spk (struct snd_soc_codec *codec);
@@ -319,4 +320,13 @@ int arizona_set_output_mode(struct snd_soc_codec *codec, int output,extern bool arizona_input_analog (struct snd_soc_codec *codec,int shift);extern const char *arizona_sample_rate_val_to_name (unsigned int rate_val); + +extern int arizona_register_notifier (struct snd_soc_codec *codec, +struct notifier_block *nb, +int (*notify)(struct notifier_block *nb, +unsigned long action, +void *data)); +extern int arizona_unregister_notifier (struct snd_soc_codec *codec, +struct notifier_block *nb); +#endif
sound/soc/codecs/cs47l24.c +1 -0
@@ -1107,6 +1107,7 @@ static int cs47l24_codec_probe(struct snd_soc_codec *codec)arizona_init_spk (codec);arizona_init_gpio (codec);arizona_init_mono (codec); +arizona_init_notifiers (codec); ret = arizona_request_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, "ADSP2 Compressed IRQ", cs47l24_adsp2_irq,
sound/soc/codecs/wm5110.c +1 -0
@@ -2262,6 +2262,7 @@ static int wm5110_codec_probe(struct snd_soc_codec *codec)arizona_init_spk (codec);arizona_init_gpio (codec);arizona_init_mono (codec); +arizona_init_notifiers (codec); ret = arizona_request_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, "ADSP2 Compressed IRQ", wm5110_adsp2_irq,
Signature · 1 line
2.1.4
PATCH 5/5 ASoC: arizona: Add event notification on voice trigger events
In reply to Charles KeepaxInform the notifier chain if the DSP recognises a voice trigger.
--- sound/soc/codecs/arizona.h | 3 +++ sound/soc/codecs/cs47l24.c | 4 ++++ sound/soc/codecs/wm5110.c | 4 ++++ 3 files changed, 11 insertions(+)
sound/soc/codecs/arizona.h +3 -0
@@ -63,6 +63,9 @@#define ARIZONA_DVFS_SR1_RQ 0x001#define ARIZONA_DVFS_ADSP1_RQ 0x100 +/* Notifier events */ +#define ARIZONA_NOTIFY_VOICE_TRIGGER 0x1 +struct arizona ;struct wm_adsp ;
sound/soc/codecs/cs47l24.c +4 -0
@@ -1085,6 +1085,10 @@ static irqreturn_t cs47l24_adsp2_irq(int irq, void *data) ret =wm_adsp_compr_handle_irq (&priv->core.adsp[i]);if (ret != -ENODEV ) serviced++; +if (ret ==WM_ADSP_COMPR_VOICE_TRIGGER ) +arizona_call_notifiers (arizona, +ARIZONA_NOTIFY_VOICE_TRIGGER , + (void *)i); }if (!serviced) {
sound/soc/codecs/wm5110.c +4 -0
@@ -2240,6 +2240,10 @@ static irqreturn_t wm5110_adsp2_irq(int irq, void *data) ret =wm_adsp_compr_handle_irq (&priv->core.adsp[i]);if (ret != -ENODEV ) serviced++; +if (ret ==WM_ADSP_COMPR_VOICE_TRIGGER ) +arizona_call_notifiers (arizona, +ARIZONA_NOTIFY_VOICE_TRIGGER , + (void *)i); }if (!serviced) {
Signature · 1 line
2.1.4
PATCH 1/5 ASoC: arizona: Tie SYSCLK to DRC signal activity widgets
In reply to Charles KeepaxThe intent is for SYSCLK to be tied to all input and output widgets such that it turns on whenever the chip is in use. It is not tied to the DRC signal activity detect virtual outputs, whilst in practice this is unlikely to cause an issue (as an input will likely also be powered up) best to correct.
--- sound/soc/codecs/cs47l24.c | 2 ++ sound/soc/codecs/wm5102.c | 1 + sound/soc/codecs/wm5110.c | 2 ++ sound/soc/codecs/wm8998.c | 1 + 4 files changed, 6 insertions(+)
sound/soc/codecs/cs47l24.c +2 -0
@@ -899,6 +899,8 @@ static const struct snd_soc_dapm_route cs47l24_dapm_routes[] = { { "MICSUPP", NULL, "SYSCLK" }, + { "DRC1 Signal Activity", NULL, "SYSCLK" }, + { "DRC2 Signal Activity", NULL, "SYSCLK" }, { "DRC1 Signal Activity", NULL, "DRC1L" }, { "DRC1 Signal Activity", NULL, "DRC1R" }, { "DRC2 Signal Activity", NULL, "DRC2L" },
sound/soc/codecs/wm5102.c +1 -0
@@ -1713,6 +1713,7 @@ static const struct snd_soc_dapm_route wm5102_dapm_routes[] = { { "MICSUPP", NULL, "SYSCLK" }, + { "DRC1 Signal Activity", NULL, "SYSCLK" }, { "DRC1 Signal Activity", NULL, "DRC1L" }, { "DRC1 Signal Activity", NULL, "DRC1R" }, };
sound/soc/codecs/wm5110.c +2 -0
@@ -1997,6 +1997,8 @@ static const struct snd_soc_dapm_route wm5110_dapm_routes[] = { { "MICSUPP", NULL, "SYSCLK" }, + { "DRC1 Signal Activity", NULL, "SYSCLK" }, + { "DRC2 Signal Activity", NULL, "SYSCLK" }, { "DRC1 Signal Activity", NULL, "DRC1L" }, { "DRC1 Signal Activity", NULL, "DRC1R" }, { "DRC2 Signal Activity", NULL, "DRC2L" },
sound/soc/codecs/wm8998.c +1 -0
@@ -1166,6 +1166,7 @@ static const struct snd_soc_dapm_route wm8998_dapm_routes[] = { { "MICSUPP", NULL, "SYSCLK" }, + { "DRC1 Signal Activity", NULL, "SYSCLK" }, { "DRC1 Signal Activity", NULL, "DRC1L" }, { "DRC1 Signal Activity", NULL, "DRC1R" }, };
Signature · 1 line
2.1.4
cover Add support for trigger only voice recognition
In some systems our voice trigger firmwares will be used only to provide an event that indicates the trigger phrase was spoken, this patch chain adds support for this use-case. There are two parts to adding this support firstly, a mechanism is required to get the DSP to power on without the compressed stream being opened, this is done by means of a virtual output for the voice trigger in the DAPM graph. Secondly, the trigger event needs to be handled. Typically this will be used to generate a key press event, but there are numerous options what could be done here, and vendors often have their own rather strong opinions. Rather than dictate the usage at the driver level we we simply provide a notifier that can be caught in the machine driver and appropriate action can be taken there.
Thanks,
Charles
Charles Keepax (5):
ASoC: arizona: Tie SYSCLK to DRC signal activity widgets
ASoC: arizona: Add voice trigger output widget
ASoC: wm_adsp: Specifically propagate voice trigger event to caller
ASoC: arizona: Add a notifier chain for CODEC events
ASoC: arizona: Add event notification on voice trigger events
include/linux/mfd/arizona/core.h | 10 ++++++++++ sound/soc/codecs/arizona.c | 43 ++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/arizona.h | 15 ++++++++++++++ sound/soc/codecs/cs47l24.c | 16 +++++++++++++++ sound/soc/codecs/wm5102.c | 1 + sound/soc/codecs/wm5110.c | 16 +++++++++++++++ sound/soc/codecs/wm8998.c | 1 + sound/soc/codecs/wm_adsp.c | 5 +++++ sound/soc/codecs/wm_adsp.h | 4 ++++ 9 files changed, 111 insertions(+)
Signature · 1 line
2.1.4
PATCH 2/5 ASoC: arizona: Add voice trigger output widget
In some situations the voice control firmware will by used to only provide a trigger notification event. In this case a compressed stream will not be opened by user-space, as such we need to provide a virtual output to power on the DSP in this use-case. This patch adds a virtual output 'DSP Voice Trigger' that can be used for this, and a switch that lets it be connected to the core when required.
--- sound/soc/codecs/arizona.c | 8 ++++++++ sound/soc/codecs/arizona.h | 2 ++ sound/soc/codecs/cs47l24.c | 9 +++++++++ sound/soc/codecs/wm5110.c | 9 +++++++++ 4 files changed, 28 insertions(+)
sound/soc/codecs/arizona.c +8 -0
@@ -810,6 +810,14 @@ const struct soc_enum arizona_output_anc_src[] = { };EXPORT_SYMBOL_GPL (arizona_output_anc_src); +const struct snd_kcontrol_new arizona_voice_trigger_switch[] = { +SOC_DAPM_SINGLE ("Switch" ,SND_SOC_NOPM ,0 ,1 ,0 ), +SOC_DAPM_SINGLE ("Switch" ,SND_SOC_NOPM ,1 ,1 ,0 ), +SOC_DAPM_SINGLE ("Switch" ,SND_SOC_NOPM ,2 ,1 ,0 ), +SOC_DAPM_SINGLE ("Switch" ,SND_SOC_NOPM ,3 ,1 ,0 ), +}; +EXPORT_SYMBOL_GPL (arizona_voice_trigger_switch); +static void arizona_in_set_vu (struct snd_soc_codec *codec,int ena) {struct arizona_priv *priv =snd_soc_codec_get_drvdata (codec);
sound/soc/codecs/arizona.h +2 -0
@@ -248,6 +248,8 @@ extern const struct soc_enum arizona_anc_input_src[];extern const struct soc_enum arizona_anc_ng_enum;extern const struct soc_enum arizona_output_anc_src[]; +extern const struct snd_kcontrol_new arizona_voice_trigger_switch[]; +extern int arizona_in_ev (struct snd_soc_dapm_widget *w,struct snd_kcontrol *kcontrol,int event);
sound/soc/codecs/cs47l24.c +9 -0
@@ -359,6 +359,11 @@ SND_SOC_DAPM_INPUT("IN2R"),SND_SOC_DAPM_OUTPUT ("DRC1 Signal Activity" ),SND_SOC_DAPM_OUTPUT ("DRC2 Signal Activity" ), +SND_SOC_DAPM_OUTPUT ("DSP Voice Trigger" ), + +SND_SOC_DAPM_SWITCH ("DSP3 Voice Trigger" ,SND_SOC_NOPM ,2 ,0 , + &arizona_voice_trigger_switch[2 ]), + SND_SOC_DAPM_PGA_E("IN1L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1L_ENA_SHIFT, 0, NULL, 0, arizona_in_ev, SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
@@ -905,6 +910,10 @@ static const struct snd_soc_dapm_route cs47l24_dapm_routes[] = { { "DRC1 Signal Activity", NULL, "DRC1R" }, { "DRC2 Signal Activity", NULL, "DRC2L" }, { "DRC2 Signal Activity", NULL, "DRC2R" }, + + { "DSP Voice Trigger", NULL, "SYSCLK" }, + { "DSP Voice Trigger", NULL, "DSP3 Voice Trigger" }, + { "DSP3 Voice Trigger", "Switch", "DSP3" }, }; static int cs47l24_set_fll(struct snd_soc_codec *codec, int fll_id, int source,
sound/soc/codecs/wm5110.c +9 -0
@@ -1104,6 +1104,11 @@ SND_SOC_DAPM_INPUT("IN4R"),SND_SOC_DAPM_OUTPUT ("DRC1 Signal Activity" ),SND_SOC_DAPM_OUTPUT ("DRC2 Signal Activity" ), +SND_SOC_DAPM_OUTPUT ("DSP Voice Trigger" ), + +SND_SOC_DAPM_SWITCH ("DSP3 Voice Trigger" ,SND_SOC_NOPM ,2 ,0 , + &arizona_voice_trigger_switch[2 ]), + SND_SOC_DAPM_PGA_E("IN1L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1L_ENA_SHIFT, 0, NULL, 0, wm5110_in_ev, SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
@@ -2003,6 +2008,10 @@ static const struct snd_soc_dapm_route wm5110_dapm_routes[] = { { "DRC1 Signal Activity", NULL, "DRC1R" }, { "DRC2 Signal Activity", NULL, "DRC2L" }, { "DRC2 Signal Activity", NULL, "DRC2R" }, + + { "DSP Voice Trigger", NULL, "SYSCLK" }, + { "DSP Voice Trigger", NULL, "DSP3 Voice Trigger" }, + { "DSP3 Voice Trigger", "Switch", "DSP3" }, }; static int wm5110_set_fll(struct snd_soc_codec *codec, int fll_id, int source,
Signature · 1 line
2.1.4
Mark Brown
maintainerApplied "ASoC: arizona: Tie SYSCLK to DRC signal activity widgets" to the asoc tree
In reply to Charles KeepaxThe patch
ASoC: arizona: Tie SYSCLK to DRC signal activity widgets
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
399e1f25ef9a2b8fc4e55fadb696131f9d92f577Mon Sep 17 00:00:00 2001
From: Charles Keepax <[email protected]>
Date: Fri, 13 May 2016 16:45:15 +0100
Subject: [PATCH] ASoC: arizona: Tie SYSCLK to DRC signal activity widgets
The intent is for SYSCLK to be tied to all input and output widgets such that it turns on whenever the chip is in use. It is not tied to the DRC signal activity detect virtual outputs, whilst in practice this is unlikely to cause an issue (as an input will likely also be powered up) best to correct.
--- sound/soc/codecs/cs47l24.c | 2 ++ sound/soc/codecs/wm5102.c | 1 + sound/soc/codecs/wm5110.c | 2 ++ sound/soc/codecs/wm8998.c | 1 + 4 files changed, 6 insertions(+)
sound/soc/codecs/cs47l24.c +2 -0
@@ -896,6 +896,8 @@ static const struct snd_soc_dapm_route cs47l24_dapm_routes[] = { { "MICSUPP", NULL, "SYSCLK" }, + { "DRC1 Signal Activity", NULL, "SYSCLK" }, + { "DRC2 Signal Activity", NULL, "SYSCLK" }, { "DRC1 Signal Activity", NULL, "DRC1L" }, { "DRC1 Signal Activity", NULL, "DRC1R" }, { "DRC2 Signal Activity", NULL, "DRC2L" },
sound/soc/codecs/wm5102.c +1 -0
@@ -1713,6 +1713,7 @@ static const struct snd_soc_dapm_route wm5102_dapm_routes[] = { { "MICSUPP", NULL, "SYSCLK" }, + { "DRC1 Signal Activity", NULL, "SYSCLK" }, { "DRC1 Signal Activity", NULL, "DRC1L" }, { "DRC1 Signal Activity", NULL, "DRC1R" }, };
sound/soc/codecs/wm5110.c +2 -0
@@ -1997,6 +1997,8 @@ static const struct snd_soc_dapm_route wm5110_dapm_routes[] = { { "MICSUPP", NULL, "SYSCLK" }, + { "DRC1 Signal Activity", NULL, "SYSCLK" }, + { "DRC2 Signal Activity", NULL, "SYSCLK" }, { "DRC1 Signal Activity", NULL, "DRC1L" }, { "DRC1 Signal Activity", NULL, "DRC1R" }, { "DRC2 Signal Activity", NULL, "DRC2L" },
sound/soc/codecs/wm8998.c +1 -0
@@ -1166,6 +1166,7 @@ static const struct snd_soc_dapm_route wm8998_dapm_routes[] = { { "MICSUPP", NULL, "SYSCLK" }, + { "DRC1 Signal Activity", NULL, "SYSCLK" }, { "DRC1 Signal Activity", NULL, "DRC1L" }, { "DRC1 Signal Activity", NULL, "DRC1R" }, };
Signature · 1 line
2.8.1
Mark Brown
maintainerApplied "ASoC: arizona: Add voice trigger output widget" to the asoc tree
In reply to Charles KeepaxThe patch
ASoC: arizona: Add voice trigger output widget
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
c35d447b7aefefc1062af1a7d3621fc877599257Mon Sep 17 00:00:00 2001
From: Charles Keepax <[email protected]>
Date: Fri, 13 May 2016 16:45:16 +0100
Subject: [PATCH] ASoC: arizona: Add voice trigger output widget
In some situations the voice control firmware will by used to only provide a trigger notification event. In this case a compressed stream will not be opened by user-space, as such we need to provide a virtual output to power on the DSP in this use-case. This patch adds a virtual output 'DSP Voice Trigger' that can be used for this, and a switch that lets it be connected to the core when required.
--- sound/soc/codecs/arizona.c | 8 ++++++++ sound/soc/codecs/arizona.h | 2 ++ sound/soc/codecs/cs47l24.c | 9 +++++++++ sound/soc/codecs/wm5110.c | 9 +++++++++ 4 files changed, 28 insertions(+)
sound/soc/codecs/arizona.c +8 -0
@@ -798,6 +798,14 @@ const struct soc_enum arizona_output_anc_src[] = { };EXPORT_SYMBOL_GPL (arizona_output_anc_src); +const struct snd_kcontrol_new arizona_voice_trigger_switch[] = { +SOC_DAPM_SINGLE ("Switch" ,SND_SOC_NOPM ,0 ,1 ,0 ), +SOC_DAPM_SINGLE ("Switch" ,SND_SOC_NOPM ,1 ,1 ,0 ), +SOC_DAPM_SINGLE ("Switch" ,SND_SOC_NOPM ,2 ,1 ,0 ), +SOC_DAPM_SINGLE ("Switch" ,SND_SOC_NOPM ,3 ,1 ,0 ), +}; +EXPORT_SYMBOL_GPL (arizona_voice_trigger_switch); +static void arizona_in_set_vu (struct snd_soc_codec *codec,int ena) {struct arizona_priv *priv =snd_soc_codec_get_drvdata (codec);
sound/soc/codecs/arizona.h +2 -0
@@ -248,6 +248,8 @@ extern const struct soc_enum arizona_anc_input_src[];extern const struct soc_enum arizona_anc_ng_enum;extern const struct soc_enum arizona_output_anc_src[]; +extern const struct snd_kcontrol_new arizona_voice_trigger_switch[]; +extern int arizona_in_ev (struct snd_soc_dapm_widget *w,struct snd_kcontrol *kcontrol,int event);
sound/soc/codecs/cs47l24.c +9 -0
@@ -359,6 +359,11 @@ SND_SOC_DAPM_INPUT("IN2R"),SND_SOC_DAPM_OUTPUT ("DRC1 Signal Activity" ),SND_SOC_DAPM_OUTPUT ("DRC2 Signal Activity" ), +SND_SOC_DAPM_OUTPUT ("DSP Voice Trigger" ), + +SND_SOC_DAPM_SWITCH ("DSP3 Voice Trigger" ,SND_SOC_NOPM ,2 ,0 , + &arizona_voice_trigger_switch[2 ]), + SND_SOC_DAPM_PGA_E("IN1L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1L_ENA_SHIFT, 0, NULL, 0, arizona_in_ev, SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
@@ -902,6 +907,10 @@ static const struct snd_soc_dapm_route cs47l24_dapm_routes[] = { { "DRC1 Signal Activity", NULL, "DRC1R" }, { "DRC2 Signal Activity", NULL, "DRC2L" }, { "DRC2 Signal Activity", NULL, "DRC2R" }, + + { "DSP Voice Trigger", NULL, "SYSCLK" }, + { "DSP Voice Trigger", NULL, "DSP3 Voice Trigger" }, + { "DSP3 Voice Trigger", "Switch", "DSP3" }, }; static int cs47l24_set_fll(struct snd_soc_codec *codec, int fll_id, int source,
sound/soc/codecs/wm5110.c +9 -0
@@ -1104,6 +1104,11 @@ SND_SOC_DAPM_INPUT("IN4R"),SND_SOC_DAPM_OUTPUT ("DRC1 Signal Activity" ),SND_SOC_DAPM_OUTPUT ("DRC2 Signal Activity" ), +SND_SOC_DAPM_OUTPUT ("DSP Voice Trigger" ), + +SND_SOC_DAPM_SWITCH ("DSP3 Voice Trigger" ,SND_SOC_NOPM ,2 ,0 , + &arizona_voice_trigger_switch[2 ]), + SND_SOC_DAPM_PGA_E("IN1L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1L_ENA_SHIFT, 0, NULL, 0, wm5110_in_ev, SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
@@ -2003,6 +2008,10 @@ static const struct snd_soc_dapm_route wm5110_dapm_routes[] = { { "DRC1 Signal Activity", NULL, "DRC1R" }, { "DRC2 Signal Activity", NULL, "DRC2L" }, { "DRC2 Signal Activity", NULL, "DRC2R" }, + + { "DSP Voice Trigger", NULL, "SYSCLK" }, + { "DSP Voice Trigger", NULL, "DSP3 Voice Trigger" }, + { "DSP3 Voice Trigger", "Switch", "DSP3" }, }; static int wm5110_set_fll(struct snd_soc_codec *codec, int fll_id, int source,
Signature · 1 line
2.8.1
Mark Brown
maintainerApplied "ASoC: wm_adsp: Specifically propagate voice trigger event to caller" to the asoc tree
In reply to Charles KeepaxThe patch
ASoC: wm_adsp: Specifically propagate voice trigger event to caller
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
ca7e86dd6d4902c23890d17b5984542490f51054Mon Sep 17 00:00:00 2001
From: Charles Keepax <[email protected]>
Date: Fri, 13 May 2016 16:45:17 +0100
Subject: [PATCH] ASoC: wm_adsp: Specifically propagate voice trigger event to
caller
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.
--- sound/soc/codecs/wm_adsp.c | 5 +++++ sound/soc/codecs/wm_adsp.h | 4 ++++ 2 files changed, 9 insertions(+)
sound/soc/codecs/wm_adsp.c +5 -0
@@ -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);
sound/soc/codecs/wm_adsp.h +4 -0
@@ -19,6 +19,10 @@#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;
Signature · 1 line
2.8.1
Mark Brown
maintainerApplied "ASoC: arizona: Add event notification on voice trigger events" to the asoc tree
In reply to Charles KeepaxThe patch
ASoC: arizona: Add event notification on voice trigger events
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
7580cc37a00285450eb5aa4f90f76d8a5d41859cMon Sep 17 00:00:00 2001
From: Charles Keepax <[email protected]>
Date: Fri, 13 May 2016 16:45:19 +0100
Subject: [PATCH] ASoC: arizona: Add event notification on voice trigger events
Inform the notifier chain if the DSP recognises a voice trigger.
--- sound/soc/codecs/arizona.h | 3 +++ sound/soc/codecs/cs47l24.c | 4 ++++ sound/soc/codecs/wm5110.c | 4 ++++ 3 files changed, 11 insertions(+)
sound/soc/codecs/arizona.h +3 -0
@@ -63,6 +63,9 @@#define ARIZONA_DVFS_SR1_RQ 0x001#define ARIZONA_DVFS_ADSP1_RQ 0x100 +/* Notifier events */ +#define ARIZONA_NOTIFY_VOICE_TRIGGER 0x1 +struct arizona ;struct wm_adsp ;
sound/soc/codecs/cs47l24.c +4 -0
@@ -1074,6 +1074,10 @@ static irqreturn_t cs47l24_adsp2_irq(int irq, void *data) ret =wm_adsp_compr_handle_irq (&priv->core.adsp[i]);if (ret != -ENODEV ) serviced++; +if (ret ==WM_ADSP_COMPR_VOICE_TRIGGER ) +arizona_call_notifiers (arizona, +ARIZONA_NOTIFY_VOICE_TRIGGER , + (void *)i); }if (!serviced) {
sound/soc/codecs/wm5110.c +4 -0
@@ -2229,6 +2229,10 @@ static irqreturn_t wm5110_adsp2_irq(int irq, void *data) ret =wm_adsp_compr_handle_irq (&priv->core.adsp[i]);if (ret != -ENODEV ) serviced++; +if (ret ==WM_ADSP_COMPR_VOICE_TRIGGER ) +arizona_call_notifiers (arizona, +ARIZONA_NOTIFY_VOICE_TRIGGER , + (void *)i); }if (!serviced) {
Signature · 1 line
2.8.1
Mark Brown
maintainerApplied "ASoC: arizona: Add a notifier chain for CODEC events" to the asoc tree
In reply to Charles KeepaxThe patch
ASoC: arizona: Add a notifier chain for CODEC events
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
28d8d49876660a4ecd1aaa94e49f6a9bf8c701f1Mon Sep 17 00:00:00 2001
From: Charles Keepax <[email protected]>
Date: Fri, 13 May 2016 16:45:18 +0100
Subject: [PATCH] ASoC: arizona: Add a notifier chain for CODEC events
Add a notifier chain that can be used from the machine driver to catch events generated by the CODEC.
--- include/linux/mfd/arizona/core.h | 10 ++++++++++ sound/soc/codecs/arizona.c | 35 +++++++++++++++++++++++++++++++++++ sound/soc/codecs/arizona.h | 10 ++++++++++ sound/soc/codecs/cs47l24.c | 1 + sound/soc/codecs/wm5110.c | 1 + 5 files changed, 57 insertions(+)
include/linux/mfd/arizona/core.h +10 -0
@@ -14,6 +14,7 @@#define _WM_ARIZONA_CORE_H#include <linux/interrupt.h> +#include <linux/notifier.h> #include <linux/regmap.h> #include <linux/regulator/consumer.h> #include <linux/mfd/arizona/pdata.h>
@@ -148,8 +149,17 @@ struct arizona {uint16_t dac_comp_coeff;uint8_t dac_comp_enabled;struct mutex dac_comp_lock; + +struct blocking_notifier_head notifier; }; +static inline int arizona_call_notifiers (struct arizona *arizona, +unsigned long event, +void *data) +{ +return blocking_notifier_call_chain (&arizona->notifier, event, data); +} +int arizona_clk32k_enable (struct arizona *arizona);int arizona_clk32k_disable (struct arizona *arizona);
sound/soc/codecs/arizona.c +35 -0
@@ -324,6 +324,17 @@ int arizona_init_gpio(struct snd_soc_codec *codec) }EXPORT_SYMBOL_GPL (arizona_init_gpio); +int arizona_init_notifiers (struct snd_soc_codec *codec) +{ +struct arizona_priv *priv =snd_soc_codec_get_drvdata (codec); +struct arizona *arizona = priv->arizona; + +BLOCKING_INIT_NOTIFIER_HEAD (&arizona->notifier); + +return 0 ; +} +EXPORT_SYMBOL_GPL (arizona_init_notifiers); +const char *const arizona_mixer_texts[ARIZONA_NUM_MIXER_INPUTS ] = {"None" ,"Tone Generator 1" ,
@@ -2573,6 +2584,30 @@ int arizona_lhpf_coeff_put(struct snd_kcontrol *kcontrol, }EXPORT_SYMBOL_GPL (arizona_lhpf_coeff_put); +int arizona_register_notifier (struct snd_soc_codec *codec, +struct notifier_block *nb, +int (*notify)(struct notifier_block *nb, +unsigned long action,void *data)) +{ +struct arizona_priv *priv =snd_soc_codec_get_drvdata (codec); +struct arizona *arizona = priv->arizona; + + nb->notifier_call = notify; + +return blocking_notifier_chain_register (&arizona->notifier, nb); +} +EXPORT_SYMBOL_GPL (arizona_register_notifier); + +int arizona_unregister_notifier (struct snd_soc_codec *codec, +struct notifier_block *nb) +{ +struct arizona_priv *priv =snd_soc_codec_get_drvdata (codec); +struct arizona *arizona = priv->arizona; + +return blocking_notifier_chain_unregister (&arizona->notifier, nb); +} +EXPORT_SYMBOL_GPL (arizona_unregister_notifier); +MODULE_DESCRIPTION ("ASoC Wolfson Arizona class device support" );MODULE_AUTHOR ("Mark Brown <[email protected]>" );MODULE_LICENSE ("GPL" );
sound/soc/codecs/arizona.h +10 -0
@@ -306,6 +306,7 @@ extern int arizona_set_fll(struct arizona_fll *fll, int source,extern int arizona_init_spk (struct snd_soc_codec *codec);extern int arizona_init_gpio (struct snd_soc_codec *codec);extern int arizona_init_mono (struct snd_soc_codec *codec); +extern int arizona_init_notifiers (struct snd_soc_codec *codec);extern int arizona_free_spk (struct snd_soc_codec *codec);
@@ -317,4 +318,13 @@ int arizona_set_output_mode(struct snd_soc_codec *codec, int output,extern bool arizona_input_analog (struct snd_soc_codec *codec,int shift);extern const char *arizona_sample_rate_val_to_name (unsigned int rate_val); + +extern int arizona_register_notifier (struct snd_soc_codec *codec, +struct notifier_block *nb, +int (*notify)(struct notifier_block *nb, +unsigned long action, +void *data)); +extern int arizona_unregister_notifier (struct snd_soc_codec *codec, +struct notifier_block *nb); +#endif
sound/soc/codecs/cs47l24.c +1 -0
@@ -1096,6 +1096,7 @@ static int cs47l24_codec_probe(struct snd_soc_codec *codec)arizona_init_spk (codec);arizona_init_gpio (codec);arizona_init_mono (codec); +arizona_init_notifiers (codec); ret = arizona_request_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, "ADSP2 Compressed IRQ", cs47l24_adsp2_irq,
sound/soc/codecs/wm5110.c +1 -0
@@ -2251,6 +2251,7 @@ static int wm5110_codec_probe(struct snd_soc_codec *codec)arizona_init_spk (codec);arizona_init_gpio (codec);arizona_init_mono (codec); +arizona_init_notifiers (codec); ret = arizona_request_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, "ADSP2 Compressed IRQ", wm5110_adsp2_irq,
Signature · 1 line
2.8.1