aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/omap/omap-mcpdm.c
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2011-08-02 06:35:30 -0400
committerPeter Ujfalusi <peter.ujfalusi@ti.com>2011-09-22 02:19:15 -0400
commitb199adfdff98092b16f67860013fb5263579c476 (patch)
tree524e368c9d92a09dad6f428392248450ee411331 /sound/soc/omap/omap-mcpdm.c
parentd05e2ea8dcf5e30de3d5607abf44883ef17d589d (diff)
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/omap-mcpdm.c')
-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[] = {
46 /* downlink */ 46 /* downlink */
47 { 47 {
48 .irq_mask = MCPDM_DN_IRQ_EMPTY | MCPDM_DN_IRQ_FULL, 48 .irq_mask = MCPDM_DN_IRQ_EMPTY | MCPDM_DN_IRQ_FULL,
49 .threshold = 1, 49 .threshold = 2,
50 .format = PDMOUTFORMAT_LJUST, 50 .format = PDMOUTFORMAT_LJUST,
51 }, 51 },
52 /* uplink */ 52 /* uplink */
53 { 53 {
54 .irq_mask = MCPDM_UP_IRQ_EMPTY | MCPDM_UP_IRQ_FULL, 54 .irq_mask = MCPDM_UP_IRQ_EMPTY | MCPDM_UP_IRQ_FULL,
55 .threshold = 1, 55 .threshold = UP_THRES_MAX - 3,
56 .format = PDMOUTFORMAT_LJUST, 56 .format = PDMOUTFORMAT_LJUST,
57 }, 57 },
58}; 58};
@@ -136,12 +136,11 @@ static int omap_mcpdm_dai_hw_params(struct snd_pcm_substream *substream,
136{ 136{
137 struct omap_mcpdm_data *mcpdm_priv = snd_soc_dai_get_drvdata(dai); 137 struct omap_mcpdm_data *mcpdm_priv = snd_soc_dai_get_drvdata(dai);
138 struct omap_mcpdm_link *mcpdm_links = mcpdm_priv->links; 138 struct omap_mcpdm_link *mcpdm_links = mcpdm_priv->links;
139 struct omap_pcm_dma_data *dma_data;
140 int threshold;
139 int stream = substream->stream; 141 int stream = substream->stream;
140 int channels, err, link_mask = 0; 142 int channels, err, link_mask = 0;
141 143
142 snd_soc_dai_set_dma_data(dai, substream,
143 &omap_mcpdm_dai_dma_params[stream]);
144
145 channels = params_channels(params); 144 channels = params_channels(params);
146 switch (channels) { 145 switch (channels) {
147 case 4: 146 case 4:
@@ -164,14 +163,22 @@ static int omap_mcpdm_dai_hw_params(struct snd_pcm_substream *substream,
164 return -EINVAL; 163 return -EINVAL;
165 } 164 }
166 165
166 dma_data = &omap_mcpdm_dai_dma_params[stream];
167 threshold = mcpdm_links[stream].threshold;
168
167 if (stream == SNDRV_PCM_STREAM_PLAYBACK) { 169 if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
168 mcpdm_links[stream].channels = link_mask << 3; 170 mcpdm_links[stream].channels = link_mask << 3;
171 dma_data->packet_size = (DN_THRES_MAX - threshold) * channels;
172
169 err = omap_mcpdm_playback_open(&mcpdm_links[stream]); 173 err = omap_mcpdm_playback_open(&mcpdm_links[stream]);
170 } else { 174 } else {
171 mcpdm_links[stream].channels = link_mask << 0; 175 mcpdm_links[stream].channels = link_mask << 0;
176 dma_data->packet_size = threshold * channels;
177
172 err = omap_mcpdm_capture_open(&mcpdm_links[stream]); 178 err = omap_mcpdm_capture_open(&mcpdm_links[stream]);
173 } 179 }
174 180
181 snd_soc_dai_set_dma_data(dai, substream, dma_data);
175 return err; 182 return err;
176} 183}
177 184