summaryrefslogtreecommitdiff
path: root/sound/soc/omap
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2011-08-02 14:35:30 +0400
committerPeter Ujfalusi <peter.ujfalusi@ti.com>2011-09-22 10:19:15 +0400
commitb199adfdff98092b16f67860013fb5263579c476 (patch)
tree524e368c9d92a09dad6f428392248450ee411331 /sound/soc/omap
parentd05e2ea8dcf5e30de3d5607abf44883ef17d589d (diff)
downloadlinux-b199adfdff98092b16f67860013fb5263579c476.tar.xz
ASoC: omap-mcpdm: Fix threshold and dma configuration
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> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
Diffstat (limited to 'sound/soc/omap')
-rw-r--r--sound/soc/omap/omap-mcpdm.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c
index bed09c27e44c..7727de0c998e 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;
}