* imx-ssi fixes
@ 2010-04-14 7:17 Sascha Hauer
2010-04-14 7:17 ` [PATCH 1/2] imx-ssi: do not call hrtimer_disable in trigger function Sascha Hauer
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Sascha Hauer @ 2010-04-14 7:17 UTC (permalink / raw)
To: alsa-devel; +Cc: Mark Brown, Valentin Longchamp
Just a resend of the patches I sent yesterday with an updated commit message.
Sascha
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH 1/2] imx-ssi: do not call hrtimer_disable in trigger function 2010-04-14 7:17 imx-ssi fixes Sascha Hauer @ 2010-04-14 7:17 ` Sascha Hauer 2010-04-14 7:41 ` Liam Girdwood 2010-04-14 7:17 ` [PATCH 2/2] imx-ssi: increase minimum periods to 4 Sascha Hauer 2010-04-15 1:30 ` imx-ssi fixes Mark Brown 2 siblings, 1 reply; 9+ messages in thread From: Sascha Hauer @ 2010-04-14 7:17 UTC (permalink / raw) To: alsa-devel; +Cc: Sascha Hauer, Mark Brown, Valentin Longchamp Doing so causes a deadlock, so just signal the timer to stop using an atomic variable. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- sound/soc/imx/imx-pcm-fiq.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sound/soc/imx/imx-pcm-fiq.c b/sound/soc/imx/imx-pcm-fiq.c index 2646e05..24670ee 100644 --- a/sound/soc/imx/imx-pcm-fiq.c +++ b/sound/soc/imx/imx-pcm-fiq.c @@ -42,6 +42,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) @@ -53,6 +54,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(®s); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) @@ -130,6 +134,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) @@ -140,11 +145,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; @@ -191,6 +196,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; -- 1.7.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] imx-ssi: do not call hrtimer_disable in trigger function 2010-04-14 7:17 ` [PATCH 1/2] imx-ssi: do not call hrtimer_disable in trigger function Sascha Hauer @ 2010-04-14 7:41 ` Liam Girdwood 0 siblings, 0 replies; 9+ messages in thread From: Liam Girdwood @ 2010-04-14 7:41 UTC (permalink / raw) To: Sascha Hauer; +Cc: alsa-devel, Mark Brown, Valentin Longchamp On Wed, 2010-04-14 at 09:17 +0200, Sascha Hauer wrote: > Doing so causes a deadlock, so just signal the timer to stop > using an atomic variable. > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> -- Freelance Developer, SlimLogic Ltd ASoC and Voltage Regulator Maintainer. http://www.slimlogic.co.uk ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/2] imx-ssi: increase minimum periods to 4 2010-04-14 7:17 imx-ssi fixes Sascha Hauer 2010-04-14 7:17 ` [PATCH 1/2] imx-ssi: do not call hrtimer_disable in trigger function Sascha Hauer @ 2010-04-14 7:17 ` Sascha Hauer 2010-04-15 1:30 ` imx-ssi fixes Mark Brown 2 siblings, 0 replies; 9+ messages in thread From: Sascha Hauer @ 2010-04-14 7:17 UTC (permalink / raw) To: alsa-devel; +Cc: Sascha Hauer, Mark Brown, Valentin Longchamp Currently the notification of elapsed periods is not very exact. Increase minimum periods to 4 as suggested by Liam Girdwood. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> --- sound/soc/imx/imx-pcm-fiq.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/sound/soc/imx/imx-pcm-fiq.c b/sound/soc/imx/imx-pcm-fiq.c index 24670ee..6b518e0 100644 --- a/sound/soc/imx/imx-pcm-fiq.c +++ b/sound/soc/imx/imx-pcm-fiq.c @@ -180,7 +180,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, }; -- 1.7.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: imx-ssi fixes 2010-04-14 7:17 imx-ssi fixes Sascha Hauer 2010-04-14 7:17 ` [PATCH 1/2] imx-ssi: do not call hrtimer_disable in trigger function Sascha Hauer 2010-04-14 7:17 ` [PATCH 2/2] imx-ssi: increase minimum periods to 4 Sascha Hauer @ 2010-04-15 1:30 ` Mark Brown 2 siblings, 0 replies; 9+ messages in thread From: Mark Brown @ 2010-04-15 1:30 UTC (permalink / raw) To: Sascha Hauer; +Cc: alsa-devel, Valentin Longchamp On Wed, Apr 14, 2010 at 09:17:29AM +0200, Sascha Hauer wrote: > Just a resend of the patches I sent yesterday with an updated commit message. Applied both, thanks. ^ permalink raw reply [flat|nested] 9+ messages in thread
* imx-ssi fixes @ 2010-04-08 9:31 Sascha Hauer 2010-04-08 14:47 ` Mark Brown 0 siblings, 1 reply; 9+ messages in thread From: Sascha Hauer @ 2010-04-08 9:31 UTC (permalink / raw) To: alsa-devel; +Cc: Mark Brown, Valentin Longchamp Hi all, Here are some bugfix patches for the imx-ssi driver. It should also fix the problems reported in FIQ mode. Sascha ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: imx-ssi fixes 2010-04-08 9:31 Sascha Hauer @ 2010-04-08 14:47 ` Mark Brown 2010-04-08 15:51 ` Sascha Hauer 0 siblings, 1 reply; 9+ messages in thread From: Mark Brown @ 2010-04-08 14:47 UTC (permalink / raw) To: Sascha Hauer; +Cc: alsa-devel, Valentin Longchamp On Thu, Apr 08, 2010 at 11:31:23AM +0200, Sascha Hauer wrote: > Here are some bugfix patches for the imx-ssi driver. It should also fix > the problems reported in FIQ mode. Applied all three, thanks - the hrtimer stuff works an awful lot better than the vanilla timer stuff did. It's a shame I hadn't noticed that hrtimers did manage to give better resolution on i.MX when I looked into this previously. It'd be good if you could look into the timer sync issue - doing something like deferring the timer by a proportion of a period if the period hasn't elapsed ought to cover it. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: imx-ssi fixes 2010-04-08 14:47 ` Mark Brown @ 2010-04-08 15:51 ` Sascha Hauer 2010-04-08 15:54 ` Mark Brown 0 siblings, 1 reply; 9+ messages in thread From: Sascha Hauer @ 2010-04-08 15:51 UTC (permalink / raw) To: Mark Brown; +Cc: alsa-devel, Valentin Longchamp On Thu, Apr 08, 2010 at 03:47:50PM +0100, Mark Brown wrote: > On Thu, Apr 08, 2010 at 11:31:23AM +0200, Sascha Hauer wrote: > > > Here are some bugfix patches for the imx-ssi driver. It should also fix > > the problems reported in FIQ mode. > > Applied all three, thanks - the hrtimer stuff works an awful lot better > than the vanilla timer stuff did. It's a shame I hadn't noticed that > hrtimers did manage to give better resolution on i.MX when I looked into > this previously. > > It'd be good if you could look into the timer sync issue - doing > something like deferring the timer by a proportion of a period if > the period hasn't elapsed ought to cover it. I'll look into it. I'm thinking of - busywaiting if the current period hasn't elapsed (should rarely if ever the case since the fiq works reliable and the timer interrupt introduces additional delays. - calculate the next callback time based on the current offset. If you haven't pushed the patches forward it would be good to delay the hrtimer patch a bit. I managed to shoot the system down while playing audio with a hackbench 10. This doesn't happen without the hrtimer patch. This may be related to the problem Valentin reported. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: imx-ssi fixes 2010-04-08 15:51 ` Sascha Hauer @ 2010-04-08 15:54 ` Mark Brown 0 siblings, 0 replies; 9+ messages in thread From: Mark Brown @ 2010-04-08 15:54 UTC (permalink / raw) To: Sascha Hauer; +Cc: alsa-devel, Valentin Longchamp On Thu, Apr 08, 2010 at 05:51:13PM +0200, Sascha Hauer wrote: > If you haven't pushed the patches forward it would be good to delay the > hrtimer patch a bit. I managed to shoot the system down while playing > audio with a hackbench 10. This doesn't happen without the hrtimer > patch. This may be related to the problem Valentin reported. Already pushed to Takashi, but he's not pulled yet. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-04-15 1:30 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-04-14 7:17 imx-ssi fixes Sascha Hauer 2010-04-14 7:17 ` [PATCH 1/2] imx-ssi: do not call hrtimer_disable in trigger function Sascha Hauer 2010-04-14 7:41 ` Liam Girdwood 2010-04-14 7:17 ` [PATCH 2/2] imx-ssi: increase minimum periods to 4 Sascha Hauer 2010-04-15 1:30 ` imx-ssi fixes Mark Brown -- strict thread matches above, loose matches on Subject: below -- 2010-04-08 9:31 Sascha Hauer 2010-04-08 14:47 ` Mark Brown 2010-04-08 15:51 ` Sascha Hauer 2010-04-08 15:54 ` Mark Brown
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).