alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ALSA: hda: Fix 0 dB offset for Lenovo Thinkpad models using AD1981
@ 2010-03-30 22:08 Daniel Chen
  2010-03-31  9:48 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Chen @ 2010-03-30 22:08 UTC (permalink / raw)
  To: Takashi Iwai, stable; +Cc: alsa-devel

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

Hi,

Attached is a patch against sound-2.6 master HEAD (applicable to
2.6.32.y and 2.6.33.y) that clamps the 0 dB offset accordingly.

Best,
-Dan

[-- Attachment #2: 0001-ALSA-hda-Fix-0-dB-offset-for-Lenovo-Thinkpad-models-.patch --]
[-- Type: text/x-diff, Size: 1412 bytes --]

From fdf6a8727da7189f23e3cfe94140f38513144468 Mon Sep 17 00:00:00 2001
From: Daniel T Chen <crimsun@ubuntu.com>
Date: Tue, 30 Mar 2010 13:29:28 -0400
Subject: [PATCH] ALSA: hda: Fix 0 dB offset for Lenovo Thinkpad models using AD1981

BugLink: https://launchpad.net/bugs/551606

The OR's hardware distorts at PCM 100% because it does not correspond to
0 dB. Fix this in patch_ad1981() for all models using the Thinkpad
quirk.

Reported-by: Jane Silber
Cc: <stable@kernel.org>
Signed-off-by: Daniel T Chen <crimsun@ubuntu.com>
---
 sound/pci/hda/patch_analog.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 262f5b5..9cbd80c 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -1904,6 +1904,14 @@ static int patch_ad1981(struct hda_codec *codec)
 	case AD1981_THINKPAD:
 		spec->mixers[0] = ad1981_thinkpad_mixers;
 		spec->input_mux = &ad1981_thinkpad_capture_source;
+		/* set the upper-limit for mixer amp to 0dB for avoiding the
+		 * possible damage by overloading
+		 */
+		snd_hda_override_amp_caps(codec, 0x11, HDA_INPUT,
+					  (0x17 << AC_AMPCAP_OFFSET_SHIFT) |
+					  (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) |
+					  (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) |
+					  (1 << AC_AMPCAP_MUTE_SHIFT));
 		break;
 	case AD1981_TOSHIBA:
 		spec->mixers[0] = ad1981_hp_mixers;
-- 
1.7.0


[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [PATCH] ALSA: hda: Fix 0 dB offset for Lenovo Thinkpad models using AD1981
  2010-03-30 22:08 [PATCH] ALSA: hda: Fix 0 dB offset for Lenovo Thinkpad models using AD1981 Daniel Chen
@ 2010-03-31  9:48 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2010-03-31  9:48 UTC (permalink / raw)
  To: Daniel Chen; +Cc: alsa-devel, stable

At Tue, 30 Mar 2010 15:08:15 -0700,
Daniel Chen wrote:
> 
> Hi,
> 
> Attached is a patch against sound-2.6 master HEAD (applicable to
> 2.6.32.y and 2.6.33.y) that clamps the 0 dB offset accordingly.

Applied now.  Thanks.


Takashi

> 
> Best,
> -Dan
> [2 0001-ALSA-hda-Fix-0-dB-offset-for-Lenovo-Thinkpad-models-.patch <text/x-diff; US-ASCII (base64)>]
> From fdf6a8727da7189f23e3cfe94140f38513144468 Mon Sep 17 00:00:00 2001
> From: Daniel T Chen <crimsun@ubuntu.com>
> Date: Tue, 30 Mar 2010 13:29:28 -0400
> Subject: [PATCH] ALSA: hda: Fix 0 dB offset for Lenovo Thinkpad models using AD1981
> 
> BugLink: https://launchpad.net/bugs/551606
> 
> The OR's hardware distorts at PCM 100% because it does not correspond to
> 0 dB. Fix this in patch_ad1981() for all models using the Thinkpad
> quirk.
> 
> Reported-by: Jane Silber
> Cc: <stable@kernel.org>
> Signed-off-by: Daniel T Chen <crimsun@ubuntu.com>
> ---
>  sound/pci/hda/patch_analog.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
> index 262f5b5..9cbd80c 100644
> --- a/sound/pci/hda/patch_analog.c
> +++ b/sound/pci/hda/patch_analog.c
> @@ -1904,6 +1904,14 @@ static int patch_ad1981(struct hda_codec *codec)
>  	case AD1981_THINKPAD:
>  		spec->mixers[0] = ad1981_thinkpad_mixers;
>  		spec->input_mux = &ad1981_thinkpad_capture_source;
> +		/* set the upper-limit for mixer amp to 0dB for avoiding the
> +		 * possible damage by overloading
> +		 */
> +		snd_hda_override_amp_caps(codec, 0x11, HDA_INPUT,
> +					  (0x17 << AC_AMPCAP_OFFSET_SHIFT) |
> +					  (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) |
> +					  (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) |
> +					  (1 << AC_AMPCAP_MUTE_SHIFT));
>  		break;
>  	case AD1981_TOSHIBA:
>  		spec->mixers[0] = ad1981_hp_mixers;
> -- 
> 1.7.0
> 

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

end of thread, other threads:[~2010-03-31  9:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-30 22:08 [PATCH] ALSA: hda: Fix 0 dB offset for Lenovo Thinkpad models using AD1981 Daniel Chen
2010-03-31  9:48 ` Takashi Iwai

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