]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/suse-2.6.27.31/patches.drivers/alsa-post-ga-hp-dv6736-mic-fix
Merge branch 'master' into next
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.drivers / alsa-post-ga-hp-dv6736-mic-fix
1 From 79d7d5333b598e9a559bf27833f0ad2b8bf6ad2c Mon Sep 17 00:00:00 2001
2 From: Takashi Iwai <tiwai@suse.de>
3 Date: Wed, 4 Mar 2009 09:03:50 +0100
4 Subject: ALSA: hda - Fix HP dv6736 mic input
5 Patch-mainline:
6 References: bnc#480753
7
8 Fix the mic input of HP dv6736 with Conexant 5051 codec chip.
9 This laptop seems have no mic-switching per jack connection.
10 A new model hp-dv6736 is introduced to match with the h/w implementation.
11
12 Reference: Novell bnc#480753
13 https://bugzilla.novell.com/show_bug.cgi?id=480753
14
15 Signed-off-by: Takashi Iwai <tiwai@suse.de>
16 Acked-by: Takashi Iwai <tiwai@suse.de>
17
18 ---
19 Documentation/sound/alsa/ALSA-Configuration.txt | 1
20 sound/pci/hda/patch_conexant.c | 63 ++++++++++++++++++++++--
21 2 files changed, 59 insertions(+), 5 deletions(-)
22
23 --- a/Documentation/sound/alsa/ALSA-Configuration.txt
24 +++ b/Documentation/sound/alsa/ALSA-Configuration.txt
25 @@ -1016,6 +1016,7 @@
26 Conexant 5051
27 laptop Basic Laptop config (default)
28 hp HP Spartan laptop
29 + hp-dv6736 HP dv6736
30 lenovo-x200 Lenovo X200 laptop
31
32 STAC9200
33 --- a/sound/pci/hda/patch_conexant.c
34 +++ b/sound/pci/hda/patch_conexant.c
35 @@ -58,6 +58,7 @@
36 */
37 unsigned int cur_eapd;
38 unsigned int hp_present;
39 + unsigned int no_auto_mic;
40 unsigned int need_dac_fix;
41
42 /* capture */
43 @@ -1571,8 +1572,11 @@
44 /* toggle input of built-in and mic jack appropriately */
45 static void cxt5051_portb_automic(struct hda_codec *codec)
46 {
47 + struct conexant_spec *spec = codec->spec;
48 unsigned int present;
49
50 + if (spec->no_auto_mic)
51 + return;
52 present = snd_hda_codec_read(codec, 0x17, 0,
53 AC_VERB_GET_PIN_SENSE, 0) &
54 AC_PINSENSE_PRESENCE;
55 @@ -1588,6 +1592,8 @@
56 unsigned int present;
57 hda_nid_t new_adc;
58
59 + if (spec->no_auto_mic)
60 + return;
61 present = snd_hda_codec_read(codec, 0x18, 0,
62 AC_VERB_GET_PIN_SENSE, 0) &
63 AC_PINSENSE_PRESENCE;
64 @@ -1672,6 +1678,22 @@
65 {}
66 };
67
68 +static struct snd_kcontrol_new cxt5051_hp_dv6736_mixers[] = {
69 + HDA_CODEC_VOLUME("Mic Volume", 0x14, 0x00, HDA_INPUT),
70 + HDA_CODEC_MUTE("Mic Switch", 0x14, 0x00, HDA_INPUT),
71 + HDA_CODEC_VOLUME("Master Playback Volume", 0x10, 0x00, HDA_OUTPUT),
72 + {
73 + .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
74 + .name = "Master Playback Switch",
75 + .info = cxt_eapd_info,
76 + .get = cxt_eapd_get,
77 + .put = cxt5051_hp_master_sw_put,
78 + .private_value = 0x1a,
79 + },
80 +
81 + {}
82 +};
83 +
84 static struct hda_verb cxt5051_init_verbs[] = {
85 /* Line in, Mic */
86 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03},
87 @@ -1702,6 +1724,32 @@
88 { } /* end */
89 };
90
91 +static struct hda_verb cxt5051_hp_dv6736_init_verbs[] = {
92 + /* Line in, Mic */
93 + {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03},
94 + {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
95 + {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0},
96 + {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0},
97 + /* SPK */
98 + {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
99 + {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
100 + /* HP, Amp */
101 + {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
102 + {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
103 + /* DAC1 */
104 + {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
105 + /* Record selector: Int mic */
106 + {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1) | 0x44},
107 + {0x14, AC_VERB_SET_CONNECT_SEL, 0x1},
108 + /* SPDIF route: PCM */
109 + {0x1c, AC_VERB_SET_CONNECT_SEL, 0x0},
110 + /* EAPD */
111 + {0x1a, AC_VERB_SET_EAPD_BTLENABLE, 0x2}, /* default on */
112 + {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CONEXANT_HP_EVENT},
113 + {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CXT5051_PORTB_EVENT},
114 + { } /* end */
115 +};
116 +
117 static struct hda_verb cxt5051_lenovo_x200_init_verbs[] = {
118 /* Line in, Mic */
119 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03},
120 @@ -1752,6 +1800,7 @@
121 enum {
122 CXT5051_LAPTOP, /* Laptops w/ EAPD support */
123 CXT5051_HP, /* no docking */
124 + CXT5051_HP_DV6736, /* HP without mic switch */
125 CXT5051_LENOVO_X200, /* Lenovo X200 laptop */
126 CXT5051_MODELS
127 };
128 @@ -1759,10 +1808,12 @@
129 static const char *cxt5051_models[CXT5051_MODELS] = {
130 [CXT5051_LAPTOP] = "laptop",
131 [CXT5051_HP] = "hp",
132 + [CXT5051_HP_DV6736] = "hp-dv6736",
133 [CXT5051_LENOVO_X200] = "lenovo-x200",
134 };
135
136 static struct snd_pci_quirk cxt5051_cfg_tbl[] = {
137 + SND_PCI_QUIRK(0x103c, 0x30cf, "HP DV6736", CXT5051_HP_DV6736),
138 SND_PCI_QUIRK(0x14f1, 0x0101, "Conexant Reference board",
139 CXT5051_LAPTOP),
140 SND_PCI_QUIRK(0x14f1, 0x5051, "HP Spartan 1.1", CXT5051_HP),
141 @@ -1799,20 +1850,22 @@
142 spec->cur_adc = 0;
143 spec->cur_adc_idx = 0;
144
145 + codec->patch_ops.unsol_event = cxt5051_hp_unsol_event;
146 +
147 board_config = snd_hda_check_board_config(codec, CXT5051_MODELS,
148 cxt5051_models,
149 cxt5051_cfg_tbl);
150 switch (board_config) {
151 case CXT5051_HP:
152 - codec->patch_ops.unsol_event = cxt5051_hp_unsol_event;
153 spec->mixers[0] = cxt5051_hp_mixers;
154 break;
155 + case CXT5051_HP_DV6736:
156 + spec->init_verbs[0] = cxt5051_hp_dv6736_init_verbs;
157 + spec->mixers[0] = cxt5051_hp_dv6736_mixers;
158 + spec->no_auto_mic = 1;
159 + break;
160 case CXT5051_LENOVO_X200:
161 spec->init_verbs[0] = cxt5051_lenovo_x200_init_verbs;
162 - /* fallthru */
163 - default:
164 - case CXT5051_LAPTOP:
165 - codec->patch_ops.unsol_event = cxt5051_hp_unsol_event;
166 break;
167 }
168