diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2008-12-13 04:12:51 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-12-13 04:12:51 -0500 |
commit | 72aaf09fda49f5919d98d65d35e5179f3acb0497 (patch) | |
tree | 5fd25748f7f5640f8ee8efb86ddca88d12840791 /sound/pci/hda/patch_sigmatel.c | |
parent | 67fbc2312312095acc2f19a0b601bac10f84cf9d (diff) | |
parent | 58c2467355ed3154a12ee49d8f8236547145c9d3 (diff) |
Merge git://git.marvell.com/orion into devel
Diffstat (limited to 'sound/pci/hda/patch_sigmatel.c')
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 170 |
1 files changed, 117 insertions, 53 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 9563b5bbb272..5dd3e89f620a 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -70,7 +70,9 @@ enum { | |||
70 | 70 | ||
71 | enum { | 71 | enum { |
72 | STAC_92HD73XX_REF, | 72 | STAC_92HD73XX_REF, |
73 | STAC_DELL_M6, | 73 | STAC_DELL_M6_AMIC, |
74 | STAC_DELL_M6_DMIC, | ||
75 | STAC_DELL_M6_BOTH, | ||
74 | STAC_DELL_EQ, | 76 | STAC_DELL_EQ, |
75 | STAC_92HD73XX_MODELS | 77 | STAC_92HD73XX_MODELS |
76 | }; | 78 | }; |
@@ -84,6 +86,7 @@ enum { | |||
84 | STAC_92HD71BXX_REF, | 86 | STAC_92HD71BXX_REF, |
85 | STAC_DELL_M4_1, | 87 | STAC_DELL_M4_1, |
86 | STAC_DELL_M4_2, | 88 | STAC_DELL_M4_2, |
89 | STAC_DELL_M4_3, | ||
87 | STAC_HP_M4, | 90 | STAC_HP_M4, |
88 | STAC_92HD71BXX_MODELS | 91 | STAC_92HD71BXX_MODELS |
89 | }; | 92 | }; |
@@ -137,6 +140,7 @@ struct sigmatel_spec { | |||
137 | unsigned int num_mixers; | 140 | unsigned int num_mixers; |
138 | 141 | ||
139 | int board_config; | 142 | int board_config; |
143 | unsigned int eapd_switch: 1; | ||
140 | unsigned int surr_switch: 1; | 144 | unsigned int surr_switch: 1; |
141 | unsigned int line_switch: 1; | 145 | unsigned int line_switch: 1; |
142 | unsigned int mic_switch: 1; | 146 | unsigned int mic_switch: 1; |
@@ -1600,13 +1604,17 @@ static unsigned int dell_m6_pin_configs[13] = { | |||
1600 | 1604 | ||
1601 | static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { | 1605 | static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { |
1602 | [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, | 1606 | [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, |
1603 | [STAC_DELL_M6] = dell_m6_pin_configs, | 1607 | [STAC_DELL_M6_AMIC] = dell_m6_pin_configs, |
1608 | [STAC_DELL_M6_DMIC] = dell_m6_pin_configs, | ||
1609 | [STAC_DELL_M6_BOTH] = dell_m6_pin_configs, | ||
1604 | [STAC_DELL_EQ] = dell_m6_pin_configs, | 1610 | [STAC_DELL_EQ] = dell_m6_pin_configs, |
1605 | }; | 1611 | }; |
1606 | 1612 | ||
1607 | static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { | 1613 | static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { |
1608 | [STAC_92HD73XX_REF] = "ref", | 1614 | [STAC_92HD73XX_REF] = "ref", |
1609 | [STAC_DELL_M6] = "dell-m6", | 1615 | [STAC_DELL_M6_AMIC] = "dell-m6-amic", |
1616 | [STAC_DELL_M6_DMIC] = "dell-m6-dmic", | ||
1617 | [STAC_DELL_M6_BOTH] = "dell-m6", | ||
1610 | [STAC_DELL_EQ] = "dell-eq", | 1618 | [STAC_DELL_EQ] = "dell-eq", |
1611 | }; | 1619 | }; |
1612 | 1620 | ||
@@ -1615,19 +1623,23 @@ static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { | |||
1615 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, | 1623 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
1616 | "DFI LanParty", STAC_92HD73XX_REF), | 1624 | "DFI LanParty", STAC_92HD73XX_REF), |
1617 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254, | 1625 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254, |
1618 | "unknown Dell", STAC_DELL_M6), | 1626 | "Dell Studio 1535", STAC_DELL_M6_DMIC), |
1619 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255, | 1627 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255, |
1620 | "unknown Dell", STAC_DELL_M6), | 1628 | "unknown Dell", STAC_DELL_M6_DMIC), |
1621 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256, | 1629 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256, |
1622 | "unknown Dell", STAC_DELL_M6), | 1630 | "unknown Dell", STAC_DELL_M6_BOTH), |
1623 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257, | 1631 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257, |
1624 | "unknown Dell", STAC_DELL_M6), | 1632 | "unknown Dell", STAC_DELL_M6_BOTH), |
1625 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e, | 1633 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e, |
1626 | "unknown Dell", STAC_DELL_M6), | 1634 | "unknown Dell", STAC_DELL_M6_AMIC), |
1627 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f, | 1635 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f, |
1628 | "unknown Dell", STAC_DELL_M6), | 1636 | "unknown Dell", STAC_DELL_M6_AMIC), |
1629 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271, | 1637 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271, |
1630 | "unknown Dell", STAC_DELL_M6), | 1638 | "unknown Dell", STAC_DELL_M6_DMIC), |
1639 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0272, | ||
1640 | "unknown Dell", STAC_DELL_M6_DMIC), | ||
1641 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x029f, | ||
1642 | "Dell Studio 1537", STAC_DELL_M6_DMIC), | ||
1631 | {} /* terminator */ | 1643 | {} /* terminator */ |
1632 | }; | 1644 | }; |
1633 | 1645 | ||
@@ -1670,10 +1682,17 @@ static unsigned int dell_m4_2_pin_configs[11] = { | |||
1670 | 0x40f000f0, 0x044413b0, 0x044413b0, | 1682 | 0x40f000f0, 0x044413b0, 0x044413b0, |
1671 | }; | 1683 | }; |
1672 | 1684 | ||
1685 | static unsigned int dell_m4_3_pin_configs[11] = { | ||
1686 | 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, | ||
1687 | 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a000f0, | ||
1688 | 0x40f000f0, 0x044413b0, 0x044413b0, | ||
1689 | }; | ||
1690 | |||
1673 | static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = { | 1691 | static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = { |
1674 | [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs, | 1692 | [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs, |
1675 | [STAC_DELL_M4_1] = dell_m4_1_pin_configs, | 1693 | [STAC_DELL_M4_1] = dell_m4_1_pin_configs, |
1676 | [STAC_DELL_M4_2] = dell_m4_2_pin_configs, | 1694 | [STAC_DELL_M4_2] = dell_m4_2_pin_configs, |
1695 | [STAC_DELL_M4_3] = dell_m4_3_pin_configs, | ||
1677 | [STAC_HP_M4] = NULL, | 1696 | [STAC_HP_M4] = NULL, |
1678 | }; | 1697 | }; |
1679 | 1698 | ||
@@ -1681,6 +1700,7 @@ static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { | |||
1681 | [STAC_92HD71BXX_REF] = "ref", | 1700 | [STAC_92HD71BXX_REF] = "ref", |
1682 | [STAC_DELL_M4_1] = "dell-m4-1", | 1701 | [STAC_DELL_M4_1] = "dell-m4-1", |
1683 | [STAC_DELL_M4_2] = "dell-m4-2", | 1702 | [STAC_DELL_M4_2] = "dell-m4-2", |
1703 | [STAC_DELL_M4_3] = "dell-m4-3", | ||
1684 | [STAC_HP_M4] = "hp-m4", | 1704 | [STAC_HP_M4] = "hp-m4", |
1685 | }; | 1705 | }; |
1686 | 1706 | ||
@@ -1716,6 +1736,8 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { | |||
1716 | "unknown Dell", STAC_DELL_M4_2), | 1736 | "unknown Dell", STAC_DELL_M4_2), |
1717 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264, | 1737 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264, |
1718 | "unknown Dell", STAC_DELL_M4_2), | 1738 | "unknown Dell", STAC_DELL_M4_2), |
1739 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02aa, | ||
1740 | "unknown Dell", STAC_DELL_M4_3), | ||
1719 | {} /* terminator */ | 1741 | {} /* terminator */ |
1720 | }; | 1742 | }; |
1721 | 1743 | ||
@@ -2877,7 +2899,7 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, | |||
2877 | cfg->hp_outs && !spec->multiout.hp_nid) | 2899 | cfg->hp_outs && !spec->multiout.hp_nid) |
2878 | spec->multiout.hp_nid = nid; | 2900 | spec->multiout.hp_nid = nid; |
2879 | 2901 | ||
2880 | if (cfg->hp_outs > 1) { | 2902 | if (cfg->hp_outs > 1 && cfg->line_out_type == AUTO_PIN_LINE_OUT) { |
2881 | err = stac92xx_add_control(spec, | 2903 | err = stac92xx_add_control(spec, |
2882 | STAC_CTL_WIDGET_HP_SWITCH, | 2904 | STAC_CTL_WIDGET_HP_SWITCH, |
2883 | "Headphone as Line Out Switch", | 2905 | "Headphone as Line Out Switch", |
@@ -3683,10 +3705,14 @@ static void stac92xx_power_down(struct hda_codec *codec) | |||
3683 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); | 3705 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); |
3684 | } | 3706 | } |
3685 | 3707 | ||
3708 | static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid, | ||
3709 | int enable); | ||
3710 | |||
3686 | static int stac92xx_init(struct hda_codec *codec) | 3711 | static int stac92xx_init(struct hda_codec *codec) |
3687 | { | 3712 | { |
3688 | struct sigmatel_spec *spec = codec->spec; | 3713 | struct sigmatel_spec *spec = codec->spec; |
3689 | struct auto_pin_cfg *cfg = &spec->autocfg; | 3714 | struct auto_pin_cfg *cfg = &spec->autocfg; |
3715 | unsigned int gpio; | ||
3690 | int i; | 3716 | int i; |
3691 | 3717 | ||
3692 | snd_hda_sequence_write(codec, spec->init); | 3718 | snd_hda_sequence_write(codec, spec->init); |
@@ -3697,6 +3723,16 @@ static int stac92xx_init(struct hda_codec *codec) | |||
3697 | snd_hda_codec_write_cache(codec, | 3723 | snd_hda_codec_write_cache(codec, |
3698 | spec->adc_nids[i], 0, | 3724 | spec->adc_nids[i], 0, |
3699 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); | 3725 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); |
3726 | |||
3727 | /* set up GPIO */ | ||
3728 | gpio = spec->gpio_data; | ||
3729 | /* turn on EAPD statically when spec->eapd_switch isn't set. | ||
3730 | * otherwise, unsol event will turn it on/off dynamically | ||
3731 | */ | ||
3732 | if (!spec->eapd_switch) | ||
3733 | gpio |= spec->eapd_mask; | ||
3734 | stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, gpio); | ||
3735 | |||
3700 | /* set up pins */ | 3736 | /* set up pins */ |
3701 | if (spec->hp_detect) { | 3737 | if (spec->hp_detect) { |
3702 | /* Enable unsolicited responses on the HP widget */ | 3738 | /* Enable unsolicited responses on the HP widget */ |
@@ -3736,39 +3772,43 @@ static int stac92xx_init(struct hda_codec *codec) | |||
3736 | for (i = 0; i < spec->num_dmics; i++) | 3772 | for (i = 0; i < spec->num_dmics; i++) |
3737 | stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i], | 3773 | stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i], |
3738 | AC_PINCTL_IN_EN); | 3774 | AC_PINCTL_IN_EN); |
3775 | if (cfg->dig_out_pin) | ||
3776 | stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin, | ||
3777 | AC_PINCTL_OUT_EN); | ||
3778 | if (cfg->dig_in_pin) | ||
3779 | stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin, | ||
3780 | AC_PINCTL_IN_EN); | ||
3739 | for (i = 0; i < spec->num_pwrs; i++) { | 3781 | for (i = 0; i < spec->num_pwrs; i++) { |
3740 | int event = is_nid_hp_pin(cfg, spec->pwr_nids[i]) | 3782 | hda_nid_t nid = spec->pwr_nids[i]; |
3741 | ? STAC_HP_EVENT : STAC_PWR_EVENT; | 3783 | int pinctl, def_conf; |
3742 | int pinctl = snd_hda_codec_read(codec, spec->pwr_nids[i], | 3784 | int event = STAC_PWR_EVENT; |
3743 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | 3785 | |
3744 | int def_conf = snd_hda_codec_read(codec, spec->pwr_nids[i], | 3786 | if (is_nid_hp_pin(cfg, nid) && spec->hp_detect) |
3745 | 0, AC_VERB_GET_CONFIG_DEFAULT, 0); | 3787 | continue; /* already has an unsol event */ |
3746 | def_conf = get_defcfg_connect(def_conf); | 3788 | |
3789 | pinctl = snd_hda_codec_read(codec, nid, 0, | ||
3790 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | ||
3747 | /* outputs are only ports capable of power management | 3791 | /* outputs are only ports capable of power management |
3748 | * any attempts on powering down a input port cause the | 3792 | * any attempts on powering down a input port cause the |
3749 | * referenced VREF to act quirky. | 3793 | * referenced VREF to act quirky. |
3750 | */ | 3794 | */ |
3751 | if (pinctl & AC_PINCTL_IN_EN) | 3795 | if (pinctl & AC_PINCTL_IN_EN) |
3752 | continue; | 3796 | continue; |
3797 | def_conf = snd_hda_codec_read(codec, nid, 0, | ||
3798 | AC_VERB_GET_CONFIG_DEFAULT, 0); | ||
3799 | def_conf = get_defcfg_connect(def_conf); | ||
3753 | /* skip any ports that don't have jacks since presence | 3800 | /* skip any ports that don't have jacks since presence |
3754 | * detection is useless */ | 3801 | * detection is useless */ |
3755 | if (def_conf && def_conf != AC_JACK_PORT_FIXED) | 3802 | if (def_conf != AC_JACK_PORT_COMPLEX) { |
3803 | if (def_conf != AC_JACK_PORT_NONE) | ||
3804 | stac_toggle_power_map(codec, nid, 1); | ||
3756 | continue; | 3805 | continue; |
3806 | } | ||
3757 | enable_pin_detect(codec, spec->pwr_nids[i], event | i); | 3807 | enable_pin_detect(codec, spec->pwr_nids[i], event | i); |
3758 | codec->patch_ops.unsol_event(codec, (event | i) << 26); | 3808 | codec->patch_ops.unsol_event(codec, (event | i) << 26); |
3759 | } | 3809 | } |
3760 | if (spec->dac_list) | 3810 | if (spec->dac_list) |
3761 | stac92xx_power_down(codec); | 3811 | 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; | 3812 | return 0; |
3773 | } | 3813 | } |
3774 | 3814 | ||
@@ -3901,7 +3941,7 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) | |||
3901 | for (i = 0; i < cfg->speaker_outs; i++) | 3941 | for (i = 0; i < cfg->speaker_outs; i++) |
3902 | stac92xx_reset_pinctl(codec, cfg->speaker_pins[i], | 3942 | stac92xx_reset_pinctl(codec, cfg->speaker_pins[i], |
3903 | AC_PINCTL_OUT_EN); | 3943 | AC_PINCTL_OUT_EN); |
3904 | if (spec->eapd_mask) | 3944 | if (spec->eapd_mask && spec->eapd_switch) |
3905 | stac_gpio_set(codec, spec->gpio_mask, | 3945 | stac_gpio_set(codec, spec->gpio_mask, |
3906 | spec->gpio_dir, spec->gpio_data & | 3946 | spec->gpio_dir, spec->gpio_data & |
3907 | ~spec->eapd_mask); | 3947 | ~spec->eapd_mask); |
@@ -3916,7 +3956,7 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) | |||
3916 | for (i = 0; i < cfg->speaker_outs; i++) | 3956 | for (i = 0; i < cfg->speaker_outs; i++) |
3917 | stac92xx_set_pinctl(codec, cfg->speaker_pins[i], | 3957 | stac92xx_set_pinctl(codec, cfg->speaker_pins[i], |
3918 | AC_PINCTL_OUT_EN); | 3958 | AC_PINCTL_OUT_EN); |
3919 | if (spec->eapd_mask) | 3959 | if (spec->eapd_mask && spec->eapd_switch) |
3920 | stac_gpio_set(codec, spec->gpio_mask, | 3960 | stac_gpio_set(codec, spec->gpio_mask, |
3921 | spec->gpio_dir, spec->gpio_data | | 3961 | spec->gpio_dir, spec->gpio_data | |
3922 | spec->eapd_mask); | 3962 | spec->eapd_mask); |
@@ -3933,14 +3973,18 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) | |||
3933 | } | 3973 | } |
3934 | } | 3974 | } |
3935 | 3975 | ||
3936 | static void stac92xx_pin_sense(struct hda_codec *codec, int idx) | 3976 | static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid, |
3977 | int enable) | ||
3937 | { | 3978 | { |
3938 | struct sigmatel_spec *spec = codec->spec; | 3979 | struct sigmatel_spec *spec = codec->spec; |
3939 | hda_nid_t nid = spec->pwr_nids[idx]; | 3980 | unsigned int idx, val; |
3940 | int presence, val; | 3981 | |
3941 | val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) | 3982 | for (idx = 0; idx < spec->num_pwrs; idx++) { |
3942 | & 0x000000ff; | 3983 | if (spec->pwr_nids[idx] == nid) |
3943 | presence = get_hp_pin_presence(codec, nid); | 3984 | break; |
3985 | } | ||
3986 | if (idx >= spec->num_pwrs) | ||
3987 | return; | ||
3944 | 3988 | ||
3945 | /* several codecs have two power down bits */ | 3989 | /* several codecs have two power down bits */ |
3946 | if (spec->pwr_mapping) | 3990 | if (spec->pwr_mapping) |
@@ -3948,14 +3992,20 @@ static void stac92xx_pin_sense(struct hda_codec *codec, int idx) | |||
3948 | else | 3992 | else |
3949 | idx = 1 << idx; | 3993 | idx = 1 << idx; |
3950 | 3994 | ||
3951 | if (presence) | 3995 | val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) & 0xff; |
3996 | if (enable) | ||
3952 | val &= ~idx; | 3997 | val &= ~idx; |
3953 | else | 3998 | else |
3954 | val |= idx; | 3999 | val |= idx; |
3955 | 4000 | ||
3956 | /* power down unused output ports */ | 4001 | /* power down unused output ports */ |
3957 | snd_hda_codec_write(codec, codec->afg, 0, 0x7ec, val); | 4002 | snd_hda_codec_write(codec, codec->afg, 0, 0x7ec, val); |
3958 | }; | 4003 | } |
4004 | |||
4005 | static void stac92xx_pin_sense(struct hda_codec *codec, hda_nid_t nid) | ||
4006 | { | ||
4007 | stac_toggle_power_map(codec, nid, get_hp_pin_presence(codec, nid)); | ||
4008 | } | ||
3959 | 4009 | ||
3960 | static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) | 4010 | static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) |
3961 | { | 4011 | { |
@@ -4239,31 +4289,29 @@ again: | |||
4239 | case STAC_DELL_EQ: | 4289 | case STAC_DELL_EQ: |
4240 | spec->init = dell_eq_core_init; | 4290 | spec->init = dell_eq_core_init; |
4241 | /* fallthru */ | 4291 | /* fallthru */ |
4242 | case STAC_DELL_M6: | 4292 | case STAC_DELL_M6_AMIC: |
4293 | case STAC_DELL_M6_DMIC: | ||
4294 | case STAC_DELL_M6_BOTH: | ||
4243 | spec->num_smuxes = 0; | 4295 | spec->num_smuxes = 0; |
4244 | spec->mixer = &stac92hd73xx_6ch_mixer[DELL_M6_MIXER]; | 4296 | spec->mixer = &stac92hd73xx_6ch_mixer[DELL_M6_MIXER]; |
4245 | spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP]; | 4297 | spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP]; |
4298 | spec->eapd_switch = 0; | ||
4246 | spec->num_amps = 1; | 4299 | spec->num_amps = 1; |
4247 | 4300 | ||
4248 | if (!spec->init) | 4301 | if (!spec->init) |
4249 | spec->init = dell_m6_core_init; | 4302 | spec->init = dell_m6_core_init; |
4250 | switch (codec->subsystem_id) { | 4303 | switch (spec->board_config) { |
4251 | case 0x1028025e: /* Analog Mics */ | 4304 | case STAC_DELL_M6_AMIC: /* Analog Mics */ |
4252 | case 0x1028025f: | ||
4253 | stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); | 4305 | stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); |
4254 | spec->num_dmics = 0; | 4306 | spec->num_dmics = 0; |
4255 | spec->private_dimux.num_items = 1; | 4307 | spec->private_dimux.num_items = 1; |
4256 | break; | 4308 | break; |
4257 | case 0x10280271: /* Digital Mics */ | 4309 | case STAC_DELL_M6_DMIC: /* Digital Mics */ |
4258 | case 0x10280272: | ||
4259 | case 0x10280254: | ||
4260 | case 0x10280255: | ||
4261 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); | 4310 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); |
4262 | spec->num_dmics = 1; | 4311 | spec->num_dmics = 1; |
4263 | spec->private_dimux.num_items = 2; | 4312 | spec->private_dimux.num_items = 2; |
4264 | break; | 4313 | break; |
4265 | case 0x10280256: /* Both */ | 4314 | case STAC_DELL_M6_BOTH: /* Both */ |
4266 | case 0x10280057: | ||
4267 | stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); | 4315 | stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); |
4268 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); | 4316 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); |
4269 | spec->num_dmics = 1; | 4317 | spec->num_dmics = 1; |
@@ -4274,6 +4322,7 @@ again: | |||
4274 | default: | 4322 | default: |
4275 | spec->num_dmics = STAC92HD73XX_NUM_DMICS; | 4323 | spec->num_dmics = STAC92HD73XX_NUM_DMICS; |
4276 | spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids); | 4324 | spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids); |
4325 | spec->eapd_switch = 1; | ||
4277 | } | 4326 | } |
4278 | if (spec->board_config > STAC_92HD73XX_REF) { | 4327 | if (spec->board_config > STAC_92HD73XX_REF) { |
4279 | /* GPIO0 High = Enable EAPD */ | 4328 | /* GPIO0 High = Enable EAPD */ |
@@ -4419,7 +4468,13 @@ static int stac92hd71xx_resume(struct hda_codec *codec) | |||
4419 | 4468 | ||
4420 | static int stac92hd71xx_suspend(struct hda_codec *codec, pm_message_t state) | 4469 | static int stac92hd71xx_suspend(struct hda_codec *codec, pm_message_t state) |
4421 | { | 4470 | { |
4471 | struct sigmatel_spec *spec = codec->spec; | ||
4472 | |||
4422 | stac92hd71xx_set_power_state(codec, AC_PWRST_D3); | 4473 | stac92hd71xx_set_power_state(codec, AC_PWRST_D3); |
4474 | if (spec->eapd_mask) | ||
4475 | stac_gpio_set(codec, spec->gpio_mask, | ||
4476 | spec->gpio_dir, spec->gpio_data & | ||
4477 | ~spec->eapd_mask); | ||
4423 | return 0; | 4478 | return 0; |
4424 | }; | 4479 | }; |
4425 | 4480 | ||
@@ -4562,14 +4617,21 @@ again: | |||
4562 | 4617 | ||
4563 | switch (spec->board_config) { | 4618 | switch (spec->board_config) { |
4564 | case STAC_HP_M4: | 4619 | case STAC_HP_M4: |
4565 | spec->num_dmics = 0; | ||
4566 | spec->num_smuxes = 0; | ||
4567 | spec->num_dmuxes = 0; | ||
4568 | |||
4569 | /* enable internal microphone */ | 4620 | /* enable internal microphone */ |
4570 | stac92xx_set_config_reg(codec, 0x0e, 0x01813040); | 4621 | stac92xx_set_config_reg(codec, 0x0e, 0x01813040); |
4571 | stac92xx_auto_set_pinctl(codec, 0x0e, | 4622 | stac92xx_auto_set_pinctl(codec, 0x0e, |
4572 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80); | 4623 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80); |
4624 | /* fallthru */ | ||
4625 | case STAC_DELL_M4_2: | ||
4626 | spec->num_dmics = 0; | ||
4627 | spec->num_smuxes = 0; | ||
4628 | spec->num_dmuxes = 0; | ||
4629 | break; | ||
4630 | case STAC_DELL_M4_1: | ||
4631 | case STAC_DELL_M4_3: | ||
4632 | spec->num_dmics = 1; | ||
4633 | spec->num_smuxes = 0; | ||
4634 | spec->num_dmuxes = 0; | ||
4573 | break; | 4635 | break; |
4574 | default: | 4636 | default: |
4575 | spec->num_dmics = STAC92HD71BXX_NUM_DMICS; | 4637 | spec->num_dmics = STAC92HD71BXX_NUM_DMICS; |
@@ -4806,6 +4868,7 @@ static int patch_stac927x(struct hda_codec *codec) | |||
4806 | spec->num_pwrs = 0; | 4868 | spec->num_pwrs = 0; |
4807 | spec->aloopback_mask = 0x40; | 4869 | spec->aloopback_mask = 0x40; |
4808 | spec->aloopback_shift = 0; | 4870 | spec->aloopback_shift = 0; |
4871 | spec->eapd_switch = 1; | ||
4809 | 4872 | ||
4810 | err = stac92xx_parse_auto_config(codec, 0x1e, 0x20); | 4873 | err = stac92xx_parse_auto_config(codec, 0x1e, 0x20); |
4811 | if (!err) { | 4874 | if (!err) { |
@@ -4886,6 +4949,7 @@ static int patch_stac9205(struct hda_codec *codec) | |||
4886 | 4949 | ||
4887 | spec->aloopback_mask = 0x40; | 4950 | spec->aloopback_mask = 0x40; |
4888 | spec->aloopback_shift = 0; | 4951 | spec->aloopback_shift = 0; |
4952 | spec->eapd_switch = 1; | ||
4889 | spec->multiout.dac_nids = spec->dac_nids; | 4953 | spec->multiout.dac_nids = spec->dac_nids; |
4890 | 4954 | ||
4891 | switch (spec->board_config){ | 4955 | switch (spec->board_config){ |