diff options
-rw-r--r-- | Documentation/sound/alsa/ALSA-Configuration.txt | 4 | ||||
-rw-r--r-- | sound/pci/hda/hda_codec.c | 4 | ||||
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 129 |
3 files changed, 86 insertions, 51 deletions
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt index 147f1764d976..3cd2ad958176 100644 --- a/Documentation/sound/alsa/ALSA-Configuration.txt +++ b/Documentation/sound/alsa/ALSA-Configuration.txt | |||
@@ -1076,7 +1076,9 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. | |||
1076 | 1076 | ||
1077 | STAC92HD73* | 1077 | STAC92HD73* |
1078 | ref Reference board | 1078 | ref Reference board |
1079 | dell-m6 Dell desktops | 1079 | dell-m6-amic Dell desktops/laptops with analog mics |
1080 | dell-m6-dmic Dell desktops/laptops with digital mics | ||
1081 | dell-m6 Dell desktops/laptops with both type of mics | ||
1080 | 1082 | ||
1081 | STAC9872 | 1083 | STAC9872 |
1082 | vaio Setup for VAIO FE550G/SZ110 | 1084 | vaio Setup for VAIO FE550G/SZ110 |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index ba1ab737b55f..eb9164176dab 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -1436,12 +1436,12 @@ static void set_dig_out(struct hda_codec *codec, hda_nid_t nid, | |||
1436 | { | 1436 | { |
1437 | hda_nid_t *d; | 1437 | hda_nid_t *d; |
1438 | 1438 | ||
1439 | snd_hda_codec_write(codec, nid, 0, verb, val); | 1439 | snd_hda_codec_write_cache(codec, nid, 0, verb, val); |
1440 | d = codec->slave_dig_outs; | 1440 | d = codec->slave_dig_outs; |
1441 | if (!d) | 1441 | if (!d) |
1442 | return; | 1442 | return; |
1443 | for (; *d; d++) | 1443 | for (; *d; d++) |
1444 | snd_hda_codec_write(codec, *d, 0, verb, val); | 1444 | snd_hda_codec_write_cache(codec, *d, 0, verb, val); |
1445 | } | 1445 | } |
1446 | 1446 | ||
1447 | static inline void set_dig_out_convert(struct hda_codec *codec, hda_nid_t nid, | 1447 | static inline void set_dig_out_convert(struct hda_codec *codec, hda_nid_t nid, |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 2b52a4056a9b..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 | }; |
@@ -1602,13 +1604,17 @@ static unsigned int dell_m6_pin_configs[13] = { | |||
1602 | 1604 | ||
1603 | static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { | 1605 | static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { |
1604 | [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, | 1606 | [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, |
1605 | [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, | ||
1606 | [STAC_DELL_EQ] = dell_m6_pin_configs, | 1610 | [STAC_DELL_EQ] = dell_m6_pin_configs, |
1607 | }; | 1611 | }; |
1608 | 1612 | ||
1609 | static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { | 1613 | static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { |
1610 | [STAC_92HD73XX_REF] = "ref", | 1614 | [STAC_92HD73XX_REF] = "ref", |
1611 | [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", | ||
1612 | [STAC_DELL_EQ] = "dell-eq", | 1618 | [STAC_DELL_EQ] = "dell-eq", |
1613 | }; | 1619 | }; |
1614 | 1620 | ||
@@ -1617,21 +1623,23 @@ static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { | |||
1617 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, | 1623 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
1618 | "DFI LanParty", STAC_92HD73XX_REF), | 1624 | "DFI LanParty", STAC_92HD73XX_REF), |
1619 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254, | 1625 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254, |
1620 | "unknown Dell", STAC_DELL_M6), | 1626 | "Dell Studio 1535", STAC_DELL_M6_DMIC), |
1621 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255, | 1627 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255, |
1622 | "unknown Dell", STAC_DELL_M6), | 1628 | "unknown Dell", STAC_DELL_M6_DMIC), |
1623 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256, | 1629 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256, |
1624 | "unknown Dell", STAC_DELL_M6), | 1630 | "unknown Dell", STAC_DELL_M6_BOTH), |
1625 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257, | 1631 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257, |
1626 | "unknown Dell", STAC_DELL_M6), | 1632 | "unknown Dell", STAC_DELL_M6_BOTH), |
1627 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e, | 1633 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e, |
1628 | "unknown Dell", STAC_DELL_M6), | 1634 | "unknown Dell", STAC_DELL_M6_AMIC), |
1629 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f, | 1635 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f, |
1630 | "unknown Dell", STAC_DELL_M6), | 1636 | "unknown Dell", STAC_DELL_M6_AMIC), |
1631 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271, | 1637 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271, |
1632 | "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), | ||
1633 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x029f, | 1641 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x029f, |
1634 | "Dell Studio 15", STAC_DELL_M6), | 1642 | "Dell Studio 1537", STAC_DELL_M6_DMIC), |
1635 | {} /* terminator */ | 1643 | {} /* terminator */ |
1636 | }; | 1644 | }; |
1637 | 1645 | ||
@@ -2891,7 +2899,7 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, | |||
2891 | cfg->hp_outs && !spec->multiout.hp_nid) | 2899 | cfg->hp_outs && !spec->multiout.hp_nid) |
2892 | spec->multiout.hp_nid = nid; | 2900 | spec->multiout.hp_nid = nid; |
2893 | 2901 | ||
2894 | if (cfg->hp_outs > 1) { | 2902 | if (cfg->hp_outs > 1 && cfg->line_out_type == AUTO_PIN_LINE_OUT) { |
2895 | err = stac92xx_add_control(spec, | 2903 | err = stac92xx_add_control(spec, |
2896 | STAC_CTL_WIDGET_HP_SWITCH, | 2904 | STAC_CTL_WIDGET_HP_SWITCH, |
2897 | "Headphone as Line Out Switch", | 2905 | "Headphone as Line Out Switch", |
@@ -3697,10 +3705,14 @@ static void stac92xx_power_down(struct hda_codec *codec) | |||
3697 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); | 3705 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); |
3698 | } | 3706 | } |
3699 | 3707 | ||
3708 | static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid, | ||
3709 | int enable); | ||
3710 | |||
3700 | static int stac92xx_init(struct hda_codec *codec) | 3711 | static int stac92xx_init(struct hda_codec *codec) |
3701 | { | 3712 | { |
3702 | struct sigmatel_spec *spec = codec->spec; | 3713 | struct sigmatel_spec *spec = codec->spec; |
3703 | struct auto_pin_cfg *cfg = &spec->autocfg; | 3714 | struct auto_pin_cfg *cfg = &spec->autocfg; |
3715 | unsigned int gpio; | ||
3704 | int i; | 3716 | int i; |
3705 | 3717 | ||
3706 | snd_hda_sequence_write(codec, spec->init); | 3718 | snd_hda_sequence_write(codec, spec->init); |
@@ -3711,6 +3723,16 @@ static int stac92xx_init(struct hda_codec *codec) | |||
3711 | snd_hda_codec_write_cache(codec, | 3723 | snd_hda_codec_write_cache(codec, |
3712 | spec->adc_nids[i], 0, | 3724 | spec->adc_nids[i], 0, |
3713 | 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 | |||
3714 | /* set up pins */ | 3736 | /* set up pins */ |
3715 | if (spec->hp_detect) { | 3737 | if (spec->hp_detect) { |
3716 | /* Enable unsolicited responses on the HP widget */ | 3738 | /* Enable unsolicited responses on the HP widget */ |
@@ -3750,39 +3772,43 @@ static int stac92xx_init(struct hda_codec *codec) | |||
3750 | for (i = 0; i < spec->num_dmics; i++) | 3772 | for (i = 0; i < spec->num_dmics; i++) |
3751 | stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i], | 3773 | stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i], |
3752 | 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); | ||
3753 | for (i = 0; i < spec->num_pwrs; i++) { | 3781 | for (i = 0; i < spec->num_pwrs; i++) { |
3754 | int event = is_nid_hp_pin(cfg, spec->pwr_nids[i]) | 3782 | hda_nid_t nid = spec->pwr_nids[i]; |
3755 | ? STAC_HP_EVENT : STAC_PWR_EVENT; | 3783 | int pinctl, def_conf; |
3756 | int pinctl = snd_hda_codec_read(codec, spec->pwr_nids[i], | 3784 | int event = STAC_PWR_EVENT; |
3757 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | 3785 | |
3758 | int def_conf = snd_hda_codec_read(codec, spec->pwr_nids[i], | 3786 | if (is_nid_hp_pin(cfg, nid) && spec->hp_detect) |
3759 | 0, AC_VERB_GET_CONFIG_DEFAULT, 0); | 3787 | continue; /* already has an unsol event */ |
3760 | 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); | ||
3761 | /* outputs are only ports capable of power management | 3791 | /* outputs are only ports capable of power management |
3762 | * any attempts on powering down a input port cause the | 3792 | * any attempts on powering down a input port cause the |
3763 | * referenced VREF to act quirky. | 3793 | * referenced VREF to act quirky. |
3764 | */ | 3794 | */ |
3765 | if (pinctl & AC_PINCTL_IN_EN) | 3795 | if (pinctl & AC_PINCTL_IN_EN) |
3766 | 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); | ||
3767 | /* skip any ports that don't have jacks since presence | 3800 | /* skip any ports that don't have jacks since presence |
3768 | * detection is useless */ | 3801 | * detection is useless */ |
3769 | 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); | ||
3770 | continue; | 3805 | continue; |
3806 | } | ||
3771 | enable_pin_detect(codec, spec->pwr_nids[i], event | i); | 3807 | enable_pin_detect(codec, spec->pwr_nids[i], event | i); |
3772 | codec->patch_ops.unsol_event(codec, (event | i) << 26); | 3808 | codec->patch_ops.unsol_event(codec, (event | i) << 26); |
3773 | } | 3809 | } |
3774 | if (spec->dac_list) | 3810 | if (spec->dac_list) |
3775 | stac92xx_power_down(codec); | 3811 | stac92xx_power_down(codec); |
3776 | if (cfg->dig_out_pin) | ||
3777 | stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin, | ||
3778 | AC_PINCTL_OUT_EN); | ||
3779 | if (cfg->dig_in_pin) | ||
3780 | stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin, | ||
3781 | AC_PINCTL_IN_EN); | ||
3782 | |||
3783 | stac_gpio_set(codec, spec->gpio_mask, | ||
3784 | spec->gpio_dir, spec->gpio_data); | ||
3785 | |||
3786 | return 0; | 3812 | return 0; |
3787 | } | 3813 | } |
3788 | 3814 | ||
@@ -3947,14 +3973,18 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) | |||
3947 | } | 3973 | } |
3948 | } | 3974 | } |
3949 | 3975 | ||
3950 | 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) | ||
3951 | { | 3978 | { |
3952 | struct sigmatel_spec *spec = codec->spec; | 3979 | struct sigmatel_spec *spec = codec->spec; |
3953 | hda_nid_t nid = spec->pwr_nids[idx]; | 3980 | unsigned int idx, val; |
3954 | int presence, val; | 3981 | |
3955 | val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) | 3982 | for (idx = 0; idx < spec->num_pwrs; idx++) { |
3956 | & 0x000000ff; | 3983 | if (spec->pwr_nids[idx] == nid) |
3957 | presence = get_hp_pin_presence(codec, nid); | 3984 | break; |
3985 | } | ||
3986 | if (idx >= spec->num_pwrs) | ||
3987 | return; | ||
3958 | 3988 | ||
3959 | /* several codecs have two power down bits */ | 3989 | /* several codecs have two power down bits */ |
3960 | if (spec->pwr_mapping) | 3990 | if (spec->pwr_mapping) |
@@ -3962,14 +3992,20 @@ static void stac92xx_pin_sense(struct hda_codec *codec, int idx) | |||
3962 | else | 3992 | else |
3963 | idx = 1 << idx; | 3993 | idx = 1 << idx; |
3964 | 3994 | ||
3965 | if (presence) | 3995 | val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) & 0xff; |
3996 | if (enable) | ||
3966 | val &= ~idx; | 3997 | val &= ~idx; |
3967 | else | 3998 | else |
3968 | val |= idx; | 3999 | val |= idx; |
3969 | 4000 | ||
3970 | /* power down unused output ports */ | 4001 | /* power down unused output ports */ |
3971 | snd_hda_codec_write(codec, codec->afg, 0, 0x7ec, val); | 4002 | snd_hda_codec_write(codec, codec->afg, 0, 0x7ec, val); |
3972 | }; | 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 | } | ||
3973 | 4009 | ||
3974 | 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) |
3975 | { | 4011 | { |
@@ -4253,7 +4289,9 @@ again: | |||
4253 | case STAC_DELL_EQ: | 4289 | case STAC_DELL_EQ: |
4254 | spec->init = dell_eq_core_init; | 4290 | spec->init = dell_eq_core_init; |
4255 | /* fallthru */ | 4291 | /* fallthru */ |
4256 | case STAC_DELL_M6: | 4292 | case STAC_DELL_M6_AMIC: |
4293 | case STAC_DELL_M6_DMIC: | ||
4294 | case STAC_DELL_M6_BOTH: | ||
4257 | spec->num_smuxes = 0; | 4295 | spec->num_smuxes = 0; |
4258 | spec->mixer = &stac92hd73xx_6ch_mixer[DELL_M6_MIXER]; | 4296 | spec->mixer = &stac92hd73xx_6ch_mixer[DELL_M6_MIXER]; |
4259 | spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP]; | 4297 | spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP]; |
@@ -4262,23 +4300,18 @@ again: | |||
4262 | 4300 | ||
4263 | if (!spec->init) | 4301 | if (!spec->init) |
4264 | spec->init = dell_m6_core_init; | 4302 | spec->init = dell_m6_core_init; |
4265 | switch (codec->subsystem_id) { | 4303 | switch (spec->board_config) { |
4266 | case 0x1028025e: /* Analog Mics */ | 4304 | case STAC_DELL_M6_AMIC: /* Analog Mics */ |
4267 | case 0x1028025f: | ||
4268 | stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); | 4305 | stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); |
4269 | spec->num_dmics = 0; | 4306 | spec->num_dmics = 0; |
4270 | spec->private_dimux.num_items = 1; | 4307 | spec->private_dimux.num_items = 1; |
4271 | break; | 4308 | break; |
4272 | case 0x10280271: /* Digital Mics */ | 4309 | case STAC_DELL_M6_DMIC: /* Digital Mics */ |
4273 | case 0x10280272: | ||
4274 | case 0x10280254: | ||
4275 | case 0x10280255: | ||
4276 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); | 4310 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); |
4277 | spec->num_dmics = 1; | 4311 | spec->num_dmics = 1; |
4278 | spec->private_dimux.num_items = 2; | 4312 | spec->private_dimux.num_items = 2; |
4279 | break; | 4313 | break; |
4280 | case 0x10280256: /* Both */ | 4314 | case STAC_DELL_M6_BOTH: /* Both */ |
4281 | case 0x10280057: | ||
4282 | stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); | 4315 | stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); |
4283 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); | 4316 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); |
4284 | spec->num_dmics = 1; | 4317 | spec->num_dmics = 1; |