Blame view

sound/pci/hda/patch_sigmatel.c 135 KB
2f2f4251c   Matt   [ALSA] add sigmat...
1
2
3
4
5
6
  /*
   * Universal Interface for Intel High Definition Audio Codec
   *
   * HD audio interface patch for SigmaTel STAC92xx
   *
   * Copyright (c) 2005 Embedded Alley Solutions, Inc.
403d19446   Matt Porter   [ALSA] hda-codec ...
7
   * Matt Porter <mporter@embeddedalley.com>
2f2f4251c   Matt   [ALSA] add sigmat...
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
   *
   * Based on patch_cmedia.c and patch_realtek.c
   * Copyright (c) 2004 Takashi Iwai <tiwai@suse.de>
   *
   *  This driver is free software; you can redistribute it and/or modify
   *  it under the terms of the GNU General Public License as published by
   *  the Free Software Foundation; either version 2 of the License, or
   *  (at your option) any later version.
   *
   *  This driver is distributed in the hope that it will be useful,
   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   *  GNU General Public License for more details.
   *
   *  You should have received a copy of the GNU General Public License
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
   */
2f2f4251c   Matt   [ALSA] add sigmat...
26
27
28
29
  #include <linux/init.h>
  #include <linux/delay.h>
  #include <linux/slab.h>
  #include <linux/pci.h>
5bdaaada1   Vitaliy Kulikov   ALSA: hda - Enabl...
30
  #include <linux/dmi.h>
da155d5b4   Paul Gortmaker   sound: Add module...
31
  #include <linux/module.h>
2f2f4251c   Matt   [ALSA] add sigmat...
32
  #include <sound/core.h>
45a6ac16c   Matthew Ranostay   ALSA: hda: add su...
33
  #include <sound/jack.h>
2f2f4251c   Matt   [ALSA] add sigmat...
34
35
  #include "hda_codec.h"
  #include "hda_local.h"
128bc4ba8   Takashi Iwai   ALSA: hda - Move ...
36
  #include "hda_auto_parser.h"
1cd2224cd   Matthew Ranostay   ALSA: hda: digita...
37
  #include "hda_beep.h"
1835a0f9a   Takashi Iwai   ALSA: hda - Cache...
38
  #include "hda_jack.h"
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
39
  #include "hda_generic.h"
2f2f4251c   Matt   [ALSA] add sigmat...
40

c6e4c6661   Takashi Iwai   ALSA: hda - Assig...
41
  enum {
f5fcc13c2   Takashi Iwai   [ALSA] hda-codec ...
42
  	STAC_REF,
bf277785d   Tobin Davis   [ALSA] HDA - Add ...
43
  	STAC_9200_OQO,
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
44
45
46
47
48
49
50
51
52
53
  	STAC_9200_DELL_D21,
  	STAC_9200_DELL_D22,
  	STAC_9200_DELL_D23,
  	STAC_9200_DELL_M21,
  	STAC_9200_DELL_M22,
  	STAC_9200_DELL_M23,
  	STAC_9200_DELL_M24,
  	STAC_9200_DELL_M25,
  	STAC_9200_DELL_M26,
  	STAC_9200_DELL_M27,
58eec4235   Mauro Carvalho Chehab   ALSA: hda - More ...
54
55
  	STAC_9200_M4,
  	STAC_9200_M4_2,
117f257d7   Takashi Iwai   [ALSA] hda-codec ...
56
  	STAC_9200_PANASONIC,
d39a3ae82   Takashi Iwai   ALSA: hda - Use s...
57
  	STAC_9200_EAPD_INIT,
f5fcc13c2   Takashi Iwai   [ALSA] hda-codec ...
58
59
60
61
62
  	STAC_9200_MODELS
  };
  
  enum {
  	STAC_9205_REF,
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
63
  	STAC_9205_DELL_M42,
ae0a8ed8b   Tobin Davis   [ALSA] This patch...
64
65
  	STAC_9205_DELL_M43,
  	STAC_9205_DELL_M44,
d9a4268ee   Takashi Iwai   ALSA: hda - Add q...
66
  	STAC_9205_EAPD,
f5fcc13c2   Takashi Iwai   [ALSA] hda-codec ...
67
68
69
70
  	STAC_9205_MODELS
  };
  
  enum {
9e43f0de6   Takashi Iwai   ALSA: hda - Add n...
71
  	STAC_92HD73XX_NO_JD, /* no jack-detection */
e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
72
  	STAC_92HD73XX_REF,
ae709440e   Wu Fengguang   ALSA: hda: add mo...
73
  	STAC_92HD73XX_INTEL,
661cd8fb5   Takashi Iwai   ALSA: hda - Check...
74
75
76
  	STAC_DELL_M6_AMIC,
  	STAC_DELL_M6_DMIC,
  	STAC_DELL_M6_BOTH,
6b3ab21ef   Matthew Ranostay   ALSA: hda: make a...
77
  	STAC_DELL_EQ,
842ae6380   Takashi Iwai   ALSA: hda - Add s...
78
  	STAC_ALIENWARE_M17X,
1de7ca5e8   Hui Wang   ALSA: hda - Enabl...
79
  	STAC_92HD89XX_HP_FRONT_JACK,
7440850c2   Hui Wang   ALSA: hda - fix a...
80
  	STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK,
e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
81
82
83
84
  	STAC_92HD73XX_MODELS
  };
  
  enum {
d0513fc6c   Matthew Ranostay   ALSA: hda: added ...
85
  	STAC_92HD83XXX_REF,
32ed3f464   Matthew Ranostay   ALSA: hda: Add ST...
86
  	STAC_92HD83XXX_PWR_REF,
8bb0ac557   Matthew Ranostay   ALSA: hda: Add ST...
87
  	STAC_DELL_S14,
f7f9bdfad   Julian Wollrath   ALSA: hda - fix i...
88
  	STAC_DELL_VOSTRO_3500,
0c27c1805   Vitaliy Kulikov   ALSA: hda - Add s...
89
  	STAC_92HD83XXX_HP_cNB11_INTQUAD,
483155901   Steven Eastland   ALSA: hda - New s...
90
  	STAC_HP_DV7_4000,
5556e1470   Vitaliy Kulikov   ALSA: hda - Fix a...
91
  	STAC_HP_ZEPHYR,
a3e199732   Takashi Iwai   ALSA: hda - Fix m...
92
  	STAC_92HD83XXX_HP_LED,
ff8a1e274   Takashi Iwai   ALSA: hda - Fix p...
93
  	STAC_92HD83XXX_HP_INV_LED,
62cbde186   Takashi Iwai   ALSA: hda - Add m...
94
  	STAC_92HD83XXX_HP_MIC_LED,
37c367ecd   Takashi Iwai   ALSA: hda - Add a...
95
  	STAC_HP_LED_GPIO10,
8d032a8f6   David Henningsson   ALSA: hda - remov...
96
  	STAC_92HD83XXX_HEADSET_JACK,
372f8c750   Takashi Iwai   ALSA: hda - Use s...
97
  	STAC_92HD83XXX_HP,
49920427e   Takashi Iwai   ALSA: hda/sigmate...
98
  	STAC_HP_ENVY_BASS,
d009f3deb   Vitaliy Kulikov   ALSA: hda - load ...
99
  	STAC_HP_BNB13_EQ,
8695a003a   Takashi Iwai   ALSA: hda - Add t...
100
  	STAC_HP_ENVY_TS_BASS,
d0513fc6c   Matthew Ranostay   ALSA: hda: added ...
101
102
103
104
  	STAC_92HD83XXX_MODELS
  };
  
  enum {
e035b8410   Matthew Ranostay   [ALSA] hda: Added...
105
  	STAC_92HD71BXX_REF,
a76626401   Matthew Ranostay   [ALSA] hda: 92HDx...
106
107
  	STAC_DELL_M4_1,
  	STAC_DELL_M4_2,
3a7abfd2b   Matthew Ranostay   ALSA: hda: Add ST...
108
  	STAC_DELL_M4_3,
6a14f5851   Matthew Ranostay   ALSA: hda: Added ...
109
  	STAC_HP_M4,
2a6ce6e5f   Takashi Iwai   ALSA: hda - Add h...
110
  	STAC_HP_DV4,
1b0652eb5   Takashi Iwai   ALSA: hda - Fix H...
111
  	STAC_HP_DV5,
ae6241fbf   Christoph Plattner   ALSA: hda - Added...
112
  	STAC_HP_HDX,
0f6fcb73c   Takashi Iwai   ALSA: hda - Use s...
113
114
115
  	STAC_92HD71BXX_HP,
  	STAC_92HD71BXX_NO_DMIC,
  	STAC_92HD71BXX_NO_SMUX,
e035b8410   Matthew Ranostay   [ALSA] hda: Added...
116
117
118
119
  	STAC_92HD71BXX_MODELS
  };
  
  enum {
8b3dfdaf0   Takashi Iwai   ALSA: hda - Adjus...
120
121
122
123
124
125
  	STAC_92HD95_HP_LED,
  	STAC_92HD95_HP_BASS,
  	STAC_92HD95_MODELS
  };
  
  enum {
8e21c34cd   Tobin Davis   [ALSA] hda-codec ...
126
  	STAC_925x_REF,
9cb36c2af   Mauro Carvalho Chehab   ALSA: patch_sigma...
127
128
129
  	STAC_M1,
  	STAC_M1_2,
  	STAC_M2,
8e21c34cd   Tobin Davis   [ALSA] hda-codec ...
130
  	STAC_M2_2,
9cb36c2af   Mauro Carvalho Chehab   ALSA: patch_sigma...
131
132
133
  	STAC_M3,
  	STAC_M5,
  	STAC_M6,
8e21c34cd   Tobin Davis   [ALSA] hda-codec ...
134
135
136
137
  	STAC_925x_MODELS
  };
  
  enum {
f5fcc13c2   Takashi Iwai   [ALSA] hda-codec ...
138
139
140
  	STAC_D945_REF,
  	STAC_D945GTP3,
  	STAC_D945GTP5,
5d5d3bc3e   Ivan N. Zlatev   [ALSA] hda-codec ...
141
142
143
144
145
  	STAC_INTEL_MAC_V1,
  	STAC_INTEL_MAC_V2,
  	STAC_INTEL_MAC_V3,
  	STAC_INTEL_MAC_V4,
  	STAC_INTEL_MAC_V5,
0a4278464   Takashi Iwai   ALSA: hda - Use s...
146
  	STAC_INTEL_MAC_AUTO,
8c6500879   Mauro Carvalho Chehab   ALSA: hda: Add su...
147
  	STAC_ECS_202,
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
148
149
150
151
  	STAC_922X_DELL_D81,
  	STAC_922X_DELL_D82,
  	STAC_922X_DELL_M81,
  	STAC_922X_DELL_M82,
0a4278464   Takashi Iwai   ALSA: hda - Use s...
152
  	STAC_922X_INTEL_MAC_GPIO,
f5fcc13c2   Takashi Iwai   [ALSA] hda-codec ...
153
154
155
156
  	STAC_922X_MODELS
  };
  
  enum {
e28d83223   Takashi Iwai   ALSA: hda - Fix s...
157
  	STAC_D965_REF_NO_JD, /* no jack-detection */
f5fcc13c2   Takashi Iwai   [ALSA] hda-codec ...
158
159
160
  	STAC_D965_REF,
  	STAC_D965_3ST,
  	STAC_D965_5ST,
679d92ed1   Takashi Iwai   ALSA: hda - Add 5...
161
  	STAC_D965_5ST_NO_FP,
29ac83635   Takashi Iwai   ALSA: hda - Use s...
162
  	STAC_D965_VERBS,
4ff076e5d   Tobin Davis   [ALSA] hda-codec ...
163
  	STAC_DELL_3ST,
8e9068b1c   Matthew Ranostay   [ALSA] hda: STAC9...
164
  	STAC_DELL_BIOS,
eefb8be4a   Takashi Iwai   ALSA: hda - Remov...
165
  	STAC_DELL_BIOS_AMIC,
29ac83635   Takashi Iwai   ALSA: hda - Use s...
166
167
  	STAC_DELL_BIOS_SPDIF,
  	STAC_927X_DELL_DMIC,
54930531a   Takashi Iwai   ALSA: hda - Fix m...
168
  	STAC_927X_VOLKNOB,
f5fcc13c2   Takashi Iwai   [ALSA] hda-codec ...
169
170
  	STAC_927X_MODELS
  };
403d19446   Matt Porter   [ALSA] hda-codec ...
171

307282c89   Takashi Iwai   ALSA: hda - Add m...
172
  enum {
307282c89   Takashi Iwai   ALSA: hda - Add m...
173
174
175
  	STAC_9872_VAIO,
  	STAC_9872_MODELS
  };
2f2f4251c   Matt   [ALSA] add sigmat...
176
  struct sigmatel_spec {
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
177
  	struct hda_gen_spec gen;
c7d4b2fa3   Matt   [ALSA] hda-codec ...
178

c0cea0d09   Matthew Ranostay   ALSA: hda: STAC_D...
179
  	unsigned int eapd_switch: 1;
1b0e372d7   Daniel J Blueman   ALSA: hda - Fix b...
180
  	unsigned int linear_tone_beep:1;
8d032a8f6   David Henningsson   ALSA: hda - remov...
181
  	unsigned int headset_jack:1; /* 4-pin headset jack (hp + mono mic) */
29ac83635   Takashi Iwai   ALSA: hda - Use s...
182
  	unsigned int volknob_init:1; /* special volume-knob initialization */
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
183
  	unsigned int powerdown_adcs:1;
42875479b   Takashi Iwai   ALSA: hda - Reviv...
184
  	unsigned int have_spdif_mux:1;
c7d4b2fa3   Matt   [ALSA] hda-codec ...
185

4fe5195c4   Matthew Ranostay   [ALSA] hda: Add G...
186
  	/* gpio lines */
0fc9dec46   Matthew Ranostay   [ALSA] hda: EAPD ...
187
  	unsigned int eapd_mask;
4fe5195c4   Matthew Ranostay   [ALSA] hda: Add G...
188
189
190
191
  	unsigned int gpio_mask;
  	unsigned int gpio_dir;
  	unsigned int gpio_data;
  	unsigned int gpio_mute;
86d190e77   Takashi Iwai   ALSA: hda - Minor...
192
  	unsigned int gpio_led;
c357aab02   Vitaliy Kulikov   ALSA: hda - Fix L...
193
  	unsigned int gpio_led_polarity;
f1a73746c   Takashi Iwai   ALSA: hda - Fix G...
194
  	unsigned int vref_mute_led_nid; /* pin NID for mute-LED vref control */
45eebda7b   Vitaliy Kulikov   ALSA: hda - Add s...
195
  	unsigned int vref_led;
372f8c750   Takashi Iwai   ALSA: hda - Use s...
196
  	int default_polarity;
4fe5195c4   Matthew Ranostay   [ALSA] hda: Add G...
197

62cbde186   Takashi Iwai   ALSA: hda - Add m...
198
  	unsigned int mic_mute_led_gpio; /* capture mute LED GPIO */
7fe307117   Takashi Iwai   ALSA: hda - Fix i...
199
  	unsigned int mic_enabled; /* current mic mute state (bitmask) */
62cbde186   Takashi Iwai   ALSA: hda - Add m...
200

8daaaa97d   Matthew Ranostay   ALSA: hda: 92HD75...
201
202
  	/* stream */
  	unsigned int stream_delay;
4fe5195c4   Matthew Ranostay   [ALSA] hda: Add G...
203
  	/* analog loopback */
2b63536f0   Takashi Iwai   ALSA: hda - Const...
204
  	const struct snd_kcontrol_new *aloopback_ctl;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
205
  	unsigned int aloopback;
e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
206
207
  	unsigned char aloopback_mask;
  	unsigned char aloopback_shift;
8259980eb   Takashi Iwai   [ALSA] hda-codec ...
208

a64135a2d   Matthew Ranostay   [ALSA] hda: 92HD7...
209
  	/* power management */
c882246d8   Takashi Iwai   ALSA: hda/idt - C...
210
  	unsigned int power_map_bits;
a64135a2d   Matthew Ranostay   [ALSA] hda: 92HD7...
211
  	unsigned int num_pwrs;
2b63536f0   Takashi Iwai   ALSA: hda - Const...
212
  	const hda_nid_t *pwr_nids;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
213
214
215
  	unsigned int active_adcs;
  
  	/* beep widgets */
1cd2224cd   Matthew Ranostay   ALSA: hda: digita...
216
  	hda_nid_t anabeep_nid;
42875479b   Takashi Iwai   ALSA: hda - Reviv...
217
218
219
220
221
  
  	/* SPDIF-out mux */
  	const char * const *spdif_labels;
  	struct hda_input_mux spdif_mux;
  	unsigned int cur_smux[2];
2f2f4251c   Matt   [ALSA] add sigmat...
222
  };
c882246d8   Takashi Iwai   ALSA: hda/idt - C...
223
224
  #define AC_VERB_IDT_SET_POWER_MAP	0x7ec
  #define AC_VERB_IDT_GET_POWER_MAP	0xfec
2b63536f0   Takashi Iwai   ALSA: hda - Const...
225
  static const hda_nid_t stac92hd73xx_pwr_nids[8] = {
a64135a2d   Matthew Ranostay   [ALSA] hda: 92HD7...
226
227
228
  	0x0a, 0x0b, 0x0c, 0xd, 0x0e,
  	0x0f, 0x10, 0x11
  };
afef2cfa0   Charles Chin   ALSA: hda - pwr_n...
229
230
231
  static const hda_nid_t stac92hd83xxx_pwr_nids[7] = {
  	0x0a, 0x0b, 0x0c, 0xd, 0x0e,
  	0x0f, 0x10
d0513fc6c   Matthew Ranostay   ALSA: hda: added ...
232
  };
2b63536f0   Takashi Iwai   ALSA: hda - Const...
233
  static const hda_nid_t stac92hd71bxx_pwr_nids[3] = {
a64135a2d   Matthew Ranostay   [ALSA] hda: 92HD7...
234
235
  	0x0a, 0x0d, 0x0f
  };
f3302a59c   Matt Porter   [ALSA] hda: sigma...
236

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
237
238
239
240
241
242
243
  /*
   * PCM hooks
   */
  static void stac_playback_pcm_hook(struct hda_pcm_stream *hinfo,
  				   struct hda_codec *codec,
  				   struct snd_pcm_substream *substream,
  				   int action)
8b65727bf   Matt Porter   [ALSA] hda: add d...
244
  {
8b65727bf   Matt Porter   [ALSA] hda: add d...
245
  	struct sigmatel_spec *spec = codec->spec;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
246
247
  	if (action == HDA_GEN_PCM_ACT_OPEN && spec->stream_delay)
  		msleep(spec->stream_delay);
8b65727bf   Matt Porter   [ALSA] hda: add d...
248
  }
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
249
250
251
252
  static void stac_capture_pcm_hook(struct hda_pcm_stream *hinfo,
  				  struct hda_codec *codec,
  				  struct snd_pcm_substream *substream,
  				  int action)
8b65727bf   Matt Porter   [ALSA] hda: add d...
253
  {
8b65727bf   Matt Porter   [ALSA] hda: add d...
254
  	struct sigmatel_spec *spec = codec->spec;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
255
  	int i, idx = 0;
8b65727bf   Matt Porter   [ALSA] hda: add d...
256

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
257
258
  	if (!spec->powerdown_adcs)
  		return;
8b65727bf   Matt Porter   [ALSA] hda: add d...
259

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
260
261
262
263
264
265
  	for (i = 0; i < spec->gen.num_all_adcs; i++) {
  		if (spec->gen.all_adcs[i] == hinfo->nid) {
  			idx = i;
  			break;
  		}
  	}
8b65727bf   Matt Porter   [ALSA] hda: add d...
266

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
267
268
269
270
271
272
273
274
275
276
277
278
279
  	switch (action) {
  	case HDA_GEN_PCM_ACT_OPEN:
  		msleep(40);
  		snd_hda_codec_write(codec, hinfo->nid, 0,
  				    AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
  		spec->active_adcs |= (1 << idx);
  		break;
  	case HDA_GEN_PCM_ACT_CLOSE:
  		snd_hda_codec_write(codec, hinfo->nid, 0,
  				    AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
  		spec->active_adcs &= ~(1 << idx);
  		break;
  	}
8b65727bf   Matt Porter   [ALSA] hda: add d...
280
  }
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
281
282
283
284
  /*
   * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a
   * funky external mute control using GPIO pins.
   */
d9737751e   Matthew Ranostay   ALSA: hda: SPDIF ...
285

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
286
287
  static void stac_gpio_set(struct hda_codec *codec, unsigned int mask,
  			  unsigned int dir_mask, unsigned int data)
d9737751e   Matthew Ranostay   ALSA: hda: SPDIF ...
288
  {
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
289
  	unsigned int gpiostate, gpiomask, gpiodir;
d9737751e   Matthew Ranostay   ALSA: hda: SPDIF ...
290

4e76a8833   Takashi Iwai   ALSA: hda - Repla...
291
292
  	codec_dbg(codec, "%s msk %x dir %x gpio %x
  ", __func__, mask, dir_mask, data);
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
  
  	gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
  				       AC_VERB_GET_GPIO_DATA, 0);
  	gpiostate = (gpiostate & ~dir_mask) | (data & dir_mask);
  
  	gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
  				      AC_VERB_GET_GPIO_MASK, 0);
  	gpiomask |= mask;
  
  	gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
  				     AC_VERB_GET_GPIO_DIRECTION, 0);
  	gpiodir |= dir_mask;
  
  	/* Configure GPIOx as CMOS */
  	snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0);
  
  	snd_hda_codec_write(codec, codec->afg, 0,
  			    AC_VERB_SET_GPIO_MASK, gpiomask);
  	snd_hda_codec_read(codec, codec->afg, 0,
  			   AC_VERB_SET_GPIO_DIRECTION, gpiodir); /* sync */
  
  	msleep(1);
  
  	snd_hda_codec_read(codec, codec->afg, 0,
  			   AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */
d9737751e   Matthew Ranostay   ALSA: hda: SPDIF ...
318
  }
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
319
  /* hook for controlling mic-mute LED GPIO */
a90229e05   Takashi Iwai   ALSA: hda - Conso...
320
  static void stac_capture_led_hook(struct hda_codec *codec,
7fe307117   Takashi Iwai   ALSA: hda - Fix i...
321
322
  				  struct snd_kcontrol *kcontrol,
  				  struct snd_ctl_elem_value *ucontrol)
d9737751e   Matthew Ranostay   ALSA: hda: SPDIF ...
323
  {
d9737751e   Matthew Ranostay   ALSA: hda: SPDIF ...
324
  	struct sigmatel_spec *spec = codec->spec;
7fe307117   Takashi Iwai   ALSA: hda - Fix i...
325
326
  	unsigned int mask;
  	bool cur_mute, prev_mute;
00ef50c24   Matthew Ranostay   ALSA: hda: SPDIF ...
327

7fe307117   Takashi Iwai   ALSA: hda - Fix i...
328
  	if (!kcontrol || !ucontrol)
a90229e05   Takashi Iwai   ALSA: hda - Conso...
329
  		return;
7fe307117   Takashi Iwai   ALSA: hda - Fix i...
330
331
332
333
334
335
336
337
338
339
  	mask = 1U << snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
  	prev_mute = !spec->mic_enabled;
  	if (ucontrol->value.integer.value[0] ||
  	    ucontrol->value.integer.value[1])
  		spec->mic_enabled |= mask;
  	else
  		spec->mic_enabled &= ~mask;
  	cur_mute = !spec->mic_enabled;
  	if (cur_mute != prev_mute) {
  		if (cur_mute)
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
340
  			spec->gpio_data |= spec->mic_mute_led_gpio;
00ef50c24   Matthew Ranostay   ALSA: hda: SPDIF ...
341
  		else
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
342
343
344
  			spec->gpio_data &= ~spec->mic_mute_led_gpio;
  		stac_gpio_set(codec, spec->gpio_mask,
  			      spec->gpio_dir, spec->gpio_data);
00ef50c24   Matthew Ranostay   ALSA: hda: SPDIF ...
345
  	}
d9737751e   Matthew Ranostay   ALSA: hda: SPDIF ...
346
  }
45eebda7b   Vitaliy Kulikov   ALSA: hda - Add s...
347
348
349
350
  static int stac_vrefout_set(struct hda_codec *codec,
  					hda_nid_t nid, unsigned int new_vref)
  {
  	int error, pinctl;
4e76a8833   Takashi Iwai   ALSA: hda - Repla...
351
352
  	codec_dbg(codec, "%s, nid %x ctl %x
  ", __func__, nid, new_vref);
45eebda7b   Vitaliy Kulikov   ALSA: hda - Add s...
353
354
355
356
357
358
359
360
361
  	pinctl = snd_hda_codec_read(codec, nid, 0,
  				AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
  
  	if (pinctl < 0)
  		return pinctl;
  
  	pinctl &= 0xff;
  	pinctl &= ~AC_PINCTL_VREFEN;
  	pinctl |= (new_vref & AC_PINCTL_VREFEN);
cdd03cedc   Takashi Iwai   ALSA: hda - Intro...
362
  	error = snd_hda_set_pin_ctl_cache(codec, nid, pinctl);
45eebda7b   Vitaliy Kulikov   ALSA: hda - Add s...
363
364
365
366
367
  	if (error < 0)
  		return error;
  
  	return 1;
  }
dfc6e469b   Takashi Iwai   ALSA: hda - Apply...
368
369
370
371
372
373
374
375
376
377
  /* prevent codec AFG to D3 state when vref-out pin is used for mute LED */
  /* this hook is set in stac_setup_gpio() */
  static unsigned int stac_vref_led_power_filter(struct hda_codec *codec,
  					       hda_nid_t nid,
  					       unsigned int power_state)
  {
  	if (nid == codec->afg && power_state == AC_PWRST_D3)
  		return AC_PWRST_D1;
  	return snd_hda_gen_path_power_filter(codec, nid, power_state);
  }
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
378
379
  /* update mute-LED accoring to the master switch */
  static void stac_update_led_status(struct hda_codec *codec, int enabled)
2f2f4251c   Matt   [ALSA] add sigmat...
380
  {
2f2f4251c   Matt   [ALSA] add sigmat...
381
  	struct sigmatel_spec *spec = codec->spec;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
382
  	int muted = !enabled;
2f2f4251c   Matt   [ALSA] add sigmat...
383

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
384
385
  	if (!spec->gpio_led)
  		return;
2f2f4251c   Matt   [ALSA] add sigmat...
386

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
387
388
389
  	/* LED state is inverted on these systems */
  	if (spec->gpio_led_polarity)
  		muted = !muted;
2f2f4251c   Matt   [ALSA] add sigmat...
390

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
391
392
393
394
395
396
397
  	if (!spec->vref_mute_led_nid) {
  		if (muted)
  			spec->gpio_data |= spec->gpio_led;
  		else
  			spec->gpio_data &= ~spec->gpio_led;
  		stac_gpio_set(codec, spec->gpio_mask,
  				spec->gpio_dir, spec->gpio_data);
5207e10ed   Takashi Iwai   ALSA: hda - Integ...
398
  	} else {
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
399
400
401
  		spec->vref_led = muted ? AC_PINCTL_VREF_50 : AC_PINCTL_VREF_GRD;
  		stac_vrefout_set(codec,	spec->vref_mute_led_nid,
  				 spec->vref_led);
5207e10ed   Takashi Iwai   ALSA: hda - Integ...
402
  	}
2f2f4251c   Matt   [ALSA] add sigmat...
403
  }
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
404
405
  /* vmaster hook to update mute LED */
  static void stac_vmaster_hook(void *private_data, int val)
b22b48214   Matthew Ranostay   [ALSA] hda: Mono ...
406
  {
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
407
  	stac_update_led_status(private_data, val);
b22b48214   Matthew Ranostay   [ALSA] hda: Mono ...
408
  }
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
409
410
  /* automute hook to handle GPIO mute and EAPD updates */
  static void stac_update_outputs(struct hda_codec *codec)
b22b48214   Matthew Ranostay   [ALSA] hda: Mono ...
411
  {
b22b48214   Matthew Ranostay   [ALSA] hda: Mono ...
412
  	struct sigmatel_spec *spec = codec->spec;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
413
414
415
416
  	if (spec->gpio_mute)
  		spec->gen.master_mute =
  			!(snd_hda_codec_read(codec, codec->afg, 0,
  				AC_VERB_GET_GPIO_DATA, 0) & spec->gpio_mute);
b22b48214   Matthew Ranostay   [ALSA] hda: Mono ...
417

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
418
  	snd_hda_gen_update_outputs(codec);
b22b48214   Matthew Ranostay   [ALSA] hda: Mono ...
419

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
420
421
422
423
424
425
  	if (spec->eapd_mask && spec->eapd_switch) {
  		unsigned int val = spec->gpio_data;
  		if (spec->gen.speaker_muted)
  			val &= ~spec->eapd_mask;
  		else
  			val |= spec->eapd_mask;
1ea9a69d1   Takashi Iwai   ALSA: hda - Fix E...
426
427
  		if (spec->gpio_data != val) {
  			spec->gpio_data = val;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
428
429
  			stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir,
  				      val);
1ea9a69d1   Takashi Iwai   ALSA: hda - Fix E...
430
  		}
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
431
  	}
b22b48214   Matthew Ranostay   [ALSA] hda: Mono ...
432
  }
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
433
434
  static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid,
  				  bool enable, bool do_write)
5f10c4a9a   Maxim Levitsky   [ALSA] hda-codec ...
435
  {
5f10c4a9a   Maxim Levitsky   [ALSA] hda-codec ...
436
  	struct sigmatel_spec *spec = codec->spec;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
437
  	unsigned int idx, val;
5f10c4a9a   Maxim Levitsky   [ALSA] hda-codec ...
438

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
  	for (idx = 0; idx < spec->num_pwrs; idx++) {
  		if (spec->pwr_nids[idx] == nid)
  			break;
  	}
  	if (idx >= spec->num_pwrs)
  		return;
  
  	idx = 1 << idx;
  
  	val = spec->power_map_bits;
  	if (enable)
  		val &= ~idx;
  	else
  		val |= idx;
  
  	/* power down unused output ports */
  	if (val != spec->power_map_bits) {
  		spec->power_map_bits = val;
  		if (do_write)
  			snd_hda_codec_write(codec, codec->afg, 0,
  					    AC_VERB_IDT_SET_POWER_MAP, val);
  	}
  }
  
  /* update power bit per jack plug/unplug */
  static void jack_update_power(struct hda_codec *codec,
1a4f69d5a   Takashi Iwai   ALSA: hda - Allow...
465
  			      struct hda_jack_callback *jack)
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
466
467
468
469
470
471
  {
  	struct sigmatel_spec *spec = codec->spec;
  	int i;
  
  	if (!spec->num_pwrs)
  		return;
1a4f69d5a   Takashi Iwai   ALSA: hda - Allow...
472
473
474
  	if (jack && jack->tbl->nid) {
  		stac_toggle_power_map(codec, jack->tbl->nid,
  				      snd_hda_jack_detect(codec, jack->tbl->nid),
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
475
476
477
478
479
480
481
  				      true);
  		return;
  	}
  
  	/* update all jacks */
  	for (i = 0; i < spec->num_pwrs; i++) {
  		hda_nid_t nid = spec->pwr_nids[i];
1a4f69d5a   Takashi Iwai   ALSA: hda - Allow...
482
  		if (!snd_hda_jack_tbl_get(codec, nid))
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
483
  			continue;
62f949bf6   Takashi Iwai   ALSA: hda - Get r...
484
485
486
  		stac_toggle_power_map(codec, nid,
  				      snd_hda_jack_detect(codec, nid),
  				      false);
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
487
488
489
490
491
  	}
  
  	snd_hda_codec_write(codec, codec->afg, 0, AC_VERB_IDT_SET_POWER_MAP,
  			    spec->power_map_bits);
  }
