ALSA: hda - Fix missing Mic Boost controls for VIA codecs
authorTakashi Iwai <tiwai@suse.de>
Wed, 19 Jun 2013 05:54:09 +0000 (07:54 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jul 2013 21:07:24 +0000 (14:07 -0700)
commit d045c5dc43d829df9f067d363c3b42b14dacf434 upstream.

Some VIA codecs like VT1708S have Mic boost amps in the mic pins but
they aren't exposed in the capability bits.  In the past driver code,
we override the pin caps and create mic boost controls forcibly.
While transition to the generic parser, we lost the mic boost controls
although the pin caps are still overridden, because the generic parser
code checks the widget caps, too.

So this patch adds a new helper function to allow the override of the
given widget capability bits, and makes VIA codecs driver to add the
missing input-amp capability bit.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=59861
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/pci/hda/hda_local.h
sound/pci/hda/patch_via.c

index 29ed7d9b27e4e8527e85bec8ee039d98243c5a7e..2e7493ef8ee0643b1ee51b759198c233d23af6a5 100644 (file)
@@ -562,6 +562,14 @@ static inline unsigned int get_wcaps_channels(u32 wcaps)
        return chans;
 }
 
+static inline void snd_hda_override_wcaps(struct hda_codec *codec,
+                                         hda_nid_t nid, u32 val)
+{
+       if (nid >= codec->start_nid &&
+           nid < codec->start_nid + codec->num_nodes)
+               codec->wcaps[nid - codec->start_nid] = val;
+}
+
 u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction);
 int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
                              unsigned int caps);
index e5245544eb52bbecaaf0ff3e60b6f4f25d80d3c3..aed19c3f8466d1224fa403055f0d76cc428fecf8 100644 (file)
@@ -910,6 +910,8 @@ static const struct hda_verb vt1708S_init_verbs[] = {
 static void override_mic_boost(struct hda_codec *codec, hda_nid_t pin,
                               int offset, int num_steps, int step_size)
 {
+       snd_hda_override_wcaps(codec, pin,
+                              get_wcaps(codec, pin) | AC_WCAP_IN_AMP);
        snd_hda_override_amp_caps(codec, pin, HDA_INPUT,
                                  (offset << AC_AMPCAP_OFFSET_SHIFT) |
                                  (num_steps << AC_AMPCAP_NUM_STEPS_SHIFT) |