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.c190
1 files changed, 136 insertions, 54 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 9563b5bbb272..596ceabd6504 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -69,8 +69,11 @@ enum {
69}; 69};
70 70
71enum { 71enum {
72 STAC_92HD73XX_NO_JD, /* no jack-detection */
72 STAC_92HD73XX_REF, 73 STAC_92HD73XX_REF,
73 STAC_DELL_M6, 74 STAC_DELL_M6_AMIC,
75 STAC_DELL_M6_DMIC,
76 STAC_DELL_M6_BOTH,
74 STAC_DELL_EQ, 77 STAC_DELL_EQ,
75 STAC_92HD73XX_MODELS 78 STAC_92HD73XX_MODELS
76}; 79};
@@ -84,6 +87,7 @@ enum {
84 STAC_92HD71BXX_REF, 87 STAC_92HD71BXX_REF,
85 STAC_DELL_M4_1, 88 STAC_DELL_M4_1,
86 STAC_DELL_M4_2, 89 STAC_DELL_M4_2,
90 STAC_DELL_M4_3,
87 STAC_HP_M4, 91 STAC_HP_M4,
88 STAC_92HD71BXX_MODELS 92 STAC_92HD71BXX_MODELS
89}; 93};
@@ -124,6 +128,7 @@ enum {
124}; 128};
125 129
126enum { 130enum {
131 STAC_D965_REF_NO_JD, /* no jack-detection */
127 STAC_D965_REF, 132 STAC_D965_REF,
128 STAC_D965_3ST, 133 STAC_D965_3ST,
129 STAC_D965_5ST, 134 STAC_D965_5ST,
@@ -137,6 +142,7 @@ struct sigmatel_spec {
137 unsigned int num_mixers; 142 unsigned int num_mixers;
138 143
139 int board_config; 144 int board_config;
145 unsigned int eapd_switch: 1;
140 unsigned int surr_switch: 1; 146 unsigned int surr_switch: 1;
141 unsigned int line_switch: 1; 147 unsigned int line_switch: 1;
142 unsigned int mic_switch: 1; 148 unsigned int mic_switch: 1;
@@ -1600,13 +1606,18 @@ static unsigned int dell_m6_pin_configs[13] = {
1600 1606
1601static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { 1607static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = {
1602 [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, 1608 [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs,
1603 [STAC_DELL_M6] = dell_m6_pin_configs, 1609 [STAC_DELL_M6_AMIC] = dell_m6_pin_configs,
1610 [STAC_DELL_M6_DMIC] = dell_m6_pin_configs,
1611 [STAC_DELL_M6_BOTH] = dell_m6_pin_configs,
1604 [STAC_DELL_EQ] = dell_m6_pin_configs, 1612 [STAC_DELL_EQ] = dell_m6_pin_configs,
1605}; 1613};
1606 1614
1607static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { 1615static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = {
1616 [STAC_92HD73XX_NO_JD] = "no-jd",
1608 [STAC_92HD73XX_REF] = "ref", 1617 [STAC_92HD73XX_REF] = "ref",
1609 [STAC_DELL_M6] = "dell-m6", 1618 [STAC_DELL_M6_AMIC] = "dell-m6-amic",
1619 [STAC_DELL_M6_DMIC] = "dell-m6-dmic",
1620 [STAC_DELL_M6_BOTH] = "dell-m6",
1610 [STAC_DELL_EQ] = "dell-eq", 1621 [STAC_DELL_EQ] = "dell-eq",
1611}; 1622};
1612 1623
@@ -1615,19 +1626,25 @@ static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
1615 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 1626 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1616 "DFI LanParty", STAC_92HD73XX_REF), 1627 "DFI LanParty", STAC_92HD73XX_REF),
1617 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254, 1628 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254,
1618 "unknown Dell", STAC_DELL_M6), 1629 "Dell Studio 1535", STAC_DELL_M6_DMIC),
1619 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255, 1630 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255,
1620 "unknown Dell", STAC_DELL_M6), 1631 "unknown Dell", STAC_DELL_M6_DMIC),
1621 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256, 1632 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256,
1622 "unknown Dell", STAC_DELL_M6), 1633 "unknown Dell", STAC_DELL_M6_BOTH),
1623 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257, 1634 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257,
1624 "unknown Dell", STAC_DELL_M6), 1635 "unknown Dell", STAC_DELL_M6_BOTH),
1625 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e, 1636 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e,
1626 "unknown Dell", STAC_DELL_M6), 1637 "unknown Dell", STAC_DELL_M6_AMIC),
1627 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f, 1638 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f,
1628 "unknown Dell", STAC_DELL_M6), 1639 "unknown Dell", STAC_DELL_M6_AMIC),
1629 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271, 1640 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271,
1630 "unknown Dell", STAC_DELL_M6), 1641 "unknown Dell", STAC_DELL_M6_DMIC),
1642 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0272,
1643 "unknown Dell", STAC_DELL_M6_DMIC),
1644 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x029f,
1645 "Dell Studio 1537", STAC_DELL_M6_DMIC),
1646 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a0,
1647 "Dell Studio 17", STAC_DELL_M6_DMIC),
1631 {} /* terminator */ 1648 {} /* terminator */
1632}; 1649};
1633 1650
@@ -1670,10 +1687,17 @@ static unsigned int dell_m4_2_pin_configs[11] = {
1670 0x40f000f0, 0x044413b0, 0x044413b0, 1687 0x40f000f0, 0x044413b0, 0x044413b0,
1671}; 1688};
1672 1689
1690static unsigned int dell_m4_3_pin_configs[11] = {
1691 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1692 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a000f0,
1693 0x40f000f0, 0x044413b0, 0x044413b0,
1694};
1695
1673static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = { 1696static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = {
1674 [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs, 1697 [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs,
1675 [STAC_DELL_M4_1] = dell_m4_1_pin_configs, 1698 [STAC_DELL_M4_1] = dell_m4_1_pin_configs,
1676 [STAC_DELL_M4_2] = dell_m4_2_pin_configs, 1699 [STAC_DELL_M4_2] = dell_m4_2_pin_configs,
1700 [STAC_DELL_M4_3] = dell_m4_3_pin_configs,
1677 [STAC_HP_M4] = NULL, 1701 [STAC_HP_M4] = NULL,
1678}; 1702};
1679 1703
@@ -1681,6 +1705,7 @@ static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = {
1681 [STAC_92HD71BXX_REF] = "ref", 1705 [STAC_92HD71BXX_REF] = "ref",
1682 [STAC_DELL_M4_1] = "dell-m4-1", 1706 [STAC_DELL_M4_1] = "dell-m4-1",
1683 [STAC_DELL_M4_2] = "dell-m4-2", 1707 [STAC_DELL_M4_2] = "dell-m4-2",
1708 [STAC_DELL_M4_3] = "dell-m4-3",
1684 [STAC_HP_M4] = "hp-m4", 1709 [STAC_HP_M4] = "hp-m4",
1685}; 1710};
1686 1711
@@ -1716,6 +1741,8 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
1716 "unknown Dell", STAC_DELL_M4_2), 1741 "unknown Dell", STAC_DELL_M4_2),
1717 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264, 1742 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264,
1718 "unknown Dell", STAC_DELL_M4_2), 1743 "unknown Dell", STAC_DELL_M4_2),
1744 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02aa,
1745 "unknown Dell", STAC_DELL_M4_3),
1719 {} /* terminator */ 1746 {} /* terminator */
1720}; 1747};
1721 1748
@@ -2005,6 +2032,7 @@ static unsigned int dell_3st_pin_configs[14] = {
2005}; 2032};
2006 2033
2007static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = { 2034static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = {
2035 [STAC_D965_REF_NO_JD] = ref927x_pin_configs,
2008 [STAC_D965_REF] = ref927x_pin_configs, 2036 [STAC_D965_REF] = ref927x_pin_configs,
2009 [STAC_D965_3ST] = d965_3st_pin_configs, 2037 [STAC_D965_3ST] = d965_3st_pin_configs,
2010 [STAC_D965_5ST] = d965_5st_pin_configs, 2038 [STAC_D965_5ST] = d965_5st_pin_configs,
@@ -2013,6 +2041,7 @@ static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = {
2013}; 2041};
2014 2042
2015static const char *stac927x_models[STAC_927X_MODELS] = { 2043static const char *stac927x_models[STAC_927X_MODELS] = {
2044 [STAC_D965_REF_NO_JD] = "ref-no-jd",
2016 [STAC_D965_REF] = "ref", 2045 [STAC_D965_REF] = "ref",
2017 [STAC_D965_3ST] = "3stack", 2046 [STAC_D965_3ST] = "3stack",
2018 [STAC_D965_5ST] = "5stack", 2047 [STAC_D965_5ST] = "5stack",
@@ -2874,10 +2903,10 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec,
2874 } 2903 }
2875 2904
2876 if ((spec->multiout.num_dacs - cfg->line_outs) > 0 && 2905 if ((spec->multiout.num_dacs - cfg->line_outs) > 0 &&
2877 cfg->hp_outs && !spec->multiout.hp_nid) 2906 cfg->hp_outs == 1 && !spec->multiout.hp_nid)
2878 spec->multiout.hp_nid = nid; 2907 spec->multiout.hp_nid = nid;
2879 2908
2880 if (cfg->hp_outs > 1) { 2909 if (cfg->hp_outs > 1 && cfg->line_out_type == AUTO_PIN_LINE_OUT) {
2881 err = stac92xx_add_control(spec, 2910 err = stac92xx_add_control(spec,
2882 STAC_CTL_WIDGET_HP_SWITCH, 2911 STAC_CTL_WIDGET_HP_SWITCH,
2883 "Headphone as Line Out Switch", 2912 "Headphone as Line Out Switch",
@@ -3683,10 +3712,14 @@ static void stac92xx_power_down(struct hda_codec *codec)
3683 AC_VERB_SET_POWER_STATE, AC_PWRST_D3); 3712 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
3684} 3713}
3685 3714
3715static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid,
3716 int enable);
3717
3686static int stac92xx_init(struct hda_codec *codec) 3718static int stac92xx_init(struct hda_codec *codec)
3687{ 3719{
3688 struct sigmatel_spec *spec = codec->spec; 3720 struct sigmatel_spec *spec = codec->spec;
3689 struct auto_pin_cfg *cfg = &spec->autocfg; 3721 struct auto_pin_cfg *cfg = &spec->autocfg;
3722 unsigned int gpio;
3690 int i; 3723 int i;
3691 3724
3692 snd_hda_sequence_write(codec, spec->init); 3725 snd_hda_sequence_write(codec, spec->init);
@@ -3697,6 +3730,16 @@ static int stac92xx_init(struct hda_codec *codec)
3697 snd_hda_codec_write_cache(codec, 3730 snd_hda_codec_write_cache(codec,
3698 spec->adc_nids[i], 0, 3731 spec->adc_nids[i], 0,
3699 AC_VERB_SET_POWER_STATE, AC_PWRST_D3); 3732 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
3733
3734 /* set up GPIO */
3735 gpio = spec->gpio_data;
3736 /* turn on EAPD statically when spec->eapd_switch isn't set.
3737 * otherwise, unsol event will turn it on/off dynamically
3738 */
3739 if (!spec->eapd_switch)
3740 gpio |= spec->eapd_mask;
3741 stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, gpio);
3742
3700 /* set up pins */ 3743 /* set up pins */
3701 if (spec->hp_detect) { 3744 if (spec->hp_detect) {
3702 /* Enable unsolicited responses on the HP widget */ 3745 /* Enable unsolicited responses on the HP widget */
@@ -3736,39 +3779,43 @@ static int stac92xx_init(struct hda_codec *codec)
3736 for (i = 0; i < spec->num_dmics; i++) 3779 for (i = 0; i < spec->num_dmics; i++)
3737 stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i], 3780 stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i],
3738 AC_PINCTL_IN_EN); 3781 AC_PINCTL_IN_EN);
3782 if (cfg->dig_out_pin)
3783 stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin,
3784 AC_PINCTL_OUT_EN);
3785 if (cfg->dig_in_pin)
3786 stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin,
3787 AC_PINCTL_IN_EN);
3739 for (i = 0; i < spec->num_pwrs; i++) { 3788 for (i = 0; i < spec->num_pwrs; i++) {
3740 int event = is_nid_hp_pin(cfg, spec->pwr_nids[i]) 3789 hda_nid_t nid = spec->pwr_nids[i];
3741 ? STAC_HP_EVENT : STAC_PWR_EVENT; 3790 int pinctl, def_conf;
3742 int pinctl = snd_hda_codec_read(codec, spec->pwr_nids[i], 3791 int event = STAC_PWR_EVENT;
3743 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0); 3792
3744 int def_conf = snd_hda_codec_read(codec, spec->pwr_nids[i], 3793 if (is_nid_hp_pin(cfg, nid) && spec->hp_detect)
3745 0, AC_VERB_GET_CONFIG_DEFAULT, 0); 3794 continue; /* already has an unsol event */
3746 def_conf = get_defcfg_connect(def_conf); 3795
3796 pinctl = snd_hda_codec_read(codec, nid, 0,
3797 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3747 /* outputs are only ports capable of power management 3798 /* outputs are only ports capable of power management
3748 * any attempts on powering down a input port cause the 3799 * any attempts on powering down a input port cause the
3749 * referenced VREF to act quirky. 3800 * referenced VREF to act quirky.
3750 */ 3801 */
3751 if (pinctl & AC_PINCTL_IN_EN) 3802 if (pinctl & AC_PINCTL_IN_EN)
3752 continue; 3803 continue;
3804 def_conf = snd_hda_codec_read(codec, nid, 0,
3805 AC_VERB_GET_CONFIG_DEFAULT, 0);
3806 def_conf = get_defcfg_connect(def_conf);
3753 /* skip any ports that don't have jacks since presence 3807 /* skip any ports that don't have jacks since presence
3754 * detection is useless */ 3808 * detection is useless */
3755 if (def_conf && def_conf != AC_JACK_PORT_FIXED) 3809 if (def_conf != AC_JACK_PORT_COMPLEX) {
3810 if (def_conf != AC_JACK_PORT_NONE)
3811 stac_toggle_power_map(codec, nid, 1);
3756 continue; 3812 continue;
3813 }
3757 enable_pin_detect(codec, spec->pwr_nids[i], event | i); 3814 enable_pin_detect(codec, spec->pwr_nids[i], event | i);
3758 codec->patch_ops.unsol_event(codec, (event | i) << 26); 3815 codec->patch_ops.unsol_event(codec, (event | i) << 26);
3759 } 3816 }
3760 if (spec->dac_list) 3817 if (spec->dac_list)
3761 stac92xx_power_down(codec); 3818 stac92xx_power_down(codec);
3762 if (cfg->dig_out_pin)
3763 stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin,
3764 AC_PINCTL_OUT_EN);
3765 if (cfg->dig_in_pin)
3766 stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin,
3767 AC_PINCTL_IN_EN);
3768
3769 stac_gpio_set(codec, spec->gpio_mask,
3770 spec->gpio_dir, spec->gpio_data);
3771
3772 return 0; 3819 return 0;
3773} 3820}
3774 3821
@@ -3901,7 +3948,7 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res)
3901 for (i = 0; i < cfg->speaker_outs; i++) 3948 for (i = 0; i < cfg->speaker_outs; i++)
3902 stac92xx_reset_pinctl(codec, cfg->speaker_pins[i], 3949 stac92xx_reset_pinctl(codec, cfg->speaker_pins[i],
3903 AC_PINCTL_OUT_EN); 3950 AC_PINCTL_OUT_EN);
3904 if (spec->eapd_mask) 3951 if (spec->eapd_mask && spec->eapd_switch)
3905 stac_gpio_set(codec, spec->gpio_mask, 3952 stac_gpio_set(codec, spec->gpio_mask,
3906 spec->gpio_dir, spec->gpio_data & 3953 spec->gpio_dir, spec->gpio_data &
3907 ~spec->eapd_mask); 3954 ~spec->eapd_mask);
@@ -3916,7 +3963,7 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res)
3916 for (i = 0; i < cfg->speaker_outs; i++) 3963 for (i = 0; i < cfg->speaker_outs; i++)
3917 stac92xx_set_pinctl(codec, cfg->speaker_pins[i], 3964 stac92xx_set_pinctl(codec, cfg->speaker_pins[i],
3918 AC_PINCTL_OUT_EN); 3965 AC_PINCTL_OUT_EN);
3919 if (spec->eapd_mask) 3966 if (spec->eapd_mask && spec->eapd_switch)
3920 stac_gpio_set(codec, spec->gpio_mask, 3967 stac_gpio_set(codec, spec->gpio_mask,
3921 spec->gpio_dir, spec->gpio_data | 3968 spec->gpio_dir, spec->gpio_data |
3922 spec->eapd_mask); 3969 spec->eapd_mask);
@@ -3933,14 +3980,18 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res)
3933 } 3980 }
3934} 3981}
3935 3982
3936static void stac92xx_pin_sense(struct hda_codec *codec, int idx) 3983static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid,
3984 int enable)
3937{ 3985{
3938 struct sigmatel_spec *spec = codec->spec; 3986 struct sigmatel_spec *spec = codec->spec;
3939 hda_nid_t nid = spec->pwr_nids[idx]; 3987 unsigned int idx, val;
3940 int presence, val; 3988
3941 val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) 3989 for (idx = 0; idx < spec->num_pwrs; idx++) {
3942 & 0x000000ff; 3990 if (spec->pwr_nids[idx] == nid)
3943 presence = get_hp_pin_presence(codec, nid); 3991 break;
3992 }
3993 if (idx >= spec->num_pwrs)
3994 return;
3944 3995
3945 /* several codecs have two power down bits */ 3996 /* several codecs have two power down bits */
3946 if (spec->pwr_mapping) 3997 if (spec->pwr_mapping)
@@ -3948,14 +3999,20 @@ static void stac92xx_pin_sense(struct hda_codec *codec, int idx)
3948 else 3999 else
3949 idx = 1 << idx; 4000 idx = 1 << idx;
3950 4001
3951 if (presence) 4002 val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) & 0xff;
4003 if (enable)
3952 val &= ~idx; 4004 val &= ~idx;
3953 else 4005 else
3954 val |= idx; 4006 val |= idx;
3955 4007
3956 /* power down unused output ports */ 4008 /* power down unused output ports */
3957 snd_hda_codec_write(codec, codec->afg, 0, 0x7ec, val); 4009 snd_hda_codec_write(codec, codec->afg, 0, 0x7ec, val);
3958}; 4010}
4011
4012static void stac92xx_pin_sense(struct hda_codec *codec, hda_nid_t nid)
4013{
4014 stac_toggle_power_map(codec, nid, get_hp_pin_presence(codec, nid));
4015}
3959 4016
3960static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) 4017static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
3961{ 4018{
@@ -4204,14 +4261,17 @@ again:
4204 4261
4205 switch (spec->multiout.num_dacs) { 4262 switch (spec->multiout.num_dacs) {
4206 case 0x3: /* 6 Channel */ 4263 case 0x3: /* 6 Channel */
4264 spec->multiout.hp_nid = 0x17;
4207 spec->mixer = stac92hd73xx_6ch_mixer; 4265 spec->mixer = stac92hd73xx_6ch_mixer;
4208 spec->init = stac92hd73xx_6ch_core_init; 4266 spec->init = stac92hd73xx_6ch_core_init;
4209 break; 4267 break;
4210 case 0x4: /* 8 Channel */ 4268 case 0x4: /* 8 Channel */
4269 spec->multiout.hp_nid = 0x18;
4211 spec->mixer = stac92hd73xx_8ch_mixer; 4270 spec->mixer = stac92hd73xx_8ch_mixer;
4212 spec->init = stac92hd73xx_8ch_core_init; 4271 spec->init = stac92hd73xx_8ch_core_init;
4213 break; 4272 break;
4214 case 0x5: /* 10 Channel */ 4273 case 0x5: /* 10 Channel */
4274 spec->multiout.hp_nid = 0x19;
4215 spec->mixer = stac92hd73xx_10ch_mixer; 4275 spec->mixer = stac92hd73xx_10ch_mixer;
4216 spec->init = stac92hd73xx_10ch_core_init; 4276 spec->init = stac92hd73xx_10ch_core_init;
4217 }; 4277 };
@@ -4239,31 +4299,30 @@ again:
4239 case STAC_DELL_EQ: 4299 case STAC_DELL_EQ:
4240 spec->init = dell_eq_core_init; 4300 spec->init = dell_eq_core_init;
4241 /* fallthru */ 4301 /* fallthru */
4242 case STAC_DELL_M6: 4302 case STAC_DELL_M6_AMIC:
4303 case STAC_DELL_M6_DMIC:
4304 case STAC_DELL_M6_BOTH:
4243 spec->num_smuxes = 0; 4305 spec->num_smuxes = 0;
4244 spec->mixer = &stac92hd73xx_6ch_mixer[DELL_M6_MIXER]; 4306 spec->mixer = &stac92hd73xx_6ch_mixer[DELL_M6_MIXER];
4245 spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP]; 4307 spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP];
4308 spec->eapd_switch = 0;
4246 spec->num_amps = 1; 4309 spec->num_amps = 1;
4310 spec->multiout.hp_nid = 0; /* dual HPs */
4247 4311
4248 if (!spec->init) 4312 if (!spec->init)
4249 spec->init = dell_m6_core_init; 4313 spec->init = dell_m6_core_init;
4250 switch (codec->subsystem_id) { 4314 switch (spec->board_config) {
4251 case 0x1028025e: /* Analog Mics */ 4315 case STAC_DELL_M6_AMIC: /* Analog Mics */
4252 case 0x1028025f:
4253 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); 4316 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170);
4254 spec->num_dmics = 0; 4317 spec->num_dmics = 0;
4255 spec->private_dimux.num_items = 1; 4318 spec->private_dimux.num_items = 1;
4256 break; 4319 break;
4257 case 0x10280271: /* Digital Mics */ 4320 case STAC_DELL_M6_DMIC: /* Digital Mics */
4258 case 0x10280272:
4259 case 0x10280254:
4260 case 0x10280255:
4261 stac92xx_set_config_reg(codec, 0x13, 0x90A60160); 4321 stac92xx_set_config_reg(codec, 0x13, 0x90A60160);
4262 spec->num_dmics = 1; 4322 spec->num_dmics = 1;
4263 spec->private_dimux.num_items = 2; 4323 spec->private_dimux.num_items = 2;
4264 break; 4324 break;
4265 case 0x10280256: /* Both */ 4325 case STAC_DELL_M6_BOTH: /* Both */
4266 case 0x10280057:
4267 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); 4326 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170);
4268 stac92xx_set_config_reg(codec, 0x13, 0x90A60160); 4327 stac92xx_set_config_reg(codec, 0x13, 0x90A60160);
4269 spec->num_dmics = 1; 4328 spec->num_dmics = 1;
@@ -4274,6 +4333,7 @@ again:
4274 default: 4333 default:
4275 spec->num_dmics = STAC92HD73XX_NUM_DMICS; 4334 spec->num_dmics = STAC92HD73XX_NUM_DMICS;
4276 spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids); 4335 spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids);
4336 spec->eapd_switch = 1;
4277 } 4337 }
4278 if (spec->board_config > STAC_92HD73XX_REF) { 4338 if (spec->board_config > STAC_92HD73XX_REF) {
4279 /* GPIO0 High = Enable EAPD */ 4339 /* GPIO0 High = Enable EAPD */
@@ -4302,6 +4362,9 @@ again:
4302 return err; 4362 return err;
4303 } 4363 }
4304 4364
4365 if (spec->board_config == STAC_92HD73XX_NO_JD)
4366 spec->hp_detect = 0;
4367
4305 codec->patch_ops = stac92xx_patch_ops; 4368 codec->patch_ops = stac92xx_patch_ops;
4306 4369
4307 return 0; 4370 return 0;
@@ -4419,7 +4482,13 @@ static int stac92hd71xx_resume(struct hda_codec *codec)
4419 4482
4420static int stac92hd71xx_suspend(struct hda_codec *codec, pm_message_t state) 4483static int stac92hd71xx_suspend(struct hda_codec *codec, pm_message_t state)
4421{ 4484{
4485 struct sigmatel_spec *spec = codec->spec;
4486
4422 stac92hd71xx_set_power_state(codec, AC_PWRST_D3); 4487 stac92hd71xx_set_power_state(codec, AC_PWRST_D3);
4488 if (spec->eapd_mask)
4489 stac_gpio_set(codec, spec->gpio_mask,
4490 spec->gpio_dir, spec->gpio_data &
4491 ~spec->eapd_mask);
4423 return 0; 4492 return 0;
4424}; 4493};
4425 4494
@@ -4562,14 +4631,21 @@ again:
4562 4631
4563 switch (spec->board_config) { 4632 switch (spec->board_config) {
4564 case STAC_HP_M4: 4633 case STAC_HP_M4:
4565 spec->num_dmics = 0;
4566 spec->num_smuxes = 0;
4567 spec->num_dmuxes = 0;
4568
4569 /* enable internal microphone */ 4634 /* enable internal microphone */
4570 stac92xx_set_config_reg(codec, 0x0e, 0x01813040); 4635 stac92xx_set_config_reg(codec, 0x0e, 0x01813040);
4571 stac92xx_auto_set_pinctl(codec, 0x0e, 4636 stac92xx_auto_set_pinctl(codec, 0x0e,
4572 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80); 4637 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80);
4638 /* fallthru */
4639 case STAC_DELL_M4_2:
4640 spec->num_dmics = 0;
4641 spec->num_smuxes = 0;
4642 spec->num_dmuxes = 0;
4643 break;
4644 case STAC_DELL_M4_1:
4645 case STAC_DELL_M4_3:
4646 spec->num_dmics = 1;
4647 spec->num_smuxes = 0;
4648 spec->num_dmuxes = 0;
4573 break; 4649 break;
4574 default: 4650 default:
4575 spec->num_dmics = STAC92HD71BXX_NUM_DMICS; 4651 spec->num_dmics = STAC92HD71BXX_NUM_DMICS;
@@ -4806,6 +4882,7 @@ static int patch_stac927x(struct hda_codec *codec)
4806 spec->num_pwrs = 0; 4882 spec->num_pwrs = 0;
4807 spec->aloopback_mask = 0x40; 4883 spec->aloopback_mask = 0x40;
4808 spec->aloopback_shift = 0; 4884 spec->aloopback_shift = 0;
4885 spec->eapd_switch = 1;
4809 4886
4810 err = stac92xx_parse_auto_config(codec, 0x1e, 0x20); 4887 err = stac92xx_parse_auto_config(codec, 0x1e, 0x20);
4811 if (!err) { 4888 if (!err) {
@@ -4836,6 +4913,10 @@ static int patch_stac927x(struct hda_codec *codec)
4836 */ 4913 */
4837 codec->bus->needs_damn_long_delay = 1; 4914 codec->bus->needs_damn_long_delay = 1;
4838 4915
4916 /* no jack detecion for ref-no-jd model */
4917 if (spec->board_config == STAC_D965_REF_NO_JD)
4918 spec->hp_detect = 0;
4919
4839 return 0; 4920 return 0;
4840} 4921}
4841 4922
@@ -4886,6 +4967,7 @@ static int patch_stac9205(struct hda_codec *codec)
4886 4967
4887 spec->aloopback_mask = 0x40; 4968 spec->aloopback_mask = 0x40;
4888 spec->aloopback_shift = 0; 4969 spec->aloopback_shift = 0;
4970 spec->eapd_switch = 1;
4889 spec->multiout.dac_nids = spec->dac_nids; 4971 spec->multiout.dac_nids = spec->dac_nids;
4890 4972
4891 switch (spec->board_config){ 4973 switch (spec->board_config){