1a4f69d5a   Takashi Iwai   ALSA: hda - Allow...
492
493
  static void stac_vref_event(struct hda_codec *codec,
  			    struct hda_jack_callback *event)
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
  {
  	unsigned int data;
  
  	data = snd_hda_codec_read(codec, codec->afg, 0,
  				  AC_VERB_GET_GPIO_DATA, 0);
  	/* toggle VREF state based on GPIOx status */
  	snd_hda_codec_write(codec, codec->afg, 0, 0x7e0,
  			    !!(data & (1 << event->private_data)));
  }
  
  /* initialize the power map and enable the power event to jacks that
   * haven't been assigned to automute
   */
  static void stac_init_power_map(struct hda_codec *codec)
  {
  	struct sigmatel_spec *spec = codec->spec;
  	int i;
  
  	for (i = 0; i < spec->num_pwrs; i++)  {
  		hda_nid_t nid = spec->pwr_nids[i];
  		unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid);
  		def_conf = get_defcfg_connect(def_conf);
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
516
  		if (def_conf == AC_JACK_PORT_COMPLEX &&
7a9744cb4   Takashi Iwai   ALSA: hda - Fix i...
517
518
  		    spec->vref_mute_led_nid != nid &&
  		    is_jack_detectable(codec, nid)) {
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
519
  			snd_hda_jack_detect_enable_callback(codec, nid,
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
  							    jack_update_power);
  		} else {
  			if (def_conf == AC_JACK_PORT_NONE)
  				stac_toggle_power_map(codec, nid, false, false);
  			else
  				stac_toggle_power_map(codec, nid, true, false);
  		}
  	}
  }
  
  /*
   */
  
  static inline bool get_int_hint(struct hda_codec *codec, const char *key,
  				int *valp)
  {
  	return !snd_hda_get_int_hint(codec, key, valp);
  }
  
  /* override some hints from the hwdep entry */
  static void stac_store_hints(struct hda_codec *codec)
  {
  	struct sigmatel_spec *spec = codec->spec;
  	int val;
  
  	if (get_int_hint(codec, "gpio_mask", &spec->gpio_mask)) {
  		spec->eapd_mask = spec->gpio_dir = spec->gpio_data =
  			spec->gpio_mask;
  	}
  	if (get_int_hint(codec, "gpio_dir", &spec->gpio_dir))
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
550
  		spec->gpio_dir &= spec->gpio_mask;
c507de88f   Takashi Iwai   ALSA: hda - Fix w...
551
552
  	if (get_int_hint(codec, "gpio_data", &spec->gpio_data))
  		spec->gpio_data &= spec->gpio_mask;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
  	if (get_int_hint(codec, "eapd_mask", &spec->eapd_mask))
  		spec->eapd_mask &= spec->gpio_mask;
  	if (get_int_hint(codec, "gpio_mute", &spec->gpio_mute))
  		spec->gpio_mute &= spec->gpio_mask;
  	val = snd_hda_get_bool_hint(codec, "eapd_switch");
  	if (val >= 0)
  		spec->eapd_switch = val;
  }
  
  /*
   * loopback controls
   */
  
  #define stac_aloopback_info snd_ctl_boolean_mono_info
  
  static int stac_aloopback_get(struct snd_kcontrol *kcontrol,
  			      struct snd_ctl_elem_value *ucontrol)
  {
  	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  	unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
  	struct sigmatel_spec *spec = codec->spec;
  
  	ucontrol->value.integer.value[0] = !!(spec->aloopback &
  					      (spec->aloopback_mask << idx));
  	return 0;
5f10c4a9a   Maxim Levitsky   [ALSA] hda-codec ...
578
  }
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
579
580
  static int stac_aloopback_put(struct snd_kcontrol *kcontrol,
  			      struct snd_ctl_elem_value *ucontrol)
5f10c4a9a   Maxim Levitsky   [ALSA] hda-codec ...
581
582
583
  {
  	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  	struct sigmatel_spec *spec = codec->spec;
e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
584
  	unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
5f10c4a9a   Maxim Levitsky   [ALSA] hda-codec ...
585
  	unsigned int dac_mode;
e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
586
  	unsigned int val, idx_val;
5f10c4a9a   Maxim Levitsky   [ALSA] hda-codec ...
587

e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
588
589
590
591
592
  	idx_val = spec->aloopback_mask << idx;
  	if (ucontrol->value.integer.value[0])
  		val = spec->aloopback | idx_val;
  	else
  		val = spec->aloopback & ~idx_val;
68ea7b2f2   Takashi Iwai   [ALSA] hda-codec ...
593
  	if (spec->aloopback == val)
5f10c4a9a   Maxim Levitsky   [ALSA] hda-codec ...
594
  		return 0;
68ea7b2f2   Takashi Iwai   [ALSA] hda-codec ...
595
  	spec->aloopback = val;
5f10c4a9a   Maxim Levitsky   [ALSA] hda-codec ...
596

e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
597
598
599
  	/* Only return the bits defined by the shift value of the
  	 * first two bytes of the mask
  	 */
5f10c4a9a   Maxim Levitsky   [ALSA] hda-codec ...
600
  	dac_mode = snd_hda_codec_read(codec, codec->afg, 0,
e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
601
602
  				      kcontrol->private_value & 0xFFFF, 0x0);
  	dac_mode >>= spec->aloopback_shift;
5f10c4a9a   Maxim Levitsky   [ALSA] hda-codec ...
603

e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
604
  	if (spec->aloopback & idx_val) {
5f10c4a9a   Maxim Levitsky   [ALSA] hda-codec ...
605
  		snd_hda_power_up(codec);
e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
606
  		dac_mode |= idx_val;
5f10c4a9a   Maxim Levitsky   [ALSA] hda-codec ...
607
608
  	} else {
  		snd_hda_power_down(codec);
e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
609
  		dac_mode &= ~idx_val;
5f10c4a9a   Maxim Levitsky   [ALSA] hda-codec ...
610
611
612
613
614
615
616
  	}
  
  	snd_hda_codec_write_cache(codec, codec->afg, 0,
  		kcontrol->private_value >> 16, dac_mode);
  
  	return 1;
  }
e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
617
  #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \
5f10c4a9a   Maxim Levitsky   [ALSA] hda-codec ...
618
619
620
  	{ \
  		.iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
  		.name  = "Analog Loopback", \
e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
621
  		.count = cnt, \
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
622
623
624
  		.info  = stac_aloopback_info, \
  		.get   = stac_aloopback_get, \
  		.put   = stac_aloopback_put, \
5f10c4a9a   Maxim Levitsky   [ALSA] hda-codec ...
625
626
  		.private_value = verb_read | (verb_write << 16), \
  	}
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
627
628
629
  /*
   * Mute LED handling on HP laptops
   */
2fc998907   Nickolas Lloyd   ALSA: hda - add c...
630

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
631
632
633
634
635
636
  /* check whether it's a HP laptop with a docking port */
  static bool hp_bnb2011_with_dock(struct hda_codec *codec)
  {
  	if (codec->vendor_id != 0x111d7605 &&
  	    codec->vendor_id != 0x111d76d1)
  		return false;
2f2f4251c   Matt   [ALSA] add sigmat...
637

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
638
639
640
641
642
643
644
645
646
  	switch (codec->subsystem_id) {
  	case 0x103c1618:
  	case 0x103c1619:
  	case 0x103c161a:
  	case 0x103c161b:
  	case 0x103c161c:
  	case 0x103c161d:
  	case 0x103c161e:
  	case 0x103c161f:
d78d7a90a   Takashi Iwai   ALSA: hda - Creat...
647

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
648
649
  	case 0x103c162a:
  	case 0x103c162b:
e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
650

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
651
652
  	case 0x103c1630:
  	case 0x103c1631:
d78d7a90a   Takashi Iwai   ALSA: hda - Creat...
653

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
654
655
656
  	case 0x103c1633:
  	case 0x103c1634:
  	case 0x103c1635:
d0513fc6c   Matthew Ranostay   ALSA: hda: added ...
657

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
658
659
660
661
  	case 0x103c3587:
  	case 0x103c3588:
  	case 0x103c3589:
  	case 0x103c358a:
541eee876   Matthew Ranostay   [ALSA] hda: Added...
662

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
663
664
665
  	case 0x103c3667:
  	case 0x103c3668:
  	case 0x103c3669:
2f2f4251c   Matt   [ALSA] add sigmat...
666

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
667
668
669
670
  		return true;
  	}
  	return false;
  }
1697055e6   Takashi Iwai   [ALSA] hda-codec ...
671

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
  static bool hp_blike_system(u32 subsystem_id)
  {
  	switch (subsystem_id) {
  	case 0x103c1520:
  	case 0x103c1521:
  	case 0x103c1523:
  	case 0x103c1524:
  	case 0x103c1525:
  	case 0x103c1722:
  	case 0x103c1723:
  	case 0x103c1724:
  	case 0x103c1725:
  	case 0x103c1726:
  	case 0x103c1727:
  	case 0x103c1728:
  	case 0x103c1729:
  	case 0x103c172a:
  	case 0x103c172b:
  	case 0x103c307e:
  	case 0x103c307f:
  	case 0x103c3080:
  	case 0x103c3081:
  	case 0x103c7007:
  	case 0x103c7008:
  		return true;
  	}
  	return false;
  }
d9737751e   Matthew Ranostay   ALSA: hda: SPDIF ...
700

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
701
702
703
704
  static void set_hp_led_gpio(struct hda_codec *codec)
  {
  	struct sigmatel_spec *spec = codec->spec;
  	unsigned int gpio;
2134ea4f3   Takashi Iwai   [ALSA] hda-codec ...
705

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
706
707
  	if (spec->gpio_led)
  		return;
2faa3bf15   Takashi Iwai   ALSA: hda - Rewri...
708

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
709
710
711
712
713
714
  	gpio = snd_hda_param_read(codec, codec->afg, AC_PAR_GPIO_CAP);
  	gpio &= AC_GPIO_IO_COUNT;
  	if (gpio > 3)
  		spec->gpio_led = 0x08; /* GPIO 3 */
  	else
  		spec->gpio_led = 0x01; /* GPIO 0 */
2faa3bf15   Takashi Iwai   ALSA: hda - Rewri...
715
  }
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
  /*
   * This method searches for the mute LED GPIO configuration
   * provided as OEM string in SMBIOS. The format of that string
   * is HP_Mute_LED_P_G or HP_Mute_LED_P
   * where P can be 0 or 1 and defines mute LED GPIO control state (low/high)
   * that corresponds to the NOT muted state of the master volume
   * and G is the index of the GPIO to use as the mute LED control (0..9)
   * If _G portion is missing it is assigned based on the codec ID
   *
   * So, HP B-series like systems may have HP_Mute_LED_0 (current models)
   * or  HP_Mute_LED_0_3 (future models) OEM SMBIOS strings
   *
   *
   * The dv-series laptops don't seem to have the HP_Mute_LED* strings in
   * SMBIOS - at least the ones I have seen do not have them - which include
   * my own system (HP Pavilion dv6-1110ax) and my cousin's
   * HP Pavilion dv9500t CTO.
   * Need more information on whether it is true across the entire series.
   * -- kunal
   */
  static int find_mute_led_cfg(struct hda_codec *codec, int default_polarity)
2f2f4251c   Matt   [ALSA] add sigmat...
737
738
  {
  	struct sigmatel_spec *spec = codec->spec;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
739
  	const struct dmi_device *dev = NULL;
2f2f4251c   Matt   [ALSA] add sigmat...
740

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
741
742
743
744
  	if (get_int_hint(codec, "gpio_led", &spec->gpio_led)) {
  		get_int_hint(codec, "gpio_led_polarity",
  			     &spec->gpio_led_polarity);
  		return 1;
6479c6318   Takashi Iwai   ALSA: hda - Creat...
745
  	}
c7d4b2fa3   Matt   [ALSA] hda-codec ...
746

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
747
  	while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
e7fc49606   Toralf Förster   ALSA: hda - fix f...
748
  		if (sscanf(dev->name, "HP_Mute_LED_%u_%x",
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
749
750
751
752
753
754
755
756
757
758
759
760
  			   &spec->gpio_led_polarity,
  			   &spec->gpio_led) == 2) {
  			unsigned int max_gpio;
  			max_gpio = snd_hda_param_read(codec, codec->afg,
  						      AC_PAR_GPIO_CAP);
  			max_gpio &= AC_GPIO_IO_COUNT;
  			if (spec->gpio_led < max_gpio)
  				spec->gpio_led = 1 << spec->gpio_led;
  			else
  				spec->vref_mute_led_nid = spec->gpio_led;
  			return 1;
  		}
e7fc49606   Toralf Förster   ALSA: hda - fix f...
761
  		if (sscanf(dev->name, "HP_Mute_LED_%u",
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
762
763
764
765
766
767
768
769
770
771
772
773
  			   &spec->gpio_led_polarity) == 1) {
  			set_hp_led_gpio(codec);
  			return 1;
  		}
  		/* BIOS bug: unfilled OEM string */
  		if (strstr(dev->name, "HP_Mute_LED_P_G")) {
  			set_hp_led_gpio(codec);
  			if (default_polarity >= 0)
  				spec->gpio_led_polarity = default_polarity;
  			else
  				spec->gpio_led_polarity = 1;
  			return 1;
00ef50c24   Matthew Ranostay   ALSA: hda: SPDIF ...
774
  		}
d9737751e   Matthew Ranostay   ALSA: hda: SPDIF ...
775
  	}
c7d4b2fa3   Matt   [ALSA] hda-codec ...
776

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
777
778
779
780
781
782
783
784
785
786
  	/*
  	 * Fallback case - if we don't find the DMI strings,
  	 * we statically set the GPIO - if not a B-series system
  	 * and default polarity is provided
  	 */
  	if (!hp_blike_system(codec->subsystem_id) &&
  	    (default_polarity == 0 || default_polarity == 1)) {
  		set_hp_led_gpio(codec);
  		spec->gpio_led_polarity = default_polarity;
  		return 1;
dabbed6f7   Matt   [ALSA] SigmaTel H...
787
  	}
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
788
789
  	return 0;
  }
2134ea4f3   Takashi Iwai   [ALSA] hda-codec ...
790

303985f81   David Henningsson   ALSA: hda - Disab...
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
  /* check whether a built-in speaker is included in parsed pins */
  static bool has_builtin_speaker(struct hda_codec *codec)
  {
  	struct sigmatel_spec *spec = codec->spec;
  	hda_nid_t *nid_pin;
  	int nids, i;
  
  	if (spec->gen.autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) {
  		nid_pin = spec->gen.autocfg.line_out_pins;
  		nids = spec->gen.autocfg.line_outs;
  	} else {
  		nid_pin = spec->gen.autocfg.speaker_pins;
  		nids = spec->gen.autocfg.speaker_outs;
  	}
  
  	for (i = 0; i < nids; i++) {
  		unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid_pin[i]);
  		if (snd_hda_get_input_pin_attr(def_conf) == INPUT_PIN_ATTR_INT)
  			return true;
  	}
  	return false;
  }
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
813
814
815
  /*
   * PC beep controls
   */
2faa3bf15   Takashi Iwai   ALSA: hda - Rewri...
816

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
817
818
819
820
821
822
823
824
825
826
827
828
829
  /* create PC beep volume controls */
  static int stac_auto_create_beep_ctls(struct hda_codec *codec,
  						hda_nid_t nid)
  {
  	struct sigmatel_spec *spec = codec->spec;
  	u32 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
  	struct snd_kcontrol_new *knew;
  	static struct snd_kcontrol_new abeep_mute_ctl =
  		HDA_CODEC_MUTE(NULL, 0, 0, 0);
  	static struct snd_kcontrol_new dbeep_mute_ctl =
  		HDA_CODEC_MUTE_BEEP(NULL, 0, 0, 0);
  	static struct snd_kcontrol_new beep_vol_ctl =
  		HDA_CODEC_VOLUME(NULL, 0, 0, 0);
2faa3bf15   Takashi Iwai   ALSA: hda - Rewri...
830

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
831
832
833
834
835
836
837
838
839
840
841
842
843
  	/* check for mute support for the the amp */
  	if ((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT) {
  		const struct snd_kcontrol_new *temp;
  		if (spec->anabeep_nid == nid)
  			temp = &abeep_mute_ctl;
  		else
  			temp = &dbeep_mute_ctl;
  		knew = snd_hda_gen_add_kctl(&spec->gen,
  					    "Beep Playback Switch", temp);
  		if (!knew)
  			return -ENOMEM;
  		knew->private_value =
  			HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT);
2134ea4f3   Takashi Iwai   [ALSA] hda-codec ...
844
  	}
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
845
846
847
848
849
850
851
852
853
  	/* check to see if there is volume support for the amp */
  	if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) {
  		knew = snd_hda_gen_add_kctl(&spec->gen,
  					    "Beep Playback Volume",
  					    &beep_vol_ctl);
  		if (!knew)
  			return -ENOMEM;
  		knew->private_value =
  			HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT);
d78d7a90a   Takashi Iwai   ALSA: hda - Creat...
854
  	}
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
855
856
  	return 0;
  }
d78d7a90a   Takashi Iwai   ALSA: hda - Creat...
857

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
858
859
  #ifdef CONFIG_SND_HDA_INPUT_BEEP
  #define stac_dig_beep_switch_info snd_ctl_boolean_mono_info
e4973e1e5   Takashi Iwai   ALSA: hda - Creat...
860

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
861
862
863
864
865
866
867
  static int stac_dig_beep_switch_get(struct snd_kcontrol *kcontrol,
  				    struct snd_ctl_elem_value *ucontrol)
  {
  	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  	ucontrol->value.integer.value[0] = codec->beep->enabled;
  	return 0;
  }
e4973e1e5   Takashi Iwai   ALSA: hda - Creat...
868

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
869
870
871
872
873
  static int stac_dig_beep_switch_put(struct snd_kcontrol *kcontrol,
  				    struct snd_ctl_elem_value *ucontrol)
  {
  	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  	return snd_hda_enable_beep_device(codec, ucontrol->value.integer.value[0]);
2f2f4251c   Matt   [ALSA] add sigmat...
874
  }
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
875
876
877
878
879
880
  static const struct snd_kcontrol_new stac_dig_beep_ctrl = {
  	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  	.name = "Beep Playback Switch",
  	.info = stac_dig_beep_switch_info,
  	.get = stac_dig_beep_switch_get,
  	.put = stac_dig_beep_switch_put,
2f2f4251c   Matt   [ALSA] add sigmat...
881
  };
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
882
883
884
885
886
887
888
889
890
891
892
  static int stac_beep_switch_ctl(struct hda_codec *codec)
  {
  	struct sigmatel_spec *spec = codec->spec;
  
  	if (!snd_hda_gen_add_kctl(&spec->gen, NULL, &stac_dig_beep_ctrl))
  		return -ENOMEM;
  	return 0;
  }
  #endif
  
  /*
42875479b   Takashi Iwai   ALSA: hda - Reviv...
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
   * SPDIF-out mux controls
   */
  
  static int stac_smux_enum_info(struct snd_kcontrol *kcontrol,
  			       struct snd_ctl_elem_info *uinfo)
  {
  	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  	struct sigmatel_spec *spec = codec->spec;
  	return snd_hda_input_mux_info(&spec->spdif_mux, uinfo);
  }
  
  static int stac_smux_enum_get(struct snd_kcontrol *kcontrol,
  			      struct snd_ctl_elem_value *ucontrol)
  {
  	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  	struct sigmatel_spec *spec = codec->spec;
  	unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
  
  	ucontrol->value.enumerated.item[0] = spec->cur_smux[smux_idx];
  	return 0;
  }
  
  static int stac_smux_enum_put(struct snd_kcontrol *kcontrol,
  			      struct snd_ctl_elem_value *ucontrol)
  {
  	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  	struct sigmatel_spec *spec = codec->spec;
  	unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
  
  	return snd_hda_input_mux_put(codec, &spec->spdif_mux, ucontrol,
  				     spec->gen.autocfg.dig_out_pins[smux_idx],
  				     &spec->cur_smux[smux_idx]);
  }
  
  static struct snd_kcontrol_new stac_smux_mixer = {
  	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  	.name = "IEC958 Playback Source",
  	/* count set later */
  	.info = stac_smux_enum_info,
  	.get = stac_smux_enum_get,
  	.put = stac_smux_enum_put,
  };
  
  static const char * const stac_spdif_labels[] = {
  	"Digital Playback", "Analog Mux 1", "Analog Mux 2", NULL
  };
  
  static int stac_create_spdif_mux_ctls(struct hda_codec *codec)
  {
  	struct sigmatel_spec *spec = codec->spec;
  	struct auto_pin_cfg *cfg = &spec->gen.autocfg;
  	const char * const *labels = spec->spdif_labels;
  	struct snd_kcontrol_new *kctl;
  	int i, num_cons;
  
  	if (cfg->dig_outs < 1)
  		return 0;
  
  	num_cons = snd_hda_get_num_conns(codec, cfg->dig_out_pins[0]);
  	if (num_cons <= 1)
  		return 0;
  
  	if (!labels)
  		labels = stac_spdif_labels;
  	for (i = 0; i < num_cons; i++) {
  		if (snd_BUG_ON(!labels[i]))
  			return -EINVAL;
6194b99de   Takashi Iwai   ALSA: hda - Kill ...
960
  		snd_hda_add_imux_item(codec, &spec->spdif_mux, labels[i], i, NULL);
42875479b   Takashi Iwai   ALSA: hda - Reviv...
961
962
963
964
965
966
967
968
969
970
971
  	}
  
  	kctl = snd_hda_gen_add_kctl(&spec->gen, NULL, &stac_smux_mixer);
  	if (!kctl)
  		return -ENOMEM;
  	kctl->count = cfg->dig_outs;
  
  	return 0;
  }
  
  /*
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
972
973
974
975
976
   */
  
  static const struct hda_verb stac9200_core_init[] = {
  	/* set dac0mux for dac converter */
  	{ 0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
d39a3ae82   Takashi Iwai   ALSA: hda - Use s...
977
  	{}
58eec4235   Mauro Carvalho Chehab   ALSA: hda - More ...
978
  };
d39a3ae82   Takashi Iwai   ALSA: hda - Use s...
979

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
980
981
982
983
  static const struct hda_verb stac9200_eapd_init[] = {
  	/* set dac0mux for dac converter */
  	{0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
  	{0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
d39a3ae82   Takashi Iwai   ALSA: hda - Use s...
984
  	{}
58eec4235   Mauro Carvalho Chehab   ALSA: hda - More ...
985
  };
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
986
987
988
989
  static const struct hda_verb dell_eq_core_init[] = {
  	/* set master volume to max value without distortion
  	 * and direct control */
  	{ 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec},
d39a3ae82   Takashi Iwai   ALSA: hda - Use s...
990
  	{}
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
991
  };
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
992
993
994
  static const struct hda_verb stac92hd73xx_core_init[] = {
  	/* set master volume and direct control */
  	{ 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
d39a3ae82   Takashi Iwai   ALSA: hda - Use s...
995
  	{}
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
996
  };
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
  static const struct hda_verb stac92hd83xxx_core_init[] = {
  	/* power state controls amps */
  	{ 0x01, AC_VERB_SET_EAPD, 1 << 2},
  	{}
  };
  
  static const struct hda_verb stac92hd83xxx_hp_zephyr_init[] = {
  	{ 0x22, 0x785, 0x43 },
  	{ 0x22, 0x782, 0xe0 },
  	{ 0x22, 0x795, 0x00 },
  	{}
  };
  
  static const struct hda_verb stac92hd71bxx_core_init[] = {
  	/* set master volume and direct control */
  	{ 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
  	{}
  };
  
  static const struct hda_verb stac92hd71bxx_unmute_core_init[] = {
  	/* unmute right and left channels for nodes 0x0f, 0xa, 0x0d */
  	{ 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  	{ 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  	{ 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
  	{}
  };
  
  static const struct hda_verb stac925x_core_init[] = {
  	/* set dac0mux for dac converter */
  	{ 0x06, AC_VERB_SET_CONNECT_SEL, 0x00},
  	/* mute the master volume */
  	{ 0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
  	{}
  };
  
  static const struct hda_verb stac922x_core_init[] = {
  	/* set master volume and direct control */
  	{ 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
  	{}
  };
  
  static const struct hda_verb d965_core_init[] = {
  	/* unmute node 0x1b */
  	{ 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
  	/* select node 0x03 as DAC */
  	{ 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
  	{}
  };
  
  static const struct hda_verb dell_3st_core_init[] = {
  	/* don't set delta bit */
  	{0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f},
  	/* unmute node 0x1b */
  	{0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
  	/* select node 0x03 as DAC */
  	{0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
  	{}
  };
  
  static const struct hda_verb stac927x_core_init[] = {
  	/* set master volume and direct control */
  	{ 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
  	/* enable analog pc beep path */
  	{ 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
  	{}
  };
  
  static const struct hda_verb stac927x_volknob_core_init[] = {
  	/* don't set delta bit */
  	{0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f},
  	/* enable analog pc beep path */
  	{0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
  	{}
  };
  
  static const struct hda_verb stac9205_core_init[] = {
  	/* set master volume and direct control */
  	{ 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
  	/* enable analog pc beep path */
  	{ 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
  	{}
  };
  
  static const struct snd_kcontrol_new stac92hd73xx_6ch_loopback =
  	STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3);
  
  static const struct snd_kcontrol_new stac92hd73xx_8ch_loopback =
  	STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4);
  
  static const struct snd_kcontrol_new stac92hd73xx_10ch_loopback =
  	STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5);
  
  static const struct snd_kcontrol_new stac92hd71bxx_loopback =
  	STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2);
  
  static const struct snd_kcontrol_new stac9205_loopback =
  	STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1);
  
  static const struct snd_kcontrol_new stac927x_loopback =
  	STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1);
  
  static const struct hda_pintbl ref9200_pin_configs[] = {
  	{ 0x08, 0x01c47010 },
  	{ 0x09, 0x01447010 },
  	{ 0x0d, 0x0221401f },
  	{ 0x0e, 0x01114010 },
  	{ 0x0f, 0x02a19020 },
  	{ 0x10, 0x01a19021 },
  	{ 0x11, 0x90100140 },
  	{ 0x12, 0x01813122 },
  	{}
  };
  
  static const struct hda_pintbl gateway9200_m4_pin_configs[] = {
  	{ 0x08, 0x400000fe },
  	{ 0x09, 0x404500f4 },
  	{ 0x0d, 0x400100f0 },
  	{ 0x0e, 0x90110010 },
  	{ 0x0f, 0x400100f1 },
  	{ 0x10, 0x02a1902e },
  	{ 0x11, 0x500000f2 },
  	{ 0x12, 0x500000f3 },
  	{}
  };
  
  static const struct hda_pintbl gateway9200_m4_2_pin_configs[] = {
  	{ 0x08, 0x400000fe },
  	{ 0x09, 0x404500f4 },
  	{ 0x0d, 0x400100f0 },
  	{ 0x0e, 0x90110010 },
  	{ 0x0f, 0x400100f1 },
  	{ 0x10, 0x02a1902e },
  	{ 0x11, 0x500000f2 },
  	{ 0x12, 0x500000f3 },
  	{}
  };
  
  /*
      STAC 9200 pin configs for
      102801A8
      102801DE
      102801E8
  */
  static const struct hda_pintbl dell9200_d21_pin_configs[] = {
  	{ 0x08, 0x400001f0 },
  	{ 0x09, 0x400001f1 },
  	{ 0x0d, 0x02214030 },
  	{ 0x0e, 0x01014010 },
  	{ 0x0f, 0x02a19020 },
  	{ 0x10, 0x01a19021 },
  	{ 0x11, 0x90100140 },
  	{ 0x12, 0x01813122 },
  	{}
  };
  
  /*
      STAC 9200 pin configs for
      102801C0
      102801C1
  */
  static const struct hda_pintbl dell9200_d22_pin_configs[] = {
  	{ 0x08, 0x400001f0 },
  	{ 0x09, 0x400001f1 },
  	{ 0x0d, 0x0221401f },
  	{ 0x0e, 0x01014010 },
  	{ 0x0f, 0x01813020 },
  	{ 0x10, 0x02a19021 },
  	{ 0x11, 0x90100140 },
  	{ 0x12, 0x400001f2 },
  	{}
  };
  
  /*
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
1170
1171
1172
1173
1174
1175
1176
1177
      STAC 9200 pin configs for
      102801C4 (Dell Dimension E310)
      102801C5
      102801C7
      102801D9
      102801DA
      102801E3
  */
d39a3ae82   Takashi Iwai   ALSA: hda - Use s...
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
  static const struct hda_pintbl dell9200_d23_pin_configs[] = {
  	{ 0x08, 0x400001f0 },
  	{ 0x09, 0x400001f1 },
  	{ 0x0d, 0x0221401f },
  	{ 0x0e, 0x01014010 },
  	{ 0x0f, 0x01813020 },
  	{ 0x10, 0x01a19021 },
  	{ 0x11, 0x90100140 },
  	{ 0x12, 0x400001f2 },
  	{}
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
1188
1189
1190
1191
1192
1193
1194
1195
  };
  
  
  /* 
      STAC 9200-32 pin configs for
      102801B5 (Dell Inspiron 630m)
      102801D8 (Dell Inspiron 640m)
  */
d39a3ae82   Takashi Iwai   ALSA: hda - Use s...
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
  static const struct hda_pintbl dell9200_m21_pin_configs[] = {
  	{ 0x08, 0x40c003fa },
  	{ 0x09, 0x03441340 },
  	{ 0x0d, 0x0321121f },
  	{ 0x0e, 0x90170310 },
  	{ 0x0f, 0x408003fb },
  	{ 0x10, 0x03a11020 },
  	{ 0x11, 0x401003fc },
  	{ 0x12, 0x403003fd },
  	{}
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
  };
  
  /* 
      STAC 9200-32 pin configs for
      102801C2 (Dell Latitude D620)
      102801C8 
      102801CC (Dell Latitude D820)
      102801D4 
      102801D6 
  */
d39a3ae82   Takashi Iwai   ALSA: hda - Use s...
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
  static const struct hda_pintbl dell9200_m22_pin_configs[] = {
  	{ 0x08, 0x40c003fa },
  	{ 0x09, 0x0144131f },
  	{ 0x0d, 0x0321121f },
  	{ 0x0e, 0x90170310 },
  	{ 0x0f, 0x90a70321 },
  	{ 0x10, 0x03a11020 },
  	{ 0x11, 0x401003fb },
  	{ 0x12, 0x40f000fc },
  	{}
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
1226
1227
1228
1229
1230
1231
1232
  };
  
  /* 
      STAC 9200-32 pin configs for
      102801CE (Dell XPS M1710)
      102801CF (Dell Precision M90)
  */
d39a3ae82   Takashi Iwai   ALSA: hda - Use s...
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
  static const struct hda_pintbl dell9200_m23_pin_configs[] = {
  	{ 0x08, 0x40c003fa },
  	{ 0x09, 0x01441340 },
  	{ 0x0d, 0x0421421f },
  	{ 0x0e, 0x90170310 },
  	{ 0x0f, 0x408003fb },
  	{ 0x10, 0x04a1102e },
  	{ 0x11, 0x90170311 },
  	{ 0x12, 0x403003fc },
  	{}
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
1243
1244
1245
1246
1247
1248
1249
1250
1251
  };
  
  /*
      STAC 9200-32 pin configs for 
      102801C9
      102801CA
      102801CB (Dell Latitude 120L)
      102801D3
  */
d39a3ae82   Takashi Iwai   ALSA: hda - Use s...
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
  static const struct hda_pintbl dell9200_m24_pin_configs[] = {
  	{ 0x08, 0x40c003fa },
  	{ 0x09, 0x404003fb },
  	{ 0x0d, 0x0321121f },
  	{ 0x0e, 0x90170310 },
  	{ 0x0f, 0x408003fc },
  	{ 0x10, 0x03a11020 },
  	{ 0x11, 0x401003fd },
  	{ 0x12, 0x403003fe },
  	{}
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
1262
1263
1264
1265
1266
1267
1268
1269
  };
  
  /*
      STAC 9200-32 pin configs for
      102801BD (Dell Inspiron E1505n)
      102801EE
      102801EF
  */
d39a3ae82   Takashi Iwai   ALSA: hda - Use s...
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
  static const struct hda_pintbl dell9200_m25_pin_configs[] = {
  	{ 0x08, 0x40c003fa },
  	{ 0x09, 0x01441340 },
  	{ 0x0d, 0x0421121f },
  	{ 0x0e, 0x90170310 },
  	{ 0x0f, 0x408003fb },
  	{ 0x10, 0x04a11020 },
  	{ 0x11, 0x401003fc },
  	{ 0x12, 0x403003fd },
  	{}
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
1280
1281
1282
1283
1284
1285
1286
  };
  
  /*
      STAC 9200-32 pin configs for
      102801F5 (Dell Inspiron 1501)
      102801F6
  */
d39a3ae82   Takashi Iwai   ALSA: hda - Use s...
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
  static const struct hda_pintbl dell9200_m26_pin_configs[] = {
  	{ 0x08, 0x40c003fa },
  	{ 0x09, 0x404003fb },
  	{ 0x0d, 0x0421121f },
  	{ 0x0e, 0x90170310 },
  	{ 0x0f, 0x408003fc },
  	{ 0x10, 0x04a11020 },
  	{ 0x11, 0x401003fd },
  	{ 0x12, 0x403003fe },
  	{}
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
1297
1298
1299
1300
1301
1302
  };
  
  /*
      STAC 9200-32
      102801CD (Dell Inspiron E1705/9400)
  */
d39a3ae82   Takashi Iwai   ALSA: hda - Use s...
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
  static const struct hda_pintbl dell9200_m27_pin_configs[] = {
  	{ 0x08, 0x40c003fa },
  	{ 0x09, 0x01441340 },
  	{ 0x0d, 0x0421121f },
  	{ 0x0e, 0x90170310 },
  	{ 0x0f, 0x90170310 },
  	{ 0x10, 0x04a11020 },
  	{ 0x11, 0x90170310 },
  	{ 0x12, 0x40f003fc },
  	{}
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
1313
  };
d39a3ae82   Takashi Iwai   ALSA: hda - Use s...
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
  static const struct hda_pintbl oqo9200_pin_configs[] = {
  	{ 0x08, 0x40c000f0 },
  	{ 0x09, 0x404000f1 },
  	{ 0x0d, 0x0221121f },
  	{ 0x0e, 0x02211210 },
  	{ 0x0f, 0x90170111 },
  	{ 0x10, 0x90a70120 },
  	{ 0x11, 0x400000f2 },
  	{ 0x12, 0x400000f3 },
  	{}
bf277785d   Tobin Davis   [ALSA] HDA - Add ...
1324
  };
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
1325

d39a3ae82   Takashi Iwai   ALSA: hda - Use s...
1326
1327
1328
1329
  static void stac9200_fixup_panasonic(struct hda_codec *codec,
  				     const struct hda_fixup *fix, int action)
  {
  	struct sigmatel_spec *spec = codec->spec;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
1330
  	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
d39a3ae82   Takashi Iwai   ALSA: hda - Use s...
1331
1332
  		spec->gpio_mask = spec->gpio_dir = 0x09;
  		spec->gpio_data = 0x00;
d39a3ae82   Takashi Iwai   ALSA: hda - Use s...
1333
1334
1335
  		/* CF-74 has no headphone detection, and the driver should *NOT*
  		 * do detection and HP/speaker toggle because the hardware does it.
  		 */
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
1336
  		spec->gen.suppress_auto_mute = 1;
d39a3ae82   Takashi Iwai   ALSA: hda - Use s...
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
  	}
  }
  
  
  static const struct hda_fixup stac9200_fixups[] = {
  	[STAC_REF] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = ref9200_pin_configs,
  	},
  	[STAC_9200_OQO] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = oqo9200_pin_configs,
  		.chained = true,
  		.chain_id = STAC_9200_EAPD_INIT,
  	},
  	[STAC_9200_DELL_D21] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = dell9200_d21_pin_configs,
  	},
  	[STAC_9200_DELL_D22] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = dell9200_d22_pin_configs,
  	},
  	[STAC_9200_DELL_D23] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = dell9200_d23_pin_configs,
  	},
  	[STAC_9200_DELL_M21] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = dell9200_m21_pin_configs,
  	},
  	[STAC_9200_DELL_M22] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = dell9200_m22_pin_configs,
  	},
  	[STAC_9200_DELL_M23] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = dell9200_m23_pin_configs,
  	},
  	[STAC_9200_DELL_M24] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = dell9200_m24_pin_configs,
  	},
  	[STAC_9200_DELL_M25] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = dell9200_m25_pin_configs,
  	},
  	[STAC_9200_DELL_M26] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = dell9200_m26_pin_configs,
  	},
  	[STAC_9200_DELL_M27] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = dell9200_m27_pin_configs,
  	},
  	[STAC_9200_M4] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = gateway9200_m4_pin_configs,
  		.chained = true,
  		.chain_id = STAC_9200_EAPD_INIT,
  	},
  	[STAC_9200_M4_2] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = gateway9200_m4_2_pin_configs,
  		.chained = true,
  		.chain_id = STAC_9200_EAPD_INIT,
  	},
  	[STAC_9200_PANASONIC] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac9200_fixup_panasonic,
  	},
  	[STAC_9200_EAPD_INIT] = {
  		.type = HDA_FIXUP_VERBS,
  		.v.verbs = (const struct hda_verb[]) {
  			{0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
  			{}
  		},
  	},
403d19446   Matt Porter   [ALSA] hda-codec ...
1415
  };
