All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Khapyorsky <sashak@smlink.com>
To: alsa-devel@lists.sourceforge.netalsa-devel@lists.sourceforge.net,
	Takashi Iwai <tiwai@suse.de>
Cc: Alastair Poole <unixtricks@btinternet.com>
Subject: atiixp_modem.c patch + problem.
Date: Wed, 7 Jul 2004 21:48:50 +0300	[thread overview]
Message-ID: <20040707214850.55a91c52@sashak.lan> (raw)

[-- Attachment #1: Type: text/plain, Size: 887 bytes --]

Hello All,

I've played with atiixp modem driver and there is the patch for
atiixp_modem.c (also attached to [ALSA - driver 0000259]). Now the
driver is able to setup HOOK state and line level,rate.

However there still be a problem, and I need your suggestions to solve
this.

The problem is that there is 32-bit (only?) dma transfer, but modem
expects 16-bit samples (1 channel, S16_LE). For instance: with 1 channel
capture setup dma data actually looks like 2 channels frames (valid
samples are in right channel), sample rate is doubled and readi()
returns buffer with 2 channels frames.

I think that valid samples may be separated by using copy() callback,
but not sure that this is optimal and suitable way.

Also since I don't have sophisticated spec for this hardware, I am not
sure that there is no possibility just to setup DMA appropriately.

Any suggestions?

TIA,

Sasha.


[-- Attachment #2: atiixp_modem.c.patch --]
[-- Type: text/x-patch, Size: 2670 bytes --]

Index: alsa-driver/pci/atiixp_modem.c
===================================================================
RCS file: /cvsroot/alsa/alsa-driver/pci/atiixp_modem.c,v
retrieving revision 1.6
diff -u -b -B -r1.6 atiixp_modem.c
--- alsa-driver/pci/atiixp_modem.c	5 Jul 2004 15:07:21 -0000	1.6
+++ alsa-driver/pci/atiixp_modem.c	7 Jul 2004 14:06:49 -0000
@@ -155,8 +155,11 @@
 #define ATI_REG_MODEM_OUT_DMA3_DT_CUR	0x64
 #define ATI_REG_MODEM_OUT_DMA12_DT_SIZE	0x68
 #define ATI_REG_MODEM_OUT_DMA3_DT_SIZE	0x6c
-#define ATI_REG_MODEM_OUT_GPIO		0x70
-#define ATI_REG_MODEM_IN_GPIO		0x74
+#define ATI_REG_MODEM_OUT_FIFO_USED     0x70
+#define ATI_REG_MODEM_OUT_GPIO		0x74
+#define  ATI_REG_MODEM_OUT_GPIO_EN	   1
+#define  ATI_REG_MODEM_OUT_GPIO_DATA_SHIFT 5
+#define ATI_REG_MODEM_IN_GPIO		0x78
 
 #define ATI_REG_MODEM_MIRROR		0x7c
 #define ATI_REG_AUDIO_MIRROR		0x80
@@ -355,7 +358,7 @@
 		dma->period_bytes = dma->periods = 0; /* clear */
 	}
 
-	if (dma->periods == dma->periods && dma->period_bytes == period_bytes)
+	if (dma->periods == periods && dma->period_bytes == period_bytes)
 		return 0;
 
 	/* reset DMA before changing the descriptor table */
@@ -676,6 +679,7 @@
 {
 	atiixp_t *chip = snd_pcm_substream_chip(substream);
 	atiixp_dma_t *dma = (atiixp_dma_t *)substream->runtime->private_data;
+	unsigned int reg = 0;
 	int i;
 
 	snd_assert(dma->ops->enable_transfer && dma->ops->flush_dma, return -EINVAL);
@@ -683,15 +687,22 @@
 	if (cmd != SNDRV_PCM_TRIGGER_START && cmd != SNDRV_PCM_TRIGGER_STOP)
 		return -EINVAL;
 
+	spin_lock(&chip->reg_lock);
+
+	/* hook off/on: via GPIO_OUT */
 	for (i = 0; i < NUM_ATI_CODECS; i++) {
-		if (chip->ac97[i])
-			snd_ac97_update_bits(chip->ac97[i], AC97_GPIO_STATUS,
-					     AC97_GPIO_LINE1_OH,
-					     cmd == SNDRV_PCM_TRIGGER_START ?
-					     AC97_GPIO_LINE1_OH : 0);
+		if (chip->ac97[i]) {
+			reg = snd_ac97_read(chip->ac97[i], AC97_GPIO_STATUS);
+			break;
 	}
+	}
+	if(cmd == SNDRV_PCM_TRIGGER_START)
+		reg |= AC97_GPIO_LINE1_OH;
+	else
+		reg &= ~AC97_GPIO_LINE1_OH;
+	reg = (reg << ATI_REG_MODEM_OUT_GPIO_DATA_SHIFT) | ATI_REG_MODEM_OUT_GPIO_EN ;
+	atiixp_write(chip, MODEM_OUT_GPIO, reg);
 
-	spin_lock(&chip->reg_lock);
 	if (cmd == SNDRV_PCM_TRIGGER_START) {
 		dma->ops->enable_transfer(chip, 1);
 		dma->running = 1;
@@ -818,8 +829,8 @@
 	for (i = 0; i < NUM_ATI_CODECS; i++) {
 		if (! chip->ac97[i])
 			continue;
-		snd_ac97_update(chip->ac97[i], AC97_LINE1_RATE, params_rate(hw_params));
-		snd_ac97_update(chip->ac97[i], AC97_LINE1_LEVEL, 0);
+		snd_ac97_write(chip->ac97[i], AC97_LINE1_RATE, params_rate(hw_params));
+		snd_ac97_write(chip->ac97[i], AC97_LINE1_LEVEL, 0);
 	}
 
 	return err;

                 reply	other threads:[~2004-07-07 18:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040707214850.55a91c52@sashak.lan \
    --to=sashak@smlink.com \
    --cc=alsa-devel@lists.sourceforge.netalsa-devel \
    --cc=unixtricks@btinternet.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.