blob: 4ae5767a2cf5cac96008b925ed451f9db2b34cf0 [file] [log] [blame]
Matt2f2f4252005-04-13 14:45:30 +02001/*
2 * Universal Interface for Intel High Definition Audio Codec
3 *
4 * HD audio interface patch for SigmaTel STAC92xx
5 *
6 * Copyright (c) 2005 Embedded Alley Solutions, Inc.
Matt Porter403d1942005-11-29 15:00:51 +01007 * Matt Porter <mporter@embeddedalley.com>
Matt2f2f4252005-04-13 14:45:30 +02008 *
9 * Based on patch_cmedia.c and patch_realtek.c
10 * Copyright (c) 2004 Takashi Iwai <tiwai@suse.de>
11 *
12 * This driver is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This driver is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 */
26
Matt2f2f4252005-04-13 14:45:30 +020027#include <linux/init.h>
28#include <linux/delay.h>
29#include <linux/slab.h>
30#include <linux/pci.h>
Vitaliy Kulikov5bdaaad2009-11-04 07:57:45 +010031#include <linux/dmi.h>
Paul Gortmakerda155d52011-07-15 12:38:28 -040032#include <linux/module.h>
Matt2f2f4252005-04-13 14:45:30 +020033#include <sound/core.h>
Matthew Ranostay45a6ac12008-10-15 14:45:38 -040034#include <sound/jack.h>
Clemens Ladischa74ccea2010-10-22 15:52:34 +020035#include <sound/tlv.h>
Matt2f2f4252005-04-13 14:45:30 +020036#include "hda_codec.h"
37#include "hda_local.h"
Takashi Iwai128bc4b2012-05-07 17:42:31 +020038#include "hda_auto_parser.h"
Matthew Ranostay1cd22242008-07-18 18:20:52 +020039#include "hda_beep.h"
Takashi Iwai1835a0f2011-10-27 22:12:46 +020040#include "hda_jack.h"
Takashi Iwai36c9db72013-01-17 17:07:59 +010041#include "hda_generic.h"
Matt2f2f4252005-04-13 14:45:30 +020042
Takashi Iwaic6e4c662008-11-25 11:58:19 +010043enum {
Takashi Iwai36c9db72013-01-17 17:07:59 +010044 STAC_VREF_EVENT = 8,
Takashi Iwaic6e4c662008-11-25 11:58:19 +010045 STAC_PWR_EVENT,
Takashi Iwaic6e4c662008-11-25 11:58:19 +010046};
Matt4e550962005-07-04 17:51:39 +020047
Takashi Iwaif5fcc132006-11-24 17:07:44 +010048enum {
49 STAC_REF,
Tobin Davisbf277782008-02-03 20:31:47 +010050 STAC_9200_OQO,
Takashi Iwaidfe495d2007-08-23 19:04:28 +020051 STAC_9200_DELL_D21,
52 STAC_9200_DELL_D22,
53 STAC_9200_DELL_D23,
54 STAC_9200_DELL_M21,
55 STAC_9200_DELL_M22,
56 STAC_9200_DELL_M23,
57 STAC_9200_DELL_M24,
58 STAC_9200_DELL_M25,
59 STAC_9200_DELL_M26,
60 STAC_9200_DELL_M27,
Mauro Carvalho Chehab58eec422008-08-11 10:18:39 +020061 STAC_9200_M4,
62 STAC_9200_M4_2,
Takashi Iwai117f2572008-03-18 09:53:23 +010063 STAC_9200_PANASONIC,
Takashi Iwaid39a3ae2013-01-14 14:06:26 +010064 STAC_9200_EAPD_INIT,
Takashi Iwaif5fcc132006-11-24 17:07:44 +010065 STAC_9200_MODELS
66};
67
68enum {
69 STAC_9205_REF,
Takashi Iwaidfe495d2007-08-23 19:04:28 +020070 STAC_9205_DELL_M42,
Tobin Davisae0a8ed2007-08-13 15:50:29 +020071 STAC_9205_DELL_M43,
72 STAC_9205_DELL_M44,
Takashi Iwaid9a42682009-01-22 17:40:18 +010073 STAC_9205_EAPD,
Takashi Iwaif5fcc132006-11-24 17:07:44 +010074 STAC_9205_MODELS
75};
76
77enum {
Takashi Iwai9e43f0d2008-12-17 14:51:01 +010078 STAC_92HD73XX_NO_JD, /* no jack-detection */
Matthew Ranostaye1f0d662007-12-13 17:47:21 +010079 STAC_92HD73XX_REF,
Wu Fengguangae709442009-08-19 17:05:11 +080080 STAC_92HD73XX_INTEL,
Takashi Iwai661cd8f2008-11-25 15:18:29 +010081 STAC_DELL_M6_AMIC,
82 STAC_DELL_M6_DMIC,
83 STAC_DELL_M6_BOTH,
Matthew Ranostay6b3ab212008-11-03 08:12:43 -050084 STAC_DELL_EQ,
Takashi Iwai842ae632009-09-02 07:43:08 +020085 STAC_ALIENWARE_M17X,
Hui Wang80c24502014-02-20 11:47:21 +080086 STAC_92HD89XX_HP_FRONT_JACK,
Hui Wang159902f2014-07-30 11:11:48 +080087 STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK,
Matthew Ranostaye1f0d662007-12-13 17:47:21 +010088 STAC_92HD73XX_MODELS
89};
90
91enum {
Matthew Ranostayd0513fc2008-07-27 10:30:30 +020092 STAC_92HD83XXX_REF,
Matthew Ranostay32ed3f42009-01-22 20:53:29 -050093 STAC_92HD83XXX_PWR_REF,
Matthew Ranostay8bb0ac52009-02-12 16:50:01 -050094 STAC_DELL_S14,
Julian Wollrathf7f9bdf2011-11-09 10:02:40 +010095 STAC_DELL_VOSTRO_3500,
Vitaliy Kulikov0c27c182011-07-22 17:50:37 -050096 STAC_92HD83XXX_HP_cNB11_INTQUAD,
Steven Eastland48315592010-08-06 15:07:35 -060097 STAC_HP_DV7_4000,
Vitaliy Kulikov5556e142012-02-27 16:47:37 -060098 STAC_HP_ZEPHYR,
Takashi Iwaia3e19972012-07-26 08:17:20 +020099 STAC_92HD83XXX_HP_LED,
Takashi Iwaiff8a1e22012-07-31 10:16:59 +0200100 STAC_92HD83XXX_HP_INV_LED,
Takashi Iwai62cbde12012-09-14 11:58:54 +0200101 STAC_92HD83XXX_HP_MIC_LED,
Takashi Iwaif5556a62014-02-24 15:23:10 +0100102 STAC_HP_LED_GPIO10,
David Henningsson8d032a82012-10-09 12:48:40 +0200103 STAC_92HD83XXX_HEADSET_JACK,
Takashi Iwai372f8c72013-01-14 18:06:34 +0100104 STAC_92HD83XXX_HP,
Takashi Iwai49920422013-01-18 14:28:07 +0100105 STAC_HP_ENVY_BASS,
Matthew Ranostayd0513fc2008-07-27 10:30:30 +0200106 STAC_92HD83XXX_MODELS
107};
108
109enum {
Matthew Ranostaye035b842007-11-06 11:53:55 +0100110 STAC_92HD71BXX_REF,
Matthew Ranostaya7662642008-02-21 07:51:14 +0100111 STAC_DELL_M4_1,
112 STAC_DELL_M4_2,
Matthew Ranostay3a7abfd2008-11-20 21:21:43 -0500113 STAC_DELL_M4_3,
Matthew Ranostay6a14f582008-09-12 12:02:30 -0400114 STAC_HP_M4,
Takashi Iwai2a6ce6e2010-05-12 10:16:20 +0200115 STAC_HP_DV4,
Takashi Iwai1b0652e2009-01-14 08:27:35 +0100116 STAC_HP_DV5,
Christoph Plattnerae6241f2009-03-08 23:19:05 +0100117 STAC_HP_HDX,
Takashi Iwai0f6fcb72013-01-14 17:05:25 +0100118 STAC_92HD71BXX_HP,
119 STAC_92HD71BXX_NO_DMIC,
120 STAC_92HD71BXX_NO_SMUX,
Matthew Ranostaye035b842007-11-06 11:53:55 +0100121 STAC_92HD71BXX_MODELS
122};
123
124enum {
Tobin Davis8e21c342007-01-08 11:04:17 +0100125 STAC_925x_REF,
Mauro Carvalho Chehab9cb36c22008-08-11 10:18:39 +0200126 STAC_M1,
127 STAC_M1_2,
128 STAC_M2,
Tobin Davis8e21c342007-01-08 11:04:17 +0100129 STAC_M2_2,
Mauro Carvalho Chehab9cb36c22008-08-11 10:18:39 +0200130 STAC_M3,
131 STAC_M5,
132 STAC_M6,
Tobin Davis8e21c342007-01-08 11:04:17 +0100133 STAC_925x_MODELS
134};
135
136enum {
Takashi Iwaif5fcc132006-11-24 17:07:44 +0100137 STAC_D945_REF,
138 STAC_D945GTP3,
139 STAC_D945GTP5,
Ivan N. Zlatev5d5d3bc2007-05-29 16:03:00 +0200140 STAC_INTEL_MAC_V1,
141 STAC_INTEL_MAC_V2,
142 STAC_INTEL_MAC_V3,
143 STAC_INTEL_MAC_V4,
144 STAC_INTEL_MAC_V5,
Takashi Iwai0a42784642013-01-14 15:20:13 +0100145 STAC_INTEL_MAC_AUTO,
Mauro Carvalho Chehab8c650082008-08-04 10:39:59 -0300146 STAC_ECS_202,
Takashi Iwaidfe495d2007-08-23 19:04:28 +0200147 STAC_922X_DELL_D81,
148 STAC_922X_DELL_D82,
149 STAC_922X_DELL_M81,
150 STAC_922X_DELL_M82,
Takashi Iwai0a42784642013-01-14 15:20:13 +0100151 STAC_922X_INTEL_MAC_GPIO,
Takashi Iwaif5fcc132006-11-24 17:07:44 +0100152 STAC_922X_MODELS
153};
154
155enum {
Takashi Iwaie28d8322008-12-17 13:48:29 +0100156 STAC_D965_REF_NO_JD, /* no jack-detection */
Takashi Iwaif5fcc132006-11-24 17:07:44 +0100157 STAC_D965_REF,
158 STAC_D965_3ST,
159 STAC_D965_5ST,
Takashi Iwai679d92e2009-05-24 19:00:08 +0200160 STAC_D965_5ST_NO_FP,
Takashi Iwai29ac8362013-01-14 16:03:38 +0100161 STAC_D965_VERBS,
Tobin Davis4ff076e2007-08-07 11:48:12 +0200162 STAC_DELL_3ST,
Matthew Ranostay8e9068b2007-12-17 11:58:13 +0100163 STAC_DELL_BIOS,
Takashi Iwai29ac8362013-01-14 16:03:38 +0100164 STAC_DELL_BIOS_SPDIF,
165 STAC_927X_DELL_DMIC,
Takashi Iwai54930532009-10-11 17:38:29 +0200166 STAC_927X_VOLKNOB,
Takashi Iwaif5fcc132006-11-24 17:07:44 +0100167 STAC_927X_MODELS
168};
Matt Porter403d1942005-11-29 15:00:51 +0100169
Takashi Iwai307282c2009-03-12 18:17:58 +0100170enum {
Takashi Iwai307282c2009-03-12 18:17:58 +0100171 STAC_9872_VAIO,
172 STAC_9872_MODELS
173};
174
Matt2f2f4252005-04-13 14:45:30 +0200175struct sigmatel_spec {
Takashi Iwai36c9db72013-01-17 17:07:59 +0100176 struct hda_gen_spec gen;
Mattc7d4b2f2005-06-27 14:59:41 +0200177
Matthew Ranostayc0cea0d2008-11-16 11:42:34 -0500178 unsigned int eapd_switch: 1;
Daniel J Blueman1b0e3722010-08-03 11:09:13 +0100179 unsigned int linear_tone_beep:1;
David Henningsson8d032a82012-10-09 12:48:40 +0200180 unsigned int headset_jack:1; /* 4-pin headset jack (hp + mono mic) */
Takashi Iwai29ac8362013-01-14 16:03:38 +0100181 unsigned int volknob_init:1; /* special volume-knob initialization */
Takashi Iwai36c9db72013-01-17 17:07:59 +0100182 unsigned int powerdown_adcs:1;
Takashi Iwai42875472013-01-22 09:34:48 +0100183 unsigned int have_spdif_mux:1;
Mattc7d4b2f2005-06-27 14:59:41 +0200184
Matthew Ranostay4fe51952008-01-29 15:28:44 +0100185 /* gpio lines */
Matthew Ranostay0fc9dec2008-04-14 13:32:54 +0200186 unsigned int eapd_mask;
Matthew Ranostay4fe51952008-01-29 15:28:44 +0100187 unsigned int gpio_mask;
188 unsigned int gpio_dir;
189 unsigned int gpio_data;
190 unsigned int gpio_mute;
Takashi Iwai86d190e2009-05-26 15:18:58 +0200191 unsigned int gpio_led;
Vitaliy Kulikovc357aab2009-12-11 07:51:54 +0100192 unsigned int gpio_led_polarity;
Takashi Iwaif1a73742011-12-04 13:44:06 +0100193 unsigned int vref_mute_led_nid; /* pin NID for mute-LED vref control */
Vitaliy Kulikov45eebda2011-07-26 16:56:20 -0500194 unsigned int vref_led;
Takashi Iwai372f8c72013-01-14 18:06:34 +0100195 int default_polarity;
Matthew Ranostay4fe51952008-01-29 15:28:44 +0100196
Takashi Iwai62cbde12012-09-14 11:58:54 +0200197 unsigned int mic_mute_led_gpio; /* capture mute LED GPIO */
198 bool mic_mute_led_on; /* current mic mute state */
199
Matthew Ranostay8daaaa92008-08-15 07:45:52 +0200200 /* stream */
201 unsigned int stream_delay;
202
Matthew Ranostay4fe51952008-01-29 15:28:44 +0100203 /* analog loopback */
Takashi Iwai2b635362011-05-02 12:33:43 +0200204 const struct snd_kcontrol_new *aloopback_ctl;
Takashi Iwai36c9db72013-01-17 17:07:59 +0100205 unsigned int aloopback;
Matthew Ranostaye1f0d662007-12-13 17:47:21 +0100206 unsigned char aloopback_mask;
207 unsigned char aloopback_shift;
Takashi Iwai82599802007-07-31 15:56:24 +0200208
Matthew Ranostaya64135a2008-01-10 16:55:06 +0100209 /* power management */
Takashi Iwaic8822462012-05-15 09:11:36 +0200210 unsigned int power_map_bits;
Matthew Ranostaya64135a2008-01-10 16:55:06 +0100211 unsigned int num_pwrs;
Takashi Iwai2b635362011-05-02 12:33:43 +0200212 const hda_nid_t *pwr_nids;
Takashi Iwai36c9db72013-01-17 17:07:59 +0100213 unsigned int active_adcs;
Matthew Ranostaya64135a2008-01-10 16:55:06 +0100214
Takashi Iwai36c9db72013-01-17 17:07:59 +0100215 /* beep widgets */
Matthew Ranostay1cd22242008-07-18 18:20:52 +0200216 hda_nid_t anabeep_nid;
Takashi Iwai42875472013-01-22 09:34:48 +0100217
218 /* SPDIF-out mux */
219 const char * const *spdif_labels;
220 struct hda_input_mux spdif_mux;
221 unsigned int cur_smux[2];
Matt2f2f4252005-04-13 14:45:30 +0200222};
223
Takashi Iwaic8822462012-05-15 09:11:36 +0200224#define AC_VERB_IDT_SET_POWER_MAP 0x7ec
225#define AC_VERB_IDT_GET_POWER_MAP 0xfec
226
Takashi Iwai2b635362011-05-02 12:33:43 +0200227static const hda_nid_t stac92hd73xx_pwr_nids[8] = {
Matthew Ranostaya64135a2008-01-10 16:55:06 +0100228 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
229 0x0f, 0x10, 0x11
230};
231
Charles Chinafef2cf2011-11-11 08:05:28 +0100232static const hda_nid_t stac92hd83xxx_pwr_nids[7] = {
233 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
234 0x0f, 0x10
Matthew Ranostayd0513fc2008-07-27 10:30:30 +0200235};
236
Takashi Iwai2b635362011-05-02 12:33:43 +0200237static const hda_nid_t stac92hd71bxx_pwr_nids[3] = {
Matthew Ranostaya64135a2008-01-10 16:55:06 +0100238 0x0a, 0x0d, 0x0f
239};
240
Matthew Ranostaye035b842007-11-06 11:53:55 +0100241
Takashi Iwai36c9db72013-01-17 17:07:59 +0100242/*
243 * PCM hooks
244 */
245static void stac_playback_pcm_hook(struct hda_pcm_stream *hinfo,
246 struct hda_codec *codec,
247 struct snd_pcm_substream *substream,
248 int action)
Matt Porter8b657272006-10-26 17:12:59 +0200249{
Matt Porter8b657272006-10-26 17:12:59 +0200250 struct sigmatel_spec *spec = codec->spec;
Takashi Iwai36c9db72013-01-17 17:07:59 +0100251 if (action == HDA_GEN_PCM_ACT_OPEN && spec->stream_delay)
252 msleep(spec->stream_delay);
Matt Porter8b657272006-10-26 17:12:59 +0200253}
254
Takashi Iwai36c9db72013-01-17 17:07:59 +0100255static void stac_capture_pcm_hook(struct hda_pcm_stream *hinfo,
256 struct hda_codec *codec,
257 struct snd_pcm_substream *substream,
258 int action)
Matt Porter8b657272006-10-26 17:12:59 +0200259{
Matt Porter8b657272006-10-26 17:12:59 +0200260 struct sigmatel_spec *spec = codec->spec;
Takashi Iwai36c9db72013-01-17 17:07:59 +0100261 int i, idx = 0;
Matt Porter8b657272006-10-26 17:12:59 +0200262
Takashi Iwai36c9db72013-01-17 17:07:59 +0100263 if (!spec->powerdown_adcs)
264 return;
Matt Porter8b657272006-10-26 17:12:59 +0200265
Takashi Iwai36c9db72013-01-17 17:07:59 +0100266 for (i = 0; i < spec->gen.num_all_adcs; i++) {
267 if (spec->gen.all_adcs[i] == hinfo->nid) {
268 idx = i;
269 break;
270 }
Matthew Ranostay00ef50c2008-09-27 18:13:47 -0400271 }
Takashi Iwai36c9db72013-01-17 17:07:59 +0100272
273 switch (action) {
274 case HDA_GEN_PCM_ACT_OPEN:
275 msleep(40);
276 snd_hda_codec_write(codec, hinfo->nid, 0,
277 AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
278 spec->active_adcs |= (1 << idx);
279 break;
280 case HDA_GEN_PCM_ACT_CLOSE:
281 snd_hda_codec_write(codec, hinfo->nid, 0,
282 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
283 spec->active_adcs &= ~(1 << idx);
284 break;
285 }
286}
287
288/*
289 * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a
290 * funky external mute control using GPIO pins.
291 */
292
293static void stac_gpio_set(struct hda_codec *codec, unsigned int mask,
294 unsigned int dir_mask, unsigned int data)
295{
296 unsigned int gpiostate, gpiomask, gpiodir;
297
298 snd_printdd("%s msk %x dir %x gpio %x\n", __func__, mask, dir_mask, data);
299
300 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
301 AC_VERB_GET_GPIO_DATA, 0);
302 gpiostate = (gpiostate & ~dir_mask) | (data & dir_mask);
303
304 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
305 AC_VERB_GET_GPIO_MASK, 0);
306 gpiomask |= mask;
307
308 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
309 AC_VERB_GET_GPIO_DIRECTION, 0);
310 gpiodir |= dir_mask;
311
312 /* Configure GPIOx as CMOS */
313 snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0);
314
315 snd_hda_codec_write(codec, codec->afg, 0,
316 AC_VERB_SET_GPIO_MASK, gpiomask);
317 snd_hda_codec_read(codec, codec->afg, 0,
318 AC_VERB_SET_GPIO_DIRECTION, gpiodir); /* sync */
319
320 msleep(1);
321
322 snd_hda_codec_read(codec, codec->afg, 0,
323 AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */
324}
325
326/* hook for controlling mic-mute LED GPIO */
Takashi Iwaia90229e2013-01-18 14:10:00 +0100327static void stac_capture_led_hook(struct hda_codec *codec,
328 struct snd_ctl_elem_value *ucontrol)
Takashi Iwai36c9db72013-01-17 17:07:59 +0100329{
330 struct sigmatel_spec *spec = codec->spec;
Takashi Iwaia90229e2013-01-18 14:10:00 +0100331 bool mute;
Takashi Iwai36c9db72013-01-17 17:07:59 +0100332
Takashi Iwaia90229e2013-01-18 14:10:00 +0100333 if (!ucontrol)
334 return;
335
336 mute = !(ucontrol->value.integer.value[0] ||
337 ucontrol->value.integer.value[1]);
Takashi Iwai36c9db72013-01-17 17:07:59 +0100338 if (spec->mic_mute_led_on != mute) {
339 spec->mic_mute_led_on = mute;
340 if (mute)
341 spec->gpio_data |= spec->mic_mute_led_gpio;
342 else
343 spec->gpio_data &= ~spec->mic_mute_led_gpio;
344 stac_gpio_set(codec, spec->gpio_mask,
345 spec->gpio_dir, spec->gpio_data);
346 }
Matthew Ranostayd9737752008-09-07 12:03:41 +0200347}
348
Vitaliy Kulikov45eebda2011-07-26 16:56:20 -0500349static int stac_vrefout_set(struct hda_codec *codec,
350 hda_nid_t nid, unsigned int new_vref)
351{
352 int error, pinctl;
353
354 snd_printdd("%s, nid %x ctl %x\n", __func__, nid, new_vref);
355 pinctl = snd_hda_codec_read(codec, nid, 0,
356 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
357
358 if (pinctl < 0)
359 return pinctl;
360
361 pinctl &= 0xff;
362 pinctl &= ~AC_PINCTL_VREFEN;
363 pinctl |= (new_vref & AC_PINCTL_VREFEN);
364
Takashi Iwaicdd03ce2012-04-20 12:34:50 +0200365 error = snd_hda_set_pin_ctl_cache(codec, nid, pinctl);
Vitaliy Kulikov45eebda2011-07-26 16:56:20 -0500366 if (error < 0)
367 return error;
368
369 return 1;
370}
371
Takashi Iwai36c9db72013-01-17 17:07:59 +0100372/* update mute-LED accoring to the master switch */
373static void stac_update_led_status(struct hda_codec *codec, int enabled)
Nickolas Lloyd2fc99892009-05-15 15:33:30 +0200374{
Matt2f2f4252005-04-13 14:45:30 +0200375 struct sigmatel_spec *spec = codec->spec;
Takashi Iwai36c9db72013-01-17 17:07:59 +0100376 int muted = !enabled;
Matt2f2f4252005-04-13 14:45:30 +0200377
Takashi Iwai36c9db72013-01-17 17:07:59 +0100378 if (!spec->gpio_led)
379 return;
Matt2f2f4252005-04-13 14:45:30 +0200380
Takashi Iwai36c9db72013-01-17 17:07:59 +0100381 /* LED state is inverted on these systems */
382 if (spec->gpio_led_polarity)
383 muted = !muted;
Matt2f2f4252005-04-13 14:45:30 +0200384
Takashi Iwai36c9db72013-01-17 17:07:59 +0100385 if (!spec->vref_mute_led_nid) {
386 if (muted)
387 spec->gpio_data |= spec->gpio_led;
388 else
389 spec->gpio_data &= ~spec->gpio_led;
390 stac_gpio_set(codec, spec->gpio_mask,
391 spec->gpio_dir, spec->gpio_data);
Takashi Iwai5207e102009-07-30 13:09:08 +0200392 } else {
Takashi Iwai36c9db72013-01-17 17:07:59 +0100393 spec->vref_led = muted ? AC_PINCTL_VREF_50 : AC_PINCTL_VREF_GRD;
394 stac_vrefout_set(codec, spec->vref_mute_led_nid,
395 spec->vref_led);
Takashi Iwai5207e102009-07-30 13:09:08 +0200396 }
Matt2f2f4252005-04-13 14:45:30 +0200397}
398
Takashi Iwai36c9db72013-01-17 17:07:59 +0100399/* vmaster hook to update mute LED */
400static void stac_vmaster_hook(void *private_data, int val)
Matthew Ranostayb22b4822008-01-22 12:32:30 +0100401{
Takashi Iwai36c9db72013-01-17 17:07:59 +0100402 stac_update_led_status(private_data, val);
Matthew Ranostayb22b4822008-01-22 12:32:30 +0100403}
404
Takashi Iwai36c9db72013-01-17 17:07:59 +0100405/* automute hook to handle GPIO mute and EAPD updates */
406static void stac_update_outputs(struct hda_codec *codec)
Matthew Ranostayb22b4822008-01-22 12:32:30 +0100407{
Matthew Ranostayb22b4822008-01-22 12:32:30 +0100408 struct sigmatel_spec *spec = codec->spec;
409
Takashi Iwai36c9db72013-01-17 17:07:59 +0100410 if (spec->gpio_mute)
411 spec->gen.master_mute =
412 !(snd_hda_codec_read(codec, codec->afg, 0,
413 AC_VERB_GET_GPIO_DATA, 0) & spec->gpio_mute);
414
415 snd_hda_gen_update_outputs(codec);
416
417 if (spec->eapd_mask && spec->eapd_switch) {
418 unsigned int val = spec->gpio_data;
419 if (spec->gen.speaker_muted)
420 val &= ~spec->eapd_mask;
421 else
422 val |= spec->eapd_mask;
Takashi Iwai9c563a52013-07-19 07:58:02 +0200423 if (spec->gpio_data != val) {
424 spec->gpio_data = val;
Takashi Iwai36c9db72013-01-17 17:07:59 +0100425 stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir,
426 val);
Takashi Iwai9c563a52013-07-19 07:58:02 +0200427 }
Takashi Iwai36c9db72013-01-17 17:07:59 +0100428 }
Matthew Ranostayb22b4822008-01-22 12:32:30 +0100429}
430
Takashi Iwai36c9db72013-01-17 17:07:59 +0100431static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid,
432 bool enable, bool do_write)
Matthew Ranostayb22b4822008-01-22 12:32:30 +0100433{
Matthew Ranostayb22b4822008-01-22 12:32:30 +0100434 struct sigmatel_spec *spec = codec->spec;
Takashi Iwai36c9db72013-01-17 17:07:59 +0100435 unsigned int idx, val;
Matthew Ranostayb22b4822008-01-22 12:32:30 +0100436
Takashi Iwai36c9db72013-01-17 17:07:59 +0100437 for (idx = 0; idx < spec->num_pwrs; idx++) {
438 if (spec->pwr_nids[idx] == nid)
439 break;
440 }
441 if (idx >= spec->num_pwrs)
442 return;
443
444 idx = 1 << idx;
445
446 val = spec->power_map_bits;
447 if (enable)
448 val &= ~idx;
449 else
450 val |= idx;
451
452 /* power down unused output ports */
453 if (val != spec->power_map_bits) {
454 spec->power_map_bits = val;
455 if (do_write)
456 snd_hda_codec_write(codec, codec->afg, 0,
457 AC_VERB_IDT_SET_POWER_MAP, val);
458 }
Matthew Ranostayb22b4822008-01-22 12:32:30 +0100459}
460
Takashi Iwai36c9db72013-01-17 17:07:59 +0100461/* update power bit per jack plug/unplug */
462static void jack_update_power(struct hda_codec *codec,
463 struct hda_jack_tbl *jack)
464{
465 struct sigmatel_spec *spec = codec->spec;
466 int i;
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +0200467
Takashi Iwai36c9db72013-01-17 17:07:59 +0100468 if (!spec->num_pwrs)
469 return;
470
471 if (jack && jack->nid) {
472 stac_toggle_power_map(codec, jack->nid,
473 snd_hda_jack_detect(codec, jack->nid),
474 true);
475 return;
476 }
477
478 /* update all jacks */
479 for (i = 0; i < spec->num_pwrs; i++) {
480 hda_nid_t nid = spec->pwr_nids[i];
481 jack = snd_hda_jack_tbl_get(codec, nid);
482 if (!jack || !jack->action)
483 continue;
484 if (jack->action == STAC_PWR_EVENT ||
485 jack->action <= HDA_GEN_LAST_EVENT)
486 stac_toggle_power_map(codec, nid,
487 snd_hda_jack_detect(codec, nid),
488 false);
489 }
490
491 snd_hda_codec_write(codec, codec->afg, 0, AC_VERB_IDT_SET_POWER_MAP,
492 spec->power_map_bits);
493}
494
495static void stac_hp_automute(struct hda_codec *codec,
496 struct hda_jack_tbl *jack)
497{
498 snd_hda_gen_hp_automute(codec, jack);
499 jack_update_power(codec, jack);
500}
501
502static void stac_line_automute(struct hda_codec *codec,
503 struct hda_jack_tbl *jack)
504{
505 snd_hda_gen_line_automute(codec, jack);
506 jack_update_power(codec, jack);
507}
508
David Henningsson664389d2013-01-28 11:29:17 +0100509static void stac_mic_autoswitch(struct hda_codec *codec,
510 struct hda_jack_tbl *jack)
511{
512 snd_hda_gen_mic_autoswitch(codec, jack);
513 jack_update_power(codec, jack);
514}
515
Takashi Iwai36c9db72013-01-17 17:07:59 +0100516static void stac_vref_event(struct hda_codec *codec, struct hda_jack_tbl *event)
517{
518 unsigned int data;
519
520 data = snd_hda_codec_read(codec, codec->afg, 0,
521 AC_VERB_GET_GPIO_DATA, 0);
522 /* toggle VREF state based on GPIOx status */
523 snd_hda_codec_write(codec, codec->afg, 0, 0x7e0,
524 !!(data & (1 << event->private_data)));
525}
526
527/* initialize the power map and enable the power event to jacks that
528 * haven't been assigned to automute
529 */
530static void stac_init_power_map(struct hda_codec *codec)
531{
532 struct sigmatel_spec *spec = codec->spec;
533 int i;
534
535 for (i = 0; i < spec->num_pwrs; i++) {
536 hda_nid_t nid = spec->pwr_nids[i];
537 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid);
538 def_conf = get_defcfg_connect(def_conf);
539 if (snd_hda_jack_tbl_get(codec, nid))
540 continue;
541 if (def_conf == AC_JACK_PORT_COMPLEX &&
Takashi Iwaic0532c3b2014-09-11 12:59:21 +0200542 spec->vref_mute_led_nid != nid &&
543 is_jack_detectable(codec, nid)) {
Takashi Iwai36c9db72013-01-17 17:07:59 +0100544 snd_hda_jack_detect_enable_callback(codec, nid,
545 STAC_PWR_EVENT,
546 jack_update_power);
547 } else {
548 if (def_conf == AC_JACK_PORT_NONE)
549 stac_toggle_power_map(codec, nid, false, false);
550 else
551 stac_toggle_power_map(codec, nid, true, false);
552 }
553 }
554}
555
556/*
557 */
558
559static inline bool get_int_hint(struct hda_codec *codec, const char *key,
560 int *valp)
561{
562 return !snd_hda_get_int_hint(codec, key, valp);
563}
564
565/* override some hints from the hwdep entry */
566static void stac_store_hints(struct hda_codec *codec)
567{
568 struct sigmatel_spec *spec = codec->spec;
569 int val;
570
571 if (get_int_hint(codec, "gpio_mask", &spec->gpio_mask)) {
572 spec->eapd_mask = spec->gpio_dir = spec->gpio_data =
573 spec->gpio_mask;
574 }
575 if (get_int_hint(codec, "gpio_dir", &spec->gpio_dir))
Takashi Iwai36c9db72013-01-17 17:07:59 +0100576 spec->gpio_dir &= spec->gpio_mask;
Takashi Iwaic5bcceb2015-01-05 13:27:33 +0100577 if (get_int_hint(codec, "gpio_data", &spec->gpio_data))
578 spec->gpio_data &= spec->gpio_mask;
Takashi Iwai36c9db72013-01-17 17:07:59 +0100579 if (get_int_hint(codec, "eapd_mask", &spec->eapd_mask))
580 spec->eapd_mask &= spec->gpio_mask;
581 if (get_int_hint(codec, "gpio_mute", &spec->gpio_mute))
582 spec->gpio_mute &= spec->gpio_mask;
583 val = snd_hda_get_bool_hint(codec, "eapd_switch");
584 if (val >= 0)
585 spec->eapd_switch = val;
586}
587
588/*
589 * loopback controls
590 */
591
592#define stac_aloopback_info snd_ctl_boolean_mono_info
593
594static int stac_aloopback_get(struct snd_kcontrol *kcontrol,
595 struct snd_ctl_elem_value *ucontrol)
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +0200596{
597 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
Matthew Ranostaye1f0d662007-12-13 17:47:21 +0100598 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +0200599 struct sigmatel_spec *spec = codec->spec;
600
Matthew Ranostaye1f0d662007-12-13 17:47:21 +0100601 ucontrol->value.integer.value[0] = !!(spec->aloopback &
602 (spec->aloopback_mask << idx));
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +0200603 return 0;
604}
605
Takashi Iwai36c9db72013-01-17 17:07:59 +0100606static int stac_aloopback_put(struct snd_kcontrol *kcontrol,
607 struct snd_ctl_elem_value *ucontrol)
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +0200608{
609 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
610 struct sigmatel_spec *spec = codec->spec;
Matthew Ranostaye1f0d662007-12-13 17:47:21 +0100611 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +0200612 unsigned int dac_mode;
Matthew Ranostaye1f0d662007-12-13 17:47:21 +0100613 unsigned int val, idx_val;
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +0200614
Matthew Ranostaye1f0d662007-12-13 17:47:21 +0100615 idx_val = spec->aloopback_mask << idx;
616 if (ucontrol->value.integer.value[0])
617 val = spec->aloopback | idx_val;
618 else
619 val = spec->aloopback & ~idx_val;
Takashi Iwai68ea7b22007-11-15 15:54:38 +0100620 if (spec->aloopback == val)
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +0200621 return 0;
622
Takashi Iwai68ea7b22007-11-15 15:54:38 +0100623 spec->aloopback = val;
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +0200624
Matthew Ranostaye1f0d662007-12-13 17:47:21 +0100625 /* Only return the bits defined by the shift value of the
626 * first two bytes of the mask
627 */
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +0200628 dac_mode = snd_hda_codec_read(codec, codec->afg, 0,
Matthew Ranostaye1f0d662007-12-13 17:47:21 +0100629 kcontrol->private_value & 0xFFFF, 0x0);
630 dac_mode >>= spec->aloopback_shift;
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +0200631
Matthew Ranostaye1f0d662007-12-13 17:47:21 +0100632 if (spec->aloopback & idx_val) {
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +0200633 snd_hda_power_up(codec);
Matthew Ranostaye1f0d662007-12-13 17:47:21 +0100634 dac_mode |= idx_val;
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +0200635 } else {
636 snd_hda_power_down(codec);
Matthew Ranostaye1f0d662007-12-13 17:47:21 +0100637 dac_mode &= ~idx_val;
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +0200638 }
639
640 snd_hda_codec_write_cache(codec, codec->afg, 0,
641 kcontrol->private_value >> 16, dac_mode);
642
643 return 1;
644}
645
Takashi Iwai36c9db72013-01-17 17:07:59 +0100646#define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \
647 { \
648 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
649 .name = "Analog Loopback", \
650 .count = cnt, \
651 .info = stac_aloopback_info, \
652 .get = stac_aloopback_get, \
653 .put = stac_aloopback_put, \
654 .private_value = verb_read | (verb_write << 16), \
655 }
656
657/*
658 * Mute LED handling on HP laptops
659 */
660
661/* check whether it's a HP laptop with a docking port */
662static bool hp_bnb2011_with_dock(struct hda_codec *codec)
663{
664 if (codec->vendor_id != 0x111d7605 &&
665 codec->vendor_id != 0x111d76d1)
666 return false;
667
668 switch (codec->subsystem_id) {
669 case 0x103c1618:
670 case 0x103c1619:
671 case 0x103c161a:
672 case 0x103c161b:
673 case 0x103c161c:
674 case 0x103c161d:
675 case 0x103c161e:
676 case 0x103c161f:
677
678 case 0x103c162a:
679 case 0x103c162b:
680
681 case 0x103c1630:
682 case 0x103c1631:
683
684 case 0x103c1633:
685 case 0x103c1634:
686 case 0x103c1635:
687
688 case 0x103c3587:
689 case 0x103c3588:
690 case 0x103c3589:
691 case 0x103c358a:
692
693 case 0x103c3667:
694 case 0x103c3668:
695 case 0x103c3669:
696
697 return true;
698 }
699 return false;
700}
701
702static bool hp_blike_system(u32 subsystem_id)
703{
704 switch (subsystem_id) {
705 case 0x103c1520:
706 case 0x103c1521:
707 case 0x103c1523:
708 case 0x103c1524:
709 case 0x103c1525:
710 case 0x103c1722:
711 case 0x103c1723:
712 case 0x103c1724:
713 case 0x103c1725:
714 case 0x103c1726:
715 case 0x103c1727:
716 case 0x103c1728:
717 case 0x103c1729:
718 case 0x103c172a:
719 case 0x103c172b:
720 case 0x103c307e:
721 case 0x103c307f:
722 case 0x103c3080:
723 case 0x103c3081:
724 case 0x103c7007:
725 case 0x103c7008:
726 return true;
727 }
728 return false;
729}
730
731static void set_hp_led_gpio(struct hda_codec *codec)
732{
733 struct sigmatel_spec *spec = codec->spec;
734 unsigned int gpio;
735
736 if (spec->gpio_led)
737 return;
738
739 gpio = snd_hda_param_read(codec, codec->afg, AC_PAR_GPIO_CAP);
740 gpio &= AC_GPIO_IO_COUNT;
741 if (gpio > 3)
742 spec->gpio_led = 0x08; /* GPIO 3 */
743 else
744 spec->gpio_led = 0x01; /* GPIO 0 */
745}
746
747/*
748 * This method searches for the mute LED GPIO configuration
749 * provided as OEM string in SMBIOS. The format of that string
750 * is HP_Mute_LED_P_G or HP_Mute_LED_P
751 * where P can be 0 or 1 and defines mute LED GPIO control state (low/high)
752 * that corresponds to the NOT muted state of the master volume
753 * and G is the index of the GPIO to use as the mute LED control (0..9)
754 * If _G portion is missing it is assigned based on the codec ID
755 *
756 * So, HP B-series like systems may have HP_Mute_LED_0 (current models)
757 * or HP_Mute_LED_0_3 (future models) OEM SMBIOS strings
758 *
759 *
760 * The dv-series laptops don't seem to have the HP_Mute_LED* strings in
761 * SMBIOS - at least the ones I have seen do not have them - which include
762 * my own system (HP Pavilion dv6-1110ax) and my cousin's
763 * HP Pavilion dv9500t CTO.
764 * Need more information on whether it is true across the entire series.
765 * -- kunal
766 */
767static int find_mute_led_cfg(struct hda_codec *codec, int default_polarity)
768{
769 struct sigmatel_spec *spec = codec->spec;
770 const struct dmi_device *dev = NULL;
771
772 if (get_int_hint(codec, "gpio_led", &spec->gpio_led)) {
773 get_int_hint(codec, "gpio_led_polarity",
774 &spec->gpio_led_polarity);
775 return 1;
776 }
777
778 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
779 if (sscanf(dev->name, "HP_Mute_LED_%d_%x",
780 &spec->gpio_led_polarity,
781 &spec->gpio_led) == 2) {
782 unsigned int max_gpio;
783 max_gpio = snd_hda_param_read(codec, codec->afg,
784 AC_PAR_GPIO_CAP);
785 max_gpio &= AC_GPIO_IO_COUNT;
786 if (spec->gpio_led < max_gpio)
787 spec->gpio_led = 1 << spec->gpio_led;
788 else
789 spec->vref_mute_led_nid = spec->gpio_led;
790 return 1;
791 }
792 if (sscanf(dev->name, "HP_Mute_LED_%d",
793 &spec->gpio_led_polarity) == 1) {
794 set_hp_led_gpio(codec);
795 return 1;
796 }
797 /* BIOS bug: unfilled OEM string */
798 if (strstr(dev->name, "HP_Mute_LED_P_G")) {
799 set_hp_led_gpio(codec);
800 if (default_polarity >= 0)
801 spec->gpio_led_polarity = default_polarity;
802 else
803 spec->gpio_led_polarity = 1;
804 return 1;
805 }
806 }
807
808 /*
809 * Fallback case - if we don't find the DMI strings,
810 * we statically set the GPIO - if not a B-series system
811 * and default polarity is provided
812 */
813 if (!hp_blike_system(codec->subsystem_id) &&
814 (default_polarity == 0 || default_polarity == 1)) {
815 set_hp_led_gpio(codec);
816 spec->gpio_led_polarity = default_polarity;
817 return 1;
818 }
819 return 0;
820}
821
David Henningsson303985f2013-03-14 15:28:29 +0100822/* check whether a built-in speaker is included in parsed pins */
823static bool has_builtin_speaker(struct hda_codec *codec)
824{
825 struct sigmatel_spec *spec = codec->spec;
826 hda_nid_t *nid_pin;
827 int nids, i;
828
829 if (spec->gen.autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) {
830 nid_pin = spec->gen.autocfg.line_out_pins;
831 nids = spec->gen.autocfg.line_outs;
832 } else {
833 nid_pin = spec->gen.autocfg.speaker_pins;
834 nids = spec->gen.autocfg.speaker_outs;
835 }
836
837 for (i = 0; i < nids; i++) {
838 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid_pin[i]);
839 if (snd_hda_get_input_pin_attr(def_conf) == INPUT_PIN_ATTR_INT)
840 return true;
841 }
842 return false;
843}
844
Takashi Iwai36c9db72013-01-17 17:07:59 +0100845/*
846 * PC beep controls
847 */
848
849/* create PC beep volume controls */
850static int stac_auto_create_beep_ctls(struct hda_codec *codec,
851 hda_nid_t nid)
852{
853 struct sigmatel_spec *spec = codec->spec;
854 u32 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
855 struct snd_kcontrol_new *knew;
856 static struct snd_kcontrol_new abeep_mute_ctl =
857 HDA_CODEC_MUTE(NULL, 0, 0, 0);
858 static struct snd_kcontrol_new dbeep_mute_ctl =
859 HDA_CODEC_MUTE_BEEP(NULL, 0, 0, 0);
860 static struct snd_kcontrol_new beep_vol_ctl =
861 HDA_CODEC_VOLUME(NULL, 0, 0, 0);
862
863 /* check for mute support for the the amp */
864 if ((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT) {
865 const struct snd_kcontrol_new *temp;
866 if (spec->anabeep_nid == nid)
867 temp = &abeep_mute_ctl;
868 else
869 temp = &dbeep_mute_ctl;
870 knew = snd_hda_gen_add_kctl(&spec->gen,
871 "Beep Playback Switch", temp);
872 if (!knew)
873 return -ENOMEM;
874 knew->private_value =
875 HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT);
876 }
877
878 /* check to see if there is volume support for the amp */
879 if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) {
880 knew = snd_hda_gen_add_kctl(&spec->gen,
881 "Beep Playback Volume",
882 &beep_vol_ctl);
883 if (!knew)
884 return -ENOMEM;
885 knew->private_value =
886 HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT);
887 }
888 return 0;
889}
890
891#ifdef CONFIG_SND_HDA_INPUT_BEEP
892#define stac_dig_beep_switch_info snd_ctl_boolean_mono_info
893
894static int stac_dig_beep_switch_get(struct snd_kcontrol *kcontrol,
895 struct snd_ctl_elem_value *ucontrol)
896{
897 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
898 ucontrol->value.integer.value[0] = codec->beep->enabled;
899 return 0;
900}
901
902static int stac_dig_beep_switch_put(struct snd_kcontrol *kcontrol,
903 struct snd_ctl_elem_value *ucontrol)
904{
905 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
906 return snd_hda_enable_beep_device(codec, ucontrol->value.integer.value[0]);
907}
908
909static const struct snd_kcontrol_new stac_dig_beep_ctrl = {
910 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
911 .name = "Beep Playback Switch",
912 .info = stac_dig_beep_switch_info,
913 .get = stac_dig_beep_switch_get,
914 .put = stac_dig_beep_switch_put,
915};
916
917static int stac_beep_switch_ctl(struct hda_codec *codec)
918{
919 struct sigmatel_spec *spec = codec->spec;
920
921 if (!snd_hda_gen_add_kctl(&spec->gen, NULL, &stac_dig_beep_ctrl))
922 return -ENOMEM;
923 return 0;
924}
925#endif
926
927/*
Takashi Iwai42875472013-01-22 09:34:48 +0100928 * SPDIF-out mux controls
929 */
930
931static int stac_smux_enum_info(struct snd_kcontrol *kcontrol,
932 struct snd_ctl_elem_info *uinfo)
933{
934 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
935 struct sigmatel_spec *spec = codec->spec;
936 return snd_hda_input_mux_info(&spec->spdif_mux, uinfo);
937}
938
939static int stac_smux_enum_get(struct snd_kcontrol *kcontrol,
940 struct snd_ctl_elem_value *ucontrol)
941{
942 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
943 struct sigmatel_spec *spec = codec->spec;
944 unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
945
946 ucontrol->value.enumerated.item[0] = spec->cur_smux[smux_idx];
947 return 0;
948}
949
950static int stac_smux_enum_put(struct snd_kcontrol *kcontrol,
951 struct snd_ctl_elem_value *ucontrol)
952{
953 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
954 struct sigmatel_spec *spec = codec->spec;
955 unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
956
957 return snd_hda_input_mux_put(codec, &spec->spdif_mux, ucontrol,
958 spec->gen.autocfg.dig_out_pins[smux_idx],
959 &spec->cur_smux[smux_idx]);
960}
961
962static struct snd_kcontrol_new stac_smux_mixer = {
963 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
964 .name = "IEC958 Playback Source",
965 /* count set later */
966 .info = stac_smux_enum_info,
967 .get = stac_smux_enum_get,
968 .put = stac_smux_enum_put,
969};
970
971static const char * const stac_spdif_labels[] = {
972 "Digital Playback", "Analog Mux 1", "Analog Mux 2", NULL
973};
974
975static int stac_create_spdif_mux_ctls(struct hda_codec *codec)
976{
977 struct sigmatel_spec *spec = codec->spec;
978 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
979 const char * const *labels = spec->spdif_labels;
980 struct snd_kcontrol_new *kctl;
981 int i, num_cons;
982
983 if (cfg->dig_outs < 1)
984 return 0;
985
986 num_cons = snd_hda_get_num_conns(codec, cfg->dig_out_pins[0]);
987 if (num_cons <= 1)
988 return 0;
989
990 if (!labels)
991 labels = stac_spdif_labels;
992 for (i = 0; i < num_cons; i++) {
993 if (snd_BUG_ON(!labels[i]))
994 return -EINVAL;
995 snd_hda_add_imux_item(&spec->spdif_mux, labels[i], i, NULL);
996 }
997
998 kctl = snd_hda_gen_add_kctl(&spec->gen, NULL, &stac_smux_mixer);
999 if (!kctl)
1000 return -ENOMEM;
1001 kctl->count = cfg->dig_outs;
1002
1003 return 0;
1004}
1005
1006/*
Takashi Iwai36c9db72013-01-17 17:07:59 +01001007 */
1008
Takashi Iwai2b635362011-05-02 12:33:43 +02001009static const struct hda_verb stac9200_core_init[] = {
Matt2f2f4252005-04-13 14:45:30 +02001010 /* set dac0mux for dac converter */
Mattc7d4b2f2005-06-27 14:59:41 +02001011 { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
Matt2f2f4252005-04-13 14:45:30 +02001012 {}
1013};
1014
Takashi Iwai2b635362011-05-02 12:33:43 +02001015static const struct hda_verb stac9200_eapd_init[] = {
Takashi Iwai1194b5b2007-10-10 10:04:26 +02001016 /* set dac0mux for dac converter */
1017 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1018 {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1019 {}
1020};
1021
Takashi Iwai2b635362011-05-02 12:33:43 +02001022static const struct hda_verb dell_eq_core_init[] = {
Matthew Ranostayd654a662008-03-14 08:46:51 +01001023 /* set master volume to max value without distortion
1024 * and direct control */
1025 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec},
Matthew Ranostayd654a662008-03-14 08:46:51 +01001026 {}
1027};
1028
Takashi Iwai2b635362011-05-02 12:33:43 +02001029static const struct hda_verb stac92hd73xx_core_init[] = {
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01001030 /* set master volume and direct control */
1031 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01001032 {}
1033};
1034
Takashi Iwai2b635362011-05-02 12:33:43 +02001035static const struct hda_verb stac92hd83xxx_core_init[] = {
Matthew Ranostayd0513fc2008-07-27 10:30:30 +02001036 /* power state controls amps */
1037 { 0x01, AC_VERB_SET_EAPD, 1 << 2},
Herton Ronaldo Krzesinski574f3c42008-12-23 16:53:00 -02001038 {}
Matthew Ranostayd0513fc2008-07-27 10:30:30 +02001039};
1040
Vitaliy Kulikov5556e142012-02-27 16:47:37 -06001041static const struct hda_verb stac92hd83xxx_hp_zephyr_init[] = {
1042 { 0x22, 0x785, 0x43 },
1043 { 0x22, 0x782, 0xe0 },
1044 { 0x22, 0x795, 0x00 },
1045 {}
1046};
1047
Takashi Iwai2b635362011-05-02 12:33:43 +02001048static const struct hda_verb stac92hd71bxx_core_init[] = {
Matthew Ranostaye035b842007-11-06 11:53:55 +01001049 /* set master volume and direct control */
1050 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
Herton Ronaldo Krzesinski574f3c42008-12-23 16:53:00 -02001051 {}
Matthew Ranostay541eee82007-12-14 12:08:04 +01001052};
1053
Takashi Iwai2b635362011-05-02 12:33:43 +02001054static const struct hda_verb stac92hd71bxx_unmute_core_init[] = {
Matthew Ranostayca8d33f2009-01-26 09:33:52 -05001055 /* unmute right and left channels for nodes 0x0f, 0xa, 0x0d */
1056 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
Matthew Ranostaye035b842007-11-06 11:53:55 +01001057 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1058 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
Matthew Ranostaye035b842007-11-06 11:53:55 +01001059 {}
1060};
1061
Takashi Iwai2b635362011-05-02 12:33:43 +02001062static const struct hda_verb stac925x_core_init[] = {
Tobin Davis8e21c342007-01-08 11:04:17 +01001063 /* set dac0mux for dac converter */
1064 { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00},
Takashi Iwaic9280d62009-01-15 17:31:00 +01001065 /* mute the master volume */
1066 { 0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
Tobin Davis8e21c342007-01-08 11:04:17 +01001067 {}
1068};
1069
Takashi Iwai2b635362011-05-02 12:33:43 +02001070static const struct hda_verb stac922x_core_init[] = {
Takashi Iwai36c9db72013-01-17 17:07:59 +01001071 /* set master volume and direct control */
Mattc7d4b2f2005-06-27 14:59:41 +02001072 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
Matt2f2f4252005-04-13 14:45:30 +02001073 {}
1074};
1075
Takashi Iwai2b635362011-05-02 12:33:43 +02001076static const struct hda_verb d965_core_init[] = {
Takashi Iwai19039bd2006-06-28 15:52:16 +02001077 /* unmute node 0x1b */
1078 { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
Takashi Iwai36c9db72013-01-17 17:07:59 +01001079 /* select node 0x03 as DAC */
Takashi Iwai19039bd2006-06-28 15:52:16 +02001080 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
1081 {}
1082};
1083
Takashi Iwai2b635362011-05-02 12:33:43 +02001084static const struct hda_verb dell_3st_core_init[] = {
Takashi Iwaiccca7cd2009-10-13 15:32:21 +02001085 /* don't set delta bit */
1086 {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f},
1087 /* unmute node 0x1b */
1088 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
1089 /* select node 0x03 as DAC */
1090 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
1091 {}
1092};
1093
Takashi Iwai2b635362011-05-02 12:33:43 +02001094static const struct hda_verb stac927x_core_init[] = {
Takashi Iwai36c9db72013-01-17 17:07:59 +01001095 /* set master volume and direct control */
Matt Porter3cc08dc2006-01-23 15:27:49 +01001096 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
Matthew Ranostay1cd22242008-07-18 18:20:52 +02001097 /* enable analog pc beep path */
1098 { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
Matt Porter3cc08dc2006-01-23 15:27:49 +01001099 {}
1100};
1101
Takashi Iwai2b635362011-05-02 12:33:43 +02001102static const struct hda_verb stac927x_volknob_core_init[] = {
Takashi Iwai54930532009-10-11 17:38:29 +02001103 /* don't set delta bit */
1104 {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f},
1105 /* enable analog pc beep path */
1106 {0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
1107 {}
1108};
1109
Takashi Iwai2b635362011-05-02 12:33:43 +02001110static const struct hda_verb stac9205_core_init[] = {
Takashi Iwai36c9db72013-01-17 17:07:59 +01001111 /* set master volume and direct control */
Matt Porterf3302a52006-07-31 12:49:34 +02001112 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
Matthew Ranostayd0513fc2008-07-27 10:30:30 +02001113 /* enable analog pc beep path */
1114 { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
Matt Porterf3302a52006-07-31 12:49:34 +02001115 {}
1116};
1117
Takashi Iwai36c9db72013-01-17 17:07:59 +01001118static const struct snd_kcontrol_new stac92hd73xx_6ch_loopback =
1119 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3);
Matthew Ranostayb22b4822008-01-22 12:32:30 +01001120
Takashi Iwai36c9db72013-01-17 17:07:59 +01001121static const struct snd_kcontrol_new stac92hd73xx_8ch_loopback =
1122 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4);
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +02001123
Takashi Iwai36c9db72013-01-17 17:07:59 +01001124static const struct snd_kcontrol_new stac92hd73xx_10ch_loopback =
1125 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5);
Nickolas Lloyd2fc99892009-05-15 15:33:30 +02001126
Takashi Iwai36c9db72013-01-17 17:07:59 +01001127static const struct snd_kcontrol_new stac92hd71bxx_loopback =
1128 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2);
Matt2f2f4252005-04-13 14:45:30 +02001129
Takashi Iwai36c9db72013-01-17 17:07:59 +01001130static const struct snd_kcontrol_new stac9205_loopback =
1131 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1);
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01001132
Takashi Iwai36c9db72013-01-17 17:07:59 +01001133static const struct snd_kcontrol_new stac927x_loopback =
1134 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1);
Matt2f2f4252005-04-13 14:45:30 +02001135
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001136static const struct hda_pintbl ref9200_pin_configs[] = {
1137 { 0x08, 0x01c47010 },
1138 { 0x09, 0x01447010 },
1139 { 0x0d, 0x0221401f },
1140 { 0x0e, 0x01114010 },
1141 { 0x0f, 0x02a19020 },
1142 { 0x10, 0x01a19021 },
1143 { 0x11, 0x90100140 },
1144 { 0x12, 0x01813122 },
1145 {}
Matt2f2f4252005-04-13 14:45:30 +02001146};
1147
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001148static const struct hda_pintbl gateway9200_m4_pin_configs[] = {
1149 { 0x08, 0x400000fe },
1150 { 0x09, 0x404500f4 },
1151 { 0x0d, 0x400100f0 },
1152 { 0x0e, 0x90110010 },
1153 { 0x0f, 0x400100f1 },
1154 { 0x10, 0x02a1902e },
1155 { 0x11, 0x500000f2 },
1156 { 0x12, 0x500000f3 },
1157 {}
Mauro Carvalho Chehab58eec422008-08-11 10:18:39 +02001158};
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001159
1160static const struct hda_pintbl gateway9200_m4_2_pin_configs[] = {
1161 { 0x08, 0x400000fe },
1162 { 0x09, 0x404500f4 },
1163 { 0x0d, 0x400100f0 },
1164 { 0x0e, 0x90110010 },
1165 { 0x0f, 0x400100f1 },
1166 { 0x10, 0x02a1902e },
1167 { 0x11, 0x500000f2 },
1168 { 0x12, 0x500000f3 },
1169 {}
Mauro Carvalho Chehab58eec422008-08-11 10:18:39 +02001170};
1171
1172/*
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001173 STAC 9200 pin configs for
1174 102801A8
1175 102801DE
1176 102801E8
1177*/
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001178static const struct hda_pintbl dell9200_d21_pin_configs[] = {
1179 { 0x08, 0x400001f0 },
1180 { 0x09, 0x400001f1 },
1181 { 0x0d, 0x02214030 },
1182 { 0x0e, 0x01014010 },
1183 { 0x0f, 0x02a19020 },
1184 { 0x10, 0x01a19021 },
1185 { 0x11, 0x90100140 },
1186 { 0x12, 0x01813122 },
1187 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001188};
1189
Takashi Iwai36c9db72013-01-17 17:07:59 +01001190/*
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001191 STAC 9200 pin configs for
1192 102801C0
1193 102801C1
1194*/
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001195static const struct hda_pintbl dell9200_d22_pin_configs[] = {
1196 { 0x08, 0x400001f0 },
1197 { 0x09, 0x400001f1 },
1198 { 0x0d, 0x0221401f },
1199 { 0x0e, 0x01014010 },
1200 { 0x0f, 0x01813020 },
1201 { 0x10, 0x02a19021 },
1202 { 0x11, 0x90100140 },
1203 { 0x12, 0x400001f2 },
1204 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001205};
1206
Takashi Iwai36c9db72013-01-17 17:07:59 +01001207/*
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001208 STAC 9200 pin configs for
1209 102801C4 (Dell Dimension E310)
1210 102801C5
1211 102801C7
1212 102801D9
1213 102801DA
1214 102801E3
1215*/
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001216static const struct hda_pintbl dell9200_d23_pin_configs[] = {
1217 { 0x08, 0x400001f0 },
1218 { 0x09, 0x400001f1 },
1219 { 0x0d, 0x0221401f },
1220 { 0x0e, 0x01014010 },
1221 { 0x0f, 0x01813020 },
1222 { 0x10, 0x01a19021 },
1223 { 0x11, 0x90100140 },
1224 { 0x12, 0x400001f2 },
1225 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001226};
1227
1228
1229/*
1230 STAC 9200-32 pin configs for
1231 102801B5 (Dell Inspiron 630m)
1232 102801D8 (Dell Inspiron 640m)
1233*/
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001234static const struct hda_pintbl dell9200_m21_pin_configs[] = {
1235 { 0x08, 0x40c003fa },
1236 { 0x09, 0x03441340 },
1237 { 0x0d, 0x0321121f },
1238 { 0x0e, 0x90170310 },
1239 { 0x0f, 0x408003fb },
1240 { 0x10, 0x03a11020 },
1241 { 0x11, 0x401003fc },
1242 { 0x12, 0x403003fd },
1243 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001244};
1245
1246/*
1247 STAC 9200-32 pin configs for
1248 102801C2 (Dell Latitude D620)
1249 102801C8
1250 102801CC (Dell Latitude D820)
1251 102801D4
1252 102801D6
1253*/
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001254static const struct hda_pintbl dell9200_m22_pin_configs[] = {
1255 { 0x08, 0x40c003fa },
1256 { 0x09, 0x0144131f },
1257 { 0x0d, 0x0321121f },
1258 { 0x0e, 0x90170310 },
1259 { 0x0f, 0x90a70321 },
1260 { 0x10, 0x03a11020 },
1261 { 0x11, 0x401003fb },
1262 { 0x12, 0x40f000fc },
1263 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001264};
1265
1266/*
1267 STAC 9200-32 pin configs for
1268 102801CE (Dell XPS M1710)
1269 102801CF (Dell Precision M90)
1270*/
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001271static const struct hda_pintbl dell9200_m23_pin_configs[] = {
1272 { 0x08, 0x40c003fa },
1273 { 0x09, 0x01441340 },
1274 { 0x0d, 0x0421421f },
1275 { 0x0e, 0x90170310 },
1276 { 0x0f, 0x408003fb },
1277 { 0x10, 0x04a1102e },
1278 { 0x11, 0x90170311 },
1279 { 0x12, 0x403003fc },
1280 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001281};
1282
1283/*
1284 STAC 9200-32 pin configs for
1285 102801C9
1286 102801CA
1287 102801CB (Dell Latitude 120L)
1288 102801D3
1289*/
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001290static const struct hda_pintbl dell9200_m24_pin_configs[] = {
1291 { 0x08, 0x40c003fa },
1292 { 0x09, 0x404003fb },
1293 { 0x0d, 0x0321121f },
1294 { 0x0e, 0x90170310 },
1295 { 0x0f, 0x408003fc },
1296 { 0x10, 0x03a11020 },
1297 { 0x11, 0x401003fd },
1298 { 0x12, 0x403003fe },
1299 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001300};
1301
1302/*
1303 STAC 9200-32 pin configs for
1304 102801BD (Dell Inspiron E1505n)
1305 102801EE
1306 102801EF
1307*/
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001308static const struct hda_pintbl dell9200_m25_pin_configs[] = {
1309 { 0x08, 0x40c003fa },
1310 { 0x09, 0x01441340 },
1311 { 0x0d, 0x0421121f },
1312 { 0x0e, 0x90170310 },
1313 { 0x0f, 0x408003fb },
1314 { 0x10, 0x04a11020 },
1315 { 0x11, 0x401003fc },
1316 { 0x12, 0x403003fd },
1317 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001318};
1319
1320/*
1321 STAC 9200-32 pin configs for
1322 102801F5 (Dell Inspiron 1501)
1323 102801F6
1324*/
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001325static const struct hda_pintbl dell9200_m26_pin_configs[] = {
1326 { 0x08, 0x40c003fa },
1327 { 0x09, 0x404003fb },
1328 { 0x0d, 0x0421121f },
1329 { 0x0e, 0x90170310 },
1330 { 0x0f, 0x408003fc },
1331 { 0x10, 0x04a11020 },
1332 { 0x11, 0x401003fd },
1333 { 0x12, 0x403003fe },
1334 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001335};
1336
1337/*
1338 STAC 9200-32
1339 102801CD (Dell Inspiron E1705/9400)
1340*/
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001341static const struct hda_pintbl dell9200_m27_pin_configs[] = {
1342 { 0x08, 0x40c003fa },
1343 { 0x09, 0x01441340 },
1344 { 0x0d, 0x0421121f },
1345 { 0x0e, 0x90170310 },
1346 { 0x0f, 0x90170310 },
1347 { 0x10, 0x04a11020 },
1348 { 0x11, 0x90170310 },
1349 { 0x12, 0x40f003fc },
1350 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001351};
1352
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001353static const struct hda_pintbl oqo9200_pin_configs[] = {
1354 { 0x08, 0x40c000f0 },
1355 { 0x09, 0x404000f1 },
1356 { 0x0d, 0x0221121f },
1357 { 0x0e, 0x02211210 },
1358 { 0x0f, 0x90170111 },
1359 { 0x10, 0x90a70120 },
1360 { 0x11, 0x400000f2 },
1361 { 0x12, 0x400000f3 },
1362 {}
Tobin Davisbf277782008-02-03 20:31:47 +01001363};
1364
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001365
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001366static void stac9200_fixup_panasonic(struct hda_codec *codec,
1367 const struct hda_fixup *fix, int action)
1368{
1369 struct sigmatel_spec *spec = codec->spec;
1370
Takashi Iwai36c9db72013-01-17 17:07:59 +01001371 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001372 spec->gpio_mask = spec->gpio_dir = 0x09;
1373 spec->gpio_data = 0x00;
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001374 /* CF-74 has no headphone detection, and the driver should *NOT*
1375 * do detection and HP/speaker toggle because the hardware does it.
1376 */
Takashi Iwai36c9db72013-01-17 17:07:59 +01001377 spec->gen.suppress_auto_mute = 1;
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001378 }
1379}
1380
1381
1382static const struct hda_fixup stac9200_fixups[] = {
1383 [STAC_REF] = {
1384 .type = HDA_FIXUP_PINS,
1385 .v.pins = ref9200_pin_configs,
1386 },
1387 [STAC_9200_OQO] = {
1388 .type = HDA_FIXUP_PINS,
1389 .v.pins = oqo9200_pin_configs,
1390 .chained = true,
1391 .chain_id = STAC_9200_EAPD_INIT,
1392 },
1393 [STAC_9200_DELL_D21] = {
1394 .type = HDA_FIXUP_PINS,
1395 .v.pins = dell9200_d21_pin_configs,
1396 },
1397 [STAC_9200_DELL_D22] = {
1398 .type = HDA_FIXUP_PINS,
1399 .v.pins = dell9200_d22_pin_configs,
1400 },
1401 [STAC_9200_DELL_D23] = {
1402 .type = HDA_FIXUP_PINS,
1403 .v.pins = dell9200_d23_pin_configs,
1404 },
1405 [STAC_9200_DELL_M21] = {
1406 .type = HDA_FIXUP_PINS,
1407 .v.pins = dell9200_m21_pin_configs,
1408 },
1409 [STAC_9200_DELL_M22] = {
1410 .type = HDA_FIXUP_PINS,
1411 .v.pins = dell9200_m22_pin_configs,
1412 },
1413 [STAC_9200_DELL_M23] = {
1414 .type = HDA_FIXUP_PINS,
1415 .v.pins = dell9200_m23_pin_configs,
1416 },
1417 [STAC_9200_DELL_M24] = {
1418 .type = HDA_FIXUP_PINS,
1419 .v.pins = dell9200_m24_pin_configs,
1420 },
1421 [STAC_9200_DELL_M25] = {
1422 .type = HDA_FIXUP_PINS,
1423 .v.pins = dell9200_m25_pin_configs,
1424 },
1425 [STAC_9200_DELL_M26] = {
1426 .type = HDA_FIXUP_PINS,
1427 .v.pins = dell9200_m26_pin_configs,
1428 },
1429 [STAC_9200_DELL_M27] = {
1430 .type = HDA_FIXUP_PINS,
1431 .v.pins = dell9200_m27_pin_configs,
1432 },
1433 [STAC_9200_M4] = {
1434 .type = HDA_FIXUP_PINS,
1435 .v.pins = gateway9200_m4_pin_configs,
1436 .chained = true,
1437 .chain_id = STAC_9200_EAPD_INIT,
1438 },
1439 [STAC_9200_M4_2] = {
1440 .type = HDA_FIXUP_PINS,
1441 .v.pins = gateway9200_m4_2_pin_configs,
1442 .chained = true,
1443 .chain_id = STAC_9200_EAPD_INIT,
1444 },
1445 [STAC_9200_PANASONIC] = {
1446 .type = HDA_FIXUP_FUNC,
1447 .v.func = stac9200_fixup_panasonic,
1448 },
1449 [STAC_9200_EAPD_INIT] = {
1450 .type = HDA_FIXUP_VERBS,
1451 .v.verbs = (const struct hda_verb[]) {
1452 {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1453 {}
1454 },
1455 },
Matt Porter403d1942005-11-29 15:00:51 +01001456};
1457
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001458static const struct hda_model_fixup stac9200_models[] = {
1459 { .id = STAC_REF, .name = "ref" },
1460 { .id = STAC_9200_OQO, .name = "oqo" },
1461 { .id = STAC_9200_DELL_D21, .name = "dell-d21" },
1462 { .id = STAC_9200_DELL_D22, .name = "dell-d22" },
1463 { .id = STAC_9200_DELL_D23, .name = "dell-d23" },
1464 { .id = STAC_9200_DELL_M21, .name = "dell-m21" },
1465 { .id = STAC_9200_DELL_M22, .name = "dell-m22" },
1466 { .id = STAC_9200_DELL_M23, .name = "dell-m23" },
1467 { .id = STAC_9200_DELL_M24, .name = "dell-m24" },
1468 { .id = STAC_9200_DELL_M25, .name = "dell-m25" },
1469 { .id = STAC_9200_DELL_M26, .name = "dell-m26" },
1470 { .id = STAC_9200_DELL_M27, .name = "dell-m27" },
1471 { .id = STAC_9200_M4, .name = "gateway-m4" },
1472 { .id = STAC_9200_M4_2, .name = "gateway-m4-2" },
1473 { .id = STAC_9200_PANASONIC, .name = "panasonic" },
1474 {}
Takashi Iwaif5fcc132006-11-24 17:07:44 +01001475};
1476
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001477static const struct snd_pci_quirk stac9200_fixup_tbl[] = {
Takashi Iwaif5fcc132006-11-24 17:07:44 +01001478 /* SigmaTel reference board */
1479 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1480 "DFI LanParty", STAC_REF),
Matthew Ranostay577aa2c2009-01-22 22:55:44 -05001481 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
1482 "DFI LanParty", STAC_REF),
Matt Portere7377072006-11-06 11:20:38 +01001483 /* Dell laptops have BIOS problem */
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001484 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8,
1485 "unknown Dell", STAC_9200_DELL_D21),
Takashi Iwaif5fcc132006-11-24 17:07:44 +01001486 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5,
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001487 "Dell Inspiron 630m", STAC_9200_DELL_M21),
1488 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bd,
1489 "Dell Inspiron E1505n", STAC_9200_DELL_M25),
1490 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c0,
1491 "unknown Dell", STAC_9200_DELL_D22),
1492 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c1,
1493 "unknown Dell", STAC_9200_DELL_D22),
Takashi Iwaif5fcc132006-11-24 17:07:44 +01001494 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2,
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001495 "Dell Latitude D620", STAC_9200_DELL_M22),
1496 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c5,
1497 "unknown Dell", STAC_9200_DELL_D23),
1498 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c7,
1499 "unknown Dell", STAC_9200_DELL_D23),
1500 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c8,
1501 "unknown Dell", STAC_9200_DELL_M22),
1502 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c9,
1503 "unknown Dell", STAC_9200_DELL_M24),
1504 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ca,
1505 "unknown Dell", STAC_9200_DELL_M24),
Takashi Iwaif5fcc132006-11-24 17:07:44 +01001506 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb,
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001507 "Dell Latitude 120L", STAC_9200_DELL_M24),
Cory T. Tusar877b8662007-01-30 17:30:55 +01001508 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc,
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001509 "Dell Latitude D820", STAC_9200_DELL_M22),
Mikael Nilsson46f02ca2007-02-13 12:46:16 +01001510 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cd,
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001511 "Dell Inspiron E1705/9400", STAC_9200_DELL_M27),
Mikael Nilsson46f02ca2007-02-13 12:46:16 +01001512 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce,
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001513 "Dell XPS M1710", STAC_9200_DELL_M23),
Takashi Iwaif0f96742007-02-14 00:59:17 +01001514 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf,
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001515 "Dell Precision M90", STAC_9200_DELL_M23),
1516 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d3,
1517 "unknown Dell", STAC_9200_DELL_M22),
1518 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d4,
1519 "unknown Dell", STAC_9200_DELL_M22),
Daniel T Chen8286c532007-05-15 11:46:23 +02001520 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6,
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001521 "unknown Dell", STAC_9200_DELL_M22),
Tobin Davis49c605d2007-05-17 09:38:24 +02001522 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8,
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001523 "Dell Inspiron 640m", STAC_9200_DELL_M21),
1524 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d9,
1525 "unknown Dell", STAC_9200_DELL_D23),
1526 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01da,
1527 "unknown Dell", STAC_9200_DELL_D23),
1528 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01de,
1529 "unknown Dell", STAC_9200_DELL_D21),
1530 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e3,
1531 "unknown Dell", STAC_9200_DELL_D23),
1532 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e8,
1533 "unknown Dell", STAC_9200_DELL_D21),
1534 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ee,
1535 "unknown Dell", STAC_9200_DELL_M25),
1536 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ef,
1537 "unknown Dell", STAC_9200_DELL_M25),
Tobin Davis49c605d2007-05-17 09:38:24 +02001538 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5,
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001539 "Dell Inspiron 1501", STAC_9200_DELL_M26),
1540 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6,
1541 "unknown Dell", STAC_9200_DELL_M26),
Tobin Davis49c605d2007-05-17 09:38:24 +02001542 /* Panasonic */
Takashi Iwai117f2572008-03-18 09:53:23 +01001543 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC),
Takashi Iwai1194b5b2007-10-10 10:04:26 +02001544 /* Gateway machines needs EAPD to be set on resume */
Mauro Carvalho Chehab58eec422008-08-11 10:18:39 +02001545 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_M4),
1546 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", STAC_9200_M4_2),
1547 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", STAC_9200_M4_2),
Tobin Davisbf277782008-02-03 20:31:47 +01001548 /* OQO Mobile */
1549 SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO),
Matt Porter403d1942005-11-29 15:00:51 +01001550 {} /* terminator */
1551};
1552
Takashi Iwaid2077d42013-01-14 14:20:16 +01001553static const struct hda_pintbl ref925x_pin_configs[] = {
1554 { 0x07, 0x40c003f0 },
1555 { 0x08, 0x424503f2 },
1556 { 0x0a, 0x01813022 },
1557 { 0x0b, 0x02a19021 },
1558 { 0x0c, 0x90a70320 },
1559 { 0x0d, 0x02214210 },
1560 { 0x10, 0x01019020 },
1561 { 0x11, 0x9033032e },
1562 {}
Tobin Davis8e21c342007-01-08 11:04:17 +01001563};
1564
Takashi Iwaid2077d42013-01-14 14:20:16 +01001565static const struct hda_pintbl stac925xM1_pin_configs[] = {
1566 { 0x07, 0x40c003f4 },
1567 { 0x08, 0x424503f2 },
1568 { 0x0a, 0x400000f3 },
1569 { 0x0b, 0x02a19020 },
1570 { 0x0c, 0x40a000f0 },
1571 { 0x0d, 0x90100210 },
1572 { 0x10, 0x400003f1 },
1573 { 0x11, 0x9033032e },
1574 {}
Tobin Davis8e21c342007-01-08 11:04:17 +01001575};
1576
Takashi Iwaid2077d42013-01-14 14:20:16 +01001577static const struct hda_pintbl stac925xM1_2_pin_configs[] = {
1578 { 0x07, 0x40c003f4 },
1579 { 0x08, 0x424503f2 },
1580 { 0x0a, 0x400000f3 },
1581 { 0x0b, 0x02a19020 },
1582 { 0x0c, 0x40a000f0 },
1583 { 0x0d, 0x90100210 },
1584 { 0x10, 0x400003f1 },
1585 { 0x11, 0x9033032e },
1586 {}
Mauro Carvalho Chehab9cb36c22008-08-11 10:18:39 +02001587};
Mauro Carvalho Chehab58eec422008-08-11 10:18:39 +02001588
Takashi Iwaid2077d42013-01-14 14:20:16 +01001589static const struct hda_pintbl stac925xM2_pin_configs[] = {
1590 { 0x07, 0x40c003f4 },
1591 { 0x08, 0x424503f2 },
1592 { 0x0a, 0x400000f3 },
1593 { 0x0b, 0x02a19020 },
1594 { 0x0c, 0x40a000f0 },
1595 { 0x0d, 0x90100210 },
1596 { 0x10, 0x400003f1 },
1597 { 0x11, 0x9033032e },
1598 {}
Tobin Davis2c11f952007-05-17 09:36:34 +02001599};
1600
Takashi Iwaid2077d42013-01-14 14:20:16 +01001601static const struct hda_pintbl stac925xM2_2_pin_configs[] = {
1602 { 0x07, 0x40c003f4 },
1603 { 0x08, 0x424503f2 },
1604 { 0x0a, 0x400000f3 },
1605 { 0x0b, 0x02a19020 },
1606 { 0x0c, 0x40a000f0 },
1607 { 0x0d, 0x90100210 },
1608 { 0x10, 0x400003f1 },
1609 { 0x11, 0x9033032e },
1610 {}
Mauro Carvalho Chehab58eec422008-08-11 10:18:39 +02001611};
1612
Takashi Iwaid2077d42013-01-14 14:20:16 +01001613static const struct hda_pintbl stac925xM3_pin_configs[] = {
1614 { 0x07, 0x40c003f4 },
1615 { 0x08, 0x424503f2 },
1616 { 0x0a, 0x400000f3 },
1617 { 0x0b, 0x02a19020 },
1618 { 0x0c, 0x40a000f0 },
1619 { 0x0d, 0x90100210 },
1620 { 0x10, 0x400003f1 },
1621 { 0x11, 0x503303f3 },
1622 {}
Mauro Carvalho Chehab9cb36c22008-08-11 10:18:39 +02001623};
Mauro Carvalho Chehab58eec422008-08-11 10:18:39 +02001624
Takashi Iwaid2077d42013-01-14 14:20:16 +01001625static const struct hda_pintbl stac925xM5_pin_configs[] = {
1626 { 0x07, 0x40c003f4 },
1627 { 0x08, 0x424503f2 },
1628 { 0x0a, 0x400000f3 },
1629 { 0x0b, 0x02a19020 },
1630 { 0x0c, 0x40a000f0 },
1631 { 0x0d, 0x90100210 },
1632 { 0x10, 0x400003f1 },
1633 { 0x11, 0x9033032e },
1634 {}
Mauro Carvalho Chehab9cb36c22008-08-11 10:18:39 +02001635};
1636
Takashi Iwaid2077d42013-01-14 14:20:16 +01001637static const struct hda_pintbl stac925xM6_pin_configs[] = {
1638 { 0x07, 0x40c003f4 },
1639 { 0x08, 0x424503f2 },
1640 { 0x0a, 0x400000f3 },
1641 { 0x0b, 0x02a19020 },
1642 { 0x0c, 0x40a000f0 },
1643 { 0x0d, 0x90100210 },
1644 { 0x10, 0x400003f1 },
1645 { 0x11, 0x90330320 },
1646 {}
Tobin Davis8e21c342007-01-08 11:04:17 +01001647};
1648
Takashi Iwaid2077d42013-01-14 14:20:16 +01001649static const struct hda_fixup stac925x_fixups[] = {
1650 [STAC_REF] = {
1651 .type = HDA_FIXUP_PINS,
1652 .v.pins = ref925x_pin_configs,
1653 },
1654 [STAC_M1] = {
1655 .type = HDA_FIXUP_PINS,
1656 .v.pins = stac925xM1_pin_configs,
1657 },
1658 [STAC_M1_2] = {
1659 .type = HDA_FIXUP_PINS,
1660 .v.pins = stac925xM1_2_pin_configs,
1661 },
1662 [STAC_M2] = {
1663 .type = HDA_FIXUP_PINS,
1664 .v.pins = stac925xM2_pin_configs,
1665 },
1666 [STAC_M2_2] = {
1667 .type = HDA_FIXUP_PINS,
1668 .v.pins = stac925xM2_2_pin_configs,
1669 },
1670 [STAC_M3] = {
1671 .type = HDA_FIXUP_PINS,
1672 .v.pins = stac925xM3_pin_configs,
1673 },
1674 [STAC_M5] = {
1675 .type = HDA_FIXUP_PINS,
1676 .v.pins = stac925xM5_pin_configs,
1677 },
1678 [STAC_M6] = {
1679 .type = HDA_FIXUP_PINS,
1680 .v.pins = stac925xM6_pin_configs,
1681 },
Tobin Davis8e21c342007-01-08 11:04:17 +01001682};
1683
Takashi Iwaid2077d42013-01-14 14:20:16 +01001684static const struct hda_model_fixup stac925x_models[] = {
1685 { .id = STAC_REF, .name = "ref" },
1686 { .id = STAC_M1, .name = "m1" },
1687 { .id = STAC_M1_2, .name = "m1-2" },
1688 { .id = STAC_M2, .name = "m2" },
1689 { .id = STAC_M2_2, .name = "m2-2" },
1690 { .id = STAC_M3, .name = "m3" },
1691 { .id = STAC_M5, .name = "m5" },
1692 { .id = STAC_M6, .name = "m6" },
1693 {}
Tobin Davis8e21c342007-01-08 11:04:17 +01001694};
1695
Takashi Iwaid2077d42013-01-14 14:20:16 +01001696static const struct snd_pci_quirk stac925x_fixup_tbl[] = {
1697 /* SigmaTel reference board */
1698 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF),
1699 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, "DFI LanParty", STAC_REF),
1700 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF),
1701
1702 /* Default table for unknown ID */
1703 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway mobile", STAC_M2_2),
1704
1705 /* gateway machines are checked via codec ssid */
Mauro Carvalho Chehab58eec422008-08-11 10:18:39 +02001706 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_M2),
1707 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_M5),
1708 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_M1),
1709 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_M2),
Mauro Carvalho Chehab9cb36c22008-08-11 10:18:39 +02001710 SND_PCI_QUIRK(0x107b, 0x0367, "Gateway MX6453", STAC_M1_2),
Mauro Carvalho Chehab9cb36c22008-08-11 10:18:39 +02001711 /* Not sure about the brand name for those */
1712 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M1),
1713 SND_PCI_QUIRK(0x107b, 0x0507, "Gateway mobile", STAC_M3),
1714 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M6),
1715 SND_PCI_QUIRK(0x107b, 0x0685, "Gateway mobile", STAC_M2_2),
Mauro Carvalho Chehab9cb36c22008-08-11 10:18:39 +02001716 {} /* terminator */
Tobin Davis8e21c342007-01-08 11:04:17 +01001717};
1718
Takashi Iwai55e30142013-01-14 17:30:04 +01001719static const struct hda_pintbl ref92hd73xx_pin_configs[] = {
1720 { 0x0a, 0x02214030 },
1721 { 0x0b, 0x02a19040 },
1722 { 0x0c, 0x01a19020 },
1723 { 0x0d, 0x02214030 },
1724 { 0x0e, 0x0181302e },
1725 { 0x0f, 0x01014010 },
1726 { 0x10, 0x01014020 },
1727 { 0x11, 0x01014030 },
1728 { 0x12, 0x02319040 },
1729 { 0x13, 0x90a000f0 },
1730 { 0x14, 0x90a000f0 },
1731 { 0x22, 0x01452050 },
1732 { 0x23, 0x01452050 },
1733 {}
Matthew Ranostaya7662642008-02-21 07:51:14 +01001734};
1735
Takashi Iwai55e30142013-01-14 17:30:04 +01001736static const struct hda_pintbl dell_m6_pin_configs[] = {
1737 { 0x0a, 0x0321101f },
1738 { 0x0b, 0x4f00000f },
1739 { 0x0c, 0x4f0000f0 },
1740 { 0x0d, 0x90170110 },
1741 { 0x0e, 0x03a11020 },
1742 { 0x0f, 0x0321101f },
1743 { 0x10, 0x4f0000f0 },
1744 { 0x11, 0x4f0000f0 },
1745 { 0x12, 0x4f0000f0 },
1746 { 0x13, 0x90a60160 },
1747 { 0x14, 0x4f0000f0 },
1748 { 0x22, 0x4f0000f0 },
1749 { 0x23, 0x4f0000f0 },
1750 {}
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01001751};
1752
Takashi Iwai55e30142013-01-14 17:30:04 +01001753static const struct hda_pintbl alienware_m17x_pin_configs[] = {
1754 { 0x0a, 0x0321101f },
1755 { 0x0b, 0x0321101f },
1756 { 0x0c, 0x03a11020 },
1757 { 0x0d, 0x03014020 },
1758 { 0x0e, 0x90170110 },
1759 { 0x0f, 0x4f0000f0 },
1760 { 0x10, 0x4f0000f0 },
1761 { 0x11, 0x4f0000f0 },
1762 { 0x12, 0x4f0000f0 },
1763 { 0x13, 0x90a60160 },
1764 { 0x14, 0x4f0000f0 },
1765 { 0x22, 0x4f0000f0 },
1766 { 0x23, 0x904601b0 },
1767 {}
Takashi Iwai842ae632009-09-02 07:43:08 +02001768};
1769
Takashi Iwai55e30142013-01-14 17:30:04 +01001770static const struct hda_pintbl intel_dg45id_pin_configs[] = {
1771 { 0x0a, 0x02214230 },
1772 { 0x0b, 0x02A19240 },
1773 { 0x0c, 0x01013214 },
1774 { 0x0d, 0x01014210 },
1775 { 0x0e, 0x01A19250 },
1776 { 0x0f, 0x01011212 },
1777 { 0x10, 0x01016211 },
1778 {}
Alexey Fisher52dc4382009-12-12 11:16:41 +02001779};
1780
Hui Wang80c24502014-02-20 11:47:21 +08001781static const struct hda_pintbl stac92hd89xx_hp_front_jack_pin_configs[] = {
1782 { 0x0a, 0x02214030 },
1783 { 0x0b, 0x02A19010 },
1784 {}
1785};
1786
Hui Wang159902f2014-07-30 11:11:48 +08001787static const struct hda_pintbl stac92hd89xx_hp_z1_g2_right_mic_jack_pin_configs[] = {
1788 { 0x0e, 0x400000f0 },
1789 {}
1790};
1791
Takashi Iwai55e30142013-01-14 17:30:04 +01001792static void stac92hd73xx_fixup_ref(struct hda_codec *codec,
1793 const struct hda_fixup *fix, int action)
1794{
1795 struct sigmatel_spec *spec = codec->spec;
1796
1797 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1798 return;
1799
1800 snd_hda_apply_pincfgs(codec, ref92hd73xx_pin_configs);
1801 spec->gpio_mask = spec->gpio_dir = spec->gpio_data = 0;
1802}
1803
1804static void stac92hd73xx_fixup_dell(struct hda_codec *codec)
1805{
1806 struct sigmatel_spec *spec = codec->spec;
1807
1808 snd_hda_apply_pincfgs(codec, dell_m6_pin_configs);
Takashi Iwai55e30142013-01-14 17:30:04 +01001809 spec->eapd_switch = 0;
1810}
1811
1812static void stac92hd73xx_fixup_dell_eq(struct hda_codec *codec,
1813 const struct hda_fixup *fix, int action)
1814{
1815 struct sigmatel_spec *spec = codec->spec;
1816
1817 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1818 return;
1819
1820 stac92hd73xx_fixup_dell(codec);
1821 snd_hda_add_verbs(codec, dell_eq_core_init);
1822 spec->volknob_init = 1;
1823}
1824
1825/* Analog Mics */
1826static void stac92hd73xx_fixup_dell_m6_amic(struct hda_codec *codec,
1827 const struct hda_fixup *fix, int action)
1828{
Takashi Iwai55e30142013-01-14 17:30:04 +01001829 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1830 return;
1831
1832 stac92hd73xx_fixup_dell(codec);
1833 snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170);
Takashi Iwai55e30142013-01-14 17:30:04 +01001834}
1835
1836/* Digital Mics */
1837static void stac92hd73xx_fixup_dell_m6_dmic(struct hda_codec *codec,
1838 const struct hda_fixup *fix, int action)
1839{
Takashi Iwai55e30142013-01-14 17:30:04 +01001840 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1841 return;
1842
1843 stac92hd73xx_fixup_dell(codec);
1844 snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160);
Takashi Iwai55e30142013-01-14 17:30:04 +01001845}
1846
1847/* Both */
1848static void stac92hd73xx_fixup_dell_m6_both(struct hda_codec *codec,
1849 const struct hda_fixup *fix, int action)
1850{
Takashi Iwai55e30142013-01-14 17:30:04 +01001851 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1852 return;
1853
1854 stac92hd73xx_fixup_dell(codec);
1855 snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170);
1856 snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160);
Takashi Iwai55e30142013-01-14 17:30:04 +01001857}
1858
1859static void stac92hd73xx_fixup_alienware_m17x(struct hda_codec *codec,
1860 const struct hda_fixup *fix, int action)
1861{
1862 struct sigmatel_spec *spec = codec->spec;
1863
1864 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1865 return;
1866
1867 snd_hda_apply_pincfgs(codec, alienware_m17x_pin_configs);
Takashi Iwai55e30142013-01-14 17:30:04 +01001868 spec->eapd_switch = 0;
1869}
1870
1871static void stac92hd73xx_fixup_no_jd(struct hda_codec *codec,
1872 const struct hda_fixup *fix, int action)
1873{
Takashi Iwai36c9db72013-01-17 17:07:59 +01001874 if (action == HDA_FIXUP_ACT_PRE_PROBE)
1875 codec->no_jack_detect = 1;
Takashi Iwai55e30142013-01-14 17:30:04 +01001876}
1877
1878static const struct hda_fixup stac92hd73xx_fixups[] = {
1879 [STAC_92HD73XX_REF] = {
1880 .type = HDA_FIXUP_FUNC,
1881 .v.func = stac92hd73xx_fixup_ref,
1882 },
1883 [STAC_DELL_M6_AMIC] = {
1884 .type = HDA_FIXUP_FUNC,
1885 .v.func = stac92hd73xx_fixup_dell_m6_amic,
1886 },
1887 [STAC_DELL_M6_DMIC] = {
1888 .type = HDA_FIXUP_FUNC,
1889 .v.func = stac92hd73xx_fixup_dell_m6_dmic,
1890 },
1891 [STAC_DELL_M6_BOTH] = {
1892 .type = HDA_FIXUP_FUNC,
1893 .v.func = stac92hd73xx_fixup_dell_m6_both,
1894 },
1895 [STAC_DELL_EQ] = {
1896 .type = HDA_FIXUP_FUNC,
1897 .v.func = stac92hd73xx_fixup_dell_eq,
1898 },
1899 [STAC_ALIENWARE_M17X] = {
1900 .type = HDA_FIXUP_FUNC,
1901 .v.func = stac92hd73xx_fixup_alienware_m17x,
1902 },
1903 [STAC_92HD73XX_INTEL] = {
1904 .type = HDA_FIXUP_PINS,
1905 .v.pins = intel_dg45id_pin_configs,
1906 },
1907 [STAC_92HD73XX_NO_JD] = {
1908 .type = HDA_FIXUP_FUNC,
1909 .v.func = stac92hd73xx_fixup_no_jd,
Hui Wang80c24502014-02-20 11:47:21 +08001910 },
1911 [STAC_92HD89XX_HP_FRONT_JACK] = {
1912 .type = HDA_FIXUP_PINS,
1913 .v.pins = stac92hd89xx_hp_front_jack_pin_configs,
Hui Wang159902f2014-07-30 11:11:48 +08001914 },
1915 [STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK] = {
1916 .type = HDA_FIXUP_PINS,
1917 .v.pins = stac92hd89xx_hp_z1_g2_right_mic_jack_pin_configs,
Takashi Iwai55e30142013-01-14 17:30:04 +01001918 }
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01001919};
1920
Takashi Iwai55e30142013-01-14 17:30:04 +01001921static const struct hda_model_fixup stac92hd73xx_models[] = {
1922 { .id = STAC_92HD73XX_NO_JD, .name = "no-jd" },
1923 { .id = STAC_92HD73XX_REF, .name = "ref" },
1924 { .id = STAC_92HD73XX_INTEL, .name = "intel" },
1925 { .id = STAC_DELL_M6_AMIC, .name = "dell-m6-amic" },
1926 { .id = STAC_DELL_M6_DMIC, .name = "dell-m6-dmic" },
1927 { .id = STAC_DELL_M6_BOTH, .name = "dell-m6" },
1928 { .id = STAC_DELL_EQ, .name = "dell-eq" },
1929 { .id = STAC_ALIENWARE_M17X, .name = "alienware" },
1930 {}
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01001931};
1932
Takashi Iwai55e30142013-01-14 17:30:04 +01001933static const struct snd_pci_quirk stac92hd73xx_fixup_tbl[] = {
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01001934 /* SigmaTel reference board */
1935 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
Matthew Ranostaya7662642008-02-21 07:51:14 +01001936 "DFI LanParty", STAC_92HD73XX_REF),
Matthew Ranostay577aa2c2009-01-22 22:55:44 -05001937 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
1938 "DFI LanParty", STAC_92HD73XX_REF),
Wu Fengguangae709442009-08-19 17:05:11 +08001939 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5002,
1940 "Intel DG45ID", STAC_92HD73XX_INTEL),
1941 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5003,
1942 "Intel DG45FC", STAC_92HD73XX_INTEL),
Matthew Ranostaya7662642008-02-21 07:51:14 +01001943 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254,
Takashi Iwai661cd8f2008-11-25 15:18:29 +01001944 "Dell Studio 1535", STAC_DELL_M6_DMIC),
Matthew Ranostaya7662642008-02-21 07:51:14 +01001945 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255,
Takashi Iwai661cd8f2008-11-25 15:18:29 +01001946 "unknown Dell", STAC_DELL_M6_DMIC),
Matthew Ranostaya7662642008-02-21 07:51:14 +01001947 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256,
Takashi Iwai661cd8f2008-11-25 15:18:29 +01001948 "unknown Dell", STAC_DELL_M6_BOTH),
Matthew Ranostaya7662642008-02-21 07:51:14 +01001949 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257,
Takashi Iwai661cd8f2008-11-25 15:18:29 +01001950 "unknown Dell", STAC_DELL_M6_BOTH),
Matthew Ranostaya7662642008-02-21 07:51:14 +01001951 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e,
Takashi Iwai661cd8f2008-11-25 15:18:29 +01001952 "unknown Dell", STAC_DELL_M6_AMIC),
Matthew Ranostaya7662642008-02-21 07:51:14 +01001953 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f,
Takashi Iwai661cd8f2008-11-25 15:18:29 +01001954 "unknown Dell", STAC_DELL_M6_AMIC),
Matthew Ranostaya7662642008-02-21 07:51:14 +01001955 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271,
Takashi Iwai661cd8f2008-11-25 15:18:29 +01001956 "unknown Dell", STAC_DELL_M6_DMIC),
1957 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0272,
1958 "unknown Dell", STAC_DELL_M6_DMIC),
Takashi Iwaib0fc5e02008-11-21 08:37:03 +01001959 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x029f,
Takashi Iwai661cd8f2008-11-25 15:18:29 +01001960 "Dell Studio 1537", STAC_DELL_M6_DMIC),
Joerg Schirottkefa620e92008-12-19 08:13:49 +01001961 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a0,
1962 "Dell Studio 17", STAC_DELL_M6_DMIC),
Takashi Iwai626f5ce2009-07-28 00:54:39 +02001963 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02be,
1964 "Dell Studio 1555", STAC_DELL_M6_DMIC),
Daniel J Blueman8ef58372009-11-14 18:20:04 +00001965 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02bd,
1966 "Dell Studio 1557", STAC_DELL_M6_DMIC),
Daniel T Chenaac78da2010-04-21 20:41:52 -04001967 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02fe,
David Henningssonffe535e2012-01-16 10:52:20 +01001968 "Dell Studio XPS 1645", STAC_DELL_M6_DMIC),
Daniel T Chen5c1bccf2010-04-22 17:54:45 -04001969 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0413,
David Henningssone033ebf2011-05-16 12:09:29 +02001970 "Dell Studio 1558", STAC_DELL_M6_DMIC),
Takashi Iwai55e30142013-01-14 17:30:04 +01001971 /* codec SSID matching */
Takashi Iwai842ae632009-09-02 07:43:08 +02001972 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a1,
1973 "Alienware M17x", STAC_ALIENWARE_M17X),
Daniel T Chen0defe092010-12-01 19:16:07 -05001974 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a,
1975 "Alienware M17x", STAC_ALIENWARE_M17X),
Takashi Iwaidbd1b542011-11-19 11:41:30 +01001976 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0490,
Albert Poolb9ecc4e2012-01-19 22:08:50 +01001977 "Alienware M17x R3", STAC_DELL_EQ),
Hui Wang159902f2014-07-30 11:11:48 +08001978 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1927,
1979 "HP Z1 G2", STAC_92HD89XX_HP_Z1_G2_RIGHT_MIC_JACK),
Hui Wang80c24502014-02-20 11:47:21 +08001980 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2b17,
1981 "unknown HP", STAC_92HD89XX_HP_FRONT_JACK),
Takashi Iwai842ae632009-09-02 07:43:08 +02001982 {} /* terminator */
1983};
1984
Takashi Iwai372f8c72013-01-14 18:06:34 +01001985static const struct hda_pintbl ref92hd83xxx_pin_configs[] = {
1986 { 0x0a, 0x02214030 },
1987 { 0x0b, 0x02211010 },
1988 { 0x0c, 0x02a19020 },
1989 { 0x0d, 0x02170130 },
1990 { 0x0e, 0x01014050 },
1991 { 0x0f, 0x01819040 },
1992 { 0x10, 0x01014020 },
1993 { 0x11, 0x90a3014e },
1994 { 0x1f, 0x01451160 },
1995 { 0x20, 0x98560170 },
1996 {}
Matthew Ranostayd0513fc2008-07-27 10:30:30 +02001997};
1998
Takashi Iwai372f8c72013-01-14 18:06:34 +01001999static const struct hda_pintbl dell_s14_pin_configs[] = {
2000 { 0x0a, 0x0221403f },
2001 { 0x0b, 0x0221101f },
2002 { 0x0c, 0x02a19020 },
2003 { 0x0d, 0x90170110 },
2004 { 0x0e, 0x40f000f0 },
2005 { 0x0f, 0x40f000f0 },
2006 { 0x10, 0x40f000f0 },
2007 { 0x11, 0x90a60160 },
2008 { 0x1f, 0x40f000f0 },
2009 { 0x20, 0x40f000f0 },
2010 {}
Matthew Ranostay8bb0ac52009-02-12 16:50:01 -05002011};
2012
Takashi Iwai372f8c72013-01-14 18:06:34 +01002013static const struct hda_pintbl dell_vostro_3500_pin_configs[] = {
2014 { 0x0a, 0x02a11020 },
2015 { 0x0b, 0x0221101f },
2016 { 0x0c, 0x400000f0 },
2017 { 0x0d, 0x90170110 },
2018 { 0x0e, 0x400000f1 },
2019 { 0x0f, 0x400000f2 },
2020 { 0x10, 0x400000f3 },
2021 { 0x11, 0x90a60160 },
2022 { 0x1f, 0x400000f4 },
2023 { 0x20, 0x400000f5 },
2024 {}
Julian Wollrathf7f9bdf2011-11-09 10:02:40 +01002025};
2026
Takashi Iwai372f8c72013-01-14 18:06:34 +01002027static const struct hda_pintbl hp_dv7_4000_pin_configs[] = {
2028 { 0x0a, 0x03a12050 },
2029 { 0x0b, 0x0321201f },
2030 { 0x0c, 0x40f000f0 },
2031 { 0x0d, 0x90170110 },
2032 { 0x0e, 0x40f000f0 },
2033 { 0x0f, 0x40f000f0 },
2034 { 0x10, 0x90170110 },
2035 { 0x11, 0xd5a30140 },
2036 { 0x1f, 0x40f000f0 },
2037 { 0x20, 0x40f000f0 },
2038 {}
Steven Eastland48315592010-08-06 15:07:35 -06002039};
2040
Takashi Iwai372f8c72013-01-14 18:06:34 +01002041static const struct hda_pintbl hp_zephyr_pin_configs[] = {
2042 { 0x0a, 0x01813050 },
2043 { 0x0b, 0x0421201f },
2044 { 0x0c, 0x04a1205e },
2045 { 0x0d, 0x96130310 },
2046 { 0x0e, 0x96130310 },
2047 { 0x0f, 0x0101401f },
2048 { 0x10, 0x1111611f },
2049 { 0x11, 0xd5a30130 },
2050 {}
Vitaliy Kulikov5556e142012-02-27 16:47:37 -06002051};
2052
Takashi Iwai372f8c72013-01-14 18:06:34 +01002053static const struct hda_pintbl hp_cNB11_intquad_pin_configs[] = {
2054 { 0x0a, 0x40f000f0 },
2055 { 0x0b, 0x0221101f },
2056 { 0x0c, 0x02a11020 },
2057 { 0x0d, 0x92170110 },
2058 { 0x0e, 0x40f000f0 },
2059 { 0x0f, 0x92170110 },
2060 { 0x10, 0x40f000f0 },
2061 { 0x11, 0xd5a30130 },
2062 { 0x1f, 0x40f000f0 },
2063 { 0x20, 0x40f000f0 },
2064 {}
Vitaliy Kulikov0c27c182011-07-22 17:50:37 -05002065};
2066
Takashi Iwai372f8c72013-01-14 18:06:34 +01002067static void stac92hd83xxx_fixup_hp(struct hda_codec *codec,
2068 const struct hda_fixup *fix, int action)
2069{
2070 struct sigmatel_spec *spec = codec->spec;
2071
2072 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2073 return;
2074
2075 if (hp_bnb2011_with_dock(codec)) {
2076 snd_hda_codec_set_pincfg(codec, 0xa, 0x2101201f);
2077 snd_hda_codec_set_pincfg(codec, 0xf, 0x2181205e);
2078 }
2079
2080 if (find_mute_led_cfg(codec, spec->default_polarity))
2081 snd_printd("mute LED gpio %d polarity %d\n",
2082 spec->gpio_led,
2083 spec->gpio_led_polarity);
2084}
2085
2086static void stac92hd83xxx_fixup_hp_zephyr(struct hda_codec *codec,
2087 const struct hda_fixup *fix, int action)
2088{
2089 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2090 return;
2091
2092 snd_hda_apply_pincfgs(codec, hp_zephyr_pin_configs);
2093 snd_hda_add_verbs(codec, stac92hd83xxx_hp_zephyr_init);
2094}
2095
2096static void stac92hd83xxx_fixup_hp_led(struct hda_codec *codec,
2097 const struct hda_fixup *fix, int action)
2098{
2099 struct sigmatel_spec *spec = codec->spec;
2100
2101 if (action == HDA_FIXUP_ACT_PRE_PROBE)
2102 spec->default_polarity = 0;
2103}
2104
2105static void stac92hd83xxx_fixup_hp_inv_led(struct hda_codec *codec,
2106 const struct hda_fixup *fix, int action)
2107{
2108 struct sigmatel_spec *spec = codec->spec;
2109
2110 if (action == HDA_FIXUP_ACT_PRE_PROBE)
2111 spec->default_polarity = 1;
2112}
2113
2114static void stac92hd83xxx_fixup_hp_mic_led(struct hda_codec *codec,
2115 const struct hda_fixup *fix, int action)
2116{
2117 struct sigmatel_spec *spec = codec->spec;
2118
2119 if (action == HDA_FIXUP_ACT_PRE_PROBE)
2120 spec->mic_mute_led_gpio = 0x08; /* GPIO3 */
2121}
2122
Takashi Iwaif5556a62014-02-24 15:23:10 +01002123static void stac92hd83xxx_fixup_hp_led_gpio10(struct hda_codec *codec,
2124 const struct hda_fixup *fix, int action)
2125{
2126 struct sigmatel_spec *spec = codec->spec;
2127
2128 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2129 spec->gpio_led = 0x10; /* GPIO4 */
2130 spec->default_polarity = 0;
2131 }
2132}
2133
Takashi Iwai372f8c72013-01-14 18:06:34 +01002134static void stac92hd83xxx_fixup_headset_jack(struct hda_codec *codec,
2135 const struct hda_fixup *fix, int action)
2136{
2137 struct sigmatel_spec *spec = codec->spec;
2138
2139 if (action == HDA_FIXUP_ACT_PRE_PROBE)
2140 spec->headset_jack = 1;
2141}
2142
2143static const struct hda_fixup stac92hd83xxx_fixups[] = {
2144 [STAC_92HD83XXX_REF] = {
2145 .type = HDA_FIXUP_PINS,
2146 .v.pins = ref92hd83xxx_pin_configs,
2147 },
2148 [STAC_92HD83XXX_PWR_REF] = {
2149 .type = HDA_FIXUP_PINS,
2150 .v.pins = ref92hd83xxx_pin_configs,
2151 },
2152 [STAC_DELL_S14] = {
2153 .type = HDA_FIXUP_PINS,
2154 .v.pins = dell_s14_pin_configs,
2155 },
2156 [STAC_DELL_VOSTRO_3500] = {
2157 .type = HDA_FIXUP_PINS,
2158 .v.pins = dell_vostro_3500_pin_configs,
2159 },
2160 [STAC_92HD83XXX_HP_cNB11_INTQUAD] = {
2161 .type = HDA_FIXUP_PINS,
2162 .v.pins = hp_cNB11_intquad_pin_configs,
2163 .chained = true,
2164 .chain_id = STAC_92HD83XXX_HP,
2165 },
2166 [STAC_92HD83XXX_HP] = {
2167 .type = HDA_FIXUP_FUNC,
2168 .v.func = stac92hd83xxx_fixup_hp,
2169 },
2170 [STAC_HP_DV7_4000] = {
2171 .type = HDA_FIXUP_PINS,
2172 .v.pins = hp_dv7_4000_pin_configs,
2173 .chained = true,
2174 .chain_id = STAC_92HD83XXX_HP,
2175 },
2176 [STAC_HP_ZEPHYR] = {
2177 .type = HDA_FIXUP_FUNC,
2178 .v.func = stac92hd83xxx_fixup_hp_zephyr,
2179 .chained = true,
2180 .chain_id = STAC_92HD83XXX_HP,
2181 },
2182 [STAC_92HD83XXX_HP_LED] = {
2183 .type = HDA_FIXUP_FUNC,
2184 .v.func = stac92hd83xxx_fixup_hp_led,
2185 .chained = true,
2186 .chain_id = STAC_92HD83XXX_HP,
2187 },
2188 [STAC_92HD83XXX_HP_INV_LED] = {
2189 .type = HDA_FIXUP_FUNC,
2190 .v.func = stac92hd83xxx_fixup_hp_inv_led,
2191 .chained = true,
2192 .chain_id = STAC_92HD83XXX_HP,
2193 },
2194 [STAC_92HD83XXX_HP_MIC_LED] = {
2195 .type = HDA_FIXUP_FUNC,
2196 .v.func = stac92hd83xxx_fixup_hp_mic_led,
2197 .chained = true,
2198 .chain_id = STAC_92HD83XXX_HP,
2199 },
Takashi Iwaif5556a62014-02-24 15:23:10 +01002200 [STAC_HP_LED_GPIO10] = {
2201 .type = HDA_FIXUP_FUNC,
2202 .v.func = stac92hd83xxx_fixup_hp_led_gpio10,
2203 .chained = true,
2204 .chain_id = STAC_92HD83XXX_HP,
2205 },
Takashi Iwai372f8c72013-01-14 18:06:34 +01002206 [STAC_92HD83XXX_HEADSET_JACK] = {
2207 .type = HDA_FIXUP_FUNC,
2208 .v.func = stac92hd83xxx_fixup_headset_jack,
2209 },
Takashi Iwai49920422013-01-18 14:28:07 +01002210 [STAC_HP_ENVY_BASS] = {
2211 .type = HDA_FIXUP_PINS,
2212 .v.pins = (const struct hda_pintbl[]) {
2213 { 0x0f, 0x90170111 },
2214 {}
2215 },
2216 },
Matthew Ranostayd0513fc2008-07-27 10:30:30 +02002217};
2218
Takashi Iwai372f8c72013-01-14 18:06:34 +01002219static const struct hda_model_fixup stac92hd83xxx_models[] = {
2220 { .id = STAC_92HD83XXX_REF, .name = "ref" },
2221 { .id = STAC_92HD83XXX_PWR_REF, .name = "mic-ref" },
2222 { .id = STAC_DELL_S14, .name = "dell-s14" },
2223 { .id = STAC_DELL_VOSTRO_3500, .name = "dell-vostro-3500" },
2224 { .id = STAC_92HD83XXX_HP_cNB11_INTQUAD, .name = "hp_cNB11_intquad" },
2225 { .id = STAC_HP_DV7_4000, .name = "hp-dv7-4000" },
2226 { .id = STAC_HP_ZEPHYR, .name = "hp-zephyr" },
2227 { .id = STAC_92HD83XXX_HP_LED, .name = "hp-led" },
2228 { .id = STAC_92HD83XXX_HP_INV_LED, .name = "hp-inv-led" },
2229 { .id = STAC_92HD83XXX_HP_MIC_LED, .name = "hp-mic-led" },
2230 { .id = STAC_92HD83XXX_HEADSET_JACK, .name = "headset-jack" },
Takashi Iwai49920422013-01-18 14:28:07 +01002231 { .id = STAC_HP_ENVY_BASS, .name = "hp-envy-bass" },
Takashi Iwai372f8c72013-01-14 18:06:34 +01002232 {}
Matthew Ranostayd0513fc2008-07-27 10:30:30 +02002233};
2234
Takashi Iwai372f8c72013-01-14 18:06:34 +01002235static const struct snd_pci_quirk stac92hd83xxx_fixup_tbl[] = {
Matthew Ranostayd0513fc2008-07-27 10:30:30 +02002236 /* SigmaTel reference board */
2237 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
Takashi Iwaif9d088b2009-01-13 11:54:49 +01002238 "DFI LanParty", STAC_92HD83XXX_REF),
Matthew Ranostay577aa2c2009-01-22 22:55:44 -05002239 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
2240 "DFI LanParty", STAC_92HD83XXX_REF),
Matthew Ranostay8bb0ac52009-02-12 16:50:01 -05002241 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ba,
2242 "unknown Dell", STAC_DELL_S14),
David Henningsson8d032a82012-10-09 12:48:40 +02002243 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0532,
2244 "Dell Latitude E6230", STAC_92HD83XXX_HEADSET_JACK),
2245 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0533,
2246 "Dell Latitude E6330", STAC_92HD83XXX_HEADSET_JACK),
2247 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0534,
2248 "Dell Latitude E6430", STAC_92HD83XXX_HEADSET_JACK),
2249 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0535,
2250 "Dell Latitude E6530", STAC_92HD83XXX_HEADSET_JACK),
2251 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x053c,
2252 "Dell Latitude E5430", STAC_92HD83XXX_HEADSET_JACK),
2253 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x053d,
2254 "Dell Latitude E5530", STAC_92HD83XXX_HEADSET_JACK),
2255 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0549,
2256 "Dell Latitude E5430", STAC_92HD83XXX_HEADSET_JACK),
2257 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x057d,
2258 "Dell Latitude E6430s", STAC_92HD83XXX_HEADSET_JACK),
2259 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0584,
2260 "Dell Latitude E6430U", STAC_92HD83XXX_HEADSET_JACK),
Julian Wollrathf7f9bdf2011-11-09 10:02:40 +01002261 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x1028,
2262 "Dell Vostro 3500", STAC_DELL_VOSTRO_3500),
Vitaliy Kulikov0c27c182011-07-22 17:50:37 -05002263 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1656,
2264 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2265 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1657,
2266 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2267 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1658,
2268 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2269 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1659,
Takashi Iwai8ae58652012-12-13 14:33:42 +01002270 "HP Pavilion dv7", STAC_HP_DV7_4000),
Vitaliy Kulikov0c27c182011-07-22 17:50:37 -05002271 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165A,
2272 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2273 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165B,
2274 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
Takashi Iwai49920422013-01-18 14:28:07 +01002275 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1888,
2276 "HP Envy Spectre", STAC_HP_ENVY_BASS),
Takashi Iwaif5556a62014-02-24 15:23:10 +01002277 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1899,
2278 "HP Folio 13", STAC_HP_LED_GPIO10),
Takashi Iwai62cbde12012-09-14 11:58:54 +02002279 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x18df,
2280 "HP Folio", STAC_92HD83XXX_HP_MIC_LED),
Takashi Iwaif9afed12013-02-06 12:39:06 +01002281 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x1900,
2282 "HP", STAC_92HD83XXX_HP_MIC_LED),
Vitaliy Kulikov0c27c182011-07-22 17:50:37 -05002283 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3388,
2284 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2285 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3389,
2286 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2287 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355B,
2288 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2289 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355C,
2290 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2291 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355D,
2292 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2293 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355E,
2294 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2295 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355F,
2296 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2297 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3560,
2298 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2299 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358B,
2300 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2301 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358C,
2302 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2303 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358D,
2304 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2305 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3591,
2306 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2307 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3592,
2308 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2309 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3593,
2310 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
Vitaliy Kulikov5556e142012-02-27 16:47:37 -06002311 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3561,
2312 "HP", STAC_HP_ZEPHYR),
Takashi Iwaia3e19972012-07-26 08:17:20 +02002313 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3660,
2314 "HP Mini", STAC_92HD83XXX_HP_LED),
Gustavo Maciel Dias Vieira5afc13a2012-10-26 12:51:53 -02002315 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x144E,
2316 "HP Pavilion dv5", STAC_92HD83XXX_HP_INV_LED),
Takashi Iwai8c698fe2013-01-15 11:20:50 +01002317 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x148a,
2318 "HP Mini", STAC_92HD83XXX_HP_LED),
Takashi Iwai372f8c72013-01-14 18:06:34 +01002319 SND_PCI_QUIRK_VENDOR(PCI_VENDOR_ID_HP, "HP", STAC_92HD83XXX_HP),
Herton Ronaldo Krzesinski574f3c42008-12-23 16:53:00 -02002320 {} /* terminator */
Matthew Ranostayd0513fc2008-07-27 10:30:30 +02002321};
2322
Takashi Iwai36c9db72013-01-17 17:07:59 +01002323/* HP dv7 bass switch - GPIO5 */
2324#define stac_hp_bass_gpio_info snd_ctl_boolean_mono_info
2325static int stac_hp_bass_gpio_get(struct snd_kcontrol *kcontrol,
2326 struct snd_ctl_elem_value *ucontrol)
2327{
2328 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2329 struct sigmatel_spec *spec = codec->spec;
2330 ucontrol->value.integer.value[0] = !!(spec->gpio_data & 0x20);
2331 return 0;
2332}
2333
2334static int stac_hp_bass_gpio_put(struct snd_kcontrol *kcontrol,
2335 struct snd_ctl_elem_value *ucontrol)
2336{
2337 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2338 struct sigmatel_spec *spec = codec->spec;
2339 unsigned int gpio_data;
2340
2341 gpio_data = (spec->gpio_data & ~0x20) |
2342 (ucontrol->value.integer.value[0] ? 0x20 : 0);
2343 if (gpio_data == spec->gpio_data)
2344 return 0;
2345 spec->gpio_data = gpio_data;
2346 stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data);
2347 return 1;
2348}
2349
2350static const struct snd_kcontrol_new stac_hp_bass_sw_ctrl = {
2351 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2352 .info = stac_hp_bass_gpio_info,
2353 .get = stac_hp_bass_gpio_get,
2354 .put = stac_hp_bass_gpio_put,
2355};
2356
2357static int stac_add_hp_bass_switch(struct hda_codec *codec)
2358{
2359 struct sigmatel_spec *spec = codec->spec;
2360
2361 if (!snd_hda_gen_add_kctl(&spec->gen, "Bass Speaker Playback Switch",
2362 &stac_hp_bass_sw_ctrl))
2363 return -ENOMEM;
2364
2365 spec->gpio_mask |= 0x20;
2366 spec->gpio_dir |= 0x20;
2367 spec->gpio_data |= 0x20;
2368 return 0;
2369}
2370
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002371static const struct hda_pintbl ref92hd71bxx_pin_configs[] = {
2372 { 0x0a, 0x02214030 },
2373 { 0x0b, 0x02a19040 },
2374 { 0x0c, 0x01a19020 },
2375 { 0x0d, 0x01014010 },
2376 { 0x0e, 0x0181302e },
2377 { 0x0f, 0x01014010 },
2378 { 0x14, 0x01019020 },
2379 { 0x18, 0x90a000f0 },
2380 { 0x19, 0x90a000f0 },
2381 { 0x1e, 0x01452050 },
2382 { 0x1f, 0x01452050 },
2383 {}
Matthew Ranostaye035b842007-11-06 11:53:55 +01002384};
2385
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002386static const struct hda_pintbl dell_m4_1_pin_configs[] = {
2387 { 0x0a, 0x0421101f },
2388 { 0x0b, 0x04a11221 },
2389 { 0x0c, 0x40f000f0 },
2390 { 0x0d, 0x90170110 },
2391 { 0x0e, 0x23a1902e },
2392 { 0x0f, 0x23014250 },
2393 { 0x14, 0x40f000f0 },
2394 { 0x18, 0x90a000f0 },
2395 { 0x19, 0x40f000f0 },
2396 { 0x1e, 0x4f0000f0 },
2397 { 0x1f, 0x4f0000f0 },
2398 {}
Matthew Ranostaya7662642008-02-21 07:51:14 +01002399};
2400
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002401static const struct hda_pintbl dell_m4_2_pin_configs[] = {
2402 { 0x0a, 0x0421101f },
2403 { 0x0b, 0x04a11221 },
2404 { 0x0c, 0x90a70330 },
2405 { 0x0d, 0x90170110 },
2406 { 0x0e, 0x23a1902e },
2407 { 0x0f, 0x23014250 },
2408 { 0x14, 0x40f000f0 },
2409 { 0x18, 0x40f000f0 },
2410 { 0x19, 0x40f000f0 },
2411 { 0x1e, 0x044413b0 },
2412 { 0x1f, 0x044413b0 },
2413 {}
Matthew Ranostaya7662642008-02-21 07:51:14 +01002414};
2415
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002416static const struct hda_pintbl dell_m4_3_pin_configs[] = {
2417 { 0x0a, 0x0421101f },
2418 { 0x0b, 0x04a11221 },
2419 { 0x0c, 0x90a70330 },
2420 { 0x0d, 0x90170110 },
2421 { 0x0e, 0x40f000f0 },
2422 { 0x0f, 0x40f000f0 },
2423 { 0x14, 0x40f000f0 },
2424 { 0x18, 0x90a000f0 },
2425 { 0x19, 0x40f000f0 },
2426 { 0x1e, 0x044413b0 },
2427 { 0x1f, 0x044413b0 },
2428 {}
Matthew Ranostay3a7abfd2008-11-20 21:21:43 -05002429};
2430
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002431static void stac92hd71bxx_fixup_ref(struct hda_codec *codec,
2432 const struct hda_fixup *fix, int action)
2433{
2434 struct sigmatel_spec *spec = codec->spec;
2435
2436 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2437 return;
2438
2439 snd_hda_apply_pincfgs(codec, ref92hd71bxx_pin_configs);
2440 spec->gpio_mask = spec->gpio_dir = spec->gpio_data = 0;
2441}
2442
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002443static void stac92hd71bxx_fixup_hp_m4(struct hda_codec *codec,
2444 const struct hda_fixup *fix, int action)
2445{
2446 struct sigmatel_spec *spec = codec->spec;
Takashi Iwai36c9db72013-01-17 17:07:59 +01002447 struct hda_jack_tbl *jack;
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002448
2449 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2450 return;
2451
2452 /* Enable VREF power saving on GPIO1 detect */
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002453 snd_hda_codec_write_cache(codec, codec->afg, 0,
2454 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02);
Takashi Iwai36c9db72013-01-17 17:07:59 +01002455 snd_hda_jack_detect_enable_callback(codec, codec->afg,
2456 STAC_VREF_EVENT,
2457 stac_vref_event);
2458 jack = snd_hda_jack_tbl_get(codec, codec->afg);
2459 if (jack)
2460 jack->private_data = 0x02;
2461
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002462 spec->gpio_mask |= 0x02;
2463
2464 /* enable internal microphone */
2465 snd_hda_codec_set_pincfg(codec, 0x0e, 0x01813040);
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002466}
2467
2468static void stac92hd71bxx_fixup_hp_dv4(struct hda_codec *codec,
2469 const struct hda_fixup *fix, int action)
2470{
2471 struct sigmatel_spec *spec = codec->spec;
2472
2473 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2474 return;
2475 spec->gpio_led = 0x01;
2476}
2477
2478static void stac92hd71bxx_fixup_hp_dv5(struct hda_codec *codec,
2479 const struct hda_fixup *fix, int action)
2480{
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002481 unsigned int cap;
2482
2483 switch (action) {
2484 case HDA_FIXUP_ACT_PRE_PROBE:
2485 snd_hda_codec_set_pincfg(codec, 0x0d, 0x90170010);
Takashi Iwaif6655d52013-01-17 08:49:01 +01002486 break;
2487
2488 case HDA_FIXUP_ACT_PROBE:
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002489 /* enable bass on HP dv7 */
2490 cap = snd_hda_param_read(codec, 0x1, AC_PAR_GPIO_CAP);
2491 cap &= AC_GPIO_IO_COUNT;
2492 if (cap >= 6)
2493 stac_add_hp_bass_switch(codec);
2494 break;
2495 }
2496}
2497
2498static void stac92hd71bxx_fixup_hp_hdx(struct hda_codec *codec,
2499 const struct hda_fixup *fix, int action)
2500{
2501 struct sigmatel_spec *spec = codec->spec;
2502
2503 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2504 return;
2505 spec->gpio_led = 0x08;
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002506}
2507
2508
2509static void stac92hd71bxx_fixup_hp(struct hda_codec *codec,
2510 const struct hda_fixup *fix, int action)
2511{
2512 struct sigmatel_spec *spec = codec->spec;
2513
2514 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2515 return;
2516
2517 if (hp_blike_system(codec->subsystem_id)) {
2518 unsigned int pin_cfg = snd_hda_codec_get_pincfg(codec, 0x0f);
2519 if (get_defcfg_device(pin_cfg) == AC_JACK_LINE_OUT ||
2520 get_defcfg_device(pin_cfg) == AC_JACK_SPEAKER ||
2521 get_defcfg_device(pin_cfg) == AC_JACK_HP_OUT) {
2522 /* It was changed in the BIOS to just satisfy MS DTM.
2523 * Lets turn it back into slaved HP
2524 */
2525 pin_cfg = (pin_cfg & (~AC_DEFCFG_DEVICE))
2526 | (AC_JACK_HP_OUT <<
2527 AC_DEFCFG_DEVICE_SHIFT);
2528 pin_cfg = (pin_cfg & (~(AC_DEFCFG_DEF_ASSOC
2529 | AC_DEFCFG_SEQUENCE)))
2530 | 0x1f;
2531 snd_hda_codec_set_pincfg(codec, 0x0f, pin_cfg);
2532 }
2533 }
2534
Takashi Iwai36c9db72013-01-17 17:07:59 +01002535 if (find_mute_led_cfg(codec, 1))
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002536 snd_printd("mute LED gpio %d polarity %d\n",
2537 spec->gpio_led,
2538 spec->gpio_led_polarity);
2539
2540}
2541
2542static const struct hda_fixup stac92hd71bxx_fixups[] = {
2543 [STAC_92HD71BXX_REF] = {
2544 .type = HDA_FIXUP_FUNC,
2545 .v.func = stac92hd71bxx_fixup_ref,
2546 },
2547 [STAC_DELL_M4_1] = {
2548 .type = HDA_FIXUP_PINS,
2549 .v.pins = dell_m4_1_pin_configs,
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002550 },
2551 [STAC_DELL_M4_2] = {
2552 .type = HDA_FIXUP_PINS,
2553 .v.pins = dell_m4_2_pin_configs,
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002554 },
2555 [STAC_DELL_M4_3] = {
2556 .type = HDA_FIXUP_PINS,
2557 .v.pins = dell_m4_3_pin_configs,
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002558 },
2559 [STAC_HP_M4] = {
2560 .type = HDA_FIXUP_FUNC,
2561 .v.func = stac92hd71bxx_fixup_hp_m4,
2562 .chained = true,
2563 .chain_id = STAC_92HD71BXX_HP,
2564 },
2565 [STAC_HP_DV4] = {
2566 .type = HDA_FIXUP_FUNC,
2567 .v.func = stac92hd71bxx_fixup_hp_dv4,
2568 .chained = true,
2569 .chain_id = STAC_HP_DV5,
2570 },
2571 [STAC_HP_DV5] = {
2572 .type = HDA_FIXUP_FUNC,
2573 .v.func = stac92hd71bxx_fixup_hp_dv5,
2574 .chained = true,
2575 .chain_id = STAC_92HD71BXX_HP,
2576 },
2577 [STAC_HP_HDX] = {
2578 .type = HDA_FIXUP_FUNC,
2579 .v.func = stac92hd71bxx_fixup_hp_hdx,
2580 .chained = true,
2581 .chain_id = STAC_92HD71BXX_HP,
2582 },
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002583 [STAC_92HD71BXX_HP] = {
2584 .type = HDA_FIXUP_FUNC,
2585 .v.func = stac92hd71bxx_fixup_hp,
2586 },
Matthew Ranostaye035b842007-11-06 11:53:55 +01002587};
2588
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002589static const struct hda_model_fixup stac92hd71bxx_models[] = {
2590 { .id = STAC_92HD71BXX_REF, .name = "ref" },
2591 { .id = STAC_DELL_M4_1, .name = "dell-m4-1" },
2592 { .id = STAC_DELL_M4_2, .name = "dell-m4-2" },
2593 { .id = STAC_DELL_M4_3, .name = "dell-m4-3" },
2594 { .id = STAC_HP_M4, .name = "hp-m4" },
2595 { .id = STAC_HP_DV4, .name = "hp-dv4" },
2596 { .id = STAC_HP_DV5, .name = "hp-dv5" },
2597 { .id = STAC_HP_HDX, .name = "hp-hdx" },
Takashi Iwai36c9db72013-01-17 17:07:59 +01002598 { .id = STAC_HP_DV4, .name = "hp-dv4-1222nr" },
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002599 {}
Matthew Ranostaye035b842007-11-06 11:53:55 +01002600};
2601
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002602static const struct snd_pci_quirk stac92hd71bxx_fixup_tbl[] = {
Matthew Ranostaye035b842007-11-06 11:53:55 +01002603 /* SigmaTel reference board */
2604 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
2605 "DFI LanParty", STAC_92HD71BXX_REF),
Matthew Ranostay577aa2c2009-01-22 22:55:44 -05002606 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
2607 "DFI LanParty", STAC_92HD71BXX_REF),
Vitaliy Kulikov5bdaaad2009-11-04 07:57:45 +01002608 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x1720,
2609 "HP", STAC_HP_DV5),
Takashi Iwai58d83952009-03-13 17:04:34 +01002610 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3080,
2611 "HP", STAC_HP_DV5),
Takashi Iwai2ae466f2009-02-16 14:16:36 +01002612 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x30f0,
Takashi Iwai2a6ce6e2010-05-12 10:16:20 +02002613 "HP dv4-7", STAC_HP_DV4),
Takashi Iwai2ae466f2009-02-16 14:16:36 +01002614 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3600,
2615 "HP dv4-7", STAC_HP_DV5),
Takashi Iwai6fce61a2009-03-10 07:48:57 +01002616 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3610,
2617 "HP HDX", STAC_HP_HDX), /* HDX18 */
Matthew Ranostay9a9e2352008-09-26 10:37:03 -04002618 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a,
Takashi Iwai2ae466f2009-02-16 14:16:36 +01002619 "HP mini 1000", STAC_HP_M4),
Christoph Plattnerae6241f2009-03-08 23:19:05 +01002620 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361b,
Takashi Iwai6fce61a2009-03-10 07:48:57 +01002621 "HP HDX", STAC_HP_HDX), /* HDX16 */
Takashi Iwai6e34c032009-09-14 15:42:18 +02002622 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3620,
2623 "HP dv6", STAC_HP_DV5),
Kunal Gangakhedkare3d25302010-03-20 23:08:01 +05302624 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3061,
2625 "HP dv6", STAC_HP_DV5), /* HP dv6-1110ax */
Luke Yelavich9b2167d2010-10-06 15:45:46 +11002626 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x363e,
2627 "HP DV6", STAC_HP_DV5),
Takashi Iwai1972d022009-08-06 08:44:43 +02002628 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x7010,
2629 "HP", STAC_HP_DV5),
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002630 SND_PCI_QUIRK_VENDOR(PCI_VENDOR_ID_HP, "HP", STAC_92HD71BXX_HP),
Matthew Ranostaya7662642008-02-21 07:51:14 +01002631 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233,
2632 "unknown Dell", STAC_DELL_M4_1),
2633 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234,
2634 "unknown Dell", STAC_DELL_M4_1),
2635 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0250,
2636 "unknown Dell", STAC_DELL_M4_1),
2637 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024f,
2638 "unknown Dell", STAC_DELL_M4_1),
2639 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024d,
2640 "unknown Dell", STAC_DELL_M4_1),
2641 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0251,
2642 "unknown Dell", STAC_DELL_M4_1),
2643 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0277,
2644 "unknown Dell", STAC_DELL_M4_1),
2645 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0263,
2646 "unknown Dell", STAC_DELL_M4_2),
2647 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0265,
2648 "unknown Dell", STAC_DELL_M4_2),
2649 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0262,
2650 "unknown Dell", STAC_DELL_M4_2),
2651 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264,
2652 "unknown Dell", STAC_DELL_M4_2),
Matthew Ranostay3a7abfd2008-11-20 21:21:43 -05002653 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02aa,
2654 "unknown Dell", STAC_DELL_M4_3),
Matthew Ranostaye035b842007-11-06 11:53:55 +01002655 {} /* terminator */
2656};
2657
Takashi Iwai0a42784642013-01-14 15:20:13 +01002658static const struct hda_pintbl ref922x_pin_configs[] = {
2659 { 0x0a, 0x01014010 },
2660 { 0x0b, 0x01016011 },
2661 { 0x0c, 0x01012012 },
2662 { 0x0d, 0x0221401f },
2663 { 0x0e, 0x01813122 },
2664 { 0x0f, 0x01011014 },
2665 { 0x10, 0x01441030 },
2666 { 0x11, 0x01c41030 },
2667 { 0x15, 0x40000100 },
2668 { 0x1b, 0x40000100 },
2669 {}
Matt2f2f4252005-04-13 14:45:30 +02002670};
2671
Takashi Iwaidfe495d2007-08-23 19:04:28 +02002672/*
2673 STAC 922X pin configs for
2674 102801A7
2675 102801AB
2676 102801A9
2677 102801D1
2678 102801D2
2679*/
Takashi Iwai0a42784642013-01-14 15:20:13 +01002680static const struct hda_pintbl dell_922x_d81_pin_configs[] = {
2681 { 0x0a, 0x02214030 },
2682 { 0x0b, 0x01a19021 },
2683 { 0x0c, 0x01111012 },
2684 { 0x0d, 0x01114010 },
2685 { 0x0e, 0x02a19020 },
2686 { 0x0f, 0x01117011 },
2687 { 0x10, 0x400001f0 },
2688 { 0x11, 0x400001f1 },
2689 { 0x15, 0x01813122 },
2690 { 0x1b, 0x400001f2 },
2691 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02002692};
2693
2694/*
2695 STAC 922X pin configs for
2696 102801AC
2697 102801D0
2698*/
Takashi Iwai0a42784642013-01-14 15:20:13 +01002699static const struct hda_pintbl dell_922x_d82_pin_configs[] = {
2700 { 0x0a, 0x02214030 },
2701 { 0x0b, 0x01a19021 },
2702 { 0x0c, 0x01111012 },
2703 { 0x0d, 0x01114010 },
2704 { 0x0e, 0x02a19020 },
2705 { 0x0f, 0x01117011 },
2706 { 0x10, 0x01451140 },
2707 { 0x11, 0x400001f0 },
2708 { 0x15, 0x01813122 },
2709 { 0x1b, 0x400001f1 },
2710 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02002711};
2712
2713/*
2714 STAC 922X pin configs for
2715 102801BF
2716*/
Takashi Iwai0a42784642013-01-14 15:20:13 +01002717static const struct hda_pintbl dell_922x_m81_pin_configs[] = {
2718 { 0x0a, 0x0321101f },
2719 { 0x0b, 0x01112024 },
2720 { 0x0c, 0x01111222 },
2721 { 0x0d, 0x91174220 },
2722 { 0x0e, 0x03a11050 },
2723 { 0x0f, 0x01116221 },
2724 { 0x10, 0x90a70330 },
2725 { 0x11, 0x01452340 },
2726 { 0x15, 0x40C003f1 },
2727 { 0x1b, 0x405003f0 },
2728 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02002729};
2730
2731/*
2732 STAC 9221 A1 pin configs for
2733 102801D7 (Dell XPS M1210)
2734*/
Takashi Iwai0a42784642013-01-14 15:20:13 +01002735static const struct hda_pintbl dell_922x_m82_pin_configs[] = {
2736 { 0x0a, 0x02211211 },
2737 { 0x0b, 0x408103ff },
2738 { 0x0c, 0x02a1123e },
2739 { 0x0d, 0x90100310 },
2740 { 0x0e, 0x408003f1 },
2741 { 0x0f, 0x0221121f },
2742 { 0x10, 0x03451340 },
2743 { 0x11, 0x40c003f2 },
2744 { 0x15, 0x508003f3 },
2745 { 0x1b, 0x405003f4 },
2746 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02002747};
2748
Takashi Iwai0a42784642013-01-14 15:20:13 +01002749static const struct hda_pintbl d945gtp3_pin_configs[] = {
2750 { 0x0a, 0x0221401f },
2751 { 0x0b, 0x01a19022 },
2752 { 0x0c, 0x01813021 },
2753 { 0x0d, 0x01014010 },
2754 { 0x0e, 0x40000100 },
2755 { 0x0f, 0x40000100 },
2756 { 0x10, 0x40000100 },
2757 { 0x11, 0x40000100 },
2758 { 0x15, 0x02a19120 },
2759 { 0x1b, 0x40000100 },
2760 {}
Matt Porter403d1942005-11-29 15:00:51 +01002761};
2762
Takashi Iwai0a42784642013-01-14 15:20:13 +01002763static const struct hda_pintbl d945gtp5_pin_configs[] = {
2764 { 0x0a, 0x0221401f },
2765 { 0x0b, 0x01011012 },
2766 { 0x0c, 0x01813024 },
2767 { 0x0d, 0x01014010 },
2768 { 0x0e, 0x01a19021 },
2769 { 0x0f, 0x01016011 },
2770 { 0x10, 0x01452130 },
2771 { 0x11, 0x40000100 },
2772 { 0x15, 0x02a19320 },
2773 { 0x1b, 0x40000100 },
2774 {}
Matt Porter403d1942005-11-29 15:00:51 +01002775};
2776
Takashi Iwai0a42784642013-01-14 15:20:13 +01002777static const struct hda_pintbl intel_mac_v1_pin_configs[] = {
2778 { 0x0a, 0x0121e21f },
2779 { 0x0b, 0x400000ff },
2780 { 0x0c, 0x9017e110 },
2781 { 0x0d, 0x400000fd },
2782 { 0x0e, 0x400000fe },
2783 { 0x0f, 0x0181e020 },
2784 { 0x10, 0x1145e030 },
2785 { 0x11, 0x11c5e240 },
2786 { 0x15, 0x400000fc },
2787 { 0x1b, 0x400000fb },
2788 {}
Takashi Iwai3fc24d82007-02-16 13:27:18 +01002789};
2790
Takashi Iwai0a42784642013-01-14 15:20:13 +01002791static const struct hda_pintbl intel_mac_v2_pin_configs[] = {
2792 { 0x0a, 0x0121e21f },
2793 { 0x0b, 0x90a7012e },
2794 { 0x0c, 0x9017e110 },
2795 { 0x0d, 0x400000fd },
2796 { 0x0e, 0x400000fe },
2797 { 0x0f, 0x0181e020 },
2798 { 0x10, 0x1145e230 },
2799 { 0x11, 0x500000fa },
2800 { 0x15, 0x400000fc },
2801 { 0x1b, 0x400000fb },
2802 {}
Sylvain FORETf16928f2007-04-27 14:22:36 +02002803};
2804
Takashi Iwai0a42784642013-01-14 15:20:13 +01002805static const struct hda_pintbl intel_mac_v3_pin_configs[] = {
2806 { 0x0a, 0x0121e21f },
2807 { 0x0b, 0x90a7012e },
2808 { 0x0c, 0x9017e110 },
2809 { 0x0d, 0x400000fd },
2810 { 0x0e, 0x400000fe },
2811 { 0x0f, 0x0181e020 },
2812 { 0x10, 0x1145e230 },
2813 { 0x11, 0x11c5e240 },
2814 { 0x15, 0x400000fc },
2815 { 0x1b, 0x400000fb },
2816 {}
Ivan N. Zlatev5d5d3bc2007-05-29 16:03:00 +02002817};
2818
Takashi Iwai0a42784642013-01-14 15:20:13 +01002819static const struct hda_pintbl intel_mac_v4_pin_configs[] = {
2820 { 0x0a, 0x0321e21f },
2821 { 0x0b, 0x03a1e02e },
2822 { 0x0c, 0x9017e110 },
2823 { 0x0d, 0x9017e11f },
2824 { 0x0e, 0x400000fe },
2825 { 0x0f, 0x0381e020 },
2826 { 0x10, 0x1345e230 },
2827 { 0x11, 0x13c5e240 },
2828 { 0x15, 0x400000fc },
2829 { 0x1b, 0x400000fb },
2830 {}
Ivan N. Zlatev5d5d3bc2007-05-29 16:03:00 +02002831};
2832
Takashi Iwai0a42784642013-01-14 15:20:13 +01002833static const struct hda_pintbl intel_mac_v5_pin_configs[] = {
2834 { 0x0a, 0x0321e21f },
2835 { 0x0b, 0x03a1e02e },
2836 { 0x0c, 0x9017e110 },
2837 { 0x0d, 0x9017e11f },
2838 { 0x0e, 0x400000fe },
2839 { 0x0f, 0x0381e020 },
2840 { 0x10, 0x1345e230 },
2841 { 0x11, 0x13c5e240 },
2842 { 0x15, 0x400000fc },
2843 { 0x1b, 0x400000fb },
2844 {}
Takashi Iwai0dae0f82007-05-21 12:41:29 +02002845};
2846
Takashi Iwai0a42784642013-01-14 15:20:13 +01002847static const struct hda_pintbl ecs202_pin_configs[] = {
2848 { 0x0a, 0x0221401f },
2849 { 0x0b, 0x02a19020 },
2850 { 0x0c, 0x01a19020 },
2851 { 0x0d, 0x01114010 },
2852 { 0x0e, 0x408000f0 },
2853 { 0x0f, 0x01813022 },
2854 { 0x10, 0x074510a0 },
2855 { 0x11, 0x40c400f1 },
2856 { 0x15, 0x9037012e },
2857 { 0x1b, 0x40e000f2 },
2858 {}
Mauro Carvalho Chehab8c650082008-08-04 10:39:59 -03002859};
Takashi Iwai76c08822007-06-19 12:17:42 +02002860
Takashi Iwai0a42784642013-01-14 15:20:13 +01002861/* codec SSIDs for Intel Mac sharing the same PCI SSID 8384:7680 */
2862static const struct snd_pci_quirk stac922x_intel_mac_fixup_tbl[] = {
Takashi Iwaic6bffb82013-08-01 08:38:27 +02002863 SND_PCI_QUIRK(0x0000, 0x0100, "Mac Mini", STAC_INTEL_MAC_V3),
Takashi Iwai0a42784642013-01-14 15:20:13 +01002864 SND_PCI_QUIRK(0x106b, 0x0800, "Mac", STAC_INTEL_MAC_V1),
2865 SND_PCI_QUIRK(0x106b, 0x0600, "Mac", STAC_INTEL_MAC_V2),
2866 SND_PCI_QUIRK(0x106b, 0x0700, "Mac", STAC_INTEL_MAC_V2),
2867 SND_PCI_QUIRK(0x106b, 0x0e00, "Mac", STAC_INTEL_MAC_V3),
2868 SND_PCI_QUIRK(0x106b, 0x0f00, "Mac", STAC_INTEL_MAC_V3),
2869 SND_PCI_QUIRK(0x106b, 0x1600, "Mac", STAC_INTEL_MAC_V3),
2870 SND_PCI_QUIRK(0x106b, 0x1700, "Mac", STAC_INTEL_MAC_V3),
2871 SND_PCI_QUIRK(0x106b, 0x0200, "Mac", STAC_INTEL_MAC_V3),
2872 SND_PCI_QUIRK(0x106b, 0x1e00, "Mac", STAC_INTEL_MAC_V3),
2873 SND_PCI_QUIRK(0x106b, 0x1a00, "Mac", STAC_INTEL_MAC_V4),
2874 SND_PCI_QUIRK(0x106b, 0x0a00, "Mac", STAC_INTEL_MAC_V5),
2875 SND_PCI_QUIRK(0x106b, 0x2200, "Mac", STAC_INTEL_MAC_V5),
2876 {}
2877};
2878
2879static const struct hda_fixup stac922x_fixups[];
2880
2881/* remap the fixup from codec SSID and apply it */
2882static void stac922x_fixup_intel_mac_auto(struct hda_codec *codec,
2883 const struct hda_fixup *fix,
2884 int action)
2885{
2886 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2887 return;
2888 snd_hda_pick_fixup(codec, NULL, stac922x_intel_mac_fixup_tbl,
2889 stac922x_fixups);
2890 if (codec->fixup_id != STAC_INTEL_MAC_AUTO)
2891 snd_hda_apply_fixup(codec, action);
2892}
2893
2894static void stac922x_fixup_intel_mac_gpio(struct hda_codec *codec,
2895 const struct hda_fixup *fix,
2896 int action)
2897{
2898 struct sigmatel_spec *spec = codec->spec;
2899
2900 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
2901 spec->gpio_mask = spec->gpio_dir = 0x03;
2902 spec->gpio_data = 0x03;
2903 }
2904}
2905
2906static const struct hda_fixup stac922x_fixups[] = {
2907 [STAC_D945_REF] = {
2908 .type = HDA_FIXUP_PINS,
2909 .v.pins = ref922x_pin_configs,
2910 },
2911 [STAC_D945GTP3] = {
2912 .type = HDA_FIXUP_PINS,
2913 .v.pins = d945gtp3_pin_configs,
2914 },
2915 [STAC_D945GTP5] = {
2916 .type = HDA_FIXUP_PINS,
2917 .v.pins = d945gtp5_pin_configs,
2918 },
2919 [STAC_INTEL_MAC_AUTO] = {
2920 .type = HDA_FIXUP_FUNC,
2921 .v.func = stac922x_fixup_intel_mac_auto,
2922 },
2923 [STAC_INTEL_MAC_V1] = {
2924 .type = HDA_FIXUP_PINS,
2925 .v.pins = intel_mac_v1_pin_configs,
2926 .chained = true,
2927 .chain_id = STAC_922X_INTEL_MAC_GPIO,
2928 },
2929 [STAC_INTEL_MAC_V2] = {
2930 .type = HDA_FIXUP_PINS,
2931 .v.pins = intel_mac_v2_pin_configs,
2932 .chained = true,
2933 .chain_id = STAC_922X_INTEL_MAC_GPIO,
2934 },
2935 [STAC_INTEL_MAC_V3] = {
2936 .type = HDA_FIXUP_PINS,
2937 .v.pins = intel_mac_v3_pin_configs,
2938 .chained = true,
2939 .chain_id = STAC_922X_INTEL_MAC_GPIO,
2940 },
2941 [STAC_INTEL_MAC_V4] = {
2942 .type = HDA_FIXUP_PINS,
2943 .v.pins = intel_mac_v4_pin_configs,
2944 .chained = true,
2945 .chain_id = STAC_922X_INTEL_MAC_GPIO,
2946 },
2947 [STAC_INTEL_MAC_V5] = {
2948 .type = HDA_FIXUP_PINS,
2949 .v.pins = intel_mac_v5_pin_configs,
2950 .chained = true,
2951 .chain_id = STAC_922X_INTEL_MAC_GPIO,
2952 },
2953 [STAC_922X_INTEL_MAC_GPIO] = {
2954 .type = HDA_FIXUP_FUNC,
2955 .v.func = stac922x_fixup_intel_mac_gpio,
2956 },
2957 [STAC_ECS_202] = {
2958 .type = HDA_FIXUP_PINS,
2959 .v.pins = ecs202_pin_configs,
2960 },
2961 [STAC_922X_DELL_D81] = {
2962 .type = HDA_FIXUP_PINS,
2963 .v.pins = dell_922x_d81_pin_configs,
2964 },
2965 [STAC_922X_DELL_D82] = {
2966 .type = HDA_FIXUP_PINS,
2967 .v.pins = dell_922x_d82_pin_configs,
2968 },
2969 [STAC_922X_DELL_M81] = {
2970 .type = HDA_FIXUP_PINS,
2971 .v.pins = dell_922x_m81_pin_configs,
2972 },
2973 [STAC_922X_DELL_M82] = {
2974 .type = HDA_FIXUP_PINS,
2975 .v.pins = dell_922x_m82_pin_configs,
2976 },
2977};
2978
2979static const struct hda_model_fixup stac922x_models[] = {
2980 { .id = STAC_D945_REF, .name = "ref" },
2981 { .id = STAC_D945GTP5, .name = "5stack" },
2982 { .id = STAC_D945GTP3, .name = "3stack" },
2983 { .id = STAC_INTEL_MAC_V1, .name = "intel-mac-v1" },
2984 { .id = STAC_INTEL_MAC_V2, .name = "intel-mac-v2" },
2985 { .id = STAC_INTEL_MAC_V3, .name = "intel-mac-v3" },
2986 { .id = STAC_INTEL_MAC_V4, .name = "intel-mac-v4" },
2987 { .id = STAC_INTEL_MAC_V5, .name = "intel-mac-v5" },
2988 { .id = STAC_INTEL_MAC_AUTO, .name = "intel-mac-auto" },
2989 { .id = STAC_ECS_202, .name = "ecs202" },
2990 { .id = STAC_922X_DELL_D81, .name = "dell-d81" },
2991 { .id = STAC_922X_DELL_D82, .name = "dell-d82" },
2992 { .id = STAC_922X_DELL_M81, .name = "dell-m81" },
2993 { .id = STAC_922X_DELL_M82, .name = "dell-m82" },
Takashi Iwaidfe495d2007-08-23 19:04:28 +02002994 /* for backward compatibility */
Takashi Iwai0a42784642013-01-14 15:20:13 +01002995 { .id = STAC_INTEL_MAC_V3, .name = "macmini" },
2996 { .id = STAC_INTEL_MAC_V5, .name = "macbook" },
2997 { .id = STAC_INTEL_MAC_V3, .name = "macbook-pro-v1" },
2998 { .id = STAC_INTEL_MAC_V3, .name = "macbook-pro" },
2999 { .id = STAC_INTEL_MAC_V2, .name = "imac-intel" },
3000 { .id = STAC_INTEL_MAC_V3, .name = "imac-intel-20" },
3001 {}
Matt Porter403d1942005-11-29 15:00:51 +01003002};
3003
Takashi Iwai0a42784642013-01-14 15:20:13 +01003004static const struct snd_pci_quirk stac922x_fixup_tbl[] = {
Takashi Iwaif5fcc132006-11-24 17:07:44 +01003005 /* SigmaTel reference board */
3006 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
3007 "DFI LanParty", STAC_D945_REF),
Matthew Ranostay577aa2c2009-01-22 22:55:44 -05003008 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
3009 "DFI LanParty", STAC_D945_REF),
Takashi Iwaif5fcc132006-11-24 17:07:44 +01003010 /* Intel 945G based systems */
3011 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101,
3012 "Intel D945G", STAC_D945GTP3),
3013 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202,
3014 "Intel D945G", STAC_D945GTP3),
3015 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606,
3016 "Intel D945G", STAC_D945GTP3),
3017 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601,
3018 "Intel D945G", STAC_D945GTP3),
3019 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111,
3020 "Intel D945G", STAC_D945GTP3),
3021 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115,
3022 "Intel D945G", STAC_D945GTP3),
3023 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116,
3024 "Intel D945G", STAC_D945GTP3),
3025 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117,
3026 "Intel D945G", STAC_D945GTP3),
3027 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118,
3028 "Intel D945G", STAC_D945GTP3),
3029 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119,
3030 "Intel D945G", STAC_D945GTP3),
3031 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826,
3032 "Intel D945G", STAC_D945GTP3),
3033 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049,
3034 "Intel D945G", STAC_D945GTP3),
3035 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055,
3036 "Intel D945G", STAC_D945GTP3),
3037 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048,
3038 "Intel D945G", STAC_D945GTP3),
3039 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110,
3040 "Intel D945G", STAC_D945GTP3),
3041 /* Intel D945G 5-stack systems */
3042 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404,
3043 "Intel D945G", STAC_D945GTP5),
3044 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303,
3045 "Intel D945G", STAC_D945GTP5),
3046 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013,
3047 "Intel D945G", STAC_D945GTP5),
3048 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417,
3049 "Intel D945G", STAC_D945GTP5),
3050 /* Intel 945P based systems */
3051 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b,
3052 "Intel D945P", STAC_D945GTP3),
3053 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112,
3054 "Intel D945P", STAC_D945GTP3),
3055 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d,
3056 "Intel D945P", STAC_D945GTP3),
3057 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909,
3058 "Intel D945P", STAC_D945GTP3),
3059 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505,
3060 "Intel D945P", STAC_D945GTP3),
3061 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707,
3062 "Intel D945P", STAC_D945GTP5),
Takashi Iwai8056d472009-01-23 09:09:43 +01003063 /* other intel */
3064 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0204,
3065 "Intel D945", STAC_D945_REF),
Takashi Iwaif5fcc132006-11-24 17:07:44 +01003066 /* other systems */
Takashi Iwai0a42784642013-01-14 15:20:13 +01003067
Nicolas Boichat536319a2008-07-21 22:18:01 +08003068 /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */
Takashi Iwai0a42784642013-01-14 15:20:13 +01003069 SND_PCI_QUIRK(0x8384, 0x7680, "Mac", STAC_INTEL_MAC_AUTO),
3070
Takashi Iwaidfe495d2007-08-23 19:04:28 +02003071 /* Dell systems */
3072 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7,
3073 "unknown Dell", STAC_922X_DELL_D81),
3074 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a9,
3075 "unknown Dell", STAC_922X_DELL_D81),
3076 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ab,
3077 "unknown Dell", STAC_922X_DELL_D81),
3078 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ac,
3079 "unknown Dell", STAC_922X_DELL_D82),
3080 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bf,
3081 "unknown Dell", STAC_922X_DELL_M81),
3082 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d0,
3083 "unknown Dell", STAC_922X_DELL_D82),
3084 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d1,
3085 "unknown Dell", STAC_922X_DELL_D81),
3086 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d2,
3087 "unknown Dell", STAC_922X_DELL_D81),
3088 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7,
3089 "Dell XPS M1210", STAC_922X_DELL_M82),
Mauro Carvalho Chehab8c650082008-08-04 10:39:59 -03003090 /* ECS/PC Chips boards */
Takashi Iwaidea0a502009-02-09 17:14:52 +01003091 SND_PCI_QUIRK_MASK(0x1019, 0xf000, 0x2000,
Herton Ronaldo Krzesinski8663ae52009-02-08 19:50:34 -02003092 "ECS/PC chips", STAC_ECS_202),
Matt Porter403d1942005-11-29 15:00:51 +01003093 {} /* terminator */
3094};
3095
Takashi Iwai29ac8362013-01-14 16:03:38 +01003096static const struct hda_pintbl ref927x_pin_configs[] = {
3097 { 0x0a, 0x02214020 },
3098 { 0x0b, 0x02a19080 },
3099 { 0x0c, 0x0181304e },
3100 { 0x0d, 0x01014010 },
3101 { 0x0e, 0x01a19040 },
3102 { 0x0f, 0x01011012 },
3103 { 0x10, 0x01016011 },
3104 { 0x11, 0x0101201f },
3105 { 0x12, 0x183301f0 },
3106 { 0x13, 0x18a001f0 },
3107 { 0x14, 0x18a001f0 },
3108 { 0x21, 0x01442070 },
3109 { 0x22, 0x01c42190 },
3110 { 0x23, 0x40000100 },
3111 {}
Matt Porter3cc08dc2006-01-23 15:27:49 +01003112};
3113
Takashi Iwai29ac8362013-01-14 16:03:38 +01003114static const struct hda_pintbl d965_3st_pin_configs[] = {
3115 { 0x0a, 0x0221401f },
3116 { 0x0b, 0x02a19120 },
3117 { 0x0c, 0x40000100 },
3118 { 0x0d, 0x01014011 },
3119 { 0x0e, 0x01a19021 },
3120 { 0x0f, 0x01813024 },
3121 { 0x10, 0x40000100 },
3122 { 0x11, 0x40000100 },
3123 { 0x12, 0x40000100 },
3124 { 0x13, 0x40000100 },
3125 { 0x14, 0x40000100 },
3126 { 0x21, 0x40000100 },
3127 { 0x22, 0x40000100 },
3128 { 0x23, 0x40000100 },
3129 {}
Tobin Davis81d3dbd2006-08-22 19:44:45 +02003130};
3131
Takashi Iwai29ac8362013-01-14 16:03:38 +01003132static const struct hda_pintbl d965_5st_pin_configs[] = {
3133 { 0x0a, 0x02214020 },
3134 { 0x0b, 0x02a19080 },
3135 { 0x0c, 0x0181304e },
3136 { 0x0d, 0x01014010 },
3137 { 0x0e, 0x01a19040 },
3138 { 0x0f, 0x01011012 },
3139 { 0x10, 0x01016011 },
3140 { 0x11, 0x40000100 },
3141 { 0x12, 0x40000100 },
3142 { 0x13, 0x40000100 },
3143 { 0x14, 0x40000100 },
3144 { 0x21, 0x01442070 },
3145 { 0x22, 0x40000100 },
3146 { 0x23, 0x40000100 },
3147 {}
Tobin Davis93ed1502006-09-01 21:03:12 +02003148};
3149
Takashi Iwai29ac8362013-01-14 16:03:38 +01003150static const struct hda_pintbl d965_5st_no_fp_pin_configs[] = {
3151 { 0x0a, 0x40000100 },
3152 { 0x0b, 0x40000100 },
3153 { 0x0c, 0x0181304e },
3154 { 0x0d, 0x01014010 },
3155 { 0x0e, 0x01a19040 },
3156 { 0x0f, 0x01011012 },
3157 { 0x10, 0x01016011 },
3158 { 0x11, 0x40000100 },
3159 { 0x12, 0x40000100 },
3160 { 0x13, 0x40000100 },
3161 { 0x14, 0x40000100 },
3162 { 0x21, 0x01442070 },
3163 { 0x22, 0x40000100 },
3164 { 0x23, 0x40000100 },
3165 {}
Takashi Iwai679d92e2009-05-24 19:00:08 +02003166};
3167
Takashi Iwai29ac8362013-01-14 16:03:38 +01003168static const struct hda_pintbl dell_3st_pin_configs[] = {
3169 { 0x0a, 0x02211230 },
3170 { 0x0b, 0x02a11220 },
3171 { 0x0c, 0x01a19040 },
3172 { 0x0d, 0x01114210 },
3173 { 0x0e, 0x01111212 },
3174 { 0x0f, 0x01116211 },
3175 { 0x10, 0x01813050 },
3176 { 0x11, 0x01112214 },
3177 { 0x12, 0x403003fa },
3178 { 0x13, 0x90a60040 },
3179 { 0x14, 0x90a60040 },
3180 { 0x21, 0x404003fb },
3181 { 0x22, 0x40c003fc },
3182 { 0x23, 0x40000100 },
3183 {}
Tobin Davis4ff076e2007-08-07 11:48:12 +02003184};
3185
Takashi Iwai29ac8362013-01-14 16:03:38 +01003186static void stac927x_fixup_ref_no_jd(struct hda_codec *codec,
3187 const struct hda_fixup *fix, int action)
3188{
Takashi Iwai29ac8362013-01-14 16:03:38 +01003189 /* no jack detecion for ref-no-jd model */
Takashi Iwai36c9db72013-01-17 17:07:59 +01003190 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3191 codec->no_jack_detect = 1;
Takashi Iwai29ac8362013-01-14 16:03:38 +01003192}
3193
3194static void stac927x_fixup_ref(struct hda_codec *codec,
3195 const struct hda_fixup *fix, int action)
3196{
3197 struct sigmatel_spec *spec = codec->spec;
3198
3199 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3200 snd_hda_apply_pincfgs(codec, ref927x_pin_configs);
3201 spec->eapd_mask = spec->gpio_mask = 0;
3202 spec->gpio_dir = spec->gpio_data = 0;
3203 }
3204}
3205
3206static void stac927x_fixup_dell_dmic(struct hda_codec *codec,
3207 const struct hda_fixup *fix, int action)
3208{
3209 struct sigmatel_spec *spec = codec->spec;
3210
3211 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3212 return;
3213
3214 if (codec->subsystem_id != 0x1028022f) {
3215 /* GPIO2 High = Enable EAPD */
3216 spec->eapd_mask = spec->gpio_mask = 0x04;
3217 spec->gpio_dir = spec->gpio_data = 0x04;
3218 }
Takashi Iwai29ac8362013-01-14 16:03:38 +01003219
3220 snd_hda_add_verbs(codec, dell_3st_core_init);
3221 spec->volknob_init = 1;
Takashi Iwai29ac8362013-01-14 16:03:38 +01003222}
3223
3224static void stac927x_fixup_volknob(struct hda_codec *codec,
3225 const struct hda_fixup *fix, int action)
3226{
3227 struct sigmatel_spec *spec = codec->spec;
3228
3229 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3230 snd_hda_add_verbs(codec, stac927x_volknob_core_init);
3231 spec->volknob_init = 1;
3232 }
3233}
3234
3235static const struct hda_fixup stac927x_fixups[] = {
3236 [STAC_D965_REF_NO_JD] = {
3237 .type = HDA_FIXUP_FUNC,
3238 .v.func = stac927x_fixup_ref_no_jd,
3239 .chained = true,
3240 .chain_id = STAC_D965_REF,
3241 },
3242 [STAC_D965_REF] = {
3243 .type = HDA_FIXUP_FUNC,
3244 .v.func = stac927x_fixup_ref,
3245 },
3246 [STAC_D965_3ST] = {
3247 .type = HDA_FIXUP_PINS,
3248 .v.pins = d965_3st_pin_configs,
3249 .chained = true,
3250 .chain_id = STAC_D965_VERBS,
3251 },
3252 [STAC_D965_5ST] = {
3253 .type = HDA_FIXUP_PINS,
3254 .v.pins = d965_5st_pin_configs,
3255 .chained = true,
3256 .chain_id = STAC_D965_VERBS,
3257 },
3258 [STAC_D965_VERBS] = {
3259 .type = HDA_FIXUP_VERBS,
3260 .v.verbs = d965_core_init,
3261 },
3262 [STAC_D965_5ST_NO_FP] = {
3263 .type = HDA_FIXUP_PINS,
3264 .v.pins = d965_5st_no_fp_pin_configs,
3265 },
3266 [STAC_DELL_3ST] = {
3267 .type = HDA_FIXUP_PINS,
3268 .v.pins = dell_3st_pin_configs,
3269 .chained = true,
3270 .chain_id = STAC_927X_DELL_DMIC,
3271 },
3272 [STAC_DELL_BIOS] = {
3273 .type = HDA_FIXUP_PINS,
3274 .v.pins = (const struct hda_pintbl[]) {
3275 /* configure the analog microphone on some laptops */
3276 { 0x0c, 0x90a79130 },
3277 /* correct the front output jack as a hp out */
Takashi Iwai0d9230a2013-07-19 08:02:25 +02003278 { 0x0f, 0x0221101f },
Takashi Iwai29ac8362013-01-14 16:03:38 +01003279 /* correct the front input jack as a mic */
3280 { 0x0e, 0x02a79130 },
3281 {}
3282 },
3283 .chained = true,
3284 .chain_id = STAC_927X_DELL_DMIC,
3285 },
3286 [STAC_DELL_BIOS_SPDIF] = {
3287 .type = HDA_FIXUP_PINS,
3288 .v.pins = (const struct hda_pintbl[]) {
3289 /* correct the device field to SPDIF out */
3290 { 0x21, 0x01442070 },
3291 {}
3292 },
3293 .chained = true,
3294 .chain_id = STAC_DELL_BIOS,
3295 },
3296 [STAC_927X_DELL_DMIC] = {
3297 .type = HDA_FIXUP_FUNC,
3298 .v.func = stac927x_fixup_dell_dmic,
3299 },
3300 [STAC_927X_VOLKNOB] = {
3301 .type = HDA_FIXUP_FUNC,
3302 .v.func = stac927x_fixup_volknob,
3303 },
Matt Porter3cc08dc2006-01-23 15:27:49 +01003304};
3305
Takashi Iwai29ac8362013-01-14 16:03:38 +01003306static const struct hda_model_fixup stac927x_models[] = {
3307 { .id = STAC_D965_REF_NO_JD, .name = "ref-no-jd" },
3308 { .id = STAC_D965_REF, .name = "ref" },
3309 { .id = STAC_D965_3ST, .name = "3stack" },
3310 { .id = STAC_D965_5ST, .name = "5stack" },
3311 { .id = STAC_D965_5ST_NO_FP, .name = "5stack-no-fp" },
3312 { .id = STAC_DELL_3ST, .name = "dell-3stack" },
3313 { .id = STAC_DELL_BIOS, .name = "dell-bios" },
3314 { .id = STAC_927X_VOLKNOB, .name = "volknob" },
3315 {}
Takashi Iwaif5fcc132006-11-24 17:07:44 +01003316};
3317
Takashi Iwai29ac8362013-01-14 16:03:38 +01003318static const struct snd_pci_quirk stac927x_fixup_tbl[] = {
Takashi Iwaif5fcc132006-11-24 17:07:44 +01003319 /* SigmaTel reference board */
3320 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
3321 "DFI LanParty", STAC_D965_REF),
Matthew Ranostay577aa2c2009-01-22 22:55:44 -05003322 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
3323 "DFI LanParty", STAC_D965_REF),
Tobin Davis81d3dbd2006-08-22 19:44:45 +02003324 /* Intel 946 based systems */
Takashi Iwaif5fcc132006-11-24 17:07:44 +01003325 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST),
3326 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xa301, "Intel D946", STAC_D965_3ST),
Tobin Davis93ed1502006-09-01 21:03:12 +02003327 /* 965 based 3 stack systems */
Takashi Iwaidea0a502009-02-09 17:14:52 +01003328 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2100,
3329 "Intel D965", STAC_D965_3ST),
3330 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2000,
3331 "Intel D965", STAC_D965_3ST),
Tobin Davis4ff076e2007-08-07 11:48:12 +02003332 /* Dell 3 stack systems */
Takashi Iwaidfe495d2007-08-23 19:04:28 +02003333 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST),
Tobin Davis4ff076e2007-08-07 11:48:12 +02003334 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ed, "Dell ", STAC_DELL_3ST),
3335 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f4, "Dell ", STAC_DELL_3ST),
Matthew Ranostay8e9068b2007-12-17 11:58:13 +01003336 /* Dell 3 stack systems with verb table in BIOS */
Matthew Ranostay2f32d902008-01-10 13:06:26 +01003337 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS),
Daniel T Chen66668b62010-05-23 20:47:45 -04003338 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f7, "Dell XPS M1730", STAC_DELL_BIOS),
Matthew Ranostay2f32d902008-01-10 13:06:26 +01003339 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS),
Takashi Iwai29ac8362013-01-14 16:03:38 +01003340 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS_SPDIF),
Chengu Wang84d3dc22009-07-30 19:43:55 +08003341 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell Inspiron 1525", STAC_DELL_BIOS),
Matthew Ranostay8e9068b2007-12-17 11:58:13 +01003342 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS),
3343 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS),
3344 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS),
Takashi Iwai29ac8362013-01-14 16:03:38 +01003345 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0209, "Dell XPS 1330", STAC_DELL_BIOS_SPDIF),
Tobin Davis93ed1502006-09-01 21:03:12 +02003346 /* 965 based 5 stack systems */
Takashi Iwaidea0a502009-02-09 17:14:52 +01003347 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2300,
3348 "Intel D965", STAC_D965_5ST),
3349 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500,
3350 "Intel D965", STAC_D965_5ST),
Takashi Iwai54930532009-10-11 17:38:29 +02003351 /* volume-knob fixes */
3352 SND_PCI_QUIRK_VENDOR(0x10cf, "FSC", STAC_927X_VOLKNOB),
Matt Porter3cc08dc2006-01-23 15:27:49 +01003353 {} /* terminator */
3354};
3355
Takashi Iwaife6322c2013-01-14 14:46:51 +01003356static const struct hda_pintbl ref9205_pin_configs[] = {
3357 { 0x0a, 0x40000100 },
3358 { 0x0b, 0x40000100 },
3359 { 0x0c, 0x01016011 },
3360 { 0x0d, 0x01014010 },
3361 { 0x0e, 0x01813122 },
3362 { 0x0f, 0x01a19021 },
3363 { 0x14, 0x01019020 },
3364 { 0x16, 0x40000100 },
3365 { 0x17, 0x90a000f0 },
3366 { 0x18, 0x90a000f0 },
3367 { 0x21, 0x01441030 },
3368 { 0x22, 0x01c41030 },
3369 {}
Matt Porterf3302a52006-07-31 12:49:34 +02003370};
3371
Takashi Iwaidfe495d2007-08-23 19:04:28 +02003372/*
3373 STAC 9205 pin configs for
3374 102801F1
3375 102801F2
3376 102801FC
3377 102801FD
3378 10280204
3379 1028021F
Matthew Ranostay3fa2ef72008-01-11 11:39:06 +01003380 10280228 (Dell Vostro 1500)
Anisse Astier95e70e82009-12-23 17:28:45 +01003381 10280229 (Dell Vostro 1700)
Takashi Iwaidfe495d2007-08-23 19:04:28 +02003382*/
Takashi Iwaife6322c2013-01-14 14:46:51 +01003383static const struct hda_pintbl dell_9205_m42_pin_configs[] = {
3384 { 0x0a, 0x0321101F },
3385 { 0x0b, 0x03A11020 },
3386 { 0x0c, 0x400003FA },
3387 { 0x0d, 0x90170310 },
3388 { 0x0e, 0x400003FB },
3389 { 0x0f, 0x400003FC },
3390 { 0x14, 0x400003FD },
3391 { 0x16, 0x40F000F9 },
3392 { 0x17, 0x90A60330 },
3393 { 0x18, 0x400003FF },
3394 { 0x21, 0x0144131F },
3395 { 0x22, 0x40C003FE },
3396 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02003397};
3398
3399/*
3400 STAC 9205 pin configs for
3401 102801F9
3402 102801FA
3403 102801FE
3404 102801FF (Dell Precision M4300)
3405 10280206
3406 10280200
3407 10280201
3408*/
Takashi Iwaife6322c2013-01-14 14:46:51 +01003409static const struct hda_pintbl dell_9205_m43_pin_configs[] = {
3410 { 0x0a, 0x0321101f },
3411 { 0x0b, 0x03a11020 },
3412 { 0x0c, 0x90a70330 },
3413 { 0x0d, 0x90170310 },
3414 { 0x0e, 0x400000fe },
3415 { 0x0f, 0x400000ff },
3416 { 0x14, 0x400000fd },
3417 { 0x16, 0x40f000f9 },
3418 { 0x17, 0x400000fa },
3419 { 0x18, 0x400000fc },
3420 { 0x21, 0x0144131f },
3421 { 0x22, 0x40c003f8 },
3422 /* Enable SPDIF in/out */
3423 { 0x1f, 0x01441030 },
3424 { 0x20, 0x1c410030 },
3425 {}
Tobin Davisae0a8ed2007-08-13 15:50:29 +02003426};
3427
Takashi Iwaife6322c2013-01-14 14:46:51 +01003428static const struct hda_pintbl dell_9205_m44_pin_configs[] = {
3429 { 0x0a, 0x0421101f },
3430 { 0x0b, 0x04a11020 },
3431 { 0x0c, 0x400003fa },
3432 { 0x0d, 0x90170310 },
3433 { 0x0e, 0x400003fb },
3434 { 0x0f, 0x400003fc },
3435 { 0x14, 0x400003fd },
3436 { 0x16, 0x400003f9 },
3437 { 0x17, 0x90a60330 },
3438 { 0x18, 0x400003ff },
3439 { 0x21, 0x01441340 },
3440 { 0x22, 0x40c003fe },
3441 {}
Tobin Davisae0a8ed2007-08-13 15:50:29 +02003442};
3443
Takashi Iwaife6322c2013-01-14 14:46:51 +01003444static void stac9205_fixup_ref(struct hda_codec *codec,
3445 const struct hda_fixup *fix, int action)
3446{
3447 struct sigmatel_spec *spec = codec->spec;
3448
3449 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3450 snd_hda_apply_pincfgs(codec, ref9205_pin_configs);
3451 /* SPDIF-In enabled */
3452 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0;
3453 }
3454}
3455
Takashi Iwaife6322c2013-01-14 14:46:51 +01003456static void stac9205_fixup_dell_m43(struct hda_codec *codec,
3457 const struct hda_fixup *fix, int action)
3458{
3459 struct sigmatel_spec *spec = codec->spec;
Takashi Iwai36c9db72013-01-17 17:07:59 +01003460 struct hda_jack_tbl *jack;
Takashi Iwaife6322c2013-01-14 14:46:51 +01003461
3462 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3463 snd_hda_apply_pincfgs(codec, dell_9205_m43_pin_configs);
3464
3465 /* Enable unsol response for GPIO4/Dock HP connection */
Takashi Iwaife6322c2013-01-14 14:46:51 +01003466 snd_hda_codec_write_cache(codec, codec->afg, 0,
3467 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10);
Takashi Iwai36c9db72013-01-17 17:07:59 +01003468 snd_hda_jack_detect_enable_callback(codec, codec->afg,
3469 STAC_VREF_EVENT,
3470 stac_vref_event);
3471 jack = snd_hda_jack_tbl_get(codec, codec->afg);
3472 if (jack)
3473 jack->private_data = 0x01;
Takashi Iwaife6322c2013-01-14 14:46:51 +01003474
3475 spec->gpio_dir = 0x0b;
3476 spec->eapd_mask = 0x01;
3477 spec->gpio_mask = 0x1b;
3478 spec->gpio_mute = 0x10;
3479 /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute,
3480 * GPIO3 Low = DRM
3481 */
3482 spec->gpio_data = 0x01;
3483 }
3484}
3485
3486static void stac9205_fixup_eapd(struct hda_codec *codec,
3487 const struct hda_fixup *fix, int action)
3488{
3489 struct sigmatel_spec *spec = codec->spec;
3490
3491 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3492 spec->eapd_switch = 0;
3493}
3494
3495static const struct hda_fixup stac9205_fixups[] = {
3496 [STAC_9205_REF] = {
3497 .type = HDA_FIXUP_FUNC,
3498 .v.func = stac9205_fixup_ref,
3499 },
3500 [STAC_9205_DELL_M42] = {
3501 .type = HDA_FIXUP_PINS,
3502 .v.pins = dell_9205_m42_pin_configs,
3503 },
3504 [STAC_9205_DELL_M43] = {
3505 .type = HDA_FIXUP_FUNC,
3506 .v.func = stac9205_fixup_dell_m43,
3507 },
3508 [STAC_9205_DELL_M44] = {
3509 .type = HDA_FIXUP_PINS,
3510 .v.pins = dell_9205_m44_pin_configs,
3511 },
3512 [STAC_9205_EAPD] = {
3513 .type = HDA_FIXUP_FUNC,
3514 .v.func = stac9205_fixup_eapd,
3515 },
3516 {}
Matt Porterf3302a52006-07-31 12:49:34 +02003517};
3518
Takashi Iwaife6322c2013-01-14 14:46:51 +01003519static const struct hda_model_fixup stac9205_models[] = {
3520 { .id = STAC_9205_REF, .name = "ref" },
3521 { .id = STAC_9205_DELL_M42, .name = "dell-m42" },
3522 { .id = STAC_9205_DELL_M43, .name = "dell-m43" },
3523 { .id = STAC_9205_DELL_M44, .name = "dell-m44" },
3524 { .id = STAC_9205_EAPD, .name = "eapd" },
3525 {}
Takashi Iwaif5fcc132006-11-24 17:07:44 +01003526};
3527
Takashi Iwaife6322c2013-01-14 14:46:51 +01003528static const struct snd_pci_quirk stac9205_fixup_tbl[] = {
Takashi Iwaif5fcc132006-11-24 17:07:44 +01003529 /* SigmaTel reference board */
3530 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
3531 "DFI LanParty", STAC_9205_REF),
Herton Ronaldo Krzesinski02358fc2009-07-04 01:44:59 -03003532 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xfb30,
3533 "SigmaTel", STAC_9205_REF),
Matthew Ranostay577aa2c2009-01-22 22:55:44 -05003534 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
3535 "DFI LanParty", STAC_9205_REF),
Takashi Iwaid9a42682009-01-22 17:40:18 +01003536 /* Dell */
Takashi Iwaidfe495d2007-08-23 19:04:28 +02003537 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1,
3538 "unknown Dell", STAC_9205_DELL_M42),
3539 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2,
3540 "unknown Dell", STAC_9205_DELL_M42),
Tobin Davisae0a8ed2007-08-13 15:50:29 +02003541 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f8,
Matthew Ranostayb44ef2f2007-09-18 00:52:38 +02003542 "Dell Precision", STAC_9205_DELL_M43),
Tobin Davisae0a8ed2007-08-13 15:50:29 +02003543 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f9,
3544 "Dell Precision", STAC_9205_DELL_M43),
3545 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fa,
3546 "Dell Precision", STAC_9205_DELL_M43),
Takashi Iwaidfe495d2007-08-23 19:04:28 +02003547 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc,
3548 "unknown Dell", STAC_9205_DELL_M42),
3549 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd,
3550 "unknown Dell", STAC_9205_DELL_M42),
Tobin Davisae0a8ed2007-08-13 15:50:29 +02003551 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fe,
3552 "Dell Precision", STAC_9205_DELL_M43),
3553 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ff,
Takashi Iwaidfe495d2007-08-23 19:04:28 +02003554 "Dell Precision M4300", STAC_9205_DELL_M43),
Takashi Iwaidfe495d2007-08-23 19:04:28 +02003555 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0204,
3556 "unknown Dell", STAC_9205_DELL_M42),
Takashi Iwai45499152008-06-12 16:27:24 +02003557 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0206,
3558 "Dell Precision", STAC_9205_DELL_M43),
3559 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021b,
3560 "Dell Precision", STAC_9205_DELL_M43),
3561 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021c,
3562 "Dell Precision", STAC_9205_DELL_M43),
Tobin Davisae0a8ed2007-08-13 15:50:29 +02003563 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021f,
3564 "Dell Inspiron", STAC_9205_DELL_M44),
Matthew Ranostay3fa2ef72008-01-11 11:39:06 +01003565 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228,
3566 "Dell Vostro 1500", STAC_9205_DELL_M42),
Anisse Astier95e70e82009-12-23 17:28:45 +01003567 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0229,
3568 "Dell Vostro 1700", STAC_9205_DELL_M42),
Takashi Iwaid9a42682009-01-22 17:40:18 +01003569 /* Gateway */
Hao Song42b95f02009-07-20 15:01:16 +08003570 SND_PCI_QUIRK(0x107b, 0x0560, "Gateway T6834c", STAC_9205_EAPD),
Takashi Iwaid9a42682009-01-22 17:40:18 +01003571 SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD),
Matt Porterf3302a52006-07-31 12:49:34 +02003572 {} /* terminator */
3573};
3574
Takashi Iwai36c9db72013-01-17 17:07:59 +01003575static int stac_parse_auto_config(struct hda_codec *codec)
Mattc7d4b2f2005-06-27 14:59:41 +02003576{
3577 struct sigmatel_spec *spec = codec->spec;
Takashi Iwaidc04d1b2009-03-06 10:00:05 +01003578 int err;
David Henningssonf390dad2013-03-21 12:16:30 +01003579 int flags = 0;
Mattc7d4b2f2005-06-27 14:59:41 +02003580
David Henningssonf390dad2013-03-21 12:16:30 +01003581 if (spec->headset_jack)
3582 flags |= HDA_PINCFG_HEADSET_MIC;
3583
3584 err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL, flags);
Takashi Iwaidc04d1b2009-03-06 10:00:05 +01003585 if (err < 0)
3586 return err;
3587
Takashi Iwai36c9db72013-01-17 17:07:59 +01003588 /* add hooks */
3589 spec->gen.pcm_playback_hook = stac_playback_pcm_hook;
3590 spec->gen.pcm_capture_hook = stac_capture_pcm_hook;
3591
3592 spec->gen.automute_hook = stac_update_outputs;
3593 spec->gen.hp_automute_hook = stac_hp_automute;
3594 spec->gen.line_automute_hook = stac_line_automute;
David Henningsson664389d2013-01-28 11:29:17 +01003595 spec->gen.mic_autoswitch_hook = stac_mic_autoswitch;
Takashi Iwai36c9db72013-01-17 17:07:59 +01003596
3597 err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg);
Takashi Iwaidc04d1b2009-03-06 10:00:05 +01003598 if (err < 0)
3599 return err;
3600
Takashi Iwai36c9db72013-01-17 17:07:59 +01003601 /* minimum value is actually mute */
3602 spec->gen.vmaster_tlv[3] |= TLV_DB_SCALE_MUTE;
Mattc7d4b2f2005-06-27 14:59:41 +02003603
Matthew Ranostay1cd22242008-07-18 18:20:52 +02003604 /* setup analog beep controls */
3605 if (spec->anabeep_nid > 0) {
Takashi Iwai36c9db72013-01-17 17:07:59 +01003606 err = stac_auto_create_beep_ctls(codec,
3607 spec->anabeep_nid);
Matthew Ranostay1cd22242008-07-18 18:20:52 +02003608 if (err < 0)
3609 return err;
3610 }
3611
3612 /* setup digital beep controls and input device */
3613#ifdef CONFIG_SND_HDA_INPUT_BEEP
Takashi Iwai7504b6c2013-03-18 11:25:51 +01003614 if (spec->gen.beep_nid) {
3615 hda_nid_t nid = spec->gen.beep_nid;
Takashi Iwai4d4e9bb2008-11-12 16:45:04 +01003616 unsigned int caps;
Matthew Ranostay1cd22242008-07-18 18:20:52 +02003617
Takashi Iwai36c9db72013-01-17 17:07:59 +01003618 err = stac_auto_create_beep_ctls(codec, nid);
Matthew Ranostay1cd22242008-07-18 18:20:52 +02003619 if (err < 0)
3620 return err;
Takashi Iwaid8d881d2009-12-22 07:52:49 +01003621 if (codec->beep) {
3622 /* IDT/STAC codecs have linear beep tone parameter */
Daniel J Blueman1b0e3722010-08-03 11:09:13 +01003623 codec->beep->linear_tone = spec->linear_tone_beep;
Takashi Iwaid8d881d2009-12-22 07:52:49 +01003624 /* if no beep switch is available, make its own one */
3625 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
3626 if (!(caps & AC_AMPCAP_MUTE)) {
Takashi Iwai36c9db72013-01-17 17:07:59 +01003627 err = stac_beep_switch_ctl(codec);
Takashi Iwaid8d881d2009-12-22 07:52:49 +01003628 if (err < 0)
3629 return err;
3630 }
Takashi Iwai4d4e9bb2008-11-12 16:45:04 +01003631 }
Matthew Ranostay1cd22242008-07-18 18:20:52 +02003632 }
3633#endif
3634
Takashi Iwai36c9db72013-01-17 17:07:59 +01003635 if (spec->gpio_led)
3636 spec->gen.vmaster_mute.hook = stac_vmaster_hook;
Maxim Levitsky0fb87bb2007-09-03 15:29:04 +02003637
Takashi Iwai36c9db72013-01-17 17:07:59 +01003638 if (spec->aloopback_ctl &&
3639 snd_hda_get_bool_hint(codec, "loopback") == 1) {
3640 if (!snd_hda_gen_add_kctl(&spec->gen, NULL, spec->aloopback_ctl))
3641 return -ENOMEM;
Takashi Iwaidc04d1b2009-03-06 10:00:05 +01003642 }
Maxim Levitsky0fb87bb2007-09-03 15:29:04 +02003643
Takashi Iwai42875472013-01-22 09:34:48 +01003644 if (spec->have_spdif_mux) {
3645 err = stac_create_spdif_mux_ctls(codec);
3646 if (err < 0)
3647 return err;
3648 }
3649
Takashi Iwai82bc9552006-03-21 11:24:42 +01003650 return 0;
3651}
3652
Takashi Iwaic0532c3b2014-09-11 12:59:21 +02003653static int stac_build_controls(struct hda_codec *codec)
3654{
3655 int err = snd_hda_gen_build_controls(codec);
3656
3657 if (err < 0)
3658 return err;
3659 stac_init_power_map(codec);
3660 return 0;
3661}
Takashi Iwai36c9db72013-01-17 17:07:59 +01003662
3663static int stac_init(struct hda_codec *codec)
Richard Fish160ea0d2006-09-06 13:58:25 +02003664{
3665 struct sigmatel_spec *spec = codec->spec;
Takashi Iwaie4973e12008-11-18 09:32:42 +01003666 int i;
Mattc7d4b2f2005-06-27 14:59:41 +02003667
Takashi Iwai6565e4f2009-03-02 14:38:35 +01003668 /* override some hints */
3669 stac_store_hints(codec);
3670
Takashi Iwaif73d3582008-11-25 08:21:51 +01003671 /* set up GPIO */
Takashi Iwaif73d3582008-11-25 08:21:51 +01003672 /* turn on EAPD statically when spec->eapd_switch isn't set.
3673 * otherwise, unsol event will turn it on/off dynamically
3674 */
3675 if (!spec->eapd_switch)
Takashi Iwai9c563a52013-07-19 07:58:02 +02003676 spec->gpio_data |= spec->eapd_mask;
3677 stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data);
Takashi Iwaif73d3582008-11-25 08:21:51 +01003678
Takashi Iwai36c9db72013-01-17 17:07:59 +01003679 snd_hda_gen_init(codec);
Takashi Iwaic8822462012-05-15 09:11:36 +02003680
3681 /* sync the power-map */
3682 if (spec->num_pwrs)
3683 snd_hda_codec_write(codec, codec->afg, 0,
3684 AC_VERB_IDT_SET_POWER_MAP,
3685 spec->power_map_bits);
Takashi Iwai36c9db72013-01-17 17:07:59 +01003686
3687 /* power down inactive ADCs */
3688 if (spec->powerdown_adcs) {
3689 for (i = 0; i < spec->gen.num_all_adcs; i++) {
3690 if (spec->active_adcs & (1 << i))
3691 continue;
3692 snd_hda_codec_write(codec, spec->gen.all_adcs[i], 0,
3693 AC_VERB_SET_POWER_STATE,
3694 AC_PWRST_D3);
3695 }
3696 }
3697
Mattc7d4b2f2005-06-27 14:59:41 +02003698 return 0;
3699}
3700
Takashi Iwai36c9db72013-01-17 17:07:59 +01003701static void stac_shutup(struct hda_codec *codec)
Takashi Iwai603c4012008-07-30 15:01:44 +02003702{
3703 struct sigmatel_spec *spec = codec->spec;
3704
Takashi Iwai36c9db72013-01-17 17:07:59 +01003705 snd_hda_shutup_pins(codec);
Takashi Iwai167eae52009-11-06 15:47:50 +01003706
3707 if (spec->eapd_mask)
3708 stac_gpio_set(codec, spec->gpio_mask,
3709 spec->gpio_dir, spec->gpio_data &
3710 ~spec->eapd_mask);
3711}
3712
Takashi Iwai7504b6c2013-03-18 11:25:51 +01003713#define stac_free snd_hda_gen_free
Matt2f2f4252005-04-13 14:45:30 +02003714
Takashi Iwai2d34e1b2008-11-28 14:35:16 +01003715#ifdef CONFIG_PROC_FS
3716static void stac92hd_proc_hook(struct snd_info_buffer *buffer,
3717 struct hda_codec *codec, hda_nid_t nid)
3718{
3719 if (nid == codec->afg)
3720 snd_iprintf(buffer, "Power-Map: 0x%02x\n",
Takashi Iwaic8822462012-05-15 09:11:36 +02003721 snd_hda_codec_read(codec, nid, 0,
3722 AC_VERB_IDT_GET_POWER_MAP, 0));
Takashi Iwai2d34e1b2008-11-28 14:35:16 +01003723}
3724
3725static void analog_loop_proc_hook(struct snd_info_buffer *buffer,
3726 struct hda_codec *codec,
3727 unsigned int verb)
3728{
3729 snd_iprintf(buffer, "Analog Loopback: 0x%02x\n",
3730 snd_hda_codec_read(codec, codec->afg, 0, verb, 0));
3731}
3732
3733/* stac92hd71bxx, stac92hd73xx */
3734static void stac92hd7x_proc_hook(struct snd_info_buffer *buffer,
3735 struct hda_codec *codec, hda_nid_t nid)
3736{
3737 stac92hd_proc_hook(buffer, codec, nid);
3738 if (nid == codec->afg)
3739 analog_loop_proc_hook(buffer, codec, 0xfa0);
3740}
3741
3742static void stac9205_proc_hook(struct snd_info_buffer *buffer,
3743 struct hda_codec *codec, hda_nid_t nid)
3744{
3745 if (nid == codec->afg)
3746 analog_loop_proc_hook(buffer, codec, 0xfe0);
3747}
3748
3749static void stac927x_proc_hook(struct snd_info_buffer *buffer,
3750 struct hda_codec *codec, hda_nid_t nid)
3751{
3752 if (nid == codec->afg)
3753 analog_loop_proc_hook(buffer, codec, 0xfeb);
3754}
3755#else
3756#define stac92hd_proc_hook NULL
3757#define stac92hd7x_proc_hook NULL
3758#define stac9205_proc_hook NULL
3759#define stac927x_proc_hook NULL
3760#endif
3761
Takashi Iwai2a439522011-07-26 09:52:50 +02003762#ifdef CONFIG_PM
Takashi Iwai36c9db72013-01-17 17:07:59 +01003763static int stac_resume(struct hda_codec *codec)
Mattff6fdc32005-06-27 15:06:52 +02003764{
Takashi Iwai36c9db72013-01-17 17:07:59 +01003765 codec->patch_ops.init(codec);
Takashi Iwai82beb8f2007-08-10 17:09:26 +02003766 snd_hda_codec_resume_amp(codec);
3767 snd_hda_codec_resume_cache(codec);
Mattff6fdc32005-06-27 15:06:52 +02003768 return 0;
3769}
Matthew Ranostayc6798d22008-11-18 20:54:17 -05003770
Takashi Iwai36c9db72013-01-17 17:07:59 +01003771static int stac_suspend(struct hda_codec *codec)
Vitaliy Kulikov45eebda2011-07-26 16:56:20 -05003772{
Takashi Iwai36c9db72013-01-17 17:07:59 +01003773 stac_shutup(codec);
Vitaliy Kulikov45eebda2011-07-26 16:56:20 -05003774 return 0;
3775}
3776
Takashi Iwai36c9db72013-01-17 17:07:59 +01003777static void stac_set_power_state(struct hda_codec *codec, hda_nid_t fg,
3778 unsigned int power_state)
Vitaliy Kulikov45eebda2011-07-26 16:56:20 -05003779{
3780 unsigned int afg_power_state = power_state;
3781 struct sigmatel_spec *spec = codec->spec;
3782
3783 if (power_state == AC_PWRST_D3) {
Takashi Iwaif1a73742011-12-04 13:44:06 +01003784 if (spec->vref_mute_led_nid) {
Vitaliy Kulikov45eebda2011-07-26 16:56:20 -05003785 /* with vref-out pin used for mute led control
3786 * codec AFG is prevented from D3 state
3787 */
3788 afg_power_state = AC_PWRST_D1;
3789 }
3790 /* this delay seems necessary to avoid click noise at power-down */
3791 msleep(100);
3792 }
3793 snd_hda_codec_read(codec, fg, 0, AC_VERB_SET_POWER_STATE,
3794 afg_power_state);
Takashi Iwai9419ab62013-01-24 17:23:35 +01003795 snd_hda_codec_set_power_to_all(codec, fg, power_state);
Vitaliy Kulikov45eebda2011-07-26 16:56:20 -05003796}
Takashi Iwai350eba432012-03-16 16:09:03 +01003797#else
Takashi Iwai36c9db72013-01-17 17:07:59 +01003798#define stac_suspend NULL
3799#define stac_resume NULL
3800#define stac_set_power_state NULL
Takashi Iwai2faa3bf2012-03-12 12:30:22 +01003801#endif /* CONFIG_PM */
Vitaliy Kulikov45eebda2011-07-26 16:56:20 -05003802
Takashi Iwai36c9db72013-01-17 17:07:59 +01003803static const struct hda_codec_ops stac_patch_ops = {
Takashi Iwaic0532c3b2014-09-11 12:59:21 +02003804 .build_controls = stac_build_controls,
Takashi Iwai36c9db72013-01-17 17:07:59 +01003805 .build_pcms = snd_hda_gen_build_pcms,
3806 .init = stac_init,
3807 .free = stac_free,
David Henningsson29adc4b2012-09-25 11:31:00 +02003808 .unsol_event = snd_hda_jack_unsol_event,
Takashi Iwai2a439522011-07-26 09:52:50 +02003809#ifdef CONFIG_PM
Takashi Iwai36c9db72013-01-17 17:07:59 +01003810 .suspend = stac_suspend,
3811 .resume = stac_resume,
Mattff6fdc32005-06-27 15:06:52 +02003812#endif
Takashi Iwai36c9db72013-01-17 17:07:59 +01003813 .reboot_notify = stac_shutup,
Matt2f2f4252005-04-13 14:45:30 +02003814};
3815
Takashi Iwai36c9db72013-01-17 17:07:59 +01003816static int alloc_stac_spec(struct hda_codec *codec)
Takashi Iwai361dab32012-05-09 14:35:27 +02003817{
3818 struct sigmatel_spec *spec;
3819
3820 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
3821 if (!spec)
3822 return -ENOMEM;
Takashi Iwai36c9db72013-01-17 17:07:59 +01003823 snd_hda_gen_spec_init(&spec->gen);
Takashi Iwai361dab32012-05-09 14:35:27 +02003824 codec->spec = spec;
3825 codec->no_trigger_sense = 1; /* seems common with STAC/IDT codecs */
Takashi Iwai361dab32012-05-09 14:35:27 +02003826 return 0;
3827}
3828
Matt2f2f4252005-04-13 14:45:30 +02003829static int patch_stac9200(struct hda_codec *codec)
3830{
3831 struct sigmatel_spec *spec;
Mattc7d4b2f2005-06-27 14:59:41 +02003832 int err;
Matt2f2f4252005-04-13 14:45:30 +02003833
Takashi Iwai36c9db72013-01-17 17:07:59 +01003834 err = alloc_stac_spec(codec);
Takashi Iwai361dab32012-05-09 14:35:27 +02003835 if (err < 0)
3836 return err;
Matt2f2f4252005-04-13 14:45:30 +02003837
Takashi Iwai361dab32012-05-09 14:35:27 +02003838 spec = codec->spec;
Daniel J Blueman1b0e3722010-08-03 11:09:13 +01003839 spec->linear_tone_beep = 1;
Takashi Iwai36c9db72013-01-17 17:07:59 +01003840 spec->gen.own_eapd_ctl = 1;
3841
3842 codec->patch_ops = stac_patch_ops;
Takashi Iwaiba615b82013-03-13 14:47:21 +01003843 codec->power_filter = snd_hda_codec_eapd_power_filter;
Takashi Iwai36c9db72013-01-17 17:07:59 +01003844
3845 snd_hda_add_verbs(codec, stac9200_eapd_init);
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01003846
3847 snd_hda_pick_fixup(codec, stac9200_models, stac9200_fixup_tbl,
3848 stac9200_fixups);
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01003849 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai117f2572008-03-18 09:53:23 +01003850
Takashi Iwai36c9db72013-01-17 17:07:59 +01003851 err = stac_parse_auto_config(codec);
Mattc7d4b2f2005-06-27 14:59:41 +02003852 if (err < 0) {
Takashi Iwai36c9db72013-01-17 17:07:59 +01003853 stac_free(codec);
Mattc7d4b2f2005-06-27 14:59:41 +02003854 return err;
3855 }
Matt2f2f4252005-04-13 14:45:30 +02003856
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01003857 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
3858
Matt2f2f4252005-04-13 14:45:30 +02003859 return 0;
3860}
3861
Tobin Davis8e21c342007-01-08 11:04:17 +01003862static int patch_stac925x(struct hda_codec *codec)
3863{
3864 struct sigmatel_spec *spec;
3865 int err;
3866
Takashi Iwai36c9db72013-01-17 17:07:59 +01003867 err = alloc_stac_spec(codec);
Takashi Iwai361dab32012-05-09 14:35:27 +02003868 if (err < 0)
3869 return err;
Tobin Davis8e21c342007-01-08 11:04:17 +01003870
Takashi Iwai361dab32012-05-09 14:35:27 +02003871 spec = codec->spec;
Daniel J Blueman1b0e3722010-08-03 11:09:13 +01003872 spec->linear_tone_beep = 1;
Takashi Iwai36c9db72013-01-17 17:07:59 +01003873 spec->gen.own_eapd_ctl = 1;
3874
3875 codec->patch_ops = stac_patch_ops;
3876
3877 snd_hda_add_verbs(codec, stac925x_core_init);
Mauro Carvalho Chehab9cb36c22008-08-11 10:18:39 +02003878
Takashi Iwaid2077d42013-01-14 14:20:16 +01003879 snd_hda_pick_fixup(codec, stac925x_models, stac925x_fixup_tbl,
3880 stac925x_fixups);
Takashi Iwaid2077d42013-01-14 14:20:16 +01003881 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3882
Takashi Iwai36c9db72013-01-17 17:07:59 +01003883 err = stac_parse_auto_config(codec);
Tobin Davis8e21c342007-01-08 11:04:17 +01003884 if (err < 0) {
Takashi Iwai36c9db72013-01-17 17:07:59 +01003885 stac_free(codec);
Tobin Davis8e21c342007-01-08 11:04:17 +01003886 return err;
3887 }
3888
Takashi Iwaid2077d42013-01-14 14:20:16 +01003889 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
3890
Tobin Davis8e21c342007-01-08 11:04:17 +01003891 return 0;
3892}
3893
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01003894static int patch_stac92hd73xx(struct hda_codec *codec)
3895{
3896 struct sigmatel_spec *spec;
Takashi Iwai361dab32012-05-09 14:35:27 +02003897 int err;
Takashi Iwaic21ca4a2008-12-19 09:26:08 +01003898 int num_dacs;
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01003899
Takashi Iwai36c9db72013-01-17 17:07:59 +01003900 err = alloc_stac_spec(codec);
Takashi Iwai361dab32012-05-09 14:35:27 +02003901 if (err < 0)
3902 return err;
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01003903
Takashi Iwai361dab32012-05-09 14:35:27 +02003904 spec = codec->spec;
Daniel J Blueman1b0e3722010-08-03 11:09:13 +01003905 spec->linear_tone_beep = 0;
Takashi Iwai27487462013-01-21 16:25:18 +01003906 spec->gen.mixer_nid = 0x1d;
Takashi Iwai42875472013-01-22 09:34:48 +01003907 spec->have_spdif_mux = 1;
Takashi Iwai55e30142013-01-14 17:30:04 +01003908
Takashi Iwai36c9db72013-01-17 17:07:59 +01003909 num_dacs = snd_hda_get_num_conns(codec, 0x0a) - 1;
Takashi Iwaic21ca4a2008-12-19 09:26:08 +01003910 if (num_dacs < 3 || num_dacs > 5) {
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01003911 printk(KERN_WARNING "hda_codec: Could not determine "
3912 "number of channels defaulting to DAC count\n");
Takashi Iwai36c9db72013-01-17 17:07:59 +01003913 num_dacs = 5;
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01003914 }
Takashi Iwai55e30142013-01-14 17:30:04 +01003915
Takashi Iwaic21ca4a2008-12-19 09:26:08 +01003916 switch (num_dacs) {
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01003917 case 0x3: /* 6 Channel */
Takashi Iwai36c9db72013-01-17 17:07:59 +01003918 spec->aloopback_ctl = &stac92hd73xx_6ch_loopback;
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01003919 break;
3920 case 0x4: /* 8 Channel */
Takashi Iwai36c9db72013-01-17 17:07:59 +01003921 spec->aloopback_ctl = &stac92hd73xx_8ch_loopback;
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01003922 break;
3923 case 0x5: /* 10 Channel */
Takashi Iwai36c9db72013-01-17 17:07:59 +01003924 spec->aloopback_ctl = &stac92hd73xx_10ch_loopback;
Takashi Iwaid78d7a92009-03-02 14:26:25 +01003925 break;
Takashi Iwaic21ca4a2008-12-19 09:26:08 +01003926 }
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01003927
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01003928 spec->aloopback_mask = 0x01;
3929 spec->aloopback_shift = 8;
3930
Takashi Iwai7504b6c2013-03-18 11:25:51 +01003931 spec->gen.beep_nid = 0x1c; /* digital beep */
Takashi Iwai6479c632009-07-28 18:20:25 +02003932
Takashi Iwai55e30142013-01-14 17:30:04 +01003933 /* GPIO0 High = Enable EAPD */
3934 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
3935 spec->gpio_data = 0x01;
Matthew Ranostay6b3ab212008-11-03 08:12:43 -05003936
Takashi Iwai55e30142013-01-14 17:30:04 +01003937 spec->eapd_switch = 1;
Matthew Ranostaya7662642008-02-21 07:51:14 +01003938
Matthew Ranostaya64135a2008-01-10 16:55:06 +01003939 spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids);
3940 spec->pwr_nids = stac92hd73xx_pwr_nids;
3941
Takashi Iwai36c9db72013-01-17 17:07:59 +01003942 spec->gen.own_eapd_ctl = 1;
Takashi Iwaif4f678d2013-01-24 18:02:43 +01003943 spec->gen.power_down_unused = 1;
Takashi Iwai36c9db72013-01-17 17:07:59 +01003944
3945 codec->patch_ops = stac_patch_ops;
3946
3947 snd_hda_pick_fixup(codec, stac92hd73xx_models, stac92hd73xx_fixup_tbl,
3948 stac92hd73xx_fixups);
Takashi Iwai55e30142013-01-14 17:30:04 +01003949 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3950
3951 if (!spec->volknob_init)
3952 snd_hda_add_verbs(codec, stac92hd73xx_core_init);
3953
Takashi Iwai36c9db72013-01-17 17:07:59 +01003954 err = stac_parse_auto_config(codec);
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01003955 if (err < 0) {
Takashi Iwai36c9db72013-01-17 17:07:59 +01003956 stac_free(codec);
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01003957 return err;
3958 }
3959
David Henningsson303985f2013-03-14 15:28:29 +01003960 /* Don't GPIO-mute speakers if there are no internal speakers, because
3961 * the GPIO might be necessary for Headphone
3962 */
3963 if (spec->eapd_switch && !has_builtin_speaker(codec))
3964 spec->eapd_switch = 0;
3965
Takashi Iwai2d34e1b2008-11-28 14:35:16 +01003966 codec->proc_widget_hook = stac92hd7x_proc_hook;
3967
Takashi Iwai55e30142013-01-14 17:30:04 +01003968 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
3969
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01003970 return 0;
3971}
3972
Takashi Iwai372f8c72013-01-14 18:06:34 +01003973static void stac_setup_gpio(struct hda_codec *codec)
Matthew Ranostayd0513fc2008-07-27 10:30:30 +02003974{
Takashi Iwai372f8c72013-01-14 18:06:34 +01003975 struct sigmatel_spec *spec = codec->spec;
Vitaliy Kulikove108c7b2010-01-28 19:21:07 +01003976
Takashi Iwai9c563a52013-07-19 07:58:02 +02003977 spec->gpio_mask |= spec->eapd_mask;
Takashi Iwaib4e81872009-11-18 17:20:24 +01003978 if (spec->gpio_led) {
Takashi Iwaif1a73742011-12-04 13:44:06 +01003979 if (!spec->vref_mute_led_nid) {
Vitaliy Kulikov45eebda2011-07-26 16:56:20 -05003980 spec->gpio_mask |= spec->gpio_led;
3981 spec->gpio_dir |= spec->gpio_led;
3982 spec->gpio_data |= spec->gpio_led;
3983 } else {
3984 codec->patch_ops.set_power_state =
Takashi Iwai36c9db72013-01-17 17:07:59 +01003985 stac_set_power_state;
Vitaliy Kulikov45eebda2011-07-26 16:56:20 -05003986 }
Takashi Iwaib4e81872009-11-18 17:20:24 +01003987 }
Takashi Iwaib4e81872009-11-18 17:20:24 +01003988
Takashi Iwai62cbde12012-09-14 11:58:54 +02003989 if (spec->mic_mute_led_gpio) {
3990 spec->gpio_mask |= spec->mic_mute_led_gpio;
3991 spec->gpio_dir |= spec->mic_mute_led_gpio;
3992 spec->mic_mute_led_on = true;
3993 spec->gpio_data |= spec->mic_mute_led_gpio;
Takashi Iwai36c9db72013-01-17 17:07:59 +01003994
Takashi Iwaia90229e2013-01-18 14:10:00 +01003995 spec->gen.cap_sync_hook = stac_capture_led_hook;
Takashi Iwai62cbde12012-09-14 11:58:54 +02003996 }
Takashi Iwai372f8c72013-01-14 18:06:34 +01003997}
3998
3999static int patch_stac92hd83xxx(struct hda_codec *codec)
4000{
4001 struct sigmatel_spec *spec;
4002 int err;
4003
Takashi Iwai36c9db72013-01-17 17:07:59 +01004004 err = alloc_stac_spec(codec);
Takashi Iwai372f8c72013-01-14 18:06:34 +01004005 if (err < 0)
4006 return err;
4007
4008 codec->epss = 0; /* longer delay needed for D3 */
Takashi Iwai372f8c72013-01-14 18:06:34 +01004009
4010 spec = codec->spec;
4011 spec->linear_tone_beep = 0;
Takashi Iwai36c9db72013-01-17 17:07:59 +01004012 spec->gen.own_eapd_ctl = 1;
Takashi Iwaif4f678d2013-01-24 18:02:43 +01004013 spec->gen.power_down_unused = 1;
Takashi Iwai27487462013-01-21 16:25:18 +01004014 spec->gen.mixer_nid = 0x1b;
Takashi Iwai36c9db72013-01-17 17:07:59 +01004015
Takashi Iwai7504b6c2013-03-18 11:25:51 +01004016 spec->gen.beep_nid = 0x21; /* digital beep */
Takashi Iwai372f8c72013-01-14 18:06:34 +01004017 spec->pwr_nids = stac92hd83xxx_pwr_nids;
4018 spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids);
Takashi Iwai36c9db72013-01-17 17:07:59 +01004019 spec->default_polarity = -1; /* no default cfg */
4020
4021 codec->patch_ops = stac_patch_ops;
4022
4023 snd_hda_add_verbs(codec, stac92hd83xxx_core_init);
Takashi Iwai372f8c72013-01-14 18:06:34 +01004024
4025 snd_hda_pick_fixup(codec, stac92hd83xxx_models, stac92hd83xxx_fixup_tbl,
4026 stac92hd83xxx_fixups);
Takashi Iwai372f8c72013-01-14 18:06:34 +01004027 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
4028
4029 stac_setup_gpio(codec);
Takashi Iwai62cbde12012-09-14 11:58:54 +02004030
Takashi Iwai36c9db72013-01-17 17:07:59 +01004031 err = stac_parse_auto_config(codec);
Matthew Ranostayd0513fc2008-07-27 10:30:30 +02004032 if (err < 0) {
Takashi Iwai36c9db72013-01-17 17:07:59 +01004033 stac_free(codec);
Matthew Ranostayd0513fc2008-07-27 10:30:30 +02004034 return err;
4035 }
4036
Takashi Iwai2d34e1b2008-11-28 14:35:16 +01004037 codec->proc_widget_hook = stac92hd_proc_hook;
4038
Takashi Iwai372f8c72013-01-14 18:06:34 +01004039 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
4040
Matthew Ranostayd0513fc2008-07-27 10:30:30 +02004041 return 0;
4042}
4043
Vitaliy Kulikov4e637c62013-01-31 17:58:59 -06004044static const hda_nid_t stac92hd95_pwr_nids[] = {
4045 0x0a, 0x0b, 0x0c, 0x0d
4046};
4047
4048static int patch_stac92hd95(struct hda_codec *codec)
4049{
4050 struct sigmatel_spec *spec;
4051 int err;
4052
4053 err = alloc_stac_spec(codec);
4054 if (err < 0)
4055 return err;
4056
4057 codec->epss = 0; /* longer delay needed for D3 */
4058
4059 spec = codec->spec;
4060 spec->linear_tone_beep = 0;
4061 spec->gen.own_eapd_ctl = 1;
4062 spec->gen.power_down_unused = 1;
4063
Takashi Iwai7504b6c2013-03-18 11:25:51 +01004064 spec->gen.beep_nid = 0x19; /* digital beep */
Vitaliy Kulikov4e637c62013-01-31 17:58:59 -06004065 spec->pwr_nids = stac92hd95_pwr_nids;
4066 spec->num_pwrs = ARRAY_SIZE(stac92hd95_pwr_nids);
4067 spec->default_polarity = -1; /* no default cfg */
4068
4069 codec->patch_ops = stac_patch_ops;
4070
4071 err = stac_parse_auto_config(codec);
4072 if (err < 0) {
4073 stac_free(codec);
4074 return err;
4075 }
4076
4077 codec->proc_widget_hook = stac92hd_proc_hook;
4078
4079 return 0;
4080}
4081
Matthew Ranostaye035b842007-11-06 11:53:55 +01004082static int patch_stac92hd71bxx(struct hda_codec *codec)
4083{
4084 struct sigmatel_spec *spec;
Takashi Iwai2b635362011-05-02 12:33:43 +02004085 const struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init;
Takashi Iwai361dab32012-05-09 14:35:27 +02004086 int err;
Matthew Ranostaye035b842007-11-06 11:53:55 +01004087
Takashi Iwai36c9db72013-01-17 17:07:59 +01004088 err = alloc_stac_spec(codec);
Takashi Iwai361dab32012-05-09 14:35:27 +02004089 if (err < 0)
4090 return err;
Matthew Ranostaye035b842007-11-06 11:53:55 +01004091
Takashi Iwai361dab32012-05-09 14:35:27 +02004092 spec = codec->spec;
Daniel J Blueman1b0e3722010-08-03 11:09:13 +01004093 spec->linear_tone_beep = 0;
Takashi Iwai36c9db72013-01-17 17:07:59 +01004094 spec->gen.own_eapd_ctl = 1;
Takashi Iwaif4f678d2013-01-24 18:02:43 +01004095 spec->gen.power_down_unused = 1;
Takashi Iwai27487462013-01-21 16:25:18 +01004096 spec->gen.mixer_nid = 0x17;
Takashi Iwai42875472013-01-22 09:34:48 +01004097 spec->have_spdif_mux = 1;
Matthew Ranostaye035b842007-11-06 11:53:55 +01004098
Takashi Iwai36c9db72013-01-17 17:07:59 +01004099 codec->patch_ops = stac_patch_ops;
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01004100
4101 /* GPIO0 = EAPD */
4102 spec->gpio_mask = 0x01;
4103 spec->gpio_dir = 0x01;
4104 spec->gpio_data = 0x01;
Takashi Iwai41c3b642008-11-18 10:45:15 +01004105
Matthew Ranostay541eee82007-12-14 12:08:04 +01004106 switch (codec->vendor_id) {
4107 case 0x111d76b6: /* 4 Port without Analog Mixer */
4108 case 0x111d76b7:
Herton Ronaldo Krzesinski23c7b522009-02-08 19:51:28 -02004109 unmute_init++;
Matthew Ranostay541eee82007-12-14 12:08:04 +01004110 break;
Matthew Ranostayaafc4412008-06-13 18:04:33 +02004111 case 0x111d7608: /* 5 Port with Analog Mixer */
Matthew Ranostay8daaaa92008-08-15 07:45:52 +02004112 if ((codec->revision_id & 0xf) == 0 ||
Takashi Iwai8c2f7672008-12-01 11:54:35 +01004113 (codec->revision_id & 0xf) == 1)
Matthew Ranostay8daaaa92008-08-15 07:45:52 +02004114 spec->stream_delay = 40; /* 40 milliseconds */
Matthew Ranostay8daaaa92008-08-15 07:45:52 +02004115
Matthew Ranostayaafc4412008-06-13 18:04:33 +02004116 /* disable VSW */
Matthew Ranostayca8d33f2009-01-26 09:33:52 -05004117 unmute_init++;
Takashi Iwai330ee992009-02-20 14:33:36 +01004118 snd_hda_codec_set_pincfg(codec, 0x0f, 0x40f000f0);
4119 snd_hda_codec_set_pincfg(codec, 0x19, 0x40f000f3);
Matthew Ranostayaafc4412008-06-13 18:04:33 +02004120 break;
4121 case 0x111d7603: /* 6 Port with Analog Mixer */
Takashi Iwai8c2f7672008-12-01 11:54:35 +01004122 if ((codec->revision_id & 0xf) == 1)
Matthew Ranostay8daaaa92008-08-15 07:45:52 +02004123 spec->stream_delay = 40; /* 40 milliseconds */
Matthew Ranostay8daaaa92008-08-15 07:45:52 +02004124
Takashi Iwai5207e102009-07-30 13:09:08 +02004125 break;
Matthew Ranostay541eee82007-12-14 12:08:04 +01004126 }
4127
David Henningsson5e68fb32012-08-16 14:11:09 +02004128 if (get_wcaps_type(get_wcaps(codec, 0x28)) == AC_WID_VOL_KNB)
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01004129 snd_hda_add_verbs(codec, stac92hd71bxx_core_init);
David Henningsson5e68fb32012-08-16 14:11:09 +02004130
Matthew Ranostayca8d33f2009-01-26 09:33:52 -05004131 if (get_wcaps(codec, 0xa) & AC_WCAP_IN_AMP)
4132 snd_hda_sequence_write_cache(codec, unmute_init);
4133
Takashi Iwai36c9db72013-01-17 17:07:59 +01004134 spec->aloopback_ctl = &stac92hd71bxx_loopback;
Matthew Ranostay4b33c762008-10-10 09:07:23 -04004135 spec->aloopback_mask = 0x50;
Matthew Ranostay541eee82007-12-14 12:08:04 +01004136 spec->aloopback_shift = 0;
4137
Matthew Ranostay8daaaa92008-08-15 07:45:52 +02004138 spec->powerdown_adcs = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01004139 spec->gen.beep_nid = 0x26; /* digital beep */
Takashi Iwai36c9db72013-01-17 17:07:59 +01004140 spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids);
Matthew Ranostayaafc4412008-06-13 18:04:33 +02004141 spec->pwr_nids = stac92hd71bxx_pwr_nids;
Matthew Ranostaye035b842007-11-06 11:53:55 +01004142
Takashi Iwai36c9db72013-01-17 17:07:59 +01004143 snd_hda_pick_fixup(codec, stac92hd71bxx_models, stac92hd71bxx_fixup_tbl,
4144 stac92hd71bxx_fixups);
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01004145 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Vitaliy Kulikov5bdaaad2009-11-04 07:57:45 +01004146
Takashi Iwai372f8c72013-01-14 18:06:34 +01004147 stac_setup_gpio(codec);
Matthew Ranostay6a14f582008-09-12 12:02:30 -04004148
Takashi Iwai36c9db72013-01-17 17:07:59 +01004149 err = stac_parse_auto_config(codec);
Matthew Ranostaye035b842007-11-06 11:53:55 +01004150 if (err < 0) {
Takashi Iwai36c9db72013-01-17 17:07:59 +01004151 stac_free(codec);
Matthew Ranostaye035b842007-11-06 11:53:55 +01004152 return err;
4153 }
4154
Takashi Iwai2d34e1b2008-11-28 14:35:16 +01004155 codec->proc_widget_hook = stac92hd7x_proc_hook;
4156
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01004157 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
4158
Matthew Ranostaye035b842007-11-06 11:53:55 +01004159 return 0;
Takashi Iwai86d190e2009-05-26 15:18:58 +02004160}
Matthew Ranostaye035b842007-11-06 11:53:55 +01004161
Matt2f2f4252005-04-13 14:45:30 +02004162static int patch_stac922x(struct hda_codec *codec)
4163{
4164 struct sigmatel_spec *spec;
Mattc7d4b2f2005-06-27 14:59:41 +02004165 int err;
Matt2f2f4252005-04-13 14:45:30 +02004166
Takashi Iwai36c9db72013-01-17 17:07:59 +01004167 err = alloc_stac_spec(codec);
Takashi Iwai361dab32012-05-09 14:35:27 +02004168 if (err < 0)
4169 return err;
Matt2f2f4252005-04-13 14:45:30 +02004170
Takashi Iwai361dab32012-05-09 14:35:27 +02004171 spec = codec->spec;
Daniel J Blueman1b0e3722010-08-03 11:09:13 +01004172 spec->linear_tone_beep = 1;
Takashi Iwai36c9db72013-01-17 17:07:59 +01004173 spec->gen.own_eapd_ctl = 1;
Ivan N. Zlatev5d5d3bc2007-05-29 16:03:00 +02004174
Takashi Iwai36c9db72013-01-17 17:07:59 +01004175 codec->patch_ops = stac_patch_ops;
Matt2f2f4252005-04-13 14:45:30 +02004176
Takashi Iwai0a42784642013-01-14 15:20:13 +01004177 snd_hda_add_verbs(codec, stac922x_core_init);
4178
Takashi Iwai807a46362007-05-29 19:01:37 +02004179 /* Fix Mux capture level; max to 2 */
4180 snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
4181 (0 << AC_AMPCAP_OFFSET_SHIFT) |
4182 (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
4183 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
4184 (0 << AC_AMPCAP_MUTE_SHIFT));
4185
Takashi Iwai36c9db72013-01-17 17:07:59 +01004186 snd_hda_pick_fixup(codec, stac922x_models, stac922x_fixup_tbl,
4187 stac922x_fixups);
4188 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
4189
4190 err = stac_parse_auto_config(codec);
4191 if (err < 0) {
4192 stac_free(codec);
4193 return err;
4194 }
4195
Takashi Iwai0a42784642013-01-14 15:20:13 +01004196 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
4197
Matt Porter3cc08dc2006-01-23 15:27:49 +01004198 return 0;
4199}
4200
Takashi Iwai42875472013-01-22 09:34:48 +01004201static const char * const stac927x_spdif_labels[] = {
4202 "Digital Playback", "ADAT", "Analog Mux 1",
4203 "Analog Mux 2", "Analog Mux 3", NULL
4204};
4205
Matt Porter3cc08dc2006-01-23 15:27:49 +01004206static int patch_stac927x(struct hda_codec *codec)
4207{
4208 struct sigmatel_spec *spec;
4209 int err;
4210
Takashi Iwai36c9db72013-01-17 17:07:59 +01004211 err = alloc_stac_spec(codec);
Takashi Iwai361dab32012-05-09 14:35:27 +02004212 if (err < 0)
4213 return err;
Matt Porter3cc08dc2006-01-23 15:27:49 +01004214
Takashi Iwai361dab32012-05-09 14:35:27 +02004215 spec = codec->spec;
Daniel J Blueman1b0e3722010-08-03 11:09:13 +01004216 spec->linear_tone_beep = 1;
Takashi Iwai36c9db72013-01-17 17:07:59 +01004217 spec->gen.own_eapd_ctl = 1;
Takashi Iwai42875472013-01-22 09:34:48 +01004218 spec->have_spdif_mux = 1;
4219 spec->spdif_labels = stac927x_spdif_labels;
Matt Porter3cc08dc2006-01-23 15:27:49 +01004220
Takashi Iwai7504b6c2013-03-18 11:25:51 +01004221 spec->gen.beep_nid = 0x23; /* digital beep */
Matthew Ranostay8e9068b2007-12-17 11:58:13 +01004222
Takashi Iwai29ac8362013-01-14 16:03:38 +01004223 /* GPIO0 High = Enable EAPD */
4224 spec->eapd_mask = spec->gpio_mask = 0x01;
4225 spec->gpio_dir = spec->gpio_data = 0x01;
Takashi Iwaiaf6ee302009-09-14 15:03:12 +02004226
Takashi Iwai36c9db72013-01-17 17:07:59 +01004227 spec->aloopback_ctl = &stac927x_loopback;
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01004228 spec->aloopback_mask = 0x40;
4229 spec->aloopback_shift = 0;
Matthew Ranostayc0cea0d2008-11-16 11:42:34 -05004230 spec->eapd_switch = 1;
Matthew Ranostay8e9068b2007-12-17 11:58:13 +01004231
Takashi Iwai36c9db72013-01-17 17:07:59 +01004232 codec->patch_ops = stac_patch_ops;
4233
4234 snd_hda_pick_fixup(codec, stac927x_models, stac927x_fixup_tbl,
4235 stac927x_fixups);
Takashi Iwaif6655d52013-01-17 08:49:01 +01004236 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
4237
Takashi Iwai29ac8362013-01-14 16:03:38 +01004238 if (!spec->volknob_init)
4239 snd_hda_add_verbs(codec, stac927x_core_init);
4240
Takashi Iwai36c9db72013-01-17 17:07:59 +01004241 err = stac_parse_auto_config(codec);
Mattc7d4b2f2005-06-27 14:59:41 +02004242 if (err < 0) {
Takashi Iwai36c9db72013-01-17 17:07:59 +01004243 stac_free(codec);
Mattc7d4b2f2005-06-27 14:59:41 +02004244 return err;
4245 }
Matt2f2f4252005-04-13 14:45:30 +02004246
Takashi Iwai2d34e1b2008-11-28 14:35:16 +01004247 codec->proc_widget_hook = stac927x_proc_hook;
4248
Takashi Iwai52987652008-01-16 16:09:47 +01004249 /*
4250 * !!FIXME!!
4251 * The STAC927x seem to require fairly long delays for certain
4252 * command sequences. With too short delays (even if the answer
4253 * is set to RIRB properly), it results in the silence output
4254 * on some hardwares like Dell.
4255 *
4256 * The below flag enables the longer delay (see get_response
4257 * in hda_intel.c).
4258 */
4259 codec->bus->needs_damn_long_delay = 1;
4260
Takashi Iwai29ac8362013-01-14 16:03:38 +01004261 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwaie28d8322008-12-17 13:48:29 +01004262
Matt2f2f4252005-04-13 14:45:30 +02004263 return 0;
4264}
4265
Matt Porterf3302a52006-07-31 12:49:34 +02004266static int patch_stac9205(struct hda_codec *codec)
4267{
4268 struct sigmatel_spec *spec;
Takashi Iwai82599802007-07-31 15:56:24 +02004269 int err;
Matt Porterf3302a52006-07-31 12:49:34 +02004270
Takashi Iwai36c9db72013-01-17 17:07:59 +01004271 err = alloc_stac_spec(codec);
Takashi Iwai361dab32012-05-09 14:35:27 +02004272 if (err < 0)
4273 return err;
Matt Porterf3302a52006-07-31 12:49:34 +02004274
Takashi Iwai361dab32012-05-09 14:35:27 +02004275 spec = codec->spec;
Daniel J Blueman1b0e3722010-08-03 11:09:13 +01004276 spec->linear_tone_beep = 1;
Takashi Iwai36c9db72013-01-17 17:07:59 +01004277 spec->gen.own_eapd_ctl = 1;
Takashi Iwai42875472013-01-22 09:34:48 +01004278 spec->have_spdif_mux = 1;
Matt Porterf3302a52006-07-31 12:49:34 +02004279
Takashi Iwai7504b6c2013-03-18 11:25:51 +01004280 spec->gen.beep_nid = 0x23; /* digital beep */
Matt Porterf3302a52006-07-31 12:49:34 +02004281
Takashi Iwaife6322c2013-01-14 14:46:51 +01004282 snd_hda_add_verbs(codec, stac9205_core_init);
Takashi Iwai36c9db72013-01-17 17:07:59 +01004283 spec->aloopback_ctl = &stac9205_loopback;
Takashi Iwai6479c632009-07-28 18:20:25 +02004284
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01004285 spec->aloopback_mask = 0x40;
4286 spec->aloopback_shift = 0;
Matthew Ranostay87d48362007-07-17 11:52:24 +02004287
Takashi Iwaife6322c2013-01-14 14:46:51 +01004288 /* GPIO0 High = EAPD */
4289 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
4290 spec->gpio_data = 0x01;
Matt Porter33382402006-12-18 13:17:28 +01004291
Takashi Iwaife6322c2013-01-14 14:46:51 +01004292 /* Turn on/off EAPD per HP plugging */
4293 spec->eapd_switch = 1;
Matthew Ranostay4fe51952008-01-29 15:28:44 +01004294
Takashi Iwai36c9db72013-01-17 17:07:59 +01004295 codec->patch_ops = stac_patch_ops;
4296
4297 snd_hda_pick_fixup(codec, stac9205_models, stac9205_fixup_tbl,
4298 stac9205_fixups);
Takashi Iwaife6322c2013-01-14 14:46:51 +01004299 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Matthew Ranostay87d48362007-07-17 11:52:24 +02004300
Takashi Iwai36c9db72013-01-17 17:07:59 +01004301 err = stac_parse_auto_config(codec);
Matt Porterf3302a52006-07-31 12:49:34 +02004302 if (err < 0) {
Takashi Iwai36c9db72013-01-17 17:07:59 +01004303 stac_free(codec);
Matt Porterf3302a52006-07-31 12:49:34 +02004304 return err;
4305 }
4306
Takashi Iwai2d34e1b2008-11-28 14:35:16 +01004307 codec->proc_widget_hook = stac9205_proc_hook;
4308
Takashi Iwaife6322c2013-01-14 14:46:51 +01004309 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
4310
Matt Porterf3302a52006-07-31 12:49:34 +02004311 return 0;
4312}
4313
Matt2f2f4252005-04-13 14:45:30 +02004314/*
Guillaume Munch6d859062006-08-22 17:15:47 +02004315 * STAC9872 hack
Takashi Iwaidb064e52006-03-16 16:04:58 +01004316 */
4317
Takashi Iwai2b635362011-05-02 12:33:43 +02004318static const struct hda_verb stac9872_core_init[] = {
Takashi Iwai1624cb92007-07-05 13:10:51 +02004319 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
Takashi Iwaidb064e52006-03-16 16:04:58 +01004320 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
4321 {}
4322};
4323
Takashi Iwaifc268c12013-01-14 14:29:36 +01004324static const struct hda_pintbl stac9872_vaio_pin_configs[] = {
4325 { 0x0a, 0x03211020 },
4326 { 0x0b, 0x411111f0 },
4327 { 0x0c, 0x411111f0 },
4328 { 0x0d, 0x03a15030 },
4329 { 0x0e, 0x411111f0 },
4330 { 0x0f, 0x90170110 },
4331 { 0x11, 0x411111f0 },
4332 { 0x13, 0x411111f0 },
4333 { 0x14, 0x90a7013e },
4334 {}
Takashi Iwai307282c2009-03-12 18:17:58 +01004335};
4336
Takashi Iwaifc268c12013-01-14 14:29:36 +01004337static const struct hda_model_fixup stac9872_models[] = {
4338 { .id = STAC_9872_VAIO, .name = "vaio" },
4339 {}
Takashi Iwai307282c2009-03-12 18:17:58 +01004340};
4341
Takashi Iwaifc268c12013-01-14 14:29:36 +01004342static const struct hda_fixup stac9872_fixups[] = {
4343 [STAC_9872_VAIO] = {
4344 .type = HDA_FIXUP_PINS,
4345 .v.pins = stac9872_vaio_pin_configs,
4346 },
Takashi Iwai307282c2009-03-12 18:17:58 +01004347};
4348
Takashi Iwaifc268c12013-01-14 14:29:36 +01004349static const struct snd_pci_quirk stac9872_fixup_tbl[] = {
Takashi Iwaib04add92009-07-20 08:01:36 +02004350 SND_PCI_QUIRK_MASK(0x104d, 0xfff0, 0x81e0,
4351 "Sony VAIO F/S", STAC_9872_VAIO),
Takashi Iwai307282c2009-03-12 18:17:58 +01004352 {} /* terminator */
4353};
4354
Guillaume Munch6d859062006-08-22 17:15:47 +02004355static int patch_stac9872(struct hda_codec *codec)
Takashi Iwaidb064e52006-03-16 16:04:58 +01004356{
4357 struct sigmatel_spec *spec;
Takashi Iwai1e137f92009-01-21 07:41:22 +01004358 int err;
Takashi Iwaidb064e52006-03-16 16:04:58 +01004359
Takashi Iwai36c9db72013-01-17 17:07:59 +01004360 err = alloc_stac_spec(codec);
Takashi Iwai361dab32012-05-09 14:35:27 +02004361 if (err < 0)
4362 return err;
4363
4364 spec = codec->spec;
Daniel J Blueman1b0e3722010-08-03 11:09:13 +01004365 spec->linear_tone_beep = 1;
Takashi Iwai36c9db72013-01-17 17:07:59 +01004366 spec->gen.own_eapd_ctl = 1;
4367
4368 codec->patch_ops = stac_patch_ops;
4369
4370 snd_hda_add_verbs(codec, stac9872_core_init);
Takashi Iwaicaa10b62009-01-20 17:19:01 +01004371
Takashi Iwaifc268c12013-01-14 14:29:36 +01004372 snd_hda_pick_fixup(codec, stac9872_models, stac9872_fixup_tbl,
4373 stac9872_fixups);
Takashi Iwaifc268c12013-01-14 14:29:36 +01004374 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwaicaa10b62009-01-20 17:19:01 +01004375
Takashi Iwai36c9db72013-01-17 17:07:59 +01004376 err = stac_parse_auto_config(codec);
Takashi Iwai1e137f92009-01-21 07:41:22 +01004377 if (err < 0) {
Takashi Iwai36c9db72013-01-17 17:07:59 +01004378 stac_free(codec);
Takashi Iwai1e137f92009-01-21 07:41:22 +01004379 return -EINVAL;
Takashi Iwaicaa10b62009-01-20 17:19:01 +01004380 }
Takashi Iwaifc268c12013-01-14 14:29:36 +01004381
4382 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
4383
Takashi Iwaidb064e52006-03-16 16:04:58 +01004384 return 0;
4385}
4386
4387
4388/*
Matt2f2f4252005-04-13 14:45:30 +02004389 * patch entries
4390 */
Takashi Iwai2b635362011-05-02 12:33:43 +02004391static const struct hda_codec_preset snd_hda_preset_sigmatel[] = {
Matt2f2f4252005-04-13 14:45:30 +02004392 { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 },
4393 { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x },
4394 { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x },
4395 { .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x },
4396 { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x },
4397 { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x },
4398 { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x },
Matt Porter22a27c72006-07-06 18:49:10 +02004399 { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x },
4400 { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x },
4401 { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x },
4402 { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x },
4403 { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x },
4404 { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x },
Matt Porter3cc08dc2006-01-23 15:27:49 +01004405 { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x },
4406 { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x },
4407 { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x },
4408 { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x },
4409 { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x },
4410 { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x },
4411 { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x },
4412 { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x },
4413 { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x },
4414 { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x },
Tobin Davis8e21c342007-01-08 11:04:17 +01004415 { .id = 0x83847632, .name = "STAC9202", .patch = patch_stac925x },
4416 { .id = 0x83847633, .name = "STAC9202D", .patch = patch_stac925x },
4417 { .id = 0x83847634, .name = "STAC9250", .patch = patch_stac925x },
4418 { .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x },
4419 { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x },
4420 { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x },
Takashi Iwai7bd3c0f2008-05-02 12:28:02 +02004421 { .id = 0x83847645, .name = "92HD206X", .patch = patch_stac927x },
4422 { .id = 0x83847646, .name = "92HD206D", .patch = patch_stac927x },
Guillaume Munch6d859062006-08-22 17:15:47 +02004423 /* The following does not take into account .id=0x83847661 when subsys =
4424 * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are
4425 * currently not fully supported.
4426 */
4427 { .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 },
4428 { .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 },
4429 { .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 },
Simos Xenitellisa5c0f882009-06-10 16:33:31 +01004430 { .id = 0x83847698, .name = "STAC9205", .patch = patch_stac9205 },
Matt Porterf3302a52006-07-31 12:49:34 +02004431 { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 },
4432 { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 },
4433 { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 },
4434 { .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 },
4435 { .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 },
4436 { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 },
4437 { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 },
4438 { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 },
Matthew Ranostayaafc4412008-06-13 18:04:33 +02004439 { .id = 0x111d7603, .name = "92HD75B3X5", .patch = patch_stac92hd71bxx},
Matthew Ranostayd0513fc2008-07-27 10:30:30 +02004440 { .id = 0x111d7604, .name = "92HD83C1X5", .patch = patch_stac92hd83xxx},
Vitaliy Kulikova9694fa2010-02-04 08:58:23 +01004441 { .id = 0x111d76d4, .name = "92HD83C1C5", .patch = patch_stac92hd83xxx},
Matthew Ranostayd0513fc2008-07-27 10:30:30 +02004442 { .id = 0x111d7605, .name = "92HD81B1X5", .patch = patch_stac92hd83xxx},
Matthew Ranostayff2e7332009-04-01 14:49:48 -04004443 { .id = 0x111d76d5, .name = "92HD81B1C5", .patch = patch_stac92hd83xxx},
Charles Chin8a345a02010-08-10 11:43:25 +02004444 { .id = 0x111d76d1, .name = "92HD87B1/3", .patch = patch_stac92hd83xxx},
4445 { .id = 0x111d76d9, .name = "92HD87B2/4", .patch = patch_stac92hd83xxx},
Charles Chin36706002010-01-29 12:05:51 +01004446 { .id = 0x111d7666, .name = "92HD88B3", .patch = patch_stac92hd83xxx},
4447 { .id = 0x111d7667, .name = "92HD88B1", .patch = patch_stac92hd83xxx},
4448 { .id = 0x111d7668, .name = "92HD88B2", .patch = patch_stac92hd83xxx},
4449 { .id = 0x111d7669, .name = "92HD88B4", .patch = patch_stac92hd83xxx},
Matthew Ranostayaafc4412008-06-13 18:04:33 +02004450 { .id = 0x111d7608, .name = "92HD75B2X5", .patch = patch_stac92hd71bxx},
Matthew Ranostay541eee82007-12-14 12:08:04 +01004451 { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx },
4452 { .id = 0x111d7675, .name = "92HD73C1X5", .patch = patch_stac92hd73xx },
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01004453 { .id = 0x111d7676, .name = "92HD73E1X5", .patch = patch_stac92hd73xx },
Vitaliy Kulikov4e637c62013-01-31 17:58:59 -06004454 { .id = 0x111d7695, .name = "92HD95", .patch = patch_stac92hd95 },
Matthew Ranostay541eee82007-12-14 12:08:04 +01004455 { .id = 0x111d76b0, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
4456 { .id = 0x111d76b1, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
4457 { .id = 0x111d76b2, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
4458 { .id = 0x111d76b3, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
4459 { .id = 0x111d76b4, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
4460 { .id = 0x111d76b5, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
4461 { .id = 0x111d76b6, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
4462 { .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
Charles Chin4d8ec5f2010-08-19 08:06:16 +02004463 { .id = 0x111d76c0, .name = "92HD89C3", .patch = patch_stac92hd73xx },
4464 { .id = 0x111d76c1, .name = "92HD89C2", .patch = patch_stac92hd73xx },
4465 { .id = 0x111d76c2, .name = "92HD89C1", .patch = patch_stac92hd73xx },
4466 { .id = 0x111d76c3, .name = "92HD89B3", .patch = patch_stac92hd73xx },
4467 { .id = 0x111d76c4, .name = "92HD89B2", .patch = patch_stac92hd73xx },
4468 { .id = 0x111d76c5, .name = "92HD89B1", .patch = patch_stac92hd73xx },
4469 { .id = 0x111d76c6, .name = "92HD89E3", .patch = patch_stac92hd73xx },
4470 { .id = 0x111d76c7, .name = "92HD89E2", .patch = patch_stac92hd73xx },
4471 { .id = 0x111d76c8, .name = "92HD89E1", .patch = patch_stac92hd73xx },
4472 { .id = 0x111d76c9, .name = "92HD89D3", .patch = patch_stac92hd73xx },
4473 { .id = 0x111d76ca, .name = "92HD89D2", .patch = patch_stac92hd73xx },
4474 { .id = 0x111d76cb, .name = "92HD89D1", .patch = patch_stac92hd73xx },
4475 { .id = 0x111d76cc, .name = "92HD89F3", .patch = patch_stac92hd73xx },
4476 { .id = 0x111d76cd, .name = "92HD89F2", .patch = patch_stac92hd73xx },
4477 { .id = 0x111d76ce, .name = "92HD89F1", .patch = patch_stac92hd73xx },
David Henningsson46724c22011-09-20 09:02:22 +02004478 { .id = 0x111d76df, .name = "92HD93BXX", .patch = patch_stac92hd83xxx},
Vitaliy Kulikovab5a6eb2010-09-08 09:00:17 +02004479 { .id = 0x111d76e0, .name = "92HD91BXX", .patch = patch_stac92hd83xxx},
Vitaliy Kulikov4dfb8a42011-02-22 17:32:19 -06004480 { .id = 0x111d76e3, .name = "92HD98BXX", .patch = patch_stac92hd83xxx},
4481 { .id = 0x111d76e5, .name = "92HD99BXX", .patch = patch_stac92hd83xxx},
Vitaliy Kulikovab5a6eb2010-09-08 09:00:17 +02004482 { .id = 0x111d76e7, .name = "92HD90BXX", .patch = patch_stac92hd83xxx},
Charles Chinad5d8752011-11-02 07:56:58 +01004483 { .id = 0x111d76e8, .name = "92HD66B1X5", .patch = patch_stac92hd83xxx},
4484 { .id = 0x111d76e9, .name = "92HD66B2X5", .patch = patch_stac92hd83xxx},
4485 { .id = 0x111d76ea, .name = "92HD66B3X5", .patch = patch_stac92hd83xxx},
4486 { .id = 0x111d76eb, .name = "92HD66C1X5", .patch = patch_stac92hd83xxx},
4487 { .id = 0x111d76ec, .name = "92HD66C2X5", .patch = patch_stac92hd83xxx},
4488 { .id = 0x111d76ed, .name = "92HD66C3X5", .patch = patch_stac92hd83xxx},
4489 { .id = 0x111d76ee, .name = "92HD66B1X3", .patch = patch_stac92hd83xxx},
4490 { .id = 0x111d76ef, .name = "92HD66B2X3", .patch = patch_stac92hd83xxx},
4491 { .id = 0x111d76f0, .name = "92HD66B3X3", .patch = patch_stac92hd83xxx},
4492 { .id = 0x111d76f1, .name = "92HD66C1X3", .patch = patch_stac92hd83xxx},
4493 { .id = 0x111d76f2, .name = "92HD66C2X3", .patch = patch_stac92hd83xxx},
4494 { .id = 0x111d76f3, .name = "92HD66C3/65", .patch = patch_stac92hd83xxx},
Matt2f2f4252005-04-13 14:45:30 +02004495 {} /* terminator */
4496};
Takashi Iwai1289e9e2008-11-27 15:47:11 +01004497
4498MODULE_ALIAS("snd-hda-codec-id:8384*");
4499MODULE_ALIAS("snd-hda-codec-id:111d*");
4500
4501MODULE_LICENSE("GPL");
4502MODULE_DESCRIPTION("IDT/Sigmatel HD-audio codec");
4503
4504static struct hda_codec_preset_list sigmatel_list = {
4505 .preset = snd_hda_preset_sigmatel,
4506 .owner = THIS_MODULE,
4507};
4508
4509static int __init patch_sigmatel_init(void)
4510{
4511 return snd_hda_add_codec_preset(&sigmatel_list);
4512}
4513
4514static void __exit patch_sigmatel_exit(void)
4515{
4516 snd_hda_delete_codec_preset(&sigmatel_list);
4517}
4518
4519module_init(patch_sigmatel_init)
4520module_exit(patch_sigmatel_exit)