d39a3ae82   Takashi Iwai   ALSA: hda - Use s...
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
  static const struct hda_model_fixup stac9200_models[] = {
  	{ .id = STAC_REF, .name = "ref" },
  	{ .id = STAC_9200_OQO, .name = "oqo" },
  	{ .id = STAC_9200_DELL_D21, .name = "dell-d21" },
  	{ .id = STAC_9200_DELL_D22, .name = "dell-d22" },
  	{ .id = STAC_9200_DELL_D23, .name = "dell-d23" },
  	{ .id = STAC_9200_DELL_M21, .name = "dell-m21" },
  	{ .id = STAC_9200_DELL_M22, .name = "dell-m22" },
  	{ .id = STAC_9200_DELL_M23, .name = "dell-m23" },
  	{ .id = STAC_9200_DELL_M24, .name = "dell-m24" },
  	{ .id = STAC_9200_DELL_M25, .name = "dell-m25" },
  	{ .id = STAC_9200_DELL_M26, .name = "dell-m26" },
  	{ .id = STAC_9200_DELL_M27, .name = "dell-m27" },
  	{ .id = STAC_9200_M4, .name = "gateway-m4" },
  	{ .id = STAC_9200_M4_2, .name = "gateway-m4-2" },
  	{ .id = STAC_9200_PANASONIC, .name = "panasonic" },
  	{}
  };
  
  static const struct snd_pci_quirk stac9200_fixup_tbl[] = {
f5fcc13c2   Takashi Iwai   [ALSA] hda-codec ...
1436
1437
1438
  	/* SigmaTel reference board */
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
  		      "DFI LanParty", STAC_REF),
577aa2c19   Matthew Ranostay   ALSA: hda: add re...
1439
1440
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
  		      "DFI LanParty", STAC_REF),
e7377071c   Matt Porter   [ALSA] hda: fix s...
1441
  	/* Dell laptops have BIOS problem */
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
1442
1443
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8,
  		      "unknown Dell", STAC_9200_DELL_D21),
f5fcc13c2   Takashi Iwai   [ALSA] hda-codec ...
1444
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5,
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
1445
1446
1447
1448
1449
1450
1451
  		      "Dell Inspiron 630m", STAC_9200_DELL_M21),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bd,
  		      "Dell Inspiron E1505n", STAC_9200_DELL_M25),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c0,
  		      "unknown Dell", STAC_9200_DELL_D22),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c1,
  		      "unknown Dell", STAC_9200_DELL_D22),
f5fcc13c2   Takashi Iwai   [ALSA] hda-codec ...
1452
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2,
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
  		      "Dell Latitude D620", STAC_9200_DELL_M22),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c5,
  		      "unknown Dell", STAC_9200_DELL_D23),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c7,
  		      "unknown Dell", STAC_9200_DELL_D23),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c8,
  		      "unknown Dell", STAC_9200_DELL_M22),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c9,
  		      "unknown Dell", STAC_9200_DELL_M24),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ca,
  		      "unknown Dell", STAC_9200_DELL_M24),
f5fcc13c2   Takashi Iwai   [ALSA] hda-codec ...
1464
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb,
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
1465
  		      "Dell Latitude 120L", STAC_9200_DELL_M24),
877b866d8   Cory T. Tusar   [ALSA] hda-codec ...
1466
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc,
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
1467
  		      "Dell Latitude D820", STAC_9200_DELL_M22),
46f02ca36   Mikael Nilsson   [ALSA] hda-codec ...
1468
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cd,
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
1469
  		      "Dell Inspiron E1705/9400", STAC_9200_DELL_M27),
46f02ca36   Mikael Nilsson   [ALSA] hda-codec ...
1470
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce,
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
1471
  		      "Dell XPS M1710", STAC_9200_DELL_M23),
f0f967458   Takashi Iwai   [ALSA] hda-codec ...
1472
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf,
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
1473
1474
1475
1476
1477
  		      "Dell Precision M90", STAC_9200_DELL_M23),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d3,
  		      "unknown Dell", STAC_9200_DELL_M22),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d4,
  		      "unknown Dell", STAC_9200_DELL_M22),
8286c53e5   Daniel T Chen   [ALSA] Include qu...
1478
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6,
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
1479
  		      "unknown Dell", STAC_9200_DELL_M22),
49c605db8   Tobin Davis   [ALSA] HDA: Add m...
1480
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8,
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
  		      "Dell Inspiron 640m", STAC_9200_DELL_M21),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d9,
  		      "unknown Dell", STAC_9200_DELL_D23),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01da,
  		      "unknown Dell", STAC_9200_DELL_D23),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01de,
  		      "unknown Dell", STAC_9200_DELL_D21),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e3,
  		      "unknown Dell", STAC_9200_DELL_D23),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e8,
  		      "unknown Dell", STAC_9200_DELL_D21),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ee,
  		      "unknown Dell", STAC_9200_DELL_M25),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ef,
  		      "unknown Dell", STAC_9200_DELL_M25),
49c605db8   Tobin Davis   [ALSA] HDA: Add m...
1496
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5,
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
1497
1498
1499
  		      "Dell Inspiron 1501", STAC_9200_DELL_M26),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6,
  		      "unknown Dell", STAC_9200_DELL_M26),
49c605db8   Tobin Davis   [ALSA] HDA: Add m...
1500
  	/* Panasonic */
117f257d7   Takashi Iwai   [ALSA] hda-codec ...
1501
  	SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC),
1194b5b70   Takashi Iwai   [ALSA] hda-codec ...
1502
  	/* Gateway machines needs EAPD to be set on resume */
58eec4235   Mauro Carvalho Chehab   ALSA: hda - More ...
1503
1504
1505
  	SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_M4),
  	SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", STAC_9200_M4_2),
  	SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", STAC_9200_M4_2),
bf277785d   Tobin Davis   [ALSA] HDA - Add ...
1506
1507
  	/* OQO Mobile */
  	SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO),
403d19446   Matt Porter   [ALSA] hda-codec ...
1508
1509
  	{} /* terminator */
  };
d2077d40c   Takashi Iwai   ALSA: hda - Use s...
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
  static const struct hda_pintbl ref925x_pin_configs[] = {
  	{ 0x07, 0x40c003f0 },
  	{ 0x08, 0x424503f2 },
  	{ 0x0a, 0x01813022 },
  	{ 0x0b, 0x02a19021 },
  	{ 0x0c, 0x90a70320 },
  	{ 0x0d, 0x02214210 },
  	{ 0x10, 0x01019020 },
  	{ 0x11, 0x9033032e },
  	{}
8e21c34cd   Tobin Davis   [ALSA] hda-codec ...
1520
  };
d2077d40c   Takashi Iwai   ALSA: hda - Use s...
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
  static const struct hda_pintbl stac925xM1_pin_configs[] = {
  	{ 0x07, 0x40c003f4 },
  	{ 0x08, 0x424503f2 },
  	{ 0x0a, 0x400000f3 },
  	{ 0x0b, 0x02a19020 },
  	{ 0x0c, 0x40a000f0 },
  	{ 0x0d, 0x90100210 },
  	{ 0x10, 0x400003f1 },
  	{ 0x11, 0x9033032e },
  	{}
8e21c34cd   Tobin Davis   [ALSA] hda-codec ...
1531
  };
d2077d40c   Takashi Iwai   ALSA: hda - Use s...
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
  static const struct hda_pintbl stac925xM1_2_pin_configs[] = {
  	{ 0x07, 0x40c003f4 },
  	{ 0x08, 0x424503f2 },
  	{ 0x0a, 0x400000f3 },
  	{ 0x0b, 0x02a19020 },
  	{ 0x0c, 0x40a000f0 },
  	{ 0x0d, 0x90100210 },
  	{ 0x10, 0x400003f1 },
  	{ 0x11, 0x9033032e },
  	{}
9cb36c2af   Mauro Carvalho Chehab   ALSA: patch_sigma...
1542
  };
58eec4235   Mauro Carvalho Chehab   ALSA: hda - More ...
1543

d2077d40c   Takashi Iwai   ALSA: hda - Use s...
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
  static const struct hda_pintbl stac925xM2_pin_configs[] = {
  	{ 0x07, 0x40c003f4 },
  	{ 0x08, 0x424503f2 },
  	{ 0x0a, 0x400000f3 },
  	{ 0x0b, 0x02a19020 },
  	{ 0x0c, 0x40a000f0 },
  	{ 0x0d, 0x90100210 },
  	{ 0x10, 0x400003f1 },
  	{ 0x11, 0x9033032e },
  	{}
2c11f955b   Tobin Davis   [ALSA] HDA: Add s...
1554
  };
d2077d40c   Takashi Iwai   ALSA: hda - Use s...
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
  static const struct hda_pintbl stac925xM2_2_pin_configs[] = {
  	{ 0x07, 0x40c003f4 },
  	{ 0x08, 0x424503f2 },
  	{ 0x0a, 0x400000f3 },
  	{ 0x0b, 0x02a19020 },
  	{ 0x0c, 0x40a000f0 },
  	{ 0x0d, 0x90100210 },
  	{ 0x10, 0x400003f1 },
  	{ 0x11, 0x9033032e },
  	{}
58eec4235   Mauro Carvalho Chehab   ALSA: hda - More ...
1565
  };
d2077d40c   Takashi Iwai   ALSA: hda - Use s...
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
  static const struct hda_pintbl stac925xM3_pin_configs[] = {
  	{ 0x07, 0x40c003f4 },
  	{ 0x08, 0x424503f2 },
  	{ 0x0a, 0x400000f3 },
  	{ 0x0b, 0x02a19020 },
  	{ 0x0c, 0x40a000f0 },
  	{ 0x0d, 0x90100210 },
  	{ 0x10, 0x400003f1 },
  	{ 0x11, 0x503303f3 },
  	{}
9cb36c2af   Mauro Carvalho Chehab   ALSA: patch_sigma...
1576
  };
58eec4235   Mauro Carvalho Chehab   ALSA: hda - More ...
1577

d2077d40c   Takashi Iwai   ALSA: hda - Use s...
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
  static const struct hda_pintbl stac925xM5_pin_configs[] = {
  	{ 0x07, 0x40c003f4 },
  	{ 0x08, 0x424503f2 },
  	{ 0x0a, 0x400000f3 },
  	{ 0x0b, 0x02a19020 },
  	{ 0x0c, 0x40a000f0 },
  	{ 0x0d, 0x90100210 },
  	{ 0x10, 0x400003f1 },
  	{ 0x11, 0x9033032e },
  	{}
9cb36c2af   Mauro Carvalho Chehab   ALSA: patch_sigma...
1588
  };
d2077d40c   Takashi Iwai   ALSA: hda - Use s...
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
  static const struct hda_pintbl stac925xM6_pin_configs[] = {
  	{ 0x07, 0x40c003f4 },
  	{ 0x08, 0x424503f2 },
  	{ 0x0a, 0x400000f3 },
  	{ 0x0b, 0x02a19020 },
  	{ 0x0c, 0x40a000f0 },
  	{ 0x0d, 0x90100210 },
  	{ 0x10, 0x400003f1 },
  	{ 0x11, 0x90330320 },
  	{}
8e21c34cd   Tobin Davis   [ALSA] hda-codec ...
1599
  };
d2077d40c   Takashi Iwai   ALSA: hda - Use s...
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
  static const struct hda_fixup stac925x_fixups[] = {
  	[STAC_REF] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = ref925x_pin_configs,
  	},
  	[STAC_M1] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = stac925xM1_pin_configs,
  	},
  	[STAC_M1_2] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = stac925xM1_2_pin_configs,
  	},
  	[STAC_M2] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = stac925xM2_pin_configs,
  	},
  	[STAC_M2_2] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = stac925xM2_2_pin_configs,
  	},
  	[STAC_M3] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = stac925xM3_pin_configs,
  	},
  	[STAC_M5] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = stac925xM5_pin_configs,
  	},
  	[STAC_M6] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = stac925xM6_pin_configs,
  	},
8e21c34cd   Tobin Davis   [ALSA] hda-codec ...
1633
  };
d2077d40c   Takashi Iwai   ALSA: hda - Use s...
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
  static const struct hda_model_fixup stac925x_models[] = {
  	{ .id = STAC_REF, .name = "ref" },
  	{ .id = STAC_M1, .name = "m1" },
  	{ .id = STAC_M1_2, .name = "m1-2" },
  	{ .id = STAC_M2, .name = "m2" },
  	{ .id = STAC_M2_2, .name = "m2-2" },
  	{ .id = STAC_M3, .name = "m3" },
  	{ .id = STAC_M5, .name = "m5" },
  	{ .id = STAC_M6, .name = "m6" },
  	{}
8e21c34cd   Tobin Davis   [ALSA] hda-codec ...
1644
  };
d2077d40c   Takashi Iwai   ALSA: hda - Use s...
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
  static const struct snd_pci_quirk stac925x_fixup_tbl[] = {
  	/* SigmaTel reference board */
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, "DFI LanParty", STAC_REF),
  	SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF),
  
  	/* Default table for unknown ID */
  	SND_PCI_QUIRK(0x1002, 0x437b, "Gateway mobile", STAC_M2_2),
  
  	/* gateway machines are checked via codec ssid */
58eec4235   Mauro Carvalho Chehab   ALSA: hda - More ...
1655
1656
1657
1658
  	SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_M2),
  	SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_M5),
  	SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_M1),
  	SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_M2),
9cb36c2af   Mauro Carvalho Chehab   ALSA: patch_sigma...
1659
  	SND_PCI_QUIRK(0x107b, 0x0367, "Gateway MX6453", STAC_M1_2),
9cb36c2af   Mauro Carvalho Chehab   ALSA: patch_sigma...
1660
1661
1662
1663
1664
  	/* Not sure about the brand name for those */
  	SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M1),
  	SND_PCI_QUIRK(0x107b, 0x0507, "Gateway mobile", STAC_M3),
  	SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M6),
  	SND_PCI_QUIRK(0x107b, 0x0685, "Gateway mobile", STAC_M2_2),
9cb36c2af   Mauro Carvalho Chehab   ALSA: patch_sigma...
1665
  	{} /* terminator */
8e21c34cd   Tobin Davis   [ALSA] hda-codec ...
1666
  };
55e30141d   Takashi Iwai   ALSA: hda - Use s...
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
  static const struct hda_pintbl ref92hd73xx_pin_configs[] = {
  	{ 0x0a, 0x02214030 },
  	{ 0x0b, 0x02a19040 },
  	{ 0x0c, 0x01a19020 },
  	{ 0x0d, 0x02214030 },
  	{ 0x0e, 0x0181302e },
  	{ 0x0f, 0x01014010 },
  	{ 0x10, 0x01014020 },
  	{ 0x11, 0x01014030 },
  	{ 0x12, 0x02319040 },
  	{ 0x13, 0x90a000f0 },
  	{ 0x14, 0x90a000f0 },
  	{ 0x22, 0x01452050 },
  	{ 0x23, 0x01452050 },
  	{}
a76626401   Matthew Ranostay   [ALSA] hda: 92HDx...
1682
  };
55e30141d   Takashi Iwai   ALSA: hda - Use s...
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
  static const struct hda_pintbl dell_m6_pin_configs[] = {
  	{ 0x0a, 0x0321101f },
  	{ 0x0b, 0x4f00000f },
  	{ 0x0c, 0x4f0000f0 },
  	{ 0x0d, 0x90170110 },
  	{ 0x0e, 0x03a11020 },
  	{ 0x0f, 0x0321101f },
  	{ 0x10, 0x4f0000f0 },
  	{ 0x11, 0x4f0000f0 },
  	{ 0x12, 0x4f0000f0 },
  	{ 0x13, 0x90a60160 },
  	{ 0x14, 0x4f0000f0 },
  	{ 0x22, 0x4f0000f0 },
  	{ 0x23, 0x4f0000f0 },
  	{}
e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
1698
  };
55e30141d   Takashi Iwai   ALSA: hda - Use s...
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
  static const struct hda_pintbl alienware_m17x_pin_configs[] = {
  	{ 0x0a, 0x0321101f },
  	{ 0x0b, 0x0321101f },
  	{ 0x0c, 0x03a11020 },
  	{ 0x0d, 0x03014020 },
  	{ 0x0e, 0x90170110 },
  	{ 0x0f, 0x4f0000f0 },
  	{ 0x10, 0x4f0000f0 },
  	{ 0x11, 0x4f0000f0 },
  	{ 0x12, 0x4f0000f0 },
  	{ 0x13, 0x90a60160 },
  	{ 0x14, 0x4f0000f0 },
  	{ 0x22, 0x4f0000f0 },
  	{ 0x23, 0x904601b0 },
  	{}
842ae6380   Takashi Iwai   ALSA: hda - Add s...
1714
  };
55e30141d   Takashi Iwai   ALSA: hda - Use s...
1715
1716
1717
1718
1719
1720
1721
1722
1723
  static const struct hda_pintbl intel_dg45id_pin_configs[] = {
  	{ 0x0a, 0x02214230 },
  	{ 0x0b, 0x02A19240 },
  	{ 0x0c, 0x01013214 },
  	{ 0x0d, 0x01014210 },
  	{ 0x0e, 0x01A19250 },
  	{ 0x0f, 0x01011212 },
  	{ 0x10, 0x01016211 },
  	{}
52dc43860   Alexey Fisher   ALSA: hda - Overw...
1724
  };
1de7ca5e8   Hui Wang   ALSA: hda - Enabl...
1725
1726
1727
1728
1729
  static const struct hda_pintbl stac92hd89xx_hp_front_jack_pin_configs[] = {
  	{ 0x0a, 0x02214030 },
  	{ 0x0b, 0x02A19010 },
  	{}
  };
7440850c2   Hui Wang   ALSA: hda - fix a...
1730
1731
1732
1733
  static const struct hda_pintbl stac92hd89xx_hp_z1_g2_right_mic_jack_pin_configs[] = {
  	{ 0x0e, 0x400000f0 },
  	{}
  };
55e30141d   Takashi Iwai   ALSA: hda - Use s...
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
  static void stac92hd73xx_fixup_ref(struct hda_codec *codec,
  				   const struct hda_fixup *fix, int action)
  {
  	struct sigmatel_spec *spec = codec->spec;
  
  	if (action != HDA_FIXUP_ACT_PRE_PROBE)
  		return;
  
  	snd_hda_apply_pincfgs(codec, ref92hd73xx_pin_configs);
  	spec->gpio_mask = spec->gpio_dir = spec->gpio_data = 0;
  }
  
  static void stac92hd73xx_fixup_dell(struct hda_codec *codec)
  {
  	struct sigmatel_spec *spec = codec->spec;
  
  	snd_hda_apply_pincfgs(codec, dell_m6_pin_configs);
55e30141d   Takashi Iwai   ALSA: hda - Use s...
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
  	spec->eapd_switch = 0;
  }
  
  static void stac92hd73xx_fixup_dell_eq(struct hda_codec *codec,
  				       const struct hda_fixup *fix, int action)
  {
  	struct sigmatel_spec *spec = codec->spec;
  
  	if (action != HDA_FIXUP_ACT_PRE_PROBE)
  		return;
  
  	stac92hd73xx_fixup_dell(codec);
  	snd_hda_add_verbs(codec, dell_eq_core_init);
  	spec->volknob_init = 1;
  }
  
  /* Analog Mics */
  static void stac92hd73xx_fixup_dell_m6_amic(struct hda_codec *codec,
  				    const struct hda_fixup *fix, int action)
  {
55e30141d   Takashi Iwai   ALSA: hda - Use s...
1771
1772
1773
1774
1775
  	if (action != HDA_FIXUP_ACT_PRE_PROBE)
  		return;
  
  	stac92hd73xx_fixup_dell(codec);
  	snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170);
55e30141d   Takashi Iwai   ALSA: hda - Use s...
1776
1777
1778
1779
1780
1781
  }
  
  /* Digital Mics */
  static void stac92hd73xx_fixup_dell_m6_dmic(struct hda_codec *codec,
  				    const struct hda_fixup *fix, int action)
  {
55e30141d   Takashi Iwai   ALSA: hda - Use s...
1782
1783
1784
1785
1786
  	if (action != HDA_FIXUP_ACT_PRE_PROBE)
  		return;
  
  	stac92hd73xx_fixup_dell(codec);
  	snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160);
55e30141d   Takashi Iwai   ALSA: hda - Use s...
1787
1788
1789
1790
1791
1792
  }
  
  /* Both */
  static void stac92hd73xx_fixup_dell_m6_both(struct hda_codec *codec,
  				    const struct hda_fixup *fix, int action)
  {
55e30141d   Takashi Iwai   ALSA: hda - Use s...
1793
1794
1795
1796
1797
1798
  	if (action != HDA_FIXUP_ACT_PRE_PROBE)
  		return;
  
  	stac92hd73xx_fixup_dell(codec);
  	snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170);
  	snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160);
55e30141d   Takashi Iwai   ALSA: hda - Use s...
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
  }
  
  static void stac92hd73xx_fixup_alienware_m17x(struct hda_codec *codec,
  				    const struct hda_fixup *fix, int action)
  {
  	struct sigmatel_spec *spec = codec->spec;
  
  	if (action != HDA_FIXUP_ACT_PRE_PROBE)
  		return;
  
  	snd_hda_apply_pincfgs(codec, alienware_m17x_pin_configs);
55e30141d   Takashi Iwai   ALSA: hda - Use s...
1810
1811
1812
1813
1814
1815
  	spec->eapd_switch = 0;
  }
  
  static void stac92hd73xx_fixup_no_jd(struct hda_codec *codec,
  				     const struct hda_fixup *fix, int action)
  {
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
1816
1817
  	if (action == HDA_FIXUP_ACT_PRE_PROBE)
  		codec->no_jack_detect = 1;
55e30141d   Takashi Iwai   ALSA: hda - Use s...
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
  }
  
  static const struct hda_fixup stac92hd73xx_fixups[] = {
  	[STAC_92HD73XX_REF] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac92hd73xx_fixup_ref,
  	},
  	[STAC_DELL_M6_AMIC] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac92hd73xx_fixup_dell_m6_amic,
  	},
  	[STAC_DELL_M6_DMIC] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac92hd73xx_fixup_dell_m6_dmic,
  	},
  	[STAC_DELL_M6_BOTH] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac92hd73xx_fixup_dell_m6_both,
  	},
  	[STAC_DELL_EQ]	= {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac92hd73xx_fixup_dell_eq,
  	},
  	[STAC_ALIENWARE_M17X] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac92hd73xx_fixup_alienware_m17x,
  	},
  	[STAC_92HD73XX_INTEL] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = intel_dg45id_pin_configs,
  	},
  	[STAC_92HD73XX_NO_JD] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac92hd73xx_fixup_no_jd,
1de7ca5e8   Hui Wang   ALSA: hda - Enabl...
1852
1853
1854
1855
  	},
  	[STAC_92HD89XX_HP_FRONT_JACK] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = stac92hd89xx_hp_front_jack_pin_configs,
7440850c2   Hui Wang   ALSA: hda - fix a...
1856
1857
1858
1859
  	},
  	[STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = stac92hd89xx_hp_z1_g2_right_mic_jack_pin_configs,
55e30141d   Takashi Iwai   ALSA: hda - Use s...
1860
  	}
e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
1861
  };
55e30141d   Takashi Iwai   ALSA: hda - Use s...
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
  static const struct hda_model_fixup stac92hd73xx_models[] = {
  	{ .id = STAC_92HD73XX_NO_JD, .name = "no-jd" },
  	{ .id = STAC_92HD73XX_REF, .name = "ref" },
  	{ .id = STAC_92HD73XX_INTEL, .name = "intel" },
  	{ .id = STAC_DELL_M6_AMIC, .name = "dell-m6-amic" },
  	{ .id = STAC_DELL_M6_DMIC, .name = "dell-m6-dmic" },
  	{ .id = STAC_DELL_M6_BOTH, .name = "dell-m6" },
  	{ .id = STAC_DELL_EQ, .name = "dell-eq" },
  	{ .id = STAC_ALIENWARE_M17X, .name = "alienware" },
  	{}
e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
1872
  };
55e30141d   Takashi Iwai   ALSA: hda - Use s...
1873
  static const struct snd_pci_quirk stac92hd73xx_fixup_tbl[] = {
e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
1874
1875
  	/* SigmaTel reference board */
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
a76626401   Matthew Ranostay   [ALSA] hda: 92HDx...
1876
  				"DFI LanParty", STAC_92HD73XX_REF),
577aa2c19   Matthew Ranostay   ALSA: hda: add re...
1877
1878
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
  				"DFI LanParty", STAC_92HD73XX_REF),
ae709440e   Wu Fengguang   ALSA: hda: add mo...
1879
1880
1881
1882
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5002,
  				"Intel DG45ID", STAC_92HD73XX_INTEL),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5003,
  				"Intel DG45FC", STAC_92HD73XX_INTEL),
a76626401   Matthew Ranostay   [ALSA] hda: 92HDx...
1883
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254,
661cd8fb5   Takashi Iwai   ALSA: hda - Check...
1884
  				"Dell Studio 1535", STAC_DELL_M6_DMIC),
a76626401   Matthew Ranostay   [ALSA] hda: 92HDx...
1885
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255,
661cd8fb5   Takashi Iwai   ALSA: hda - Check...
1886
  				"unknown Dell", STAC_DELL_M6_DMIC),
a76626401   Matthew Ranostay   [ALSA] hda: 92HDx...
1887
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256,
661cd8fb5   Takashi Iwai   ALSA: hda - Check...
1888
  				"unknown Dell", STAC_DELL_M6_BOTH),
a76626401   Matthew Ranostay   [ALSA] hda: 92HDx...
1889
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257,
661cd8fb5   Takashi Iwai   ALSA: hda - Check...
1890
  				"unknown Dell", STAC_DELL_M6_BOTH),
a76626401   Matthew Ranostay   [ALSA] hda: 92HDx...
1891
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e,
661cd8fb5   Takashi Iwai   ALSA: hda - Check...
1892
  				"unknown Dell", STAC_DELL_M6_AMIC),
a76626401   Matthew Ranostay   [ALSA] hda: 92HDx...
1893
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f,
661cd8fb5   Takashi Iwai   ALSA: hda - Check...
1894
  				"unknown Dell", STAC_DELL_M6_AMIC),
a76626401   Matthew Ranostay   [ALSA] hda: 92HDx...
1895
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271,
661cd8fb5   Takashi Iwai   ALSA: hda - Check...
1896
1897
1898
  				"unknown Dell", STAC_DELL_M6_DMIC),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0272,
  				"unknown Dell", STAC_DELL_M6_DMIC),
b0fc5e043   Takashi Iwai   ALSA: hda - Add a...
1899
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x029f,
661cd8fb5   Takashi Iwai   ALSA: hda - Check...
1900
  				"Dell Studio 1537", STAC_DELL_M6_DMIC),
fa620e97f   Joerg Schirottke   ALSA: hda - Add q...
1901
1902
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a0,
  				"Dell Studio 17", STAC_DELL_M6_DMIC),
626f5cefc   Takashi Iwai   ALSA: hda - Add q...
1903
1904
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02be,
  				"Dell Studio 1555", STAC_DELL_M6_DMIC),
8ef5837a4   Daniel J Blueman   ALSA: hda - Dell ...
1905
1906
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02bd,
  				"Dell Studio 1557", STAC_DELL_M6_DMIC),
aac78daf8   Daniel T Chen   ALSA: hda: Use ST...
1907
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02fe,
ffe535edb   David Henningsson   ALSA: HDA: Fix in...
1908
  				"Dell Studio XPS 1645", STAC_DELL_M6_DMIC),
5c1bccf64   Daniel T Chen   ALSA: hda: Use ST...
1909
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0413,
e033ebfb3   David Henningsson   ALSA: HDA: Use on...
1910
  				"Dell Studio 1558", STAC_DELL_M6_DMIC),
55e30141d   Takashi Iwai   ALSA: hda - Use s...
1911
  	/* codec SSID matching */
842ae6380   Takashi Iwai   ALSA: hda - Add s...
1912
1913
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a1,
  		      "Alienware M17x", STAC_ALIENWARE_M17X),
0defe09ca   Daniel T Chen   ALSA: hda: Use "a...
1914
1915
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a,
  		      "Alienware M17x", STAC_ALIENWARE_M17X),
