alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [patch 2/2] AC97: add full duplex support for atmel AT91 and AVR.
@ 2010-02-25 17:59 Sedji Gaouaou
  2010-02-26  9:15 ` Liam Girdwood
  2010-02-26 10:02 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Sedji Gaouaou @ 2010-02-25 17:59 UTC (permalink / raw)
  To: alsa-devel; +Cc: sedji.gaouaou, lrg

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>
---
 sound/atmel/ac97c.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c
index d48a59a..6f5e22c 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)
 	ac97c_writel(chip, OCA, word);
 
 	/* configure sample format and size */
-	word = AC97C_CMR_DMAEN | AC97C_CMR_SIZE_16;
+	word = ac97c_readl(chip, CAMR);
+	if (chip->opened <= 1)
+		word = AC97C_CMR_DMAEN | AC97C_CMR_SIZE_16;
+	else
+		word |= AC97C_CMR_DMAEN | AC97C_CMR_SIZE_16;
 
 	switch (runtime->format) {
 	case SNDRV_PCM_FORMAT_S16_LE:
@@ -426,7 +430,11 @@ static int atmel_ac97c_capture_prepare(struct snd_pcm_substream *substream)
 	ac97c_writel(chip, ICA, word);
 
 	/* configure sample format and size */
-	word = AC97C_CMR_DMAEN | AC97C_CMR_SIZE_16;
+	word = ac97c_readl(chip, CAMR);
+	if (chip->opened <= 1)
+		word = AC97C_CMR_DMAEN | AC97C_CMR_SIZE_16;
+	else
+		word |= AC97C_CMR_DMAEN | AC97C_CMR_SIZE_16;
 
 	switch (runtime->format) {
 	case SNDRV_PCM_FORMAT_S16_LE:
@@ -506,7 +514,7 @@ atmel_ac97c_playback_trigger(struct snd_pcm_substream *substream, int cmd)
 		} else {
 			ptcr = ATMEL_PDC_TXTEN;
 		}
-		camr |= AC97C_CMR_CENA;
+		camr |= AC97C_CMR_CENA | AC97C_CSR_ENDTX;
 		break;
 	case SNDRV_PCM_TRIGGER_PAUSE_PUSH: /* fall through */
 	case SNDRV_PCM_TRIGGER_SUSPEND: /* fall through */
@@ -551,7 +559,7 @@ atmel_ac97c_capture_trigger(struct snd_pcm_substream *substream, int cmd)
 		} else {
 			ptcr = ATMEL_PDC_RXTEN;
 		}
-		camr |= AC97C_CMR_CENA;
+		camr |= AC97C_CMR_CENA | AC97C_CSR_ENDRX;
 		break;
 	case SNDRV_PCM_TRIGGER_PAUSE_PUSH: /* fall through */
 	case SNDRV_PCM_TRIGGER_SUSPEND: /* fall through */
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-02-26 10:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-25 17:59 [PATCH] [patch 2/2] AC97: add full duplex support for atmel AT91 and AVR Sedji Gaouaou
2010-02-26  9:15 ` Liam Girdwood
2010-02-26 10:02 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).