aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_codec.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r--sound/pci/hda/hda_codec.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 2d9716e7a116..8b8b74a1284c 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -4795,6 +4795,33 @@ int snd_hda_multi_out_analog_cleanup(struct hda_codec *codec,
4795} 4795}
4796EXPORT_SYMBOL_HDA(snd_hda_multi_out_analog_cleanup); 4796EXPORT_SYMBOL_HDA(snd_hda_multi_out_analog_cleanup);
4797 4797
4798/**
4799 * snd_hda_get_default_vref - Get the default (mic) VREF pin bits
4800 *
4801 * Guess the suitable VREF pin bits to be set as the pin-control value.
4802 * Note: the function doesn't set the AC_PINCTL_IN_EN bit.
4803 */
4804unsigned int snd_hda_get_default_vref(struct hda_codec *codec, hda_nid_t pin)
4805{
4806 unsigned int pincap;
4807 unsigned int oldval;
4808 oldval = snd_hda_codec_read(codec, pin, 0,
4809 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4810 pincap = snd_hda_query_pin_caps(codec, pin);
4811 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
4812 /* Exception: if the default pin setup is vref50, we give it priority */
4813 if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50)
4814 return AC_PINCTL_VREF_80;
4815 else if (pincap & AC_PINCAP_VREF_50)
4816 return AC_PINCTL_VREF_50;
4817 else if (pincap & AC_PINCAP_VREF_100)
4818 return AC_PINCTL_VREF_100;
4819 else if (pincap & AC_PINCAP_VREF_GRD)
4820 return AC_PINCTL_VREF_GRD;
4821 return AC_PINCTL_VREF_HIZ;
4822}
4823EXPORT_SYMBOL_HDA(snd_hda_get_default_vref);
4824
4798int _snd_hda_set_pin_ctl(struct hda_codec *codec, hda_nid_t pin, 4825int _snd_hda_set_pin_ctl(struct hda_codec *codec, hda_nid_t pin,
4799 unsigned int val, bool cached) 4826 unsigned int val, bool cached)
4800{ 4827{