dbd1b5473   Takashi Iwai   ALSA: hda - Add p...
1916
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0490,
b9ecc4ee2   Albert Pool   snd-hda-intel: be...
1917
  		      "Alienware M17x R3", STAC_DELL_EQ),
7440850c2   Hui Wang   ALSA: hda - fix a...
1918
1919
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1927,
  				"HP Z1 G2", STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK),
1de7ca5e8   Hui Wang   ALSA: hda - Enabl...
1920
1921
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2b17,
  				"unknown HP", STAC_92HD89XX_HP_FRONT_JACK),
842ae6380   Takashi Iwai   ALSA: hda - Add s...
1922
1923
  	{} /* terminator */
  };
372f8c750   Takashi Iwai   ALSA: hda - Use s...
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
  static const struct hda_pintbl ref92hd83xxx_pin_configs[] = {
  	{ 0x0a, 0x02214030 },
  	{ 0x0b, 0x02211010 },
  	{ 0x0c, 0x02a19020 },
  	{ 0x0d, 0x02170130 },
  	{ 0x0e, 0x01014050 },
  	{ 0x0f, 0x01819040 },
  	{ 0x10, 0x01014020 },
  	{ 0x11, 0x90a3014e },
  	{ 0x1f, 0x01451160 },
  	{ 0x20, 0x98560170 },
  	{}
d0513fc6c   Matthew Ranostay   ALSA: hda: added ...
1936
  };
372f8c750   Takashi Iwai   ALSA: hda - Use s...
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
  static const struct hda_pintbl dell_s14_pin_configs[] = {
  	{ 0x0a, 0x0221403f },
  	{ 0x0b, 0x0221101f },
  	{ 0x0c, 0x02a19020 },
  	{ 0x0d, 0x90170110 },
  	{ 0x0e, 0x40f000f0 },
  	{ 0x0f, 0x40f000f0 },
  	{ 0x10, 0x40f000f0 },
  	{ 0x11, 0x90a60160 },
  	{ 0x1f, 0x40f000f0 },
  	{ 0x20, 0x40f000f0 },
  	{}
8bb0ac557   Matthew Ranostay   ALSA: hda: Add ST...
1949
  };
372f8c750   Takashi Iwai   ALSA: hda - Use s...
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
  static const struct hda_pintbl dell_vostro_3500_pin_configs[] = {
  	{ 0x0a, 0x02a11020 },
  	{ 0x0b, 0x0221101f },
  	{ 0x0c, 0x400000f0 },
  	{ 0x0d, 0x90170110 },
  	{ 0x0e, 0x400000f1 },
  	{ 0x0f, 0x400000f2 },
  	{ 0x10, 0x400000f3 },
  	{ 0x11, 0x90a60160 },
  	{ 0x1f, 0x400000f4 },
  	{ 0x20, 0x400000f5 },
  	{}
f7f9bdfad   Julian Wollrath   ALSA: hda - fix i...
1962
  };
372f8c750   Takashi Iwai   ALSA: hda - Use s...
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
  static const struct hda_pintbl hp_dv7_4000_pin_configs[] = {
  	{ 0x0a, 0x03a12050 },
  	{ 0x0b, 0x0321201f },
  	{ 0x0c, 0x40f000f0 },
  	{ 0x0d, 0x90170110 },
  	{ 0x0e, 0x40f000f0 },
  	{ 0x0f, 0x40f000f0 },
  	{ 0x10, 0x90170110 },
  	{ 0x11, 0xd5a30140 },
  	{ 0x1f, 0x40f000f0 },
  	{ 0x20, 0x40f000f0 },
  	{}
483155901   Steven Eastland   ALSA: hda - New s...
1975
  };
372f8c750   Takashi Iwai   ALSA: hda - Use s...
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
  static const struct hda_pintbl hp_zephyr_pin_configs[] = {
  	{ 0x0a, 0x01813050 },
  	{ 0x0b, 0x0421201f },
  	{ 0x0c, 0x04a1205e },
  	{ 0x0d, 0x96130310 },
  	{ 0x0e, 0x96130310 },
  	{ 0x0f, 0x0101401f },
  	{ 0x10, 0x1111611f },
  	{ 0x11, 0xd5a30130 },
  	{}
5556e1470   Vitaliy Kulikov   ALSA: hda - Fix a...
1986
  };
372f8c750   Takashi Iwai   ALSA: hda - Use s...
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
  static const struct hda_pintbl hp_cNB11_intquad_pin_configs[] = {
  	{ 0x0a, 0x40f000f0 },
  	{ 0x0b, 0x0221101f },
  	{ 0x0c, 0x02a11020 },
  	{ 0x0d, 0x92170110 },
  	{ 0x0e, 0x40f000f0 },
  	{ 0x0f, 0x92170110 },
  	{ 0x10, 0x40f000f0 },
  	{ 0x11, 0xd5a30130 },
  	{ 0x1f, 0x40f000f0 },
  	{ 0x20, 0x40f000f0 },
  	{}
0c27c1805   Vitaliy Kulikov   ALSA: hda - Add s...
1999
  };
372f8c750   Takashi Iwai   ALSA: hda - Use s...
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
  static void stac92hd83xxx_fixup_hp(struct hda_codec *codec,
  				   const struct hda_fixup *fix, int action)
  {
  	struct sigmatel_spec *spec = codec->spec;
  
  	if (action != HDA_FIXUP_ACT_PRE_PROBE)
  		return;
  
  	if (hp_bnb2011_with_dock(codec)) {
  		snd_hda_codec_set_pincfg(codec, 0xa, 0x2101201f);
  		snd_hda_codec_set_pincfg(codec, 0xf, 0x2181205e);
  	}
  
  	if (find_mute_led_cfg(codec, spec->default_polarity))
4e76a8833   Takashi Iwai   ALSA: hda - Repla...
2014
2015
  		codec_dbg(codec, "mute LED gpio %d polarity %d
  ",
372f8c750   Takashi Iwai   ALSA: hda - Use s...
2016
2017
  				spec->gpio_led,
  				spec->gpio_led_polarity);
e8b99a1dc   Takashi Iwai   ALSA: hda/sigmate...
2018
2019
2020
  
  	/* allow auto-switching of dock line-in */
  	spec->gen.line_in_auto_switch = true;
372f8c750   Takashi Iwai   ALSA: hda - Use s...
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
  }
  
  static void stac92hd83xxx_fixup_hp_zephyr(struct hda_codec *codec,
  				   const struct hda_fixup *fix, int action)
  {
  	if (action != HDA_FIXUP_ACT_PRE_PROBE)
  		return;
  
  	snd_hda_apply_pincfgs(codec, hp_zephyr_pin_configs);
  	snd_hda_add_verbs(codec, stac92hd83xxx_hp_zephyr_init);
  }
  
  static void stac92hd83xxx_fixup_hp_led(struct hda_codec *codec,
  				   const struct hda_fixup *fix, int action)
  {
  	struct sigmatel_spec *spec = codec->spec;
  
  	if (action == HDA_FIXUP_ACT_PRE_PROBE)
  		spec->default_polarity = 0;
  }
  
  static void stac92hd83xxx_fixup_hp_inv_led(struct hda_codec *codec,
  				   const struct hda_fixup *fix, int action)
  {
  	struct sigmatel_spec *spec = codec->spec;
  
  	if (action == HDA_FIXUP_ACT_PRE_PROBE)
  		spec->default_polarity = 1;
  }
  
  static void stac92hd83xxx_fixup_hp_mic_led(struct hda_codec *codec,
  				   const struct hda_fixup *fix, int action)
  {
  	struct sigmatel_spec *spec = codec->spec;
95f74c41b   Takashi Iwai   ALSA: hda - Fix m...
2055
  	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
372f8c750   Takashi Iwai   ALSA: hda - Use s...
2056
  		spec->mic_mute_led_gpio = 0x08; /* GPIO3 */
873ce8ad5   Takashi Iwai   ALSA: hda - Drop ...
2057
2058
  		/* resetting controller clears GPIO, so we need to keep on */
  		codec->bus->power_keep_link_on = 1;
95f74c41b   Takashi Iwai   ALSA: hda - Fix m...
2059
  	}
372f8c750   Takashi Iwai   ALSA: hda - Use s...
2060
  }
37c367ecd   Takashi Iwai   ALSA: hda - Add a...
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
  static void stac92hd83xxx_fixup_hp_led_gpio10(struct hda_codec *codec,
  				   const struct hda_fixup *fix, int action)
  {
  	struct sigmatel_spec *spec = codec->spec;
  
  	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  		spec->gpio_led = 0x10; /* GPIO4 */
  		spec->default_polarity = 0;
  	}
  }
372f8c750   Takashi Iwai   ALSA: hda - Use s...
2071
2072
2073
2074
2075
2076
2077
2078
  static void stac92hd83xxx_fixup_headset_jack(struct hda_codec *codec,
  				   const struct hda_fixup *fix, int action)
  {
  	struct sigmatel_spec *spec = codec->spec;
  
  	if (action == HDA_FIXUP_ACT_PRE_PROBE)
  		spec->headset_jack = 1;
  }
d009f3deb   Vitaliy Kulikov   ALSA: hda - load ...
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
  static const struct hda_verb hp_bnb13_eq_verbs[] = {
  	/* 44.1KHz base */
  	{ 0x22, 0x7A6, 0x3E },
  	{ 0x22, 0x7A7, 0x68 },
  	{ 0x22, 0x7A8, 0x17 },
  	{ 0x22, 0x7A9, 0x3E },
  	{ 0x22, 0x7AA, 0x68 },
  	{ 0x22, 0x7AB, 0x17 },
  	{ 0x22, 0x7AC, 0x00 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x83 },
  	{ 0x22, 0x7A7, 0x2F },
  	{ 0x22, 0x7A8, 0xD1 },
  	{ 0x22, 0x7A9, 0x83 },
  	{ 0x22, 0x7AA, 0x2F },
  	{ 0x22, 0x7AB, 0xD1 },
  	{ 0x22, 0x7AC, 0x01 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x3E },
  	{ 0x22, 0x7A7, 0x68 },
  	{ 0x22, 0x7A8, 0x17 },
  	{ 0x22, 0x7A9, 0x3E },
  	{ 0x22, 0x7AA, 0x68 },
  	{ 0x22, 0x7AB, 0x17 },
  	{ 0x22, 0x7AC, 0x02 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x7C },
  	{ 0x22, 0x7A7, 0xC6 },
  	{ 0x22, 0x7A8, 0x0C },
  	{ 0x22, 0x7A9, 0x7C },
  	{ 0x22, 0x7AA, 0xC6 },
  	{ 0x22, 0x7AB, 0x0C },
  	{ 0x22, 0x7AC, 0x03 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0xC3 },
  	{ 0x22, 0x7A7, 0x25 },
  	{ 0x22, 0x7A8, 0xAF },
  	{ 0x22, 0x7A9, 0xC3 },
  	{ 0x22, 0x7AA, 0x25 },
  	{ 0x22, 0x7AB, 0xAF },
  	{ 0x22, 0x7AC, 0x04 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x3E },
  	{ 0x22, 0x7A7, 0x85 },
  	{ 0x22, 0x7A8, 0x73 },
  	{ 0x22, 0x7A9, 0x3E },
  	{ 0x22, 0x7AA, 0x85 },
  	{ 0x22, 0x7AB, 0x73 },
  	{ 0x22, 0x7AC, 0x05 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x85 },
  	{ 0x22, 0x7A7, 0x39 },
  	{ 0x22, 0x7A8, 0xC7 },
  	{ 0x22, 0x7A9, 0x85 },
  	{ 0x22, 0x7AA, 0x39 },
  	{ 0x22, 0x7AB, 0xC7 },
  	{ 0x22, 0x7AC, 0x06 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x3C },
  	{ 0x22, 0x7A7, 0x90 },
  	{ 0x22, 0x7A8, 0xB0 },
  	{ 0x22, 0x7A9, 0x3C },
  	{ 0x22, 0x7AA, 0x90 },
  	{ 0x22, 0x7AB, 0xB0 },
  	{ 0x22, 0x7AC, 0x07 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x7A },
  	{ 0x22, 0x7A7, 0xC6 },
  	{ 0x22, 0x7A8, 0x39 },
  	{ 0x22, 0x7A9, 0x7A },
  	{ 0x22, 0x7AA, 0xC6 },
  	{ 0x22, 0x7AB, 0x39 },
  	{ 0x22, 0x7AC, 0x08 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0xC4 },
  	{ 0x22, 0x7A7, 0xE9 },
  	{ 0x22, 0x7A8, 0xDC },
  	{ 0x22, 0x7A9, 0xC4 },
  	{ 0x22, 0x7AA, 0xE9 },
  	{ 0x22, 0x7AB, 0xDC },
  	{ 0x22, 0x7AC, 0x09 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x3D },
  	{ 0x22, 0x7A7, 0xE1 },
  	{ 0x22, 0x7A8, 0x0D },
  	{ 0x22, 0x7A9, 0x3D },
  	{ 0x22, 0x7AA, 0xE1 },
  	{ 0x22, 0x7AB, 0x0D },
  	{ 0x22, 0x7AC, 0x0A },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x89 },
  	{ 0x22, 0x7A7, 0xB6 },
  	{ 0x22, 0x7A8, 0xEB },
  	{ 0x22, 0x7A9, 0x89 },
  	{ 0x22, 0x7AA, 0xB6 },
  	{ 0x22, 0x7AB, 0xEB },
  	{ 0x22, 0x7AC, 0x0B },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x39 },
  	{ 0x22, 0x7A7, 0x9D },
  	{ 0x22, 0x7A8, 0xFE },
  	{ 0x22, 0x7A9, 0x39 },
  	{ 0x22, 0x7AA, 0x9D },
  	{ 0x22, 0x7AB, 0xFE },
  	{ 0x22, 0x7AC, 0x0C },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x76 },
  	{ 0x22, 0x7A7, 0x49 },
  	{ 0x22, 0x7A8, 0x15 },
  	{ 0x22, 0x7A9, 0x76 },
  	{ 0x22, 0x7AA, 0x49 },
  	{ 0x22, 0x7AB, 0x15 },
  	{ 0x22, 0x7AC, 0x0D },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0xC8 },
  	{ 0x22, 0x7A7, 0x80 },
  	{ 0x22, 0x7A8, 0xF5 },
  	{ 0x22, 0x7A9, 0xC8 },
  	{ 0x22, 0x7AA, 0x80 },
  	{ 0x22, 0x7AB, 0xF5 },
  	{ 0x22, 0x7AC, 0x0E },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x40 },
  	{ 0x22, 0x7A7, 0x00 },
  	{ 0x22, 0x7A8, 0x00 },
  	{ 0x22, 0x7A9, 0x40 },
  	{ 0x22, 0x7AA, 0x00 },
  	{ 0x22, 0x7AB, 0x00 },
  	{ 0x22, 0x7AC, 0x0F },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x90 },
  	{ 0x22, 0x7A7, 0x68 },
  	{ 0x22, 0x7A8, 0xF1 },
  	{ 0x22, 0x7A9, 0x90 },
  	{ 0x22, 0x7AA, 0x68 },
  	{ 0x22, 0x7AB, 0xF1 },
  	{ 0x22, 0x7AC, 0x10 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x34 },
  	{ 0x22, 0x7A7, 0x47 },
  	{ 0x22, 0x7A8, 0x6C },
  	{ 0x22, 0x7A9, 0x34 },
  	{ 0x22, 0x7AA, 0x47 },
  	{ 0x22, 0x7AB, 0x6C },
  	{ 0x22, 0x7AC, 0x11 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x6F },
  	{ 0x22, 0x7A7, 0x97 },
  	{ 0x22, 0x7A8, 0x0F },
  	{ 0x22, 0x7A9, 0x6F },
  	{ 0x22, 0x7AA, 0x97 },
  	{ 0x22, 0x7AB, 0x0F },
  	{ 0x22, 0x7AC, 0x12 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0xCB },
  	{ 0x22, 0x7A7, 0xB8 },
  	{ 0x22, 0x7A8, 0x94 },
  	{ 0x22, 0x7A9, 0xCB },
  	{ 0x22, 0x7AA, 0xB8 },
  	{ 0x22, 0x7AB, 0x94 },
  	{ 0x22, 0x7AC, 0x13 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x40 },
  	{ 0x22, 0x7A7, 0x00 },
  	{ 0x22, 0x7A8, 0x00 },
  	{ 0x22, 0x7A9, 0x40 },
  	{ 0x22, 0x7AA, 0x00 },
  	{ 0x22, 0x7AB, 0x00 },
  	{ 0x22, 0x7AC, 0x14 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x95 },
  	{ 0x22, 0x7A7, 0x76 },
  	{ 0x22, 0x7A8, 0x5B },
  	{ 0x22, 0x7A9, 0x95 },
  	{ 0x22, 0x7AA, 0x76 },
  	{ 0x22, 0x7AB, 0x5B },
  	{ 0x22, 0x7AC, 0x15 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x31 },
  	{ 0x22, 0x7A7, 0xAC },
  	{ 0x22, 0x7A8, 0x31 },
  	{ 0x22, 0x7A9, 0x31 },
  	{ 0x22, 0x7AA, 0xAC },
  	{ 0x22, 0x7AB, 0x31 },
  	{ 0x22, 0x7AC, 0x16 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x6A },
  	{ 0x22, 0x7A7, 0x89 },
  	{ 0x22, 0x7A8, 0xA5 },
  	{ 0x22, 0x7A9, 0x6A },
  	{ 0x22, 0x7AA, 0x89 },
  	{ 0x22, 0x7AB, 0xA5 },
  	{ 0x22, 0x7AC, 0x17 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0xCE },
  	{ 0x22, 0x7A7, 0x53 },
  	{ 0x22, 0x7A8, 0xCF },
  	{ 0x22, 0x7A9, 0xCE },
  	{ 0x22, 0x7AA, 0x53 },
  	{ 0x22, 0x7AB, 0xCF },
  	{ 0x22, 0x7AC, 0x18 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x40 },
  	{ 0x22, 0x7A7, 0x00 },
  	{ 0x22, 0x7A8, 0x00 },
  	{ 0x22, 0x7A9, 0x40 },
  	{ 0x22, 0x7AA, 0x00 },
  	{ 0x22, 0x7AB, 0x00 },
  	{ 0x22, 0x7AC, 0x19 },
  	{ 0x22, 0x7AD, 0x80 },
  	/* 48KHz base */
  	{ 0x22, 0x7A6, 0x3E },
  	{ 0x22, 0x7A7, 0x88 },
  	{ 0x22, 0x7A8, 0xDC },
  	{ 0x22, 0x7A9, 0x3E },
  	{ 0x22, 0x7AA, 0x88 },
  	{ 0x22, 0x7AB, 0xDC },
  	{ 0x22, 0x7AC, 0x1A },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x82 },
  	{ 0x22, 0x7A7, 0xEE },
  	{ 0x22, 0x7A8, 0x46 },
  	{ 0x22, 0x7A9, 0x82 },
  	{ 0x22, 0x7AA, 0xEE },
  	{ 0x22, 0x7AB, 0x46 },
  	{ 0x22, 0x7AC, 0x1B },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x3E },
  	{ 0x22, 0x7A7, 0x88 },
  	{ 0x22, 0x7A8, 0xDC },
  	{ 0x22, 0x7A9, 0x3E },
  	{ 0x22, 0x7AA, 0x88 },
  	{ 0x22, 0x7AB, 0xDC },
  	{ 0x22, 0x7AC, 0x1C },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x7D },
  	{ 0x22, 0x7A7, 0x09 },
  	{ 0x22, 0x7A8, 0x28 },
  	{ 0x22, 0x7A9, 0x7D },
  	{ 0x22, 0x7AA, 0x09 },
  	{ 0x22, 0x7AB, 0x28 },
  	{ 0x22, 0x7AC, 0x1D },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0xC2 },
  	{ 0x22, 0x7A7, 0xE5 },
  	{ 0x22, 0x7A8, 0xB4 },
  	{ 0x22, 0x7A9, 0xC2 },
  	{ 0x22, 0x7AA, 0xE5 },
  	{ 0x22, 0x7AB, 0xB4 },
  	{ 0x22, 0x7AC, 0x1E },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x3E },
  	{ 0x22, 0x7A7, 0xA3 },
  	{ 0x22, 0x7A8, 0x1F },
  	{ 0x22, 0x7A9, 0x3E },
  	{ 0x22, 0x7AA, 0xA3 },
  	{ 0x22, 0x7AB, 0x1F },
  	{ 0x22, 0x7AC, 0x1F },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x84 },
  	{ 0x22, 0x7A7, 0xCA },
  	{ 0x22, 0x7A8, 0xF1 },
  	{ 0x22, 0x7A9, 0x84 },
  	{ 0x22, 0x7AA, 0xCA },
  	{ 0x22, 0x7AB, 0xF1 },
  	{ 0x22, 0x7AC, 0x20 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x3C },
  	{ 0x22, 0x7A7, 0xD5 },
  	{ 0x22, 0x7A8, 0x9C },
  	{ 0x22, 0x7A9, 0x3C },
  	{ 0x22, 0x7AA, 0xD5 },
  	{ 0x22, 0x7AB, 0x9C },
  	{ 0x22, 0x7AC, 0x21 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x7B },
  	{ 0x22, 0x7A7, 0x35 },
  	{ 0x22, 0x7A8, 0x0F },
  	{ 0x22, 0x7A9, 0x7B },
  	{ 0x22, 0x7AA, 0x35 },
  	{ 0x22, 0x7AB, 0x0F },
  	{ 0x22, 0x7AC, 0x22 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0xC4 },
  	{ 0x22, 0x7A7, 0x87 },
  	{ 0x22, 0x7A8, 0x45 },
  	{ 0x22, 0x7A9, 0xC4 },
  	{ 0x22, 0x7AA, 0x87 },
  	{ 0x22, 0x7AB, 0x45 },
  	{ 0x22, 0x7AC, 0x23 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x3E },
  	{ 0x22, 0x7A7, 0x0A },
  	{ 0x22, 0x7A8, 0x78 },
  	{ 0x22, 0x7A9, 0x3E },
  	{ 0x22, 0x7AA, 0x0A },
  	{ 0x22, 0x7AB, 0x78 },
  	{ 0x22, 0x7AC, 0x24 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x88 },
  	{ 0x22, 0x7A7, 0xE2 },
  	{ 0x22, 0x7A8, 0x05 },
  	{ 0x22, 0x7A9, 0x88 },
  	{ 0x22, 0x7AA, 0xE2 },
  	{ 0x22, 0x7AB, 0x05 },
  	{ 0x22, 0x7AC, 0x25 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x3A },
  	{ 0x22, 0x7A7, 0x1A },
  	{ 0x22, 0x7A8, 0xA3 },
  	{ 0x22, 0x7A9, 0x3A },
  	{ 0x22, 0x7AA, 0x1A },
  	{ 0x22, 0x7AB, 0xA3 },
  	{ 0x22, 0x7AC, 0x26 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x77 },
  	{ 0x22, 0x7A7, 0x1D },
  	{ 0x22, 0x7A8, 0xFB },
  	{ 0x22, 0x7A9, 0x77 },
  	{ 0x22, 0x7AA, 0x1D },
  	{ 0x22, 0x7AB, 0xFB },
  	{ 0x22, 0x7AC, 0x27 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0xC7 },
  	{ 0x22, 0x7A7, 0xDA },
  	{ 0x22, 0x7A8, 0xE5 },
  	{ 0x22, 0x7A9, 0xC7 },
  	{ 0x22, 0x7AA, 0xDA },
  	{ 0x22, 0x7AB, 0xE5 },
  	{ 0x22, 0x7AC, 0x28 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x40 },
  	{ 0x22, 0x7A7, 0x00 },
  	{ 0x22, 0x7A8, 0x00 },
  	{ 0x22, 0x7A9, 0x40 },
  	{ 0x22, 0x7AA, 0x00 },
  	{ 0x22, 0x7AB, 0x00 },
  	{ 0x22, 0x7AC, 0x29 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x8E },
  	{ 0x22, 0x7A7, 0xD7 },
  	{ 0x22, 0x7A8, 0x22 },
  	{ 0x22, 0x7A9, 0x8E },
  	{ 0x22, 0x7AA, 0xD7 },
  	{ 0x22, 0x7AB, 0x22 },
  	{ 0x22, 0x7AC, 0x2A },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x35 },
  	{ 0x22, 0x7A7, 0x26 },
  	{ 0x22, 0x7A8, 0xC6 },
  	{ 0x22, 0x7A9, 0x35 },
  	{ 0x22, 0x7AA, 0x26 },
  	{ 0x22, 0x7AB, 0xC6 },
  	{ 0x22, 0x7AC, 0x2B },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x71 },
  	{ 0x22, 0x7A7, 0x28 },
  	{ 0x22, 0x7A8, 0xDE },
  	{ 0x22, 0x7A9, 0x71 },
  	{ 0x22, 0x7AA, 0x28 },
  	{ 0x22, 0x7AB, 0xDE },
  	{ 0x22, 0x7AC, 0x2C },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0xCA },
  	{ 0x22, 0x7A7, 0xD9 },
  	{ 0x22, 0x7A8, 0x3A },
  	{ 0x22, 0x7A9, 0xCA },
  	{ 0x22, 0x7AA, 0xD9 },
  	{ 0x22, 0x7AB, 0x3A },
  	{ 0x22, 0x7AC, 0x2D },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x40 },
  	{ 0x22, 0x7A7, 0x00 },
  	{ 0x22, 0x7A8, 0x00 },
  	{ 0x22, 0x7A9, 0x40 },
  	{ 0x22, 0x7AA, 0x00 },
  	{ 0x22, 0x7AB, 0x00 },
  	{ 0x22, 0x7AC, 0x2E },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x93 },
  	{ 0x22, 0x7A7, 0x5E },
  	{ 0x22, 0x7A8, 0xD8 },
  	{ 0x22, 0x7A9, 0x93 },
  	{ 0x22, 0x7AA, 0x5E },
  	{ 0x22, 0x7AB, 0xD8 },
  	{ 0x22, 0x7AC, 0x2F },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x32 },
  	{ 0x22, 0x7A7, 0xB7 },
  	{ 0x22, 0x7A8, 0xB1 },
  	{ 0x22, 0x7A9, 0x32 },
  	{ 0x22, 0x7AA, 0xB7 },
  	{ 0x22, 0x7AB, 0xB1 },
  	{ 0x22, 0x7AC, 0x30 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x6C },
  	{ 0x22, 0x7A7, 0xA1 },
  	{ 0x22, 0x7A8, 0x28 },
  	{ 0x22, 0x7A9, 0x6C },
  	{ 0x22, 0x7AA, 0xA1 },
  	{ 0x22, 0x7AB, 0x28 },
  	{ 0x22, 0x7AC, 0x31 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0xCD },
  	{ 0x22, 0x7A7, 0x48 },
  	{ 0x22, 0x7A8, 0x4F },
  	{ 0x22, 0x7A9, 0xCD },
  	{ 0x22, 0x7AA, 0x48 },
  	{ 0x22, 0x7AB, 0x4F },
  	{ 0x22, 0x7AC, 0x32 },
  	{ 0x22, 0x7AD, 0x80 },
  	{ 0x22, 0x7A6, 0x40 },
  	{ 0x22, 0x7A7, 0x00 },
  	{ 0x22, 0x7A8, 0x00 },
  	{ 0x22, 0x7A9, 0x40 },
  	{ 0x22, 0x7AA, 0x00 },
  	{ 0x22, 0x7AB, 0x00 },
  	{ 0x22, 0x7AC, 0x33 },
  	{ 0x22, 0x7AD, 0x80 },
  	/* common */
  	{ 0x22, 0x782, 0xC1 },
  	{ 0x22, 0x771, 0x2C },
  	{ 0x22, 0x772, 0x2C },
  	{ 0x22, 0x788, 0x04 },
  	{ 0x01, 0x7B0, 0x08 },
  	{}
  };
372f8c750   Takashi Iwai   ALSA: hda - Use s...
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
  static const struct hda_fixup stac92hd83xxx_fixups[] = {
  	[STAC_92HD83XXX_REF] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = ref92hd83xxx_pin_configs,
  	},
  	[STAC_92HD83XXX_PWR_REF] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = ref92hd83xxx_pin_configs,
  	},
  	[STAC_DELL_S14] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = dell_s14_pin_configs,
  	},
  	[STAC_DELL_VOSTRO_3500] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = dell_vostro_3500_pin_configs,
  	},
  	[STAC_92HD83XXX_HP_cNB11_INTQUAD] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = hp_cNB11_intquad_pin_configs,
  		.chained = true,
  		.chain_id = STAC_92HD83XXX_HP,
  	},
  	[STAC_92HD83XXX_HP] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac92hd83xxx_fixup_hp,
  	},
  	[STAC_HP_DV7_4000] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = hp_dv7_4000_pin_configs,
  		.chained = true,
  		.chain_id = STAC_92HD83XXX_HP,
  	},
  	[STAC_HP_ZEPHYR] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac92hd83xxx_fixup_hp_zephyr,
  		.chained = true,
  		.chain_id = STAC_92HD83XXX_HP,
  	},
  	[STAC_92HD83XXX_HP_LED] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac92hd83xxx_fixup_hp_led,
  		.chained = true,
  		.chain_id = STAC_92HD83XXX_HP,
  	},
  	[STAC_92HD83XXX_HP_INV_LED] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac92hd83xxx_fixup_hp_inv_led,
  		.chained = true,
  		.chain_id = STAC_92HD83XXX_HP,
  	},
  	[STAC_92HD83XXX_HP_MIC_LED] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac92hd83xxx_fixup_hp_mic_led,
  		.chained = true,
  		.chain_id = STAC_92HD83XXX_HP,
  	},
37c367ecd   Takashi Iwai   ALSA: hda - Add a...
2563
2564
2565
2566
2567
2568
  	[STAC_HP_LED_GPIO10] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac92hd83xxx_fixup_hp_led_gpio10,
  		.chained = true,
  		.chain_id = STAC_92HD83XXX_HP,
  	},
372f8c750   Takashi Iwai   ALSA: hda - Use s...
2569
2570
2571
2572
  	[STAC_92HD83XXX_HEADSET_JACK] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac92hd83xxx_fixup_headset_jack,
  	},
49920427e   Takashi Iwai   ALSA: hda/sigmate...
2573
2574
2575
2576
2577
2578
2579
  	[STAC_HP_ENVY_BASS] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = (const struct hda_pintbl[]) {
  			{ 0x0f, 0x90170111 },
  			{}
  		},
  	},
d009f3deb   Vitaliy Kulikov   ALSA: hda - load ...
2580
2581
2582
2583
2584
2585
  	[STAC_HP_BNB13_EQ] = {
  		.type = HDA_FIXUP_VERBS,
  		.v.verbs = hp_bnb13_eq_verbs,
  		.chained = true,
  		.chain_id = STAC_92HD83XXX_HP_MIC_LED,
  	},
8695a003a   Takashi Iwai   ALSA: hda - Add t...
2586
2587
2588
2589
2590
2591
2592
  	[STAC_HP_ENVY_TS_BASS] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = (const struct hda_pintbl[]) {
  			{ 0x10, 0x92170111 },
  			{}
  		},
  	},
d0513fc6c   Matthew Ranostay   ALSA: hda: added ...
2593
  };
372f8c750   Takashi Iwai   ALSA: hda - Use s...
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
  static const struct hda_model_fixup stac92hd83xxx_models[] = {
  	{ .id = STAC_92HD83XXX_REF, .name = "ref" },
  	{ .id = STAC_92HD83XXX_PWR_REF, .name = "mic-ref" },
  	{ .id = STAC_DELL_S14, .name = "dell-s14" },
  	{ .id = STAC_DELL_VOSTRO_3500, .name = "dell-vostro-3500" },
  	{ .id = STAC_92HD83XXX_HP_cNB11_INTQUAD, .name = "hp_cNB11_intquad" },
  	{ .id = STAC_HP_DV7_4000, .name = "hp-dv7-4000" },
  	{ .id = STAC_HP_ZEPHYR, .name = "hp-zephyr" },
  	{ .id = STAC_92HD83XXX_HP_LED, .name = "hp-led" },
  	{ .id = STAC_92HD83XXX_HP_INV_LED, .name = "hp-inv-led" },
  	{ .id = STAC_92HD83XXX_HP_MIC_LED, .name = "hp-mic-led" },
  	{ .id = STAC_92HD83XXX_HEADSET_JACK, .name = "headset-jack" },
49920427e   Takashi Iwai   ALSA: hda/sigmate...
2606
  	{ .id = STAC_HP_ENVY_BASS, .name = "hp-envy-bass" },
d009f3deb   Vitaliy Kulikov   ALSA: hda - load ...
2607
  	{ .id = STAC_HP_BNB13_EQ, .name = "hp-bnb13-eq" },
8695a003a   Takashi Iwai   ALSA: hda - Add t...
2608
  	{ .id = STAC_HP_ENVY_TS_BASS, .name = "hp-envy-ts-bass" },
372f8c750   Takashi Iwai   ALSA: hda - Use s...
2609
  	{}
d0513fc6c   Matthew Ranostay   ALSA: hda: added ...
2610
  };
372f8c750   Takashi Iwai   ALSA: hda - Use s...
2611
  static const struct snd_pci_quirk stac92hd83xxx_fixup_tbl[] = {
d0513fc6c   Matthew Ranostay   ALSA: hda: added ...
2612
2613
  	/* SigmaTel reference board */
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
f9d088b20   Takashi Iwai   ALSA: hda - Fix a...
2614
  		      "DFI LanParty", STAC_92HD83XXX_REF),
577aa2c19   Matthew Ranostay   ALSA: hda: add re...
2615
2616
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
  		      "DFI LanParty", STAC_92HD83XXX_REF),
8bb0ac557   Matthew Ranostay   ALSA: hda: Add ST...
2617
2618
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ba,
  		      "unknown Dell", STAC_DELL_S14),
8d032a8f6   David Henningsson   ALSA: hda - remov...
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0532,
  		      "Dell Latitude E6230", STAC_92HD83XXX_HEADSET_JACK),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0533,
  		      "Dell Latitude E6330", STAC_92HD83XXX_HEADSET_JACK),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0534,
  		      "Dell Latitude E6430", STAC_92HD83XXX_HEADSET_JACK),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0535,
  		      "Dell Latitude E6530", STAC_92HD83XXX_HEADSET_JACK),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x053c,
  		      "Dell Latitude E5430", STAC_92HD83XXX_HEADSET_JACK),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x053d,
  		      "Dell Latitude E5530", STAC_92HD83XXX_HEADSET_JACK),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0549,
  		      "Dell Latitude E5430", STAC_92HD83XXX_HEADSET_JACK),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x057d,
  		      "Dell Latitude E6430s", STAC_92HD83XXX_HEADSET_JACK),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0584,
  		      "Dell Latitude E6430U", STAC_92HD83XXX_HEADSET_JACK),
f7f9bdfad   Julian Wollrath   ALSA: hda - fix i...
2637
2638
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x1028,
  		      "Dell Vostro 3500", STAC_DELL_VOSTRO_3500),
0c27c1805   Vitaliy Kulikov   ALSA: hda - Add s...
2639
2640
2641
2642
2643
2644
2645
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1656,
  			  "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1657,
  			  "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1658,
  			  "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1659,
8ae5865ec   Takashi Iwai   ALSA: hda - Fix p...
2646
  			  "HP Pavilion dv7", STAC_HP_DV7_4000),
0c27c1805   Vitaliy Kulikov   ALSA: hda - Add s...
2647
2648
2649
2650
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165A,
  			  "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165B,
  			  "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
49920427e   Takashi Iwai   ALSA: hda/sigmate...
2651
2652
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1888,
  			  "HP Envy Spectre", STAC_HP_ENVY_BASS),
37c367ecd   Takashi Iwai   ALSA: hda - Add a...
2653
2654
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1899,
  			  "HP Folio 13", STAC_HP_LED_GPIO10),
62cbde186   Takashi Iwai   ALSA: hda - Add m...
2655
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x18df,
d009f3deb   Vitaliy Kulikov   ALSA: hda - load ...
2656
2657
2658
2659
2660
2661
2662
  			  "HP Folio", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x18F8,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1909,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x190A,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
8695a003a   Takashi Iwai   ALSA: hda - Add t...
2663
2664
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x190e,
  			  "HP ENVY TS", STAC_HP_ENVY_TS_BASS),
d009f3deb   Vitaliy Kulikov   ALSA: hda - load ...
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1940,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1941,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1942,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1943,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1944,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1945,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1946,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1948,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1949,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194A,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194B,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194C,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194E,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194F,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1950,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1951,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x195A,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x195B,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x195C,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1991,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2103,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2104,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2105,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2106,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2107,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2108,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2109,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x210A,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x210B,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x211C,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x211D,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x211E,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x211F,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2120,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2121,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2122,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2123,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x213E,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x213F,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2140,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x21B2,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x21B3,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x21B5,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x21B6,
  			  "HP bNB13", STAC_HP_BNB13_EQ),
f9afed1f7   Takashi Iwai   ALSA: hda - Apply...
2753
2754
  	SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x1900,
  			  "HP", STAC_92HD83XXX_HP_MIC_LED),
4059a42c5   Takashi Iwai   ALSA: hda - Enabl...
2755
2756
2757
2758
  	SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x2000,
  			  "HP", STAC_92HD83XXX_HP_MIC_LED),
  	SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x2100,
  			  "HP", STAC_92HD83XXX_HP_MIC_LED),
0c27c1805   Vitaliy Kulikov   ALSA: hda - Add s...
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3388,
  			  "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3389,
  			  "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355B,
  			  "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355C,
  			  "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355D,
  			  "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355E,
  			  "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355F,
  			  "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3560,
  			  "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358B,
  			  "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358C,
  			  "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358D,
  			  "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3591,
  			  "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3592,
  			  "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3593,
  			  "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
5556e1470   Vitaliy Kulikov   ALSA: hda - Fix a...
2787
2788
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3561,
  			  "HP", STAC_HP_ZEPHYR),
a3e199732   Takashi Iwai   ALSA: hda - Fix m...
2789
2790
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3660,
  			  "HP Mini", STAC_92HD83XXX_HP_LED),
5afc13af3   Gustavo Maciel Dias Vieira   ALSA: hda - Fix m...
2791
2792
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x144E,
  			  "HP Pavilion dv5", STAC_92HD83XXX_HP_INV_LED),
8c698fe21   Takashi Iwai   ALSA: hda/sigmate...
2793
2794
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x148a,
  		      "HP Mini", STAC_92HD83XXX_HP_LED),
372f8c750   Takashi Iwai   ALSA: hda - Use s...
2795
  	SND_PCI_QUIRK_VENDOR(PCI_VENDOR_ID_HP, "HP", STAC_92HD83XXX_HP),
574f3c4f5   Herton Ronaldo Krzesinski   ALSA: hda - Add m...
2796
  	{} /* terminator */
d0513fc6c   Matthew Ranostay   ALSA: hda: added ...
2797
  };
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
  /* HP dv7 bass switch - GPIO5 */
  #define stac_hp_bass_gpio_info	snd_ctl_boolean_mono_info
  static int stac_hp_bass_gpio_get(struct snd_kcontrol *kcontrol,
  				 struct snd_ctl_elem_value *ucontrol)
  {
  	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  	struct sigmatel_spec *spec = codec->spec;
  	ucontrol->value.integer.value[0] = !!(spec->gpio_data & 0x20);
  	return 0;
  }
  
  static int stac_hp_bass_gpio_put(struct snd_kcontrol *kcontrol,
  				 struct snd_ctl_elem_value *ucontrol)
  {
  	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
  	struct sigmatel_spec *spec = codec->spec;
  	unsigned int gpio_data;
  
  	gpio_data = (spec->gpio_data & ~0x20) |
  		(ucontrol->value.integer.value[0] ? 0x20 : 0);
  	if (gpio_data == spec->gpio_data)
  		return 0;
  	spec->gpio_data = gpio_data;
  	stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data);
  	return 1;
  }
  
  static const struct snd_kcontrol_new stac_hp_bass_sw_ctrl = {
  	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  	.info = stac_hp_bass_gpio_info,
  	.get = stac_hp_bass_gpio_get,
  	.put = stac_hp_bass_gpio_put,
  };
  
  static int stac_add_hp_bass_switch(struct hda_codec *codec)
  {
  	struct sigmatel_spec *spec = codec->spec;
  
  	if (!snd_hda_gen_add_kctl(&spec->gen, "Bass Speaker Playback Switch",
  				  &stac_hp_bass_sw_ctrl))
  		return -ENOMEM;
  
  	spec->gpio_mask |= 0x20;
  	spec->gpio_dir |= 0x20;
  	spec->gpio_data |= 0x20;
  	return 0;
  }
0f6fcb73c   Takashi Iwai   ALSA: hda - Use s...
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
  static const struct hda_pintbl ref92hd71bxx_pin_configs[] = {
  	{ 0x0a, 0x02214030 },
  	{ 0x0b, 0x02a19040 },
  	{ 0x0c, 0x01a19020 },
  	{ 0x0d, 0x01014010 },
  	{ 0x0e, 0x0181302e },
  	{ 0x0f, 0x01014010 },
  	{ 0x14, 0x01019020 },
  	{ 0x18, 0x90a000f0 },
  	{ 0x19, 0x90a000f0 },
  	{ 0x1e, 0x01452050 },
  	{ 0x1f, 0x01452050 },
  	{}
e035b8410   Matthew Ranostay   [ALSA] hda: Added...
2858
  };
0f6fcb73c   Takashi Iwai   ALSA: hda - Use s...
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
  static const struct hda_pintbl dell_m4_1_pin_configs[] = {
  	{ 0x0a, 0x0421101f },
  	{ 0x0b, 0x04a11221 },
  	{ 0x0c, 0x40f000f0 },
  	{ 0x0d, 0x90170110 },
  	{ 0x0e, 0x23a1902e },
  	{ 0x0f, 0x23014250 },
  	{ 0x14, 0x40f000f0 },
  	{ 0x18, 0x90a000f0 },
  	{ 0x19, 0x40f000f0 },
  	{ 0x1e, 0x4f0000f0 },
  	{ 0x1f, 0x4f0000f0 },
  	{}
a76626401   Matthew Ranostay   [ALSA] hda: 92HDx...
2872
  };
0f6fcb73c   Takashi Iwai   ALSA: hda - Use s...
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
  static const struct hda_pintbl dell_m4_2_pin_configs[] = {
  	{ 0x0a, 0x0421101f },
  	{ 0x0b, 0x04a11221 },
  	{ 0x0c, 0x90a70330 },
  	{ 0x0d, 0x90170110 },
  	{ 0x0e, 0x23a1902e },
  	{ 0x0f, 0x23014250 },
  	{ 0x14, 0x40f000f0 },
  	{ 0x18, 0x40f000f0 },
  	{ 0x19, 0x40f000f0 },
  	{ 0x1e, 0x044413b0 },
  	{ 0x1f, 0x044413b0 },
  	{}
a76626401   Matthew Ranostay   [ALSA] hda: 92HDx...
2886
  };
0f6fcb73c   Takashi Iwai   ALSA: hda - Use s...
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
  static const struct hda_pintbl dell_m4_3_pin_configs[] = {
  	{ 0x0a, 0x0421101f },
  	{ 0x0b, 0x04a11221 },
  	{ 0x0c, 0x90a70330 },
  	{ 0x0d, 0x90170110 },
  	{ 0x0e, 0x40f000f0 },
  	{ 0x0f, 0x40f000f0 },
  	{ 0x14, 0x40f000f0 },
  	{ 0x18, 0x90a000f0 },
  	{ 0x19, 0x40f000f0 },
  	{ 0x1e, 0x044413b0 },
  	{ 0x1f, 0x044413b0 },
  	{}
3a7abfd2b   Matthew Ranostay   ALSA: hda: Add ST...
2900
  };
0f6fcb73c   Takashi Iwai   ALSA: hda - Use s...
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
  static void stac92hd71bxx_fixup_ref(struct hda_codec *codec,
  				    const struct hda_fixup *fix, int action)
  {
  	struct sigmatel_spec *spec = codec->spec;
  
  	if (action != HDA_FIXUP_ACT_PRE_PROBE)
  		return;
  
  	snd_hda_apply_pincfgs(codec, ref92hd71bxx_pin_configs);
  	spec->gpio_mask = spec->gpio_dir = spec->gpio_data = 0;
  }
0f6fcb73c   Takashi Iwai   ALSA: hda - Use s...
2912
2913
2914
2915
  static void stac92hd71bxx_fixup_hp_m4(struct hda_codec *codec,
  				      const struct hda_fixup *fix, int action)
  {
  	struct sigmatel_spec *spec = codec->spec;
1a4f69d5a   Takashi Iwai   ALSA: hda - Allow...
2916
  	struct hda_jack_callback *jack;
0f6fcb73c   Takashi Iwai   ALSA: hda - Use s...
2917
2918
2919
2920
2921
  
  	if (action != HDA_FIXUP_ACT_PRE_PROBE)
  		return;
  
  	/* Enable VREF power saving on GPIO1 detect */
0f6fcb73c   Takashi Iwai   ALSA: hda - Use s...
2922
2923
  	snd_hda_codec_write_cache(codec, codec->afg, 0,
  				  AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02);
bda17b82b   Takashi Iwai   ALSA: hda - Make ...
2924
2925
2926
  	jack = snd_hda_jack_detect_enable_callback(codec, codec->afg,
  						   stac_vref_event);
  	if (!IS_ERR(jack))
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
2927
  		jack->private_data = 0x02;
0f6fcb73c   Takashi Iwai   ALSA: hda - Use s...
2928
2929
2930
2931
  	spec->gpio_mask |= 0x02;
  
  	/* enable internal microphone */
  	snd_hda_codec_set_pincfg(codec, 0x0e, 0x01813040);
0f6fcb73c   Takashi Iwai   ALSA: hda - Use s...
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
  }
  
  static void stac92hd71bxx_fixup_hp_dv4(struct hda_codec *codec,
  				       const struct hda_fixup *fix, int action)
  {
  	struct sigmatel_spec *spec = codec->spec;
  
  	if (action != HDA_FIXUP_ACT_PRE_PROBE)
  		return;
  	spec->gpio_led = 0x01;
  }
  
  static void stac92hd71bxx_fixup_hp_dv5(struct hda_codec *codec,
  				       const struct hda_fixup *fix, int action)
  {
0f6fcb73c   Takashi Iwai   ALSA: hda - Use s...
2947
2948
2949
2950
2951
  	unsigned int cap;
  
  	switch (action) {
  	case HDA_FIXUP_ACT_PRE_PROBE:
  		snd_hda_codec_set_pincfg(codec, 0x0d, 0x90170010);
f6655d52a   Takashi Iwai   ALSA: hda - Minor...
2952
2953
2954
  		break;
  
  	case HDA_FIXUP_ACT_PROBE:
0f6fcb73c   Takashi Iwai   ALSA: hda - Use s...
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
  		/* enable bass on HP dv7 */
  		cap = snd_hda_param_read(codec, 0x1, AC_PAR_GPIO_CAP);
  		cap &= AC_GPIO_IO_COUNT;
  		if (cap >= 6)
  			stac_add_hp_bass_switch(codec);
  		break;
  	}
  }
  
  static void stac92hd71bxx_fixup_hp_hdx(struct hda_codec *codec,
  				       const struct hda_fixup *fix, int action)
  {
  	struct sigmatel_spec *spec = codec->spec;
  
  	if (action != HDA_FIXUP_ACT_PRE_PROBE)
  		return;
  	spec->gpio_led = 0x08;
0f6fcb73c   Takashi Iwai   ALSA: hda - Use s...
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
  }
  
  
  static void stac92hd71bxx_fixup_hp(struct hda_codec *codec,
  				   const struct hda_fixup *fix, int action)
  {
  	struct sigmatel_spec *spec = codec->spec;
  
  	if (action != HDA_FIXUP_ACT_PRE_PROBE)
  		return;
  
  	if (hp_blike_system(codec->subsystem_id)) {
  		unsigned int pin_cfg = snd_hda_codec_get_pincfg(codec, 0x0f);
  		if (get_defcfg_device(pin_cfg) == AC_JACK_LINE_OUT ||
  			get_defcfg_device(pin_cfg) == AC_JACK_SPEAKER  ||
  			get_defcfg_device(pin_cfg) == AC_JACK_HP_OUT) {
  			/* It was changed in the BIOS to just satisfy MS DTM.
  			 * Lets turn it back into slaved HP
  			 */
  			pin_cfg = (pin_cfg & (~AC_DEFCFG_DEVICE))
  					| (AC_JACK_HP_OUT <<
  						AC_DEFCFG_DEVICE_SHIFT);
  			pin_cfg = (pin_cfg & (~(AC_DEFCFG_DEF_ASSOC
  							| AC_DEFCFG_SEQUENCE)))
  								| 0x1f;
  			snd_hda_codec_set_pincfg(codec, 0x0f, pin_cfg);
  		}
  	}
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
3000
  	if (find_mute_led_cfg(codec, 1))
4e76a8833   Takashi Iwai   ALSA: hda - Repla...
3001
3002
  		codec_dbg(codec, "mute LED gpio %d polarity %d
  ",
0f6fcb73c   Takashi Iwai   ALSA: hda - Use s...
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
  				spec->gpio_led,
  				spec->gpio_led_polarity);
  
  }
  
  static const struct hda_fixup stac92hd71bxx_fixups[] = {
  	[STAC_92HD71BXX_REF] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac92hd71bxx_fixup_ref,
  	},
  	[STAC_DELL_M4_1] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = dell_m4_1_pin_configs,
0f6fcb73c   Takashi Iwai   ALSA: hda - Use s...
3016
3017
3018
3019
  	},
  	[STAC_DELL_M4_2] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = dell_m4_2_pin_configs,
0f6fcb73c   Takashi Iwai   ALSA: hda - Use s...
3020
3021
3022
3023
  	},
  	[STAC_DELL_M4_3] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = dell_m4_3_pin_configs,
0f6fcb73c   Takashi Iwai   ALSA: hda - Use s...
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
  	},
  	[STAC_HP_M4] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac92hd71bxx_fixup_hp_m4,
  		.chained = true,
  		.chain_id = STAC_92HD71BXX_HP,
  	},
  	[STAC_HP_DV4] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac92hd71bxx_fixup_hp_dv4,
  		.chained = true,
  		.chain_id = STAC_HP_DV5,
  	},
  	[STAC_HP_DV5] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac92hd71bxx_fixup_hp_dv5,
  		.chained = true,
  		.chain_id = STAC_92HD71BXX_HP,
  	},
  	[STAC_HP_HDX] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac92hd71bxx_fixup_hp_hdx,
  		.chained = true,
  		.chain_id = STAC_92HD71BXX_HP,
  	},
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
3049
  	[STAC_92HD71BXX_HP] = {
0f6fcb73c   Takashi Iwai   ALSA: hda - Use s...
3050
  		.type = HDA_FIXUP_FUNC,
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
3051
  		.v.func = stac92hd71bxx_fixup_hp,
0f6fcb73c   Takashi Iwai   ALSA: hda - Use s...
3052
  	},
e035b8410   Matthew Ranostay   [ALSA] hda: Added...
3053
  };
0f6fcb73c   Takashi Iwai   ALSA: hda - Use s...
3054
3055
3056
3057
3058
3059
3060
3061
3062
  static const struct hda_model_fixup stac92hd71bxx_models[] = {
  	{ .id = STAC_92HD71BXX_REF, .name = "ref" },
  	{ .id = STAC_DELL_M4_1, .name = "dell-m4-1" },
  	{ .id = STAC_DELL_M4_2, .name = "dell-m4-2" },
  	{ .id = STAC_DELL_M4_3, .name = "dell-m4-3" },
  	{ .id = STAC_HP_M4, .name = "hp-m4" },
  	{ .id = STAC_HP_DV4, .name = "hp-dv4" },
  	{ .id = STAC_HP_DV5, .name = "hp-dv5" },
  	{ .id = STAC_HP_HDX, .name = "hp-hdx" },
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
3063
  	{ .id = STAC_HP_DV4, .name = "hp-dv4-1222nr" },
0f6fcb73c   Takashi Iwai   ALSA: hda - Use s...
3064
  	{}
e035b8410   Matthew Ranostay   [ALSA] hda: Added...
3065
  };
0f6fcb73c   Takashi Iwai   ALSA: hda - Use s...
3066
  static const struct snd_pci_quirk stac92hd71bxx_fixup_tbl[] = {
e035b8410   Matthew Ranostay   [ALSA] hda: Added...
3067
3068
3069
  	/* SigmaTel reference board */
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
  		      "DFI LanParty", STAC_92HD71BXX_REF),
577aa2c19   Matthew Ranostay   ALSA: hda: add re...
3070
3071
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
  		      "DFI LanParty", STAC_92HD71BXX_REF),
5bdaaada1   Vitaliy Kulikov   ALSA: hda - Enabl...
3072
3073
  	SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x1720,
  			  "HP", STAC_HP_DV5),
58d8395b7   Takashi Iwai   ALSA: hda - Add a...
3074
3075
  	SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3080,
  		      "HP", STAC_HP_DV5),
2ae466f8c   Takashi Iwai   ALSA: hda - Clean...
3076
  	SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x30f0,
2a6ce6e5f   Takashi Iwai   ALSA: hda - Add h...
3077
  		      "HP dv4-7", STAC_HP_DV4),
2ae466f8c   Takashi Iwai   ALSA: hda - Clean...
3078
3079
  	SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3600,
  		      "HP dv4-7", STAC_HP_DV5),
6fce61aea   Takashi Iwai   ALSA: hda - Fix c...
3080
3081
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3610,
  		      "HP HDX", STAC_HP_HDX),  /* HDX18 */
9a9e2359f   Matthew Ranostay   ALSA: hda: HP lap...
3082
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a,
2ae466f8c   Takashi Iwai   ALSA: hda - Clean...
3083
  		      "HP mini 1000", STAC_HP_M4),
ae6241fbf   Christoph Plattner   ALSA: hda - Added...
3084
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361b,
6fce61aea   Takashi Iwai   ALSA: hda - Fix c...
3085
  		      "HP HDX", STAC_HP_HDX),  /* HDX16 */
6e34c0332   Takashi Iwai   ALSA: hda - Add s...
3086
3087
  	SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3620,
  		      "HP dv6", STAC_HP_DV5),
e3d2530a6   Kunal Gangakhedkar   ALSA: hda - Add P...
3088
3089
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3061,
  		      "HP dv6", STAC_HP_DV5), /* HP dv6-1110ax */
9b2167d59   Luke Yelavich   ALSA: hda - Add a...
3090
3091
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x363e,
  		      "HP DV6", STAC_HP_DV5),
1972d0250   Takashi Iwai   ALSA: hda - Add q...
3092
3093
  	SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x7010,
  		      "HP", STAC_HP_DV5),
0f6fcb73c   Takashi Iwai   ALSA: hda - Use s...
3094
  	SND_PCI_QUIRK_VENDOR(PCI_VENDOR_ID_HP, "HP", STAC_92HD71BXX_HP),
a76626401   Matthew Ranostay   [ALSA] hda: 92HDx...
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233,
  				"unknown Dell", STAC_DELL_M4_1),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234,
  				"unknown Dell", STAC_DELL_M4_1),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0250,
  				"unknown Dell", STAC_DELL_M4_1),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024f,
  				"unknown Dell", STAC_DELL_M4_1),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024d,
  				"unknown Dell", STAC_DELL_M4_1),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0251,
  				"unknown Dell", STAC_DELL_M4_1),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0277,
  				"unknown Dell", STAC_DELL_M4_1),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0263,
  				"unknown Dell", STAC_DELL_M4_2),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0265,
  				"unknown Dell", STAC_DELL_M4_2),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0262,
  				"unknown Dell", STAC_DELL_M4_2),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264,
  				"unknown Dell", STAC_DELL_M4_2),
3a7abfd2b   Matthew Ranostay   ALSA: hda: Add ST...
3117
3118
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02aa,
  				"unknown Dell", STAC_DELL_M4_3),
e035b8410   Matthew Ranostay   [ALSA] hda: Added...
3119
3120
  	{} /* terminator */
  };
0a4278464   Takashi Iwai   ALSA: hda - Use s...
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
  static const struct hda_pintbl ref922x_pin_configs[] = {
  	{ 0x0a, 0x01014010 },
  	{ 0x0b, 0x01016011 },
  	{ 0x0c, 0x01012012 },
  	{ 0x0d, 0x0221401f },
  	{ 0x0e, 0x01813122 },
  	{ 0x0f, 0x01011014 },
  	{ 0x10, 0x01441030 },
  	{ 0x11, 0x01c41030 },
  	{ 0x15, 0x40000100 },
  	{ 0x1b, 0x40000100 },
  	{}
2f2f4251c   Matt   [ALSA] add sigmat...
3133
  };
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
3134
3135
3136
3137
3138
3139
3140
3141
  /*
      STAC 922X pin configs for
      102801A7
      102801AB
      102801A9
      102801D1
      102801D2
  */
0a4278464   Takashi Iwai   ALSA: hda - Use s...
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
  static const struct hda_pintbl dell_922x_d81_pin_configs[] = {
  	{ 0x0a, 0x02214030 },
  	{ 0x0b, 0x01a19021 },
  	{ 0x0c, 0x01111012 },
  	{ 0x0d, 0x01114010 },
  	{ 0x0e, 0x02a19020 },
  	{ 0x0f, 0x01117011 },
  	{ 0x10, 0x400001f0 },
  	{ 0x11, 0x400001f1 },
  	{ 0x15, 0x01813122 },
  	{ 0x1b, 0x400001f2 },
  	{}
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
3154
3155
3156
3157
3158
3159
3160
  };
  
  /*
      STAC 922X pin configs for
      102801AC
      102801D0
  */
0a4278464   Takashi Iwai   ALSA: hda - Use s...
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
  static const struct hda_pintbl dell_922x_d82_pin_configs[] = {
  	{ 0x0a, 0x02214030 },
  	{ 0x0b, 0x01a19021 },
  	{ 0x0c, 0x01111012 },
  	{ 0x0d, 0x01114010 },
  	{ 0x0e, 0x02a19020 },
  	{ 0x0f, 0x01117011 },
  	{ 0x10, 0x01451140 },
  	{ 0x11, 0x400001f0 },
  	{ 0x15, 0x01813122 },
  	{ 0x1b, 0x400001f1 },
  	{}
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
3173
3174
3175
3176
3177
3178
  };
  
  /*
      STAC 922X pin configs for
      102801BF
  */
0a4278464   Takashi Iwai   ALSA: hda - Use s...
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
  static const struct hda_pintbl dell_922x_m81_pin_configs[] = {
  	{ 0x0a, 0x0321101f },
  	{ 0x0b, 0x01112024 },
  	{ 0x0c, 0x01111222 },
  	{ 0x0d, 0x91174220 },
  	{ 0x0e, 0x03a11050 },
  	{ 0x0f, 0x01116221 },
  	{ 0x10, 0x90a70330 },
  	{ 0x11, 0x01452340 },
  	{ 0x15, 0x40C003f1 },
  	{ 0x1b, 0x405003f0 },
  	{}
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
3191
3192
3193
3194
3195
3196
  };
  
  /*
      STAC 9221 A1 pin configs for
      102801D7 (Dell XPS M1210)
  */
0a4278464   Takashi Iwai   ALSA: hda - Use s...
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
  static const struct hda_pintbl dell_922x_m82_pin_configs[] = {
  	{ 0x0a, 0x02211211 },
  	{ 0x0b, 0x408103ff },
  	{ 0x0c, 0x02a1123e },
  	{ 0x0d, 0x90100310 },
  	{ 0x0e, 0x408003f1 },
  	{ 0x0f, 0x0221121f },
  	{ 0x10, 0x03451340 },
  	{ 0x11, 0x40c003f2 },
  	{ 0x15, 0x508003f3 },
  	{ 0x1b, 0x405003f4 },
  	{}
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
3209
  };
0a4278464   Takashi Iwai   ALSA: hda - Use s...
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
  static const struct hda_pintbl d945gtp3_pin_configs[] = {
  	{ 0x0a, 0x0221401f },
  	{ 0x0b, 0x01a19022 },
  	{ 0x0c, 0x01813021 },
  	{ 0x0d, 0x01014010 },
  	{ 0x0e, 0x40000100 },
  	{ 0x0f, 0x40000100 },
  	{ 0x10, 0x40000100 },
  	{ 0x11, 0x40000100 },
  	{ 0x15, 0x02a19120 },
  	{ 0x1b, 0x40000100 },
  	{}
  };
  
  static const struct hda_pintbl d945gtp5_pin_configs[] = {
  	{ 0x0a, 0x0221401f },
  	{ 0x0b, 0x01011012 },
  	{ 0x0c, 0x01813024 },
  	{ 0x0d, 0x01014010 },
  	{ 0x0e, 0x01a19021 },
  	{ 0x0f, 0x01016011 },
  	{ 0x10, 0x01452130 },
  	{ 0x11, 0x40000100 },
  	{ 0x15, 0x02a19320 },
  	{ 0x1b, 0x40000100 },
  	{}
403d19446   Matt Porter   [ALSA] hda-codec ...
3236
  };
0a4278464   Takashi Iwai   ALSA: hda - Use s...
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
  static const struct hda_pintbl intel_mac_v1_pin_configs[] = {
  	{ 0x0a, 0x0121e21f },
  	{ 0x0b, 0x400000ff },
  	{ 0x0c, 0x9017e110 },
  	{ 0x0d, 0x400000fd },
  	{ 0x0e, 0x400000fe },
  	{ 0x0f, 0x0181e020 },
  	{ 0x10, 0x1145e030 },
  	{ 0x11, 0x11c5e240 },
  	{ 0x15, 0x400000fc },
  	{ 0x1b, 0x400000fb },
  	{}
403d19446   Matt Porter   [ALSA] hda-codec ...
3249
  };
0a4278464   Takashi Iwai   ALSA: hda - Use s...
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
  static const struct hda_pintbl intel_mac_v2_pin_configs[] = {
  	{ 0x0a, 0x0121e21f },
  	{ 0x0b, 0x90a7012e },
  	{ 0x0c, 0x9017e110 },
  	{ 0x0d, 0x400000fd },
  	{ 0x0e, 0x400000fe },
  	{ 0x0f, 0x0181e020 },
  	{ 0x10, 0x1145e230 },
  	{ 0x11, 0x500000fa },
  	{ 0x15, 0x400000fc },
  	{ 0x1b, 0x400000fb },
  	{}
5d5d3bc3e   Ivan N. Zlatev   [ALSA] hda-codec ...
3262
  };
0a4278464   Takashi Iwai   ALSA: hda - Use s...
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
  static const struct hda_pintbl intel_mac_v3_pin_configs[] = {
  	{ 0x0a, 0x0121e21f },
  	{ 0x0b, 0x90a7012e },
  	{ 0x0c, 0x9017e110 },
  	{ 0x0d, 0x400000fd },
  	{ 0x0e, 0x400000fe },
  	{ 0x0f, 0x0181e020 },
  	{ 0x10, 0x1145e230 },
  	{ 0x11, 0x11c5e240 },
  	{ 0x15, 0x400000fc },
  	{ 0x1b, 0x400000fb },
  	{}
6f0778d87   Nicolas Boichat   [ALSA] hda-codec ...
3275
  };
0a4278464   Takashi Iwai   ALSA: hda - Use s...
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
  static const struct hda_pintbl intel_mac_v4_pin_configs[] = {
  	{ 0x0a, 0x0321e21f },
  	{ 0x0b, 0x03a1e02e },
  	{ 0x0c, 0x9017e110 },
  	{ 0x0d, 0x9017e11f },
  	{ 0x0e, 0x400000fe },
  	{ 0x0f, 0x0381e020 },
  	{ 0x10, 0x1345e230 },
  	{ 0x11, 0x13c5e240 },
  	{ 0x15, 0x400000fc },
  	{ 0x1b, 0x400000fb },
  	{}
3fc24d850   Takashi Iwai   [ALSA] hda-codec ...
3288
  };
0a4278464   Takashi Iwai   ALSA: hda - Use s...
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
  static const struct hda_pintbl intel_mac_v5_pin_configs[] = {
  	{ 0x0a, 0x0321e21f },
  	{ 0x0b, 0x03a1e02e },
  	{ 0x0c, 0x9017e110 },
  	{ 0x0d, 0x9017e11f },
  	{ 0x0e, 0x400000fe },
  	{ 0x0f, 0x0381e020 },
  	{ 0x10, 0x1345e230 },
  	{ 0x11, 0x13c5e240 },
  	{ 0x15, 0x400000fc },
  	{ 0x1b, 0x400000fb },
  	{}
f16928fb5   Sylvain FORET   [ALSA] snd_hda_in...
3301
  };
0a4278464   Takashi Iwai   ALSA: hda - Use s...
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
  static const struct hda_pintbl ecs202_pin_configs[] = {
  	{ 0x0a, 0x0221401f },
  	{ 0x0b, 0x02a19020 },
  	{ 0x0c, 0x01a19020 },
  	{ 0x0d, 0x01114010 },
  	{ 0x0e, 0x408000f0 },
  	{ 0x0f, 0x01813022 },
  	{ 0x10, 0x074510a0 },
  	{ 0x11, 0x40c400f1 },
  	{ 0x15, 0x9037012e },
  	{ 0x1b, 0x40e000f2 },
  	{}
0dae0f83c   Takashi Iwai   [ALSA] hda-codec ...
3314
  };
0a4278464   Takashi Iwai   ALSA: hda - Use s...
3315
3316
  /* codec SSIDs for Intel Mac sharing the same PCI SSID 8384:7680 */
  static const struct snd_pci_quirk stac922x_intel_mac_fixup_tbl[] = {
697aebab7   Takashi Iwai   ALSA: hda - Fix m...
3317
  	SND_PCI_QUIRK(0x0000, 0x0100, "Mac Mini", STAC_INTEL_MAC_V3),
0a4278464   Takashi Iwai   ALSA: hda - Use s...
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
  	SND_PCI_QUIRK(0x106b, 0x0800, "Mac", STAC_INTEL_MAC_V1),
  	SND_PCI_QUIRK(0x106b, 0x0600, "Mac", STAC_INTEL_MAC_V2),
  	SND_PCI_QUIRK(0x106b, 0x0700, "Mac", STAC_INTEL_MAC_V2),
  	SND_PCI_QUIRK(0x106b, 0x0e00, "Mac", STAC_INTEL_MAC_V3),
  	SND_PCI_QUIRK(0x106b, 0x0f00, "Mac", STAC_INTEL_MAC_V3),
  	SND_PCI_QUIRK(0x106b, 0x1600, "Mac", STAC_INTEL_MAC_V3),
  	SND_PCI_QUIRK(0x106b, 0x1700, "Mac", STAC_INTEL_MAC_V3),
  	SND_PCI_QUIRK(0x106b, 0x0200, "Mac", STAC_INTEL_MAC_V3),
  	SND_PCI_QUIRK(0x106b, 0x1e00, "Mac", STAC_INTEL_MAC_V3),
  	SND_PCI_QUIRK(0x106b, 0x1a00, "Mac", STAC_INTEL_MAC_V4),
  	SND_PCI_QUIRK(0x106b, 0x0a00, "Mac", STAC_INTEL_MAC_V5),
  	SND_PCI_QUIRK(0x106b, 0x2200, "Mac", STAC_INTEL_MAC_V5),
  	{}
8c6500879   Mauro Carvalho Chehab   ALSA: hda: Add su...
3331
  };
76c088287   Takashi Iwai   [ALSA] hda-codec ...
3332

0a4278464   Takashi Iwai   ALSA: hda - Use s...
3333
3334
3335
3336
3337
3338
3339
3340
3341
  static const struct hda_fixup stac922x_fixups[];
  
  /* remap the fixup from codec SSID and apply it */
  static void stac922x_fixup_intel_mac_auto(struct hda_codec *codec,
  					  const struct hda_fixup *fix,
  					  int action)
  {
  	if (action != HDA_FIXUP_ACT_PRE_PROBE)
  		return;
f5662e1cb   David Henningsson   ALSA: hda - Refac...
3342
3343
  
  	codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
0a4278464   Takashi Iwai   ALSA: hda - Use s...
3344
3345
  	snd_hda_pick_fixup(codec, NULL, stac922x_intel_mac_fixup_tbl,
  			   stac922x_fixups);
f5662e1cb   David Henningsson   ALSA: hda - Refac...
3346
  	if (codec->fixup_id != HDA_FIXUP_ID_NOT_SET)
0a4278464   Takashi Iwai   ALSA: hda - Use s...
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
  		snd_hda_apply_fixup(codec, action);
  }
  
  static void stac922x_fixup_intel_mac_gpio(struct hda_codec *codec,
  					  const struct hda_fixup *fix,
  					  int action)
  {
  	struct sigmatel_spec *spec = codec->spec;
  
  	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  		spec->gpio_mask = spec->gpio_dir = 0x03;
  		spec->gpio_data = 0x03;
  	}
  }
  
  static const struct hda_fixup stac922x_fixups[] = {
  	[STAC_D945_REF] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = ref922x_pin_configs,
  	},
  	[STAC_D945GTP3] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = d945gtp3_pin_configs,
  	},
  	[STAC_D945GTP5] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = d945gtp5_pin_configs,
  	},
  	[STAC_INTEL_MAC_AUTO] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac922x_fixup_intel_mac_auto,
  	},
  	[STAC_INTEL_MAC_V1] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = intel_mac_v1_pin_configs,
  		.chained = true,
  		.chain_id = STAC_922X_INTEL_MAC_GPIO,
  	},
  	[STAC_INTEL_MAC_V2] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = intel_mac_v2_pin_configs,
  		.chained = true,
  		.chain_id = STAC_922X_INTEL_MAC_GPIO,
  	},
  	[STAC_INTEL_MAC_V3] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = intel_mac_v3_pin_configs,
  		.chained = true,
  		.chain_id = STAC_922X_INTEL_MAC_GPIO,
  	},
  	[STAC_INTEL_MAC_V4] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = intel_mac_v4_pin_configs,
  		.chained = true,
  		.chain_id = STAC_922X_INTEL_MAC_GPIO,
  	},
  	[STAC_INTEL_MAC_V5] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = intel_mac_v5_pin_configs,
  		.chained = true,
  		.chain_id = STAC_922X_INTEL_MAC_GPIO,
  	},
  	[STAC_922X_INTEL_MAC_GPIO] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac922x_fixup_intel_mac_gpio,
  	},
  	[STAC_ECS_202] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = ecs202_pin_configs,
  	},
  	[STAC_922X_DELL_D81] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = dell_922x_d81_pin_configs,
  	},
  	[STAC_922X_DELL_D82] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = dell_922x_d82_pin_configs,
  	},
  	[STAC_922X_DELL_M81] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = dell_922x_m81_pin_configs,
  	},
  	[STAC_922X_DELL_M82] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = dell_922x_m82_pin_configs,
  	},
  };
  
  static const struct hda_model_fixup stac922x_models[] = {
  	{ .id = STAC_D945_REF, .name = "ref" },
  	{ .id = STAC_D945GTP5, .name = "5stack" },
  	{ .id = STAC_D945GTP3, .name = "3stack" },
  	{ .id = STAC_INTEL_MAC_V1, .name = "intel-mac-v1" },
  	{ .id = STAC_INTEL_MAC_V2, .name = "intel-mac-v2" },
  	{ .id = STAC_INTEL_MAC_V3, .name = "intel-mac-v3" },
  	{ .id = STAC_INTEL_MAC_V4, .name = "intel-mac-v4" },
  	{ .id = STAC_INTEL_MAC_V5, .name = "intel-mac-v5" },
  	{ .id = STAC_INTEL_MAC_AUTO, .name = "intel-mac-auto" },
  	{ .id = STAC_ECS_202, .name = "ecs202" },
  	{ .id = STAC_922X_DELL_D81, .name = "dell-d81" },
  	{ .id = STAC_922X_DELL_D82, .name = "dell-d82" },
  	{ .id = STAC_922X_DELL_M81, .name = "dell-m81" },
  	{ .id = STAC_922X_DELL_M82, .name = "dell-m82" },
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
3450
  	/* for backward compatibility */
0a4278464   Takashi Iwai   ALSA: hda - Use s...
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
  	{ .id = STAC_INTEL_MAC_V3, .name = "macmini" },
  	{ .id = STAC_INTEL_MAC_V5, .name = "macbook" },
  	{ .id = STAC_INTEL_MAC_V3, .name = "macbook-pro-v1" },
  	{ .id = STAC_INTEL_MAC_V3, .name = "macbook-pro" },
  	{ .id = STAC_INTEL_MAC_V2, .name = "imac-intel" },
  	{ .id = STAC_INTEL_MAC_V3, .name = "imac-intel-20" },
  	{}
  };
  
  static const struct snd_pci_quirk stac922x_fixup_tbl[] = {
f5fcc13c2   Takashi Iwai   [ALSA] hda-codec ...
3461
3462
3463
  	/* SigmaTel reference board */
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
  		      "DFI LanParty", STAC_D945_REF),
577aa2c19   Matthew Ranostay   ALSA: hda: add re...
3464
3465
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
  		      "DFI LanParty", STAC_D945_REF),
f5fcc13c2   Takashi Iwai   [ALSA] hda-codec ...
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
  	/* Intel 945G based systems */
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101,
  		      "Intel D945G", STAC_D945GTP3),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202,
  		      "Intel D945G", STAC_D945GTP3),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606,
  		      "Intel D945G", STAC_D945GTP3),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601,
  		      "Intel D945G", STAC_D945GTP3),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111,
  		      "Intel D945G", STAC_D945GTP3),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115,
  		      "Intel D945G", STAC_D945GTP3),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116,
  		      "Intel D945G", STAC_D945GTP3),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117,
  		      "Intel D945G", STAC_D945GTP3),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118,
  		      "Intel D945G", STAC_D945GTP3),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119,
  		      "Intel D945G", STAC_D945GTP3),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826,
  		      "Intel D945G", STAC_D945GTP3),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049,
  		      "Intel D945G", STAC_D945GTP3),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055,
  		      "Intel D945G", STAC_D945GTP3),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048,
  		      "Intel D945G", STAC_D945GTP3),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110,
  		      "Intel D945G", STAC_D945GTP3),
  	/* Intel D945G 5-stack systems */
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404,
  		      "Intel D945G", STAC_D945GTP5),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303,
  		      "Intel D945G", STAC_D945GTP5),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013,
  		      "Intel D945G", STAC_D945GTP5),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417,
  		      "Intel D945G", STAC_D945GTP5),
  	/* Intel 945P based systems */
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b,
  		      "Intel D945P", STAC_D945GTP3),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112,
  		      "Intel D945P", STAC_D945GTP3),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d,
  		      "Intel D945P", STAC_D945GTP3),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909,
  		      "Intel D945P", STAC_D945GTP3),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505,
  		      "Intel D945P", STAC_D945GTP3),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707,
  		      "Intel D945P", STAC_D945GTP5),
8056d47e7   Takashi Iwai   ALSA: hda - Add m...
3519
3520
3521
  	/* other intel */
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0204,
  		      "Intel D945", STAC_D945_REF),
f5fcc13c2   Takashi Iwai   [ALSA] hda-codec ...
3522
  	/* other systems  */
0a4278464   Takashi Iwai   ALSA: hda - Use s...
3523

536319afd   Nicolas Boichat   ALSA: Allow to fo...
3524
  	/* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */
0a4278464   Takashi Iwai   ALSA: hda - Use s...
3525
  	SND_PCI_QUIRK(0x8384, 0x7680, "Mac", STAC_INTEL_MAC_AUTO),
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
  	/* Dell systems  */
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7,
  		      "unknown Dell", STAC_922X_DELL_D81),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a9,
  		      "unknown Dell", STAC_922X_DELL_D81),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ab,
  		      "unknown Dell", STAC_922X_DELL_D81),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ac,
  		      "unknown Dell", STAC_922X_DELL_D82),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bf,
  		      "unknown Dell", STAC_922X_DELL_M81),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d0,
  		      "unknown Dell", STAC_922X_DELL_D82),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d1,
  		      "unknown Dell", STAC_922X_DELL_D81),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d2,
  		      "unknown Dell", STAC_922X_DELL_D81),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7,
  		      "Dell XPS M1210", STAC_922X_DELL_M82),
8c6500879   Mauro Carvalho Chehab   ALSA: hda: Add su...
3545
  	/* ECS/PC Chips boards */
dea0a5095   Takashi Iwai   ALSA: hda - Clean...
3546
  	SND_PCI_QUIRK_MASK(0x1019, 0xf000, 0x2000,
8663ae55f   Herton Ronaldo Krzesinski   ALSA: hda - Bind ...
3547
  		      "ECS/PC chips", STAC_ECS_202),
403d19446   Matt Porter   [ALSA] hda-codec ...
3548
3549
  	{} /* terminator */
  };
29ac83635   Takashi Iwai   ALSA: hda - Use s...
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
  static const struct hda_pintbl ref927x_pin_configs[] = {
  	{ 0x0a, 0x02214020 },
  	{ 0x0b, 0x02a19080 },
  	{ 0x0c, 0x0181304e },
  	{ 0x0d, 0x01014010 },
  	{ 0x0e, 0x01a19040 },
  	{ 0x0f, 0x01011012 },
  	{ 0x10, 0x01016011 },
  	{ 0x11, 0x0101201f },
  	{ 0x12, 0x183301f0 },
  	{ 0x13, 0x18a001f0 },
  	{ 0x14, 0x18a001f0 },
  	{ 0x21, 0x01442070 },
  	{ 0x22, 0x01c42190 },
  	{ 0x23, 0x40000100 },
  	{}
3cc08dc6e   Matt Porter   [ALSA] hda-codec ...
3566
  };
29ac83635   Takashi Iwai   ALSA: hda - Use s...
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
  static const struct hda_pintbl d965_3st_pin_configs[] = {
  	{ 0x0a, 0x0221401f },
  	{ 0x0b, 0x02a19120 },
  	{ 0x0c, 0x40000100 },
  	{ 0x0d, 0x01014011 },
  	{ 0x0e, 0x01a19021 },
  	{ 0x0f, 0x01813024 },
  	{ 0x10, 0x40000100 },
  	{ 0x11, 0x40000100 },
  	{ 0x12, 0x40000100 },
  	{ 0x13, 0x40000100 },
  	{ 0x14, 0x40000100 },
  	{ 0x21, 0x40000100 },
  	{ 0x22, 0x40000100 },
  	{ 0x23, 0x40000100 },
  	{}
81d3dbde7   Tobin Davis   [ALSA] hda-codec ...
3583
  };
29ac83635   Takashi Iwai   ALSA: hda - Use s...
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
  static const struct hda_pintbl d965_5st_pin_configs[] = {
  	{ 0x0a, 0x02214020 },
  	{ 0x0b, 0x02a19080 },
  	{ 0x0c, 0x0181304e },
  	{ 0x0d, 0x01014010 },
  	{ 0x0e, 0x01a19040 },
  	{ 0x0f, 0x01011012 },
  	{ 0x10, 0x01016011 },
  	{ 0x11, 0x40000100 },
  	{ 0x12, 0x40000100 },
  	{ 0x13, 0x40000100 },
  	{ 0x14, 0x40000100 },
  	{ 0x21, 0x01442070 },
  	{ 0x22, 0x40000100 },
  	{ 0x23, 0x40000100 },
  	{}
93ed15037   Tobin Davis   [ALSA] hda-codec ...
3600
  };
29ac83635   Takashi Iwai   ALSA: hda - Use s...
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
  static const struct hda_pintbl d965_5st_no_fp_pin_configs[] = {
  	{ 0x0a, 0x40000100 },
  	{ 0x0b, 0x40000100 },
  	{ 0x0c, 0x0181304e },
  	{ 0x0d, 0x01014010 },
  	{ 0x0e, 0x01a19040 },
  	{ 0x0f, 0x01011012 },
  	{ 0x10, 0x01016011 },
  	{ 0x11, 0x40000100 },
  	{ 0x12, 0x40000100 },
  	{ 0x13, 0x40000100 },
  	{ 0x14, 0x40000100 },
  	{ 0x21, 0x01442070 },
  	{ 0x22, 0x40000100 },
  	{ 0x23, 0x40000100 },
  	{}
679d92ed1   Takashi Iwai   ALSA: hda - Add 5...
3617
  };
29ac83635   Takashi Iwai   ALSA: hda - Use s...
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
  static const struct hda_pintbl dell_3st_pin_configs[] = {
  	{ 0x0a, 0x02211230 },
  	{ 0x0b, 0x02a11220 },
  	{ 0x0c, 0x01a19040 },
  	{ 0x0d, 0x01114210 },
  	{ 0x0e, 0x01111212 },
  	{ 0x0f, 0x01116211 },
  	{ 0x10, 0x01813050 },
  	{ 0x11, 0x01112214 },
  	{ 0x12, 0x403003fa },
  	{ 0x13, 0x90a60040 },
  	{ 0x14, 0x90a60040 },
  	{ 0x21, 0x404003fb },
  	{ 0x22, 0x40c003fc },
  	{ 0x23, 0x40000100 },
  	{}
4ff076e5d   Tobin Davis   [ALSA] hda-codec ...
3634
  };
29ac83635   Takashi Iwai   ALSA: hda - Use s...
3635
3636
3637
  static void stac927x_fixup_ref_no_jd(struct hda_codec *codec,
  				     const struct hda_fixup *fix, int action)
  {
29ac83635   Takashi Iwai   ALSA: hda - Use s...
3638
  	/* no jack detecion for ref-no-jd model */
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
3639
3640
  	if (action == HDA_FIXUP_ACT_PRE_PROBE)
  		codec->no_jack_detect = 1;
29ac83635   Takashi Iwai   ALSA: hda - Use s...
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
  }
  
  static void stac927x_fixup_ref(struct hda_codec *codec,
  			       const struct hda_fixup *fix, int action)
  {
  	struct sigmatel_spec *spec = codec->spec;
  
  	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  		snd_hda_apply_pincfgs(codec, ref927x_pin_configs);
  		spec->eapd_mask = spec->gpio_mask = 0;
  		spec->gpio_dir = spec->gpio_data = 0;
  	}
  }
  
  static void stac927x_fixup_dell_dmic(struct hda_codec *codec,
  				     const struct hda_fixup *fix, int action)
  {
  	struct sigmatel_spec *spec = codec->spec;
  
  	if (action != HDA_FIXUP_ACT_PRE_PROBE)
  		return;
  
  	if (codec->subsystem_id != 0x1028022f) {
  		/* GPIO2 High = Enable EAPD */
  		spec->eapd_mask = spec->gpio_mask = 0x04;
  		spec->gpio_dir = spec->gpio_data = 0x04;
  	}
29ac83635   Takashi Iwai   ALSA: hda - Use s...
3668
3669
3670
  
  	snd_hda_add_verbs(codec, dell_3st_core_init);
  	spec->volknob_init = 1;
29ac83635   Takashi Iwai   ALSA: hda - Use s...
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
  }
  
  static void stac927x_fixup_volknob(struct hda_codec *codec,
  				   const struct hda_fixup *fix, int action)
  {
  	struct sigmatel_spec *spec = codec->spec;
  
  	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  		snd_hda_add_verbs(codec, stac927x_volknob_core_init);
  		spec->volknob_init = 1;
  	}
  }
  
  static const struct hda_fixup stac927x_fixups[] = {
  	[STAC_D965_REF_NO_JD] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac927x_fixup_ref_no_jd,
  		.chained = true,
  		.chain_id = STAC_D965_REF,
  	},
  	[STAC_D965_REF] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac927x_fixup_ref,
  	},
  	[STAC_D965_3ST] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = d965_3st_pin_configs,
  		.chained = true,
  		.chain_id = STAC_D965_VERBS,
  	},
  	[STAC_D965_5ST] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = d965_5st_pin_configs,
  		.chained = true,
  		.chain_id = STAC_D965_VERBS,
  	},
  	[STAC_D965_VERBS] = {
  		.type = HDA_FIXUP_VERBS,
  		.v.verbs = d965_core_init,
  	},
  	[STAC_D965_5ST_NO_FP] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = d965_5st_no_fp_pin_configs,
  	},
  	[STAC_DELL_3ST] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = dell_3st_pin_configs,
  		.chained = true,
  		.chain_id = STAC_927X_DELL_DMIC,
  	},
  	[STAC_DELL_BIOS] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = (const struct hda_pintbl[]) {
29ac83635   Takashi Iwai   ALSA: hda - Use s...
3724
  			/* correct the front output jack as a hp out */
f3e351eef   Takashi Iwai   ALSA: hda - Remov...
3725
  			{ 0x0f, 0x0221101f },
29ac83635   Takashi Iwai   ALSA: hda - Use s...
3726
3727
3728
3729
3730
3731
3732
  			/* correct the front input jack as a mic */
  			{ 0x0e, 0x02a79130 },
  			{}
  		},
  		.chained = true,
  		.chain_id = STAC_927X_DELL_DMIC,
  	},
eefb8be4a   Takashi Iwai   ALSA: hda - Remov...
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
  	[STAC_DELL_BIOS_AMIC] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = (const struct hda_pintbl[]) {
  			/* configure the analog microphone on some laptops */
  			{ 0x0c, 0x90a79130 },
  			{}
  		},
  		.chained = true,
  		.chain_id = STAC_DELL_BIOS,
  	},
29ac83635   Takashi Iwai   ALSA: hda - Use s...
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
  	[STAC_DELL_BIOS_SPDIF] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = (const struct hda_pintbl[]) {
  			/* correct the device field to SPDIF out */
  			{ 0x21, 0x01442070 },
  			{}
  		},
  		.chained = true,
  		.chain_id = STAC_DELL_BIOS,
  	},
  	[STAC_927X_DELL_DMIC] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac927x_fixup_dell_dmic,
  	},
  	[STAC_927X_VOLKNOB] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac927x_fixup_volknob,
  	},
3cc08dc6e   Matt Porter   [ALSA] hda-codec ...
3761
  };
29ac83635   Takashi Iwai   ALSA: hda - Use s...
3762
3763
3764
3765
3766
3767
3768
3769
  static const struct hda_model_fixup stac927x_models[] = {
  	{ .id = STAC_D965_REF_NO_JD, .name = "ref-no-jd" },
  	{ .id = STAC_D965_REF, .name = "ref" },
  	{ .id = STAC_D965_3ST, .name = "3stack" },
  	{ .id = STAC_D965_5ST, .name = "5stack" },
  	{ .id = STAC_D965_5ST_NO_FP, .name = "5stack-no-fp" },
  	{ .id = STAC_DELL_3ST, .name = "dell-3stack" },
  	{ .id = STAC_DELL_BIOS, .name = "dell-bios" },
eefb8be4a   Takashi Iwai   ALSA: hda - Remov...
3770
  	{ .id = STAC_DELL_BIOS_AMIC, .name = "dell-bios-amic" },
29ac83635   Takashi Iwai   ALSA: hda - Use s...
3771
3772
  	{ .id = STAC_927X_VOLKNOB, .name = "volknob" },
  	{}
f5fcc13c2   Takashi Iwai   [ALSA] hda-codec ...
3773
  };
29ac83635   Takashi Iwai   ALSA: hda - Use s...
3774
  static const struct snd_pci_quirk stac927x_fixup_tbl[] = {
f5fcc13c2   Takashi Iwai   [ALSA] hda-codec ...
3775
3776
3777
  	/* SigmaTel reference board */
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
  		      "DFI LanParty", STAC_D965_REF),
577aa2c19   Matthew Ranostay   ALSA: hda: add re...
3778
3779
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
  		      "DFI LanParty", STAC_D965_REF),
81d3dbde7   Tobin Davis   [ALSA] hda-codec ...
3780
  	 /* Intel 946 based systems */
f5fcc13c2   Takashi Iwai   [ALSA] hda-codec ...
3781
3782
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xa301, "Intel D946", STAC_D965_3ST),
93ed15037   Tobin Davis   [ALSA] hda-codec ...
3783
  	/* 965 based 3 stack systems */
dea0a5095   Takashi Iwai   ALSA: hda - Clean...
3784
3785
3786
3787
  	SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2100,
  			   "Intel D965", STAC_D965_3ST),
  	SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2000,
  			   "Intel D965", STAC_D965_3ST),
4ff076e5d   Tobin Davis   [ALSA] hda-codec ...
3788
  	/* Dell 3 stack systems */
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
3789
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x01dd, "Dell Dimension E520", STAC_DELL_3ST),
4ff076e5d   Tobin Davis   [ALSA] hda-codec ...
3790
3791
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x01ed, "Dell     ", STAC_DELL_3ST),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x01f4, "Dell     ", STAC_DELL_3ST),
8e9068b1c   Matthew Ranostay   [ALSA] hda: STAC9...
3792
  	/* Dell 3 stack systems with verb table in BIOS */
2f32d909f   Matthew Ranostay   [ALSA] hda: STAC9...
3793
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS),
66668b6fb   Daniel T Chen   ALSA: hda: Fix mo...
3794
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x01f7, "Dell XPS M1730", STAC_DELL_BIOS),
2f32d909f   Matthew Ranostay   [ALSA] hda: STAC9...
3795
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x0227, "Dell Vostro 1400  ", STAC_DELL_BIOS),
29ac83635   Takashi Iwai   ALSA: hda - Use s...
3796
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x022e, "Dell     ", STAC_DELL_BIOS_SPDIF),
84d3dc200   Chengu Wang   ALSA: hda: Correc...
3797
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x022f, "Dell Inspiron 1525", STAC_DELL_BIOS),
8e9068b1c   Matthew Ranostay   [ALSA] hda: STAC9...
3798
3799
3800
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x0242, "Dell     ", STAC_DELL_BIOS),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x0243, "Dell     ", STAC_DELL_BIOS),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x02ff, "Dell     ", STAC_DELL_BIOS),
29ac83635   Takashi Iwai   ALSA: hda - Use s...
3801
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL,  0x0209, "Dell XPS 1330", STAC_DELL_BIOS_SPDIF),
93ed15037   Tobin Davis   [ALSA] hda-codec ...
3802
  	/* 965 based 5 stack systems */
dea0a5095   Takashi Iwai   ALSA: hda - Clean...
3803
3804
3805
3806
  	SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2300,
  			   "Intel D965", STAC_D965_5ST),
  	SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500,
  			   "Intel D965", STAC_D965_5ST),
54930531a   Takashi Iwai   ALSA: hda - Fix m...
3807
3808
  	/* volume-knob fixes */
  	SND_PCI_QUIRK_VENDOR(0x10cf, "FSC", STAC_927X_VOLKNOB),
3cc08dc6e   Matt Porter   [ALSA] hda-codec ...
3809
3810
  	{} /* terminator */
  };
fe6322ca6   Takashi Iwai   ALSA: hda - Use s...
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
  static const struct hda_pintbl ref9205_pin_configs[] = {
  	{ 0x0a, 0x40000100 },
  	{ 0x0b, 0x40000100 },
  	{ 0x0c, 0x01016011 },
  	{ 0x0d, 0x01014010 },
  	{ 0x0e, 0x01813122 },
  	{ 0x0f, 0x01a19021 },
  	{ 0x14, 0x01019020 },
  	{ 0x16, 0x40000100 },
  	{ 0x17, 0x90a000f0 },
  	{ 0x18, 0x90a000f0 },
  	{ 0x21, 0x01441030 },
  	{ 0x22, 0x01c41030 },
  	{}
f3302a59c   Matt Porter   [ALSA] hda: sigma...
3825
  };
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
3826
3827
3828
3829
3830
3831
3832
3833
  /*
      STAC 9205 pin configs for
      102801F1
      102801F2
      102801FC
      102801FD
      10280204
      1028021F
3fa2ef746   Matthew Ranostay   [ALSA] hda: Add n...
3834
      10280228 (Dell Vostro 1500)
95e70e875   Anisse Astier   ALSA: hda - Add S...
3835
      10280229 (Dell Vostro 1700)
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
3836
  */
fe6322ca6   Takashi Iwai   ALSA: hda - Use s...
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
  static const struct hda_pintbl dell_9205_m42_pin_configs[] = {
  	{ 0x0a, 0x0321101F },
  	{ 0x0b, 0x03A11020 },
  	{ 0x0c, 0x400003FA },
  	{ 0x0d, 0x90170310 },
  	{ 0x0e, 0x400003FB },
  	{ 0x0f, 0x400003FC },
  	{ 0x14, 0x400003FD },
  	{ 0x16, 0x40F000F9 },
  	{ 0x17, 0x90A60330 },
  	{ 0x18, 0x400003FF },
  	{ 0x21, 0x0144131F },
  	{ 0x22, 0x40C003FE },
  	{}
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
  };
  
  /*
      STAC 9205 pin configs for
      102801F9
      102801FA
      102801FE
      102801FF (Dell Precision M4300)
      10280206
      10280200
      10280201
  */
fe6322ca6   Takashi Iwai   ALSA: hda - Use s...
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
  static const struct hda_pintbl dell_9205_m43_pin_configs[] = {
  	{ 0x0a, 0x0321101f },
  	{ 0x0b, 0x03a11020 },
  	{ 0x0c, 0x90a70330 },
  	{ 0x0d, 0x90170310 },
  	{ 0x0e, 0x400000fe },
  	{ 0x0f, 0x400000ff },
  	{ 0x14, 0x400000fd },
  	{ 0x16, 0x40f000f9 },
  	{ 0x17, 0x400000fa },
  	{ 0x18, 0x400000fc },
  	{ 0x21, 0x0144131f },
  	{ 0x22, 0x40c003f8 },
  	/* Enable SPDIF in/out */
  	{ 0x1f, 0x01441030 },
  	{ 0x20, 0x1c410030 },
  	{}
ae0a8ed8b   Tobin Davis   [ALSA] This patch...
3880
  };
fe6322ca6   Takashi Iwai   ALSA: hda - Use s...
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
  static const struct hda_pintbl dell_9205_m44_pin_configs[] = {
  	{ 0x0a, 0x0421101f },
  	{ 0x0b, 0x04a11020 },
  	{ 0x0c, 0x400003fa },
  	{ 0x0d, 0x90170310 },
  	{ 0x0e, 0x400003fb },
  	{ 0x0f, 0x400003fc },
  	{ 0x14, 0x400003fd },
  	{ 0x16, 0x400003f9 },
  	{ 0x17, 0x90a60330 },
  	{ 0x18, 0x400003ff },
  	{ 0x21, 0x01441340 },
  	{ 0x22, 0x40c003fe },
  	{}
ae0a8ed8b   Tobin Davis   [ALSA] This patch...
3895
  };
fe6322ca6   Takashi Iwai   ALSA: hda - Use s...
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
  static void stac9205_fixup_ref(struct hda_codec *codec,
  			       const struct hda_fixup *fix, int action)
  {
  	struct sigmatel_spec *spec = codec->spec;
  
  	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  		snd_hda_apply_pincfgs(codec, ref9205_pin_configs);
  		/* SPDIF-In enabled */
  		spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0;
  	}
  }
fe6322ca6   Takashi Iwai   ALSA: hda - Use s...
3907
3908
3909
3910
  static void stac9205_fixup_dell_m43(struct hda_codec *codec,
  				    const struct hda_fixup *fix, int action)
  {
  	struct sigmatel_spec *spec = codec->spec;
1a4f69d5a   Takashi Iwai   ALSA: hda - Allow...
3911
  	struct hda_jack_callback *jack;
fe6322ca6   Takashi Iwai   ALSA: hda - Use s...
3912
3913
3914
3915
3916
  
  	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
  		snd_hda_apply_pincfgs(codec, dell_9205_m43_pin_configs);
  
  		/* Enable unsol response for GPIO4/Dock HP connection */
fe6322ca6   Takashi Iwai   ALSA: hda - Use s...
3917
3918
  		snd_hda_codec_write_cache(codec, codec->afg, 0,
  			AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10);
bda17b82b   Takashi Iwai   ALSA: hda - Make ...
3919
3920
3921
  		jack = snd_hda_jack_detect_enable_callback(codec, codec->afg,
  							   stac_vref_event);
  		if (!IS_ERR(jack))
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
3922
  			jack->private_data = 0x01;
fe6322ca6   Takashi Iwai   ALSA: hda - Use s...
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
  
  		spec->gpio_dir = 0x0b;
  		spec->eapd_mask = 0x01;
  		spec->gpio_mask = 0x1b;
  		spec->gpio_mute = 0x10;
  		/* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute,
  		 * GPIO3 Low = DRM
  		 */
  		spec->gpio_data = 0x01;
  	}
  }
  
  static void stac9205_fixup_eapd(struct hda_codec *codec,
  				const struct hda_fixup *fix, int action)
  {
  	struct sigmatel_spec *spec = codec->spec;
  
  	if (action == HDA_FIXUP_ACT_PRE_PROBE)
  		spec->eapd_switch = 0;
  }
  
  static const struct hda_fixup stac9205_fixups[] = {
  	[STAC_9205_REF] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac9205_fixup_ref,
  	},
  	[STAC_9205_DELL_M42] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = dell_9205_m42_pin_configs,
  	},
  	[STAC_9205_DELL_M43] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac9205_fixup_dell_m43,
  	},
  	[STAC_9205_DELL_M44] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = dell_9205_m44_pin_configs,
  	},
  	[STAC_9205_EAPD] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac9205_fixup_eapd,
  	},
  	{}
