All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@lists.sourceforge.net
Subject: can anyone test ibook (snapper) ?
Date: Mon, 14 Jul 2003 20:34:53 +0200	[thread overview]
Message-ID: <s5hznjht0s2.wl@alsa2.suse.de> (raw)

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

Hi,

can anyone test the attached patch for ibook/powerbook g4 with
"Snapper" chip?
(you can see the chip model via /proc/asound/cards.  there is a string
 AWACS, Screamer, DACA, Tumbler and Snapper.)

this will add the capture function.  i know at least the interrupts
generated but the volume was too.  you might need to tune some volumes
(e.g. Mix), or the capture volume might be too loud.  i don't see any
relevant register for ADC volume on this TAS chip...

note that this is just a test patch, and it is quite unsure that it
works as expected :)


Takashi

[-- Attachment #2: snapper-capture.dif --]
[-- Type: application/octet-stream, Size: 3521 bytes --]

Index: alsa-kernel/ppc/pmac.c
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/ppc/pmac.c,v
retrieving revision 1.32
diff -u -r1.32 pmac.c
--- alsa-kernel/ppc/pmac.c	18 Jun 2003 10:41:17 -0000	1.32
+++ alsa-kernel/ppc/pmac.c	14 Jul 2003 18:29:58 -0000
@@ -923,8 +923,6 @@
 	}
 	if (device_is_compatible(sound, "snapper")) {
 		chip->model = PMAC_SNAPPER;
-		chip->can_capture = 0;  /* no capture */
-		chip->can_duplex = 0;
 		// chip->can_byte_swap = 0; /* FIXME: check this */
 		chip->num_freqs = 2;
 		chip->freq_table = tumbler_freqs;
Index: alsa-kernel/ppc/tumbler.c
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/ppc/tumbler.c,v
retrieving revision 1.29
diff -u -r1.29 tumbler.c
--- alsa-kernel/ppc/tumbler.c	18 Jun 2003 10:41:17 -0000	1.29
+++ alsa-kernel/ppc/tumbler.c	14 Jul 2003 18:29:21 -0000
@@ -42,7 +42,7 @@
 #define TAS_I2C_ADDR	0x34
 
 /* registers */
-#define TAS_REG_MCS	0x01
+#define TAS_REG_MCS	0x01	/* main control */
 #define TAS_REG_DRC	0x02
 #define TAS_REG_VOL	0x04
 #define TAS_REG_TREBLE	0x05
@@ -56,6 +56,8 @@
 /* tas3004 */
 #define TAS_REG_LMIX	TAS_REG_INPUT1
 #define TAS_REG_RMIX	TAS_REG_INPUT2
+#define TAS_REG_MCS2	0x43		/* main control 2 */
+#define TAS_REG_ACS	0x40		/* analog control */
 
 /* mono volumes for tas3001c/tas3004 */
 enum {
@@ -98,21 +100,48 @@
 /*
  */
 
-static int tumbler_init_client(pmac_keywest_t *i2c)
+static int send_init_client(pmac_keywest_t *i2c, unsigned int *regs)
 {
-	int err, count = 10;
-	do {
-		/* normal operation, SCLK=64fps, i2s output, i2s input, 16bit width */
-		err =  snd_pmac_keywest_write_byte(i2c, TAS_REG_MCS,
-						   (1<<6)+(2<<4)+(2<<2)+0);
-		if (err >= 0)
-			return err;
-		mdelay(10);
-	} while (count--);
-	return -ENXIO;
+	while (*regs > 0) {
+		int err, count = 10;
+		do {
+			err =  snd_pmac_keywest_write_byte(i2c, regs[0], regs[1]);
+			if (err >= 0)
+				break;
+			mdelay(10);
+		} while (count--);
+		if (err < 0)
+			return -ENXIO;
+		regs += 2;
+	}
+	return 0;
 }
 
 
+static int tumbler_init_client(pmac_keywest_t *i2c)
+{
+	static unsigned int regs[] = {
+		/* normal operation, SCLK=64fps, i2s output, i2s input, 16bit width */
+		TAS_REG_MCS, (1<<6)|(2<<4)|(2<<2)|0,
+		0, /* terminator */
+	};
+	return send_init_client(i2c, regs);
+}
+
+static int snapper_init_client(pmac_keywest_t *i2c)
+{
+	static unsigned int regs[] = {
+		/* normal operation, SCLK=64fps, i2s output, 16bit width */
+		TAS_REG_MCS, (1<<6)|(2<<4)|0,
+		/* normal operation, all-pass mode */
+		TAS_REG_MCS2, (1<<1),
+		/* normal output, no deemphasis, A input, power-up */
+		TAS_REG_ACS, 0,
+		0, /* terminator */
+	};
+	return send_init_client(i2c, regs);
+}
+	
 /*
  * gpio access
  */
@@ -882,8 +911,8 @@
 	snd_assert(mix, return);
 
 	tumbler_reset_audio(chip);
-	if (mix->i2c.client) {
-		if (tumbler_init_client(&mix->i2c) < 0)
+	if (mix->i2c.client && mix->i2c.init_client) {
+		if (mix->i2c.init_client(&mix->i2c) < 0)
 			printk(KERN_ERR "tumbler_init_client error\n");
 	} else
 		printk(KERN_ERR "tumbler: i2c is not initialized\n");
@@ -987,11 +1016,12 @@
 	else
 		mix->i2c.addr = TAS_I2C_ADDR;
 
-	mix->i2c.init_client = tumbler_init_client;
 	if (chip->model == PMAC_TUMBLER) {
+		mix->i2c.init_client = tumbler_init_client;
 		mix->i2c.name = "TAS3001c";
 		chipname = "Tumbler";
 	} else {
+		mix->i2c.init_client = snapper_init_client;
 		mix->i2c.name = "TAS3004";
 		chipname = "Snapper";
 	}

                 reply	other threads:[~2003-07-14 18:34 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=s5hznjht0s2.wl@alsa2.suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@lists.sourceforge.net \
    /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.