diff options
author | Takashi Iwai <tiwai@suse.de> | 2010-01-24 05:00:27 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-01-24 05:09:31 -0500 |
commit | 6953e5524a2ee0dcf57a83d8a6728d1262c54c37 (patch) | |
tree | 5e6ff8b46c8521d141afa11571bd0a798bc7e0c2 /sound/pci/hda/patch_conexant.c | |
parent | 2c7a3fb3f81df7318c70d2b8ecbd87f008e28d52 (diff) |
ALSA: hda - initialize mic port on cxt5051 codec dynamically
Initialize the mic ports B & C on Conexant 5051 codec dynamically
according to the mic jack detection, instead of static init arrays.
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.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index e24bec6ca23a..4fbb398ccd67 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -1765,8 +1765,6 @@ static struct hda_verb cxt5051_init_verbs[] = { | |||
1765 | /* EAPD */ | 1765 | /* EAPD */ |
1766 | {0x1a, AC_VERB_SET_EAPD_BTLENABLE, 0x2}, /* default on */ | 1766 | {0x1a, AC_VERB_SET_EAPD_BTLENABLE, 0x2}, /* default on */ |
1767 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CONEXANT_HP_EVENT}, | 1767 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CONEXANT_HP_EVENT}, |
1768 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CXT5051_PORTB_EVENT}, | ||
1769 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CXT5051_PORTC_EVENT}, | ||
1770 | { } /* end */ | 1768 | { } /* end */ |
1771 | }; | 1769 | }; |
1772 | 1770 | ||
@@ -1792,7 +1790,6 @@ static struct hda_verb cxt5051_hp_dv6736_init_verbs[] = { | |||
1792 | /* EAPD */ | 1790 | /* EAPD */ |
1793 | {0x1a, AC_VERB_SET_EAPD_BTLENABLE, 0x2}, /* default on */ | 1791 | {0x1a, AC_VERB_SET_EAPD_BTLENABLE, 0x2}, /* default on */ |
1794 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CONEXANT_HP_EVENT}, | 1792 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CONEXANT_HP_EVENT}, |
1795 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CXT5051_PORTB_EVENT}, | ||
1796 | { } /* end */ | 1793 | { } /* end */ |
1797 | }; | 1794 | }; |
1798 | 1795 | ||
@@ -1824,8 +1821,6 @@ static struct hda_verb cxt5051_lenovo_x200_init_verbs[] = { | |||
1824 | /* EAPD */ | 1821 | /* EAPD */ |
1825 | {0x1a, AC_VERB_SET_EAPD_BTLENABLE, 0x2}, /* default on */ | 1822 | {0x1a, AC_VERB_SET_EAPD_BTLENABLE, 0x2}, /* default on */ |
1826 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CONEXANT_HP_EVENT}, | 1823 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CONEXANT_HP_EVENT}, |
1827 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CXT5051_PORTB_EVENT}, | ||
1828 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CXT5051_PORTC_EVENT}, | ||
1829 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CONEXANT_HP_EVENT}, | 1824 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CONEXANT_HP_EVENT}, |
1830 | { } /* end */ | 1825 | { } /* end */ |
1831 | }; | 1826 | }; |
@@ -1852,15 +1847,34 @@ static struct hda_verb cxt5051_f700_init_verbs[] = { | |||
1852 | /* EAPD */ | 1847 | /* EAPD */ |
1853 | {0x1a, AC_VERB_SET_EAPD_BTLENABLE, 0x2}, /* default on */ | 1848 | {0x1a, AC_VERB_SET_EAPD_BTLENABLE, 0x2}, /* default on */ |
1854 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CONEXANT_HP_EVENT}, | 1849 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CONEXANT_HP_EVENT}, |
1855 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CXT5051_PORTB_EVENT}, | ||
1856 | { } /* end */ | 1850 | { } /* end */ |
1857 | }; | 1851 | }; |
1858 | 1852 | ||
1853 | static void cxt5051_init_mic_port(struct hda_codec *codec, hda_nid_t nid, | ||
1854 | unsigned int event) | ||
1855 | { | ||
1856 | snd_hda_codec_write(codec, nid, 0, | ||
1857 | AC_VERB_SET_UNSOLICITED_ENABLE, | ||
1858 | AC_USRSP_EN | event); | ||
1859 | #ifdef CONFIG_SND_HDA_INPUT_JACK | ||
1860 | conexant_add_jack(codec, nid, SND_JACK_MICROPHONE); | ||
1861 | conexant_report_jack(codec, nid); | ||
1862 | #endif | ||
1863 | } | ||
1864 | |||
1859 | /* initialize jack-sensing, too */ | 1865 | /* initialize jack-sensing, too */ |
1860 | static int cxt5051_init(struct hda_codec *codec) | 1866 | static int cxt5051_init(struct hda_codec *codec) |
1861 | { | 1867 | { |
1868 | struct conexant_spec *spec = codec->spec; | ||
1869 | |||
1862 | conexant_init(codec); | 1870 | conexant_init(codec); |
1863 | conexant_init_jacks(codec); | 1871 | conexant_init_jacks(codec); |
1872 | |||
1873 | if (spec->auto_mic & AUTO_MIC_PORTB) | ||
1874 | cxt5051_init_mic_port(codec, 0x17, CXT5051_PORTB_EVENT); | ||
1875 | if (spec->auto_mic & AUTO_MIC_PORTC) | ||
1876 | cxt5051_init_mic_port(codec, 0x18, CXT5051_PORTC_EVENT); | ||
1877 | |||
1864 | if (codec->patch_ops.unsol_event) { | 1878 | if (codec->patch_ops.unsol_event) { |
1865 | cxt5051_hp_automute(codec); | 1879 | cxt5051_hp_automute(codec); |
1866 | cxt5051_portb_automic(codec); | 1880 | cxt5051_portb_automic(codec); |