OSDN Git Service

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)
commite2803e610aecb36ea4fec5a04861547664580d0c
tree59100f28fe4bff1add6c620805d88e3fce5eaa01
parentb0056fda7c8a474bef9bf01368f66caadcdd464c
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