aboutsummaryrefslogtreecommitdiffstats
path: root/sound/atmel
diff options
context:
space:
mode:
authorSedji Gaouaou <sedji.gaouaou@atmel.com>2010-02-25 12:59:40 -0500
committerTakashi Iwai <tiwai@suse.de>2010-03-25 15:22:36 -0400
commitec2755a93d5df044cb52558d2c778780272e0980 (patch)
tree4e906b7c7790f5c953e79b8fc4f5af1e850f9611 /sound/atmel
parent7177395fdd919e561544a7d1c0ac196098a2ae2d (diff)
ALSA: AC97: add full duplex support for atmel AT91 and AVR.
This patch add full duplex support on AT91 and AVR. It was a bug: we needed to check first if there are some chips opened so we could enable both reception and sending of the data. Signed-off-by: Sedji Gaouaou <sedji.gaouaou@atmel.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/atmel')
-rw-r--r--sound/atmel/ac97c.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c
index 3c0a6f4e3585..428121a7e705 100644
--- a/sound/atmel/ac97c.c
+++ b/sound/atmel/ac97c.c
@@ -339,7 +339,11 @@ static int atmel_ac97c_playback_prepare(struct snd_pcm_substream *substream)
339 ac97c_writel(chip, OCA, word); 339 ac97c_writel(chip, OCA, word);
340 340
341 /* configure sample format and size */ 341 /* configure sample format and size */
342 word = AC97C_CMR_DMAEN | AC97C_CMR_SIZE_16; 342 word = ac97c_readl(chip, CAMR);
343 if (chip->opened <= 1)
344 word = AC97C_CMR_DMAEN | AC97C_CMR_SIZE_16;
345 else
346 word |= AC97C_CMR_DMAEN | AC97C_CMR_SIZE_16;
343 347
344 switch (runtime->format) { 348 switch (runtime->format) {
345 case SNDRV_PCM_FORMAT_S16_LE: 349 case SNDRV_PCM_FORMAT_S16_LE:
@@ -426,7 +430,11 @@ static int atmel_ac97c_capture_prepare(struct snd_pcm_substream *substream)
426 ac97c_writel(chip, ICA, word); 430 ac97c_writel(chip, ICA, word);
427 431
428 /* configure sample format and size */ 432 /* configure sample format and size */
429 word = AC97C_CMR_DMAEN | AC97C_CMR_SIZE_16; 433 word = ac97c_readl(chip, CAMR);
434 if (chip->opened <= 1)
435 word = AC97C_CMR_DMAEN | AC97C_CMR_SIZE_16;
436 else
437 word |= AC97C_CMR_DMAEN | AC97C_CMR_SIZE_16;
430 438
431 switch (runtime->format) { 439 switch (runtime->format) {
432 case SNDRV_PCM_FORMAT_S16_LE: 440 case SNDRV_PCM_FORMAT_S16_LE:
@@ -506,7 +514,7 @@ atmel_ac97c_playback_trigger(struct snd_pcm_substream *substream, int cmd)
506 } else { 514 } else {
507 ptcr = ATMEL_PDC_TXTEN; 515 ptcr = ATMEL_PDC_TXTEN;
508 } 516 }
509 camr |= AC97C_CMR_CENA; 517 camr |= AC97C_CMR_CENA | AC97C_CSR_ENDTX;
510 break; 518 break;
511 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: /* fall through */ 519 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: /* fall through */
512 case SNDRV_PCM_TRIGGER_SUSPEND: /* fall through */ 520 case SNDRV_PCM_TRIGGER_SUSPEND: /* fall through */
@@ -551,7 +559,7 @@ atmel_ac97c_capture_trigger(struct snd_pcm_substream *substream, int cmd)
551 } else { 559 } else {
552 ptcr = ATMEL_PDC_RXTEN; 560 ptcr = ATMEL_PDC_RXTEN;
553 } 561 }
554 camr |= AC97C_CMR_CENA; 562 camr |= AC97C_CMR_CENA | AC97C_CSR_ENDRX;
555 break; 563 break;
556 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: /* fall through */ 564 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: /* fall through */
557 case SNDRV_PCM_TRIGGER_SUSPEND: /* fall through */ 565 case SNDRV_PCM_TRIGGER_SUSPEND: /* fall through */