diff options
author | Keyon Jie <yang.jie@linux.intel.com> | 2019-05-01 01:09:25 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-05-03 07:59:11 +0200 |
commit | e2803e610aecb36ea4fec5a04861547664580d0c (patch) | |
tree | 59100f28fe4bff1add6c620805d88e3fce5eaa01 /sound/soc/sof/sof-priv.h | |
parent | ASoC: SOF: Intel: hda-pcm: remove useless dependency on hdac_ext (diff) | |
download | linux-e2803e610aecb36ea4fec5a04861547664580d0c.tar.xz linux-e2803e610aecb36ea4fec5a04861547664580d0c.zip |
ASoC: SOF: PCM: add period_elapsed work to fix race condition in interrupt context
The IPC implementation in SOF requires sending IPCs serially: we should
not send a new IPC command to the firmware before we get an ACK (or time
out) from firmware, and the IRQ processing is complete.
snd_pcm_period_elapsed() can be called in interrupt context before
IRQ_HANDLED is returned. When the PCM is done draining, a STOP
IPC will then be sent, which breaks the expectation that IPCs are
handled serially and leads to IPC timeouts.
This patch adds a workqueue to defer the call to snd_pcm_elapsed() after
the IRQ is handled.
Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof/sof-priv.h')
-rw-r--r-- | sound/soc/sof/sof-priv.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index 35e78ffecce2..675bb10c82f5 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -274,6 +274,7 @@ struct snd_sof_pcm_stream { struct snd_dma_buffer page_table; struct sof_ipc_stream_posn posn; struct snd_pcm_substream *substream; + struct work_struct period_elapsed_work; }; /* ALSA SOF PCM device */ @@ -495,6 +496,7 @@ struct snd_sof_pcm *snd_sof_find_spcm_comp(struct snd_sof_dev *sdev, int *direction); struct snd_sof_pcm *snd_sof_find_spcm_pcm_id(struct snd_sof_dev *sdev, unsigned int pcm_id); +void snd_sof_pcm_period_elapsed(struct snd_pcm_substream *substream); /* * Stream IPC |