From 2230c49f09b552454eac51b81e9e4e41060b5e70 Mon Sep 17 00:00:00 2001 From: Charles Keepax Date: Fri, 13 May 2016 16:45:18 +0100 Subject: 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. Signed-off-by: Charles Keepax Signed-off-by: Mark Brown --- sound/soc/codecs/wm5110.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound/soc/codecs/wm5110.c') diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c index b5820e4d5471..338a3b52705b 100644 --- a/sound/soc/codecs/wm5110.c +++ b/sound/soc/codecs/wm5110.c @@ -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, -- cgit v1.2.3-59-g8ed1b From 7baa7e2490e1c292a84406c90089511c96ce3114 Mon Sep 17 00:00:00 2001 From: Charles Keepax Date: Fri, 13 May 2016 16:45:19 +0100 Subject: ASoC: arizona: Add event notification on voice trigger events Inform the notifier chain if the DSP recognises a voice trigger. Signed-off-by: Charles Keepax Signed-off-by: Mark Brown --- sound/soc/codecs/arizona.h | 3 +++ sound/soc/codecs/cs47l24.c | 4 ++++ sound/soc/codecs/wm5110.c | 4 ++++ 3 files changed, 11 insertions(+) (limited to 'sound/soc/codecs/wm5110.c') diff --git a/sound/soc/codecs/arizona.h b/sound/soc/codecs/arizona.h index 245d13c157a5..18d347f3bfbe 100644 --- a/sound/soc/codecs/arizona.h +++ b/sound/soc/codecs/arizona.h @@ -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; diff --git a/sound/soc/codecs/cs47l24.c b/sound/soc/codecs/cs47l24.c index fa9a6a5a6120..7e3d138d077b 100644 --- a/sound/soc/codecs/cs47l24.c +++ b/sound/soc/codecs/cs47l24.c @@ -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) { diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c index 338a3b52705b..dbc9b4df38a0 100644 --- a/sound/soc/codecs/wm5110.c +++ b/sound/soc/codecs/wm5110.c @@ -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) { -- cgit v1.2.3-59-g8ed1b From 546ad3d024fd47e5042d80ae1dc4c7d1b00912a7 Mon Sep 17 00:00:00 2001 From: Charles Keepax Date: Tue, 31 May 2016 12:44:17 +0100 Subject: ASoC: arizona: Add data structure for voice trigger notifier 64-bit builds would generate a warning when we passed the core number as a pointer through the notifier data: sound/soc/codecs/cs47l24.c:1091:13: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] (void *)i); Rather than just fix this up with more casting add a data structure that holds information for the notifier chain. This will make it easier to add additional information in the future as well. Fixes: 7baa7e2490e1 ("ASoC: arizona: Add event notification on voice trigger events") Signed-off-by: Charles Keepax Acked-by: Arnd Bergmann Signed-off-by: Mark Brown --- sound/soc/codecs/arizona.h | 4 ++++ sound/soc/codecs/cs47l24.c | 7 +++++-- sound/soc/codecs/wm5110.c | 7 +++++-- 3 files changed, 14 insertions(+), 4 deletions(-) (limited to 'sound/soc/codecs/wm5110.c') diff --git a/sound/soc/codecs/arizona.h b/sound/soc/codecs/arizona.h index 18d347f3bfbe..46862af7665e 100644 --- a/sound/soc/codecs/arizona.h +++ b/sound/soc/codecs/arizona.h @@ -98,6 +98,10 @@ struct arizona_priv { bool dvfs_cached; }; +struct arizona_voice_trigger_info { + int core; +}; + #define ARIZONA_NUM_MIXER_INPUTS 104 extern const unsigned int arizona_mixer_tlv[]; diff --git a/sound/soc/codecs/cs47l24.c b/sound/soc/codecs/cs47l24.c index 7e3d138d077b..bbc8cf18ded0 100644 --- a/sound/soc/codecs/cs47l24.c +++ b/sound/soc/codecs/cs47l24.c @@ -1067,6 +1067,7 @@ static irqreturn_t cs47l24_adsp2_irq(int irq, void *data) { struct cs47l24_priv *priv = data; struct arizona *arizona = priv->core.arizona; + struct arizona_voice_trigger_info info; int serviced = 0; int i, ret; @@ -1074,10 +1075,12 @@ 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) + if (ret == WM_ADSP_COMPR_VOICE_TRIGGER) { + info.core = i; arizona_call_notifiers(arizona, ARIZONA_NOTIFY_VOICE_TRIGGER, - (void *)i); + &info); + } } if (!serviced) { diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c index dbc9b4df38a0..83c48eca56f5 100644 --- a/sound/soc/codecs/wm5110.c +++ b/sound/soc/codecs/wm5110.c @@ -2222,6 +2222,7 @@ static irqreturn_t wm5110_adsp2_irq(int irq, void *data) { struct wm5110_priv *priv = data; struct arizona *arizona = priv->core.arizona; + struct arizona_voice_trigger_info info; int serviced = 0; int i, ret; @@ -2229,10 +2230,12 @@ 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) + if (ret == WM_ADSP_COMPR_VOICE_TRIGGER) { + info.core = i; arizona_call_notifiers(arizona, ARIZONA_NOTIFY_VOICE_TRIGGER, - (void *)i); + &info); + } } if (!serviced) { -- cgit v1.2.3-59-g8ed1b