aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/drivers/pcsp/pcsp.c1
-rw-r--r--sound/pci/hda/hda_codec.c4
-rw-r--r--sound/pci/hda/patch_sigmatel.c193
-rw-r--r--sound/soc/fsl/Kconfig3
-rw-r--r--sound/soc/omap/omap-pcm.c2
-rw-r--r--sound/sound_core.c6
6 files changed, 147 insertions, 62 deletions
diff --git a/sound/drivers/pcsp/pcsp.c b/sound/drivers/pcsp/pcsp.c
index 1899cf0685bc..8e52b2a8a13a 100644
--- a/sound/drivers/pcsp/pcsp.c
+++ b/sound/drivers/pcsp/pcsp.c
@@ -96,7 +96,6 @@ static int __devinit snd_card_pcsp_probe(int devnum, struct device *dev)
96 return -EINVAL; 96 return -EINVAL;
97 97
98 hrtimer_init(&pcsp_chip.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 98 hrtimer_init(&pcsp_chip.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
99 pcsp_chip.timer.cb_mode = HRTIMER_CB_SOFTIRQ;
100 pcsp_chip.timer.function = pcsp_do_timer; 99 pcsp_chip.timer.function = pcsp_do_timer;
101 100
102 card = snd_card_new(index, id, THIS_MODULE, 0); 101 card = snd_card_new(index, id, THIS_MODULE, 0);
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
1447static inline void set_dig_out_convert(struct hda_codec *codec, hda_nid_t nid, 1447static 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 9563b5bbb272..b77f330d2650 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;
@@ -853,6 +859,7 @@ static struct hda_verb stac92hd83xxx_core_init[] = {
853 859
854 /* power state controls amps */ 860 /* power state controls amps */
855 { 0x01, AC_VERB_SET_EAPD, 1 << 2}, 861 { 0x01, AC_VERB_SET_EAPD, 1 << 2},
862 {}
856}; 863};
857 864
858static struct hda_verb stac92hd71bxx_core_init[] = { 865static struct hda_verb stac92hd71bxx_core_init[] = {
@@ -864,6 +871,7 @@ static struct hda_verb stac92hd71bxx_core_init[] = {
864 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 871 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
865 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 872 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
866 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 873 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
874 {}
867}; 875};
868 876
869#define HD_DISABLE_PORTF 2 877#define HD_DISABLE_PORTF 2
@@ -1600,13 +1608,18 @@ static unsigned int dell_m6_pin_configs[13] = {
1600 1608
1601static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { 1609static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = {
1602 [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, 1610 [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs,
1603 [STAC_DELL_M6] = dell_m6_pin_configs, 1611 [STAC_DELL_M6_AMIC] = dell_m6_pin_configs,
1612 [STAC_DELL_M6_DMIC] = dell_m6_pin_configs,
1613 [STAC_DELL_M6_BOTH] = dell_m6_pin_configs,
1604 [STAC_DELL_EQ] = dell_m6_pin_configs, 1614 [STAC_DELL_EQ] = dell_m6_pin_configs,
1605}; 1615};
1606 1616
1607static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { 1617static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = {
1618 [STAC_92HD73XX_NO_JD] = "no-jd",
1608 [STAC_92HD73XX_REF] = "ref", 1619 [STAC_92HD73XX_REF] = "ref",
1609 [STAC_DELL_M6] = "dell-m6", 1620 [STAC_DELL_M6_AMIC] = "dell-m6-amic",
1621 [STAC_DELL_M6_DMIC] = "dell-m6-dmic",
1622 [STAC_DELL_M6_BOTH] = "dell-m6",
1610 [STAC_DELL_EQ] = "dell-eq", 1623 [STAC_DELL_EQ] = "dell-eq",
1611}; 1624};
1612 1625
@@ -1615,19 +1628,25 @@ static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
1615 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 1628 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1616 "DFI LanParty", STAC_92HD73XX_REF), 1629 "DFI LanParty", STAC_92HD73XX_REF),
1617 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254, 1630 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254,
1618 "unknown Dell", STAC_DELL_M6), 1631 "Dell Studio 1535", STAC_DELL_M6_DMIC),
1619 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255, 1632 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255,
1620 "unknown Dell", STAC_DELL_M6), 1633 "unknown Dell", STAC_DELL_M6_DMIC),
1621 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256, 1634 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256,
1622 "unknown Dell", STAC_DELL_M6), 1635 "unknown Dell", STAC_DELL_M6_BOTH),
1623 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257, 1636 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257,
1624 "unknown Dell", STAC_DELL_M6), 1637 "unknown Dell", STAC_DELL_M6_BOTH),
1625 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e, 1638 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e,
1626 "unknown Dell", STAC_DELL_M6), 1639 "unknown Dell", STAC_DELL_M6_AMIC),
1627 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f, 1640 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f,
1628 "unknown Dell", STAC_DELL_M6), 1641 "unknown Dell", STAC_DELL_M6_AMIC),
1629 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271, 1642 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271,
1630 "unknown Dell", STAC_DELL_M6), 1643 "unknown Dell", STAC_DELL_M6_DMIC),
1644 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0272,
1645 "unknown Dell", STAC_DELL_M6_DMIC),
1646 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x029f,
1647 "Dell Studio 1537", STAC_DELL_M6_DMIC),
1648 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a0,
1649 "Dell Studio 17", STAC_DELL_M6_DMIC),
1631 {} /* terminator */ 1650 {} /* terminator */
1632}; 1651};
1633 1652
@@ -1650,6 +1669,7 @@ static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
1650 /* SigmaTel reference board */ 1669 /* SigmaTel reference board */
1651 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 1670 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1652 "DFI LanParty", STAC_92HD71BXX_REF), 1671 "DFI LanParty", STAC_92HD71BXX_REF),
1672 {} /* terminator */
1653}; 1673};
1654 1674
1655static unsigned int ref92hd71bxx_pin_configs[11] = { 1675static unsigned int ref92hd71bxx_pin_configs[11] = {
@@ -1670,10 +1690,17 @@ static unsigned int dell_m4_2_pin_configs[11] = {
1670 0x40f000f0, 0x044413b0, 0x044413b0, 1690 0x40f000f0, 0x044413b0, 0x044413b0,
1671}; 1691};
1672 1692
1693static unsigned int dell_m4_3_pin_configs[11] = {
1694 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,
1695 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a000f0,
1696 0x40f000f0, 0x044413b0, 0x044413b0,
1697};
1698
1673static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = { 1699static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = {
1674 [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs, 1700 [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs,
1675 [STAC_DELL_M4_1] = dell_m4_1_pin_configs, 1701 [STAC_DELL_M4_1] = dell_m4_1_pin_configs,
1676 [STAC_DELL_M4_2] = dell_m4_2_pin_configs, 1702 [STAC_DELL_M4_2] = dell_m4_2_pin_configs,
1703 [STAC_DELL_M4_3] = dell_m4_3_pin_configs,
1677 [STAC_HP_M4] = NULL, 1704 [STAC_HP_M4] = NULL,
1678}; 1705};
1679 1706
@@ -1681,6 +1708,7 @@ static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = {
1681 [STAC_92HD71BXX_REF] = "ref", 1708 [STAC_92HD71BXX_REF] = "ref",
1682 [STAC_DELL_M4_1] = "dell-m4-1", 1709 [STAC_DELL_M4_1] = "dell-m4-1",
1683 [STAC_DELL_M4_2] = "dell-m4-2", 1710 [STAC_DELL_M4_2] = "dell-m4-2",
1711 [STAC_DELL_M4_3] = "dell-m4-3",
1684 [STAC_HP_M4] = "hp-m4", 1712 [STAC_HP_M4] = "hp-m4",
1685}; 1713};
1686 1714
@@ -1716,6 +1744,8 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
1716 "unknown Dell", STAC_DELL_M4_2), 1744 "unknown Dell", STAC_DELL_M4_2),
1717 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264, 1745 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264,
1718 "unknown Dell", STAC_DELL_M4_2), 1746 "unknown Dell", STAC_DELL_M4_2),
1747 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02aa,
1748 "unknown Dell", STAC_DELL_M4_3),
1719 {} /* terminator */ 1749 {} /* terminator */
1720}; 1750};
1721 1751
@@ -2005,6 +2035,7 @@ static unsigned int dell_3st_pin_configs[14] = {
2005}; 2035};
2006 2036
2007static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = { 2037static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = {
2038 [STAC_D965_REF_NO_JD] = ref927x_pin_configs,
2008 [STAC_D965_REF] = ref927x_pin_configs, 2039 [STAC_D965_REF] = ref927x_pin_configs,
2009 [STAC_D965_3ST] = d965_3st_pin_configs, 2040 [STAC_D965_3ST] = d965_3st_pin_configs,
2010 [STAC_D965_5ST] = d965_5st_pin_configs, 2041 [STAC_D965_5ST] = d965_5st_pin_configs,
@@ -2013,6 +2044,7 @@ static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = {
2013}; 2044};
2014 2045
2015static const char *stac927x_models[STAC_927X_MODELS] = { 2046static const char *stac927x_models[STAC_927X_MODELS] = {
2047 [STAC_D965_REF_NO_JD] = "ref-no-jd",
2016 [STAC_D965_REF] = "ref", 2048 [STAC_D965_REF] = "ref",
2017 [STAC_D965_3ST] = "3stack", 2049 [STAC_D965_3ST] = "3stack",
2018 [STAC_D965_5ST] = "5stack", 2050 [STAC_D965_5ST] = "5stack",
@@ -2874,10 +2906,10 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec,
2874 } 2906 }
2875 2907
2876 if ((spec->multiout.num_dacs - cfg->line_outs) > 0 && 2908 if ((spec->multiout.num_dacs - cfg->line_outs) > 0 &&
2877 cfg->hp_outs && !spec->multiout.hp_nid) 2909 cfg->hp_outs == 1 && !spec->multiout.hp_nid)
2878 spec->multiout.hp_nid = nid; 2910 spec->multiout.hp_nid = nid;
2879 2911
2880 if (cfg->hp_outs > 1) { 2912 if (cfg->hp_outs > 1 && cfg->line_out_type == AUTO_PIN_LINE_OUT) {
2881 err = stac92xx_add_control(spec, 2913 err = stac92xx_add_control(spec,
2882 STAC_CTL_WIDGET_HP_SWITCH, 2914 STAC_CTL_WIDGET_HP_SWITCH,
2883 "Headphone as Line Out Switch", 2915 "Headphone as Line Out Switch",
@@ -3683,10 +3715,14 @@ static void stac92xx_power_down(struct hda_codec *codec)
3683 AC_VERB_SET_POWER_STATE, AC_PWRST_D3); 3715 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
3684} 3716}
3685 3717
3718static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid,
3719 int enable);
3720
3686static int stac92xx_init(struct hda_codec *codec) 3721static int stac92xx_init(struct hda_codec *codec)
3687{ 3722{
3688 struct sigmatel_spec *spec = codec->spec; 3723 struct sigmatel_spec *spec = codec->spec;
3689 struct auto_pin_cfg *cfg = &spec->autocfg; 3724 struct auto_pin_cfg *cfg = &spec->autocfg;
3725 unsigned int gpio;
3690 int i; 3726 int i;
3691 3727
3692 snd_hda_sequence_write(codec, spec->init); 3728 snd_hda_sequence_write(codec, spec->init);
@@ -3697,6 +3733,16 @@ static int stac92xx_init(struct hda_codec *codec)
3697 snd_hda_codec_write_cache(codec, 3733 snd_hda_codec_write_cache(codec,
3698 spec->adc_nids[i], 0, 3734 spec->adc_nids[i], 0,
3699 AC_VERB_SET_POWER_STATE, AC_PWRST_D3); 3735 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
3736
3737 /* set up GPIO */
3738 gpio = spec->gpio_data;
3739 /* turn on EAPD statically when spec->eapd_switch isn't set.
3740 * otherwise, unsol event will turn it on/off dynamically
3741 */
3742 if (!spec->eapd_switch)
3743 gpio |= spec->eapd_mask;
3744 stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, gpio);
3745
3700 /* set up pins */ 3746 /* set up pins */
3701 if (spec->hp_detect) { 3747 if (spec->hp_detect) {
3702 /* Enable unsolicited responses on the HP widget */ 3748 /* Enable unsolicited responses on the HP widget */
@@ -3736,39 +3782,43 @@ static int stac92xx_init(struct hda_codec *codec)
3736 for (i = 0; i < spec->num_dmics; i++) 3782 for (i = 0; i < spec->num_dmics; i++)
3737 stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i], 3783 stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i],
3738 AC_PINCTL_IN_EN); 3784 AC_PINCTL_IN_EN);
3785 if (cfg->dig_out_pin)
3786 stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin,
3787 AC_PINCTL_OUT_EN);
3788 if (cfg->dig_in_pin)
3789 stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin,
3790 AC_PINCTL_IN_EN);
3739 for (i = 0; i < spec->num_pwrs; i++) { 3791 for (i = 0; i < spec->num_pwrs; i++) {
3740 int event = is_nid_hp_pin(cfg, spec->pwr_nids[i]) 3792 hda_nid_t nid = spec->pwr_nids[i];
3741 ? STAC_HP_EVENT : STAC_PWR_EVENT; 3793 int pinctl, def_conf;
3742 int pinctl = snd_hda_codec_read(codec, spec->pwr_nids[i], 3794 int event = STAC_PWR_EVENT;
3743 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0); 3795
3744 int def_conf = snd_hda_codec_read(codec, spec->pwr_nids[i], 3796 if (is_nid_hp_pin(cfg, nid) && spec->hp_detect)
3745 0, AC_VERB_GET_CONFIG_DEFAULT, 0); 3797 continue; /* already has an unsol event */
3746 def_conf = get_defcfg_connect(def_conf); 3798
3799 pinctl = snd_hda_codec_read(codec, nid, 0,
3800 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3747 /* outputs are only ports capable of power management 3801 /* outputs are only ports capable of power management
3748 * any attempts on powering down a input port cause the 3802 * any attempts on powering down a input port cause the
3749 * referenced VREF to act quirky. 3803 * referenced VREF to act quirky.
3750 */ 3804 */
3751 if (pinctl & AC_PINCTL_IN_EN) 3805 if (pinctl & AC_PINCTL_IN_EN)
3752 continue; 3806 continue;
3807 def_conf = snd_hda_codec_read(codec, nid, 0,
3808 AC_VERB_GET_CONFIG_DEFAULT, 0);
3809 def_conf = get_defcfg_connect(def_conf);
3753 /* skip any ports that don't have jacks since presence 3810 /* skip any ports that don't have jacks since presence
3754 * detection is useless */ 3811 * detection is useless */
3755 if (def_conf && def_conf != AC_JACK_PORT_FIXED) 3812 if (def_conf != AC_JACK_PORT_COMPLEX) {
3813 if (def_conf != AC_JACK_PORT_NONE)
3814 stac_toggle_power_map(codec, nid, 1);
3756 continue; 3815 continue;
3816 }
3757 enable_pin_detect(codec, spec->pwr_nids[i], event | i); 3817 enable_pin_detect(codec, spec->pwr_nids[i], event | i);
3758 codec->patch_ops.unsol_event(codec, (event | i) << 26); 3818 codec->patch_ops.unsol_event(codec, (event | i) << 26);
3759 } 3819 }
3760 if (spec->dac_list) 3820 if (spec->dac_list)
3761 stac92xx_power_down(codec); 3821 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; 3822 return 0;
3773} 3823}
3774 3824
@@ -3901,7 +3951,7 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res)
3901 for (i = 0; i < cfg->speaker_outs; i++) 3951 for (i = 0; i < cfg->speaker_outs; i++)
3902 stac92xx_reset_pinctl(codec, cfg->speaker_pins[i], 3952 stac92xx_reset_pinctl(codec, cfg->speaker_pins[i],
3903 AC_PINCTL_OUT_EN); 3953 AC_PINCTL_OUT_EN);
3904 if (spec->eapd_mask) 3954 if (spec->eapd_mask && spec->eapd_switch)
3905 stac_gpio_set(codec, spec->gpio_mask, 3955 stac_gpio_set(codec, spec->gpio_mask,
3906 spec->gpio_dir, spec->gpio_data & 3956 spec->gpio_dir, spec->gpio_data &
3907 ~spec->eapd_mask); 3957 ~spec->eapd_mask);
@@ -3916,7 +3966,7 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res)
3916 for (i = 0; i < cfg->speaker_outs; i++) 3966 for (i = 0; i < cfg->speaker_outs; i++)
3917 stac92xx_set_pinctl(codec, cfg->speaker_pins[i], 3967 stac92xx_set_pinctl(codec, cfg->speaker_pins[i],
3918 AC_PINCTL_OUT_EN); 3968 AC_PINCTL_OUT_EN);
3919 if (spec->eapd_mask) 3969 if (spec->eapd_mask && spec->eapd_switch)
3920 stac_gpio_set(codec, spec->gpio_mask, 3970 stac_gpio_set(codec, spec->gpio_mask,
3921 spec->gpio_dir, spec->gpio_data | 3971 spec->gpio_dir, spec->gpio_data |
3922 spec->eapd_mask); 3972 spec->eapd_mask);
@@ -3933,14 +3983,18 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res)
3933 } 3983 }
3934} 3984}
3935 3985
3936static void stac92xx_pin_sense(struct hda_codec *codec, int idx) 3986static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid,
3987 int enable)
3937{ 3988{
3938 struct sigmatel_spec *spec = codec->spec; 3989 struct sigmatel_spec *spec = codec->spec;
3939 hda_nid_t nid = spec->pwr_nids[idx]; 3990 unsigned int idx, val;
3940 int presence, val; 3991
3941 val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) 3992 for (idx = 0; idx < spec->num_pwrs; idx++) {
3942 & 0x000000ff; 3993 if (spec->pwr_nids[idx] == nid)
3943 presence = get_hp_pin_presence(codec, nid); 3994 break;
3995 }
3996 if (idx >= spec->num_pwrs)
3997 return;
3944 3998
3945 /* several codecs have two power down bits */ 3999 /* several codecs have two power down bits */
3946 if (spec->pwr_mapping) 4000 if (spec->pwr_mapping)
@@ -3948,14 +4002,20 @@ static void stac92xx_pin_sense(struct hda_codec *codec, int idx)
3948 else 4002 else
3949 idx = 1 << idx; 4003 idx = 1 << idx;
3950 4004
3951 if (presence) 4005 val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) & 0xff;
4006 if (enable)
3952 val &= ~idx; 4007 val &= ~idx;
3953 else 4008 else
3954 val |= idx; 4009 val |= idx;
3955 4010
3956 /* power down unused output ports */ 4011 /* power down unused output ports */
3957 snd_hda_codec_write(codec, codec->afg, 0, 0x7ec, val); 4012 snd_hda_codec_write(codec, codec->afg, 0, 0x7ec, val);
3958}; 4013}
4014
4015static void stac92xx_pin_sense(struct hda_codec *codec, hda_nid_t nid)
4016{
4017 stac_toggle_power_map(codec, nid, get_hp_pin_presence(codec, nid));
4018}
3959 4019
3960static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) 4020static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
3961{ 4021{
@@ -4204,14 +4264,17 @@ again:
4204 4264
4205 switch (spec->multiout.num_dacs) { 4265 switch (spec->multiout.num_dacs) {
4206 case 0x3: /* 6 Channel */ 4266 case 0x3: /* 6 Channel */
4267 spec->multiout.hp_nid = 0x17;
4207 spec->mixer = stac92hd73xx_6ch_mixer; 4268 spec->mixer = stac92hd73xx_6ch_mixer;
4208 spec->init = stac92hd73xx_6ch_core_init; 4269 spec->init = stac92hd73xx_6ch_core_init;
4209 break; 4270 break;
4210 case 0x4: /* 8 Channel */ 4271 case 0x4: /* 8 Channel */
4272 spec->multiout.hp_nid = 0x18;
4211 spec->mixer = stac92hd73xx_8ch_mixer; 4273 spec->mixer = stac92hd73xx_8ch_mixer;
4212 spec->init = stac92hd73xx_8ch_core_init; 4274 spec->init = stac92hd73xx_8ch_core_init;
4213 break; 4275 break;
4214 case 0x5: /* 10 Channel */ 4276 case 0x5: /* 10 Channel */
4277 spec->multiout.hp_nid = 0x19;
4215 spec->mixer = stac92hd73xx_10ch_mixer; 4278 spec->mixer = stac92hd73xx_10ch_mixer;
4216 spec->init = stac92hd73xx_10ch_core_init; 4279 spec->init = stac92hd73xx_10ch_core_init;
4217 }; 4280 };
@@ -4239,31 +4302,30 @@ again:
4239 case STAC_DELL_EQ: 4302 case STAC_DELL_EQ:
4240 spec->init = dell_eq_core_init; 4303 spec->init = dell_eq_core_init;
4241 /* fallthru */ 4304 /* fallthru */
4242 case STAC_DELL_M6: 4305 case STAC_DELL_M6_AMIC:
4306 case STAC_DELL_M6_DMIC:
4307 case STAC_DELL_M6_BOTH:
4243 spec->num_smuxes = 0; 4308 spec->num_smuxes = 0;
4244 spec->mixer = &stac92hd73xx_6ch_mixer[DELL_M6_MIXER]; 4309 spec->mixer = &stac92hd73xx_6ch_mixer[DELL_M6_MIXER];
4245 spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP]; 4310 spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP];
4311 spec->eapd_switch = 0;
4246 spec->num_amps = 1; 4312 spec->num_amps = 1;
4313 spec->multiout.hp_nid = 0; /* dual HPs */
4247 4314
4248 if (!spec->init) 4315 if (!spec->init)
4249 spec->init = dell_m6_core_init; 4316 spec->init = dell_m6_core_init;
4250 switch (codec->subsystem_id) { 4317 switch (spec->board_config) {
4251 case 0x1028025e: /* Analog Mics */ 4318 case STAC_DELL_M6_AMIC: /* Analog Mics */
4252 case 0x1028025f:
4253 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); 4319 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170);
4254 spec->num_dmics = 0; 4320 spec->num_dmics = 0;
4255 spec->private_dimux.num_items = 1; 4321 spec->private_dimux.num_items = 1;
4256 break; 4322 break;
4257 case 0x10280271: /* Digital Mics */ 4323 case STAC_DELL_M6_DMIC: /* Digital Mics */
4258 case 0x10280272:
4259 case 0x10280254:
4260 case 0x10280255:
4261 stac92xx_set_config_reg(codec, 0x13, 0x90A60160); 4324 stac92xx_set_config_reg(codec, 0x13, 0x90A60160);
4262 spec->num_dmics = 1; 4325 spec->num_dmics = 1;
4263 spec->private_dimux.num_items = 2; 4326 spec->private_dimux.num_items = 2;
4264 break; 4327 break;
4265 case 0x10280256: /* Both */ 4328 case STAC_DELL_M6_BOTH: /* Both */
4266 case 0x10280057:
4267 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); 4329 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170);
4268 stac92xx_set_config_reg(codec, 0x13, 0x90A60160); 4330 stac92xx_set_config_reg(codec, 0x13, 0x90A60160);
4269 spec->num_dmics = 1; 4331 spec->num_dmics = 1;
@@ -4274,6 +4336,7 @@ again:
4274 default: 4336 default:
4275 spec->num_dmics = STAC92HD73XX_NUM_DMICS; 4337 spec->num_dmics = STAC92HD73XX_NUM_DMICS;
4276 spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids); 4338 spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids);
4339 spec->eapd_switch = 1;
4277 } 4340 }
4278 if (spec->board_config > STAC_92HD73XX_REF) { 4341 if (spec->board_config > STAC_92HD73XX_REF) {
4279 /* GPIO0 High = Enable EAPD */ 4342 /* GPIO0 High = Enable EAPD */
@@ -4302,6 +4365,9 @@ again:
4302 return err; 4365 return err;
4303 } 4366 }
4304 4367
4368 if (spec->board_config == STAC_92HD73XX_NO_JD)
4369 spec->hp_detect = 0;
4370
4305 codec->patch_ops = stac92xx_patch_ops; 4371 codec->patch_ops = stac92xx_patch_ops;
4306 4372
4307 return 0; 4373 return 0;
@@ -4419,7 +4485,13 @@ static int stac92hd71xx_resume(struct hda_codec *codec)
4419 4485
4420static int stac92hd71xx_suspend(struct hda_codec *codec, pm_message_t state) 4486static int stac92hd71xx_suspend(struct hda_codec *codec, pm_message_t state)
4421{ 4487{
4488 struct sigmatel_spec *spec = codec->spec;
4489
4422 stac92hd71xx_set_power_state(codec, AC_PWRST_D3); 4490 stac92hd71xx_set_power_state(codec, AC_PWRST_D3);
4491 if (spec->eapd_mask)
4492 stac_gpio_set(codec, spec->gpio_mask,
4493 spec->gpio_dir, spec->gpio_data &
4494 ~spec->eapd_mask);
4423 return 0; 4495 return 0;
4424}; 4496};
4425 4497
@@ -4562,14 +4634,21 @@ again:
4562 4634
4563 switch (spec->board_config) { 4635 switch (spec->board_config) {
4564 case STAC_HP_M4: 4636 case STAC_HP_M4:
4565 spec->num_dmics = 0;
4566 spec->num_smuxes = 0;
4567 spec->num_dmuxes = 0;
4568
4569 /* enable internal microphone */ 4637 /* enable internal microphone */
4570 stac92xx_set_config_reg(codec, 0x0e, 0x01813040); 4638 stac92xx_set_config_reg(codec, 0x0e, 0x01813040);
4571 stac92xx_auto_set_pinctl(codec, 0x0e, 4639 stac92xx_auto_set_pinctl(codec, 0x0e,
4572 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80); 4640 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80);
4641 /* fallthru */
4642 case STAC_DELL_M4_2:
4643 spec->num_dmics = 0;
4644 spec->num_smuxes = 0;
4645 spec->num_dmuxes = 0;
4646 break;
4647 case STAC_DELL_M4_1:
4648 case STAC_DELL_M4_3:
4649 spec->num_dmics = 1;
4650 spec->num_smuxes = 0;
4651 spec->num_dmuxes = 0;
4573 break; 4652 break;
4574 default: 4653 default:
4575 spec->num_dmics = STAC92HD71BXX_NUM_DMICS; 4654 spec->num_dmics = STAC92HD71BXX_NUM_DMICS;
@@ -4806,6 +4885,7 @@ static int patch_stac927x(struct hda_codec *codec)
4806 spec->num_pwrs = 0; 4885 spec->num_pwrs = 0;
4807 spec->aloopback_mask = 0x40; 4886 spec->aloopback_mask = 0x40;
4808 spec->aloopback_shift = 0; 4887 spec->aloopback_shift = 0;
4888 spec->eapd_switch = 1;
4809 4889
4810 err = stac92xx_parse_auto_config(codec, 0x1e, 0x20); 4890 err = stac92xx_parse_auto_config(codec, 0x1e, 0x20);
4811 if (!err) { 4891 if (!err) {
@@ -4836,6 +4916,10 @@ static int patch_stac927x(struct hda_codec *codec)
4836 */ 4916 */
4837 codec->bus->needs_damn_long_delay = 1; 4917 codec->bus->needs_damn_long_delay = 1;
4838 4918
4919 /* no jack detecion for ref-no-jd model */
4920 if (spec->board_config == STAC_D965_REF_NO_JD)
4921 spec->hp_detect = 0;
4922
4839 return 0; 4923 return 0;
4840} 4924}
4841 4925
@@ -4886,6 +4970,7 @@ static int patch_stac9205(struct hda_codec *codec)
4886 4970
4887 spec->aloopback_mask = 0x40; 4971 spec->aloopback_mask = 0x40;
4888 spec->aloopback_shift = 0; 4972 spec->aloopback_shift = 0;
4973 spec->eapd_switch = 1;
4889 spec->multiout.dac_nids = spec->dac_nids; 4974 spec->multiout.dac_nids = spec->dac_nids;
4890 4975
4891 switch (spec->board_config){ 4976 switch (spec->board_config){
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index bba9546ba5f5..8d73edc56102 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -20,7 +20,8 @@ config SND_SOC_MPC8610_HPCD
20 20
21config SND_SOC_MPC5200_I2S 21config SND_SOC_MPC5200_I2S
22 tristate "Freescale MPC5200 PSC in I2S mode driver" 22 tristate "Freescale MPC5200 PSC in I2S mode driver"
23 depends on SND_SOC && PPC_MPC52xx && PPC_BESTCOMM
23 select SND_SOC_OF_SIMPLE 24 select SND_SOC_OF_SIMPLE
24 depends on SND_SOC && PPC_MPC52xx 25 select PPC_BESTCOMM_GEN_BD
25 help 26 help
26 Say Y here to support the MPC5200 PSCs in I2S mode. 27 Say Y here to support the MPC5200 PSCs in I2S mode.
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
index e9084fdd2082..acd68efb2b75 100644
--- a/sound/soc/omap/omap-pcm.c
+++ b/sound/soc/omap/omap-pcm.c
@@ -233,7 +233,7 @@ static int omap_pcm_open(struct snd_pcm_substream *substream)
233 if (ret < 0) 233 if (ret < 0)
234 goto out; 234 goto out;
235 235
236 prtd = kzalloc(sizeof(prtd), GFP_KERNEL); 236 prtd = kzalloc(sizeof(*prtd), GFP_KERNEL);
237 if (prtd == NULL) { 237 if (prtd == NULL) {
238 ret = -ENOMEM; 238 ret = -ENOMEM;
239 goto out; 239 goto out;
diff --git a/sound/sound_core.c b/sound/sound_core.c
index a75b289a5d78..10ba4218161b 100644
--- a/sound/sound_core.c
+++ b/sound/sound_core.c
@@ -457,7 +457,7 @@ EXPORT_SYMBOL(unregister_sound_mixer);
457 457
458void unregister_sound_midi(int unit) 458void unregister_sound_midi(int unit)
459{ 459{
460 return sound_remove_unit(&chains[2], unit); 460 sound_remove_unit(&chains[2], unit);
461} 461}
462 462
463EXPORT_SYMBOL(unregister_sound_midi); 463EXPORT_SYMBOL(unregister_sound_midi);
@@ -474,7 +474,7 @@ EXPORT_SYMBOL(unregister_sound_midi);
474 474
475void unregister_sound_dsp(int unit) 475void unregister_sound_dsp(int unit)
476{ 476{
477 return sound_remove_unit(&chains[3], unit); 477 sound_remove_unit(&chains[3], unit);
478} 478}
479 479
480 480
@@ -507,7 +507,7 @@ static struct sound_unit *__look_for_unit(int chain, int unit)
507 return NULL; 507 return NULL;
508} 508}
509 509
510int soundcore_open(struct inode *inode, struct file *file) 510static int soundcore_open(struct inode *inode, struct file *file)
511{ 511{
512 int chain; 512 int chain;
513 int unit = iminor(inode); 513 int unit = iminor(inode);