diff options
Diffstat (limited to 'sound/pci/hda/patch_sigmatel.c')
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 68 |
1 files changed, 12 insertions, 56 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 4742cac26aa9..b04179be6205 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <sound/tlv.h> | 36 | #include <sound/tlv.h> |
37 | #include "hda_codec.h" | 37 | #include "hda_codec.h" |
38 | #include "hda_local.h" | 38 | #include "hda_local.h" |
39 | #include "hda_auto_parser.h" | ||
39 | #include "hda_beep.h" | 40 | #include "hda_beep.h" |
40 | #include "hda_jack.h" | 41 | #include "hda_jack.h" |
41 | 42 | ||
@@ -681,8 +682,7 @@ static int stac_vrefout_set(struct hda_codec *codec, | |||
681 | pinctl &= ~AC_PINCTL_VREFEN; | 682 | pinctl &= ~AC_PINCTL_VREFEN; |
682 | pinctl |= (new_vref & AC_PINCTL_VREFEN); | 683 | pinctl |= (new_vref & AC_PINCTL_VREFEN); |
683 | 684 | ||
684 | error = snd_hda_codec_write_cache(codec, nid, 0, | 685 | error = snd_hda_set_pin_ctl_cache(codec, nid, pinctl); |
685 | AC_VERB_SET_PIN_WIDGET_CONTROL, pinctl); | ||
686 | if (error < 0) | 686 | if (error < 0) |
687 | return error; | 687 | return error; |
688 | 688 | ||
@@ -706,8 +706,7 @@ static unsigned int stac92xx_vref_set(struct hda_codec *codec, | |||
706 | else | 706 | else |
707 | pincfg |= AC_PINCTL_IN_EN; | 707 | pincfg |= AC_PINCTL_IN_EN; |
708 | 708 | ||
709 | error = snd_hda_codec_write_cache(codec, nid, 0, | 709 | error = snd_hda_set_pin_ctl_cache(codec, nid, pincfg); |
710 | AC_VERB_SET_PIN_WIDGET_CONTROL, pincfg); | ||
711 | if (error < 0) | 710 | if (error < 0) |
712 | return error; | 711 | return error; |
713 | else | 712 | else |
@@ -2505,27 +2504,10 @@ static int stac92xx_build_pcms(struct hda_codec *codec) | |||
2505 | return 0; | 2504 | return 0; |
2506 | } | 2505 | } |
2507 | 2506 | ||
2508 | static unsigned int stac92xx_get_default_vref(struct hda_codec *codec, | ||
2509 | hda_nid_t nid) | ||
2510 | { | ||
2511 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); | ||
2512 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; | ||
2513 | if (pincap & AC_PINCAP_VREF_100) | ||
2514 | return AC_PINCTL_VREF_100; | ||
2515 | if (pincap & AC_PINCAP_VREF_80) | ||
2516 | return AC_PINCTL_VREF_80; | ||
2517 | if (pincap & AC_PINCAP_VREF_50) | ||
2518 | return AC_PINCTL_VREF_50; | ||
2519 | if (pincap & AC_PINCAP_VREF_GRD) | ||
2520 | return AC_PINCTL_VREF_GRD; | ||
2521 | return 0; | ||
2522 | } | ||
2523 | |||
2524 | static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type) | 2507 | static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type) |
2525 | 2508 | ||
2526 | { | 2509 | { |
2527 | snd_hda_codec_write_cache(codec, nid, 0, | 2510 | snd_hda_set_pin_ctl_cache(codec, nid, pin_type); |
2528 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); | ||
2529 | } | 2511 | } |
2530 | 2512 | ||
2531 | #define stac92xx_hp_switch_info snd_ctl_boolean_mono_info | 2513 | #define stac92xx_hp_switch_info snd_ctl_boolean_mono_info |
@@ -2594,7 +2576,7 @@ static int stac92xx_dc_bias_get(struct snd_kcontrol *kcontrol, | |||
2594 | hda_nid_t nid = kcontrol->private_value; | 2576 | hda_nid_t nid = kcontrol->private_value; |
2595 | unsigned int vref = stac92xx_vref_get(codec, nid); | 2577 | unsigned int vref = stac92xx_vref_get(codec, nid); |
2596 | 2578 | ||
2597 | if (vref == stac92xx_get_default_vref(codec, nid)) | 2579 | if (vref == snd_hda_get_default_vref(codec, nid)) |
2598 | ucontrol->value.enumerated.item[0] = 0; | 2580 | ucontrol->value.enumerated.item[0] = 0; |
2599 | else if (vref == AC_PINCTL_VREF_GRD) | 2581 | else if (vref == AC_PINCTL_VREF_GRD) |
2600 | ucontrol->value.enumerated.item[0] = 1; | 2582 | ucontrol->value.enumerated.item[0] = 1; |
@@ -2613,7 +2595,7 @@ static int stac92xx_dc_bias_put(struct snd_kcontrol *kcontrol, | |||
2613 | hda_nid_t nid = kcontrol->private_value; | 2595 | hda_nid_t nid = kcontrol->private_value; |
2614 | 2596 | ||
2615 | if (ucontrol->value.enumerated.item[0] == 0) | 2597 | if (ucontrol->value.enumerated.item[0] == 0) |
2616 | new_vref = stac92xx_get_default_vref(codec, nid); | 2598 | new_vref = snd_hda_get_default_vref(codec, nid); |
2617 | else if (ucontrol->value.enumerated.item[0] == 1) | 2599 | else if (ucontrol->value.enumerated.item[0] == 1) |
2618 | new_vref = AC_PINCTL_VREF_GRD; | 2600 | new_vref = AC_PINCTL_VREF_GRD; |
2619 | else if (ucontrol->value.enumerated.item[0] == 2) | 2601 | else if (ucontrol->value.enumerated.item[0] == 2) |
@@ -2679,7 +2661,7 @@ static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_ | |||
2679 | else { | 2661 | else { |
2680 | unsigned int pinctl = AC_PINCTL_IN_EN; | 2662 | unsigned int pinctl = AC_PINCTL_IN_EN; |
2681 | if (io_idx) /* set VREF for mic */ | 2663 | if (io_idx) /* set VREF for mic */ |
2682 | pinctl |= stac92xx_get_default_vref(codec, nid); | 2664 | pinctl |= snd_hda_get_default_vref(codec, nid); |
2683 | stac92xx_auto_set_pinctl(codec, nid, pinctl); | 2665 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
2684 | } | 2666 | } |
2685 | 2667 | ||
@@ -2847,7 +2829,7 @@ static inline int stac92xx_add_jack_mode_control(struct hda_codec *codec, | |||
2847 | char name[22]; | 2829 | char name[22]; |
2848 | 2830 | ||
2849 | if (snd_hda_get_input_pin_attr(def_conf) != INPUT_PIN_ATTR_INT) { | 2831 | if (snd_hda_get_input_pin_attr(def_conf) != INPUT_PIN_ATTR_INT) { |
2850 | if (stac92xx_get_default_vref(codec, nid) == AC_PINCTL_VREF_GRD | 2832 | if (snd_hda_get_default_vref(codec, nid) == AC_PINCTL_VREF_GRD |
2851 | && nid == spec->line_switch) | 2833 | && nid == spec->line_switch) |
2852 | control = STAC_CTL_WIDGET_IO_SWITCH; | 2834 | control = STAC_CTL_WIDGET_IO_SWITCH; |
2853 | else if (snd_hda_query_pin_caps(codec, nid) | 2835 | else if (snd_hda_query_pin_caps(codec, nid) |
@@ -4354,7 +4336,7 @@ static int stac92xx_init(struct hda_codec *codec) | |||
4354 | unsigned int pinctl, conf; | 4336 | unsigned int pinctl, conf; |
4355 | if (type == AUTO_PIN_MIC) { | 4337 | if (type == AUTO_PIN_MIC) { |
4356 | /* for mic pins, force to initialize */ | 4338 | /* for mic pins, force to initialize */ |
4357 | pinctl = stac92xx_get_default_vref(codec, nid); | 4339 | pinctl = snd_hda_get_default_vref(codec, nid); |
4358 | pinctl |= AC_PINCTL_IN_EN; | 4340 | pinctl |= AC_PINCTL_IN_EN; |
4359 | stac92xx_auto_set_pinctl(codec, nid, pinctl); | 4341 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
4360 | } else { | 4342 | } else { |
@@ -4460,8 +4442,7 @@ static void stac92xx_shutup_pins(struct hda_codec *codec) | |||
4460 | struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i); | 4442 | struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i); |
4461 | def_conf = snd_hda_codec_get_pincfg(codec, pin->nid); | 4443 | def_conf = snd_hda_codec_get_pincfg(codec, pin->nid); |
4462 | if (get_defcfg_connect(def_conf) != AC_JACK_PORT_NONE) | 4444 | if (get_defcfg_connect(def_conf) != AC_JACK_PORT_NONE) |
4463 | snd_hda_codec_write(codec, pin->nid, 0, | 4445 | snd_hda_set_pin_ctl(codec, pin->nid, 0); |
4464 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | ||
4465 | } | 4446 | } |
4466 | } | 4447 | } |
4467 | 4448 | ||
@@ -4517,9 +4498,7 @@ static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid, | |||
4517 | 4498 | ||
4518 | pin_ctl |= flag; | 4499 | pin_ctl |= flag; |
4519 | if (old_ctl != pin_ctl) | 4500 | if (old_ctl != pin_ctl) |
4520 | snd_hda_codec_write_cache(codec, nid, 0, | 4501 | snd_hda_set_pin_ctl_cache(codec, nid, pin_ctl); |
4521 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
4522 | pin_ctl); | ||
4523 | } | 4502 | } |
4524 | 4503 | ||
4525 | static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid, | 4504 | static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid, |
@@ -4528,9 +4507,7 @@ static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid, | |||
4528 | unsigned int pin_ctl = snd_hda_codec_read(codec, nid, | 4507 | unsigned int pin_ctl = snd_hda_codec_read(codec, nid, |
4529 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); | 4508 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); |
4530 | if (pin_ctl & flag) | 4509 | if (pin_ctl & flag) |
4531 | snd_hda_codec_write_cache(codec, nid, 0, | 4510 | snd_hda_set_pin_ctl_cache(codec, nid, pin_ctl & ~flag); |
4532 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
4533 | pin_ctl & ~flag); | ||
4534 | } | 4511 | } |
4535 | 4512 | ||
4536 | static inline int get_pin_presence(struct hda_codec *codec, hda_nid_t nid) | 4513 | static inline int get_pin_presence(struct hda_codec *codec, hda_nid_t nid) |
@@ -5009,20 +4986,6 @@ static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state) | |||
5009 | return 0; | 4986 | return 0; |
5010 | } | 4987 | } |
5011 | 4988 | ||
5012 | static int stac92xx_pre_resume(struct hda_codec *codec) | ||
5013 | { | ||
5014 | struct sigmatel_spec *spec = codec->spec; | ||
5015 | |||
5016 | /* sync mute LED */ | ||
5017 | if (spec->vref_mute_led_nid) | ||
5018 | stac_vrefout_set(codec, spec->vref_mute_led_nid, | ||
5019 | spec->vref_led); | ||
5020 | else if (spec->gpio_led) | ||
5021 | stac_gpio_set(codec, spec->gpio_mask, | ||
5022 | spec->gpio_dir, spec->gpio_data); | ||
5023 | return 0; | ||
5024 | } | ||
5025 | |||
5026 | static void stac92xx_set_power_state(struct hda_codec *codec, hda_nid_t fg, | 4989 | static void stac92xx_set_power_state(struct hda_codec *codec, hda_nid_t fg, |
5027 | unsigned int power_state) | 4990 | unsigned int power_state) |
5028 | { | 4991 | { |
@@ -5046,7 +5009,6 @@ static void stac92xx_set_power_state(struct hda_codec *codec, hda_nid_t fg, | |||
5046 | #else | 5009 | #else |
5047 | #define stac92xx_suspend NULL | 5010 | #define stac92xx_suspend NULL |
5048 | #define stac92xx_resume NULL | 5011 | #define stac92xx_resume NULL |
5049 | #define stac92xx_pre_resume NULL | ||
5050 | #define stac92xx_set_power_state NULL | 5012 | #define stac92xx_set_power_state NULL |
5051 | #endif /* CONFIG_PM */ | 5013 | #endif /* CONFIG_PM */ |
5052 | 5014 | ||
@@ -5592,9 +5554,6 @@ again: | |||
5592 | codec->patch_ops.set_power_state = | 5554 | codec->patch_ops.set_power_state = |
5593 | stac92xx_set_power_state; | 5555 | stac92xx_set_power_state; |
5594 | } | 5556 | } |
5595 | #ifdef CONFIG_PM | ||
5596 | codec->patch_ops.pre_resume = stac92xx_pre_resume; | ||
5597 | #endif | ||
5598 | } | 5557 | } |
5599 | 5558 | ||
5600 | err = stac92xx_parse_auto_config(codec); | 5559 | err = stac92xx_parse_auto_config(codec); |
@@ -5901,9 +5860,6 @@ again: | |||
5901 | codec->patch_ops.set_power_state = | 5860 | codec->patch_ops.set_power_state = |
5902 | stac92xx_set_power_state; | 5861 | stac92xx_set_power_state; |
5903 | } | 5862 | } |
5904 | #ifdef CONFIG_PM | ||
5905 | codec->patch_ops.pre_resume = stac92xx_pre_resume; | ||
5906 | #endif | ||
5907 | } | 5863 | } |
5908 | 5864 | ||
5909 | spec->multiout.dac_nids = spec->dac_nids; | 5865 | spec->multiout.dac_nids = spec->dac_nids; |