ASoC: wm_adsp: Add a handler for the compressed IRQ
Subsystems (3)
PATCH v4 1/2 ASoC: wm_adsp: Add a handler for the compressed IRQ
Here support is added for responding to DSP IRQs that are used to indicate data being available on the DSP. The idea is that we check the amount of data available upon receipt of an IRQ and on subsequent calls to the pointer callback we recheck once less than one fragment is available (to avoid excessive SPI traffic), if there is truely less than one fragment available we ack the last IRQ and wait for a new one.
---
Changes since v3:
- Make spurious IRQs return IRQ_NONE
- Add a comment to explain the usage of wm_adsp_buffer_ack_irq
Thanks,
Charles
sound/soc/codecs/wm5110.c | 27 +++++++ sound/soc/codecs/wm_adsp.c | 192 +++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/wm_adsp.h | 3 + 3 files changed, 222 insertions(+)
sound/soc/codecs/wm5110.c +27 -0
@@ -2177,10 +2177,23 @@ static int wm5110_open(struct snd_compr_stream *stream)return wm_adsp_compr_open (&priv->core.adsp[n_adsp], stream); } +static irqreturn_t wm5110_adsp2_irq (int irq,void *data) +{ +struct wm5110_priv *florida = data; +int ret; + + ret =wm_adsp_compr_handle_irq (&florida->core.adsp[2 ]); +if (ret == -ENODEV ) +return IRQ_NONE ; + +return IRQ_HANDLED ; +} +static int wm5110_codec_probe (struct snd_soc_codec *codec) {struct snd_soc_dapm_context *dapm =snd_soc_codec_get_dapm (codec);struct wm5110_priv *priv =snd_soc_codec_get_drvdata (codec); +struct arizona *arizona = priv->core.arizona;int i, ret; priv->core.arizona->dapm = dapm;
@@ -2189,6 +2202,14 @@ static int wm5110_codec_probe(struct snd_soc_codec *codec)arizona_init_gpio (codec);arizona_init_mono (codec); + ret =arizona_request_irq (arizona,ARIZONA_IRQ_DSP_IRQ1 , +"ADSP2 Compressed IRQ" , wm5110_adsp2_irq, + priv); +if (ret !=0 ) { +dev_err (codec->dev,"Failed to request DSP IRQ: %d\n" , ret); +return ret; + } +for (i =0 ; i <WM5110_NUM_ADSP ; ++i) { ret =wm_adsp2_codec_probe (&priv->core.adsp[i], codec);if (ret)
@@ -2209,12 +2230,15 @@ err_adsp2_codec_probe:for (--i; i >=0 ; --i)wm_adsp2_codec_remove (&priv->core.adsp[i], codec); +arizona_free_irq (arizona,ARIZONA_IRQ_DSP_IRQ1 , priv); +return ret; }static int wm5110_codec_remove (struct snd_soc_codec *codec) {struct wm5110_priv *priv =snd_soc_codec_get_drvdata (codec); +struct arizona *arizona = priv->core.arizona;int i;for (i =0 ; i <WM5110_NUM_ADSP ; ++i)
@@ -2222,6 +2246,8 @@ static int wm5110_codec_remove(struct snd_soc_codec *codec) priv->core.arizona->dapm =NULL ; +arizona_free_irq (arizona,ARIZONA_IRQ_DSP_IRQ1 , priv); +return 0 ; }
@@ -2273,6 +2299,7 @@ static struct snd_compr_ops wm5110_compr_ops = { .set_params = wm_adsp_compr_set_params, .get_caps = wm_adsp_compr_get_caps, .trigger = wm_adsp_compr_trigger, + .pointer = wm_adsp_compr_pointer, };static struct snd_soc_platform_driver wm5110_compr_platform = {
sound/soc/codecs/wm_adsp.c +192 -0
226 lines not on this page · raw message
sound/soc/codecs/wm_adsp.h +3 -0
@@ -112,5 +112,8 @@ extern int wm_adsp_compr_set_params(struct snd_compr_stream *stream,extern int wm_adsp_compr_get_caps (struct snd_compr_stream *stream,struct snd_compr_caps *caps);extern int wm_adsp_compr_trigger (struct snd_compr_stream *stream,int cmd); +extern int wm_adsp_compr_handle_irq (struct wm_adsp *dsp); +extern int wm_adsp_compr_pointer (struct snd_compr_stream *stream, +struct snd_compr_tstamp *tstamp);#endif
Signature · 1 line
2.1.4
PATCH v4 2/2 ASoC: wm_adsp: Pull data through compressed read
Data is read in blocks of up to one fragment is size from the circular buffer on the DSP and is re-packed to remove the padding byte that exists in the DSP memory map.
---
No changes since v3.
Thanks,
Charles
sound/soc/codecs/wm5110.c | 1 + sound/soc/codecs/wm_adsp.c | 138 +++++++++++++++++++++++++++++++++++++++++++++ sound/soc/codecs/wm_adsp.h | 2 + 3 files changed, 141 insertions(+)
sound/soc/codecs/wm5110.c +1 -0
@@ -2300,6 +2300,7 @@ static struct snd_compr_ops wm5110_compr_ops = { .get_caps = wm_adsp_compr_get_caps, .trigger = wm_adsp_compr_trigger, .pointer = wm_adsp_compr_pointer, + .copy = wm_adsp_compr_copy, };static struct snd_soc_platform_driver wm5110_compr_platform = {
sound/soc/codecs/wm_adsp.c +138 -0
178 lines not on this page · raw message
sound/soc/codecs/wm_adsp.h +2 -0
@@ -115,5 +115,7 @@ extern int wm_adsp_compr_trigger(struct snd_compr_stream *stream, int cmd);extern int wm_adsp_compr_handle_irq (struct wm_adsp *dsp);extern int wm_adsp_compr_pointer (struct snd_compr_stream *stream,struct snd_compr_tstamp *tstamp); +extern int wm_adsp_compr_copy (struct snd_compr_stream *stream, +char __user *buf,size_t count);#endif
Signature · 1 line
2.1.4