diff options
Diffstat (limited to 'sound/pci/hda/patch_sigmatel.c')
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 200 |
1 files changed, 154 insertions, 46 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index df9b0bc7f878..9563b5bbb272 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -36,9 +36,11 @@ | |||
36 | #include "hda_beep.h" | 36 | #include "hda_beep.h" |
37 | 37 | ||
38 | #define NUM_CONTROL_ALLOC 32 | 38 | #define NUM_CONTROL_ALLOC 32 |
39 | |||
40 | #define STAC_VREF_EVENT 0x00 | ||
41 | #define STAC_INSERT_EVENT 0x10 | ||
39 | #define STAC_PWR_EVENT 0x20 | 42 | #define STAC_PWR_EVENT 0x20 |
40 | #define STAC_HP_EVENT 0x30 | 43 | #define STAC_HP_EVENT 0x30 |
41 | #define STAC_VREF_EVENT 0x40 | ||
42 | 44 | ||
43 | enum { | 45 | enum { |
44 | STAC_REF, | 46 | STAC_REF, |
@@ -69,6 +71,7 @@ enum { | |||
69 | enum { | 71 | enum { |
70 | STAC_92HD73XX_REF, | 72 | STAC_92HD73XX_REF, |
71 | STAC_DELL_M6, | 73 | STAC_DELL_M6, |
74 | STAC_DELL_EQ, | ||
72 | STAC_92HD73XX_MODELS | 75 | STAC_92HD73XX_MODELS |
73 | }; | 76 | }; |
74 | 77 | ||
@@ -211,7 +214,7 @@ struct sigmatel_spec { | |||
211 | /* i/o switches */ | 214 | /* i/o switches */ |
212 | unsigned int io_switch[2]; | 215 | unsigned int io_switch[2]; |
213 | unsigned int clfe_swap; | 216 | unsigned int clfe_swap; |
214 | unsigned int hp_switch; | 217 | unsigned int hp_switch; /* NID of HP as line-out */ |
215 | unsigned int aloopback; | 218 | unsigned int aloopback; |
216 | 219 | ||
217 | struct hda_pcm pcm_rec[2]; /* PCM information */ | 220 | struct hda_pcm pcm_rec[2]; /* PCM information */ |
@@ -773,9 +776,7 @@ static struct hda_verb dell_eq_core_init[] = { | |||
773 | }; | 776 | }; |
774 | 777 | ||
775 | static struct hda_verb dell_m6_core_init[] = { | 778 | static struct hda_verb dell_m6_core_init[] = { |
776 | /* set master volume to max value without distortion | 779 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
777 | * and direct control */ | ||
778 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec}, | ||
779 | /* setup audio connections */ | 780 | /* setup audio connections */ |
780 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, | 781 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
781 | { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, | 782 | { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
@@ -1600,11 +1601,13 @@ static unsigned int dell_m6_pin_configs[13] = { | |||
1600 | static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { | 1601 | static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { |
1601 | [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, | 1602 | [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, |
1602 | [STAC_DELL_M6] = dell_m6_pin_configs, | 1603 | [STAC_DELL_M6] = dell_m6_pin_configs, |
1604 | [STAC_DELL_EQ] = dell_m6_pin_configs, | ||
1603 | }; | 1605 | }; |
1604 | 1606 | ||
1605 | static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { | 1607 | static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { |
1606 | [STAC_92HD73XX_REF] = "ref", | 1608 | [STAC_92HD73XX_REF] = "ref", |
1607 | [STAC_DELL_M6] = "dell-m6", | 1609 | [STAC_DELL_M6] = "dell-m6", |
1610 | [STAC_DELL_EQ] = "dell-eq", | ||
1608 | }; | 1611 | }; |
1609 | 1612 | ||
1610 | static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { | 1613 | static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { |
@@ -1685,6 +1688,10 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { | |||
1685 | /* SigmaTel reference board */ | 1688 | /* SigmaTel reference board */ |
1686 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, | 1689 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
1687 | "DFI LanParty", STAC_92HD71BXX_REF), | 1690 | "DFI LanParty", STAC_92HD71BXX_REF), |
1691 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f2, | ||
1692 | "HP dv5", STAC_HP_M4), | ||
1693 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f4, | ||
1694 | "HP dv7", STAC_HP_M4), | ||
1688 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, | 1695 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, |
1689 | "unknown HP", STAC_HP_M4), | 1696 | "unknown HP", STAC_HP_M4), |
1690 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, | 1697 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, |
@@ -2442,7 +2449,7 @@ static int stac92xx_hp_switch_get(struct snd_kcontrol *kcontrol, | |||
2442 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 2449 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
2443 | struct sigmatel_spec *spec = codec->spec; | 2450 | struct sigmatel_spec *spec = codec->spec; |
2444 | 2451 | ||
2445 | ucontrol->value.integer.value[0] = spec->hp_switch; | 2452 | ucontrol->value.integer.value[0] = !!spec->hp_switch; |
2446 | return 0; | 2453 | return 0; |
2447 | } | 2454 | } |
2448 | 2455 | ||
@@ -2451,8 +2458,9 @@ static int stac92xx_hp_switch_put(struct snd_kcontrol *kcontrol, | |||
2451 | { | 2458 | { |
2452 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 2459 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
2453 | struct sigmatel_spec *spec = codec->spec; | 2460 | struct sigmatel_spec *spec = codec->spec; |
2454 | 2461 | int nid = kcontrol->private_value; | |
2455 | spec->hp_switch = ucontrol->value.integer.value[0]; | 2462 | |
2463 | spec->hp_switch = ucontrol->value.integer.value[0] ? nid : 0; | ||
2456 | 2464 | ||
2457 | /* check to be sure that the ports are upto date with | 2465 | /* check to be sure that the ports are upto date with |
2458 | * switch changes | 2466 | * switch changes |
@@ -2585,8 +2593,10 @@ static struct snd_kcontrol_new stac92xx_control_templates[] = { | |||
2585 | }; | 2593 | }; |
2586 | 2594 | ||
2587 | /* add dynamic controls */ | 2595 | /* add dynamic controls */ |
2588 | static int stac92xx_add_control_idx(struct sigmatel_spec *spec, int type, | 2596 | static int stac92xx_add_control_temp(struct sigmatel_spec *spec, |
2589 | int idx, const char *name, unsigned long val) | 2597 | struct snd_kcontrol_new *ktemp, |
2598 | int idx, const char *name, | ||
2599 | unsigned long val) | ||
2590 | { | 2600 | { |
2591 | struct snd_kcontrol_new *knew; | 2601 | struct snd_kcontrol_new *knew; |
2592 | 2602 | ||
@@ -2605,20 +2615,29 @@ static int stac92xx_add_control_idx(struct sigmatel_spec *spec, int type, | |||
2605 | } | 2615 | } |
2606 | 2616 | ||
2607 | knew = &spec->kctl_alloc[spec->num_kctl_used]; | 2617 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
2608 | *knew = stac92xx_control_templates[type]; | 2618 | *knew = *ktemp; |
2609 | knew->index = idx; | 2619 | knew->index = idx; |
2610 | knew->name = kstrdup(name, GFP_KERNEL); | 2620 | knew->name = kstrdup(name, GFP_KERNEL); |
2611 | if (! knew->name) | 2621 | if (!knew->name) |
2612 | return -ENOMEM; | 2622 | return -ENOMEM; |
2613 | knew->private_value = val; | 2623 | knew->private_value = val; |
2614 | spec->num_kctl_used++; | 2624 | spec->num_kctl_used++; |
2615 | return 0; | 2625 | return 0; |
2616 | } | 2626 | } |
2617 | 2627 | ||
2628 | static inline int stac92xx_add_control_idx(struct sigmatel_spec *spec, | ||
2629 | int type, int idx, const char *name, | ||
2630 | unsigned long val) | ||
2631 | { | ||
2632 | return stac92xx_add_control_temp(spec, | ||
2633 | &stac92xx_control_templates[type], | ||
2634 | idx, name, val); | ||
2635 | } | ||
2636 | |||
2618 | 2637 | ||
2619 | /* add dynamic controls */ | 2638 | /* add dynamic controls */ |
2620 | static int stac92xx_add_control(struct sigmatel_spec *spec, int type, | 2639 | static inline int stac92xx_add_control(struct sigmatel_spec *spec, int type, |
2621 | const char *name, unsigned long val) | 2640 | const char *name, unsigned long val) |
2622 | { | 2641 | { |
2623 | return stac92xx_add_control_idx(spec, type, 0, name, val); | 2642 | return stac92xx_add_control_idx(spec, type, 0, name, val); |
2624 | } | 2643 | } |
@@ -2861,7 +2880,8 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, | |||
2861 | if (cfg->hp_outs > 1) { | 2880 | if (cfg->hp_outs > 1) { |
2862 | err = stac92xx_add_control(spec, | 2881 | err = stac92xx_add_control(spec, |
2863 | STAC_CTL_WIDGET_HP_SWITCH, | 2882 | STAC_CTL_WIDGET_HP_SWITCH, |
2864 | "Headphone as Line Out Switch", 0); | 2883 | "Headphone as Line Out Switch", |
2884 | cfg->hp_pins[cfg->hp_outs - 1]); | ||
2865 | if (err < 0) | 2885 | if (err < 0) |
2866 | return err; | 2886 | return err; |
2867 | } | 2887 | } |
@@ -3059,6 +3079,43 @@ static int stac92xx_auto_create_beep_ctls(struct hda_codec *codec, | |||
3059 | return 0; | 3079 | return 0; |
3060 | } | 3080 | } |
3061 | 3081 | ||
3082 | #ifdef CONFIG_SND_HDA_INPUT_BEEP | ||
3083 | #define stac92xx_dig_beep_switch_info snd_ctl_boolean_mono_info | ||
3084 | |||
3085 | static int stac92xx_dig_beep_switch_get(struct snd_kcontrol *kcontrol, | ||
3086 | struct snd_ctl_elem_value *ucontrol) | ||
3087 | { | ||
3088 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
3089 | ucontrol->value.integer.value[0] = codec->beep->enabled; | ||
3090 | return 0; | ||
3091 | } | ||
3092 | |||
3093 | static int stac92xx_dig_beep_switch_put(struct snd_kcontrol *kcontrol, | ||
3094 | struct snd_ctl_elem_value *ucontrol) | ||
3095 | { | ||
3096 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
3097 | int enabled = !!ucontrol->value.integer.value[0]; | ||
3098 | if (codec->beep->enabled != enabled) { | ||
3099 | codec->beep->enabled = enabled; | ||
3100 | return 1; | ||
3101 | } | ||
3102 | return 0; | ||
3103 | } | ||
3104 | |||
3105 | static struct snd_kcontrol_new stac92xx_dig_beep_ctrl = { | ||
3106 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
3107 | .info = stac92xx_dig_beep_switch_info, | ||
3108 | .get = stac92xx_dig_beep_switch_get, | ||
3109 | .put = stac92xx_dig_beep_switch_put, | ||
3110 | }; | ||
3111 | |||
3112 | static int stac92xx_beep_switch_ctl(struct hda_codec *codec) | ||
3113 | { | ||
3114 | return stac92xx_add_control_temp(codec->spec, &stac92xx_dig_beep_ctrl, | ||
3115 | 0, "PC Beep Playback Switch", 0); | ||
3116 | } | ||
3117 | #endif | ||
3118 | |||
3062 | static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec) | 3119 | static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec) |
3063 | { | 3120 | { |
3064 | struct sigmatel_spec *spec = codec->spec; | 3121 | struct sigmatel_spec *spec = codec->spec; |
@@ -3365,6 +3422,7 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
3365 | #ifdef CONFIG_SND_HDA_INPUT_BEEP | 3422 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
3366 | if (spec->digbeep_nid > 0) { | 3423 | if (spec->digbeep_nid > 0) { |
3367 | hda_nid_t nid = spec->digbeep_nid; | 3424 | hda_nid_t nid = spec->digbeep_nid; |
3425 | unsigned int caps; | ||
3368 | 3426 | ||
3369 | err = stac92xx_auto_create_beep_ctls(codec, nid); | 3427 | err = stac92xx_auto_create_beep_ctls(codec, nid); |
3370 | if (err < 0) | 3428 | if (err < 0) |
@@ -3372,6 +3430,14 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
3372 | err = snd_hda_attach_beep_device(codec, nid); | 3430 | err = snd_hda_attach_beep_device(codec, nid); |
3373 | if (err < 0) | 3431 | if (err < 0) |
3374 | return err; | 3432 | return err; |
3433 | /* if no beep switch is available, make its own one */ | ||
3434 | caps = query_amp_caps(codec, nid, HDA_OUTPUT); | ||
3435 | if (codec->beep && | ||
3436 | !((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT)) { | ||
3437 | err = stac92xx_beep_switch_ctl(codec); | ||
3438 | if (err < 0) | ||
3439 | return err; | ||
3440 | } | ||
3375 | } | 3441 | } |
3376 | #endif | 3442 | #endif |
3377 | 3443 | ||
@@ -3529,6 +3595,12 @@ static int stac9200_parse_auto_config(struct hda_codec *codec) | |||
3529 | if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0) | 3595 | if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0) |
3530 | return err; | 3596 | return err; |
3531 | 3597 | ||
3598 | if (spec->num_muxes > 0) { | ||
3599 | err = stac92xx_auto_create_mux_input_ctls(codec); | ||
3600 | if (err < 0) | ||
3601 | return err; | ||
3602 | } | ||
3603 | |||
3532 | if (spec->autocfg.dig_out_pin) | 3604 | if (spec->autocfg.dig_out_pin) |
3533 | spec->multiout.dig_out_nid = 0x05; | 3605 | spec->multiout.dig_out_nid = 0x05; |
3534 | if (spec->autocfg.dig_in_pin) | 3606 | if (spec->autocfg.dig_in_pin) |
@@ -3646,14 +3718,18 @@ static int stac92xx_init(struct hda_codec *codec) | |||
3646 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 3718 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
3647 | hda_nid_t nid = cfg->input_pins[i]; | 3719 | hda_nid_t nid = cfg->input_pins[i]; |
3648 | if (nid) { | 3720 | if (nid) { |
3649 | unsigned int pinctl = snd_hda_codec_read(codec, nid, | 3721 | unsigned int pinctl; |
3650 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | 3722 | if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) { |
3651 | /* if PINCTL already set then skip */ | 3723 | /* for mic pins, force to initialize */ |
3652 | if (pinctl & AC_PINCAP_IN) | 3724 | pinctl = stac92xx_get_vref(codec, nid); |
3653 | continue; | 3725 | } else { |
3654 | pinctl = AC_PINCTL_IN_EN; | 3726 | pinctl = snd_hda_codec_read(codec, nid, 0, |
3655 | if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) | 3727 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
3656 | pinctl |= stac92xx_get_vref(codec, nid); | 3728 | /* if PINCTL already set then skip */ |
3729 | if (pinctl & AC_PINCTL_IN_EN) | ||
3730 | continue; | ||
3731 | } | ||
3732 | pinctl |= AC_PINCTL_IN_EN; | ||
3657 | stac92xx_auto_set_pinctl(codec, nid, pinctl); | 3733 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
3658 | } | 3734 | } |
3659 | } | 3735 | } |
@@ -3775,11 +3851,30 @@ static int get_hp_pin_presence(struct hda_codec *codec, hda_nid_t nid) | |||
3775 | return 0; | 3851 | return 0; |
3776 | } | 3852 | } |
3777 | 3853 | ||
3854 | /* return non-zero if the hp-pin of the given array index isn't | ||
3855 | * a jack-detection target | ||
3856 | */ | ||
3857 | static int no_hp_sensing(struct sigmatel_spec *spec, int i) | ||
3858 | { | ||
3859 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
3860 | |||
3861 | /* ignore sensing of shared line and mic jacks */ | ||
3862 | if (spec->line_switch && | ||
3863 | cfg->hp_pins[i] == cfg->input_pins[AUTO_PIN_LINE]) | ||
3864 | return 1; | ||
3865 | if (spec->mic_switch && | ||
3866 | cfg->hp_pins[i] == cfg->input_pins[AUTO_PIN_MIC]) | ||
3867 | return 1; | ||
3868 | /* ignore if the pin is set as line-out */ | ||
3869 | if (cfg->hp_pins[i] == spec->hp_switch) | ||
3870 | return 1; | ||
3871 | return 0; | ||
3872 | } | ||
3873 | |||
3778 | static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) | 3874 | static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) |
3779 | { | 3875 | { |
3780 | struct sigmatel_spec *spec = codec->spec; | 3876 | struct sigmatel_spec *spec = codec->spec; |
3781 | struct auto_pin_cfg *cfg = &spec->autocfg; | 3877 | struct auto_pin_cfg *cfg = &spec->autocfg; |
3782 | int nid = cfg->hp_pins[cfg->hp_outs - 1]; | ||
3783 | int i, presence; | 3878 | int i, presence; |
3784 | 3879 | ||
3785 | presence = 0; | 3880 | presence = 0; |
@@ -3790,15 +3885,16 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) | |||
3790 | for (i = 0; i < cfg->hp_outs; i++) { | 3885 | for (i = 0; i < cfg->hp_outs; i++) { |
3791 | if (presence) | 3886 | if (presence) |
3792 | break; | 3887 | break; |
3793 | if (spec->hp_switch && cfg->hp_pins[i] == nid) | 3888 | if (no_hp_sensing(spec, i)) |
3794 | break; | 3889 | continue; |
3795 | presence = get_hp_pin_presence(codec, cfg->hp_pins[i]); | 3890 | presence = get_hp_pin_presence(codec, cfg->hp_pins[i]); |
3796 | } | 3891 | } |
3797 | 3892 | ||
3798 | if (presence) { | 3893 | if (presence) { |
3799 | /* disable lineouts, enable hp */ | 3894 | /* disable lineouts */ |
3800 | if (spec->hp_switch) | 3895 | if (spec->hp_switch) |
3801 | stac92xx_reset_pinctl(codec, nid, AC_PINCTL_OUT_EN); | 3896 | stac92xx_reset_pinctl(codec, spec->hp_switch, |
3897 | AC_PINCTL_OUT_EN); | ||
3802 | for (i = 0; i < cfg->line_outs; i++) | 3898 | for (i = 0; i < cfg->line_outs; i++) |
3803 | stac92xx_reset_pinctl(codec, cfg->line_out_pins[i], | 3899 | stac92xx_reset_pinctl(codec, cfg->line_out_pins[i], |
3804 | AC_PINCTL_OUT_EN); | 3900 | AC_PINCTL_OUT_EN); |
@@ -3810,9 +3906,10 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) | |||
3810 | spec->gpio_dir, spec->gpio_data & | 3906 | spec->gpio_dir, spec->gpio_data & |
3811 | ~spec->eapd_mask); | 3907 | ~spec->eapd_mask); |
3812 | } else { | 3908 | } else { |
3813 | /* enable lineouts, disable hp */ | 3909 | /* enable lineouts */ |
3814 | if (spec->hp_switch) | 3910 | if (spec->hp_switch) |
3815 | stac92xx_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); | 3911 | stac92xx_set_pinctl(codec, spec->hp_switch, |
3912 | AC_PINCTL_OUT_EN); | ||
3816 | for (i = 0; i < cfg->line_outs; i++) | 3913 | for (i = 0; i < cfg->line_outs; i++) |
3817 | stac92xx_set_pinctl(codec, cfg->line_out_pins[i], | 3914 | stac92xx_set_pinctl(codec, cfg->line_out_pins[i], |
3818 | AC_PINCTL_OUT_EN); | 3915 | AC_PINCTL_OUT_EN); |
@@ -3824,8 +3921,16 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) | |||
3824 | spec->gpio_dir, spec->gpio_data | | 3921 | spec->gpio_dir, spec->gpio_data | |
3825 | spec->eapd_mask); | 3922 | spec->eapd_mask); |
3826 | } | 3923 | } |
3827 | if (!spec->hp_switch && cfg->hp_outs > 1 && presence) | 3924 | /* toggle hp outs */ |
3828 | stac92xx_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); | 3925 | for (i = 0; i < cfg->hp_outs; i++) { |
3926 | unsigned int val = AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN; | ||
3927 | if (no_hp_sensing(spec, i)) | ||
3928 | continue; | ||
3929 | if (presence) | ||
3930 | stac92xx_set_pinctl(codec, cfg->hp_pins[i], val); | ||
3931 | else | ||
3932 | stac92xx_reset_pinctl(codec, cfg->hp_pins[i], val); | ||
3933 | } | ||
3829 | } | 3934 | } |
3830 | 3935 | ||
3831 | static void stac92xx_pin_sense(struct hda_codec *codec, int idx) | 3936 | static void stac92xx_pin_sense(struct hda_codec *codec, int idx) |
@@ -4131,12 +4236,17 @@ again: | |||
4131 | sizeof(stac92hd73xx_dmux)); | 4236 | sizeof(stac92hd73xx_dmux)); |
4132 | 4237 | ||
4133 | switch (spec->board_config) { | 4238 | switch (spec->board_config) { |
4134 | case STAC_DELL_M6: | 4239 | case STAC_DELL_EQ: |
4135 | spec->init = dell_eq_core_init; | 4240 | spec->init = dell_eq_core_init; |
4241 | /* fallthru */ | ||
4242 | case STAC_DELL_M6: | ||
4136 | spec->num_smuxes = 0; | 4243 | spec->num_smuxes = 0; |
4137 | spec->mixer = &stac92hd73xx_6ch_mixer[DELL_M6_MIXER]; | 4244 | spec->mixer = &stac92hd73xx_6ch_mixer[DELL_M6_MIXER]; |
4138 | spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP]; | 4245 | spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP]; |
4139 | spec->num_amps = 1; | 4246 | spec->num_amps = 1; |
4247 | |||
4248 | if (!spec->init) | ||
4249 | spec->init = dell_m6_core_init; | ||
4140 | switch (codec->subsystem_id) { | 4250 | switch (codec->subsystem_id) { |
4141 | case 0x1028025e: /* Analog Mics */ | 4251 | case 0x1028025e: /* Analog Mics */ |
4142 | case 0x1028025f: | 4252 | case 0x1028025f: |
@@ -4146,8 +4256,6 @@ again: | |||
4146 | break; | 4256 | break; |
4147 | case 0x10280271: /* Digital Mics */ | 4257 | case 0x10280271: /* Digital Mics */ |
4148 | case 0x10280272: | 4258 | case 0x10280272: |
4149 | spec->init = dell_m6_core_init; | ||
4150 | /* fall-through */ | ||
4151 | case 0x10280254: | 4259 | case 0x10280254: |
4152 | case 0x10280255: | 4260 | case 0x10280255: |
4153 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); | 4261 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); |
@@ -4374,6 +4482,13 @@ again: | |||
4374 | stac92xx_set_config_regs(codec); | 4482 | stac92xx_set_config_regs(codec); |
4375 | } | 4483 | } |
4376 | 4484 | ||
4485 | if (spec->board_config > STAC_92HD71BXX_REF) { | ||
4486 | /* GPIO0 = EAPD */ | ||
4487 | spec->gpio_mask = 0x01; | ||
4488 | spec->gpio_dir = 0x01; | ||
4489 | spec->gpio_data = 0x01; | ||
4490 | } | ||
4491 | |||
4377 | switch (codec->vendor_id) { | 4492 | switch (codec->vendor_id) { |
4378 | case 0x111d76b6: /* 4 Port without Analog Mixer */ | 4493 | case 0x111d76b6: /* 4 Port without Analog Mixer */ |
4379 | case 0x111d76b7: | 4494 | case 0x111d76b7: |
@@ -4384,10 +4499,10 @@ again: | |||
4384 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; | 4499 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; |
4385 | break; | 4500 | break; |
4386 | case 0x111d7608: /* 5 Port with Analog Mixer */ | 4501 | case 0x111d7608: /* 5 Port with Analog Mixer */ |
4387 | switch (codec->subsystem_id) { | 4502 | switch (spec->board_config) { |
4388 | case 0x103c361a: | 4503 | case STAC_HP_M4: |
4389 | /* Enable VREF power saving on GPIO1 detect */ | 4504 | /* Enable VREF power saving on GPIO1 detect */ |
4390 | snd_hda_codec_write(codec, codec->afg, 0, | 4505 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
4391 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02); | 4506 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02); |
4392 | snd_hda_codec_write_cache(codec, codec->afg, 0, | 4507 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
4393 | AC_VERB_SET_UNSOLICITED_ENABLE, | 4508 | AC_VERB_SET_UNSOLICITED_ENABLE, |
@@ -4433,13 +4548,6 @@ again: | |||
4433 | spec->aloopback_mask = 0x50; | 4548 | spec->aloopback_mask = 0x50; |
4434 | spec->aloopback_shift = 0; | 4549 | spec->aloopback_shift = 0; |
4435 | 4550 | ||
4436 | if (spec->board_config > STAC_92HD71BXX_REF) { | ||
4437 | /* GPIO0 = EAPD */ | ||
4438 | spec->gpio_mask = 0x01; | ||
4439 | spec->gpio_dir = 0x01; | ||
4440 | spec->gpio_data = 0x01; | ||
4441 | } | ||
4442 | |||
4443 | spec->powerdown_adcs = 1; | 4551 | spec->powerdown_adcs = 1; |
4444 | spec->digbeep_nid = 0x26; | 4552 | spec->digbeep_nid = 0x26; |
4445 | spec->mux_nids = stac92hd71bxx_mux_nids; | 4553 | spec->mux_nids = stac92hd71bxx_mux_nids; |
@@ -4787,7 +4895,7 @@ static int patch_stac9205(struct hda_codec *codec) | |||
4787 | stac92xx_set_config_reg(codec, 0x20, 0x1c410030); | 4895 | stac92xx_set_config_reg(codec, 0x20, 0x1c410030); |
4788 | 4896 | ||
4789 | /* Enable unsol response for GPIO4/Dock HP connection */ | 4897 | /* Enable unsol response for GPIO4/Dock HP connection */ |
4790 | snd_hda_codec_write(codec, codec->afg, 0, | 4898 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
4791 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10); | 4899 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10); |
4792 | snd_hda_codec_write_cache(codec, codec->afg, 0, | 4900 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
4793 | AC_VERB_SET_UNSOLICITED_ENABLE, | 4901 | AC_VERB_SET_UNSOLICITED_ENABLE, |