[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#581876: Please apply upstream patch to fix the beep for some Thinkpad machines



Note: the commits I refer below to are taken from
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git


Andrei Popescu <andreimpopescu@gmail.com> writes:

> 2.6.30 introduced a regression where some Thinkpads would not beep 
> anymore on plugging/unplugging the power chord. See this thread
> http://sourceforge.net/mailarchive/message.php?msg_id=m31vgd2v3h.fsf%40fox.lamasti.net
> for more info.
>
> The alsa developers came up with a patch[1], but I haven't been able to 
> test it myself as it won't apply against 2.6.32 from sid or even 2.6.33 
> from experimental.

That's because it depends on ee6e365e30f7ee89bd214ff1215aaf90e93d4c40
which isn't merged.  You may apply that first and then
0bf0e5a6f304ac1bc93a80cdd68b4d91f3519eb5 (which is the patch you refer
to taken from Linus' tree).  Together they apply cleanly to 2.6.32.

Or you could try the patch I've attached, which is a backported variant
of 0bf0e5a6f304ac1bc93a80cdd68b4d91f3519eb5, avoiding the change in
ee6e365e30f7ee89bd214ff1215aaf90e93d4c40.

If this does fix a regression in 2.6.32, then I guess it's really more
material for 2.6.32 stable than for Debian kernels directly?



Bjørn

>From 2ac9a8175fe49bb994f87eedbc30572978325d05 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Fri, 26 Mar 2010 10:33:18 +0100
Subject: [PATCH] ALSA: hda-intel - AD1984 thinkpad - add analog beep input control
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

commit 0bf0e5a6f304ac1bc93a80cdd68b4d91f3519eb5 upstream
[bjorn: backported to 2.6.32 to avoid applying
ee6e365e30f7ee89bd214ff1215aaf90e93d4c40 as well]

For Lenovo Thinkpad T61/X61, the analog beep input is connected
to node 0x20, index 3. Move the digital beep mute/volume controls
as "Digital Beep" and create analog beep controls for mentioned node.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
 sound/pci/hda/patch_analog.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index bd0794e..8ff539e 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -71,8 +71,9 @@ struct ad198x_spec {
 	struct hda_input_mux private_imux;
 	hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
 
-	unsigned int jack_present :1;
-	unsigned int inv_jack_detect:1;
+	unsigned int jack_present: 1;
+	unsigned int inv_jack_detect: 1;/* inverted jack-detection */
+	unsigned int analog_beep: 1;	/* analog beep input present */
 
 #ifdef CONFIG_SND_HDA_POWER_SAVE
 	struct hda_loopback_check loopback;
@@ -163,6 +164,12 @@ static struct snd_kcontrol_new ad_beep_mixer[] = {
 	{ } /* end */
 };
 
+static struct snd_kcontrol_new ad_beep2_mixer[] = {
+	HDA_CODEC_VOLUME("Digital Beep Playback Volume", 0, 0, HDA_OUTPUT),
+	HDA_CODEC_MUTE_BEEP("Digital Beep Playback Switch", 0, 0, HDA_OUTPUT),
+	{ } /* end */
+};
+
 #define set_beep_amp(spec, nid, idx, dir) \
 	((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 1, idx, dir)) /* mono */
 
@@ -196,7 +203,8 @@ static int ad198x_build_controls(struct hda_codec *codec)
 	/* create beep controls if needed */
 	if (spec->beep_amp) {
 		struct snd_kcontrol_new *knew;
-		for (knew = ad_beep_mixer; knew->name; knew++) {
+		knew = spec->analog_beep ? ad_beep2_mixer : ad_beep_mixer;
+		for ( ; knew->name; knew++) {
 			struct snd_kcontrol *kctl;
 			kctl = snd_ctl_new1(knew, codec);
 			if (!kctl)
@@ -3362,6 +3370,8 @@ static struct snd_kcontrol_new ad1984_thinkpad_mixers[] = {
 	HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x00, HDA_INPUT),
 	HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x20, 0x01, HDA_INPUT),
 	HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x20, 0x01, HDA_INPUT),
+	HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT),
+	HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT),
 	HDA_CODEC_VOLUME("Docking Mic Playback Volume", 0x20, 0x04, HDA_INPUT),
 	HDA_CODEC_MUTE("Docking Mic Playback Switch", 0x20, 0x04, HDA_INPUT),
 	HDA_CODEC_VOLUME("Mic Boost", 0x14, 0x0, HDA_INPUT),
@@ -3403,6 +3413,8 @@ static struct hda_verb ad1984_thinkpad_init_verbs[] = {
 	{0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
 	/* docking mic boost */
 	{0x25, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
+	/* Analog PC Beeper - allow firmware/ACPI beeps */
+	{0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3) | 0x1a},
 	/* Analog mixer - docking mic; mute as default */
 	{0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
 	/* enable EAPD bit */
@@ -3535,6 +3547,7 @@ static int patch_ad1984(struct hda_codec *codec)
 		spec->input_mux = &ad1984_thinkpad_capture_source;
 		spec->mixers[0] = ad1984_thinkpad_mixers;
 		spec->init_verbs[spec->num_init_verbs++] = ad1984_thinkpad_init_verbs;
+		spec->analog_beep = 1;
 		break;
 	case AD1984_DELL_DESKTOP:
 		spec->multiout.dig_out_nid = 0;
-- 
1.7.1


Reply to: