* [PATCH 0/2] ASoC: omap-mcbsp: dma_op_mode changes
@ 2012-03-15 10:37 Peter Ujfalusi
2012-03-15 10:37 ` [PATCH 1/2] ASoC: omap-mcbsp: Use DMA packet mode for non mono streams on OMAP3+ Peter Ujfalusi
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Peter Ujfalusi @ 2012-03-15 10:37 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown; +Cc: alsa-devel, Jarkko Nikula
Hello,
Removing the frame dm_op_mode, and using packet mode in element mode on
OMAP3+ to transfer 1 sample at the time between the McBSP FIFO and memory.
Regards,
Peter
---
Peter Ujfalusi (2):
ASoC: omap-mcbsp: Use DMA packet mode for non mono streams on OMAP3+
ASoC: omap-mcbsp: Remove unused FRAME dma_op_mode
sound/soc/omap/mcbsp.c | 2 +-
sound/soc/omap/mcbsp.h | 1 -
sound/soc/omap/omap-mcbsp.c | 31 +++++++++++++++++--------------
3 files changed, 18 insertions(+), 16 deletions(-)
--
1.7.8.5
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] ASoC: omap-mcbsp: Use DMA packet mode for non mono streams on OMAP3+
2012-03-15 10:37 [PATCH 0/2] ASoC: omap-mcbsp: dma_op_mode changes Peter Ujfalusi
@ 2012-03-15 10:37 ` Peter Ujfalusi
2012-03-16 7:00 ` Jarkko Nikula
2012-03-15 10:37 ` [PATCH 2/2] ASoC: omap-mcbsp: Remove unused FRAME dma_op_mode Peter Ujfalusi
2012-03-15 12:22 ` [PATCH 0/2] ASoC: omap-mcbsp: dma_op_mode changes Mark Brown
2 siblings, 1 reply; 7+ messages in thread
From: Peter Ujfalusi @ 2012-03-15 10:37 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown; +Cc: alsa-devel, Jarkko Nikula
Take the DMA packet mode into use when the McBSP is configured in element
dma_op_mode if the stream is not mono.
In this way we transfer one sample from/to McBSP FIFO upon DMA request.
This change only affects OMAP3+ versions, where the McBSP ports have FIFO.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
sound/soc/omap/omap-mcbsp.c | 30 +++++++++++++++++-------------
1 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index 6912ac7..418dc3c 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -71,18 +71,17 @@ static void omap_mcbsp_set_threshold(struct snd_pcm_substream *substream)
dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
- /* TODO: Currently, MODE_ELEMENT == MODE_FRAME */
- if (mcbsp->dma_op_mode == MCBSP_DMA_MODE_THRESHOLD)
- /*
- * Configure McBSP threshold based on either:
- * packet_size, when the sDMA is in packet mode, or
- * based on the period size.
- */
- if (dma_data->packet_size)
- words = dma_data->packet_size;
- else
- words = snd_pcm_lib_period_bytes(substream) /
- (mcbsp->wlen / 8);
+ /*
+ * Configure McBSP threshold based on either:
+ * packet_size, when the sDMA is in packet mode, or based on the
+ * period size in THRESHOLD mode, otherwise use McBSP threshold = 1
+ * for mono streams.
+ */
+ 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;
@@ -230,6 +229,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
unsigned int format, div, framesize, master;
dma_data = &mcbsp->dma_data[substream->stream];
+ channels = params_channels(params);
switch (params_format(params)) {
case SNDRV_PCM_FORMAT_S16_LE:
@@ -283,6 +283,10 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
} else {
sync_mode = OMAP_DMA_SYNC_FRAME;
}
+ } else if (channels > 1) {
+ /* Use packet mode for non mono streams */
+ pkt_size = channels;
+ sync_mode = OMAP_DMA_SYNC_PACKET;
}
}
@@ -301,7 +305,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
regs->rcr1 &= ~(RFRLEN1(0x7f) | RWDLEN1(7));
regs->xcr1 &= ~(XFRLEN1(0x7f) | XWDLEN1(7));
format = mcbsp->fmt & SND_SOC_DAIFMT_FORMAT_MASK;
- wpf = channels = params_channels(params);
+ wpf = channels;
if (channels == 2 && (format == SND_SOC_DAIFMT_I2S ||
format == SND_SOC_DAIFMT_LEFT_J)) {
/* Use dual-phase frames */
--
1.7.8.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] ASoC: omap-mcbsp: Remove unused FRAME dma_op_mode
2012-03-15 10:37 [PATCH 0/2] ASoC: omap-mcbsp: dma_op_mode changes Peter Ujfalusi
2012-03-15 10:37 ` [PATCH 1/2] ASoC: omap-mcbsp: Use DMA packet mode for non mono streams on OMAP3+ Peter Ujfalusi
@ 2012-03-15 10:37 ` Peter Ujfalusi
2012-03-15 12:22 ` [PATCH 0/2] ASoC: omap-mcbsp: dma_op_mode changes Mark Brown
2 siblings, 0 replies; 7+ messages in thread
From: Peter Ujfalusi @ 2012-03-15 10:37 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown; +Cc: alsa-devel, Jarkko Nikula
The frame dma_op_mode has never been used, and it is just creating
confusion for users/developers.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
sound/soc/omap/mcbsp.c | 2 +-
sound/soc/omap/mcbsp.h | 1 -
sound/soc/omap/omap-mcbsp.c | 1 -
3 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
index e5f4444..ec6832c 100644
--- a/sound/soc/omap/mcbsp.c
+++ b/sound/soc/omap/mcbsp.c
@@ -754,7 +754,7 @@ THRESHOLD_PROP_BUILDER(max_tx_thres);
THRESHOLD_PROP_BUILDER(max_rx_thres);
static const char *dma_op_modes[] = {
- "element", "threshold", "frame",
+ "element", "threshold",
};
static ssize_t dma_op_mode_show(struct device *dev,
diff --git a/sound/soc/omap/mcbsp.h b/sound/soc/omap/mcbsp.h
index a944fcc..179a822 100644
--- a/sound/soc/omap/mcbsp.h
+++ b/sound/soc/omap/mcbsp.h
@@ -217,7 +217,6 @@ enum {
/********************** McBSP DMA operating modes **************************/
#define MCBSP_DMA_MODE_ELEMENT 0
#define MCBSP_DMA_MODE_THRESHOLD 1
-#define MCBSP_DMA_MODE_FRAME 2
/********************** McBSP WAKEUPEN bit definitions *********************/
#define RSYNCERREN BIT(0)
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index 418dc3c..27144a6 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -245,7 +245,6 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
}
if (mcbsp->pdata->buffer_size) {
dma_data->set_threshold = omap_mcbsp_set_threshold;
- /* TODO: Currently, MODE_ELEMENT == MODE_FRAME */
if (mcbsp->dma_op_mode == MCBSP_DMA_MODE_THRESHOLD) {
int period_words, max_thrsh;
--
1.7.8.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] ASoC: omap-mcbsp: dma_op_mode changes
2012-03-15 10:37 [PATCH 0/2] ASoC: omap-mcbsp: dma_op_mode changes Peter Ujfalusi
2012-03-15 10:37 ` [PATCH 1/2] ASoC: omap-mcbsp: Use DMA packet mode for non mono streams on OMAP3+ Peter Ujfalusi
2012-03-15 10:37 ` [PATCH 2/2] ASoC: omap-mcbsp: Remove unused FRAME dma_op_mode Peter Ujfalusi
@ 2012-03-15 12:22 ` Mark Brown
2012-03-16 6:29 ` Jarkko Nikula
2 siblings, 1 reply; 7+ messages in thread
From: Mark Brown @ 2012-03-15 12:22 UTC (permalink / raw)
To: Peter Ujfalusi; +Cc: alsa-devel, Liam Girdwood, Jarkko Nikula
[-- Attachment #1.1: Type: text/plain, Size: 302 bytes --]
On Thu, Mar 15, 2012 at 12:37:12PM +0200, Peter Ujfalusi wrote:
> Hello,
>
> Removing the frame dm_op_mode, and using packet mode in element mode on
> OMAP3+ to transfer 1 sample at the time between the McBSP FIFO and memory.
Both
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] ASoC: omap-mcbsp: dma_op_mode changes
2012-03-15 12:22 ` [PATCH 0/2] ASoC: omap-mcbsp: dma_op_mode changes Mark Brown
@ 2012-03-16 6:29 ` Jarkko Nikula
0 siblings, 0 replies; 7+ messages in thread
From: Jarkko Nikula @ 2012-03-16 6:29 UTC (permalink / raw)
To: Mark Brown; +Cc: Peter Ujfalusi, alsa-devel, Liam Girdwood
On 03/15/2012 02:22 PM, Mark Brown wrote:
> On Thu, Mar 15, 2012 at 12:37:12PM +0200, Peter Ujfalusi wrote:
>> Hello,
>>
>> Removing the frame dm_op_mode, and using packet mode in element mode on
>> OMAP3+ to transfer 1 sample at the time between the McBSP FIFO and memory.
>
> Both
>
> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] ASoC: omap-mcbsp: Use DMA packet mode for non mono streams on OMAP3+
2012-03-15 10:37 ` [PATCH 1/2] ASoC: omap-mcbsp: Use DMA packet mode for non mono streams on OMAP3+ Peter Ujfalusi
@ 2012-03-16 7:00 ` Jarkko Nikula
2012-03-16 12:06 ` Peter Ujfalusi
0 siblings, 1 reply; 7+ messages in thread
From: Jarkko Nikula @ 2012-03-16 7:00 UTC (permalink / raw)
To: Peter Ujfalusi; +Cc: alsa-devel, Mark Brown, Liam Girdwood
On 03/15/2012 12:37 PM, Peter Ujfalusi wrote:
> Take the DMA packet mode into use when the McBSP is configured in element
> dma_op_mode if the stream is not mono.
> In this way we transfer one sample from/to McBSP FIFO upon DMA request.
> This change only affects OMAP3+ versions, where the McBSP ports have FIFO.
>
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> ---
> sound/soc/omap/omap-mcbsp.c | 30 +++++++++++++++++-------------
> 1 files changed, 17 insertions(+), 13 deletions(-)
>
Out of curiosity, I guess this will decrease a memory bus or DMA
controller load a bit. Can you see any difference with the SW tools
(top, etc) under some system load or do you need some on-chip
observability to be able to measure effect of this transfer pattern change?
Just willing to learn here :-)
--
Jarkko
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] ASoC: omap-mcbsp: Use DMA packet mode for non mono streams on OMAP3+
2012-03-16 7:00 ` Jarkko Nikula
@ 2012-03-16 12:06 ` Peter Ujfalusi
0 siblings, 0 replies; 7+ messages in thread
From: Peter Ujfalusi @ 2012-03-16 12:06 UTC (permalink / raw)
To: Jarkko Nikula; +Cc: alsa-devel, Mark Brown, Liam Girdwood
Hi Jarkko,
On 03/16/2012 09:00 AM, Jarkko Nikula wrote:
> Out of curiosity, I guess this will decrease a memory bus or DMA
> controller load a bit.
Yes it will slightly decrease the load on those. It will also decrease
the number of DMA requests going from McBSP to the sDMA controller.
> Can you see any difference with the SW tools
> (top, etc) under some system load or do you need some on-chip
> observability to be able to measure effect of this transfer pattern change?
I can not see difference between the old
element/packet-element/threshold mode from user space point of view.
I think the effect can be seen in an optimized system more.
The decreased load on SDRAM/sDMA should help with the performance, less
DMA request means less frequent activity, which should decrease power
consumption.
Other good thing might be is that now the DMA moves in sample steps, and
not in words.
--
Péter
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-03-16 12:06 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-15 10:37 [PATCH 0/2] ASoC: omap-mcbsp: dma_op_mode changes Peter Ujfalusi
2012-03-15 10:37 ` [PATCH 1/2] ASoC: omap-mcbsp: Use DMA packet mode for non mono streams on OMAP3+ Peter Ujfalusi
2012-03-16 7:00 ` Jarkko Nikula
2012-03-16 12:06 ` Peter Ujfalusi
2012-03-15 10:37 ` [PATCH 2/2] ASoC: omap-mcbsp: Remove unused FRAME dma_op_mode Peter Ujfalusi
2012-03-15 12:22 ` [PATCH 0/2] ASoC: omap-mcbsp: dma_op_mode changes Mark Brown
2012-03-16 6:29 ` Jarkko Nikula
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.