Commit 83926099 authored by Sascha Hauer's avatar Sascha Hauer Committed by Mark Brown

ASoC: imx-ssi: do not call hrtimer_disable in trigger function

Doing so causes a deadlock, so just signal the timer to stop
using an atomic variable.
Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
Acked-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 565a79f7
...@@ -41,6 +41,7 @@ struct imx_pcm_runtime_data { ...@@ -41,6 +41,7 @@ struct imx_pcm_runtime_data {
struct hrtimer hrt; struct hrtimer hrt;
int poll_time_ns; int poll_time_ns;
struct snd_pcm_substream *substream; struct snd_pcm_substream *substream;
atomic_t running;
}; };
static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt) static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt)
...@@ -52,6 +53,9 @@ static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt) ...@@ -52,6 +53,9 @@ static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt)
struct pt_regs regs; struct pt_regs regs;
unsigned long delta; unsigned long delta;
if (!atomic_read(&iprtd->running))
return HRTIMER_NORESTART;
get_fiq_regs(&regs); get_fiq_regs(&regs);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
...@@ -129,6 +133,7 @@ static int snd_imx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) ...@@ -129,6 +133,7 @@ static int snd_imx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
atomic_set(&iprtd->running, 1);
hrtimer_start(&iprtd->hrt, ns_to_ktime(iprtd->poll_time_ns), hrtimer_start(&iprtd->hrt, ns_to_ktime(iprtd->poll_time_ns),
HRTIMER_MODE_REL); HRTIMER_MODE_REL);
if (++fiq_enable == 1) if (++fiq_enable == 1)
...@@ -139,11 +144,11 @@ static int snd_imx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) ...@@ -139,11 +144,11 @@ static int snd_imx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH: case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
hrtimer_cancel(&iprtd->hrt); atomic_set(&iprtd->running, 0);
if (--fiq_enable == 0) if (--fiq_enable == 0)
disable_fiq(imx_pcm_fiq); disable_fiq(imx_pcm_fiq);
break; break;
default: default:
return -EINVAL; return -EINVAL;
...@@ -190,6 +195,7 @@ static int snd_imx_open(struct snd_pcm_substream *substream) ...@@ -190,6 +195,7 @@ static int snd_imx_open(struct snd_pcm_substream *substream)
iprtd->substream = substream; iprtd->substream = substream;
atomic_set(&iprtd->running, 0);
hrtimer_init(&iprtd->hrt, CLOCK_MONOTONIC, HRTIMER_MODE_REL); hrtimer_init(&iprtd->hrt, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
iprtd->hrt.function = snd_hrtimer_callback; iprtd->hrt.function = snd_hrtimer_callback;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment