]> err.no Git - linux-2.6/commitdiff
[ALSA] hda-codec - Fix STAC922x capture boost level
authorTakashi Iwai <tiwai@suse.de>
Tue, 29 May 2007 17:01:37 +0000 (19:01 +0200)
committerJaroslav Kysela <perex@suse.cz>
Thu, 31 May 2007 07:06:04 +0000 (09:06 +0200)
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.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_local.h
sound/pci/hda/patch_sigmatel.c

index 8e89d56b6400d2721a6d68e505aa11358c47113e..f87f8f088956d31827ea62750ffebe10fc2f189a 100644 (file)
@@ -713,6 +713,19 @@ static u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction)
        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;
+}
+
 /*
  * read the current volume to info
  * if the cache exists, read the cache value.
index be12b8814c39b62d8e27ee65b0f9fce0c49aedb6..f91ea5ec9f6d547527c91996a45ba34bdbd079cc 100644 (file)
@@ -277,5 +277,7 @@ static inline u32 get_wcaps(struct hda_codec *codec, hda_nid_t nid)
        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 */
index 33fc7cd009350faf6c89d4efda466b77e2d5ee04..e3964fc4c40521cb3914740fdd25f764e836209f 100644 (file)
@@ -2159,6 +2159,13 @@ static int patch_stac927x(struct hda_codec *codec)
 
        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;
 }