Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Langer <martin-langer@gmx.de>
To: alsa-devel@alsa-project.org
Subject: PATCH] 3/3 miro: set mixer values for aci on startup
Date: Fri, 24 Jun 2005 01:02:32 +0200	[thread overview]
Message-ID: <20050623230232.GA3304@tuba> (raw)

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

It's much better to start the PCM20 with known values in the aci regs. 
The patch sets a bunch of mixer regs during init now. We've had a few 
aci register inits before. Now they are all merged into one function.

Signed-off-by: Martin Langer <martin-langer@gmx.de>

[-- Attachment #2: miro_init.patch --]
[-- Type: text/plain, Size: 3307 bytes --]

--- isa/opti9xx/miro.c.2_mpu401	Fri Jun 24 00:19:26 2005
+++ isa/opti9xx/miro.c	Fri Jun 24 00:20:26 2005
@@ -613,6 +613,68 @@
 	.put = snd_miro_put_capture,
 }};
 
+static unsigned char aci_init_values[][2] __initdata = {
+	{ ACI_SET_MUTE, 0x00 },
+	{ ACI_SET_POWERAMP, 0x00 },
+	{ ACI_SET_PREAMP, 0x00 },
+	{ ACI_SET_SOLOMODE, 0x00 },
+	{ ACI_SET_MIC + 0, 0x20 },
+	{ ACI_SET_MIC + 8, 0x20 },
+	{ ACI_SET_LINE + 0, 0x20 },
+	{ ACI_SET_LINE + 8, 0x20 },
+	{ ACI_SET_CD + 0, 0x20 },
+	{ ACI_SET_CD + 8, 0x20 },
+	{ ACI_SET_PCM + 0, 0x20 },
+	{ ACI_SET_PCM + 8, 0x20 },
+	{ ACI_SET_LINE1 + 0, 0x20 },
+	{ ACI_SET_LINE1 + 8, 0x20 },
+	{ ACI_SET_LINE2 + 0, 0x20 },
+	{ ACI_SET_LINE2 + 8, 0x20 },
+	{ ACI_SET_SYNTH + 0, 0x20 },
+	{ ACI_SET_SYNTH + 8, 0x20 },
+	{ ACI_SET_MASTER + 0, 0x20 },
+	{ ACI_SET_MASTER + 1, 0x20 },
+};
+
+static int __devinit snd_set_aci_init_values(miro_t *miro)
+{
+	int idx, error;
+
+	/* enable WSS on PCM1 */
+
+	if ((miro->aci_product == 'A') && wss) {
+		if ((error = aci_setvalue(miro, ACI_SET_WSS, wss)) < 0) {
+			snd_printk("enabling WSS mode failed\n");
+			return error;
+		}
+	}
+
+	/* enable IDE port */
+
+	if (ide) {
+		if ((error = aci_setvalue(miro, ACI_SET_IDE, ide)) < 0) {
+			snd_printk("enabling IDE port failed\n");
+			return error;
+		}
+	}
+
+	/* set common aci values */
+
+	for (idx = 0; idx < ARRAY_SIZE(aci_init_values); idx++)
+                if ((error = aci_setvalue(miro, aci_init_values[idx][0], 
+					  aci_init_values[idx][1])) < 0) {
+                        snd_printk("aci_setvalue(%d) failed: %d\n", 
+				   aci_init_values[idx][0], error);
+                        return error;
+                }
+
+	miro->aci_amp = 0;
+	miro->aci_preamp = 0;
+	miro->aci_solomode = 1;
+
+	return 0;
+}
+
 static int snd_miro_mixer(miro_t *miro)
 {
 	snd_card_t *card;
@@ -1332,60 +1394,9 @@
 				&rmidi)))
 			snd_printk("no MPU-401 device at 0x%lx?\n", miro->mpu_port);
 
-	/* the aci mixer is muted after reset */
-
-	if (aci_cmd(miro, ACI_SET_MUTE, 0x00, -1) < 0) {
-		snd_printk("unset aci muting failed\n");
+	if ((error = snd_set_aci_init_values(miro)) < 0) {
 		snd_card_free(card);
-		return -EBUSY;
-	}
-
-	/* enable WSS on PCM1 */
-
-	if ((miro->aci_product == 'A') && wss) {
-		if ((error = aci_cmd(miro, ACI_SET_WSS, wss, -1)) < 0) {
-			snd_printk("jumping into WSS mode failed\n");
-			snd_card_free(card);
-			return -EIO;
-		}
-	}
-
-	/* enable IDE port */
-
-	if (ide) {
-		if ((error = aci_cmd(miro, ACI_SET_IDE, ide, -1)) < 0) {
-			snd_printk("enabling IDE port failed\n");
-			snd_card_free(card);
-			return -EIO;
-		}
-	}
-
-	/* disable aci preamp and poweramp */
-
-	if ((error = aci_setvalue(miro, ACI_SET_POWERAMP, 0)) < 0) {
-		snd_printk("unset aci power-amp failed\n");
-		snd_card_free(card);
-		return -EIO;
-	} else {
-		miro->aci_amp = 0;
-	}
-
-	if ((error = aci_setvalue(miro, ACI_SET_PREAMP, 0)) < 0) {
-		snd_printk("unset aci pre-amp failed\n");
-		snd_card_free(card);
-		return -EIO;
-	} else {
-		miro->aci_preamp = 0;
-	}
-
-	/* solo mode init */
-
-	if ((error = aci_setvalue(miro, ACI_SET_SOLOMODE, 0)) < 0) {
-		snd_printk("unset solomode failed\n");
-		snd_card_free(card);
-		return -EIO;
-	} else {
-		miro->aci_solomode = 1;
+                return error;
 	}
 
 	if ((error = snd_card_register(card))) {

                 reply	other threads:[~2005-06-23 23:00 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=20050623230232.GA3304@tuba \
    --to=martin-langer@gmx.de \
    --cc=alsa-devel@alsa-project.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox