[alsa-devel] Avoid overload of PCM volume on Cx5045 codec

Takashi Iwai tiwai at suse.de
Fri Jun 20 18:08:02 CEST 2008


At Thu, 19 Jun 2008 21:30:31 +0200,
=?ISO-8859-1?Q?Andreas_P=E5hlsson?= wrote:
> 
> 2008/6/19 Takashi Iwai <tiwai at suse.de>:
> >> compiling a kernelmodule. As per the comment to the patch the sound
> >> can become very distorted without it. 6 dB works fine for me.
> >
> > Hm, but it has far higher values.  Do they also work fine (suppose you
> > reverted the amp override patch)?
> 
> They do work but give distorted sound.
> 
> For my test I just removed the amp override patch but I would really
> want to do-the-right-thing.

The right thing (tm) would be to add a simple check for activating the
amp override.  How about the patch below?


Takashi

diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index e3df8ac..64df810 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -1005,15 +1005,19 @@ static int patch_cxt5045(struct hda_codec *codec)
 #endif	
 	}
 
-	/*
-	 * Fix max PCM level to 0 dB
-	 * (originall it has 0x2b steps with 0dB offset 0x14)
-	 */
-	snd_hda_override_amp_caps(codec, 0x17, HDA_INPUT,
-				  (0x14 << AC_AMPCAP_OFFSET_SHIFT) |
-				  (0x14 << AC_AMPCAP_NUM_STEPS_SHIFT) |
-				  (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) |
-				  (1 << AC_AMPCAP_MUTE_SHIFT));
+	switch (codec->subsystem_id >> 16) {
+	case 0x103c:
+		/* HP laptop has a really bad sound over 0dB on NID 0x17.
+		 * Fix max PCM level to 0 dB
+		 * (originall it has 0x2b steps with 0dB offset 0x14)
+		 */
+		snd_hda_override_amp_caps(codec, 0x17, HDA_INPUT,
+					  (0x14 << AC_AMPCAP_OFFSET_SHIFT) |
+					  (0x14 << AC_AMPCAP_NUM_STEPS_SHIFT) |
+					  (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) |
+					  (1 << AC_AMPCAP_MUTE_SHIFT));
+		break;
+	}
 
 	return 0;
 }


More information about the Alsa-devel mailing list