All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Liam Girdwood <lrg@ti.com>, Tony Lindgren <tony@atomide.com>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: linux-omap@vger.kernel.org, alsa-devel@alsa-project.org,
	Misael Lopez Cruz <misael.lopez@ti.com>,
	Benoit Cousson <b-cousson@ti.com>,
	Sebastien Guiriec <s-guiriec@ti.com>
Subject: [PATCH 3/4] ASoC: omap-mcpdm: Fix threshold and dma configuration
Date: Tue, 2 Aug 2011 14:34:16 +0300	[thread overview]
Message-ID: <1312284857-1774-4-git-send-email-peter.ujfalusi@ti.com> (raw)
In-Reply-To: <1312284857-1774-1-git-send-email-peter.ujfalusi@ti.com>

DMA packet_size must be configured based on the McPDM FIFO threshold
value, number of channels.
Due to the FIFO operation the DMA muse be configured differently for
playback, and capture.
At the same time fix the McPDM threshold values used for playback, and
capture to avoid broken code.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 sound/soc/omap/omap-mcpdm.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c
index bed09c2..7727de0 100644
--- a/sound/soc/omap/omap-mcpdm.c
+++ b/sound/soc/omap/omap-mcpdm.c
@@ -46,13 +46,13 @@ static struct omap_mcpdm_link omap_mcpdm_links[] = {
 	/* downlink */
 	{
 		.irq_mask = MCPDM_DN_IRQ_EMPTY | MCPDM_DN_IRQ_FULL,
-		.threshold = 1,
+		.threshold = 2,
 		.format = PDMOUTFORMAT_LJUST,
 	},
 	/* uplink */
 	{
 		.irq_mask = MCPDM_UP_IRQ_EMPTY | MCPDM_UP_IRQ_FULL,
-		.threshold = 1,
+		.threshold = UP_THRES_MAX - 3,
 		.format = PDMOUTFORMAT_LJUST,
 	},
 };
@@ -136,12 +136,11 @@ static int omap_mcpdm_dai_hw_params(struct snd_pcm_substream *substream,
 {
 	struct omap_mcpdm_data *mcpdm_priv = snd_soc_dai_get_drvdata(dai);
 	struct omap_mcpdm_link *mcpdm_links = mcpdm_priv->links;
+	struct omap_pcm_dma_data *dma_data;
+	int threshold;
 	int stream = substream->stream;
 	int channels, err, link_mask = 0;
 
-	snd_soc_dai_set_dma_data(dai, substream,
-				 &omap_mcpdm_dai_dma_params[stream]);
-
 	channels = params_channels(params);
 	switch (channels) {
 	case 4:
@@ -164,14 +163,22 @@ static int omap_mcpdm_dai_hw_params(struct snd_pcm_substream *substream,
 		return -EINVAL;
 	}
 
+	dma_data = &omap_mcpdm_dai_dma_params[stream];
+	threshold = mcpdm_links[stream].threshold;
+
 	if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
 		mcpdm_links[stream].channels = link_mask << 3;
+		dma_data->packet_size = (DN_THRES_MAX - threshold) * channels;
+
 		err = omap_mcpdm_playback_open(&mcpdm_links[stream]);
 	} else {
 		mcpdm_links[stream].channels = link_mask << 0;
+		dma_data->packet_size = threshold * channels;
+
 		err = omap_mcpdm_capture_open(&mcpdm_links[stream]);
 	}
 
+	snd_soc_dai_set_dma_data(dai, substream, dma_data);
 	return err;
 }
 
-- 
1.7.6


  parent reply	other threads:[~2011-08-02 11:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-02 11:34 [PATCH 0/4] ASoC: OMAP4: McPDM: Fix legacy support Peter Ujfalusi
2011-08-02 11:34 ` [PATCH 1/4] OMAP: McPDM: Convert McPDM device to omap_device Peter Ujfalusi
2011-08-19 13:02   ` Tony Lindgren
2011-08-02 11:34 ` [PATCH 2/4] OMAP4: hwmod: enable mcpdm hwmod device Peter Ujfalusi
2011-08-19 13:02   ` Tony Lindgren
2011-08-02 11:34 ` Peter Ujfalusi [this message]
2011-08-02 15:50   ` [PATCH 3/4] ASoC: omap-mcpdm: Fix threshold and dma configuration Mark Brown
2011-08-02 11:34 ` [PATCH 4/4] ASoC: OMAP4: McPDM: Convert to hwmod/omap_device Peter Ujfalusi
2011-08-02 16:07   ` Mark Brown
2011-08-03  7:58   ` [alsa-devel] " Péter Ujfalusi
2011-08-09  7:27 ` [alsa-devel] [PATCH 0/4] ASoC: OMAP4: McPDM: Fix legacy support Péter Ujfalusi
2011-08-15 11:28   ` Péter Ujfalusi
2011-08-19 13:04     ` Re: [alsa-devel] " Tony Lindgren
2011-08-22  7:13       ` Péter Ujfalusi
2011-08-22  7:38         ` Liam Girdwood

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=1312284857-1774-4-git-send-email-peter.ujfalusi@ti.com \
    --to=peter.ujfalusi@ti.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=b-cousson@ti.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=lrg@ti.com \
    --cc=misael.lopez@ti.com \
    --cc=s-guiriec@ti.com \
    --cc=tony@atomide.com \
    /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 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.