f3302a59c   Matt Porter   [ALSA] hda: sigma...
3966
  };
fe6322ca6   Takashi Iwai   ALSA: hda - Use s...
3967
3968
3969
3970
3971
3972
3973
  static const struct hda_model_fixup stac9205_models[] = {
  	{ .id = STAC_9205_REF, .name = "ref" },
  	{ .id = STAC_9205_DELL_M42, .name = "dell-m42" },
  	{ .id = STAC_9205_DELL_M43, .name = "dell-m43" },
  	{ .id = STAC_9205_DELL_M44, .name = "dell-m44" },
  	{ .id = STAC_9205_EAPD, .name = "eapd" },
  	{}
f5fcc13c2   Takashi Iwai   [ALSA] hda-codec ...
3974
  };
fe6322ca6   Takashi Iwai   ALSA: hda - Use s...
3975
  static const struct snd_pci_quirk stac9205_fixup_tbl[] = {
f5fcc13c2   Takashi Iwai   [ALSA] hda-codec ...
3976
3977
3978
  	/* SigmaTel reference board */
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
  		      "DFI LanParty", STAC_9205_REF),
02358fcfa   Herton Ronaldo Krzesinski   ALSA: hda - move ...
3979
3980
  	SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xfb30,
  		      "SigmaTel", STAC_9205_REF),
577aa2c19   Matthew Ranostay   ALSA: hda: add re...
3981
3982
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
  		      "DFI LanParty", STAC_9205_REF),
d9a4268ee   Takashi Iwai   ALSA: hda - Add q...
3983
  	/* Dell */
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
3984
3985
3986
3987
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1,
  		      "unknown Dell", STAC_9205_DELL_M42),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2,
  		      "unknown Dell", STAC_9205_DELL_M42),
ae0a8ed8b   Tobin Davis   [ALSA] This patch...
3988
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f8,
b44ef2f15   Matthew Ranostay   [ALSA] hda: More ...
3989
  		      "Dell Precision", STAC_9205_DELL_M43),
ae0a8ed8b   Tobin Davis   [ALSA] This patch...
3990
3991
3992
3993
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f9,
  		      "Dell Precision", STAC_9205_DELL_M43),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fa,
  		      "Dell Precision", STAC_9205_DELL_M43),
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
3994
3995
3996
3997
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc,
  		      "unknown Dell", STAC_9205_DELL_M42),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd,
  		      "unknown Dell", STAC_9205_DELL_M42),
ae0a8ed8b   Tobin Davis   [ALSA] This patch...
3998
3999
4000
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fe,
  		      "Dell Precision", STAC_9205_DELL_M43),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ff,
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
4001
  		      "Dell Precision M4300", STAC_9205_DELL_M43),
dfe495d0a   Takashi Iwai   [ALSA] hda-codec ...
4002
4003
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0204,
  		      "unknown Dell", STAC_9205_DELL_M42),
4549915cd   Takashi Iwai   ALSA: hda - Fix s...
4004
4005
4006
4007
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0206,
  		      "Dell Precision", STAC_9205_DELL_M43),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021b,
  		      "Dell Precision", STAC_9205_DELL_M43),
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021c,
  		      "Dell Precision", STAC_9205_DELL_M43),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021f,
  		      "Dell Inspiron", STAC_9205_DELL_M44),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228,
  		      "Dell Vostro 1500", STAC_9205_DELL_M42),
  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0229,
  		      "Dell Vostro 1700", STAC_9205_DELL_M42),
  	/* Gateway */
  	SND_PCI_QUIRK(0x107b, 0x0560, "Gateway T6834c", STAC_9205_EAPD),
  	SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD),
  	{} /* terminator */
  };
a64135a2d   Matthew Ranostay   [ALSA] hda: 92HD7...
4021

8b3dfdaf0   Takashi Iwai   ALSA: hda - Adjus...
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
  static void stac92hd95_fixup_hp_led(struct hda_codec *codec,
  				    const struct hda_fixup *fix, int action)
  {
  	struct sigmatel_spec *spec = codec->spec;
  
  	if (action != HDA_FIXUP_ACT_PRE_PROBE)
  		return;
  
  	if (find_mute_led_cfg(codec, spec->default_polarity))
  		codec_dbg(codec, "mute LED gpio %d polarity %d
  ",
  				spec->gpio_led,
  				spec->gpio_led_polarity);
  }
  
  static const struct hda_fixup stac92hd95_fixups[] = {
  	[STAC_92HD95_HP_LED] = {
  		.type = HDA_FIXUP_FUNC,
  		.v.func = stac92hd95_fixup_hp_led,
  	},
  	[STAC_92HD95_HP_BASS] = {
  		.type = HDA_FIXUP_VERBS,
  		.v.verbs = (const struct hda_verb[]) {
  			{0x1a, 0x795, 0x00}, /* HPF to 100Hz */
  			{}
  		},
  		.chained = true,
  		.chain_id = STAC_92HD95_HP_LED,
  	},
  };
  
  static const struct snd_pci_quirk stac92hd95_fixup_tbl[] = {
  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1911, "HP Spectre 13", STAC_92HD95_HP_BASS),
  	{} /* terminator */
  };
  
  static const struct hda_model_fixup stac92hd95_models[] = {
  	{ .id = STAC_92HD95_HP_LED, .name = "hp-led" },
  	{ .id = STAC_92HD95_HP_BASS, .name = "hp-bass" },
  	{}
  };
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4063
  static int stac_parse_auto_config(struct hda_codec *codec)
ab5a6ebee   Vitaliy Kulikov   ALSA: hda - Addin...
4064
4065
  {
  	struct sigmatel_spec *spec = codec->spec;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4066
  	int err;
f390dad4d   David Henningsson   ALSA: hda - Enabl...
4067
  	int flags = 0;
ab5a6ebee   Vitaliy Kulikov   ALSA: hda - Addin...
4068

f390dad4d   David Henningsson   ALSA: hda - Enabl...
4069
4070
4071
4072
  	if (spec->headset_jack)
  		flags |= HDA_PINCFG_HEADSET_MIC;
  
  	err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL, flags);
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4073
4074
  	if (err < 0)
  		return err;
ab5a6ebee   Vitaliy Kulikov   ALSA: hda - Addin...
4075

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4076
4077
4078
  	/* add hooks */
  	spec->gen.pcm_playback_hook = stac_playback_pcm_hook;
  	spec->gen.pcm_capture_hook = stac_capture_pcm_hook;
ab5a6ebee   Vitaliy Kulikov   ALSA: hda - Addin...
4079

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4080
  	spec->gen.automute_hook = stac_update_outputs;
3d21d3f7e   Takashi Iwai   ALSA: hda - Suppo...
4081

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4082
4083
4084
  	err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg);
  	if (err < 0)
  		return err;
3d21d3f7e   Takashi Iwai   ALSA: hda - Suppo...
4085

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4086
4087
4088
4089
4090
4091
  	/* setup analog beep controls */
  	if (spec->anabeep_nid > 0) {
  		err = stac_auto_create_beep_ctls(codec,
  						 spec->anabeep_nid);
  		if (err < 0)
  			return err;
3d21d3f7e   Takashi Iwai   ALSA: hda - Suppo...
4092
  	}
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4093
4094
  	/* setup digital beep controls and input device */
  #ifdef CONFIG_SND_HDA_INPUT_BEEP
7504b6cd2   Takashi Iwai   ALSA: hda - Move ...
4095
4096
  	if (spec->gen.beep_nid) {
  		hda_nid_t nid = spec->gen.beep_nid;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4097
4098
4099
4100
4101
  		unsigned int caps;
  
  		err = stac_auto_create_beep_ctls(codec, nid);
  		if (err < 0)
  			return err;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4102
4103
4104
4105
4106
4107
4108
4109
4110
  		if (codec->beep) {
  			/* IDT/STAC codecs have linear beep tone parameter */
  			codec->beep->linear_tone = spec->linear_tone_beep;
  			/* if no beep switch is available, make its own one */
  			caps = query_amp_caps(codec, nid, HDA_OUTPUT);
  			if (!(caps & AC_AMPCAP_MUTE)) {
  				err = stac_beep_switch_ctl(codec);
  				if (err < 0)
  					return err;
fd60cc897   Matthew Ranostay   ALSA: hda - Add V...
4111
4112
  			}
  		}
314634bc8   Takashi Iwai   [ALSA] hda-codec ...
4113
  	}
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4114
  #endif
314634bc8   Takashi Iwai   [ALSA] hda-codec ...
4115

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4116
4117
4118
4119
4120
4121
4122
4123
  	if (spec->gpio_led)
  		spec->gen.vmaster_mute.hook = stac_vmaster_hook;
  
  	if (spec->aloopback_ctl &&
  	    snd_hda_get_bool_hint(codec, "loopback") == 1) {
  		if (!snd_hda_gen_add_kctl(&spec->gen, NULL, spec->aloopback_ctl))
  			return -ENOMEM;
  	}
42875479b   Takashi Iwai   ALSA: hda - Reviv...
4124
4125
4126
4127
4128
  	if (spec->have_spdif_mux) {
  		err = stac_create_spdif_mux_ctls(codec);
  		if (err < 0)
  			return err;
  	}
7a9744cb4   Takashi Iwai   ALSA: hda - Fix i...
4129
  	stac_init_power_map(codec);
aa699c492   Takashi Iwai   ALSA: hda - Remov...
4130

7a9744cb4   Takashi Iwai   ALSA: hda - Fix i...
4131
4132
  	return 0;
  }
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4133
4134
  
  static int stac_init(struct hda_codec *codec)
d38cce704   Kunal Gangakhedkar   ALSA: hda - Fix m...
4135
4136
  {
  	struct sigmatel_spec *spec = codec->spec;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4137
  	int i;
07f804495   Takashi Iwai   ALSA: hda - Detec...
4138

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4139
4140
  	/* override some hints */
  	stac_store_hints(codec);
26ebe0a28   Takashi Iwai   ALSA: hda - Fix m...
4141

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4142
  	/* set up GPIO */
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4143
4144
4145
4146
  	/* turn on EAPD statically when spec->eapd_switch isn't set.
  	 * otherwise, unsol event will turn it on/off dynamically
  	 */
  	if (!spec->eapd_switch)
1ea9a69d1   Takashi Iwai   ALSA: hda - Fix E...
4147
4148
  		spec->gpio_data |= spec->eapd_mask;
  	stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data);
d38cce704   Kunal Gangakhedkar   ALSA: hda - Fix m...
4149

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4150
  	snd_hda_gen_init(codec);
c357aab02   Vitaliy Kulikov   ALSA: hda - Fix L...
4151

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4152
4153
4154
4155
4156
  	/* sync the power-map */
  	if (spec->num_pwrs)
  		snd_hda_codec_write(codec, codec->afg, 0,
  				    AC_VERB_IDT_SET_POWER_MAP,
  				    spec->power_map_bits);
0f6fcb73c   Takashi Iwai   ALSA: hda - Use s...
4157

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4158
4159
4160
4161
4162
4163
4164
4165
  	/* power down inactive ADCs */
  	if (spec->powerdown_adcs) {
  		for (i = 0; i < spec->gen.num_all_adcs; i++) {
  			if (spec->active_adcs & (1 << i))
  				continue;
  			snd_hda_codec_write(codec, spec->gen.all_adcs[i], 0,
  					    AC_VERB_SET_POWER_STATE,
  					    AC_PWRST_D3);
89bb3e74b   Takashi Iwai   ALSA: hda/sigmate...
4166
4167
  		}
  	}
c357aab02   Vitaliy Kulikov   ALSA: hda - Fix L...
4168
4169
  	return 0;
  }
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4170
  static void stac_shutup(struct hda_codec *codec)
78987bdc4   Randy Dunlap   ALSA: hda, move h...
4171
  {
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4172
4173
4174
4175
4176
4177
4178
4179
4180
  	struct sigmatel_spec *spec = codec->spec;
  
  	snd_hda_shutup_pins(codec);
  
  	if (spec->eapd_mask)
  		stac_gpio_set(codec, spec->gpio_mask,
  				spec->gpio_dir, spec->gpio_data &
  				~spec->eapd_mask);
  }
7504b6cd2   Takashi Iwai   ALSA: hda - Move ...
4181
  #define stac_free	snd_hda_gen_free
78987bdc4   Randy Dunlap   ALSA: hda, move h...
4182

2d34e1b3b   Takashi Iwai   ALSA: hda - Add I...
4183
4184
4185
4186
4187
4188
4189
  #ifdef CONFIG_PROC_FS
  static void stac92hd_proc_hook(struct snd_info_buffer *buffer,
  			       struct hda_codec *codec, hda_nid_t nid)
  {
  	if (nid == codec->afg)
  		snd_iprintf(buffer, "Power-Map: 0x%02x
  ", 
c882246d8   Takashi Iwai   ALSA: hda/idt - C...
4190
4191
  			    snd_hda_codec_read(codec, nid, 0,
  					       AC_VERB_IDT_GET_POWER_MAP, 0));
2d34e1b3b   Takashi Iwai   ALSA: hda - Add I...
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
  }
  
  static void analog_loop_proc_hook(struct snd_info_buffer *buffer,
  				  struct hda_codec *codec,
  				  unsigned int verb)
  {
  	snd_iprintf(buffer, "Analog Loopback: 0x%02x
  ",
  		    snd_hda_codec_read(codec, codec->afg, 0, verb, 0));
  }
  
  /* stac92hd71bxx, stac92hd73xx */
  static void stac92hd7x_proc_hook(struct snd_info_buffer *buffer,
  				 struct hda_codec *codec, hda_nid_t nid)
  {
  	stac92hd_proc_hook(buffer, codec, nid);
  	if (nid == codec->afg)
  		analog_loop_proc_hook(buffer, codec, 0xfa0);
  }
  
  static void stac9205_proc_hook(struct snd_info_buffer *buffer,
  			       struct hda_codec *codec, hda_nid_t nid)
  {
  	if (nid == codec->afg)
  		analog_loop_proc_hook(buffer, codec, 0xfe0);
  }
  
  static void stac927x_proc_hook(struct snd_info_buffer *buffer,
  			       struct hda_codec *codec, hda_nid_t nid)
  {
  	if (nid == codec->afg)
  		analog_loop_proc_hook(buffer, codec, 0xfeb);
  }
  #else
  #define stac92hd_proc_hook	NULL
  #define stac92hd7x_proc_hook	NULL
  #define stac9205_proc_hook	NULL
  #define stac927x_proc_hook	NULL
  #endif
2a43952a9   Takashi Iwai   ALSA: hda - Make ...
4231
  #ifdef CONFIG_PM
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4232
4233
4234
4235
4236
  static int stac_suspend(struct hda_codec *codec)
  {
  	stac_shutup(codec);
  	return 0;
  }
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4237
4238
  #else
  #define stac_suspend		NULL
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4239
  #endif /* CONFIG_PM */
7df1ce1a8   Vitaliy Kulikov   ALSA: hda - Make ...
4240

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4241
  static const struct hda_codec_ops stac_patch_ops = {
aa699c492   Takashi Iwai   ALSA: hda - Remov...
4242
  	.build_controls = snd_hda_gen_build_controls,
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4243
4244
4245
  	.build_pcms = snd_hda_gen_build_pcms,
  	.init = stac_init,
  	.free = stac_free,
29adc4b9e   David Henningsson   ALSA: hda - make ...
4246
  	.unsol_event = snd_hda_jack_unsol_event,
2a43952a9   Takashi Iwai   ALSA: hda - Make ...
4247
  #ifdef CONFIG_PM
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4248
  	.suspend = stac_suspend,
ff6fdc37f   Matt   [ALSA] hda-codec ...
4249
  #endif
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4250
  	.reboot_notify = stac_shutup,
2f2f4251c   Matt   [ALSA] add sigmat...
4251
  };
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4252
  static int alloc_stac_spec(struct hda_codec *codec)
361dab3ec   Takashi Iwai   ALSA: hda - Call ...
4253
4254
4255
4256
4257
4258
  {
  	struct sigmatel_spec *spec;
  
  	spec = kzalloc(sizeof(*spec), GFP_KERNEL);
  	if (!spec)
  		return -ENOMEM;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4259
  	snd_hda_gen_spec_init(&spec->gen);
361dab3ec   Takashi Iwai   ALSA: hda - Call ...
4260
4261
  	codec->spec = spec;
  	codec->no_trigger_sense = 1; /* seems common with STAC/IDT codecs */
d89c6c0c9   Takashi Iwai   ALSA: hda - Add T...
4262
  	spec->gen.dac_min_mute = true;
361dab3ec   Takashi Iwai   ALSA: hda - Call ...
4263
4264
  	return 0;
  }
2f2f4251c   Matt   [ALSA] add sigmat...
4265
4266
4267
  static int patch_stac9200(struct hda_codec *codec)
  {
  	struct sigmatel_spec *spec;
c7d4b2fa3   Matt   [ALSA] hda-codec ...
4268
  	int err;
2f2f4251c   Matt   [ALSA] add sigmat...
4269

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4270
  	err = alloc_stac_spec(codec);
361dab3ec   Takashi Iwai   ALSA: hda - Call ...
4271
4272
  	if (err < 0)
  		return err;
2f2f4251c   Matt   [ALSA] add sigmat...
4273

361dab3ec   Takashi Iwai   ALSA: hda - Call ...
4274
  	spec = codec->spec;
1b0e372d7   Daniel J Blueman   ALSA: hda - Fix b...
4275
  	spec->linear_tone_beep = 1;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4276
  	spec->gen.own_eapd_ctl = 1;
d39a3ae82   Takashi Iwai   ALSA: hda - Use s...
4277

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4278
  	codec->patch_ops = stac_patch_ops;
ba615b86d   Takashi Iwai   ALSA: hda - Don't...
4279
  	codec->power_filter = snd_hda_codec_eapd_power_filter;
2f2f4251c   Matt   [ALSA] add sigmat...
4280

d39a3ae82   Takashi Iwai   ALSA: hda - Use s...
4281
  	snd_hda_add_verbs(codec, stac9200_eapd_init);
c7d4b2fa3   Matt   [ALSA] hda-codec ...
4282

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4283
4284
  	snd_hda_pick_fixup(codec, stac9200_models, stac9200_fixup_tbl,
  			   stac9200_fixups);
d39a3ae82   Takashi Iwai   ALSA: hda - Use s...
4285
  	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
117f257d7   Takashi Iwai   [ALSA] hda-codec ...
4286

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4287
  	err = stac_parse_auto_config(codec);
c7d4b2fa3   Matt   [ALSA] hda-codec ...
4288
  	if (err < 0) {
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4289
  		stac_free(codec);
c7d4b2fa3   Matt   [ALSA] hda-codec ...
4290
4291
  		return err;
  	}
2f2f4251c   Matt   [ALSA] add sigmat...
4292

d39a3ae82   Takashi Iwai   ALSA: hda - Use s...
4293
  	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2f2f4251c   Matt   [ALSA] add sigmat...
4294
4295
  	return 0;
  }
8e21c34cd   Tobin Davis   [ALSA] hda-codec ...
4296
4297
4298
4299
  static int patch_stac925x(struct hda_codec *codec)
  {
  	struct sigmatel_spec *spec;
  	int err;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4300
  	err = alloc_stac_spec(codec);
361dab3ec   Takashi Iwai   ALSA: hda - Call ...
4301
4302
  	if (err < 0)
  		return err;
8e21c34cd   Tobin Davis   [ALSA] hda-codec ...
4303

361dab3ec   Takashi Iwai   ALSA: hda - Call ...
4304
  	spec = codec->spec;
1b0e372d7   Daniel J Blueman   ALSA: hda - Fix b...
4305
  	spec->linear_tone_beep = 1;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4306
  	spec->gen.own_eapd_ctl = 1;
9cb36c2af   Mauro Carvalho Chehab   ALSA: patch_sigma...
4307

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4308
  	codec->patch_ops = stac_patch_ops;
8e21c34cd   Tobin Davis   [ALSA] hda-codec ...
4309

d2077d40c   Takashi Iwai   ALSA: hda - Use s...
4310
  	snd_hda_add_verbs(codec, stac925x_core_init);
8e21c34cd   Tobin Davis   [ALSA] hda-codec ...
4311

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4312
4313
  	snd_hda_pick_fixup(codec, stac925x_models, stac925x_fixup_tbl,
  			   stac925x_fixups);
d2077d40c   Takashi Iwai   ALSA: hda - Use s...
4314
  	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4315
  	err = stac_parse_auto_config(codec);
8e21c34cd   Tobin Davis   [ALSA] hda-codec ...
4316
  	if (err < 0) {
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4317
  		stac_free(codec);
8e21c34cd   Tobin Davis   [ALSA] hda-codec ...
4318
4319
  		return err;
  	}
d2077d40c   Takashi Iwai   ALSA: hda - Use s...
4320
  	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
8e21c34cd   Tobin Davis   [ALSA] hda-codec ...
4321
4322
  	return 0;
  }
e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
4323
4324
4325
  static int patch_stac92hd73xx(struct hda_codec *codec)
  {
  	struct sigmatel_spec *spec;
361dab3ec   Takashi Iwai   ALSA: hda - Call ...
4326
  	int err;
c21ca4a87   Takashi Iwai   ALSA: hda - Rewor...
4327
  	int num_dacs;
e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
4328

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4329
  	err = alloc_stac_spec(codec);
361dab3ec   Takashi Iwai   ALSA: hda - Call ...
4330
4331
  	if (err < 0)
  		return err;
e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
4332

361dab3ec   Takashi Iwai   ALSA: hda - Call ...
4333
  	spec = codec->spec;
1b0e372d7   Daniel J Blueman   ALSA: hda - Fix b...
4334
  	spec->linear_tone_beep = 0;
2748746f4   Takashi Iwai   ALSA: hda - Add a...
4335
  	spec->gen.mixer_nid = 0x1d;
42875479b   Takashi Iwai   ALSA: hda - Reviv...
4336
  	spec->have_spdif_mux = 1;
e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
4337

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4338
  	num_dacs = snd_hda_get_num_conns(codec, 0x0a) - 1;
c21ca4a87   Takashi Iwai   ALSA: hda - Rewor...
4339
  	if (num_dacs < 3 || num_dacs > 5) {
4e76a8833   Takashi Iwai   ALSA: hda - Repla...
4340
4341
4342
  		codec_warn(codec,
  			   "Could not determine number of channels defaulting to DAC count
  ");
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4343
  		num_dacs = 5;
e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
4344
  	}
55e30141d   Takashi Iwai   ALSA: hda - Use s...
4345

c21ca4a87   Takashi Iwai   ALSA: hda - Rewor...
4346
  	switch (num_dacs) {
e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
4347
  	case 0x3: /* 6 Channel */
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4348
  		spec->aloopback_ctl = &stac92hd73xx_6ch_loopback;
e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
4349
4350
  		break;
  	case 0x4: /* 8 Channel */
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4351
  		spec->aloopback_ctl = &stac92hd73xx_8ch_loopback;
e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
4352
4353
  		break;
  	case 0x5: /* 10 Channel */
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4354
  		spec->aloopback_ctl = &stac92hd73xx_10ch_loopback;
d78d7a90a   Takashi Iwai   ALSA: hda - Creat...
4355
  		break;
c21ca4a87   Takashi Iwai   ALSA: hda - Rewor...
4356
  	}
e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
4357

e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
4358
4359
  	spec->aloopback_mask = 0x01;
  	spec->aloopback_shift = 8;
7504b6cd2   Takashi Iwai   ALSA: hda - Move ...
4360
  	spec->gen.beep_nid = 0x1c; /* digital beep */
6479c6318   Takashi Iwai   ALSA: hda - Creat...
4361

55e30141d   Takashi Iwai   ALSA: hda - Use s...
4362
4363
4364
  	/* GPIO0 High = Enable EAPD */
  	spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
  	spec->gpio_data = 0x01;
6b3ab21ef   Matthew Ranostay   ALSA: hda: make a...
4365

55e30141d   Takashi Iwai   ALSA: hda - Use s...
4366
  	spec->eapd_switch = 1;
a76626401   Matthew Ranostay   [ALSA] hda: 92HDx...
4367

a64135a2d   Matthew Ranostay   [ALSA] hda: 92HD7...
4368
4369
  	spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids);
  	spec->pwr_nids = stac92hd73xx_pwr_nids;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4370
  	spec->gen.own_eapd_ctl = 1;
f4f678d22   Takashi Iwai   ALSA: hda - Enabl...
4371
  	spec->gen.power_down_unused = 1;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4372
4373
4374
4375
4376
  
  	codec->patch_ops = stac_patch_ops;
  
  	snd_hda_pick_fixup(codec, stac92hd73xx_models, stac92hd73xx_fixup_tbl,
  			   stac92hd73xx_fixups);
55e30141d   Takashi Iwai   ALSA: hda - Use s...
4377
4378
4379
4380
  	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  
  	if (!spec->volknob_init)
  		snd_hda_add_verbs(codec, stac92hd73xx_core_init);
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4381
  	err = stac_parse_auto_config(codec);
e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
4382
  	if (err < 0) {
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4383
  		stac_free(codec);
e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
4384
4385
  		return err;
  	}
303985f81   David Henningsson   ALSA: hda - Disab...
4386
4387
4388
4389
4390
  	/* Don't GPIO-mute speakers if there are no internal speakers, because
  	 * the GPIO might be necessary for Headphone
  	 */
  	if (spec->eapd_switch && !has_builtin_speaker(codec))
  		spec->eapd_switch = 0;
2d34e1b3b   Takashi Iwai   ALSA: hda - Add I...
4391
  	codec->proc_widget_hook = stac92hd7x_proc_hook;
55e30141d   Takashi Iwai   ALSA: hda - Use s...
4392
  	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
4393
4394
  	return 0;
  }
372f8c750   Takashi Iwai   ALSA: hda - Use s...
4395
4396
4397
  static void stac_setup_gpio(struct hda_codec *codec)
  {
  	struct sigmatel_spec *spec = codec->spec;
1ea9a69d1   Takashi Iwai   ALSA: hda - Fix E...
4398
  	spec->gpio_mask |= spec->eapd_mask;
372f8c750   Takashi Iwai   ALSA: hda - Use s...
4399
4400
4401
4402
4403
4404
  	if (spec->gpio_led) {
  		if (!spec->vref_mute_led_nid) {
  			spec->gpio_mask |= spec->gpio_led;
  			spec->gpio_dir |= spec->gpio_led;
  			spec->gpio_data |= spec->gpio_led;
  		} else {
dfc6e469b   Takashi Iwai   ALSA: hda - Apply...
4405
  			codec->power_filter = stac_vref_led_power_filter;
372f8c750   Takashi Iwai   ALSA: hda - Use s...
4406
4407
4408
4409
4410
4411
  		}
  	}
  
  	if (spec->mic_mute_led_gpio) {
  		spec->gpio_mask |= spec->mic_mute_led_gpio;
  		spec->gpio_dir |= spec->mic_mute_led_gpio;
7fe307117   Takashi Iwai   ALSA: hda - Fix i...
4412
  		spec->mic_enabled = 0;
372f8c750   Takashi Iwai   ALSA: hda - Use s...
4413
  		spec->gpio_data |= spec->mic_mute_led_gpio;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4414

a90229e05   Takashi Iwai   ALSA: hda - Conso...
4415
  		spec->gen.cap_sync_hook = stac_capture_led_hook;
372f8c750   Takashi Iwai   ALSA: hda - Use s...
4416
4417
  	}
  }
d0513fc6c   Matthew Ranostay   ALSA: hda: added ...
4418
4419
4420
4421
  static int patch_stac92hd83xxx(struct hda_codec *codec)
  {
  	struct sigmatel_spec *spec;
  	int err;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4422
  	err = alloc_stac_spec(codec);
361dab3ec   Takashi Iwai   ALSA: hda - Call ...
4423
4424
  	if (err < 0)
  		return err;
d0513fc6c   Matthew Ranostay   ALSA: hda: added ...
4425

c36b5b054   Takashi Iwai   ALSA: hda - Don't...
4426
  	codec->epss = 0; /* longer delay needed for D3 */
699d89956   Vitaliy Kulikov   ALSA: hda - pin-a...
4427

361dab3ec   Takashi Iwai   ALSA: hda - Call ...
4428
  	spec = codec->spec;
1db7ccdb2   Takashi Iwai   ALSA: hda - Fix b...
4429
  	spec->linear_tone_beep = 0;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4430
  	spec->gen.own_eapd_ctl = 1;
f4f678d22   Takashi Iwai   ALSA: hda - Enabl...
4431
  	spec->gen.power_down_unused = 1;
2748746f4   Takashi Iwai   ALSA: hda - Add a...
4432
  	spec->gen.mixer_nid = 0x1b;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4433

7504b6cd2   Takashi Iwai   ALSA: hda - Move ...
4434
  	spec->gen.beep_nid = 0x21; /* digital beep */
d0513fc6c   Matthew Ranostay   ALSA: hda: added ...
4435
  	spec->pwr_nids = stac92hd83xxx_pwr_nids;
d0513fc6c   Matthew Ranostay   ALSA: hda: added ...
4436
  	spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids);
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4437
  	spec->default_polarity = -1; /* no default cfg */
d0513fc6c   Matthew Ranostay   ALSA: hda: added ...
4438

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4439
  	codec->patch_ops = stac_patch_ops;
b4e818768   Takashi Iwai   ALSA: hda - Fix m...
4440

372f8c750   Takashi Iwai   ALSA: hda - Use s...
4441
  	snd_hda_add_verbs(codec, stac92hd83xxx_core_init);
e108c7b79   Vitaliy Kulikov   ALSA: hda - Add m...
4442

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4443
4444
  	snd_hda_pick_fixup(codec, stac92hd83xxx_models, stac92hd83xxx_fixup_tbl,
  			   stac92hd83xxx_fixups);
372f8c750   Takashi Iwai   ALSA: hda - Use s...
4445
  	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
b4e818768   Takashi Iwai   ALSA: hda - Fix m...
4446

372f8c750   Takashi Iwai   ALSA: hda - Use s...
4447
  	stac_setup_gpio(codec);
62cbde186   Takashi Iwai   ALSA: hda - Add m...
4448

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4449
  	err = stac_parse_auto_config(codec);
d0513fc6c   Matthew Ranostay   ALSA: hda: added ...
4450
  	if (err < 0) {
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4451
  		stac_free(codec);
d0513fc6c   Matthew Ranostay   ALSA: hda: added ...
4452
4453
  		return err;
  	}
2d34e1b3b   Takashi Iwai   ALSA: hda - Add I...
4454
  	codec->proc_widget_hook = stac92hd_proc_hook;
372f8c750   Takashi Iwai   ALSA: hda - Use s...
4455
  	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
d0513fc6c   Matthew Ranostay   ALSA: hda: added ...
4456
4457
  	return 0;
  }
4e637c6e0   Vitaliy Kulikov   ALSA: hda - add s...
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
  static const hda_nid_t stac92hd95_pwr_nids[] = {
  	0x0a, 0x0b, 0x0c, 0x0d
  };
  
  static int patch_stac92hd95(struct hda_codec *codec)
  {
  	struct sigmatel_spec *spec;
  	int err;
  
  	err = alloc_stac_spec(codec);
  	if (err < 0)
  		return err;
  
  	codec->epss = 0; /* longer delay needed for D3 */
  
  	spec = codec->spec;
  	spec->linear_tone_beep = 0;
  	spec->gen.own_eapd_ctl = 1;
  	spec->gen.power_down_unused = 1;
7504b6cd2   Takashi Iwai   ALSA: hda - Move ...
4477
  	spec->gen.beep_nid = 0x19; /* digital beep */
4e637c6e0   Vitaliy Kulikov   ALSA: hda - add s...
4478
4479
  	spec->pwr_nids = stac92hd95_pwr_nids;
  	spec->num_pwrs = ARRAY_SIZE(stac92hd95_pwr_nids);
8b3dfdaf0   Takashi Iwai   ALSA: hda - Adjus...
4480
  	spec->default_polarity = 0;
4e637c6e0   Vitaliy Kulikov   ALSA: hda - add s...
4481
4482
  
  	codec->patch_ops = stac_patch_ops;
8b3dfdaf0   Takashi Iwai   ALSA: hda - Adjus...
4483
4484
4485
4486
4487
  	snd_hda_pick_fixup(codec, stac92hd95_models, stac92hd95_fixup_tbl,
  			   stac92hd95_fixups);
  	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  
  	stac_setup_gpio(codec);
4e637c6e0   Vitaliy Kulikov   ALSA: hda - add s...
4488
4489
4490
4491
4492
4493
4494
  	err = stac_parse_auto_config(codec);
  	if (err < 0) {
  		stac_free(codec);
  		return err;
  	}
  
  	codec->proc_widget_hook = stac92hd_proc_hook;
8b3dfdaf0   Takashi Iwai   ALSA: hda - Adjus...
4495
  	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
4e637c6e0   Vitaliy Kulikov   ALSA: hda - add s...
4496
4497
  	return 0;
  }
