aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_sigmatel.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/patch_sigmatel.c')
-rw-r--r--sound/pci/hda/patch_sigmatel.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 21de62b7c991..884f8ad351fd 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -2503,22 +2503,6 @@ static int stac92xx_build_pcms(struct hda_codec *codec)
2503 return 0; 2503 return 0;
2504} 2504}
2505 2505
2506static unsigned int stac92xx_get_default_vref(struct hda_codec *codec,
2507 hda_nid_t nid)
2508{
2509 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
2510 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
2511 if (pincap & AC_PINCAP_VREF_100)
2512 return AC_PINCTL_VREF_100;
2513 if (pincap & AC_PINCAP_VREF_80)
2514 return AC_PINCTL_VREF_80;
2515 if (pincap & AC_PINCAP_VREF_50)
2516 return AC_PINCTL_VREF_50;
2517 if (pincap & AC_PINCAP_VREF_GRD)
2518 return AC_PINCTL_VREF_GRD;
2519 return 0;
2520}
2521
2522static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type) 2506static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type)
2523 2507
2524{ 2508{
@@ -2591,7 +2575,7 @@ static int stac92xx_dc_bias_get(struct snd_kcontrol *kcontrol,
2591 hda_nid_t nid = kcontrol->private_value; 2575 hda_nid_t nid = kcontrol->private_value;
2592 unsigned int vref = stac92xx_vref_get(codec, nid); 2576 unsigned int vref = stac92xx_vref_get(codec, nid);
2593 2577
2594 if (vref == stac92xx_get_default_vref(codec, nid)) 2578 if (vref == snd_hda_get_default_vref(codec, nid))
2595 ucontrol->value.enumerated.item[0] = 0; 2579 ucontrol->value.enumerated.item[0] = 0;
2596 else if (vref == AC_PINCTL_VREF_GRD) 2580 else if (vref == AC_PINCTL_VREF_GRD)
2597 ucontrol->value.enumerated.item[0] = 1; 2581 ucontrol->value.enumerated.item[0] = 1;
@@ -2610,7 +2594,7 @@ static int stac92xx_dc_bias_put(struct snd_kcontrol *kcontrol,
2610 hda_nid_t nid = kcontrol->private_value; 2594 hda_nid_t nid = kcontrol->private_value;
2611 2595
2612 if (ucontrol->value.enumerated.item[0] == 0) 2596 if (ucontrol->value.enumerated.item[0] == 0)
2613 new_vref = stac92xx_get_default_vref(codec, nid); 2597 new_vref = snd_hda_get_default_vref(codec, nid);
2614 else if (ucontrol->value.enumerated.item[0] == 1) 2598 else if (ucontrol->value.enumerated.item[0] == 1)
2615 new_vref = AC_PINCTL_VREF_GRD; 2599 new_vref = AC_PINCTL_VREF_GRD;
2616 else if (ucontrol->value.enumerated.item[0] == 2) 2600 else if (ucontrol->value.enumerated.item[0] == 2)
@@ -2676,7 +2660,7 @@ static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_
2676 else { 2660 else {
2677 unsigned int pinctl = AC_PINCTL_IN_EN; 2661 unsigned int pinctl = AC_PINCTL_IN_EN;
2678 if (io_idx) /* set VREF for mic */ 2662 if (io_idx) /* set VREF for mic */
2679 pinctl |= stac92xx_get_default_vref(codec, nid); 2663 pinctl |= snd_hda_get_default_vref(codec, nid);
2680 stac92xx_auto_set_pinctl(codec, nid, pinctl); 2664 stac92xx_auto_set_pinctl(codec, nid, pinctl);
2681 } 2665 }
2682 2666
@@ -2844,7 +2828,7 @@ static inline int stac92xx_add_jack_mode_control(struct hda_codec *codec,
2844 char name[22]; 2828 char name[22];
2845 2829
2846 if (snd_hda_get_input_pin_attr(def_conf) != INPUT_PIN_ATTR_INT) { 2830 if (snd_hda_get_input_pin_attr(def_conf) != INPUT_PIN_ATTR_INT) {
2847 if (stac92xx_get_default_vref(codec, nid) == AC_PINCTL_VREF_GRD 2831 if (snd_hda_get_default_vref(codec, nid) == AC_PINCTL_VREF_GRD
2848 && nid == spec->line_switch) 2832 && nid == spec->line_switch)
2849 control = STAC_CTL_WIDGET_IO_SWITCH; 2833 control = STAC_CTL_WIDGET_IO_SWITCH;
2850 else if (snd_hda_query_pin_caps(codec, nid) 2834 else if (snd_hda_query_pin_caps(codec, nid)
@@ -4351,7 +4335,7 @@ static int stac92xx_init(struct hda_codec *codec)
4351 unsigned int pinctl, conf; 4335 unsigned int pinctl, conf;
4352 if (type == AUTO_PIN_MIC) { 4336 if (type == AUTO_PIN_MIC) {
4353 /* for mic pins, force to initialize */ 4337 /* for mic pins, force to initialize */
4354 pinctl = stac92xx_get_default_vref(codec, nid); 4338 pinctl = snd_hda_get_default_vref(codec, nid);
4355 pinctl |= AC_PINCTL_IN_EN; 4339 pinctl |= AC_PINCTL_IN_EN;
4356 stac92xx_auto_set_pinctl(codec, nid, pinctl); 4340 stac92xx_auto_set_pinctl(codec, nid, pinctl);
4357 } else { 4341 } else {