summaryrefslogtreecommitdiff
path: root/sound/soc/sof/sof-priv.h
diff options
context:
space:
mode:
authorKeyon Jie <yang.jie@linux.intel.com>2019-04-30 18:09:25 -0500
committerMark Brown <broonie@kernel.org>2019-05-03 14:59:11 +0900
commite2803e610aecb36ea4fec5a04861547664580d0c (patch)
tree59100f28fe4bff1add6c620805d88e3fce5eaa01 /sound/soc/sof/sof-priv.h
parentb0056fda7c8a474bef9bf01368f66caadcdd464c (diff)
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.h2
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