e035b8410   Matthew Ranostay   [ALSA] hda: Added...
4498
4499
4500
  static int patch_stac92hd71bxx(struct hda_codec *codec)
  {
  	struct sigmatel_spec *spec;
2b63536f0   Takashi Iwai   ALSA: hda - Const...
4501
  	const struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init;
361dab3ec   Takashi Iwai   ALSA: hda - Call ...
4502
  	int err;
e035b8410   Matthew Ranostay   [ALSA] hda: Added...
4503

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4504
  	err = alloc_stac_spec(codec);
361dab3ec   Takashi Iwai   ALSA: hda - Call ...
4505
4506
  	if (err < 0)
  		return err;
e035b8410   Matthew Ranostay   [ALSA] hda: Added...
4507

361dab3ec   Takashi Iwai   ALSA: hda - Call ...
4508
  	spec = codec->spec;
1b0e372d7   Daniel J Blueman   ALSA: hda - Fix b...
4509
  	spec->linear_tone_beep = 0;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4510
  	spec->gen.own_eapd_ctl = 1;
f4f678d22   Takashi Iwai   ALSA: hda - Enabl...
4511
  	spec->gen.power_down_unused = 1;
2748746f4   Takashi Iwai   ALSA: hda - Add a...
4512
  	spec->gen.mixer_nid = 0x17;
42875479b   Takashi Iwai   ALSA: hda - Reviv...
4513
  	spec->have_spdif_mux = 1;
e035b8410   Matthew Ranostay   [ALSA] hda: Added...
4514

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4515
  	codec->patch_ops = stac_patch_ops;
0f6fcb73c   Takashi Iwai   ALSA: hda - Use s...
4516
4517
4518
4519
4520
  
  	/* GPIO0 = EAPD */
  	spec->gpio_mask = 0x01;
  	spec->gpio_dir = 0x01;
  	spec->gpio_data = 0x01;
41c3b648b   Takashi Iwai   ALSA: hda - Fix G...
4521

541eee876   Matthew Ranostay   [ALSA] hda: Added...
4522
4523
4524
  	switch (codec->vendor_id) {
  	case 0x111d76b6: /* 4 Port without Analog Mixer */
  	case 0x111d76b7:
23c7b521c   Herton Ronaldo Krzesinski   ALSA: hda - Don't...
4525
  		unmute_init++;
541eee876   Matthew Ranostay   [ALSA] hda: Added...
4526
  		break;
aafc4412b   Matthew Ranostay   ALSA: hda: Add su...
4527
  	case 0x111d7608: /* 5 Port with Analog Mixer */
8daaaa97d   Matthew Ranostay   ALSA: hda: 92HD75...
4528
  		if ((codec->revision_id & 0xf) == 0 ||
8c2f767bf   Takashi Iwai   ALSA: hda - Remov...
4529
  		    (codec->revision_id & 0xf) == 1)
8daaaa97d   Matthew Ranostay   ALSA: hda: 92HD75...
4530
  			spec->stream_delay = 40; /* 40 milliseconds */
8daaaa97d   Matthew Ranostay   ALSA: hda: 92HD75...
4531

aafc4412b   Matthew Ranostay   ALSA: hda: Add su...
4532
  		/* disable VSW */
ca8d33fc9   Matthew Ranostay   ALSA: hda: 92hd71...
4533
  		unmute_init++;
330ee9957   Takashi Iwai   ALSA: hda - Remov...
4534
4535
  		snd_hda_codec_set_pincfg(codec, 0x0f, 0x40f000f0);
  		snd_hda_codec_set_pincfg(codec, 0x19, 0x40f000f3);
aafc4412b   Matthew Ranostay   ALSA: hda: Add su...
4536
4537
  		break;
  	case 0x111d7603: /* 6 Port with Analog Mixer */
8c2f767bf   Takashi Iwai   ALSA: hda - Remov...
4538
  		if ((codec->revision_id & 0xf) == 1)
8daaaa97d   Matthew Ranostay   ALSA: hda: 92HD75...
4539
  			spec->stream_delay = 40; /* 40 milliseconds */
8daaaa97d   Matthew Ranostay   ALSA: hda: 92HD75...
4540

5207e10ed   Takashi Iwai   ALSA: hda - Integ...
4541
  		break;
541eee876   Matthew Ranostay   [ALSA] hda: Added...
4542
  	}
5e68fb3ca   David Henningsson   ALSA: hda - Don't...
4543
  	if (get_wcaps_type(get_wcaps(codec, 0x28)) == AC_WID_VOL_KNB)
0f6fcb73c   Takashi Iwai   ALSA: hda - Use s...
4544
  		snd_hda_add_verbs(codec, stac92hd71bxx_core_init);
5e68fb3ca   David Henningsson   ALSA: hda - Don't...
4545

ca8d33fc9   Matthew Ranostay   ALSA: hda: 92hd71...
4546
4547
  	if (get_wcaps(codec, 0xa) & AC_WCAP_IN_AMP)
  		snd_hda_sequence_write_cache(codec, unmute_init);
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4548
  	spec->aloopback_ctl = &stac92hd71bxx_loopback;
4b33c7675   Matthew Ranostay   ALSA: hda: add mi...
4549
  	spec->aloopback_mask = 0x50;
541eee876   Matthew Ranostay   [ALSA] hda: Added...
4550
  	spec->aloopback_shift = 0;
8daaaa97d   Matthew Ranostay   ALSA: hda: 92HD75...
4551
  	spec->powerdown_adcs = 1;
7504b6cd2   Takashi Iwai   ALSA: hda - Move ...
4552
  	spec->gen.beep_nid = 0x26; /* digital beep */
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4553
  	spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids);
aafc4412b   Matthew Ranostay   ALSA: hda: Add su...
4554
  	spec->pwr_nids = stac92hd71bxx_pwr_nids;
e035b8410   Matthew Ranostay   [ALSA] hda: Added...
4555

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4556
4557
  	snd_hda_pick_fixup(codec, stac92hd71bxx_models, stac92hd71bxx_fixup_tbl,
  			   stac92hd71bxx_fixups);
0f6fcb73c   Takashi Iwai   ALSA: hda - Use s...
4558
  	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
5bdaaada1   Vitaliy Kulikov   ALSA: hda - Enabl...
4559

372f8c750   Takashi Iwai   ALSA: hda - Use s...
4560
  	stac_setup_gpio(codec);
6a14f5851   Matthew Ranostay   ALSA: hda: Added ...
4561

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4562
  	err = stac_parse_auto_config(codec);
e035b8410   Matthew Ranostay   [ALSA] hda: Added...
4563
  	if (err < 0) {
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4564
  		stac_free(codec);
e035b8410   Matthew Ranostay   [ALSA] hda: Added...
4565
4566
  		return err;
  	}
2d34e1b3b   Takashi Iwai   ALSA: hda - Add I...
4567
  	codec->proc_widget_hook = stac92hd7x_proc_hook;
0f6fcb73c   Takashi Iwai   ALSA: hda - Use s...
4568
  	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
e035b8410   Matthew Ranostay   [ALSA] hda: Added...
4569
  	return 0;
86d190e77   Takashi Iwai   ALSA: hda - Minor...
4570
  }
e035b8410   Matthew Ranostay   [ALSA] hda: Added...
4571

2f2f4251c   Matt   [ALSA] add sigmat...
4572
4573
4574
  static int patch_stac922x(struct hda_codec *codec)
  {
  	struct sigmatel_spec *spec;
c7d4b2fa3   Matt   [ALSA] hda-codec ...
4575
  	int err;
2f2f4251c   Matt   [ALSA] add sigmat...
4576

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4577
  	err = alloc_stac_spec(codec);
361dab3ec   Takashi Iwai   ALSA: hda - Call ...
4578
4579
  	if (err < 0)
  		return err;
2f2f4251c   Matt   [ALSA] add sigmat...
4580

361dab3ec   Takashi Iwai   ALSA: hda - Call ...
4581
  	spec = codec->spec;
1b0e372d7   Daniel J Blueman   ALSA: hda - Fix b...
4582
  	spec->linear_tone_beep = 1;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4583
  	spec->gen.own_eapd_ctl = 1;
5d5d3bc3e   Ivan N. Zlatev   [ALSA] hda-codec ...
4584

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4585
  	codec->patch_ops = stac_patch_ops;
c7d4b2fa3   Matt   [ALSA] hda-codec ...
4586

0a4278464   Takashi Iwai   ALSA: hda - Use s...
4587
  	snd_hda_add_verbs(codec, stac922x_core_init);
807a46360   Takashi Iwai   [ALSA] hda-codec ...
4588
4589
4590
4591
4592
4593
  	/* Fix Mux capture level; max to 2 */
  	snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
  				  (0 << AC_AMPCAP_OFFSET_SHIFT) |
  				  (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
  				  (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
  				  (0 << AC_AMPCAP_MUTE_SHIFT));
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4594
4595
4596
4597
4598
4599
4600
4601
4602
  	snd_hda_pick_fixup(codec, stac922x_models, stac922x_fixup_tbl,
  			   stac922x_fixups);
  	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
  
  	err = stac_parse_auto_config(codec);
  	if (err < 0) {
  		stac_free(codec);
  		return err;
  	}
0a4278464   Takashi Iwai   ALSA: hda - Use s...
4603
  	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
3cc08dc6e   Matt Porter   [ALSA] hda-codec ...
4604
4605
  	return 0;
  }
42875479b   Takashi Iwai   ALSA: hda - Reviv...
4606
4607
4608
4609
  static const char * const stac927x_spdif_labels[] = {
  	"Digital Playback", "ADAT", "Analog Mux 1",
  	"Analog Mux 2", "Analog Mux 3", NULL
  };
3cc08dc6e   Matt Porter   [ALSA] hda-codec ...
4610
4611
4612
4613
  static int patch_stac927x(struct hda_codec *codec)
  {
  	struct sigmatel_spec *spec;
  	int err;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4614
  	err = alloc_stac_spec(codec);
361dab3ec   Takashi Iwai   ALSA: hda - Call ...
4615
4616
  	if (err < 0)
  		return err;
3cc08dc6e   Matt Porter   [ALSA] hda-codec ...
4617

361dab3ec   Takashi Iwai   ALSA: hda - Call ...
4618
  	spec = codec->spec;
1b0e372d7   Daniel J Blueman   ALSA: hda - Fix b...
4619
  	spec->linear_tone_beep = 1;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4620
  	spec->gen.own_eapd_ctl = 1;
42875479b   Takashi Iwai   ALSA: hda - Reviv...
4621
4622
  	spec->have_spdif_mux = 1;
  	spec->spdif_labels = stac927x_spdif_labels;
3cc08dc6e   Matt Porter   [ALSA] hda-codec ...
4623

7504b6cd2   Takashi Iwai   ALSA: hda - Move ...
4624
  	spec->gen.beep_nid = 0x23; /* digital beep */
8e9068b1c   Matthew Ranostay   [ALSA] hda: STAC9...
4625

29ac83635   Takashi Iwai   ALSA: hda - Use s...
4626
4627
4628
  	/* GPIO0 High = Enable EAPD */
  	spec->eapd_mask = spec->gpio_mask = 0x01;
  	spec->gpio_dir = spec->gpio_data = 0x01;
af6ee3020   Takashi Iwai   ALSA: hda - Set d...
4629

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4630
  	spec->aloopback_ctl = &stac927x_loopback;
e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
4631
4632
  	spec->aloopback_mask = 0x40;
  	spec->aloopback_shift = 0;
c0cea0d09   Matthew Ranostay   ALSA: hda: STAC_D...
4633
  	spec->eapd_switch = 1;
8e9068b1c   Matthew Ranostay   [ALSA] hda: STAC9...
4634

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4635
4636
4637
4638
  	codec->patch_ops = stac_patch_ops;
  
  	snd_hda_pick_fixup(codec, stac927x_models, stac927x_fixup_tbl,
  			   stac927x_fixups);
f6655d52a   Takashi Iwai   ALSA: hda - Minor...
4639
  	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
29ac83635   Takashi Iwai   ALSA: hda - Use s...
4640
4641
  	if (!spec->volknob_init)
  		snd_hda_add_verbs(codec, stac927x_core_init);
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4642
  	err = stac_parse_auto_config(codec);
c7d4b2fa3   Matt   [ALSA] hda-codec ...
4643
  	if (err < 0) {
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4644
  		stac_free(codec);
c7d4b2fa3   Matt   [ALSA] hda-codec ...
4645
4646
  		return err;
  	}
2f2f4251c   Matt   [ALSA] add sigmat...
4647

2d34e1b3b   Takashi Iwai   ALSA: hda - Add I...
4648
  	codec->proc_widget_hook = stac927x_proc_hook;
52987656f   Takashi Iwai   [ALSA] hda-intel ...
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
  	/*
  	 * !!FIXME!!
  	 * The STAC927x seem to require fairly long delays for certain
  	 * command sequences.  With too short delays (even if the answer
  	 * is set to RIRB properly), it results in the silence output
  	 * on some hardwares like Dell.
  	 *
  	 * The below flag enables the longer delay (see get_response
  	 * in hda_intel.c).
  	 */
  	codec->bus->needs_damn_long_delay = 1;
29ac83635   Takashi Iwai   ALSA: hda - Use s...
4660
  	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
e28d83223   Takashi Iwai   ALSA: hda - Fix s...
4661

2f2f4251c   Matt   [ALSA] add sigmat...
4662
4663
  	return 0;
  }
f3302a59c   Matt Porter   [ALSA] hda: sigma...
4664
4665
4666
  static int patch_stac9205(struct hda_codec *codec)
  {
  	struct sigmatel_spec *spec;
8259980eb   Takashi Iwai   [ALSA] hda-codec ...
4667
  	int err;
f3302a59c   Matt Porter   [ALSA] hda: sigma...
4668

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4669
  	err = alloc_stac_spec(codec);
361dab3ec   Takashi Iwai   ALSA: hda - Call ...
4670
4671
  	if (err < 0)
  		return err;
f3302a59c   Matt Porter   [ALSA] hda: sigma...
4672

361dab3ec   Takashi Iwai   ALSA: hda - Call ...
4673
  	spec = codec->spec;
1b0e372d7   Daniel J Blueman   ALSA: hda - Fix b...
4674
  	spec->linear_tone_beep = 1;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4675
  	spec->gen.own_eapd_ctl = 1;
42875479b   Takashi Iwai   ALSA: hda - Reviv...
4676
  	spec->have_spdif_mux = 1;
f3302a59c   Matt Porter   [ALSA] hda: sigma...
4677

7504b6cd2   Takashi Iwai   ALSA: hda - Move ...
4678
  	spec->gen.beep_nid = 0x23; /* digital beep */
f3302a59c   Matt Porter   [ALSA] hda: sigma...
4679

fe6322ca6   Takashi Iwai   ALSA: hda - Use s...
4680
  	snd_hda_add_verbs(codec, stac9205_core_init);
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4681
  	spec->aloopback_ctl = &stac9205_loopback;
6479c6318   Takashi Iwai   ALSA: hda - Creat...
4682

e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
4683
4684
  	spec->aloopback_mask = 0x40;
  	spec->aloopback_shift = 0;
87d483630   Matthew Ranostay   [ALSA] hda: Enabl...
4685
  	
fe6322ca6   Takashi Iwai   ALSA: hda - Use s...
4686
4687
4688
  	/* GPIO0 High = EAPD */
  	spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
  	spec->gpio_data = 0x01;
87d483630   Matthew Ranostay   [ALSA] hda: Enabl...
4689

fe6322ca6   Takashi Iwai   ALSA: hda - Use s...
4690
4691
  	/* Turn on/off EAPD per HP plugging */
  	spec->eapd_switch = 1;
4fe5195c4   Matthew Ranostay   [ALSA] hda: Add G...
4692

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4693
4694
4695
4696
  	codec->patch_ops = stac_patch_ops;
  
  	snd_hda_pick_fixup(codec, stac9205_models, stac9205_fixup_tbl,
  			   stac9205_fixups);
fe6322ca6   Takashi Iwai   ALSA: hda - Use s...
4697
  	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
333824034   Matt Porter   [ALSA] hda: add s...
4698

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4699
  	err = stac_parse_auto_config(codec);
f3302a59c   Matt Porter   [ALSA] hda: sigma...
4700
  	if (err < 0) {
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4701
  		stac_free(codec);
f3302a59c   Matt Porter   [ALSA] hda: sigma...
4702
4703
  		return err;
  	}
2d34e1b3b   Takashi Iwai   ALSA: hda - Add I...
4704
  	codec->proc_widget_hook = stac9205_proc_hook;
fe6322ca6   Takashi Iwai   ALSA: hda - Use s...
4705
  	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
f3302a59c   Matt Porter   [ALSA] hda: sigma...
4706
4707
  	return 0;
  }
2f2f4251c   Matt   [ALSA] add sigmat...
4708
  /*
6d8590650   Guillaume Munch   [ALSA] hda-codec ...
4709
   * STAC9872 hack
db064e503   Takashi Iwai   [ALSA] hda-codec ...
4710
   */
2b63536f0   Takashi Iwai   ALSA: hda - Const...
4711
  static const struct hda_verb stac9872_core_init[] = {
1624cb9a3   Takashi Iwai   [ALSA] hda-codec ...
4712
  	{0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
6d8590650   Guillaume Munch   [ALSA] hda-codec ...
4713
4714
4715
  	{0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
  	{}
  };
fc268c10c   Takashi Iwai   ALSA: hda - Use s...
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
  static const struct hda_pintbl stac9872_vaio_pin_configs[] = {
  	{ 0x0a, 0x03211020 },
  	{ 0x0b, 0x411111f0 },
  	{ 0x0c, 0x411111f0 },
  	{ 0x0d, 0x03a15030 },
  	{ 0x0e, 0x411111f0 },
  	{ 0x0f, 0x90170110 },
  	{ 0x11, 0x411111f0 },
  	{ 0x13, 0x411111f0 },
  	{ 0x14, 0x90a7013e },
  	{}
307282c89   Takashi Iwai   ALSA: hda - Add m...
4727
  };
fc268c10c   Takashi Iwai   ALSA: hda - Use s...
4728
4729
4730
  static const struct hda_model_fixup stac9872_models[] = {
  	{ .id = STAC_9872_VAIO, .name = "vaio" },
  	{}
307282c89   Takashi Iwai   ALSA: hda - Add m...
4731
  };
fc268c10c   Takashi Iwai   ALSA: hda - Use s...
4732
4733
4734
4735
4736
  static const struct hda_fixup stac9872_fixups[] = {
  	[STAC_9872_VAIO] = {
  		.type = HDA_FIXUP_PINS,
  		.v.pins = stac9872_vaio_pin_configs,
  	},
307282c89   Takashi Iwai   ALSA: hda - Add m...
4737
  };
fc268c10c   Takashi Iwai   ALSA: hda - Use s...
4738
  static const struct snd_pci_quirk stac9872_fixup_tbl[] = {
b04add956   Takashi Iwai   ALSA: hda - Fix p...
4739
4740
  	SND_PCI_QUIRK_MASK(0x104d, 0xfff0, 0x81e0,
  			   "Sony VAIO F/S", STAC_9872_VAIO),
307282c89   Takashi Iwai   ALSA: hda - Add m...
4741
4742
  	{} /* terminator */
  };
6d8590650   Guillaume Munch   [ALSA] hda-codec ...
4743
  static int patch_stac9872(struct hda_codec *codec)
db064e503   Takashi Iwai   [ALSA] hda-codec ...
4744
4745
  {
  	struct sigmatel_spec *spec;
1e137f929   Takashi Iwai   ALSA: hda - Clean...
4746
  	int err;
db064e503   Takashi Iwai   [ALSA] hda-codec ...
4747

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4748
  	err = alloc_stac_spec(codec);
361dab3ec   Takashi Iwai   ALSA: hda - Call ...
4749
4750
4751
4752
  	if (err < 0)
  		return err;
  
  	spec = codec->spec;
1b0e372d7   Daniel J Blueman   ALSA: hda - Fix b...
4753
  	spec->linear_tone_beep = 1;
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4754
  	spec->gen.own_eapd_ctl = 1;
caa10b6e8   Takashi Iwai   ALSA: hda - Impro...
4755

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4756
  	codec->patch_ops = stac_patch_ops;
db064e503   Takashi Iwai   [ALSA] hda-codec ...
4757

fc268c10c   Takashi Iwai   ALSA: hda - Use s...
4758
  	snd_hda_add_verbs(codec, stac9872_core_init);
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4759
4760
  	snd_hda_pick_fixup(codec, stac9872_models, stac9872_fixup_tbl,
  			   stac9872_fixups);
fc268c10c   Takashi Iwai   ALSA: hda - Use s...
4761
  	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1e137f929   Takashi Iwai   ALSA: hda - Clean...
4762

36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4763
  	err = stac_parse_auto_config(codec);
1e137f929   Takashi Iwai   ALSA: hda - Clean...
4764
  	if (err < 0) {
36c9db7a1   Takashi Iwai   ALSA: hda - Use g...
4765
  		stac_free(codec);
1e137f929   Takashi Iwai   ALSA: hda - Clean...
4766
4767
  		return -EINVAL;
  	}
fc268c10c   Takashi Iwai   ALSA: hda - Use s...
4768
4769
  
  	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
db064e503   Takashi Iwai   [ALSA] hda-codec ...
4770
4771
4772
4773
4774
  	return 0;
  }
  
  
  /*
2f2f4251c   Matt   [ALSA] add sigmat...
4775
4776
   * patch entries
   */
2b63536f0   Takashi Iwai   ALSA: hda - Const...
4777
  static const struct hda_codec_preset snd_hda_preset_sigmatel[] = {
2f2f4251c   Matt   [ALSA] add sigmat...
4778
4779
4780
4781
4782
4783
4784
   	{ .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 },
   	{ .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x },
   	{ .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x },
   	{ .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x },
   	{ .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x },
   	{ .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x },
   	{ .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x },
22a27c7f8   Matt Porter   [ALSA] hda: fix s...
4785
4786
4787
4788
4789
4790
   	{ .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x },
   	{ .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x },
   	{ .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x },
   	{ .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x },
   	{ .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x },
   	{ .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x },
3cc08dc6e   Matt Porter   [ALSA] hda-codec ...
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
   	{ .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x },
   	{ .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x },
   	{ .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x },
   	{ .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x },
   	{ .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x },
   	{ .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x },
   	{ .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x },
   	{ .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x },
   	{ .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x },
   	{ .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x },
8e21c34cd   Tobin Davis   [ALSA] hda-codec ...
4801
4802
4803
4804
4805
4806
  	{ .id = 0x83847632, .name = "STAC9202",  .patch = patch_stac925x },
  	{ .id = 0x83847633, .name = "STAC9202D", .patch = patch_stac925x },
  	{ .id = 0x83847634, .name = "STAC9250", .patch = patch_stac925x },
  	{ .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x },
  	{ .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x },
  	{ .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x },
7bd3c0f73   Takashi Iwai   [ALSA] hda - Supp...
4807
4808
  	{ .id = 0x83847645, .name = "92HD206X", .patch = patch_stac927x },
  	{ .id = 0x83847646, .name = "92HD206D", .patch = patch_stac927x },
6d8590650   Guillaume Munch   [ALSA] hda-codec ...
4809
4810
4811
4812
4813
4814
4815
   	/* The following does not take into account .id=0x83847661 when subsys =
   	 * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are
   	 * currently not fully supported.
   	 */
   	{ .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 },
   	{ .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 },
   	{ .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 },
a5c0f8867   Simos Xenitellis   ALSA: hda - add q...
4816
  	{ .id = 0x83847698, .name = "STAC9205", .patch = patch_stac9205 },
f3302a59c   Matt Porter   [ALSA] hda: sigma...
4817
4818
4819
4820
4821
4822
4823
4824
   	{ .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 },
   	{ .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 },
   	{ .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 },
   	{ .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 },
   	{ .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 },
   	{ .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 },
   	{ .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 },
   	{ .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 },
aafc4412b   Matthew Ranostay   ALSA: hda: Add su...
4825
  	{ .id = 0x111d7603, .name = "92HD75B3X5", .patch = patch_stac92hd71bxx},
d0513fc6c   Matthew Ranostay   ALSA: hda: added ...
4826
  	{ .id = 0x111d7604, .name = "92HD83C1X5", .patch = patch_stac92hd83xxx},
a9694faa2   Vitaliy Kulikov   ALSA: hda - Addin...
4827
  	{ .id = 0x111d76d4, .name = "92HD83C1C5", .patch = patch_stac92hd83xxx},
d0513fc6c   Matthew Ranostay   ALSA: hda: added ...
4828
  	{ .id = 0x111d7605, .name = "92HD81B1X5", .patch = patch_stac92hd83xxx},
ff2e7337b   Matthew Ranostay   ALSA: Add 92HD81B...
4829
  	{ .id = 0x111d76d5, .name = "92HD81B1C5", .patch = patch_stac92hd83xxx},
8a345a042   Charles Chin   ALSA: hda - Addin...
4830
4831
  	{ .id = 0x111d76d1, .name = "92HD87B1/3", .patch = patch_stac92hd83xxx},
  	{ .id = 0x111d76d9, .name = "92HD87B2/4", .patch = patch_stac92hd83xxx},
36706005d   Charles Chin   ALSA: hda - Add s...
4832
4833
4834
4835
  	{ .id = 0x111d7666, .name = "92HD88B3", .patch = patch_stac92hd83xxx},
  	{ .id = 0x111d7667, .name = "92HD88B1", .patch = patch_stac92hd83xxx},
  	{ .id = 0x111d7668, .name = "92HD88B2", .patch = patch_stac92hd83xxx},
  	{ .id = 0x111d7669, .name = "92HD88B4", .patch = patch_stac92hd83xxx},
aafc4412b   Matthew Ranostay   ALSA: hda: Add su...
4836
  	{ .id = 0x111d7608, .name = "92HD75B2X5", .patch = patch_stac92hd71bxx},
541eee876   Matthew Ranostay   [ALSA] hda: Added...
4837
4838
  	{ .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx },
  	{ .id = 0x111d7675, .name = "92HD73C1X5", .patch = patch_stac92hd73xx },
e1f0d6690   Matthew Ranostay   [ALSA] hda: Added...
4839
  	{ .id = 0x111d7676, .name = "92HD73E1X5", .patch = patch_stac92hd73xx },
4e637c6e0   Vitaliy Kulikov   ALSA: hda - add s...
4840
  	{ .id = 0x111d7695, .name = "92HD95", .patch = patch_stac92hd95 },
541eee876   Matthew Ranostay   [ALSA] hda: Added...
4841
4842
4843
4844
4845
4846
4847
4848
  	{ .id = 0x111d76b0, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
  	{ .id = 0x111d76b1, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
  	{ .id = 0x111d76b2, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
  	{ .id = 0x111d76b3, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
  	{ .id = 0x111d76b4, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
  	{ .id = 0x111d76b5, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
  	{ .id = 0x111d76b6, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
  	{ .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
4d8ec5f3b   Charles Chin   ALSA: hda - Add s...
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
  	{ .id = 0x111d76c0, .name = "92HD89C3", .patch = patch_stac92hd73xx },
  	{ .id = 0x111d76c1, .name = "92HD89C2", .patch = patch_stac92hd73xx },
  	{ .id = 0x111d76c2, .name = "92HD89C1", .patch = patch_stac92hd73xx },
  	{ .id = 0x111d76c3, .name = "92HD89B3", .patch = patch_stac92hd73xx },
  	{ .id = 0x111d76c4, .name = "92HD89B2", .patch = patch_stac92hd73xx },
  	{ .id = 0x111d76c5, .name = "92HD89B1", .patch = patch_stac92hd73xx },
  	{ .id = 0x111d76c6, .name = "92HD89E3", .patch = patch_stac92hd73xx },
  	{ .id = 0x111d76c7, .name = "92HD89E2", .patch = patch_stac92hd73xx },
  	{ .id = 0x111d76c8, .name = "92HD89E1", .patch = patch_stac92hd73xx },
  	{ .id = 0x111d76c9, .name = "92HD89D3", .patch = patch_stac92hd73xx },
  	{ .id = 0x111d76ca, .name = "92HD89D2", .patch = patch_stac92hd73xx },
  	{ .id = 0x111d76cb, .name = "92HD89D1", .patch = patch_stac92hd73xx },
  	{ .id = 0x111d76cc, .name = "92HD89F3", .patch = patch_stac92hd73xx },
  	{ .id = 0x111d76cd, .name = "92HD89F2", .patch = patch_stac92hd73xx },
  	{ .id = 0x111d76ce, .name = "92HD89F1", .patch = patch_stac92hd73xx },
46724c2e0   David Henningsson   ALSA: HDA: Add su...
4864
  	{ .id = 0x111d76df, .name = "92HD93BXX", .patch = patch_stac92hd83xxx},
ab5a6ebee   Vitaliy Kulikov   ALSA: hda - Addin...
4865
  	{ .id = 0x111d76e0, .name = "92HD91BXX", .patch = patch_stac92hd83xxx},
4dfb8a45d   Vitaliy Kulikov   ALSA: hda - Add s...
4866
4867
  	{ .id = 0x111d76e3, .name = "92HD98BXX", .patch = patch_stac92hd83xxx},
  	{ .id = 0x111d76e5, .name = "92HD99BXX", .patch = patch_stac92hd83xxx},
ab5a6ebee   Vitaliy Kulikov   ALSA: hda - Addin...
4868
  	{ .id = 0x111d76e7, .name = "92HD90BXX", .patch = patch_stac92hd83xxx},
ad5d87551   Charles Chin   ALSA: hda - Add s...
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
  	{ .id = 0x111d76e8, .name = "92HD66B1X5", .patch = patch_stac92hd83xxx},
  	{ .id = 0x111d76e9, .name = "92HD66B2X5", .patch = patch_stac92hd83xxx},
  	{ .id = 0x111d76ea, .name = "92HD66B3X5", .patch = patch_stac92hd83xxx},
  	{ .id = 0x111d76eb, .name = "92HD66C1X5", .patch = patch_stac92hd83xxx},
  	{ .id = 0x111d76ec, .name = "92HD66C2X5", .patch = patch_stac92hd83xxx},
  	{ .id = 0x111d76ed, .name = "92HD66C3X5", .patch = patch_stac92hd83xxx},
  	{ .id = 0x111d76ee, .name = "92HD66B1X3", .patch = patch_stac92hd83xxx},
  	{ .id = 0x111d76ef, .name = "92HD66B2X3", .patch = patch_stac92hd83xxx},
  	{ .id = 0x111d76f0, .name = "92HD66B3X3", .patch = patch_stac92hd83xxx},
  	{ .id = 0x111d76f1, .name = "92HD66C1X3", .patch = patch_stac92hd83xxx},
  	{ .id = 0x111d76f2, .name = "92HD66C2X3", .patch = patch_stac92hd83xxx},
  	{ .id = 0x111d76f3, .name = "92HD66C3/65", .patch = patch_stac92hd83xxx},
2f2f4251c   Matt   [ALSA] add sigmat...
4881
4882
  	{} /* terminator */
  };
1289e9e8b   Takashi Iwai   ALSA: hda - Modul...
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
  
  MODULE_ALIAS("snd-hda-codec-id:8384*");
  MODULE_ALIAS("snd-hda-codec-id:111d*");
  
  MODULE_LICENSE("GPL");
  MODULE_DESCRIPTION("IDT/Sigmatel HD-audio codec");
  
  static struct hda_codec_preset_list sigmatel_list = {
  	.preset = snd_hda_preset_sigmatel,
  	.owner = THIS_MODULE,
  };
  
  static int __init patch_sigmatel_init(void)
  {
  	return snd_hda_add_codec_preset(&sigmatel_list);
  }
  
  static void __exit patch_sigmatel_exit(void)
  {
  	snd_hda_delete_codec_preset(&sigmatel_list);
  }
  
  module_init(patch_sigmatel_init)
  module_exit(patch_sigmatel_exit)