From: peter.ujfalusi@ti.com (Peter Ujfalusi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 11/11] ASoC: omap-pcm: Convert to use dmaengine
Date: Wed, 12 Sep 2012 17:35:56 +0300 [thread overview]
Message-ID: <50509DCC.4000503@ti.com> (raw)
In-Reply-To: <505085DB.5000407@ti.com>
On 09/12/2012 03:53 PM, Peter Ujfalusi wrote:
> I need to look at this, but at first look we do wait for the drain in
> omap_stop_dma(). We used to use omap_stop_dma/omap_start_dma for pause/resume
> operations.
> But sDMA also have a bit: CDPi: PAUSE_LINK_LIST which should do what we are
> looking for.
> Need to read the relevant parts of the TRM, but AFAIK we are using normal mode
> with linked list (self linking).
> I already have the patch for this, I just need to test it on HW.
We can get the PAUSE/RESUME work either:
1.
drivers/dma/omap-dma.c
static int omap_dma_pause(struct omap_chan *c)
{
- /* FIXME: not supported by platform private API */
- return -EINVAL;
+ /* Only in cyclic mode */
+ if (!c->cyclic)
+ return -EINVAL;
+
+ if (!c->paused) {
+ omap_stop_dma(c->dma_ch);
+ c->paused = true;
+ }
+
+ return 0;
}
static int omap_dma_resume(struct omap_chan *c)
{
- /* FIXME: not supported by platform private API */
- return -EINVAL;
+ /* Only in cyclic mode */
+ if (!c->cyclic)
+ return -EINVAL;
+
+ if (c->paused) {
+ omap_start_dma(c->dma_ch);
+ c->paused = false;
+ }
+
+ return 0;
}
2.
arch/arm/plat-omap/dma.c
+void omap_pause_linked_dma(int lch)
+{
+ u32 l;
+ unsigned long flags;
+
+ local_irq_save(flags);
+ l = p->dma_read(CDP, lch);
+ l |= 0x80; /* PAUSE_LINK_LIST */
+ p->dma_write(l, CDP, lch);
+ local_irq_restore(flags);
+}
+EXPORT_SYMBOL(omap_pause_linked_dma);
+
+void omap_resume_linked_dma(int lch)
+{
+ u32 l;
+ unsigned long flags;
+
+ local_irq_save(flags);
+ l = p->dma_read(CDP, lch);
+ l &= (~0x80); /* PAUSE_LINK_LIST */
+ p->dma_write(l, CDP, lch);
+ local_irq_restore(flags);
+}
+EXPORT_SYMBOL(omap_resume_linked_dma);
drivers/dma/omap-dma.c
static int omap_dma_pause(struct omap_chan *c)
{
- /* FIXME: not supported by platform private API */
- return -EINVAL;
+ /* Only in cyclic mode */
+ if (!c->cyclic)
+ return -EINVAL;
+
+ if (!c->paused) {
+ omap_pause_linked_dma(c->dma_ch);
+ c->paused = true;
+ }
+
+ return 0;
}
static int omap_dma_resume(struct omap_chan *c)
{
- /* FIXME: not supported by platform private API */
- return -EINVAL;
+ /* Only in cyclic mode */
+ if (!c->cyclic)
+ return -EINVAL;
+
+ if (c->paused) {
+ omap_resume_linked_dma(c->dma_ch);
+ c->paused = false;
+ }
+
+ return 0;
}
Both works fine (have tested it on BeagleBoard with mplayer).
With [1] we have identical way of dealing with the PAUSE/RESUME as we had
previously, so it is know to work fine on OMAP1/2/3/4/5
We have never used [2] in the past, but I think that is not going to work on
OMAP1 and OMAP2420. Also we need to add code to arch/arm/plat-omap/dma.c for
this...
I can resend the series with either of these to fix this regression caused by
the dmaengine conversion (after cleanup off course).
--
P?ter
next prev parent reply other threads:[~2012-09-12 14:35 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-12 11:46 [PATCH 00/11] ASoC: OMAP: Convert to use dmaengine Peter Ujfalusi
2012-09-12 11:46 ` [PATCH 01/11] dmaengine: omap: Support for element mode in cyclic DMA Peter Ujfalusi
2012-09-12 11:46 ` [PATCH 02/11] ASoC: omap-mcbsp: Use sDMA packet mode instead of frame mode Peter Ujfalusi
2012-09-12 11:46 ` [PATCH 03/11] ASoC: omap-pcm: Select sDMA synchronization based on packet_size Peter Ujfalusi
2012-09-12 11:47 ` [PATCH 04/11] ASoC: OMAP: Remove sync_mode from omap_pcm_dma_data struct Peter Ujfalusi
2012-09-12 11:47 ` [PATCH 05/11] ASoC: omap-pcm: Prepare to configure the DMA data_type based on stream properties Peter Ujfalusi
2012-09-12 11:47 ` [PATCH 06/11] ARM: OMAP4: hwmod_data: Add resource names to McPDM memory ranges Peter Ujfalusi
2012-09-12 11:47 ` [PATCH 07/11] ASoC: omap-mcpdm: Use platform_get_resource_* to get resources Peter Ujfalusi
2012-09-12 11:47 ` [PATCH 08/11] ASoC: OMAP: mcbsp, mcpdm, dmic: Let omap-pcm to pick the dma_type Peter Ujfalusi
2012-09-12 11:47 ` [PATCH 09/11] ASoC: omap-pcm, omap-hdmi: Change the use of omap_pcm_dma_data->data_type Peter Ujfalusi
2012-09-12 11:47 ` [PATCH 10/11] ASoC: OMAP: mcbsp, mcpdm, dmic, hdmi: Set dma_data at startup time Peter Ujfalusi
2012-09-12 11:47 ` [PATCH 11/11] ASoC: omap-pcm: Convert to use dmaengine Peter Ujfalusi
2012-09-12 12:00 ` Russell King - ARM Linux
2012-09-12 12:53 ` Peter Ujfalusi
2012-09-12 14:35 ` Peter Ujfalusi [this message]
2012-09-12 14:05 ` [alsa-devel] " Takashi Iwai
2012-09-13 8:11 ` [PATCH 00/11] ASoC: OMAP: " Mark Brown
2012-09-13 9:20 ` Peter Ujfalusi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50509DCC.4000503@ti.com \
--to=peter.ujfalusi@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).