Skip to contentSkip to conversation

(no subject)

PATCH In review Sascha Hauer 2 participants 5 messages Apr 13, 2010

Subsystems (3)
lore
Share & tools
lore

Sascha Hauer

author maintainer
#0 lore raw

Hi,

Here are further fixes for the i.MX ssi driver. Mark, please let me know whether I should combine 1/2 with the patch that actually broke fiq support.

Sascha

author maintainer
#1 lore raw

PATCH 1/2 imx-ssi: do not call hrtimer_disable in trigger function

This causes a deadlock.

---
 sound/soc/imx/imx-pcm-fiq.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
sound/soc/imx/imx-pcm-fiq.c +8 -2
index 64df813..4b694d5 100644
@@ -41,6 +41,7 @@ struct imx_pcm_runtime_data {
 	struct hrtimer hrt;
 	int poll_time_ns;
 	struct snd_pcm_substream *substream;
+	atomic_t running;
 };
 
 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;
 	unsigned long delta;
 
+	if (!atomic_read(&iprtd->running))
+		return HRTIMER_NORESTART;
+
 	get_fiq_regs(&regs);
 
 	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
@@ -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_RESUME:
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
+		atomic_set(&iprtd->running, 1);
 		hrtimer_start(&iprtd->hrt, ns_to_ktime(iprtd->poll_time_ns),
 		      HRTIMER_MODE_REL);
 		if (++fiq_enable == 1)
@@ -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_SUSPEND:
 	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
-		hrtimer_cancel(&iprtd->hrt);
+		atomic_set(&iprtd->running, 0);
+
 		if (--fiq_enable == 0)
 			disable_fiq(imx_pcm_fiq);
 
-
 		break;
 	default:
 		return -EINVAL;
@@ -190,6 +195,7 @@ static int snd_imx_open(struct snd_pcm_substream *substream)
 
 	iprtd->substream = substream;
 
+	atomic_set(&iprtd->running, 0);
 	hrtimer_init(&iprtd->hrt, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 	iprtd->hrt.function = snd_hrtimer_callback;
 
Signature · 1 line
1.7.0
#2 lore raw

Re: [PATCH 1/2] imx-ssi: do not call hrtimer_disable in trigger function

Quoted 2 lines · Sascha Hauer

This causes a deadlock.

Code looks fine. Can you fixup the commit message, I assume this patch fixes rather than causes the deadlock ?

Thanks

Liam

Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk
author maintainer
#3 lore raw

PATCH 2/2 imx-ssi: increase minimum periods to 4

In reply to Sascha Hauer

Currently the notification of elapsed periods is not very exact. Increase minimum periods to 4.

---
 sound/soc/imx/imx-pcm-fiq.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/imx/imx-pcm-fiq.c +1 -1
index 4b694d5..ecec332 100644
@@ -179,7 +179,7 @@ static struct snd_pcm_hardware snd_imx_hardware = {
 	.buffer_bytes_max = IMX_SSI_DMABUF_SIZE,
 	.period_bytes_min = 128,
 	.period_bytes_max = 16 * 1024,
-	.periods_min = 2,
+	.periods_min = 4,
 	.periods_max = 255,
 	.fifo_size = 0,
 };
Signature · 1 line
1.7.0
Acked-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] imx-ssi: increase minimum periods to 4

Quoted 8 lines · Sascha Hauer

Currently the notification of elapsed periods is not very exact. Increase minimum periods to 4.

---
 sound/soc/imx/imx-pcm-fiq.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk