From: peter.ujfalusi@ti.com (Peter Ujfalusi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 06/15] ASoC: omap-mcbsp: Use sDMA packet mode instead of frame mode
Date: Thu, 13 Sep 2012 16:37:56 +0300 [thread overview]
Message-ID: <1347543485-339-7-git-send-email-peter.ujfalusi@ti.com> (raw)
In-Reply-To: <1347543485-339-1-git-send-email-peter.ujfalusi@ti.com>
When McBSP is configured in threshold mode we can use sDMA packet mode in
all cases.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
sound/soc/omap/omap-mcbsp.c | 47 ++++++++++++++++-----------------------------
1 file changed, 17 insertions(+), 30 deletions(-)
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index 2e91a86..fe3debc 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -81,9 +81,6 @@ static void omap_mcbsp_set_threshold(struct snd_pcm_substream *substream)
*/
if (dma_data->packet_size)
words = dma_data->packet_size;
- else if (mcbsp->dma_op_mode == MCBSP_DMA_MODE_THRESHOLD)
- words = snd_pcm_lib_period_bytes(substream) /
- (mcbsp->wlen / 8);
else
words = 1;
@@ -251,6 +248,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
dma_data->set_threshold = omap_mcbsp_set_threshold;
if (mcbsp->dma_op_mode == MCBSP_DMA_MODE_THRESHOLD) {
int period_words, max_thrsh;
+ int divider = 0;
period_words = params_period_bytes(params) / (wlen / 8);
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
@@ -258,34 +256,23 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
else
max_thrsh = mcbsp->max_rx_thres;
/*
- * If the period contains less or equal number of words,
- * we are using the original threshold mode setup:
- * McBSP threshold = sDMA frame size = period_size
- * Otherwise we switch to sDMA packet mode:
- * McBSP threshold = sDMA packet size
- * sDMA frame size = period size
+ * Use sDMA packet mode if McBSP is in threshold mode:
+ * If period words less than the FIFO size the packet
+ * size is set to the number of period words, otherwise
+ * Look for the biggest threshold value which divides
+ * the period size evenly.
*/
- if (period_words > max_thrsh) {
- int divider = 0;
-
- /*
- * Look for the biggest threshold value, which
- * divides the period size evenly.
- */
- divider = period_words / max_thrsh;
- if (period_words % max_thrsh)
- divider++;
- while (period_words % divider &&
- divider < period_words)
- divider++;
- if (divider == period_words)
- return -EINVAL;
-
- pkt_size = period_words / divider;
- sync_mode = OMAP_DMA_SYNC_PACKET;
- } else {
- sync_mode = OMAP_DMA_SYNC_FRAME;
- }
+ divider = period_words / max_thrsh;
+ if (period_words % max_thrsh)
+ divider++;
+ while (period_words % divider &&
+ divider < period_words)
+ divider++;
+ if (divider == period_words)
+ return -EINVAL;
+
+ pkt_size = period_words / divider;
+ sync_mode = OMAP_DMA_SYNC_PACKET;
} else if (channels > 1) {
/* Use packet mode for non mono streams */
pkt_size = channels;
--
1.7.12
next prev parent reply other threads:[~2012-09-13 13:37 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-13 13:37 [PATCH v2 00/15] ASoC: OMAP: Convert to use dmaengine Peter Ujfalusi
2012-09-13 13:37 ` [PATCH v2 01/15] dmaengine: omap: Support for element mode in cyclic DMA Peter Ujfalusi
2012-09-13 13:37 ` [PATCH v2 02/15] dmaengine: omap: Add support for pause/resume in cyclic dma mode Peter Ujfalusi
2012-09-13 13:37 ` [PATCH v2 03/15] dmaengine: Add no_wakeup parameter to dmaengine_prep_dma_cyclic() Peter Ujfalusi
2012-09-13 15:27 ` Lars-Peter Clausen
2012-09-13 15:38 ` Russell King - ARM Linux
2012-09-14 3:27 ` Vinod Koul
2012-09-14 7:15 ` Peter Ujfalusi
2012-09-14 3:26 ` Vinod Koul
2012-09-14 7:18 ` [alsa-devel] " Peter Ujfalusi
2012-09-14 8:13 ` Lars-Peter Clausen
2012-09-14 8:50 ` Vinod Koul
2012-09-14 9:28 ` Peter Ujfalusi
2012-09-14 9:38 ` Vinod Koul
2012-09-14 10:01 ` Russell King - ARM Linux
2012-09-14 7:12 ` Peter Ujfalusi
2012-09-13 13:37 ` [PATCH v2 04/15] dmaengine: Pass no_wakeup parameter via device_prep_dma_cyclic() callback Peter Ujfalusi
2012-09-14 3:24 ` Vinod Koul
2012-09-14 7:07 ` Peter Ujfalusi
2012-09-17 6:34 ` Shawn Guo
2012-09-17 7:16 ` Peter Ujfalusi
2012-09-17 7:23 ` Shawn Guo
2012-09-17 9:01 ` Linus Walleij
2012-09-18 8:31 ` Russell King - ARM Linux
2012-09-18 9:00 ` Vinod Koul
2012-09-18 12:22 ` Linus Walleij
2012-09-13 13:37 ` [PATCH v2 05/15] dmaengine: omap-dma: Add support for no_wakeup in cyclic mode Peter Ujfalusi
2012-09-13 13:37 ` Peter Ujfalusi [this message]
2012-09-13 13:37 ` [PATCH v2 07/15] ASoC: omap-pcm: Select sDMA synchronization based on packet_size Peter Ujfalusi
2012-09-13 13:37 ` [PATCH v2 08/15] ASoC: OMAP: Remove sync_mode from omap_pcm_dma_data struct Peter Ujfalusi
2012-09-13 13:37 ` [PATCH v2 09/15] ASoC: omap-pcm: Prepare to configure the DMA data_type based on stream properties Peter Ujfalusi
2012-09-13 13:38 ` [PATCH v2 10/15] ARM: OMAP4: hwmod_data: Add resource names to McPDM memory ranges Peter Ujfalusi
2012-09-13 13:38 ` [PATCH v2 11/15] ASoC: omap-mcpdm: Use platform_get_resource_* to get resources Peter Ujfalusi
2012-09-13 13:38 ` [PATCH v2 12/15] ASoC: OMAP: mcbsp, mcpdm, dmic: Let omap-pcm to pick the dma_type Peter Ujfalusi
2012-09-13 13:38 ` [PATCH v2 13/15] ASoC: omap-pcm, omap-dmic: Change the use of omap_pcm_dma_data->data_type Peter Ujfalusi
2012-09-13 13:38 ` [PATCH v2 14/15] ASoC: OMAP: mcbsp, mcpdm, dmic, hdmi: Set dma_data at startup time Peter Ujfalusi
2012-09-13 13:38 ` [PATCH v2 15/15] ASoC: omap-pcm: Convert to use dmaengine 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=1347543485-339-7-git-send-email-peter.ujfalusi@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).