changelog shortlog tags manifest raw

changeset: hda-codec - Fix STAC922x capture boost level

changeset 5086: 6ee58da0b892
parent 5085:200fc3a7ef62
child 5087:8f2546d9c49a
author: tiwai
date: Tue May 29 19:01:37 2007 +0200 (4 years ago)
files: pci/hda/hda_codec.c pci/hda/hda_local.h pci/hda/patch_sigmatel.c
description: hda-codec - Fix STAC922x capture boost level

STAC922x provides the capture boost level up to 4, but actually it
works only up to 2. Since the range of the mixer is automatically
defined from amp-capability bits, we need to override the value
beforehand. snd_hda_override_amp_caps() is introduced for this
purpose.

The function patch_stac922x() calls this for NID 0x12 (Mux Capture
Volume). This should fix another recording problem on Intel Macs.

Patch-level: ASAP
--- a/pci/hda/hda_codec.c	Tue May 29 18:01:06 2007 +0200
+++ b/pci/hda/hda_codec.c	Tue May 29 19:01:37 2007 +0200
@@ -711,6 +711,19 @@ static u32 query_amp_caps(struct hda_cod
 			info->status |= INFO_AMP_CAPS;
 	}
 	return info->amp_caps;
+}
+
+int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
+			      unsigned int caps)
+{
+	struct hda_amp_info *info;
+
+	info = get_alloc_amp_hash(codec, HDA_HASH_KEY(nid, dir, 0));
+	if (!info)
+		return -EINVAL;
+	info->amp_caps = caps;
+	info->status |= INFO_AMP_CAPS;
+	return 0;
 }
 
 /*
--- a/pci/hda/hda_local.h	Tue May 29 18:01:06 2007 +0200
+++ b/pci/hda/hda_local.h	Tue May 29 19:01:37 2007 +0200
@@ -277,5 +277,7 @@ static inline u32 get_wcaps(struct hda_c
 	return codec->wcaps[nid - codec->start_nid];
 }
 
+int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
+			      unsigned int caps);
 
 #endif /* __SOUND_HDA_LOCAL_H */
--- a/pci/hda/patch_sigmatel.c	Tue May 29 18:01:06 2007 +0200
+++ b/pci/hda/patch_sigmatel.c	Tue May 29 19:01:37 2007 +0200
@@ -2127,6 +2127,13 @@ static int patch_stac922x(struct hda_cod
 
 	codec->patch_ops = stac92xx_patch_ops;
 
+	/* Fix Mux capture level; max to 2 */
+	snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
+				  (0 << AC_AMPCAP_OFFSET_SHIFT) |
+				  (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
+				  (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
+				  (0 << AC_AMPCAP_MUTE_SHIFT));
+
 	return 0;
 }