From: Shane Wegner <shane@cm.nu>
To: linux-kernel@vger.kernel.org
Subject: [patch] 2.4 ac97_codec micboost control
Date: Mon, 12 May 2003 15:56:54 -0700 [thread overview]
Message-ID: <20030512225654.GA27358@cm.nu> (raw)
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);
next reply other threads:[~2003-05-12 22:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-12 22:56 Shane Wegner [this message]
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
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=20030512225654.GA27358@cm.nu \
--to=shane@cm.nu \
--cc=linux-kernel@vger.kernel.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