linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] 2.4 ac97_codec micboost control
@ 2003-05-12 22:56 Shane Wegner
  2003-05-13 21:11 ` [patch] 2.4 fix to allow vmalloc at interrupt time Matthew Jacob
  0 siblings, 1 reply; 8+ messages in thread
From: Shane Wegner @ 2003-05-12 22:56 UTC (permalink / raw)
  To: linux-kernel

Hi,

Attached is a small patch to enable the built-in mic boost
of the ac97_codec.  On my SB-live, it needs this to get
decent mic volume and I imagine this is the case for some
other cards as well.  It maps the micboost to
SOUND_MIXER_AGC which, well, isn't used for anything else
at present that I know of.

Applies to 2.4.21-rc2.

S

diff -urN linux.orig/drivers/sound/ac97_codec.c linux/drivers/sound/ac97_codec.c
--- linux.orig/drivers/sound/ac97_codec.c	2003-05-12 15:50:07.000000000 -0700
+++ linux/drivers/sound/ac97_codec.c	2003-05-12 15:50:52.000000000 -0700
@@ -400,6 +400,18 @@
 		if (left >= mh->scale)
 			left = mh->scale-1;
 		val |= left & 0x000e;
+	} else if (oss_channel == SOUND_MIXER_MIC) {
+		val = codec->codec_read(codec , mh->offset) & ~0x801f;
+		if (!left)
+			val |= AC97_MUTE;
+	 else {
+			left = ((100 - left) * mh->scale) / 100;
+			if (left >= mh->scale)
+				left = mh->scale-1;
+			val |= left;
+			/*  the low bit is optional in the tone sliders and masking
+			    it lets us avoid the 0xf 'bypass'.. */
+		}
 	} else if(left == 0) {
 		val = AC97_MUTE;
 	} else if (oss_channel == SOUND_MIXER_SPEAKER) {
@@ -418,14 +430,6 @@
 		if (left >= mh->scale)
 			left = mh->scale-1;
 		val = left;
-	} else if (oss_channel == SOUND_MIXER_MIC) {
-		val = codec->codec_read(codec , mh->offset) & ~0x801f;
-		left = ((100 - left) * mh->scale) / 100;
-		if (left >= mh->scale)
-			left = mh->scale-1;
-		val |= left;
-		/*  the low bit is optional in the tone sliders and masking
-		    it lets us avoid the 0xf 'bypass'.. */
 	}
 #ifdef DEBUG
 	printk(" 0x%04x", val);
@@ -574,6 +578,15 @@
 			codec->recmask_io(codec, 0, val);
 
 			return 0;
+		case _IOC_NR(SOUND_MIXER_AGC): {
+			u16 r = codec->codec_read(codec, AC97_MIC_VOL);
+			if (val)
+				r |= AC97_MICBOOST;
+			else
+				r &= ~AC97_MICBOOST;
+		codec->codec_write(codec, AC97_MIC_VOL, r);
+		return 0;
+		}
 		default: /* write a specific mixer */
 			i = _IOC_NR(cmd);
 

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

end of thread, other threads:[~2003-05-14  0:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-12 22:56 [patch] 2.4 ac97_codec micboost control Shane Wegner
2003-05-13 21:11 ` [patch] 2.4 fix to allow vmalloc at interrupt time Matthew Jacob
2003-05-13 21:17   ` William Lee Irwin III
2003-05-13 21:28     ` Matthew Jacob
2003-05-13 22:40     ` Russell King
2003-05-13 21:18   ` Christoph Hellwig
2003-05-13 22:34   ` Alan Cox
2003-05-13 23:21     ` Alan Cox

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).