]> git.baikalelectronics.ru Git - kernel.git/commit
ASoC: SOF: PCM: add period_elapsed work to fix race condition in interrupt context
authorKeyon Jie <yang.jie@linux.intel.com>
Tue, 30 Apr 2019 23:09:25 +0000 (18:09 -0500)
committerMark Brown <broonie@kernel.org>
Fri, 3 May 2019 05:59:11 +0000 (14:59 +0900)
commit1503ba45e9c53faaf291529aa4adde53e425729f
tree59100f28fe4bff1add6c620805d88e3fce5eaa01
parentb765cb8574fbc17cb0ea5b7f3feb9da6ae24dba9
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>
sound/soc/sof/pcm.c
sound/soc/sof/sof-priv.h