aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/omap/omap-mcbsp.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-25 11:45:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-25 11:45:25 -0400
commitbe87cfb47c5c740f7b17929bcd7c480b228513e0 (patch)
tree48a82c823205e4ac0b50ea7d6c336fc5a26b5bbe /sound/soc/omap/omap-mcbsp.c
parent58823de9d2f1265030d0d06cb03cc2a551994398 (diff)
parentadcc70b249ca77c1197eb62b1645146721ba6e5b (diff)
Merge tag 'sound-3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound update from Takashi Iwai: "This is the second updates for 3.5-rc1. It's mainly for OMAP4 HDMI updates and the device tree updates for OMAP, in addition to a couple of PCM accuray improvement and Realtek ALC269VD codec support." * tag 'sound-3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (21 commits) ALSA: hda/realtek - Add new codec support for ALC269VD ALSA: core: group read of pointer, tstamp and jiffies ASoC: OMAP: HDMI: Rename sound card source file ASoC: OMAP: HDMI: Make sound card naming more generic ASoC: OMAP: HDMI: Make build config options more generic ASoC: OMAP: HDMI: Expand capabilities of the HDMI DAI ASoC: OMAP: HDMI: Improve how the display state is verified ASoC: OMAP: HDMI: Expand configuration of hw_params ASoC: OMAP: HDMI: Use the DSS audio interface ASoC: OMAP: HDMI: Create a structure for private data of the CPU DAI ASoC: OMAP: HDMI: Change error values in HDMI CPU DAI ASoC: OMAP: HDMI: Update the platform device names ASoC: omap-abe-twl6040: Introduce driver data for runtime parameters ASoC: omap-abe-twl6040: Move Digital Mic widget into dapm table ASoC: omap-abe-twl6040: Keep only one snd_soc_dai_link structure ASoC: omap-dmic: Add device tree bindings ASoC: omap-mcpdm: Add device tree bindings ASoC: omap-mcbsp: buffer size constraint only applies to playback stream ASoC: omap-mcbsp: Use the common interrupt line if supported by the SoC ASoC: omap-mcbsp: Remove unused FRAME dma_op_mode ...
Diffstat (limited to 'sound/soc/omap/omap-mcbsp.c')
-rw-r--r--sound/soc/omap/omap-mcbsp.c45
1 files changed, 25 insertions, 20 deletions
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index 6912ac7cb62..1046083e90a 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)
71 71
72 dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); 72 dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
73 73
74 /* TODO: Currently, MODE_ELEMENT == MODE_FRAME */ 74 /*
75 if (mcbsp->dma_op_mode == MCBSP_DMA_MODE_THRESHOLD) 75 * Configure McBSP threshold based on either:
76 /* 76 * packet_size, when the sDMA is in packet mode, or based on the
77 * Configure McBSP threshold based on either: 77 * period size in THRESHOLD mode, otherwise use McBSP threshold = 1
78 * packet_size, when the sDMA is in packet mode, or 78 * for mono streams.
79 * based on the period size. 79 */
80 */ 80 if (dma_data->packet_size)
81 if (dma_data->packet_size) 81 words = dma_data->packet_size;
82 words = dma_data->packet_size; 82 else if (mcbsp->dma_op_mode == MCBSP_DMA_MODE_THRESHOLD)
83 else 83 words = snd_pcm_lib_period_bytes(substream) /
84 words = snd_pcm_lib_period_bytes(substream) / 84 (mcbsp->wlen / 8);
85 (mcbsp->wlen / 8);
86 else 85 else
87 words = 1; 86 words = 1;
88 87
@@ -139,13 +138,15 @@ static int omap_mcbsp_dai_startup(struct snd_pcm_substream *substream,
139 if (mcbsp->pdata->buffer_size) { 138 if (mcbsp->pdata->buffer_size) {
140 /* 139 /*
141 * Rule for the buffer size. We should not allow 140 * Rule for the buffer size. We should not allow
142 * smaller buffer than the FIFO size to avoid underruns 141 * smaller buffer than the FIFO size to avoid underruns.
142 * This applies only for the playback stream.
143 */ 143 */
144 snd_pcm_hw_rule_add(substream->runtime, 0, 144 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
145 SNDRV_PCM_HW_PARAM_BUFFER_SIZE, 145 snd_pcm_hw_rule_add(substream->runtime, 0,
146 omap_mcbsp_hwrule_min_buffersize, 146 SNDRV_PCM_HW_PARAM_BUFFER_SIZE,
147 mcbsp, 147 omap_mcbsp_hwrule_min_buffersize,
148 SNDRV_PCM_HW_PARAM_CHANNELS, -1); 148 mcbsp,
149 SNDRV_PCM_HW_PARAM_CHANNELS, -1);
149 150
150 /* Make sure, that the period size is always even */ 151 /* Make sure, that the period size is always even */
151 snd_pcm_hw_constraint_step(substream->runtime, 0, 152 snd_pcm_hw_constraint_step(substream->runtime, 0,
@@ -230,6 +231,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
230 unsigned int format, div, framesize, master; 231 unsigned int format, div, framesize, master;
231 232
232 dma_data = &mcbsp->dma_data[substream->stream]; 233 dma_data = &mcbsp->dma_data[substream->stream];
234 channels = params_channels(params);
233 235
234 switch (params_format(params)) { 236 switch (params_format(params)) {
235 case SNDRV_PCM_FORMAT_S16_LE: 237 case SNDRV_PCM_FORMAT_S16_LE:
@@ -245,7 +247,6 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
245 } 247 }
246 if (mcbsp->pdata->buffer_size) { 248 if (mcbsp->pdata->buffer_size) {
247 dma_data->set_threshold = omap_mcbsp_set_threshold; 249 dma_data->set_threshold = omap_mcbsp_set_threshold;
248 /* TODO: Currently, MODE_ELEMENT == MODE_FRAME */
249 if (mcbsp->dma_op_mode == MCBSP_DMA_MODE_THRESHOLD) { 250 if (mcbsp->dma_op_mode == MCBSP_DMA_MODE_THRESHOLD) {
250 int period_words, max_thrsh; 251 int period_words, max_thrsh;
251 252
@@ -283,6 +284,10 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
283 } else { 284 } else {
284 sync_mode = OMAP_DMA_SYNC_FRAME; 285 sync_mode = OMAP_DMA_SYNC_FRAME;
285 } 286 }
287 } else if (channels > 1) {
288 /* Use packet mode for non mono streams */
289 pkt_size = channels;
290 sync_mode = OMAP_DMA_SYNC_PACKET;
286 } 291 }
287 } 292 }
288 293
@@ -301,7 +306,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
301 regs->rcr1 &= ~(RFRLEN1(0x7f) | RWDLEN1(7)); 306 regs->rcr1 &= ~(RFRLEN1(0x7f) | RWDLEN1(7));
302 regs->xcr1 &= ~(XFRLEN1(0x7f) | XWDLEN1(7)); 307 regs->xcr1 &= ~(XFRLEN1(0x7f) | XWDLEN1(7));
303 format = mcbsp->fmt & SND_SOC_DAIFMT_FORMAT_MASK; 308 format = mcbsp->fmt & SND_SOC_DAIFMT_FORMAT_MASK;
304 wpf = channels = params_channels(params); 309 wpf = channels;
305 if (channels == 2 && (format == SND_SOC_DAIFMT_I2S || 310 if (channels == 2 && (format == SND_SOC_DAIFMT_I2S ||
306 format == SND_SOC_DAIFMT_LEFT_J)) { 311 format == SND_SOC_DAIFMT_LEFT_J)) {
307 /* Use dual-phase frames */ 312 /* Use dual-phase frames */