aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_conexant.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-03-04 03:03:50 -0500
committerTakashi Iwai <tiwai@suse.de>2009-03-04 03:03:50 -0500
commit79d7d5333b598e9a559bf27833f0ad2b8bf6ad2c (patch)
tree3ace212e462ec9e28708655b03ffeac31939b28e /sound/pci/hda/patch_conexant.c
parent82ad39f9391fca1d3177bd9f6a5264eff5b5346a (diff)
ALSA: hda - Fix HP dv6736 mic input
Fix the mic input of HP dv6736 with Conexant 5051 codec chip. This laptop seems have no mic-switching per jack connection. A new model hp-dv6736 is introduced to match with the h/w implementation. Reference: Novell bnc#480753 https://bugzilla.novell.com/show_bug.cgi?id=480753 Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_conexant.c')
-rw-r--r--sound/pci/hda/patch_conexant.c63
1 files changed, 58 insertions, 5 deletions
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index b8de73ecfdeb..1938e92e1f03 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -72,6 +72,7 @@ struct conexant_spec {
72 */ 72 */
73 unsigned int cur_eapd; 73 unsigned int cur_eapd;
74 unsigned int hp_present; 74 unsigned int hp_present;
75 unsigned int no_auto_mic;
75 unsigned int need_dac_fix; 76 unsigned int need_dac_fix;
76 77
77 /* capture */ 78 /* capture */
@@ -1665,8 +1666,11 @@ static int cxt5051_hp_master_sw_put(struct snd_kcontrol *kcontrol,
1665/* toggle input of built-in and mic jack appropriately */ 1666/* toggle input of built-in and mic jack appropriately */
1666static void cxt5051_portb_automic(struct hda_codec *codec) 1667static void cxt5051_portb_automic(struct hda_codec *codec)
1667{ 1668{
1669 struct conexant_spec *spec = codec->spec;
1668 unsigned int present; 1670 unsigned int present;
1669 1671
1672 if (spec->no_auto_mic)
1673 return;
1670 present = snd_hda_codec_read(codec, 0x17, 0, 1674 present = snd_hda_codec_read(codec, 0x17, 0,
1671 AC_VERB_GET_PIN_SENSE, 0) & 1675 AC_VERB_GET_PIN_SENSE, 0) &
1672 AC_PINSENSE_PRESENCE; 1676 AC_PINSENSE_PRESENCE;
@@ -1682,6 +1686,8 @@ static void cxt5051_portc_automic(struct hda_codec *codec)
1682 unsigned int present; 1686 unsigned int present;
1683 hda_nid_t new_adc; 1687 hda_nid_t new_adc;
1684 1688
1689 if (spec->no_auto_mic)
1690 return;
1685 present = snd_hda_codec_read(codec, 0x18, 0, 1691 present = snd_hda_codec_read(codec, 0x18, 0,
1686 AC_VERB_GET_PIN_SENSE, 0) & 1692 AC_VERB_GET_PIN_SENSE, 0) &
1687 AC_PINSENSE_PRESENCE; 1693 AC_PINSENSE_PRESENCE;
@@ -1768,6 +1774,22 @@ static struct snd_kcontrol_new cxt5051_hp_mixers[] = {
1768 {} 1774 {}
1769}; 1775};
1770 1776
1777static struct snd_kcontrol_new cxt5051_hp_dv6736_mixers[] = {
1778 HDA_CODEC_VOLUME("Mic Volume", 0x14, 0x00, HDA_INPUT),
1779 HDA_CODEC_MUTE("Mic Switch", 0x14, 0x00, HDA_INPUT),
1780 HDA_CODEC_VOLUME("Master Playback Volume", 0x10, 0x00, HDA_OUTPUT),
1781 {
1782 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1783 .name = "Master Playback Switch",
1784 .info = cxt_eapd_info,
1785 .get = cxt_eapd_get,
1786 .put = cxt5051_hp_master_sw_put,
1787 .private_value = 0x1a,
1788 },
1789
1790 {}
1791};
1792
1771static struct hda_verb cxt5051_init_verbs[] = { 1793static struct hda_verb cxt5051_init_verbs[] = {
1772 /* Line in, Mic */ 1794 /* Line in, Mic */
1773 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03}, 1795 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03},
@@ -1798,6 +1820,32 @@ static struct hda_verb cxt5051_init_verbs[] = {
1798 { } /* end */ 1820 { } /* end */
1799}; 1821};
1800 1822
1823static struct hda_verb cxt5051_hp_dv6736_init_verbs[] = {
1824 /* Line in, Mic */
1825 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03},
1826 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1827 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0},
1828 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0},
1829 /* SPK */
1830 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1831 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
1832 /* HP, Amp */
1833 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1834 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
1835 /* DAC1 */
1836 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1837 /* Record selector: Int mic */
1838 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1) | 0x44},
1839 {0x14, AC_VERB_SET_CONNECT_SEL, 0x1},
1840 /* SPDIF route: PCM */
1841 {0x1c, AC_VERB_SET_CONNECT_SEL, 0x0},
1842 /* EAPD */
1843 {0x1a, AC_VERB_SET_EAPD_BTLENABLE, 0x2}, /* default on */
1844 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CONEXANT_HP_EVENT},
1845 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CXT5051_PORTB_EVENT},
1846 { } /* end */
1847};
1848
1801static struct hda_verb cxt5051_lenovo_x200_init_verbs[] = { 1849static struct hda_verb cxt5051_lenovo_x200_init_verbs[] = {
1802 /* Line in, Mic */ 1850 /* Line in, Mic */
1803 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03}, 1851 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03},
@@ -1849,6 +1897,7 @@ static int cxt5051_init(struct hda_codec *codec)
1849enum { 1897enum {
1850 CXT5051_LAPTOP, /* Laptops w/ EAPD support */ 1898 CXT5051_LAPTOP, /* Laptops w/ EAPD support */
1851 CXT5051_HP, /* no docking */ 1899 CXT5051_HP, /* no docking */
1900 CXT5051_HP_DV6736, /* HP without mic switch */
1852 CXT5051_LENOVO_X200, /* Lenovo X200 laptop */ 1901 CXT5051_LENOVO_X200, /* Lenovo X200 laptop */
1853 CXT5051_MODELS 1902 CXT5051_MODELS
1854}; 1903};
@@ -1856,10 +1905,12 @@ enum {
1856static const char *cxt5051_models[CXT5051_MODELS] = { 1905static const char *cxt5051_models[CXT5051_MODELS] = {
1857 [CXT5051_LAPTOP] = "laptop", 1906 [CXT5051_LAPTOP] = "laptop",
1858 [CXT5051_HP] = "hp", 1907 [CXT5051_HP] = "hp",
1908 [CXT5051_HP_DV6736] = "hp-dv6736",
1859 [CXT5051_LENOVO_X200] = "lenovo-x200", 1909 [CXT5051_LENOVO_X200] = "lenovo-x200",
1860}; 1910};
1861 1911
1862static struct snd_pci_quirk cxt5051_cfg_tbl[] = { 1912static struct snd_pci_quirk cxt5051_cfg_tbl[] = {
1913 SND_PCI_QUIRK(0x103c, 0x30cf, "HP DV6736", CXT5051_HP_DV6736),
1863 SND_PCI_QUIRK(0x14f1, 0x0101, "Conexant Reference board", 1914 SND_PCI_QUIRK(0x14f1, 0x0101, "Conexant Reference board",
1864 CXT5051_LAPTOP), 1915 CXT5051_LAPTOP),
1865 SND_PCI_QUIRK(0x14f1, 0x5051, "HP Spartan 1.1", CXT5051_HP), 1916 SND_PCI_QUIRK(0x14f1, 0x5051, "HP Spartan 1.1", CXT5051_HP),
@@ -1896,20 +1947,22 @@ static int patch_cxt5051(struct hda_codec *codec)
1896 spec->cur_adc = 0; 1947 spec->cur_adc = 0;
1897 spec->cur_adc_idx = 0; 1948 spec->cur_adc_idx = 0;
1898 1949
1950 codec->patch_ops.unsol_event = cxt5051_hp_unsol_event;
1951
1899 board_config = snd_hda_check_board_config(codec, CXT5051_MODELS, 1952 board_config = snd_hda_check_board_config(codec, CXT5051_MODELS,
1900 cxt5051_models, 1953 cxt5051_models,
1901 cxt5051_cfg_tbl); 1954 cxt5051_cfg_tbl);
1902 switch (board_config) { 1955 switch (board_config) {
1903 case CXT5051_HP: 1956 case CXT5051_HP:
1904 codec->patch_ops.unsol_event = cxt5051_hp_unsol_event;
1905 spec->mixers[0] = cxt5051_hp_mixers; 1957 spec->mixers[0] = cxt5051_hp_mixers;
1906 break; 1958 break;
1959 case CXT5051_HP_DV6736:
1960 spec->init_verbs[0] = cxt5051_hp_dv6736_init_verbs;
1961 spec->mixers[0] = cxt5051_hp_dv6736_mixers;
1962 spec->no_auto_mic = 1;
1963 break;
1907 case CXT5051_LENOVO_X200: 1964 case CXT5051_LENOVO_X200:
1908 spec->init_verbs[0] = cxt5051_lenovo_x200_init_verbs; 1965 spec->init_verbs[0] = cxt5051_lenovo_x200_init_verbs;
1909 /* fallthru */
1910 default:
1911 case CXT5051_LAPTOP:
1912 codec->patch_ops.unsol_event = cxt5051_hp_unsol_event;
1913 break; 1966 break;
1914 } 1967 }
1915 1968