blob: 6998cf29b9bc34016e2d2ee1574b6b3d02ce8ef2 [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,
Matthew Ranostaye1f0d662007-12-13 17:47:21 +010086 STAC_92HD73XX_MODELS
87};
88
89enum {
Matthew Ranostayd0513fc2008-07-27 10:30:30 +020090 STAC_92HD83XXX_REF,
Matthew Ranostay32ed3f42009-01-22 20:53:29 -050091 STAC_92HD83XXX_PWR_REF,
Matthew Ranostay8bb0ac52009-02-12 16:50:01 -050092 STAC_DELL_S14,
Julian Wollrathf7f9bdf2011-11-09 10:02:40 +010093 STAC_DELL_VOSTRO_3500,
Vitaliy Kulikov0c27c182011-07-22 17:50:37 -050094 STAC_92HD83XXX_HP_cNB11_INTQUAD,
Steven Eastland48315592010-08-06 15:07:35 -060095 STAC_HP_DV7_4000,
Vitaliy Kulikov5556e142012-02-27 16:47:37 -060096 STAC_HP_ZEPHYR,
Takashi Iwaia3e19972012-07-26 08:17:20 +020097 STAC_92HD83XXX_HP_LED,
Takashi Iwaiff8a1e22012-07-31 10:16:59 +020098 STAC_92HD83XXX_HP_INV_LED,
Takashi Iwai62cbde12012-09-14 11:58:54 +020099 STAC_92HD83XXX_HP_MIC_LED,
David Henningsson8d032a82012-10-09 12:48:40 +0200100 STAC_92HD83XXX_HEADSET_JACK,
Takashi Iwai372f8c72013-01-14 18:06:34 +0100101 STAC_92HD83XXX_HP,
Takashi Iwai49920422013-01-18 14:28:07 +0100102 STAC_HP_ENVY_BASS,
Vitaliy Kulikovd009f3d2013-11-14 11:52:16 -0600103 STAC_HP_BNB13_EQ,
Matthew Ranostayd0513fc2008-07-27 10:30:30 +0200104 STAC_92HD83XXX_MODELS
105};
106
107enum {
Matthew Ranostaye035b842007-11-06 11:53:55 +0100108 STAC_92HD71BXX_REF,
Matthew Ranostaya7662642008-02-21 07:51:14 +0100109 STAC_DELL_M4_1,
110 STAC_DELL_M4_2,
Matthew Ranostay3a7abfd2008-11-20 21:21:43 -0500111 STAC_DELL_M4_3,
Matthew Ranostay6a14f582008-09-12 12:02:30 -0400112 STAC_HP_M4,
Takashi Iwai2a6ce6e2010-05-12 10:16:20 +0200113 STAC_HP_DV4,
Takashi Iwai1b0652e2009-01-14 08:27:35 +0100114 STAC_HP_DV5,
Christoph Plattnerae6241f2009-03-08 23:19:05 +0100115 STAC_HP_HDX,
Takashi Iwai0f6fcb72013-01-14 17:05:25 +0100116 STAC_92HD71BXX_HP,
117 STAC_92HD71BXX_NO_DMIC,
118 STAC_92HD71BXX_NO_SMUX,
Matthew Ranostaye035b842007-11-06 11:53:55 +0100119 STAC_92HD71BXX_MODELS
120};
121
122enum {
Tobin Davis8e21c342007-01-08 11:04:17 +0100123 STAC_925x_REF,
Mauro Carvalho Chehab9cb36c22008-08-11 10:18:39 +0200124 STAC_M1,
125 STAC_M1_2,
126 STAC_M2,
Tobin Davis8e21c342007-01-08 11:04:17 +0100127 STAC_M2_2,
Mauro Carvalho Chehab9cb36c22008-08-11 10:18:39 +0200128 STAC_M3,
129 STAC_M5,
130 STAC_M6,
Tobin Davis8e21c342007-01-08 11:04:17 +0100131 STAC_925x_MODELS
132};
133
134enum {
Takashi Iwaif5fcc132006-11-24 17:07:44 +0100135 STAC_D945_REF,
136 STAC_D945GTP3,
137 STAC_D945GTP5,
Ivan N. Zlatev5d5d3bc2007-05-29 16:03:00 +0200138 STAC_INTEL_MAC_V1,
139 STAC_INTEL_MAC_V2,
140 STAC_INTEL_MAC_V3,
141 STAC_INTEL_MAC_V4,
142 STAC_INTEL_MAC_V5,
Takashi Iwai0a427842013-01-14 15:20:13 +0100143 STAC_INTEL_MAC_AUTO,
Mauro Carvalho Chehab8c650082008-08-04 10:39:59 -0300144 STAC_ECS_202,
Takashi Iwaidfe495d2007-08-23 19:04:28 +0200145 STAC_922X_DELL_D81,
146 STAC_922X_DELL_D82,
147 STAC_922X_DELL_M81,
148 STAC_922X_DELL_M82,
Takashi Iwai0a427842013-01-14 15:20:13 +0100149 STAC_922X_INTEL_MAC_GPIO,
Takashi Iwaif5fcc132006-11-24 17:07:44 +0100150 STAC_922X_MODELS
151};
152
153enum {
Takashi Iwaie28d8322008-12-17 13:48:29 +0100154 STAC_D965_REF_NO_JD, /* no jack-detection */
Takashi Iwaif5fcc132006-11-24 17:07:44 +0100155 STAC_D965_REF,
156 STAC_D965_3ST,
157 STAC_D965_5ST,
Takashi Iwai679d92e2009-05-24 19:00:08 +0200158 STAC_D965_5ST_NO_FP,
Takashi Iwai29ac8362013-01-14 16:03:38 +0100159 STAC_D965_VERBS,
Tobin Davis4ff076e2007-08-07 11:48:12 +0200160 STAC_DELL_3ST,
Matthew Ranostay8e9068b2007-12-17 11:58:13 +0100161 STAC_DELL_BIOS,
Takashi Iwaieefb8be2013-07-29 16:26:15 +0200162 STAC_DELL_BIOS_AMIC,
Takashi Iwai29ac8362013-01-14 16:03:38 +0100163 STAC_DELL_BIOS_SPDIF,
164 STAC_927X_DELL_DMIC,
Takashi Iwai54930532009-10-11 17:38:29 +0200165 STAC_927X_VOLKNOB,
Takashi Iwaif5fcc132006-11-24 17:07:44 +0100166 STAC_927X_MODELS
167};
Matt Porter403d1942005-11-29 15:00:51 +0100168
Takashi Iwai307282c2009-03-12 18:17:58 +0100169enum {
Takashi Iwai307282c2009-03-12 18:17:58 +0100170 STAC_9872_VAIO,
171 STAC_9872_MODELS
172};
173
Matt2f2f4252005-04-13 14:45:30 +0200174struct sigmatel_spec {
Takashi Iwai36c9db72013-01-17 17:07:59 +0100175 struct hda_gen_spec gen;
Mattc7d4b2f2005-06-27 14:59:41 +0200176
Matthew Ranostayc0cea0d2008-11-16 11:42:34 -0500177 unsigned int eapd_switch: 1;
Daniel J Blueman1b0e3722010-08-03 11:09:13 +0100178 unsigned int linear_tone_beep:1;
David Henningsson8d032a82012-10-09 12:48:40 +0200179 unsigned int headset_jack:1; /* 4-pin headset jack (hp + mono mic) */
Takashi Iwai29ac8362013-01-14 16:03:38 +0100180 unsigned int volknob_init:1; /* special volume-knob initialization */
Takashi Iwai36c9db72013-01-17 17:07:59 +0100181 unsigned int powerdown_adcs:1;
Takashi Iwai42875472013-01-22 09:34:48 +0100182 unsigned int have_spdif_mux:1;
Mattc7d4b2f2005-06-27 14:59:41 +0200183
Matthew Ranostay4fe51952008-01-29 15:28:44 +0100184 /* gpio lines */
Matthew Ranostay0fc9dec2008-04-14 13:32:54 +0200185 unsigned int eapd_mask;
Matthew Ranostay4fe51952008-01-29 15:28:44 +0100186 unsigned int gpio_mask;
187 unsigned int gpio_dir;
188 unsigned int gpio_data;
189 unsigned int gpio_mute;
Takashi Iwai86d190e2009-05-26 15:18:58 +0200190 unsigned int gpio_led;
Vitaliy Kulikovc357aab2009-12-11 07:51:54 +0100191 unsigned int gpio_led_polarity;
Takashi Iwaif1a73742011-12-04 13:44:06 +0100192 unsigned int vref_mute_led_nid; /* pin NID for mute-LED vref control */
Vitaliy Kulikov45eebda2011-07-26 16:56:20 -0500193 unsigned int vref_led;
Takashi Iwai372f8c72013-01-14 18:06:34 +0100194 int default_polarity;
Matthew Ranostay4fe51952008-01-29 15:28:44 +0100195
Takashi Iwai62cbde12012-09-14 11:58:54 +0200196 unsigned int mic_mute_led_gpio; /* capture mute LED GPIO */
197 bool mic_mute_led_on; /* current mic mute state */
198
Matthew Ranostay8daaaa92008-08-15 07:45:52 +0200199 /* stream */
200 unsigned int stream_delay;
201
Matthew Ranostay4fe51952008-01-29 15:28:44 +0100202 /* analog loopback */
Takashi Iwai2b635362011-05-02 12:33:43 +0200203 const struct snd_kcontrol_new *aloopback_ctl;
Takashi Iwai36c9db72013-01-17 17:07:59 +0100204 unsigned int aloopback;
Matthew Ranostaye1f0d662007-12-13 17:47:21 +0100205 unsigned char aloopback_mask;
206 unsigned char aloopback_shift;
Takashi Iwai82599802007-07-31 15:56:24 +0200207
Matthew Ranostaya64135a2008-01-10 16:55:06 +0100208 /* power management */
Takashi Iwaic8822462012-05-15 09:11:36 +0200209 unsigned int power_map_bits;
Matthew Ranostaya64135a2008-01-10 16:55:06 +0100210 unsigned int num_pwrs;
Takashi Iwai2b635362011-05-02 12:33:43 +0200211 const hda_nid_t *pwr_nids;
Takashi Iwai36c9db72013-01-17 17:07:59 +0100212 unsigned int active_adcs;
Matthew Ranostaya64135a2008-01-10 16:55:06 +0100213
Takashi Iwai36c9db72013-01-17 17:07:59 +0100214 /* beep widgets */
Matthew Ranostay1cd22242008-07-18 18:20:52 +0200215 hda_nid_t anabeep_nid;
Takashi Iwai42875472013-01-22 09:34:48 +0100216
217 /* SPDIF-out mux */
218 const char * const *spdif_labels;
219 struct hda_input_mux spdif_mux;
220 unsigned int cur_smux[2];
Matt2f2f4252005-04-13 14:45:30 +0200221};
222
Takashi Iwaic8822462012-05-15 09:11:36 +0200223#define AC_VERB_IDT_SET_POWER_MAP 0x7ec
224#define AC_VERB_IDT_GET_POWER_MAP 0xfec
225
Takashi Iwai2b635362011-05-02 12:33:43 +0200226static const hda_nid_t stac92hd73xx_pwr_nids[8] = {
Matthew Ranostaya64135a2008-01-10 16:55:06 +0100227 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
228 0x0f, 0x10, 0x11
229};
230
Charles Chinafef2cf2011-11-11 08:05:28 +0100231static const hda_nid_t stac92hd83xxx_pwr_nids[7] = {
232 0x0a, 0x0b, 0x0c, 0xd, 0x0e,
233 0x0f, 0x10
Matthew Ranostayd0513fc2008-07-27 10:30:30 +0200234};
235
Takashi Iwai2b635362011-05-02 12:33:43 +0200236static const hda_nid_t stac92hd71bxx_pwr_nids[3] = {
Matthew Ranostaya64135a2008-01-10 16:55:06 +0100237 0x0a, 0x0d, 0x0f
238};
239
Matthew Ranostaye035b842007-11-06 11:53:55 +0100240
Takashi Iwai36c9db72013-01-17 17:07:59 +0100241/*
242 * PCM hooks
243 */
244static void stac_playback_pcm_hook(struct hda_pcm_stream *hinfo,
245 struct hda_codec *codec,
246 struct snd_pcm_substream *substream,
247 int action)
Matt Porter8b657272006-10-26 17:12:59 +0200248{
Matt Porter8b657272006-10-26 17:12:59 +0200249 struct sigmatel_spec *spec = codec->spec;
Takashi Iwai36c9db72013-01-17 17:07:59 +0100250 if (action == HDA_GEN_PCM_ACT_OPEN && spec->stream_delay)
251 msleep(spec->stream_delay);
Matt Porter8b657272006-10-26 17:12:59 +0200252}
253
Takashi Iwai36c9db72013-01-17 17:07:59 +0100254static void stac_capture_pcm_hook(struct hda_pcm_stream *hinfo,
255 struct hda_codec *codec,
256 struct snd_pcm_substream *substream,
257 int action)
Matt Porter8b657272006-10-26 17:12:59 +0200258{
Matt Porter8b657272006-10-26 17:12:59 +0200259 struct sigmatel_spec *spec = codec->spec;
Takashi Iwai36c9db72013-01-17 17:07:59 +0100260 int i, idx = 0;
Matt Porter8b657272006-10-26 17:12:59 +0200261
Takashi Iwai36c9db72013-01-17 17:07:59 +0100262 if (!spec->powerdown_adcs)
263 return;
Matt Porter8b657272006-10-26 17:12:59 +0200264
Takashi Iwai36c9db72013-01-17 17:07:59 +0100265 for (i = 0; i < spec->gen.num_all_adcs; i++) {
266 if (spec->gen.all_adcs[i] == hinfo->nid) {
267 idx = i;
268 break;
269 }
Matthew Ranostay00ef50c2008-09-27 18:13:47 -0400270 }
Takashi Iwai36c9db72013-01-17 17:07:59 +0100271
272 switch (action) {
273 case HDA_GEN_PCM_ACT_OPEN:
274 msleep(40);
275 snd_hda_codec_write(codec, hinfo->nid, 0,
276 AC_VERB_SET_POWER_STATE, AC_PWRST_D0);
277 spec->active_adcs |= (1 << idx);
278 break;
279 case HDA_GEN_PCM_ACT_CLOSE:
280 snd_hda_codec_write(codec, hinfo->nid, 0,
281 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
282 spec->active_adcs &= ~(1 << idx);
283 break;
284 }
285}
286
287/*
288 * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a
289 * funky external mute control using GPIO pins.
290 */
291
292static void stac_gpio_set(struct hda_codec *codec, unsigned int mask,
293 unsigned int dir_mask, unsigned int data)
294{
295 unsigned int gpiostate, gpiomask, gpiodir;
296
297 snd_printdd("%s msk %x dir %x gpio %x\n", __func__, mask, dir_mask, data);
298
299 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
300 AC_VERB_GET_GPIO_DATA, 0);
301 gpiostate = (gpiostate & ~dir_mask) | (data & dir_mask);
302
303 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
304 AC_VERB_GET_GPIO_MASK, 0);
305 gpiomask |= mask;
306
307 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
308 AC_VERB_GET_GPIO_DIRECTION, 0);
309 gpiodir |= dir_mask;
310
311 /* Configure GPIOx as CMOS */
312 snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0);
313
314 snd_hda_codec_write(codec, codec->afg, 0,
315 AC_VERB_SET_GPIO_MASK, gpiomask);
316 snd_hda_codec_read(codec, codec->afg, 0,
317 AC_VERB_SET_GPIO_DIRECTION, gpiodir); /* sync */
318
319 msleep(1);
320
321 snd_hda_codec_read(codec, codec->afg, 0,
322 AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */
323}
324
325/* hook for controlling mic-mute LED GPIO */
Takashi Iwaia90229e2013-01-18 14:10:00 +0100326static void stac_capture_led_hook(struct hda_codec *codec,
327 struct snd_ctl_elem_value *ucontrol)
Takashi Iwai36c9db72013-01-17 17:07:59 +0100328{
329 struct sigmatel_spec *spec = codec->spec;
Takashi Iwaia90229e2013-01-18 14:10:00 +0100330 bool mute;
Takashi Iwai36c9db72013-01-17 17:07:59 +0100331
Takashi Iwaia90229e2013-01-18 14:10:00 +0100332 if (!ucontrol)
333 return;
334
335 mute = !(ucontrol->value.integer.value[0] ||
336 ucontrol->value.integer.value[1]);
Takashi Iwai36c9db72013-01-17 17:07:59 +0100337 if (spec->mic_mute_led_on != mute) {
338 spec->mic_mute_led_on = mute;
339 if (mute)
340 spec->gpio_data |= spec->mic_mute_led_gpio;
341 else
342 spec->gpio_data &= ~spec->mic_mute_led_gpio;
343 stac_gpio_set(codec, spec->gpio_mask,
344 spec->gpio_dir, spec->gpio_data);
345 }
Matthew Ranostayd9737752008-09-07 12:03:41 +0200346}
347
Vitaliy Kulikov45eebda2011-07-26 16:56:20 -0500348static int stac_vrefout_set(struct hda_codec *codec,
349 hda_nid_t nid, unsigned int new_vref)
350{
351 int error, pinctl;
352
353 snd_printdd("%s, nid %x ctl %x\n", __func__, nid, new_vref);
354 pinctl = snd_hda_codec_read(codec, nid, 0,
355 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
356
357 if (pinctl < 0)
358 return pinctl;
359
360 pinctl &= 0xff;
361 pinctl &= ~AC_PINCTL_VREFEN;
362 pinctl |= (new_vref & AC_PINCTL_VREFEN);
363
Takashi Iwaicdd03ce2012-04-20 12:34:50 +0200364 error = snd_hda_set_pin_ctl_cache(codec, nid, pinctl);
Vitaliy Kulikov45eebda2011-07-26 16:56:20 -0500365 if (error < 0)
366 return error;
367
368 return 1;
369}
370
Takashi Iwaidfc6e462014-01-13 16:09:57 +0100371/* prevent codec AFG to D3 state when vref-out pin is used for mute LED */
372/* this hook is set in stac_setup_gpio() */
373static unsigned int stac_vref_led_power_filter(struct hda_codec *codec,
374 hda_nid_t nid,
375 unsigned int power_state)
376{
377 if (nid == codec->afg && power_state == AC_PWRST_D3)
378 return AC_PWRST_D1;
379 return snd_hda_gen_path_power_filter(codec, nid, power_state);
380}
381
Takashi Iwai36c9db72013-01-17 17:07:59 +0100382/* update mute-LED accoring to the master switch */
383static void stac_update_led_status(struct hda_codec *codec, int enabled)
Nickolas Lloyd2fc99892009-05-15 15:33:30 +0200384{
Matt2f2f4252005-04-13 14:45:30 +0200385 struct sigmatel_spec *spec = codec->spec;
Takashi Iwai36c9db72013-01-17 17:07:59 +0100386 int muted = !enabled;
Matt2f2f4252005-04-13 14:45:30 +0200387
Takashi Iwai36c9db72013-01-17 17:07:59 +0100388 if (!spec->gpio_led)
389 return;
Matt2f2f4252005-04-13 14:45:30 +0200390
Takashi Iwai36c9db72013-01-17 17:07:59 +0100391 /* LED state is inverted on these systems */
392 if (spec->gpio_led_polarity)
393 muted = !muted;
Matt2f2f4252005-04-13 14:45:30 +0200394
Takashi Iwai36c9db72013-01-17 17:07:59 +0100395 if (!spec->vref_mute_led_nid) {
396 if (muted)
397 spec->gpio_data |= spec->gpio_led;
398 else
399 spec->gpio_data &= ~spec->gpio_led;
400 stac_gpio_set(codec, spec->gpio_mask,
401 spec->gpio_dir, spec->gpio_data);
Takashi Iwai5207e102009-07-30 13:09:08 +0200402 } else {
Takashi Iwai36c9db72013-01-17 17:07:59 +0100403 spec->vref_led = muted ? AC_PINCTL_VREF_50 : AC_PINCTL_VREF_GRD;
404 stac_vrefout_set(codec, spec->vref_mute_led_nid,
405 spec->vref_led);
Takashi Iwai5207e102009-07-30 13:09:08 +0200406 }
Matt2f2f4252005-04-13 14:45:30 +0200407}
408
Takashi Iwai36c9db72013-01-17 17:07:59 +0100409/* vmaster hook to update mute LED */
410static void stac_vmaster_hook(void *private_data, int val)
Matthew Ranostayb22b4822008-01-22 12:32:30 +0100411{
Takashi Iwai36c9db72013-01-17 17:07:59 +0100412 stac_update_led_status(private_data, val);
Matthew Ranostayb22b4822008-01-22 12:32:30 +0100413}
414
Takashi Iwai36c9db72013-01-17 17:07:59 +0100415/* automute hook to handle GPIO mute and EAPD updates */
416static void stac_update_outputs(struct hda_codec *codec)
Matthew Ranostayb22b4822008-01-22 12:32:30 +0100417{
Matthew Ranostayb22b4822008-01-22 12:32:30 +0100418 struct sigmatel_spec *spec = codec->spec;
419
Takashi Iwai36c9db72013-01-17 17:07:59 +0100420 if (spec->gpio_mute)
421 spec->gen.master_mute =
422 !(snd_hda_codec_read(codec, codec->afg, 0,
423 AC_VERB_GET_GPIO_DATA, 0) & spec->gpio_mute);
424
425 snd_hda_gen_update_outputs(codec);
426
427 if (spec->eapd_mask && spec->eapd_switch) {
428 unsigned int val = spec->gpio_data;
429 if (spec->gen.speaker_muted)
430 val &= ~spec->eapd_mask;
431 else
432 val |= spec->eapd_mask;
Takashi Iwai1ea9a692013-07-19 07:58:02 +0200433 if (spec->gpio_data != val) {
434 spec->gpio_data = val;
Takashi Iwai36c9db72013-01-17 17:07:59 +0100435 stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir,
436 val);
Takashi Iwai1ea9a692013-07-19 07:58:02 +0200437 }
Takashi Iwai36c9db72013-01-17 17:07:59 +0100438 }
Matthew Ranostayb22b4822008-01-22 12:32:30 +0100439}
440
Takashi Iwai36c9db72013-01-17 17:07:59 +0100441static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid,
442 bool enable, bool do_write)
Matthew Ranostayb22b4822008-01-22 12:32:30 +0100443{
Matthew Ranostayb22b4822008-01-22 12:32:30 +0100444 struct sigmatel_spec *spec = codec->spec;
Takashi Iwai36c9db72013-01-17 17:07:59 +0100445 unsigned int idx, val;
Matthew Ranostayb22b4822008-01-22 12:32:30 +0100446
Takashi Iwai36c9db72013-01-17 17:07:59 +0100447 for (idx = 0; idx < spec->num_pwrs; idx++) {
448 if (spec->pwr_nids[idx] == nid)
449 break;
450 }
451 if (idx >= spec->num_pwrs)
452 return;
453
454 idx = 1 << idx;
455
456 val = spec->power_map_bits;
457 if (enable)
458 val &= ~idx;
459 else
460 val |= idx;
461
462 /* power down unused output ports */
463 if (val != spec->power_map_bits) {
464 spec->power_map_bits = val;
465 if (do_write)
466 snd_hda_codec_write(codec, codec->afg, 0,
467 AC_VERB_IDT_SET_POWER_MAP, val);
468 }
Matthew Ranostayb22b4822008-01-22 12:32:30 +0100469}
470
Takashi Iwai36c9db72013-01-17 17:07:59 +0100471/* update power bit per jack plug/unplug */
472static void jack_update_power(struct hda_codec *codec,
473 struct hda_jack_tbl *jack)
474{
475 struct sigmatel_spec *spec = codec->spec;
476 int i;
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +0200477
Takashi Iwai36c9db72013-01-17 17:07:59 +0100478 if (!spec->num_pwrs)
479 return;
480
481 if (jack && jack->nid) {
482 stac_toggle_power_map(codec, jack->nid,
483 snd_hda_jack_detect(codec, jack->nid),
484 true);
485 return;
486 }
487
488 /* update all jacks */
489 for (i = 0; i < spec->num_pwrs; i++) {
490 hda_nid_t nid = spec->pwr_nids[i];
491 jack = snd_hda_jack_tbl_get(codec, nid);
492 if (!jack || !jack->action)
493 continue;
494 if (jack->action == STAC_PWR_EVENT ||
495 jack->action <= HDA_GEN_LAST_EVENT)
496 stac_toggle_power_map(codec, nid,
497 snd_hda_jack_detect(codec, nid),
498 false);
499 }
500
501 snd_hda_codec_write(codec, codec->afg, 0, AC_VERB_IDT_SET_POWER_MAP,
502 spec->power_map_bits);
503}
504
505static void stac_hp_automute(struct hda_codec *codec,
506 struct hda_jack_tbl *jack)
507{
508 snd_hda_gen_hp_automute(codec, jack);
509 jack_update_power(codec, jack);
510}
511
512static void stac_line_automute(struct hda_codec *codec,
513 struct hda_jack_tbl *jack)
514{
515 snd_hda_gen_line_automute(codec, jack);
516 jack_update_power(codec, jack);
517}
518
David Henningsson664389d2013-01-28 11:29:17 +0100519static void stac_mic_autoswitch(struct hda_codec *codec,
520 struct hda_jack_tbl *jack)
521{
522 snd_hda_gen_mic_autoswitch(codec, jack);
523 jack_update_power(codec, jack);
524}
525
Takashi Iwai36c9db72013-01-17 17:07:59 +0100526static void stac_vref_event(struct hda_codec *codec, struct hda_jack_tbl *event)
527{
528 unsigned int data;
529
530 data = snd_hda_codec_read(codec, codec->afg, 0,
531 AC_VERB_GET_GPIO_DATA, 0);
532 /* toggle VREF state based on GPIOx status */
533 snd_hda_codec_write(codec, codec->afg, 0, 0x7e0,
534 !!(data & (1 << event->private_data)));
535}
536
537/* initialize the power map and enable the power event to jacks that
538 * haven't been assigned to automute
539 */
540static void stac_init_power_map(struct hda_codec *codec)
541{
542 struct sigmatel_spec *spec = codec->spec;
543 int i;
544
545 for (i = 0; i < spec->num_pwrs; i++) {
546 hda_nid_t nid = spec->pwr_nids[i];
547 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid);
548 def_conf = get_defcfg_connect(def_conf);
549 if (snd_hda_jack_tbl_get(codec, nid))
550 continue;
551 if (def_conf == AC_JACK_PORT_COMPLEX &&
552 !(spec->vref_mute_led_nid == nid ||
553 is_jack_detectable(codec, nid))) {
554 snd_hda_jack_detect_enable_callback(codec, nid,
555 STAC_PWR_EVENT,
556 jack_update_power);
557 } else {
558 if (def_conf == AC_JACK_PORT_NONE)
559 stac_toggle_power_map(codec, nid, false, false);
560 else
561 stac_toggle_power_map(codec, nid, true, false);
562 }
563 }
564}
565
566/*
567 */
568
569static inline bool get_int_hint(struct hda_codec *codec, const char *key,
570 int *valp)
571{
572 return !snd_hda_get_int_hint(codec, key, valp);
573}
574
575/* override some hints from the hwdep entry */
576static void stac_store_hints(struct hda_codec *codec)
577{
578 struct sigmatel_spec *spec = codec->spec;
579 int val;
580
581 if (get_int_hint(codec, "gpio_mask", &spec->gpio_mask)) {
582 spec->eapd_mask = spec->gpio_dir = spec->gpio_data =
583 spec->gpio_mask;
584 }
585 if (get_int_hint(codec, "gpio_dir", &spec->gpio_dir))
586 spec->gpio_mask &= spec->gpio_mask;
587 if (get_int_hint(codec, "gpio_data", &spec->gpio_data))
588 spec->gpio_dir &= spec->gpio_mask;
589 if (get_int_hint(codec, "eapd_mask", &spec->eapd_mask))
590 spec->eapd_mask &= spec->gpio_mask;
591 if (get_int_hint(codec, "gpio_mute", &spec->gpio_mute))
592 spec->gpio_mute &= spec->gpio_mask;
593 val = snd_hda_get_bool_hint(codec, "eapd_switch");
594 if (val >= 0)
595 spec->eapd_switch = val;
596}
597
598/*
599 * loopback controls
600 */
601
602#define stac_aloopback_info snd_ctl_boolean_mono_info
603
604static int stac_aloopback_get(struct snd_kcontrol *kcontrol,
605 struct snd_ctl_elem_value *ucontrol)
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +0200606{
607 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
Matthew Ranostaye1f0d662007-12-13 17:47:21 +0100608 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +0200609 struct sigmatel_spec *spec = codec->spec;
610
Matthew Ranostaye1f0d662007-12-13 17:47:21 +0100611 ucontrol->value.integer.value[0] = !!(spec->aloopback &
612 (spec->aloopback_mask << idx));
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +0200613 return 0;
614}
615
Takashi Iwai36c9db72013-01-17 17:07:59 +0100616static int stac_aloopback_put(struct snd_kcontrol *kcontrol,
617 struct snd_ctl_elem_value *ucontrol)
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +0200618{
619 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
620 struct sigmatel_spec *spec = codec->spec;
Matthew Ranostaye1f0d662007-12-13 17:47:21 +0100621 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +0200622 unsigned int dac_mode;
Matthew Ranostaye1f0d662007-12-13 17:47:21 +0100623 unsigned int val, idx_val;
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +0200624
Matthew Ranostaye1f0d662007-12-13 17:47:21 +0100625 idx_val = spec->aloopback_mask << idx;
626 if (ucontrol->value.integer.value[0])
627 val = spec->aloopback | idx_val;
628 else
629 val = spec->aloopback & ~idx_val;
Takashi Iwai68ea7b22007-11-15 15:54:38 +0100630 if (spec->aloopback == val)
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +0200631 return 0;
632
Takashi Iwai68ea7b22007-11-15 15:54:38 +0100633 spec->aloopback = val;
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +0200634
Matthew Ranostaye1f0d662007-12-13 17:47:21 +0100635 /* Only return the bits defined by the shift value of the
636 * first two bytes of the mask
637 */
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +0200638 dac_mode = snd_hda_codec_read(codec, codec->afg, 0,
Matthew Ranostaye1f0d662007-12-13 17:47:21 +0100639 kcontrol->private_value & 0xFFFF, 0x0);
640 dac_mode >>= spec->aloopback_shift;
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +0200641
Matthew Ranostaye1f0d662007-12-13 17:47:21 +0100642 if (spec->aloopback & idx_val) {
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +0200643 snd_hda_power_up(codec);
Matthew Ranostaye1f0d662007-12-13 17:47:21 +0100644 dac_mode |= idx_val;
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +0200645 } else {
646 snd_hda_power_down(codec);
Matthew Ranostaye1f0d662007-12-13 17:47:21 +0100647 dac_mode &= ~idx_val;
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +0200648 }
649
650 snd_hda_codec_write_cache(codec, codec->afg, 0,
651 kcontrol->private_value >> 16, dac_mode);
652
653 return 1;
654}
655
Takashi Iwai36c9db72013-01-17 17:07:59 +0100656#define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \
657 { \
658 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
659 .name = "Analog Loopback", \
660 .count = cnt, \
661 .info = stac_aloopback_info, \
662 .get = stac_aloopback_get, \
663 .put = stac_aloopback_put, \
664 .private_value = verb_read | (verb_write << 16), \
665 }
666
667/*
668 * Mute LED handling on HP laptops
669 */
670
671/* check whether it's a HP laptop with a docking port */
672static bool hp_bnb2011_with_dock(struct hda_codec *codec)
673{
674 if (codec->vendor_id != 0x111d7605 &&
675 codec->vendor_id != 0x111d76d1)
676 return false;
677
678 switch (codec->subsystem_id) {
679 case 0x103c1618:
680 case 0x103c1619:
681 case 0x103c161a:
682 case 0x103c161b:
683 case 0x103c161c:
684 case 0x103c161d:
685 case 0x103c161e:
686 case 0x103c161f:
687
688 case 0x103c162a:
689 case 0x103c162b:
690
691 case 0x103c1630:
692 case 0x103c1631:
693
694 case 0x103c1633:
695 case 0x103c1634:
696 case 0x103c1635:
697
698 case 0x103c3587:
699 case 0x103c3588:
700 case 0x103c3589:
701 case 0x103c358a:
702
703 case 0x103c3667:
704 case 0x103c3668:
705 case 0x103c3669:
706
707 return true;
708 }
709 return false;
710}
711
712static bool hp_blike_system(u32 subsystem_id)
713{
714 switch (subsystem_id) {
715 case 0x103c1520:
716 case 0x103c1521:
717 case 0x103c1523:
718 case 0x103c1524:
719 case 0x103c1525:
720 case 0x103c1722:
721 case 0x103c1723:
722 case 0x103c1724:
723 case 0x103c1725:
724 case 0x103c1726:
725 case 0x103c1727:
726 case 0x103c1728:
727 case 0x103c1729:
728 case 0x103c172a:
729 case 0x103c172b:
730 case 0x103c307e:
731 case 0x103c307f:
732 case 0x103c3080:
733 case 0x103c3081:
734 case 0x103c7007:
735 case 0x103c7008:
736 return true;
737 }
738 return false;
739}
740
741static void set_hp_led_gpio(struct hda_codec *codec)
742{
743 struct sigmatel_spec *spec = codec->spec;
744 unsigned int gpio;
745
746 if (spec->gpio_led)
747 return;
748
749 gpio = snd_hda_param_read(codec, codec->afg, AC_PAR_GPIO_CAP);
750 gpio &= AC_GPIO_IO_COUNT;
751 if (gpio > 3)
752 spec->gpio_led = 0x08; /* GPIO 3 */
753 else
754 spec->gpio_led = 0x01; /* GPIO 0 */
755}
756
757/*
758 * This method searches for the mute LED GPIO configuration
759 * provided as OEM string in SMBIOS. The format of that string
760 * is HP_Mute_LED_P_G or HP_Mute_LED_P
761 * where P can be 0 or 1 and defines mute LED GPIO control state (low/high)
762 * that corresponds to the NOT muted state of the master volume
763 * and G is the index of the GPIO to use as the mute LED control (0..9)
764 * If _G portion is missing it is assigned based on the codec ID
765 *
766 * So, HP B-series like systems may have HP_Mute_LED_0 (current models)
767 * or HP_Mute_LED_0_3 (future models) OEM SMBIOS strings
768 *
769 *
770 * The dv-series laptops don't seem to have the HP_Mute_LED* strings in
771 * SMBIOS - at least the ones I have seen do not have them - which include
772 * my own system (HP Pavilion dv6-1110ax) and my cousin's
773 * HP Pavilion dv9500t CTO.
774 * Need more information on whether it is true across the entire series.
775 * -- kunal
776 */
777static int find_mute_led_cfg(struct hda_codec *codec, int default_polarity)
778{
779 struct sigmatel_spec *spec = codec->spec;
780 const struct dmi_device *dev = NULL;
781
782 if (get_int_hint(codec, "gpio_led", &spec->gpio_led)) {
783 get_int_hint(codec, "gpio_led_polarity",
784 &spec->gpio_led_polarity);
785 return 1;
786 }
787
788 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
789 if (sscanf(dev->name, "HP_Mute_LED_%d_%x",
790 &spec->gpio_led_polarity,
791 &spec->gpio_led) == 2) {
792 unsigned int max_gpio;
793 max_gpio = snd_hda_param_read(codec, codec->afg,
794 AC_PAR_GPIO_CAP);
795 max_gpio &= AC_GPIO_IO_COUNT;
796 if (spec->gpio_led < max_gpio)
797 spec->gpio_led = 1 << spec->gpio_led;
798 else
799 spec->vref_mute_led_nid = spec->gpio_led;
800 return 1;
801 }
802 if (sscanf(dev->name, "HP_Mute_LED_%d",
803 &spec->gpio_led_polarity) == 1) {
804 set_hp_led_gpio(codec);
805 return 1;
806 }
807 /* BIOS bug: unfilled OEM string */
808 if (strstr(dev->name, "HP_Mute_LED_P_G")) {
809 set_hp_led_gpio(codec);
810 if (default_polarity >= 0)
811 spec->gpio_led_polarity = default_polarity;
812 else
813 spec->gpio_led_polarity = 1;
814 return 1;
815 }
816 }
817
818 /*
819 * Fallback case - if we don't find the DMI strings,
820 * we statically set the GPIO - if not a B-series system
821 * and default polarity is provided
822 */
823 if (!hp_blike_system(codec->subsystem_id) &&
824 (default_polarity == 0 || default_polarity == 1)) {
825 set_hp_led_gpio(codec);
826 spec->gpio_led_polarity = default_polarity;
827 return 1;
828 }
829 return 0;
830}
831
David Henningsson303985f2013-03-14 15:28:29 +0100832/* check whether a built-in speaker is included in parsed pins */
833static bool has_builtin_speaker(struct hda_codec *codec)
834{
835 struct sigmatel_spec *spec = codec->spec;
836 hda_nid_t *nid_pin;
837 int nids, i;
838
839 if (spec->gen.autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) {
840 nid_pin = spec->gen.autocfg.line_out_pins;
841 nids = spec->gen.autocfg.line_outs;
842 } else {
843 nid_pin = spec->gen.autocfg.speaker_pins;
844 nids = spec->gen.autocfg.speaker_outs;
845 }
846
847 for (i = 0; i < nids; i++) {
848 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid_pin[i]);
849 if (snd_hda_get_input_pin_attr(def_conf) == INPUT_PIN_ATTR_INT)
850 return true;
851 }
852 return false;
853}
854
Takashi Iwai36c9db72013-01-17 17:07:59 +0100855/*
856 * PC beep controls
857 */
858
859/* create PC beep volume controls */
860static int stac_auto_create_beep_ctls(struct hda_codec *codec,
861 hda_nid_t nid)
862{
863 struct sigmatel_spec *spec = codec->spec;
864 u32 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
865 struct snd_kcontrol_new *knew;
866 static struct snd_kcontrol_new abeep_mute_ctl =
867 HDA_CODEC_MUTE(NULL, 0, 0, 0);
868 static struct snd_kcontrol_new dbeep_mute_ctl =
869 HDA_CODEC_MUTE_BEEP(NULL, 0, 0, 0);
870 static struct snd_kcontrol_new beep_vol_ctl =
871 HDA_CODEC_VOLUME(NULL, 0, 0, 0);
872
873 /* check for mute support for the the amp */
874 if ((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT) {
875 const struct snd_kcontrol_new *temp;
876 if (spec->anabeep_nid == nid)
877 temp = &abeep_mute_ctl;
878 else
879 temp = &dbeep_mute_ctl;
880 knew = snd_hda_gen_add_kctl(&spec->gen,
881 "Beep Playback Switch", temp);
882 if (!knew)
883 return -ENOMEM;
884 knew->private_value =
885 HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT);
886 }
887
888 /* check to see if there is volume support for the amp */
889 if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) {
890 knew = snd_hda_gen_add_kctl(&spec->gen,
891 "Beep Playback Volume",
892 &beep_vol_ctl);
893 if (!knew)
894 return -ENOMEM;
895 knew->private_value =
896 HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT);
897 }
898 return 0;
899}
900
901#ifdef CONFIG_SND_HDA_INPUT_BEEP
902#define stac_dig_beep_switch_info snd_ctl_boolean_mono_info
903
904static int stac_dig_beep_switch_get(struct snd_kcontrol *kcontrol,
905 struct snd_ctl_elem_value *ucontrol)
906{
907 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
908 ucontrol->value.integer.value[0] = codec->beep->enabled;
909 return 0;
910}
911
912static int stac_dig_beep_switch_put(struct snd_kcontrol *kcontrol,
913 struct snd_ctl_elem_value *ucontrol)
914{
915 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
916 return snd_hda_enable_beep_device(codec, ucontrol->value.integer.value[0]);
917}
918
919static const struct snd_kcontrol_new stac_dig_beep_ctrl = {
920 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
921 .name = "Beep Playback Switch",
922 .info = stac_dig_beep_switch_info,
923 .get = stac_dig_beep_switch_get,
924 .put = stac_dig_beep_switch_put,
925};
926
927static int stac_beep_switch_ctl(struct hda_codec *codec)
928{
929 struct sigmatel_spec *spec = codec->spec;
930
931 if (!snd_hda_gen_add_kctl(&spec->gen, NULL, &stac_dig_beep_ctrl))
932 return -ENOMEM;
933 return 0;
934}
935#endif
936
937/*
Takashi Iwai42875472013-01-22 09:34:48 +0100938 * SPDIF-out mux controls
939 */
940
941static int stac_smux_enum_info(struct snd_kcontrol *kcontrol,
942 struct snd_ctl_elem_info *uinfo)
943{
944 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
945 struct sigmatel_spec *spec = codec->spec;
946 return snd_hda_input_mux_info(&spec->spdif_mux, uinfo);
947}
948
949static int stac_smux_enum_get(struct snd_kcontrol *kcontrol,
950 struct snd_ctl_elem_value *ucontrol)
951{
952 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
953 struct sigmatel_spec *spec = codec->spec;
954 unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
955
956 ucontrol->value.enumerated.item[0] = spec->cur_smux[smux_idx];
957 return 0;
958}
959
960static int stac_smux_enum_put(struct snd_kcontrol *kcontrol,
961 struct snd_ctl_elem_value *ucontrol)
962{
963 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
964 struct sigmatel_spec *spec = codec->spec;
965 unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
966
967 return snd_hda_input_mux_put(codec, &spec->spdif_mux, ucontrol,
968 spec->gen.autocfg.dig_out_pins[smux_idx],
969 &spec->cur_smux[smux_idx]);
970}
971
972static struct snd_kcontrol_new stac_smux_mixer = {
973 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
974 .name = "IEC958 Playback Source",
975 /* count set later */
976 .info = stac_smux_enum_info,
977 .get = stac_smux_enum_get,
978 .put = stac_smux_enum_put,
979};
980
981static const char * const stac_spdif_labels[] = {
982 "Digital Playback", "Analog Mux 1", "Analog Mux 2", NULL
983};
984
985static int stac_create_spdif_mux_ctls(struct hda_codec *codec)
986{
987 struct sigmatel_spec *spec = codec->spec;
988 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
989 const char * const *labels = spec->spdif_labels;
990 struct snd_kcontrol_new *kctl;
991 int i, num_cons;
992
993 if (cfg->dig_outs < 1)
994 return 0;
995
996 num_cons = snd_hda_get_num_conns(codec, cfg->dig_out_pins[0]);
997 if (num_cons <= 1)
998 return 0;
999
1000 if (!labels)
1001 labels = stac_spdif_labels;
1002 for (i = 0; i < num_cons; i++) {
1003 if (snd_BUG_ON(!labels[i]))
1004 return -EINVAL;
1005 snd_hda_add_imux_item(&spec->spdif_mux, labels[i], i, NULL);
1006 }
1007
1008 kctl = snd_hda_gen_add_kctl(&spec->gen, NULL, &stac_smux_mixer);
1009 if (!kctl)
1010 return -ENOMEM;
1011 kctl->count = cfg->dig_outs;
1012
1013 return 0;
1014}
1015
1016/*
Takashi Iwai36c9db72013-01-17 17:07:59 +01001017 */
1018
Takashi Iwai2b635362011-05-02 12:33:43 +02001019static const struct hda_verb stac9200_core_init[] = {
Matt2f2f4252005-04-13 14:45:30 +02001020 /* set dac0mux for dac converter */
Mattc7d4b2f2005-06-27 14:59:41 +02001021 { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
Matt2f2f4252005-04-13 14:45:30 +02001022 {}
1023};
1024
Takashi Iwai2b635362011-05-02 12:33:43 +02001025static const struct hda_verb stac9200_eapd_init[] = {
Takashi Iwai1194b5b2007-10-10 10:04:26 +02001026 /* set dac0mux for dac converter */
1027 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1028 {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1029 {}
1030};
1031
Takashi Iwai2b635362011-05-02 12:33:43 +02001032static const struct hda_verb dell_eq_core_init[] = {
Matthew Ranostayd654a662008-03-14 08:46:51 +01001033 /* set master volume to max value without distortion
1034 * and direct control */
1035 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec},
Matthew Ranostayd654a662008-03-14 08:46:51 +01001036 {}
1037};
1038
Takashi Iwai2b635362011-05-02 12:33:43 +02001039static const struct hda_verb stac92hd73xx_core_init[] = {
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01001040 /* set master volume and direct control */
1041 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01001042 {}
1043};
1044
Takashi Iwai2b635362011-05-02 12:33:43 +02001045static const struct hda_verb stac92hd83xxx_core_init[] = {
Matthew Ranostayd0513fc2008-07-27 10:30:30 +02001046 /* power state controls amps */
1047 { 0x01, AC_VERB_SET_EAPD, 1 << 2},
Herton Ronaldo Krzesinski574f3c42008-12-23 16:53:00 -02001048 {}
Matthew Ranostayd0513fc2008-07-27 10:30:30 +02001049};
1050
Vitaliy Kulikov5556e142012-02-27 16:47:37 -06001051static const struct hda_verb stac92hd83xxx_hp_zephyr_init[] = {
1052 { 0x22, 0x785, 0x43 },
1053 { 0x22, 0x782, 0xe0 },
1054 { 0x22, 0x795, 0x00 },
1055 {}
1056};
1057
Takashi Iwai2b635362011-05-02 12:33:43 +02001058static const struct hda_verb stac92hd71bxx_core_init[] = {
Matthew Ranostaye035b842007-11-06 11:53:55 +01001059 /* set master volume and direct control */
1060 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
Herton Ronaldo Krzesinski574f3c42008-12-23 16:53:00 -02001061 {}
Matthew Ranostay541eee82007-12-14 12:08:04 +01001062};
1063
Takashi Iwai2b635362011-05-02 12:33:43 +02001064static const struct hda_verb stac92hd71bxx_unmute_core_init[] = {
Matthew Ranostayca8d33f2009-01-26 09:33:52 -05001065 /* unmute right and left channels for nodes 0x0f, 0xa, 0x0d */
1066 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
Matthew Ranostaye035b842007-11-06 11:53:55 +01001067 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1068 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
Matthew Ranostaye035b842007-11-06 11:53:55 +01001069 {}
1070};
1071
Takashi Iwai2b635362011-05-02 12:33:43 +02001072static const struct hda_verb stac925x_core_init[] = {
Tobin Davis8e21c342007-01-08 11:04:17 +01001073 /* set dac0mux for dac converter */
1074 { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00},
Takashi Iwaic9280d62009-01-15 17:31:00 +01001075 /* mute the master volume */
1076 { 0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
Tobin Davis8e21c342007-01-08 11:04:17 +01001077 {}
1078};
1079
Takashi Iwai2b635362011-05-02 12:33:43 +02001080static const struct hda_verb stac922x_core_init[] = {
Takashi Iwai36c9db72013-01-17 17:07:59 +01001081 /* set master volume and direct control */
Mattc7d4b2f2005-06-27 14:59:41 +02001082 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
Matt2f2f4252005-04-13 14:45:30 +02001083 {}
1084};
1085
Takashi Iwai2b635362011-05-02 12:33:43 +02001086static const struct hda_verb d965_core_init[] = {
Takashi Iwai19039bd2006-06-28 15:52:16 +02001087 /* unmute node 0x1b */
1088 { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
Takashi Iwai36c9db72013-01-17 17:07:59 +01001089 /* select node 0x03 as DAC */
Takashi Iwai19039bd2006-06-28 15:52:16 +02001090 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
1091 {}
1092};
1093
Takashi Iwai2b635362011-05-02 12:33:43 +02001094static const struct hda_verb dell_3st_core_init[] = {
Takashi Iwaiccca7cd2009-10-13 15:32:21 +02001095 /* don't set delta bit */
1096 {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f},
1097 /* unmute node 0x1b */
1098 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
1099 /* select node 0x03 as DAC */
1100 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x01},
1101 {}
1102};
1103
Takashi Iwai2b635362011-05-02 12:33:43 +02001104static const struct hda_verb stac927x_core_init[] = {
Takashi Iwai36c9db72013-01-17 17:07:59 +01001105 /* set master volume and direct control */
Matt Porter3cc08dc2006-01-23 15:27:49 +01001106 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
Matthew Ranostay1cd22242008-07-18 18:20:52 +02001107 /* enable analog pc beep path */
1108 { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
Matt Porter3cc08dc2006-01-23 15:27:49 +01001109 {}
1110};
1111
Takashi Iwai2b635362011-05-02 12:33:43 +02001112static const struct hda_verb stac927x_volknob_core_init[] = {
Takashi Iwai54930532009-10-11 17:38:29 +02001113 /* don't set delta bit */
1114 {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f},
1115 /* enable analog pc beep path */
1116 {0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
1117 {}
1118};
1119
Takashi Iwai2b635362011-05-02 12:33:43 +02001120static const struct hda_verb stac9205_core_init[] = {
Takashi Iwai36c9db72013-01-17 17:07:59 +01001121 /* set master volume and direct control */
Matt Porterf3302a52006-07-31 12:49:34 +02001122 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
Matthew Ranostayd0513fc2008-07-27 10:30:30 +02001123 /* enable analog pc beep path */
1124 { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5},
Matt Porterf3302a52006-07-31 12:49:34 +02001125 {}
1126};
1127
Takashi Iwai36c9db72013-01-17 17:07:59 +01001128static const struct snd_kcontrol_new stac92hd73xx_6ch_loopback =
1129 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3);
Matthew Ranostayb22b4822008-01-22 12:32:30 +01001130
Takashi Iwai36c9db72013-01-17 17:07:59 +01001131static const struct snd_kcontrol_new stac92hd73xx_8ch_loopback =
1132 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4);
Maxim Levitsky5f10c4a2007-09-03 15:29:37 +02001133
Takashi Iwai36c9db72013-01-17 17:07:59 +01001134static const struct snd_kcontrol_new stac92hd73xx_10ch_loopback =
1135 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5);
Nickolas Lloyd2fc99892009-05-15 15:33:30 +02001136
Takashi Iwai36c9db72013-01-17 17:07:59 +01001137static const struct snd_kcontrol_new stac92hd71bxx_loopback =
1138 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2);
Matt2f2f4252005-04-13 14:45:30 +02001139
Takashi Iwai36c9db72013-01-17 17:07:59 +01001140static const struct snd_kcontrol_new stac9205_loopback =
1141 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1);
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01001142
Takashi Iwai36c9db72013-01-17 17:07:59 +01001143static const struct snd_kcontrol_new stac927x_loopback =
1144 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1);
Matt2f2f4252005-04-13 14:45:30 +02001145
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001146static const struct hda_pintbl ref9200_pin_configs[] = {
1147 { 0x08, 0x01c47010 },
1148 { 0x09, 0x01447010 },
1149 { 0x0d, 0x0221401f },
1150 { 0x0e, 0x01114010 },
1151 { 0x0f, 0x02a19020 },
1152 { 0x10, 0x01a19021 },
1153 { 0x11, 0x90100140 },
1154 { 0x12, 0x01813122 },
1155 {}
Matt2f2f4252005-04-13 14:45:30 +02001156};
1157
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001158static const struct hda_pintbl gateway9200_m4_pin_configs[] = {
1159 { 0x08, 0x400000fe },
1160 { 0x09, 0x404500f4 },
1161 { 0x0d, 0x400100f0 },
1162 { 0x0e, 0x90110010 },
1163 { 0x0f, 0x400100f1 },
1164 { 0x10, 0x02a1902e },
1165 { 0x11, 0x500000f2 },
1166 { 0x12, 0x500000f3 },
1167 {}
Mauro Carvalho Chehab58eec422008-08-11 10:18:39 +02001168};
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001169
1170static const struct hda_pintbl gateway9200_m4_2_pin_configs[] = {
1171 { 0x08, 0x400000fe },
1172 { 0x09, 0x404500f4 },
1173 { 0x0d, 0x400100f0 },
1174 { 0x0e, 0x90110010 },
1175 { 0x0f, 0x400100f1 },
1176 { 0x10, 0x02a1902e },
1177 { 0x11, 0x500000f2 },
1178 { 0x12, 0x500000f3 },
1179 {}
Mauro Carvalho Chehab58eec422008-08-11 10:18:39 +02001180};
1181
1182/*
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001183 STAC 9200 pin configs for
1184 102801A8
1185 102801DE
1186 102801E8
1187*/
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001188static const struct hda_pintbl dell9200_d21_pin_configs[] = {
1189 { 0x08, 0x400001f0 },
1190 { 0x09, 0x400001f1 },
1191 { 0x0d, 0x02214030 },
1192 { 0x0e, 0x01014010 },
1193 { 0x0f, 0x02a19020 },
1194 { 0x10, 0x01a19021 },
1195 { 0x11, 0x90100140 },
1196 { 0x12, 0x01813122 },
1197 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001198};
1199
Takashi Iwai36c9db72013-01-17 17:07:59 +01001200/*
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001201 STAC 9200 pin configs for
1202 102801C0
1203 102801C1
1204*/
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001205static const struct hda_pintbl dell9200_d22_pin_configs[] = {
1206 { 0x08, 0x400001f0 },
1207 { 0x09, 0x400001f1 },
1208 { 0x0d, 0x0221401f },
1209 { 0x0e, 0x01014010 },
1210 { 0x0f, 0x01813020 },
1211 { 0x10, 0x02a19021 },
1212 { 0x11, 0x90100140 },
1213 { 0x12, 0x400001f2 },
1214 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001215};
1216
Takashi Iwai36c9db72013-01-17 17:07:59 +01001217/*
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001218 STAC 9200 pin configs for
1219 102801C4 (Dell Dimension E310)
1220 102801C5
1221 102801C7
1222 102801D9
1223 102801DA
1224 102801E3
1225*/
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001226static const struct hda_pintbl dell9200_d23_pin_configs[] = {
1227 { 0x08, 0x400001f0 },
1228 { 0x09, 0x400001f1 },
1229 { 0x0d, 0x0221401f },
1230 { 0x0e, 0x01014010 },
1231 { 0x0f, 0x01813020 },
1232 { 0x10, 0x01a19021 },
1233 { 0x11, 0x90100140 },
1234 { 0x12, 0x400001f2 },
1235 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001236};
1237
1238
1239/*
1240 STAC 9200-32 pin configs for
1241 102801B5 (Dell Inspiron 630m)
1242 102801D8 (Dell Inspiron 640m)
1243*/
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001244static const struct hda_pintbl dell9200_m21_pin_configs[] = {
1245 { 0x08, 0x40c003fa },
1246 { 0x09, 0x03441340 },
1247 { 0x0d, 0x0321121f },
1248 { 0x0e, 0x90170310 },
1249 { 0x0f, 0x408003fb },
1250 { 0x10, 0x03a11020 },
1251 { 0x11, 0x401003fc },
1252 { 0x12, 0x403003fd },
1253 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001254};
1255
1256/*
1257 STAC 9200-32 pin configs for
1258 102801C2 (Dell Latitude D620)
1259 102801C8
1260 102801CC (Dell Latitude D820)
1261 102801D4
1262 102801D6
1263*/
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001264static const struct hda_pintbl dell9200_m22_pin_configs[] = {
1265 { 0x08, 0x40c003fa },
1266 { 0x09, 0x0144131f },
1267 { 0x0d, 0x0321121f },
1268 { 0x0e, 0x90170310 },
1269 { 0x0f, 0x90a70321 },
1270 { 0x10, 0x03a11020 },
1271 { 0x11, 0x401003fb },
1272 { 0x12, 0x40f000fc },
1273 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001274};
1275
1276/*
1277 STAC 9200-32 pin configs for
1278 102801CE (Dell XPS M1710)
1279 102801CF (Dell Precision M90)
1280*/
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001281static const struct hda_pintbl dell9200_m23_pin_configs[] = {
1282 { 0x08, 0x40c003fa },
1283 { 0x09, 0x01441340 },
1284 { 0x0d, 0x0421421f },
1285 { 0x0e, 0x90170310 },
1286 { 0x0f, 0x408003fb },
1287 { 0x10, 0x04a1102e },
1288 { 0x11, 0x90170311 },
1289 { 0x12, 0x403003fc },
1290 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001291};
1292
1293/*
1294 STAC 9200-32 pin configs for
1295 102801C9
1296 102801CA
1297 102801CB (Dell Latitude 120L)
1298 102801D3
1299*/
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001300static const struct hda_pintbl dell9200_m24_pin_configs[] = {
1301 { 0x08, 0x40c003fa },
1302 { 0x09, 0x404003fb },
1303 { 0x0d, 0x0321121f },
1304 { 0x0e, 0x90170310 },
1305 { 0x0f, 0x408003fc },
1306 { 0x10, 0x03a11020 },
1307 { 0x11, 0x401003fd },
1308 { 0x12, 0x403003fe },
1309 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001310};
1311
1312/*
1313 STAC 9200-32 pin configs for
1314 102801BD (Dell Inspiron E1505n)
1315 102801EE
1316 102801EF
1317*/
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001318static const struct hda_pintbl dell9200_m25_pin_configs[] = {
1319 { 0x08, 0x40c003fa },
1320 { 0x09, 0x01441340 },
1321 { 0x0d, 0x0421121f },
1322 { 0x0e, 0x90170310 },
1323 { 0x0f, 0x408003fb },
1324 { 0x10, 0x04a11020 },
1325 { 0x11, 0x401003fc },
1326 { 0x12, 0x403003fd },
1327 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001328};
1329
1330/*
1331 STAC 9200-32 pin configs for
1332 102801F5 (Dell Inspiron 1501)
1333 102801F6
1334*/
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001335static const struct hda_pintbl dell9200_m26_pin_configs[] = {
1336 { 0x08, 0x40c003fa },
1337 { 0x09, 0x404003fb },
1338 { 0x0d, 0x0421121f },
1339 { 0x0e, 0x90170310 },
1340 { 0x0f, 0x408003fc },
1341 { 0x10, 0x04a11020 },
1342 { 0x11, 0x401003fd },
1343 { 0x12, 0x403003fe },
1344 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001345};
1346
1347/*
1348 STAC 9200-32
1349 102801CD (Dell Inspiron E1705/9400)
1350*/
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001351static const struct hda_pintbl dell9200_m27_pin_configs[] = {
1352 { 0x08, 0x40c003fa },
1353 { 0x09, 0x01441340 },
1354 { 0x0d, 0x0421121f },
1355 { 0x0e, 0x90170310 },
1356 { 0x0f, 0x90170310 },
1357 { 0x10, 0x04a11020 },
1358 { 0x11, 0x90170310 },
1359 { 0x12, 0x40f003fc },
1360 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001361};
1362
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001363static const struct hda_pintbl oqo9200_pin_configs[] = {
1364 { 0x08, 0x40c000f0 },
1365 { 0x09, 0x404000f1 },
1366 { 0x0d, 0x0221121f },
1367 { 0x0e, 0x02211210 },
1368 { 0x0f, 0x90170111 },
1369 { 0x10, 0x90a70120 },
1370 { 0x11, 0x400000f2 },
1371 { 0x12, 0x400000f3 },
1372 {}
Tobin Davisbf277782008-02-03 20:31:47 +01001373};
1374
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001375
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001376static void stac9200_fixup_panasonic(struct hda_codec *codec,
1377 const struct hda_fixup *fix, int action)
1378{
1379 struct sigmatel_spec *spec = codec->spec;
1380
Takashi Iwai36c9db72013-01-17 17:07:59 +01001381 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001382 spec->gpio_mask = spec->gpio_dir = 0x09;
1383 spec->gpio_data = 0x00;
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001384 /* CF-74 has no headphone detection, and the driver should *NOT*
1385 * do detection and HP/speaker toggle because the hardware does it.
1386 */
Takashi Iwai36c9db72013-01-17 17:07:59 +01001387 spec->gen.suppress_auto_mute = 1;
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001388 }
1389}
1390
1391
1392static const struct hda_fixup stac9200_fixups[] = {
1393 [STAC_REF] = {
1394 .type = HDA_FIXUP_PINS,
1395 .v.pins = ref9200_pin_configs,
1396 },
1397 [STAC_9200_OQO] = {
1398 .type = HDA_FIXUP_PINS,
1399 .v.pins = oqo9200_pin_configs,
1400 .chained = true,
1401 .chain_id = STAC_9200_EAPD_INIT,
1402 },
1403 [STAC_9200_DELL_D21] = {
1404 .type = HDA_FIXUP_PINS,
1405 .v.pins = dell9200_d21_pin_configs,
1406 },
1407 [STAC_9200_DELL_D22] = {
1408 .type = HDA_FIXUP_PINS,
1409 .v.pins = dell9200_d22_pin_configs,
1410 },
1411 [STAC_9200_DELL_D23] = {
1412 .type = HDA_FIXUP_PINS,
1413 .v.pins = dell9200_d23_pin_configs,
1414 },
1415 [STAC_9200_DELL_M21] = {
1416 .type = HDA_FIXUP_PINS,
1417 .v.pins = dell9200_m21_pin_configs,
1418 },
1419 [STAC_9200_DELL_M22] = {
1420 .type = HDA_FIXUP_PINS,
1421 .v.pins = dell9200_m22_pin_configs,
1422 },
1423 [STAC_9200_DELL_M23] = {
1424 .type = HDA_FIXUP_PINS,
1425 .v.pins = dell9200_m23_pin_configs,
1426 },
1427 [STAC_9200_DELL_M24] = {
1428 .type = HDA_FIXUP_PINS,
1429 .v.pins = dell9200_m24_pin_configs,
1430 },
1431 [STAC_9200_DELL_M25] = {
1432 .type = HDA_FIXUP_PINS,
1433 .v.pins = dell9200_m25_pin_configs,
1434 },
1435 [STAC_9200_DELL_M26] = {
1436 .type = HDA_FIXUP_PINS,
1437 .v.pins = dell9200_m26_pin_configs,
1438 },
1439 [STAC_9200_DELL_M27] = {
1440 .type = HDA_FIXUP_PINS,
1441 .v.pins = dell9200_m27_pin_configs,
1442 },
1443 [STAC_9200_M4] = {
1444 .type = HDA_FIXUP_PINS,
1445 .v.pins = gateway9200_m4_pin_configs,
1446 .chained = true,
1447 .chain_id = STAC_9200_EAPD_INIT,
1448 },
1449 [STAC_9200_M4_2] = {
1450 .type = HDA_FIXUP_PINS,
1451 .v.pins = gateway9200_m4_2_pin_configs,
1452 .chained = true,
1453 .chain_id = STAC_9200_EAPD_INIT,
1454 },
1455 [STAC_9200_PANASONIC] = {
1456 .type = HDA_FIXUP_FUNC,
1457 .v.func = stac9200_fixup_panasonic,
1458 },
1459 [STAC_9200_EAPD_INIT] = {
1460 .type = HDA_FIXUP_VERBS,
1461 .v.verbs = (const struct hda_verb[]) {
1462 {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1463 {}
1464 },
1465 },
Matt Porter403d1942005-11-29 15:00:51 +01001466};
1467
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001468static const struct hda_model_fixup stac9200_models[] = {
1469 { .id = STAC_REF, .name = "ref" },
1470 { .id = STAC_9200_OQO, .name = "oqo" },
1471 { .id = STAC_9200_DELL_D21, .name = "dell-d21" },
1472 { .id = STAC_9200_DELL_D22, .name = "dell-d22" },
1473 { .id = STAC_9200_DELL_D23, .name = "dell-d23" },
1474 { .id = STAC_9200_DELL_M21, .name = "dell-m21" },
1475 { .id = STAC_9200_DELL_M22, .name = "dell-m22" },
1476 { .id = STAC_9200_DELL_M23, .name = "dell-m23" },
1477 { .id = STAC_9200_DELL_M24, .name = "dell-m24" },
1478 { .id = STAC_9200_DELL_M25, .name = "dell-m25" },
1479 { .id = STAC_9200_DELL_M26, .name = "dell-m26" },
1480 { .id = STAC_9200_DELL_M27, .name = "dell-m27" },
1481 { .id = STAC_9200_M4, .name = "gateway-m4" },
1482 { .id = STAC_9200_M4_2, .name = "gateway-m4-2" },
1483 { .id = STAC_9200_PANASONIC, .name = "panasonic" },
1484 {}
Takashi Iwaif5fcc132006-11-24 17:07:44 +01001485};
1486
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01001487static const struct snd_pci_quirk stac9200_fixup_tbl[] = {
Takashi Iwaif5fcc132006-11-24 17:07:44 +01001488 /* SigmaTel reference board */
1489 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
1490 "DFI LanParty", STAC_REF),
Matthew Ranostay577aa2c2009-01-22 22:55:44 -05001491 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
1492 "DFI LanParty", STAC_REF),
Matt Portere7377072006-11-06 11:20:38 +01001493 /* Dell laptops have BIOS problem */
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001494 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8,
1495 "unknown Dell", STAC_9200_DELL_D21),
Takashi Iwaif5fcc132006-11-24 17:07:44 +01001496 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5,
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001497 "Dell Inspiron 630m", STAC_9200_DELL_M21),
1498 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bd,
1499 "Dell Inspiron E1505n", STAC_9200_DELL_M25),
1500 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c0,
1501 "unknown Dell", STAC_9200_DELL_D22),
1502 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c1,
1503 "unknown Dell", STAC_9200_DELL_D22),
Takashi Iwaif5fcc132006-11-24 17:07:44 +01001504 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2,
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001505 "Dell Latitude D620", STAC_9200_DELL_M22),
1506 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c5,
1507 "unknown Dell", STAC_9200_DELL_D23),
1508 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c7,
1509 "unknown Dell", STAC_9200_DELL_D23),
1510 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c8,
1511 "unknown Dell", STAC_9200_DELL_M22),
1512 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c9,
1513 "unknown Dell", STAC_9200_DELL_M24),
1514 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ca,
1515 "unknown Dell", STAC_9200_DELL_M24),
Takashi Iwaif5fcc132006-11-24 17:07:44 +01001516 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb,
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001517 "Dell Latitude 120L", STAC_9200_DELL_M24),
Cory T. Tusar877b8662007-01-30 17:30:55 +01001518 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc,
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001519 "Dell Latitude D820", STAC_9200_DELL_M22),
Mikael Nilsson46f02ca2007-02-13 12:46:16 +01001520 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cd,
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001521 "Dell Inspiron E1705/9400", STAC_9200_DELL_M27),
Mikael Nilsson46f02ca2007-02-13 12:46:16 +01001522 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce,
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001523 "Dell XPS M1710", STAC_9200_DELL_M23),
Takashi Iwaif0f96742007-02-14 00:59:17 +01001524 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf,
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001525 "Dell Precision M90", STAC_9200_DELL_M23),
1526 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d3,
1527 "unknown Dell", STAC_9200_DELL_M22),
1528 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d4,
1529 "unknown Dell", STAC_9200_DELL_M22),
Daniel T Chen8286c532007-05-15 11:46:23 +02001530 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6,
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001531 "unknown Dell", STAC_9200_DELL_M22),
Tobin Davis49c605d2007-05-17 09:38:24 +02001532 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8,
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001533 "Dell Inspiron 640m", STAC_9200_DELL_M21),
1534 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d9,
1535 "unknown Dell", STAC_9200_DELL_D23),
1536 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01da,
1537 "unknown Dell", STAC_9200_DELL_D23),
1538 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01de,
1539 "unknown Dell", STAC_9200_DELL_D21),
1540 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e3,
1541 "unknown Dell", STAC_9200_DELL_D23),
1542 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e8,
1543 "unknown Dell", STAC_9200_DELL_D21),
1544 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ee,
1545 "unknown Dell", STAC_9200_DELL_M25),
1546 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ef,
1547 "unknown Dell", STAC_9200_DELL_M25),
Tobin Davis49c605d2007-05-17 09:38:24 +02001548 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5,
Takashi Iwaidfe495d2007-08-23 19:04:28 +02001549 "Dell Inspiron 1501", STAC_9200_DELL_M26),
1550 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6,
1551 "unknown Dell", STAC_9200_DELL_M26),
Tobin Davis49c605d2007-05-17 09:38:24 +02001552 /* Panasonic */
Takashi Iwai117f2572008-03-18 09:53:23 +01001553 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC),
Takashi Iwai1194b5b2007-10-10 10:04:26 +02001554 /* Gateway machines needs EAPD to be set on resume */
Mauro Carvalho Chehab58eec422008-08-11 10:18:39 +02001555 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_M4),
1556 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", STAC_9200_M4_2),
1557 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", STAC_9200_M4_2),
Tobin Davisbf277782008-02-03 20:31:47 +01001558 /* OQO Mobile */
1559 SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO),
Matt Porter403d1942005-11-29 15:00:51 +01001560 {} /* terminator */
1561};
1562
Takashi Iwaid2077d42013-01-14 14:20:16 +01001563static const struct hda_pintbl ref925x_pin_configs[] = {
1564 { 0x07, 0x40c003f0 },
1565 { 0x08, 0x424503f2 },
1566 { 0x0a, 0x01813022 },
1567 { 0x0b, 0x02a19021 },
1568 { 0x0c, 0x90a70320 },
1569 { 0x0d, 0x02214210 },
1570 { 0x10, 0x01019020 },
1571 { 0x11, 0x9033032e },
1572 {}
Tobin Davis8e21c342007-01-08 11:04:17 +01001573};
1574
Takashi Iwaid2077d42013-01-14 14:20:16 +01001575static const struct hda_pintbl stac925xM1_pin_configs[] = {
1576 { 0x07, 0x40c003f4 },
1577 { 0x08, 0x424503f2 },
1578 { 0x0a, 0x400000f3 },
1579 { 0x0b, 0x02a19020 },
1580 { 0x0c, 0x40a000f0 },
1581 { 0x0d, 0x90100210 },
1582 { 0x10, 0x400003f1 },
1583 { 0x11, 0x9033032e },
1584 {}
Tobin Davis8e21c342007-01-08 11:04:17 +01001585};
1586
Takashi Iwaid2077d42013-01-14 14:20:16 +01001587static const struct hda_pintbl stac925xM1_2_pin_configs[] = {
1588 { 0x07, 0x40c003f4 },
1589 { 0x08, 0x424503f2 },
1590 { 0x0a, 0x400000f3 },
1591 { 0x0b, 0x02a19020 },
1592 { 0x0c, 0x40a000f0 },
1593 { 0x0d, 0x90100210 },
1594 { 0x10, 0x400003f1 },
1595 { 0x11, 0x9033032e },
1596 {}
Mauro Carvalho Chehab9cb36c22008-08-11 10:18:39 +02001597};
Mauro Carvalho Chehab58eec422008-08-11 10:18:39 +02001598
Takashi Iwaid2077d42013-01-14 14:20:16 +01001599static const struct hda_pintbl stac925xM2_pin_configs[] = {
1600 { 0x07, 0x40c003f4 },
1601 { 0x08, 0x424503f2 },
1602 { 0x0a, 0x400000f3 },
1603 { 0x0b, 0x02a19020 },
1604 { 0x0c, 0x40a000f0 },
1605 { 0x0d, 0x90100210 },
1606 { 0x10, 0x400003f1 },
1607 { 0x11, 0x9033032e },
1608 {}
Tobin Davis2c11f952007-05-17 09:36:34 +02001609};
1610
Takashi Iwaid2077d42013-01-14 14:20:16 +01001611static const struct hda_pintbl stac925xM2_2_pin_configs[] = {
1612 { 0x07, 0x40c003f4 },
1613 { 0x08, 0x424503f2 },
1614 { 0x0a, 0x400000f3 },
1615 { 0x0b, 0x02a19020 },
1616 { 0x0c, 0x40a000f0 },
1617 { 0x0d, 0x90100210 },
1618 { 0x10, 0x400003f1 },
1619 { 0x11, 0x9033032e },
1620 {}
Mauro Carvalho Chehab58eec422008-08-11 10:18:39 +02001621};
1622
Takashi Iwaid2077d42013-01-14 14:20:16 +01001623static const struct hda_pintbl stac925xM3_pin_configs[] = {
1624 { 0x07, 0x40c003f4 },
1625 { 0x08, 0x424503f2 },
1626 { 0x0a, 0x400000f3 },
1627 { 0x0b, 0x02a19020 },
1628 { 0x0c, 0x40a000f0 },
1629 { 0x0d, 0x90100210 },
1630 { 0x10, 0x400003f1 },
1631 { 0x11, 0x503303f3 },
1632 {}
Mauro Carvalho Chehab9cb36c22008-08-11 10:18:39 +02001633};
Mauro Carvalho Chehab58eec422008-08-11 10:18:39 +02001634
Takashi Iwaid2077d42013-01-14 14:20:16 +01001635static const struct hda_pintbl stac925xM5_pin_configs[] = {
1636 { 0x07, 0x40c003f4 },
1637 { 0x08, 0x424503f2 },
1638 { 0x0a, 0x400000f3 },
1639 { 0x0b, 0x02a19020 },
1640 { 0x0c, 0x40a000f0 },
1641 { 0x0d, 0x90100210 },
1642 { 0x10, 0x400003f1 },
1643 { 0x11, 0x9033032e },
1644 {}
Mauro Carvalho Chehab9cb36c22008-08-11 10:18:39 +02001645};
1646
Takashi Iwaid2077d42013-01-14 14:20:16 +01001647static const struct hda_pintbl stac925xM6_pin_configs[] = {
1648 { 0x07, 0x40c003f4 },
1649 { 0x08, 0x424503f2 },
1650 { 0x0a, 0x400000f3 },
1651 { 0x0b, 0x02a19020 },
1652 { 0x0c, 0x40a000f0 },
1653 { 0x0d, 0x90100210 },
1654 { 0x10, 0x400003f1 },
1655 { 0x11, 0x90330320 },
1656 {}
Tobin Davis8e21c342007-01-08 11:04:17 +01001657};
1658
Takashi Iwaid2077d42013-01-14 14:20:16 +01001659static const struct hda_fixup stac925x_fixups[] = {
1660 [STAC_REF] = {
1661 .type = HDA_FIXUP_PINS,
1662 .v.pins = ref925x_pin_configs,
1663 },
1664 [STAC_M1] = {
1665 .type = HDA_FIXUP_PINS,
1666 .v.pins = stac925xM1_pin_configs,
1667 },
1668 [STAC_M1_2] = {
1669 .type = HDA_FIXUP_PINS,
1670 .v.pins = stac925xM1_2_pin_configs,
1671 },
1672 [STAC_M2] = {
1673 .type = HDA_FIXUP_PINS,
1674 .v.pins = stac925xM2_pin_configs,
1675 },
1676 [STAC_M2_2] = {
1677 .type = HDA_FIXUP_PINS,
1678 .v.pins = stac925xM2_2_pin_configs,
1679 },
1680 [STAC_M3] = {
1681 .type = HDA_FIXUP_PINS,
1682 .v.pins = stac925xM3_pin_configs,
1683 },
1684 [STAC_M5] = {
1685 .type = HDA_FIXUP_PINS,
1686 .v.pins = stac925xM5_pin_configs,
1687 },
1688 [STAC_M6] = {
1689 .type = HDA_FIXUP_PINS,
1690 .v.pins = stac925xM6_pin_configs,
1691 },
Tobin Davis8e21c342007-01-08 11:04:17 +01001692};
1693
Takashi Iwaid2077d42013-01-14 14:20:16 +01001694static const struct hda_model_fixup stac925x_models[] = {
1695 { .id = STAC_REF, .name = "ref" },
1696 { .id = STAC_M1, .name = "m1" },
1697 { .id = STAC_M1_2, .name = "m1-2" },
1698 { .id = STAC_M2, .name = "m2" },
1699 { .id = STAC_M2_2, .name = "m2-2" },
1700 { .id = STAC_M3, .name = "m3" },
1701 { .id = STAC_M5, .name = "m5" },
1702 { .id = STAC_M6, .name = "m6" },
1703 {}
Tobin Davis8e21c342007-01-08 11:04:17 +01001704};
1705
Takashi Iwaid2077d42013-01-14 14:20:16 +01001706static const struct snd_pci_quirk stac925x_fixup_tbl[] = {
1707 /* SigmaTel reference board */
1708 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF),
1709 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, "DFI LanParty", STAC_REF),
1710 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF),
1711
1712 /* Default table for unknown ID */
1713 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway mobile", STAC_M2_2),
1714
1715 /* gateway machines are checked via codec ssid */
Mauro Carvalho Chehab58eec422008-08-11 10:18:39 +02001716 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_M2),
1717 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_M5),
1718 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_M1),
1719 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_M2),
Mauro Carvalho Chehab9cb36c22008-08-11 10:18:39 +02001720 SND_PCI_QUIRK(0x107b, 0x0367, "Gateway MX6453", STAC_M1_2),
Mauro Carvalho Chehab9cb36c22008-08-11 10:18:39 +02001721 /* Not sure about the brand name for those */
1722 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M1),
1723 SND_PCI_QUIRK(0x107b, 0x0507, "Gateway mobile", STAC_M3),
1724 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M6),
1725 SND_PCI_QUIRK(0x107b, 0x0685, "Gateway mobile", STAC_M2_2),
Mauro Carvalho Chehab9cb36c22008-08-11 10:18:39 +02001726 {} /* terminator */
Tobin Davis8e21c342007-01-08 11:04:17 +01001727};
1728
Takashi Iwai55e30142013-01-14 17:30:04 +01001729static const struct hda_pintbl ref92hd73xx_pin_configs[] = {
1730 { 0x0a, 0x02214030 },
1731 { 0x0b, 0x02a19040 },
1732 { 0x0c, 0x01a19020 },
1733 { 0x0d, 0x02214030 },
1734 { 0x0e, 0x0181302e },
1735 { 0x0f, 0x01014010 },
1736 { 0x10, 0x01014020 },
1737 { 0x11, 0x01014030 },
1738 { 0x12, 0x02319040 },
1739 { 0x13, 0x90a000f0 },
1740 { 0x14, 0x90a000f0 },
1741 { 0x22, 0x01452050 },
1742 { 0x23, 0x01452050 },
1743 {}
Matthew Ranostaya7662642008-02-21 07:51:14 +01001744};
1745
Takashi Iwai55e30142013-01-14 17:30:04 +01001746static const struct hda_pintbl dell_m6_pin_configs[] = {
1747 { 0x0a, 0x0321101f },
1748 { 0x0b, 0x4f00000f },
1749 { 0x0c, 0x4f0000f0 },
1750 { 0x0d, 0x90170110 },
1751 { 0x0e, 0x03a11020 },
1752 { 0x0f, 0x0321101f },
1753 { 0x10, 0x4f0000f0 },
1754 { 0x11, 0x4f0000f0 },
1755 { 0x12, 0x4f0000f0 },
1756 { 0x13, 0x90a60160 },
1757 { 0x14, 0x4f0000f0 },
1758 { 0x22, 0x4f0000f0 },
1759 { 0x23, 0x4f0000f0 },
1760 {}
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01001761};
1762
Takashi Iwai55e30142013-01-14 17:30:04 +01001763static const struct hda_pintbl alienware_m17x_pin_configs[] = {
1764 { 0x0a, 0x0321101f },
1765 { 0x0b, 0x0321101f },
1766 { 0x0c, 0x03a11020 },
1767 { 0x0d, 0x03014020 },
1768 { 0x0e, 0x90170110 },
1769 { 0x0f, 0x4f0000f0 },
1770 { 0x10, 0x4f0000f0 },
1771 { 0x11, 0x4f0000f0 },
1772 { 0x12, 0x4f0000f0 },
1773 { 0x13, 0x90a60160 },
1774 { 0x14, 0x4f0000f0 },
1775 { 0x22, 0x4f0000f0 },
1776 { 0x23, 0x904601b0 },
1777 {}
Takashi Iwai842ae632009-09-02 07:43:08 +02001778};
1779
Takashi Iwai55e30142013-01-14 17:30:04 +01001780static const struct hda_pintbl intel_dg45id_pin_configs[] = {
1781 { 0x0a, 0x02214230 },
1782 { 0x0b, 0x02A19240 },
1783 { 0x0c, 0x01013214 },
1784 { 0x0d, 0x01014210 },
1785 { 0x0e, 0x01A19250 },
1786 { 0x0f, 0x01011212 },
1787 { 0x10, 0x01016211 },
1788 {}
Alexey Fisher52dc4382009-12-12 11:16:41 +02001789};
1790
Takashi Iwai55e30142013-01-14 17:30:04 +01001791static void stac92hd73xx_fixup_ref(struct hda_codec *codec,
1792 const struct hda_fixup *fix, int action)
1793{
1794 struct sigmatel_spec *spec = codec->spec;
1795
1796 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1797 return;
1798
1799 snd_hda_apply_pincfgs(codec, ref92hd73xx_pin_configs);
1800 spec->gpio_mask = spec->gpio_dir = spec->gpio_data = 0;
1801}
1802
1803static void stac92hd73xx_fixup_dell(struct hda_codec *codec)
1804{
1805 struct sigmatel_spec *spec = codec->spec;
1806
1807 snd_hda_apply_pincfgs(codec, dell_m6_pin_configs);
Takashi Iwai55e30142013-01-14 17:30:04 +01001808 spec->eapd_switch = 0;
1809}
1810
1811static void stac92hd73xx_fixup_dell_eq(struct hda_codec *codec,
1812 const struct hda_fixup *fix, int action)
1813{
1814 struct sigmatel_spec *spec = codec->spec;
1815
1816 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1817 return;
1818
1819 stac92hd73xx_fixup_dell(codec);
1820 snd_hda_add_verbs(codec, dell_eq_core_init);
1821 spec->volknob_init = 1;
1822}
1823
1824/* Analog Mics */
1825static void stac92hd73xx_fixup_dell_m6_amic(struct hda_codec *codec,
1826 const struct hda_fixup *fix, int action)
1827{
Takashi Iwai55e30142013-01-14 17:30:04 +01001828 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1829 return;
1830
1831 stac92hd73xx_fixup_dell(codec);
1832 snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170);
Takashi Iwai55e30142013-01-14 17:30:04 +01001833}
1834
1835/* Digital Mics */
1836static void stac92hd73xx_fixup_dell_m6_dmic(struct hda_codec *codec,
1837 const struct hda_fixup *fix, int action)
1838{
Takashi Iwai55e30142013-01-14 17:30:04 +01001839 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1840 return;
1841
1842 stac92hd73xx_fixup_dell(codec);
1843 snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160);
Takashi Iwai55e30142013-01-14 17:30:04 +01001844}
1845
1846/* Both */
1847static void stac92hd73xx_fixup_dell_m6_both(struct hda_codec *codec,
1848 const struct hda_fixup *fix, int action)
1849{
Takashi Iwai55e30142013-01-14 17:30:04 +01001850 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1851 return;
1852
1853 stac92hd73xx_fixup_dell(codec);
1854 snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170);
1855 snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160);
Takashi Iwai55e30142013-01-14 17:30:04 +01001856}
1857
1858static void stac92hd73xx_fixup_alienware_m17x(struct hda_codec *codec,
1859 const struct hda_fixup *fix, int action)
1860{
1861 struct sigmatel_spec *spec = codec->spec;
1862
1863 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1864 return;
1865
1866 snd_hda_apply_pincfgs(codec, alienware_m17x_pin_configs);
Takashi Iwai55e30142013-01-14 17:30:04 +01001867 spec->eapd_switch = 0;
1868}
1869
1870static void stac92hd73xx_fixup_no_jd(struct hda_codec *codec,
1871 const struct hda_fixup *fix, int action)
1872{
Takashi Iwai36c9db72013-01-17 17:07:59 +01001873 if (action == HDA_FIXUP_ACT_PRE_PROBE)
1874 codec->no_jack_detect = 1;
Takashi Iwai55e30142013-01-14 17:30:04 +01001875}
1876
1877static const struct hda_fixup stac92hd73xx_fixups[] = {
1878 [STAC_92HD73XX_REF] = {
1879 .type = HDA_FIXUP_FUNC,
1880 .v.func = stac92hd73xx_fixup_ref,
1881 },
1882 [STAC_DELL_M6_AMIC] = {
1883 .type = HDA_FIXUP_FUNC,
1884 .v.func = stac92hd73xx_fixup_dell_m6_amic,
1885 },
1886 [STAC_DELL_M6_DMIC] = {
1887 .type = HDA_FIXUP_FUNC,
1888 .v.func = stac92hd73xx_fixup_dell_m6_dmic,
1889 },
1890 [STAC_DELL_M6_BOTH] = {
1891 .type = HDA_FIXUP_FUNC,
1892 .v.func = stac92hd73xx_fixup_dell_m6_both,
1893 },
1894 [STAC_DELL_EQ] = {
1895 .type = HDA_FIXUP_FUNC,
1896 .v.func = stac92hd73xx_fixup_dell_eq,
1897 },
1898 [STAC_ALIENWARE_M17X] = {
1899 .type = HDA_FIXUP_FUNC,
1900 .v.func = stac92hd73xx_fixup_alienware_m17x,
1901 },
1902 [STAC_92HD73XX_INTEL] = {
1903 .type = HDA_FIXUP_PINS,
1904 .v.pins = intel_dg45id_pin_configs,
1905 },
1906 [STAC_92HD73XX_NO_JD] = {
1907 .type = HDA_FIXUP_FUNC,
1908 .v.func = stac92hd73xx_fixup_no_jd,
1909 }
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01001910};
1911
Takashi Iwai55e30142013-01-14 17:30:04 +01001912static const struct hda_model_fixup stac92hd73xx_models[] = {
1913 { .id = STAC_92HD73XX_NO_JD, .name = "no-jd" },
1914 { .id = STAC_92HD73XX_REF, .name = "ref" },
1915 { .id = STAC_92HD73XX_INTEL, .name = "intel" },
1916 { .id = STAC_DELL_M6_AMIC, .name = "dell-m6-amic" },
1917 { .id = STAC_DELL_M6_DMIC, .name = "dell-m6-dmic" },
1918 { .id = STAC_DELL_M6_BOTH, .name = "dell-m6" },
1919 { .id = STAC_DELL_EQ, .name = "dell-eq" },
1920 { .id = STAC_ALIENWARE_M17X, .name = "alienware" },
1921 {}
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01001922};
1923
Takashi Iwai55e30142013-01-14 17:30:04 +01001924static const struct snd_pci_quirk stac92hd73xx_fixup_tbl[] = {
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01001925 /* SigmaTel reference board */
1926 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
Matthew Ranostaya7662642008-02-21 07:51:14 +01001927 "DFI LanParty", STAC_92HD73XX_REF),
Matthew Ranostay577aa2c2009-01-22 22:55:44 -05001928 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
1929 "DFI LanParty", STAC_92HD73XX_REF),
Wu Fengguangae709442009-08-19 17:05:11 +08001930 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5002,
1931 "Intel DG45ID", STAC_92HD73XX_INTEL),
1932 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5003,
1933 "Intel DG45FC", STAC_92HD73XX_INTEL),
Matthew Ranostaya7662642008-02-21 07:51:14 +01001934 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254,
Takashi Iwai661cd8f2008-11-25 15:18:29 +01001935 "Dell Studio 1535", STAC_DELL_M6_DMIC),
Matthew Ranostaya7662642008-02-21 07:51:14 +01001936 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255,
Takashi Iwai661cd8f2008-11-25 15:18:29 +01001937 "unknown Dell", STAC_DELL_M6_DMIC),
Matthew Ranostaya7662642008-02-21 07:51:14 +01001938 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256,
Takashi Iwai661cd8f2008-11-25 15:18:29 +01001939 "unknown Dell", STAC_DELL_M6_BOTH),
Matthew Ranostaya7662642008-02-21 07:51:14 +01001940 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257,
Takashi Iwai661cd8f2008-11-25 15:18:29 +01001941 "unknown Dell", STAC_DELL_M6_BOTH),
Matthew Ranostaya7662642008-02-21 07:51:14 +01001942 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e,
Takashi Iwai661cd8f2008-11-25 15:18:29 +01001943 "unknown Dell", STAC_DELL_M6_AMIC),
Matthew Ranostaya7662642008-02-21 07:51:14 +01001944 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f,
Takashi Iwai661cd8f2008-11-25 15:18:29 +01001945 "unknown Dell", STAC_DELL_M6_AMIC),
Matthew Ranostaya7662642008-02-21 07:51:14 +01001946 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271,
Takashi Iwai661cd8f2008-11-25 15:18:29 +01001947 "unknown Dell", STAC_DELL_M6_DMIC),
1948 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0272,
1949 "unknown Dell", STAC_DELL_M6_DMIC),
Takashi Iwaib0fc5e02008-11-21 08:37:03 +01001950 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x029f,
Takashi Iwai661cd8f2008-11-25 15:18:29 +01001951 "Dell Studio 1537", STAC_DELL_M6_DMIC),
Joerg Schirottkefa620e92008-12-19 08:13:49 +01001952 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a0,
1953 "Dell Studio 17", STAC_DELL_M6_DMIC),
Takashi Iwai626f5ce2009-07-28 00:54:39 +02001954 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02be,
1955 "Dell Studio 1555", STAC_DELL_M6_DMIC),
Daniel J Blueman8ef58372009-11-14 18:20:04 +00001956 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02bd,
1957 "Dell Studio 1557", STAC_DELL_M6_DMIC),
Daniel T Chenaac78da2010-04-21 20:41:52 -04001958 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02fe,
David Henningssonffe535e2012-01-16 10:52:20 +01001959 "Dell Studio XPS 1645", STAC_DELL_M6_DMIC),
Daniel T Chen5c1bccf2010-04-22 17:54:45 -04001960 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0413,
David Henningssone033ebf2011-05-16 12:09:29 +02001961 "Dell Studio 1558", STAC_DELL_M6_DMIC),
Takashi Iwai55e30142013-01-14 17:30:04 +01001962 /* codec SSID matching */
Takashi Iwai842ae632009-09-02 07:43:08 +02001963 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a1,
1964 "Alienware M17x", STAC_ALIENWARE_M17X),
Daniel T Chen0defe092010-12-01 19:16:07 -05001965 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a,
1966 "Alienware M17x", STAC_ALIENWARE_M17X),
Takashi Iwaidbd1b542011-11-19 11:41:30 +01001967 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0490,
Albert Poolb9ecc4e2012-01-19 22:08:50 +01001968 "Alienware M17x R3", STAC_DELL_EQ),
Takashi Iwai842ae632009-09-02 07:43:08 +02001969 {} /* terminator */
1970};
1971
Takashi Iwai372f8c72013-01-14 18:06:34 +01001972static const struct hda_pintbl ref92hd83xxx_pin_configs[] = {
1973 { 0x0a, 0x02214030 },
1974 { 0x0b, 0x02211010 },
1975 { 0x0c, 0x02a19020 },
1976 { 0x0d, 0x02170130 },
1977 { 0x0e, 0x01014050 },
1978 { 0x0f, 0x01819040 },
1979 { 0x10, 0x01014020 },
1980 { 0x11, 0x90a3014e },
1981 { 0x1f, 0x01451160 },
1982 { 0x20, 0x98560170 },
1983 {}
Matthew Ranostayd0513fc2008-07-27 10:30:30 +02001984};
1985
Takashi Iwai372f8c72013-01-14 18:06:34 +01001986static const struct hda_pintbl dell_s14_pin_configs[] = {
1987 { 0x0a, 0x0221403f },
1988 { 0x0b, 0x0221101f },
1989 { 0x0c, 0x02a19020 },
1990 { 0x0d, 0x90170110 },
1991 { 0x0e, 0x40f000f0 },
1992 { 0x0f, 0x40f000f0 },
1993 { 0x10, 0x40f000f0 },
1994 { 0x11, 0x90a60160 },
1995 { 0x1f, 0x40f000f0 },
1996 { 0x20, 0x40f000f0 },
1997 {}
Matthew Ranostay8bb0ac52009-02-12 16:50:01 -05001998};
1999
Takashi Iwai372f8c72013-01-14 18:06:34 +01002000static const struct hda_pintbl dell_vostro_3500_pin_configs[] = {
2001 { 0x0a, 0x02a11020 },
2002 { 0x0b, 0x0221101f },
2003 { 0x0c, 0x400000f0 },
2004 { 0x0d, 0x90170110 },
2005 { 0x0e, 0x400000f1 },
2006 { 0x0f, 0x400000f2 },
2007 { 0x10, 0x400000f3 },
2008 { 0x11, 0x90a60160 },
2009 { 0x1f, 0x400000f4 },
2010 { 0x20, 0x400000f5 },
2011 {}
Julian Wollrathf7f9bdf2011-11-09 10:02:40 +01002012};
2013
Takashi Iwai372f8c72013-01-14 18:06:34 +01002014static const struct hda_pintbl hp_dv7_4000_pin_configs[] = {
2015 { 0x0a, 0x03a12050 },
2016 { 0x0b, 0x0321201f },
2017 { 0x0c, 0x40f000f0 },
2018 { 0x0d, 0x90170110 },
2019 { 0x0e, 0x40f000f0 },
2020 { 0x0f, 0x40f000f0 },
2021 { 0x10, 0x90170110 },
2022 { 0x11, 0xd5a30140 },
2023 { 0x1f, 0x40f000f0 },
2024 { 0x20, 0x40f000f0 },
2025 {}
Steven Eastland48315592010-08-06 15:07:35 -06002026};
2027
Takashi Iwai372f8c72013-01-14 18:06:34 +01002028static const struct hda_pintbl hp_zephyr_pin_configs[] = {
2029 { 0x0a, 0x01813050 },
2030 { 0x0b, 0x0421201f },
2031 { 0x0c, 0x04a1205e },
2032 { 0x0d, 0x96130310 },
2033 { 0x0e, 0x96130310 },
2034 { 0x0f, 0x0101401f },
2035 { 0x10, 0x1111611f },
2036 { 0x11, 0xd5a30130 },
2037 {}
Vitaliy Kulikov5556e142012-02-27 16:47:37 -06002038};
2039
Takashi Iwai372f8c72013-01-14 18:06:34 +01002040static const struct hda_pintbl hp_cNB11_intquad_pin_configs[] = {
2041 { 0x0a, 0x40f000f0 },
2042 { 0x0b, 0x0221101f },
2043 { 0x0c, 0x02a11020 },
2044 { 0x0d, 0x92170110 },
2045 { 0x0e, 0x40f000f0 },
2046 { 0x0f, 0x92170110 },
2047 { 0x10, 0x40f000f0 },
2048 { 0x11, 0xd5a30130 },
2049 { 0x1f, 0x40f000f0 },
2050 { 0x20, 0x40f000f0 },
2051 {}
Vitaliy Kulikov0c27c182011-07-22 17:50:37 -05002052};
2053
Takashi Iwai372f8c72013-01-14 18:06:34 +01002054static void stac92hd83xxx_fixup_hp(struct hda_codec *codec,
2055 const struct hda_fixup *fix, int action)
2056{
2057 struct sigmatel_spec *spec = codec->spec;
2058
2059 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2060 return;
2061
2062 if (hp_bnb2011_with_dock(codec)) {
2063 snd_hda_codec_set_pincfg(codec, 0xa, 0x2101201f);
2064 snd_hda_codec_set_pincfg(codec, 0xf, 0x2181205e);
2065 }
2066
2067 if (find_mute_led_cfg(codec, spec->default_polarity))
2068 snd_printd("mute LED gpio %d polarity %d\n",
2069 spec->gpio_led,
2070 spec->gpio_led_polarity);
2071}
2072
2073static void stac92hd83xxx_fixup_hp_zephyr(struct hda_codec *codec,
2074 const struct hda_fixup *fix, int action)
2075{
2076 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2077 return;
2078
2079 snd_hda_apply_pincfgs(codec, hp_zephyr_pin_configs);
2080 snd_hda_add_verbs(codec, stac92hd83xxx_hp_zephyr_init);
2081}
2082
2083static void stac92hd83xxx_fixup_hp_led(struct hda_codec *codec,
2084 const struct hda_fixup *fix, int action)
2085{
2086 struct sigmatel_spec *spec = codec->spec;
2087
2088 if (action == HDA_FIXUP_ACT_PRE_PROBE)
2089 spec->default_polarity = 0;
2090}
2091
2092static void stac92hd83xxx_fixup_hp_inv_led(struct hda_codec *codec,
2093 const struct hda_fixup *fix, int action)
2094{
2095 struct sigmatel_spec *spec = codec->spec;
2096
2097 if (action == HDA_FIXUP_ACT_PRE_PROBE)
2098 spec->default_polarity = 1;
2099}
2100
2101static void stac92hd83xxx_fixup_hp_mic_led(struct hda_codec *codec,
2102 const struct hda_fixup *fix, int action)
2103{
2104 struct sigmatel_spec *spec = codec->spec;
2105
Takashi Iwai95f74c42013-10-24 01:24:15 +02002106 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai372f8c72013-01-14 18:06:34 +01002107 spec->mic_mute_led_gpio = 0x08; /* GPIO3 */
Takashi Iwai873ce8a2013-11-26 11:58:40 +01002108 /* resetting controller clears GPIO, so we need to keep on */
2109 codec->bus->power_keep_link_on = 1;
Takashi Iwai95f74c42013-10-24 01:24:15 +02002110 }
Takashi Iwai372f8c72013-01-14 18:06:34 +01002111}
2112
2113static void stac92hd83xxx_fixup_headset_jack(struct hda_codec *codec,
2114 const struct hda_fixup *fix, int action)
2115{
2116 struct sigmatel_spec *spec = codec->spec;
2117
2118 if (action == HDA_FIXUP_ACT_PRE_PROBE)
2119 spec->headset_jack = 1;
2120}
2121
Vitaliy Kulikovd009f3d2013-11-14 11:52:16 -06002122static const struct hda_verb hp_bnb13_eq_verbs[] = {
2123 /* 44.1KHz base */
2124 { 0x22, 0x7A6, 0x3E },
2125 { 0x22, 0x7A7, 0x68 },
2126 { 0x22, 0x7A8, 0x17 },
2127 { 0x22, 0x7A9, 0x3E },
2128 { 0x22, 0x7AA, 0x68 },
2129 { 0x22, 0x7AB, 0x17 },
2130 { 0x22, 0x7AC, 0x00 },
2131 { 0x22, 0x7AD, 0x80 },
2132 { 0x22, 0x7A6, 0x83 },
2133 { 0x22, 0x7A7, 0x2F },
2134 { 0x22, 0x7A8, 0xD1 },
2135 { 0x22, 0x7A9, 0x83 },
2136 { 0x22, 0x7AA, 0x2F },
2137 { 0x22, 0x7AB, 0xD1 },
2138 { 0x22, 0x7AC, 0x01 },
2139 { 0x22, 0x7AD, 0x80 },
2140 { 0x22, 0x7A6, 0x3E },
2141 { 0x22, 0x7A7, 0x68 },
2142 { 0x22, 0x7A8, 0x17 },
2143 { 0x22, 0x7A9, 0x3E },
2144 { 0x22, 0x7AA, 0x68 },
2145 { 0x22, 0x7AB, 0x17 },
2146 { 0x22, 0x7AC, 0x02 },
2147 { 0x22, 0x7AD, 0x80 },
2148 { 0x22, 0x7A6, 0x7C },
2149 { 0x22, 0x7A7, 0xC6 },
2150 { 0x22, 0x7A8, 0x0C },
2151 { 0x22, 0x7A9, 0x7C },
2152 { 0x22, 0x7AA, 0xC6 },
2153 { 0x22, 0x7AB, 0x0C },
2154 { 0x22, 0x7AC, 0x03 },
2155 { 0x22, 0x7AD, 0x80 },
2156 { 0x22, 0x7A6, 0xC3 },
2157 { 0x22, 0x7A7, 0x25 },
2158 { 0x22, 0x7A8, 0xAF },
2159 { 0x22, 0x7A9, 0xC3 },
2160 { 0x22, 0x7AA, 0x25 },
2161 { 0x22, 0x7AB, 0xAF },
2162 { 0x22, 0x7AC, 0x04 },
2163 { 0x22, 0x7AD, 0x80 },
2164 { 0x22, 0x7A6, 0x3E },
2165 { 0x22, 0x7A7, 0x85 },
2166 { 0x22, 0x7A8, 0x73 },
2167 { 0x22, 0x7A9, 0x3E },
2168 { 0x22, 0x7AA, 0x85 },
2169 { 0x22, 0x7AB, 0x73 },
2170 { 0x22, 0x7AC, 0x05 },
2171 { 0x22, 0x7AD, 0x80 },
2172 { 0x22, 0x7A6, 0x85 },
2173 { 0x22, 0x7A7, 0x39 },
2174 { 0x22, 0x7A8, 0xC7 },
2175 { 0x22, 0x7A9, 0x85 },
2176 { 0x22, 0x7AA, 0x39 },
2177 { 0x22, 0x7AB, 0xC7 },
2178 { 0x22, 0x7AC, 0x06 },
2179 { 0x22, 0x7AD, 0x80 },
2180 { 0x22, 0x7A6, 0x3C },
2181 { 0x22, 0x7A7, 0x90 },
2182 { 0x22, 0x7A8, 0xB0 },
2183 { 0x22, 0x7A9, 0x3C },
2184 { 0x22, 0x7AA, 0x90 },
2185 { 0x22, 0x7AB, 0xB0 },
2186 { 0x22, 0x7AC, 0x07 },
2187 { 0x22, 0x7AD, 0x80 },
2188 { 0x22, 0x7A6, 0x7A },
2189 { 0x22, 0x7A7, 0xC6 },
2190 { 0x22, 0x7A8, 0x39 },
2191 { 0x22, 0x7A9, 0x7A },
2192 { 0x22, 0x7AA, 0xC6 },
2193 { 0x22, 0x7AB, 0x39 },
2194 { 0x22, 0x7AC, 0x08 },
2195 { 0x22, 0x7AD, 0x80 },
2196 { 0x22, 0x7A6, 0xC4 },
2197 { 0x22, 0x7A7, 0xE9 },
2198 { 0x22, 0x7A8, 0xDC },
2199 { 0x22, 0x7A9, 0xC4 },
2200 { 0x22, 0x7AA, 0xE9 },
2201 { 0x22, 0x7AB, 0xDC },
2202 { 0x22, 0x7AC, 0x09 },
2203 { 0x22, 0x7AD, 0x80 },
2204 { 0x22, 0x7A6, 0x3D },
2205 { 0x22, 0x7A7, 0xE1 },
2206 { 0x22, 0x7A8, 0x0D },
2207 { 0x22, 0x7A9, 0x3D },
2208 { 0x22, 0x7AA, 0xE1 },
2209 { 0x22, 0x7AB, 0x0D },
2210 { 0x22, 0x7AC, 0x0A },
2211 { 0x22, 0x7AD, 0x80 },
2212 { 0x22, 0x7A6, 0x89 },
2213 { 0x22, 0x7A7, 0xB6 },
2214 { 0x22, 0x7A8, 0xEB },
2215 { 0x22, 0x7A9, 0x89 },
2216 { 0x22, 0x7AA, 0xB6 },
2217 { 0x22, 0x7AB, 0xEB },
2218 { 0x22, 0x7AC, 0x0B },
2219 { 0x22, 0x7AD, 0x80 },
2220 { 0x22, 0x7A6, 0x39 },
2221 { 0x22, 0x7A7, 0x9D },
2222 { 0x22, 0x7A8, 0xFE },
2223 { 0x22, 0x7A9, 0x39 },
2224 { 0x22, 0x7AA, 0x9D },
2225 { 0x22, 0x7AB, 0xFE },
2226 { 0x22, 0x7AC, 0x0C },
2227 { 0x22, 0x7AD, 0x80 },
2228 { 0x22, 0x7A6, 0x76 },
2229 { 0x22, 0x7A7, 0x49 },
2230 { 0x22, 0x7A8, 0x15 },
2231 { 0x22, 0x7A9, 0x76 },
2232 { 0x22, 0x7AA, 0x49 },
2233 { 0x22, 0x7AB, 0x15 },
2234 { 0x22, 0x7AC, 0x0D },
2235 { 0x22, 0x7AD, 0x80 },
2236 { 0x22, 0x7A6, 0xC8 },
2237 { 0x22, 0x7A7, 0x80 },
2238 { 0x22, 0x7A8, 0xF5 },
2239 { 0x22, 0x7A9, 0xC8 },
2240 { 0x22, 0x7AA, 0x80 },
2241 { 0x22, 0x7AB, 0xF5 },
2242 { 0x22, 0x7AC, 0x0E },
2243 { 0x22, 0x7AD, 0x80 },
2244 { 0x22, 0x7A6, 0x40 },
2245 { 0x22, 0x7A7, 0x00 },
2246 { 0x22, 0x7A8, 0x00 },
2247 { 0x22, 0x7A9, 0x40 },
2248 { 0x22, 0x7AA, 0x00 },
2249 { 0x22, 0x7AB, 0x00 },
2250 { 0x22, 0x7AC, 0x0F },
2251 { 0x22, 0x7AD, 0x80 },
2252 { 0x22, 0x7A6, 0x90 },
2253 { 0x22, 0x7A7, 0x68 },
2254 { 0x22, 0x7A8, 0xF1 },
2255 { 0x22, 0x7A9, 0x90 },
2256 { 0x22, 0x7AA, 0x68 },
2257 { 0x22, 0x7AB, 0xF1 },
2258 { 0x22, 0x7AC, 0x10 },
2259 { 0x22, 0x7AD, 0x80 },
2260 { 0x22, 0x7A6, 0x34 },
2261 { 0x22, 0x7A7, 0x47 },
2262 { 0x22, 0x7A8, 0x6C },
2263 { 0x22, 0x7A9, 0x34 },
2264 { 0x22, 0x7AA, 0x47 },
2265 { 0x22, 0x7AB, 0x6C },
2266 { 0x22, 0x7AC, 0x11 },
2267 { 0x22, 0x7AD, 0x80 },
2268 { 0x22, 0x7A6, 0x6F },
2269 { 0x22, 0x7A7, 0x97 },
2270 { 0x22, 0x7A8, 0x0F },
2271 { 0x22, 0x7A9, 0x6F },
2272 { 0x22, 0x7AA, 0x97 },
2273 { 0x22, 0x7AB, 0x0F },
2274 { 0x22, 0x7AC, 0x12 },
2275 { 0x22, 0x7AD, 0x80 },
2276 { 0x22, 0x7A6, 0xCB },
2277 { 0x22, 0x7A7, 0xB8 },
2278 { 0x22, 0x7A8, 0x94 },
2279 { 0x22, 0x7A9, 0xCB },
2280 { 0x22, 0x7AA, 0xB8 },
2281 { 0x22, 0x7AB, 0x94 },
2282 { 0x22, 0x7AC, 0x13 },
2283 { 0x22, 0x7AD, 0x80 },
2284 { 0x22, 0x7A6, 0x40 },
2285 { 0x22, 0x7A7, 0x00 },
2286 { 0x22, 0x7A8, 0x00 },
2287 { 0x22, 0x7A9, 0x40 },
2288 { 0x22, 0x7AA, 0x00 },
2289 { 0x22, 0x7AB, 0x00 },
2290 { 0x22, 0x7AC, 0x14 },
2291 { 0x22, 0x7AD, 0x80 },
2292 { 0x22, 0x7A6, 0x95 },
2293 { 0x22, 0x7A7, 0x76 },
2294 { 0x22, 0x7A8, 0x5B },
2295 { 0x22, 0x7A9, 0x95 },
2296 { 0x22, 0x7AA, 0x76 },
2297 { 0x22, 0x7AB, 0x5B },
2298 { 0x22, 0x7AC, 0x15 },
2299 { 0x22, 0x7AD, 0x80 },
2300 { 0x22, 0x7A6, 0x31 },
2301 { 0x22, 0x7A7, 0xAC },
2302 { 0x22, 0x7A8, 0x31 },
2303 { 0x22, 0x7A9, 0x31 },
2304 { 0x22, 0x7AA, 0xAC },
2305 { 0x22, 0x7AB, 0x31 },
2306 { 0x22, 0x7AC, 0x16 },
2307 { 0x22, 0x7AD, 0x80 },
2308 { 0x22, 0x7A6, 0x6A },
2309 { 0x22, 0x7A7, 0x89 },
2310 { 0x22, 0x7A8, 0xA5 },
2311 { 0x22, 0x7A9, 0x6A },
2312 { 0x22, 0x7AA, 0x89 },
2313 { 0x22, 0x7AB, 0xA5 },
2314 { 0x22, 0x7AC, 0x17 },
2315 { 0x22, 0x7AD, 0x80 },
2316 { 0x22, 0x7A6, 0xCE },
2317 { 0x22, 0x7A7, 0x53 },
2318 { 0x22, 0x7A8, 0xCF },
2319 { 0x22, 0x7A9, 0xCE },
2320 { 0x22, 0x7AA, 0x53 },
2321 { 0x22, 0x7AB, 0xCF },
2322 { 0x22, 0x7AC, 0x18 },
2323 { 0x22, 0x7AD, 0x80 },
2324 { 0x22, 0x7A6, 0x40 },
2325 { 0x22, 0x7A7, 0x00 },
2326 { 0x22, 0x7A8, 0x00 },
2327 { 0x22, 0x7A9, 0x40 },
2328 { 0x22, 0x7AA, 0x00 },
2329 { 0x22, 0x7AB, 0x00 },
2330 { 0x22, 0x7AC, 0x19 },
2331 { 0x22, 0x7AD, 0x80 },
2332 /* 48KHz base */
2333 { 0x22, 0x7A6, 0x3E },
2334 { 0x22, 0x7A7, 0x88 },
2335 { 0x22, 0x7A8, 0xDC },
2336 { 0x22, 0x7A9, 0x3E },
2337 { 0x22, 0x7AA, 0x88 },
2338 { 0x22, 0x7AB, 0xDC },
2339 { 0x22, 0x7AC, 0x1A },
2340 { 0x22, 0x7AD, 0x80 },
2341 { 0x22, 0x7A6, 0x82 },
2342 { 0x22, 0x7A7, 0xEE },
2343 { 0x22, 0x7A8, 0x46 },
2344 { 0x22, 0x7A9, 0x82 },
2345 { 0x22, 0x7AA, 0xEE },
2346 { 0x22, 0x7AB, 0x46 },
2347 { 0x22, 0x7AC, 0x1B },
2348 { 0x22, 0x7AD, 0x80 },
2349 { 0x22, 0x7A6, 0x3E },
2350 { 0x22, 0x7A7, 0x88 },
2351 { 0x22, 0x7A8, 0xDC },
2352 { 0x22, 0x7A9, 0x3E },
2353 { 0x22, 0x7AA, 0x88 },
2354 { 0x22, 0x7AB, 0xDC },
2355 { 0x22, 0x7AC, 0x1C },
2356 { 0x22, 0x7AD, 0x80 },
2357 { 0x22, 0x7A6, 0x7D },
2358 { 0x22, 0x7A7, 0x09 },
2359 { 0x22, 0x7A8, 0x28 },
2360 { 0x22, 0x7A9, 0x7D },
2361 { 0x22, 0x7AA, 0x09 },
2362 { 0x22, 0x7AB, 0x28 },
2363 { 0x22, 0x7AC, 0x1D },
2364 { 0x22, 0x7AD, 0x80 },
2365 { 0x22, 0x7A6, 0xC2 },
2366 { 0x22, 0x7A7, 0xE5 },
2367 { 0x22, 0x7A8, 0xB4 },
2368 { 0x22, 0x7A9, 0xC2 },
2369 { 0x22, 0x7AA, 0xE5 },
2370 { 0x22, 0x7AB, 0xB4 },
2371 { 0x22, 0x7AC, 0x1E },
2372 { 0x22, 0x7AD, 0x80 },
2373 { 0x22, 0x7A6, 0x3E },
2374 { 0x22, 0x7A7, 0xA3 },
2375 { 0x22, 0x7A8, 0x1F },
2376 { 0x22, 0x7A9, 0x3E },
2377 { 0x22, 0x7AA, 0xA3 },
2378 { 0x22, 0x7AB, 0x1F },
2379 { 0x22, 0x7AC, 0x1F },
2380 { 0x22, 0x7AD, 0x80 },
2381 { 0x22, 0x7A6, 0x84 },
2382 { 0x22, 0x7A7, 0xCA },
2383 { 0x22, 0x7A8, 0xF1 },
2384 { 0x22, 0x7A9, 0x84 },
2385 { 0x22, 0x7AA, 0xCA },
2386 { 0x22, 0x7AB, 0xF1 },
2387 { 0x22, 0x7AC, 0x20 },
2388 { 0x22, 0x7AD, 0x80 },
2389 { 0x22, 0x7A6, 0x3C },
2390 { 0x22, 0x7A7, 0xD5 },
2391 { 0x22, 0x7A8, 0x9C },
2392 { 0x22, 0x7A9, 0x3C },
2393 { 0x22, 0x7AA, 0xD5 },
2394 { 0x22, 0x7AB, 0x9C },
2395 { 0x22, 0x7AC, 0x21 },
2396 { 0x22, 0x7AD, 0x80 },
2397 { 0x22, 0x7A6, 0x7B },
2398 { 0x22, 0x7A7, 0x35 },
2399 { 0x22, 0x7A8, 0x0F },
2400 { 0x22, 0x7A9, 0x7B },
2401 { 0x22, 0x7AA, 0x35 },
2402 { 0x22, 0x7AB, 0x0F },
2403 { 0x22, 0x7AC, 0x22 },
2404 { 0x22, 0x7AD, 0x80 },
2405 { 0x22, 0x7A6, 0xC4 },
2406 { 0x22, 0x7A7, 0x87 },
2407 { 0x22, 0x7A8, 0x45 },
2408 { 0x22, 0x7A9, 0xC4 },
2409 { 0x22, 0x7AA, 0x87 },
2410 { 0x22, 0x7AB, 0x45 },
2411 { 0x22, 0x7AC, 0x23 },
2412 { 0x22, 0x7AD, 0x80 },
2413 { 0x22, 0x7A6, 0x3E },
2414 { 0x22, 0x7A7, 0x0A },
2415 { 0x22, 0x7A8, 0x78 },
2416 { 0x22, 0x7A9, 0x3E },
2417 { 0x22, 0x7AA, 0x0A },
2418 { 0x22, 0x7AB, 0x78 },
2419 { 0x22, 0x7AC, 0x24 },
2420 { 0x22, 0x7AD, 0x80 },
2421 { 0x22, 0x7A6, 0x88 },
2422 { 0x22, 0x7A7, 0xE2 },
2423 { 0x22, 0x7A8, 0x05 },
2424 { 0x22, 0x7A9, 0x88 },
2425 { 0x22, 0x7AA, 0xE2 },
2426 { 0x22, 0x7AB, 0x05 },
2427 { 0x22, 0x7AC, 0x25 },
2428 { 0x22, 0x7AD, 0x80 },
2429 { 0x22, 0x7A6, 0x3A },
2430 { 0x22, 0x7A7, 0x1A },
2431 { 0x22, 0x7A8, 0xA3 },
2432 { 0x22, 0x7A9, 0x3A },
2433 { 0x22, 0x7AA, 0x1A },
2434 { 0x22, 0x7AB, 0xA3 },
2435 { 0x22, 0x7AC, 0x26 },
2436 { 0x22, 0x7AD, 0x80 },
2437 { 0x22, 0x7A6, 0x77 },
2438 { 0x22, 0x7A7, 0x1D },
2439 { 0x22, 0x7A8, 0xFB },
2440 { 0x22, 0x7A9, 0x77 },
2441 { 0x22, 0x7AA, 0x1D },
2442 { 0x22, 0x7AB, 0xFB },
2443 { 0x22, 0x7AC, 0x27 },
2444 { 0x22, 0x7AD, 0x80 },
2445 { 0x22, 0x7A6, 0xC7 },
2446 { 0x22, 0x7A7, 0xDA },
2447 { 0x22, 0x7A8, 0xE5 },
2448 { 0x22, 0x7A9, 0xC7 },
2449 { 0x22, 0x7AA, 0xDA },
2450 { 0x22, 0x7AB, 0xE5 },
2451 { 0x22, 0x7AC, 0x28 },
2452 { 0x22, 0x7AD, 0x80 },
2453 { 0x22, 0x7A6, 0x40 },
2454 { 0x22, 0x7A7, 0x00 },
2455 { 0x22, 0x7A8, 0x00 },
2456 { 0x22, 0x7A9, 0x40 },
2457 { 0x22, 0x7AA, 0x00 },
2458 { 0x22, 0x7AB, 0x00 },
2459 { 0x22, 0x7AC, 0x29 },
2460 { 0x22, 0x7AD, 0x80 },
2461 { 0x22, 0x7A6, 0x8E },
2462 { 0x22, 0x7A7, 0xD7 },
2463 { 0x22, 0x7A8, 0x22 },
2464 { 0x22, 0x7A9, 0x8E },
2465 { 0x22, 0x7AA, 0xD7 },
2466 { 0x22, 0x7AB, 0x22 },
2467 { 0x22, 0x7AC, 0x2A },
2468 { 0x22, 0x7AD, 0x80 },
2469 { 0x22, 0x7A6, 0x35 },
2470 { 0x22, 0x7A7, 0x26 },
2471 { 0x22, 0x7A8, 0xC6 },
2472 { 0x22, 0x7A9, 0x35 },
2473 { 0x22, 0x7AA, 0x26 },
2474 { 0x22, 0x7AB, 0xC6 },
2475 { 0x22, 0x7AC, 0x2B },
2476 { 0x22, 0x7AD, 0x80 },
2477 { 0x22, 0x7A6, 0x71 },
2478 { 0x22, 0x7A7, 0x28 },
2479 { 0x22, 0x7A8, 0xDE },
2480 { 0x22, 0x7A9, 0x71 },
2481 { 0x22, 0x7AA, 0x28 },
2482 { 0x22, 0x7AB, 0xDE },
2483 { 0x22, 0x7AC, 0x2C },
2484 { 0x22, 0x7AD, 0x80 },
2485 { 0x22, 0x7A6, 0xCA },
2486 { 0x22, 0x7A7, 0xD9 },
2487 { 0x22, 0x7A8, 0x3A },
2488 { 0x22, 0x7A9, 0xCA },
2489 { 0x22, 0x7AA, 0xD9 },
2490 { 0x22, 0x7AB, 0x3A },
2491 { 0x22, 0x7AC, 0x2D },
2492 { 0x22, 0x7AD, 0x80 },
2493 { 0x22, 0x7A6, 0x40 },
2494 { 0x22, 0x7A7, 0x00 },
2495 { 0x22, 0x7A8, 0x00 },
2496 { 0x22, 0x7A9, 0x40 },
2497 { 0x22, 0x7AA, 0x00 },
2498 { 0x22, 0x7AB, 0x00 },
2499 { 0x22, 0x7AC, 0x2E },
2500 { 0x22, 0x7AD, 0x80 },
2501 { 0x22, 0x7A6, 0x93 },
2502 { 0x22, 0x7A7, 0x5E },
2503 { 0x22, 0x7A8, 0xD8 },
2504 { 0x22, 0x7A9, 0x93 },
2505 { 0x22, 0x7AA, 0x5E },
2506 { 0x22, 0x7AB, 0xD8 },
2507 { 0x22, 0x7AC, 0x2F },
2508 { 0x22, 0x7AD, 0x80 },
2509 { 0x22, 0x7A6, 0x32 },
2510 { 0x22, 0x7A7, 0xB7 },
2511 { 0x22, 0x7A8, 0xB1 },
2512 { 0x22, 0x7A9, 0x32 },
2513 { 0x22, 0x7AA, 0xB7 },
2514 { 0x22, 0x7AB, 0xB1 },
2515 { 0x22, 0x7AC, 0x30 },
2516 { 0x22, 0x7AD, 0x80 },
2517 { 0x22, 0x7A6, 0x6C },
2518 { 0x22, 0x7A7, 0xA1 },
2519 { 0x22, 0x7A8, 0x28 },
2520 { 0x22, 0x7A9, 0x6C },
2521 { 0x22, 0x7AA, 0xA1 },
2522 { 0x22, 0x7AB, 0x28 },
2523 { 0x22, 0x7AC, 0x31 },
2524 { 0x22, 0x7AD, 0x80 },
2525 { 0x22, 0x7A6, 0xCD },
2526 { 0x22, 0x7A7, 0x48 },
2527 { 0x22, 0x7A8, 0x4F },
2528 { 0x22, 0x7A9, 0xCD },
2529 { 0x22, 0x7AA, 0x48 },
2530 { 0x22, 0x7AB, 0x4F },
2531 { 0x22, 0x7AC, 0x32 },
2532 { 0x22, 0x7AD, 0x80 },
2533 { 0x22, 0x7A6, 0x40 },
2534 { 0x22, 0x7A7, 0x00 },
2535 { 0x22, 0x7A8, 0x00 },
2536 { 0x22, 0x7A9, 0x40 },
2537 { 0x22, 0x7AA, 0x00 },
2538 { 0x22, 0x7AB, 0x00 },
2539 { 0x22, 0x7AC, 0x33 },
2540 { 0x22, 0x7AD, 0x80 },
2541 /* common */
2542 { 0x22, 0x782, 0xC1 },
2543 { 0x22, 0x771, 0x2C },
2544 { 0x22, 0x772, 0x2C },
2545 { 0x22, 0x788, 0x04 },
2546 { 0x01, 0x7B0, 0x08 },
2547 {}
2548};
2549
Takashi Iwai372f8c72013-01-14 18:06:34 +01002550static const struct hda_fixup stac92hd83xxx_fixups[] = {
2551 [STAC_92HD83XXX_REF] = {
2552 .type = HDA_FIXUP_PINS,
2553 .v.pins = ref92hd83xxx_pin_configs,
2554 },
2555 [STAC_92HD83XXX_PWR_REF] = {
2556 .type = HDA_FIXUP_PINS,
2557 .v.pins = ref92hd83xxx_pin_configs,
2558 },
2559 [STAC_DELL_S14] = {
2560 .type = HDA_FIXUP_PINS,
2561 .v.pins = dell_s14_pin_configs,
2562 },
2563 [STAC_DELL_VOSTRO_3500] = {
2564 .type = HDA_FIXUP_PINS,
2565 .v.pins = dell_vostro_3500_pin_configs,
2566 },
2567 [STAC_92HD83XXX_HP_cNB11_INTQUAD] = {
2568 .type = HDA_FIXUP_PINS,
2569 .v.pins = hp_cNB11_intquad_pin_configs,
2570 .chained = true,
2571 .chain_id = STAC_92HD83XXX_HP,
2572 },
2573 [STAC_92HD83XXX_HP] = {
2574 .type = HDA_FIXUP_FUNC,
2575 .v.func = stac92hd83xxx_fixup_hp,
2576 },
2577 [STAC_HP_DV7_4000] = {
2578 .type = HDA_FIXUP_PINS,
2579 .v.pins = hp_dv7_4000_pin_configs,
2580 .chained = true,
2581 .chain_id = STAC_92HD83XXX_HP,
2582 },
2583 [STAC_HP_ZEPHYR] = {
2584 .type = HDA_FIXUP_FUNC,
2585 .v.func = stac92hd83xxx_fixup_hp_zephyr,
2586 .chained = true,
2587 .chain_id = STAC_92HD83XXX_HP,
2588 },
2589 [STAC_92HD83XXX_HP_LED] = {
2590 .type = HDA_FIXUP_FUNC,
2591 .v.func = stac92hd83xxx_fixup_hp_led,
2592 .chained = true,
2593 .chain_id = STAC_92HD83XXX_HP,
2594 },
2595 [STAC_92HD83XXX_HP_INV_LED] = {
2596 .type = HDA_FIXUP_FUNC,
2597 .v.func = stac92hd83xxx_fixup_hp_inv_led,
2598 .chained = true,
2599 .chain_id = STAC_92HD83XXX_HP,
2600 },
2601 [STAC_92HD83XXX_HP_MIC_LED] = {
2602 .type = HDA_FIXUP_FUNC,
2603 .v.func = stac92hd83xxx_fixup_hp_mic_led,
2604 .chained = true,
2605 .chain_id = STAC_92HD83XXX_HP,
2606 },
2607 [STAC_92HD83XXX_HEADSET_JACK] = {
2608 .type = HDA_FIXUP_FUNC,
2609 .v.func = stac92hd83xxx_fixup_headset_jack,
2610 },
Takashi Iwai49920422013-01-18 14:28:07 +01002611 [STAC_HP_ENVY_BASS] = {
2612 .type = HDA_FIXUP_PINS,
2613 .v.pins = (const struct hda_pintbl[]) {
2614 { 0x0f, 0x90170111 },
2615 {}
2616 },
2617 },
Vitaliy Kulikovd009f3d2013-11-14 11:52:16 -06002618 [STAC_HP_BNB13_EQ] = {
2619 .type = HDA_FIXUP_VERBS,
2620 .v.verbs = hp_bnb13_eq_verbs,
2621 .chained = true,
2622 .chain_id = STAC_92HD83XXX_HP_MIC_LED,
2623 },
Matthew Ranostayd0513fc2008-07-27 10:30:30 +02002624};
2625
Takashi Iwai372f8c72013-01-14 18:06:34 +01002626static const struct hda_model_fixup stac92hd83xxx_models[] = {
2627 { .id = STAC_92HD83XXX_REF, .name = "ref" },
2628 { .id = STAC_92HD83XXX_PWR_REF, .name = "mic-ref" },
2629 { .id = STAC_DELL_S14, .name = "dell-s14" },
2630 { .id = STAC_DELL_VOSTRO_3500, .name = "dell-vostro-3500" },
2631 { .id = STAC_92HD83XXX_HP_cNB11_INTQUAD, .name = "hp_cNB11_intquad" },
2632 { .id = STAC_HP_DV7_4000, .name = "hp-dv7-4000" },
2633 { .id = STAC_HP_ZEPHYR, .name = "hp-zephyr" },
2634 { .id = STAC_92HD83XXX_HP_LED, .name = "hp-led" },
2635 { .id = STAC_92HD83XXX_HP_INV_LED, .name = "hp-inv-led" },
2636 { .id = STAC_92HD83XXX_HP_MIC_LED, .name = "hp-mic-led" },
2637 { .id = STAC_92HD83XXX_HEADSET_JACK, .name = "headset-jack" },
Takashi Iwai49920422013-01-18 14:28:07 +01002638 { .id = STAC_HP_ENVY_BASS, .name = "hp-envy-bass" },
Vitaliy Kulikovd009f3d2013-11-14 11:52:16 -06002639 { .id = STAC_HP_BNB13_EQ, .name = "hp-bnb13-eq" },
Takashi Iwai372f8c72013-01-14 18:06:34 +01002640 {}
Matthew Ranostayd0513fc2008-07-27 10:30:30 +02002641};
2642
Takashi Iwai372f8c72013-01-14 18:06:34 +01002643static const struct snd_pci_quirk stac92hd83xxx_fixup_tbl[] = {
Matthew Ranostayd0513fc2008-07-27 10:30:30 +02002644 /* SigmaTel reference board */
2645 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
Takashi Iwaif9d088b2009-01-13 11:54:49 +01002646 "DFI LanParty", STAC_92HD83XXX_REF),
Matthew Ranostay577aa2c2009-01-22 22:55:44 -05002647 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
2648 "DFI LanParty", STAC_92HD83XXX_REF),
Matthew Ranostay8bb0ac52009-02-12 16:50:01 -05002649 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ba,
2650 "unknown Dell", STAC_DELL_S14),
David Henningsson8d032a82012-10-09 12:48:40 +02002651 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0532,
2652 "Dell Latitude E6230", STAC_92HD83XXX_HEADSET_JACK),
2653 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0533,
2654 "Dell Latitude E6330", STAC_92HD83XXX_HEADSET_JACK),
2655 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0534,
2656 "Dell Latitude E6430", STAC_92HD83XXX_HEADSET_JACK),
2657 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0535,
2658 "Dell Latitude E6530", STAC_92HD83XXX_HEADSET_JACK),
2659 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x053c,
2660 "Dell Latitude E5430", STAC_92HD83XXX_HEADSET_JACK),
2661 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x053d,
2662 "Dell Latitude E5530", STAC_92HD83XXX_HEADSET_JACK),
2663 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0549,
2664 "Dell Latitude E5430", STAC_92HD83XXX_HEADSET_JACK),
2665 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x057d,
2666 "Dell Latitude E6430s", STAC_92HD83XXX_HEADSET_JACK),
2667 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0584,
2668 "Dell Latitude E6430U", STAC_92HD83XXX_HEADSET_JACK),
Julian Wollrathf7f9bdf2011-11-09 10:02:40 +01002669 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x1028,
2670 "Dell Vostro 3500", STAC_DELL_VOSTRO_3500),
Vitaliy Kulikov0c27c182011-07-22 17:50:37 -05002671 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1656,
2672 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2673 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1657,
2674 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2675 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1658,
2676 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2677 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1659,
Takashi Iwai8ae58652012-12-13 14:33:42 +01002678 "HP Pavilion dv7", STAC_HP_DV7_4000),
Vitaliy Kulikov0c27c182011-07-22 17:50:37 -05002679 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165A,
2680 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2681 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165B,
2682 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
Takashi Iwai49920422013-01-18 14:28:07 +01002683 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1888,
2684 "HP Envy Spectre", STAC_HP_ENVY_BASS),
Takashi Iwai62cbde12012-09-14 11:58:54 +02002685 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x18df,
Vitaliy Kulikovd009f3d2013-11-14 11:52:16 -06002686 "HP Folio", STAC_HP_BNB13_EQ),
2687 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x18F8,
2688 "HP bNB13", STAC_HP_BNB13_EQ),
2689 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1909,
2690 "HP bNB13", STAC_HP_BNB13_EQ),
2691 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x190A,
2692 "HP bNB13", STAC_HP_BNB13_EQ),
2693 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1940,
2694 "HP bNB13", STAC_HP_BNB13_EQ),
2695 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1941,
2696 "HP bNB13", STAC_HP_BNB13_EQ),
2697 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1942,
2698 "HP bNB13", STAC_HP_BNB13_EQ),
2699 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1943,
2700 "HP bNB13", STAC_HP_BNB13_EQ),
2701 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1944,
2702 "HP bNB13", STAC_HP_BNB13_EQ),
2703 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1945,
2704 "HP bNB13", STAC_HP_BNB13_EQ),
2705 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1946,
2706 "HP bNB13", STAC_HP_BNB13_EQ),
2707 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1948,
2708 "HP bNB13", STAC_HP_BNB13_EQ),
2709 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1949,
2710 "HP bNB13", STAC_HP_BNB13_EQ),
2711 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194A,
2712 "HP bNB13", STAC_HP_BNB13_EQ),
2713 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194B,
2714 "HP bNB13", STAC_HP_BNB13_EQ),
2715 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194C,
2716 "HP bNB13", STAC_HP_BNB13_EQ),
2717 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194E,
2718 "HP bNB13", STAC_HP_BNB13_EQ),
2719 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194F,
2720 "HP bNB13", STAC_HP_BNB13_EQ),
2721 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1950,
2722 "HP bNB13", STAC_HP_BNB13_EQ),
2723 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1951,
2724 "HP bNB13", STAC_HP_BNB13_EQ),
2725 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x195A,
2726 "HP bNB13", STAC_HP_BNB13_EQ),
2727 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x195B,
2728 "HP bNB13", STAC_HP_BNB13_EQ),
2729 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x195C,
2730 "HP bNB13", STAC_HP_BNB13_EQ),
2731 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1991,
2732 "HP bNB13", STAC_HP_BNB13_EQ),
2733 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2103,
2734 "HP bNB13", STAC_HP_BNB13_EQ),
2735 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2104,
2736 "HP bNB13", STAC_HP_BNB13_EQ),
2737 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2105,
2738 "HP bNB13", STAC_HP_BNB13_EQ),
2739 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2106,
2740 "HP bNB13", STAC_HP_BNB13_EQ),
2741 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2107,
2742 "HP bNB13", STAC_HP_BNB13_EQ),
2743 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2108,
2744 "HP bNB13", STAC_HP_BNB13_EQ),
2745 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2109,
2746 "HP bNB13", STAC_HP_BNB13_EQ),
2747 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x210A,
2748 "HP bNB13", STAC_HP_BNB13_EQ),
2749 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x210B,
2750 "HP bNB13", STAC_HP_BNB13_EQ),
2751 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x211C,
2752 "HP bNB13", STAC_HP_BNB13_EQ),
2753 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x211D,
2754 "HP bNB13", STAC_HP_BNB13_EQ),
2755 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x211E,
2756 "HP bNB13", STAC_HP_BNB13_EQ),
2757 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x211F,
2758 "HP bNB13", STAC_HP_BNB13_EQ),
2759 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2120,
2760 "HP bNB13", STAC_HP_BNB13_EQ),
2761 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2121,
2762 "HP bNB13", STAC_HP_BNB13_EQ),
2763 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2122,
2764 "HP bNB13", STAC_HP_BNB13_EQ),
2765 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2123,
2766 "HP bNB13", STAC_HP_BNB13_EQ),
2767 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x213E,
2768 "HP bNB13", STAC_HP_BNB13_EQ),
2769 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x213F,
2770 "HP bNB13", STAC_HP_BNB13_EQ),
2771 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2140,
2772 "HP bNB13", STAC_HP_BNB13_EQ),
2773 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x21B2,
2774 "HP bNB13", STAC_HP_BNB13_EQ),
2775 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x21B3,
2776 "HP bNB13", STAC_HP_BNB13_EQ),
2777 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x21B5,
2778 "HP bNB13", STAC_HP_BNB13_EQ),
2779 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x21B6,
2780 "HP bNB13", STAC_HP_BNB13_EQ),
Takashi Iwaif9afed12013-02-06 12:39:06 +01002781 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x1900,
2782 "HP", STAC_92HD83XXX_HP_MIC_LED),
Takashi Iwai4059a422013-05-28 14:53:40 +02002783 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x2000,
2784 "HP", STAC_92HD83XXX_HP_MIC_LED),
2785 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x2100,
2786 "HP", STAC_92HD83XXX_HP_MIC_LED),
Vitaliy Kulikov0c27c182011-07-22 17:50:37 -05002787 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3388,
2788 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2789 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3389,
2790 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2791 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355B,
2792 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2793 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355C,
2794 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2795 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355D,
2796 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2797 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355E,
2798 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2799 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355F,
2800 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2801 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3560,
2802 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2803 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358B,
2804 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2805 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358C,
2806 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2807 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358D,
2808 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2809 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3591,
2810 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2811 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3592,
2812 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
2813 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3593,
2814 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
Vitaliy Kulikov5556e142012-02-27 16:47:37 -06002815 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3561,
2816 "HP", STAC_HP_ZEPHYR),
Takashi Iwaia3e19972012-07-26 08:17:20 +02002817 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3660,
2818 "HP Mini", STAC_92HD83XXX_HP_LED),
Gustavo Maciel Dias Vieira5afc13a2012-10-26 12:51:53 -02002819 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x144E,
2820 "HP Pavilion dv5", STAC_92HD83XXX_HP_INV_LED),
Takashi Iwai8c698fe2013-01-15 11:20:50 +01002821 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x148a,
2822 "HP Mini", STAC_92HD83XXX_HP_LED),
Takashi Iwai372f8c72013-01-14 18:06:34 +01002823 SND_PCI_QUIRK_VENDOR(PCI_VENDOR_ID_HP, "HP", STAC_92HD83XXX_HP),
Herton Ronaldo Krzesinski574f3c42008-12-23 16:53:00 -02002824 {} /* terminator */
Matthew Ranostayd0513fc2008-07-27 10:30:30 +02002825};
2826
Takashi Iwai36c9db72013-01-17 17:07:59 +01002827/* HP dv7 bass switch - GPIO5 */
2828#define stac_hp_bass_gpio_info snd_ctl_boolean_mono_info
2829static int stac_hp_bass_gpio_get(struct snd_kcontrol *kcontrol,
2830 struct snd_ctl_elem_value *ucontrol)
2831{
2832 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2833 struct sigmatel_spec *spec = codec->spec;
2834 ucontrol->value.integer.value[0] = !!(spec->gpio_data & 0x20);
2835 return 0;
2836}
2837
2838static int stac_hp_bass_gpio_put(struct snd_kcontrol *kcontrol,
2839 struct snd_ctl_elem_value *ucontrol)
2840{
2841 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2842 struct sigmatel_spec *spec = codec->spec;
2843 unsigned int gpio_data;
2844
2845 gpio_data = (spec->gpio_data & ~0x20) |
2846 (ucontrol->value.integer.value[0] ? 0x20 : 0);
2847 if (gpio_data == spec->gpio_data)
2848 return 0;
2849 spec->gpio_data = gpio_data;
2850 stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data);
2851 return 1;
2852}
2853
2854static const struct snd_kcontrol_new stac_hp_bass_sw_ctrl = {
2855 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2856 .info = stac_hp_bass_gpio_info,
2857 .get = stac_hp_bass_gpio_get,
2858 .put = stac_hp_bass_gpio_put,
2859};
2860
2861static int stac_add_hp_bass_switch(struct hda_codec *codec)
2862{
2863 struct sigmatel_spec *spec = codec->spec;
2864
2865 if (!snd_hda_gen_add_kctl(&spec->gen, "Bass Speaker Playback Switch",
2866 &stac_hp_bass_sw_ctrl))
2867 return -ENOMEM;
2868
2869 spec->gpio_mask |= 0x20;
2870 spec->gpio_dir |= 0x20;
2871 spec->gpio_data |= 0x20;
2872 return 0;
2873}
2874
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002875static const struct hda_pintbl ref92hd71bxx_pin_configs[] = {
2876 { 0x0a, 0x02214030 },
2877 { 0x0b, 0x02a19040 },
2878 { 0x0c, 0x01a19020 },
2879 { 0x0d, 0x01014010 },
2880 { 0x0e, 0x0181302e },
2881 { 0x0f, 0x01014010 },
2882 { 0x14, 0x01019020 },
2883 { 0x18, 0x90a000f0 },
2884 { 0x19, 0x90a000f0 },
2885 { 0x1e, 0x01452050 },
2886 { 0x1f, 0x01452050 },
2887 {}
Matthew Ranostaye035b842007-11-06 11:53:55 +01002888};
2889
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002890static const struct hda_pintbl dell_m4_1_pin_configs[] = {
2891 { 0x0a, 0x0421101f },
2892 { 0x0b, 0x04a11221 },
2893 { 0x0c, 0x40f000f0 },
2894 { 0x0d, 0x90170110 },
2895 { 0x0e, 0x23a1902e },
2896 { 0x0f, 0x23014250 },
2897 { 0x14, 0x40f000f0 },
2898 { 0x18, 0x90a000f0 },
2899 { 0x19, 0x40f000f0 },
2900 { 0x1e, 0x4f0000f0 },
2901 { 0x1f, 0x4f0000f0 },
2902 {}
Matthew Ranostaya7662642008-02-21 07:51:14 +01002903};
2904
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002905static const struct hda_pintbl dell_m4_2_pin_configs[] = {
2906 { 0x0a, 0x0421101f },
2907 { 0x0b, 0x04a11221 },
2908 { 0x0c, 0x90a70330 },
2909 { 0x0d, 0x90170110 },
2910 { 0x0e, 0x23a1902e },
2911 { 0x0f, 0x23014250 },
2912 { 0x14, 0x40f000f0 },
2913 { 0x18, 0x40f000f0 },
2914 { 0x19, 0x40f000f0 },
2915 { 0x1e, 0x044413b0 },
2916 { 0x1f, 0x044413b0 },
2917 {}
Matthew Ranostaya7662642008-02-21 07:51:14 +01002918};
2919
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002920static const struct hda_pintbl dell_m4_3_pin_configs[] = {
2921 { 0x0a, 0x0421101f },
2922 { 0x0b, 0x04a11221 },
2923 { 0x0c, 0x90a70330 },
2924 { 0x0d, 0x90170110 },
2925 { 0x0e, 0x40f000f0 },
2926 { 0x0f, 0x40f000f0 },
2927 { 0x14, 0x40f000f0 },
2928 { 0x18, 0x90a000f0 },
2929 { 0x19, 0x40f000f0 },
2930 { 0x1e, 0x044413b0 },
2931 { 0x1f, 0x044413b0 },
2932 {}
Matthew Ranostay3a7abfd2008-11-20 21:21:43 -05002933};
2934
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002935static void stac92hd71bxx_fixup_ref(struct hda_codec *codec,
2936 const struct hda_fixup *fix, int action)
2937{
2938 struct sigmatel_spec *spec = codec->spec;
2939
2940 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2941 return;
2942
2943 snd_hda_apply_pincfgs(codec, ref92hd71bxx_pin_configs);
2944 spec->gpio_mask = spec->gpio_dir = spec->gpio_data = 0;
2945}
2946
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002947static void stac92hd71bxx_fixup_hp_m4(struct hda_codec *codec,
2948 const struct hda_fixup *fix, int action)
2949{
2950 struct sigmatel_spec *spec = codec->spec;
Takashi Iwai36c9db72013-01-17 17:07:59 +01002951 struct hda_jack_tbl *jack;
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002952
2953 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2954 return;
2955
2956 /* Enable VREF power saving on GPIO1 detect */
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002957 snd_hda_codec_write_cache(codec, codec->afg, 0,
2958 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02);
Takashi Iwai36c9db72013-01-17 17:07:59 +01002959 snd_hda_jack_detect_enable_callback(codec, codec->afg,
2960 STAC_VREF_EVENT,
2961 stac_vref_event);
2962 jack = snd_hda_jack_tbl_get(codec, codec->afg);
2963 if (jack)
2964 jack->private_data = 0x02;
2965
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002966 spec->gpio_mask |= 0x02;
2967
2968 /* enable internal microphone */
2969 snd_hda_codec_set_pincfg(codec, 0x0e, 0x01813040);
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002970}
2971
2972static void stac92hd71bxx_fixup_hp_dv4(struct hda_codec *codec,
2973 const struct hda_fixup *fix, int action)
2974{
2975 struct sigmatel_spec *spec = codec->spec;
2976
2977 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2978 return;
2979 spec->gpio_led = 0x01;
2980}
2981
2982static void stac92hd71bxx_fixup_hp_dv5(struct hda_codec *codec,
2983 const struct hda_fixup *fix, int action)
2984{
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002985 unsigned int cap;
2986
2987 switch (action) {
2988 case HDA_FIXUP_ACT_PRE_PROBE:
2989 snd_hda_codec_set_pincfg(codec, 0x0d, 0x90170010);
Takashi Iwaif6655d52013-01-17 08:49:01 +01002990 break;
2991
2992 case HDA_FIXUP_ACT_PROBE:
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01002993 /* enable bass on HP dv7 */
2994 cap = snd_hda_param_read(codec, 0x1, AC_PAR_GPIO_CAP);
2995 cap &= AC_GPIO_IO_COUNT;
2996 if (cap >= 6)
2997 stac_add_hp_bass_switch(codec);
2998 break;
2999 }
3000}
3001
3002static void stac92hd71bxx_fixup_hp_hdx(struct hda_codec *codec,
3003 const struct hda_fixup *fix, int action)
3004{
3005 struct sigmatel_spec *spec = codec->spec;
3006
3007 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3008 return;
3009 spec->gpio_led = 0x08;
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01003010}
3011
3012
3013static void stac92hd71bxx_fixup_hp(struct hda_codec *codec,
3014 const struct hda_fixup *fix, int action)
3015{
3016 struct sigmatel_spec *spec = codec->spec;
3017
3018 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3019 return;
3020
3021 if (hp_blike_system(codec->subsystem_id)) {
3022 unsigned int pin_cfg = snd_hda_codec_get_pincfg(codec, 0x0f);
3023 if (get_defcfg_device(pin_cfg) == AC_JACK_LINE_OUT ||
3024 get_defcfg_device(pin_cfg) == AC_JACK_SPEAKER ||
3025 get_defcfg_device(pin_cfg) == AC_JACK_HP_OUT) {
3026 /* It was changed in the BIOS to just satisfy MS DTM.
3027 * Lets turn it back into slaved HP
3028 */
3029 pin_cfg = (pin_cfg & (~AC_DEFCFG_DEVICE))
3030 | (AC_JACK_HP_OUT <<
3031 AC_DEFCFG_DEVICE_SHIFT);
3032 pin_cfg = (pin_cfg & (~(AC_DEFCFG_DEF_ASSOC
3033 | AC_DEFCFG_SEQUENCE)))
3034 | 0x1f;
3035 snd_hda_codec_set_pincfg(codec, 0x0f, pin_cfg);
3036 }
3037 }
3038
Takashi Iwai36c9db72013-01-17 17:07:59 +01003039 if (find_mute_led_cfg(codec, 1))
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01003040 snd_printd("mute LED gpio %d polarity %d\n",
3041 spec->gpio_led,
3042 spec->gpio_led_polarity);
3043
3044}
3045
3046static const struct hda_fixup stac92hd71bxx_fixups[] = {
3047 [STAC_92HD71BXX_REF] = {
3048 .type = HDA_FIXUP_FUNC,
3049 .v.func = stac92hd71bxx_fixup_ref,
3050 },
3051 [STAC_DELL_M4_1] = {
3052 .type = HDA_FIXUP_PINS,
3053 .v.pins = dell_m4_1_pin_configs,
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01003054 },
3055 [STAC_DELL_M4_2] = {
3056 .type = HDA_FIXUP_PINS,
3057 .v.pins = dell_m4_2_pin_configs,
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01003058 },
3059 [STAC_DELL_M4_3] = {
3060 .type = HDA_FIXUP_PINS,
3061 .v.pins = dell_m4_3_pin_configs,
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01003062 },
3063 [STAC_HP_M4] = {
3064 .type = HDA_FIXUP_FUNC,
3065 .v.func = stac92hd71bxx_fixup_hp_m4,
3066 .chained = true,
3067 .chain_id = STAC_92HD71BXX_HP,
3068 },
3069 [STAC_HP_DV4] = {
3070 .type = HDA_FIXUP_FUNC,
3071 .v.func = stac92hd71bxx_fixup_hp_dv4,
3072 .chained = true,
3073 .chain_id = STAC_HP_DV5,
3074 },
3075 [STAC_HP_DV5] = {
3076 .type = HDA_FIXUP_FUNC,
3077 .v.func = stac92hd71bxx_fixup_hp_dv5,
3078 .chained = true,
3079 .chain_id = STAC_92HD71BXX_HP,
3080 },
3081 [STAC_HP_HDX] = {
3082 .type = HDA_FIXUP_FUNC,
3083 .v.func = stac92hd71bxx_fixup_hp_hdx,
3084 .chained = true,
3085 .chain_id = STAC_92HD71BXX_HP,
3086 },
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01003087 [STAC_92HD71BXX_HP] = {
3088 .type = HDA_FIXUP_FUNC,
3089 .v.func = stac92hd71bxx_fixup_hp,
3090 },
Matthew Ranostaye035b842007-11-06 11:53:55 +01003091};
3092
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01003093static const struct hda_model_fixup stac92hd71bxx_models[] = {
3094 { .id = STAC_92HD71BXX_REF, .name = "ref" },
3095 { .id = STAC_DELL_M4_1, .name = "dell-m4-1" },
3096 { .id = STAC_DELL_M4_2, .name = "dell-m4-2" },
3097 { .id = STAC_DELL_M4_3, .name = "dell-m4-3" },
3098 { .id = STAC_HP_M4, .name = "hp-m4" },
3099 { .id = STAC_HP_DV4, .name = "hp-dv4" },
3100 { .id = STAC_HP_DV5, .name = "hp-dv5" },
3101 { .id = STAC_HP_HDX, .name = "hp-hdx" },
Takashi Iwai36c9db72013-01-17 17:07:59 +01003102 { .id = STAC_HP_DV4, .name = "hp-dv4-1222nr" },
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01003103 {}
Matthew Ranostaye035b842007-11-06 11:53:55 +01003104};
3105
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01003106static const struct snd_pci_quirk stac92hd71bxx_fixup_tbl[] = {
Matthew Ranostaye035b842007-11-06 11:53:55 +01003107 /* SigmaTel reference board */
3108 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
3109 "DFI LanParty", STAC_92HD71BXX_REF),
Matthew Ranostay577aa2c2009-01-22 22:55:44 -05003110 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
3111 "DFI LanParty", STAC_92HD71BXX_REF),
Vitaliy Kulikov5bdaaad2009-11-04 07:57:45 +01003112 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x1720,
3113 "HP", STAC_HP_DV5),
Takashi Iwai58d83952009-03-13 17:04:34 +01003114 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3080,
3115 "HP", STAC_HP_DV5),
Takashi Iwai2ae466f2009-02-16 14:16:36 +01003116 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x30f0,
Takashi Iwai2a6ce6e2010-05-12 10:16:20 +02003117 "HP dv4-7", STAC_HP_DV4),
Takashi Iwai2ae466f2009-02-16 14:16:36 +01003118 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3600,
3119 "HP dv4-7", STAC_HP_DV5),
Takashi Iwai6fce61a2009-03-10 07:48:57 +01003120 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3610,
3121 "HP HDX", STAC_HP_HDX), /* HDX18 */
Matthew Ranostay9a9e2352008-09-26 10:37:03 -04003122 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a,
Takashi Iwai2ae466f2009-02-16 14:16:36 +01003123 "HP mini 1000", STAC_HP_M4),
Christoph Plattnerae6241f2009-03-08 23:19:05 +01003124 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361b,
Takashi Iwai6fce61a2009-03-10 07:48:57 +01003125 "HP HDX", STAC_HP_HDX), /* HDX16 */
Takashi Iwai6e34c032009-09-14 15:42:18 +02003126 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3620,
3127 "HP dv6", STAC_HP_DV5),
Kunal Gangakhedkare3d25302010-03-20 23:08:01 +05303128 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3061,
3129 "HP dv6", STAC_HP_DV5), /* HP dv6-1110ax */
Luke Yelavich9b2167d2010-10-06 15:45:46 +11003130 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x363e,
3131 "HP DV6", STAC_HP_DV5),
Takashi Iwai1972d022009-08-06 08:44:43 +02003132 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x7010,
3133 "HP", STAC_HP_DV5),
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01003134 SND_PCI_QUIRK_VENDOR(PCI_VENDOR_ID_HP, "HP", STAC_92HD71BXX_HP),
Matthew Ranostaya7662642008-02-21 07:51:14 +01003135 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233,
3136 "unknown Dell", STAC_DELL_M4_1),
3137 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234,
3138 "unknown Dell", STAC_DELL_M4_1),
3139 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0250,
3140 "unknown Dell", STAC_DELL_M4_1),
3141 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024f,
3142 "unknown Dell", STAC_DELL_M4_1),
3143 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024d,
3144 "unknown Dell", STAC_DELL_M4_1),
3145 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0251,
3146 "unknown Dell", STAC_DELL_M4_1),
3147 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0277,
3148 "unknown Dell", STAC_DELL_M4_1),
3149 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0263,
3150 "unknown Dell", STAC_DELL_M4_2),
3151 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0265,
3152 "unknown Dell", STAC_DELL_M4_2),
3153 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0262,
3154 "unknown Dell", STAC_DELL_M4_2),
3155 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264,
3156 "unknown Dell", STAC_DELL_M4_2),
Matthew Ranostay3a7abfd2008-11-20 21:21:43 -05003157 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02aa,
3158 "unknown Dell", STAC_DELL_M4_3),
Matthew Ranostaye035b842007-11-06 11:53:55 +01003159 {} /* terminator */
3160};
3161
Takashi Iwai0a427842013-01-14 15:20:13 +01003162static const struct hda_pintbl ref922x_pin_configs[] = {
3163 { 0x0a, 0x01014010 },
3164 { 0x0b, 0x01016011 },
3165 { 0x0c, 0x01012012 },
3166 { 0x0d, 0x0221401f },
3167 { 0x0e, 0x01813122 },
3168 { 0x0f, 0x01011014 },
3169 { 0x10, 0x01441030 },
3170 { 0x11, 0x01c41030 },
3171 { 0x15, 0x40000100 },
3172 { 0x1b, 0x40000100 },
3173 {}
Matt2f2f4252005-04-13 14:45:30 +02003174};
3175
Takashi Iwaidfe495d2007-08-23 19:04:28 +02003176/*
3177 STAC 922X pin configs for
3178 102801A7
3179 102801AB
3180 102801A9
3181 102801D1
3182 102801D2
3183*/
Takashi Iwai0a427842013-01-14 15:20:13 +01003184static const struct hda_pintbl dell_922x_d81_pin_configs[] = {
3185 { 0x0a, 0x02214030 },
3186 { 0x0b, 0x01a19021 },
3187 { 0x0c, 0x01111012 },
3188 { 0x0d, 0x01114010 },
3189 { 0x0e, 0x02a19020 },
3190 { 0x0f, 0x01117011 },
3191 { 0x10, 0x400001f0 },
3192 { 0x11, 0x400001f1 },
3193 { 0x15, 0x01813122 },
3194 { 0x1b, 0x400001f2 },
3195 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02003196};
3197
3198/*
3199 STAC 922X pin configs for
3200 102801AC
3201 102801D0
3202*/
Takashi Iwai0a427842013-01-14 15:20:13 +01003203static const struct hda_pintbl dell_922x_d82_pin_configs[] = {
3204 { 0x0a, 0x02214030 },
3205 { 0x0b, 0x01a19021 },
3206 { 0x0c, 0x01111012 },
3207 { 0x0d, 0x01114010 },
3208 { 0x0e, 0x02a19020 },
3209 { 0x0f, 0x01117011 },
3210 { 0x10, 0x01451140 },
3211 { 0x11, 0x400001f0 },
3212 { 0x15, 0x01813122 },
3213 { 0x1b, 0x400001f1 },
3214 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02003215};
3216
3217/*
3218 STAC 922X pin configs for
3219 102801BF
3220*/
Takashi Iwai0a427842013-01-14 15:20:13 +01003221static const struct hda_pintbl dell_922x_m81_pin_configs[] = {
3222 { 0x0a, 0x0321101f },
3223 { 0x0b, 0x01112024 },
3224 { 0x0c, 0x01111222 },
3225 { 0x0d, 0x91174220 },
3226 { 0x0e, 0x03a11050 },
3227 { 0x0f, 0x01116221 },
3228 { 0x10, 0x90a70330 },
3229 { 0x11, 0x01452340 },
3230 { 0x15, 0x40C003f1 },
3231 { 0x1b, 0x405003f0 },
3232 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02003233};
3234
3235/*
3236 STAC 9221 A1 pin configs for
3237 102801D7 (Dell XPS M1210)
3238*/
Takashi Iwai0a427842013-01-14 15:20:13 +01003239static const struct hda_pintbl dell_922x_m82_pin_configs[] = {
3240 { 0x0a, 0x02211211 },
3241 { 0x0b, 0x408103ff },
3242 { 0x0c, 0x02a1123e },
3243 { 0x0d, 0x90100310 },
3244 { 0x0e, 0x408003f1 },
3245 { 0x0f, 0x0221121f },
3246 { 0x10, 0x03451340 },
3247 { 0x11, 0x40c003f2 },
3248 { 0x15, 0x508003f3 },
3249 { 0x1b, 0x405003f4 },
3250 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02003251};
3252
Takashi Iwai0a427842013-01-14 15:20:13 +01003253static const struct hda_pintbl d945gtp3_pin_configs[] = {
3254 { 0x0a, 0x0221401f },
3255 { 0x0b, 0x01a19022 },
3256 { 0x0c, 0x01813021 },
3257 { 0x0d, 0x01014010 },
3258 { 0x0e, 0x40000100 },
3259 { 0x0f, 0x40000100 },
3260 { 0x10, 0x40000100 },
3261 { 0x11, 0x40000100 },
3262 { 0x15, 0x02a19120 },
3263 { 0x1b, 0x40000100 },
3264 {}
Matt Porter403d1942005-11-29 15:00:51 +01003265};
3266
Takashi Iwai0a427842013-01-14 15:20:13 +01003267static const struct hda_pintbl d945gtp5_pin_configs[] = {
3268 { 0x0a, 0x0221401f },
3269 { 0x0b, 0x01011012 },
3270 { 0x0c, 0x01813024 },
3271 { 0x0d, 0x01014010 },
3272 { 0x0e, 0x01a19021 },
3273 { 0x0f, 0x01016011 },
3274 { 0x10, 0x01452130 },
3275 { 0x11, 0x40000100 },
3276 { 0x15, 0x02a19320 },
3277 { 0x1b, 0x40000100 },
3278 {}
Matt Porter403d1942005-11-29 15:00:51 +01003279};
3280
Takashi Iwai0a427842013-01-14 15:20:13 +01003281static const struct hda_pintbl intel_mac_v1_pin_configs[] = {
3282 { 0x0a, 0x0121e21f },
3283 { 0x0b, 0x400000ff },
3284 { 0x0c, 0x9017e110 },
3285 { 0x0d, 0x400000fd },
3286 { 0x0e, 0x400000fe },
3287 { 0x0f, 0x0181e020 },
3288 { 0x10, 0x1145e030 },
3289 { 0x11, 0x11c5e240 },
3290 { 0x15, 0x400000fc },
3291 { 0x1b, 0x400000fb },
3292 {}
Takashi Iwai3fc24d82007-02-16 13:27:18 +01003293};
3294
Takashi Iwai0a427842013-01-14 15:20:13 +01003295static const struct hda_pintbl intel_mac_v2_pin_configs[] = {
3296 { 0x0a, 0x0121e21f },
3297 { 0x0b, 0x90a7012e },
3298 { 0x0c, 0x9017e110 },
3299 { 0x0d, 0x400000fd },
3300 { 0x0e, 0x400000fe },
3301 { 0x0f, 0x0181e020 },
3302 { 0x10, 0x1145e230 },
3303 { 0x11, 0x500000fa },
3304 { 0x15, 0x400000fc },
3305 { 0x1b, 0x400000fb },
3306 {}
Sylvain FORETf16928f2007-04-27 14:22:36 +02003307};
3308
Takashi Iwai0a427842013-01-14 15:20:13 +01003309static const struct hda_pintbl intel_mac_v3_pin_configs[] = {
3310 { 0x0a, 0x0121e21f },
3311 { 0x0b, 0x90a7012e },
3312 { 0x0c, 0x9017e110 },
3313 { 0x0d, 0x400000fd },
3314 { 0x0e, 0x400000fe },
3315 { 0x0f, 0x0181e020 },
3316 { 0x10, 0x1145e230 },
3317 { 0x11, 0x11c5e240 },
3318 { 0x15, 0x400000fc },
3319 { 0x1b, 0x400000fb },
3320 {}
Ivan N. Zlatev5d5d3bc2007-05-29 16:03:00 +02003321};
3322
Takashi Iwai0a427842013-01-14 15:20:13 +01003323static const struct hda_pintbl intel_mac_v4_pin_configs[] = {
3324 { 0x0a, 0x0321e21f },
3325 { 0x0b, 0x03a1e02e },
3326 { 0x0c, 0x9017e110 },
3327 { 0x0d, 0x9017e11f },
3328 { 0x0e, 0x400000fe },
3329 { 0x0f, 0x0381e020 },
3330 { 0x10, 0x1345e230 },
3331 { 0x11, 0x13c5e240 },
3332 { 0x15, 0x400000fc },
3333 { 0x1b, 0x400000fb },
3334 {}
Ivan N. Zlatev5d5d3bc2007-05-29 16:03:00 +02003335};
3336
Takashi Iwai0a427842013-01-14 15:20:13 +01003337static const struct hda_pintbl intel_mac_v5_pin_configs[] = {
3338 { 0x0a, 0x0321e21f },
3339 { 0x0b, 0x03a1e02e },
3340 { 0x0c, 0x9017e110 },
3341 { 0x0d, 0x9017e11f },
3342 { 0x0e, 0x400000fe },
3343 { 0x0f, 0x0381e020 },
3344 { 0x10, 0x1345e230 },
3345 { 0x11, 0x13c5e240 },
3346 { 0x15, 0x400000fc },
3347 { 0x1b, 0x400000fb },
3348 {}
Takashi Iwai0dae0f82007-05-21 12:41:29 +02003349};
3350
Takashi Iwai0a427842013-01-14 15:20:13 +01003351static const struct hda_pintbl ecs202_pin_configs[] = {
3352 { 0x0a, 0x0221401f },
3353 { 0x0b, 0x02a19020 },
3354 { 0x0c, 0x01a19020 },
3355 { 0x0d, 0x01114010 },
3356 { 0x0e, 0x408000f0 },
3357 { 0x0f, 0x01813022 },
3358 { 0x10, 0x074510a0 },
3359 { 0x11, 0x40c400f1 },
3360 { 0x15, 0x9037012e },
3361 { 0x1b, 0x40e000f2 },
3362 {}
Mauro Carvalho Chehab8c650082008-08-04 10:39:59 -03003363};
Takashi Iwai76c08822007-06-19 12:17:42 +02003364
Takashi Iwai0a427842013-01-14 15:20:13 +01003365/* codec SSIDs for Intel Mac sharing the same PCI SSID 8384:7680 */
3366static const struct snd_pci_quirk stac922x_intel_mac_fixup_tbl[] = {
Takashi Iwai697aeba2013-08-01 08:38:27 +02003367 SND_PCI_QUIRK(0x0000, 0x0100, "Mac Mini", STAC_INTEL_MAC_V3),
Takashi Iwai0a427842013-01-14 15:20:13 +01003368 SND_PCI_QUIRK(0x106b, 0x0800, "Mac", STAC_INTEL_MAC_V1),
3369 SND_PCI_QUIRK(0x106b, 0x0600, "Mac", STAC_INTEL_MAC_V2),
3370 SND_PCI_QUIRK(0x106b, 0x0700, "Mac", STAC_INTEL_MAC_V2),
3371 SND_PCI_QUIRK(0x106b, 0x0e00, "Mac", STAC_INTEL_MAC_V3),
3372 SND_PCI_QUIRK(0x106b, 0x0f00, "Mac", STAC_INTEL_MAC_V3),
3373 SND_PCI_QUIRK(0x106b, 0x1600, "Mac", STAC_INTEL_MAC_V3),
3374 SND_PCI_QUIRK(0x106b, 0x1700, "Mac", STAC_INTEL_MAC_V3),
3375 SND_PCI_QUIRK(0x106b, 0x0200, "Mac", STAC_INTEL_MAC_V3),
3376 SND_PCI_QUIRK(0x106b, 0x1e00, "Mac", STAC_INTEL_MAC_V3),
3377 SND_PCI_QUIRK(0x106b, 0x1a00, "Mac", STAC_INTEL_MAC_V4),
3378 SND_PCI_QUIRK(0x106b, 0x0a00, "Mac", STAC_INTEL_MAC_V5),
3379 SND_PCI_QUIRK(0x106b, 0x2200, "Mac", STAC_INTEL_MAC_V5),
3380 {}
3381};
3382
3383static const struct hda_fixup stac922x_fixups[];
3384
3385/* remap the fixup from codec SSID and apply it */
3386static void stac922x_fixup_intel_mac_auto(struct hda_codec *codec,
3387 const struct hda_fixup *fix,
3388 int action)
3389{
3390 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3391 return;
3392 snd_hda_pick_fixup(codec, NULL, stac922x_intel_mac_fixup_tbl,
3393 stac922x_fixups);
3394 if (codec->fixup_id != STAC_INTEL_MAC_AUTO)
3395 snd_hda_apply_fixup(codec, action);
3396}
3397
3398static void stac922x_fixup_intel_mac_gpio(struct hda_codec *codec,
3399 const struct hda_fixup *fix,
3400 int action)
3401{
3402 struct sigmatel_spec *spec = codec->spec;
3403
3404 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3405 spec->gpio_mask = spec->gpio_dir = 0x03;
3406 spec->gpio_data = 0x03;
3407 }
3408}
3409
3410static const struct hda_fixup stac922x_fixups[] = {
3411 [STAC_D945_REF] = {
3412 .type = HDA_FIXUP_PINS,
3413 .v.pins = ref922x_pin_configs,
3414 },
3415 [STAC_D945GTP3] = {
3416 .type = HDA_FIXUP_PINS,
3417 .v.pins = d945gtp3_pin_configs,
3418 },
3419 [STAC_D945GTP5] = {
3420 .type = HDA_FIXUP_PINS,
3421 .v.pins = d945gtp5_pin_configs,
3422 },
3423 [STAC_INTEL_MAC_AUTO] = {
3424 .type = HDA_FIXUP_FUNC,
3425 .v.func = stac922x_fixup_intel_mac_auto,
3426 },
3427 [STAC_INTEL_MAC_V1] = {
3428 .type = HDA_FIXUP_PINS,
3429 .v.pins = intel_mac_v1_pin_configs,
3430 .chained = true,
3431 .chain_id = STAC_922X_INTEL_MAC_GPIO,
3432 },
3433 [STAC_INTEL_MAC_V2] = {
3434 .type = HDA_FIXUP_PINS,
3435 .v.pins = intel_mac_v2_pin_configs,
3436 .chained = true,
3437 .chain_id = STAC_922X_INTEL_MAC_GPIO,
3438 },
3439 [STAC_INTEL_MAC_V3] = {
3440 .type = HDA_FIXUP_PINS,
3441 .v.pins = intel_mac_v3_pin_configs,
3442 .chained = true,
3443 .chain_id = STAC_922X_INTEL_MAC_GPIO,
3444 },
3445 [STAC_INTEL_MAC_V4] = {
3446 .type = HDA_FIXUP_PINS,
3447 .v.pins = intel_mac_v4_pin_configs,
3448 .chained = true,
3449 .chain_id = STAC_922X_INTEL_MAC_GPIO,
3450 },
3451 [STAC_INTEL_MAC_V5] = {
3452 .type = HDA_FIXUP_PINS,
3453 .v.pins = intel_mac_v5_pin_configs,
3454 .chained = true,
3455 .chain_id = STAC_922X_INTEL_MAC_GPIO,
3456 },
3457 [STAC_922X_INTEL_MAC_GPIO] = {
3458 .type = HDA_FIXUP_FUNC,
3459 .v.func = stac922x_fixup_intel_mac_gpio,
3460 },
3461 [STAC_ECS_202] = {
3462 .type = HDA_FIXUP_PINS,
3463 .v.pins = ecs202_pin_configs,
3464 },
3465 [STAC_922X_DELL_D81] = {
3466 .type = HDA_FIXUP_PINS,
3467 .v.pins = dell_922x_d81_pin_configs,
3468 },
3469 [STAC_922X_DELL_D82] = {
3470 .type = HDA_FIXUP_PINS,
3471 .v.pins = dell_922x_d82_pin_configs,
3472 },
3473 [STAC_922X_DELL_M81] = {
3474 .type = HDA_FIXUP_PINS,
3475 .v.pins = dell_922x_m81_pin_configs,
3476 },
3477 [STAC_922X_DELL_M82] = {
3478 .type = HDA_FIXUP_PINS,
3479 .v.pins = dell_922x_m82_pin_configs,
3480 },
3481};
3482
3483static const struct hda_model_fixup stac922x_models[] = {
3484 { .id = STAC_D945_REF, .name = "ref" },
3485 { .id = STAC_D945GTP5, .name = "5stack" },
3486 { .id = STAC_D945GTP3, .name = "3stack" },
3487 { .id = STAC_INTEL_MAC_V1, .name = "intel-mac-v1" },
3488 { .id = STAC_INTEL_MAC_V2, .name = "intel-mac-v2" },
3489 { .id = STAC_INTEL_MAC_V3, .name = "intel-mac-v3" },
3490 { .id = STAC_INTEL_MAC_V4, .name = "intel-mac-v4" },
3491 { .id = STAC_INTEL_MAC_V5, .name = "intel-mac-v5" },
3492 { .id = STAC_INTEL_MAC_AUTO, .name = "intel-mac-auto" },
3493 { .id = STAC_ECS_202, .name = "ecs202" },
3494 { .id = STAC_922X_DELL_D81, .name = "dell-d81" },
3495 { .id = STAC_922X_DELL_D82, .name = "dell-d82" },
3496 { .id = STAC_922X_DELL_M81, .name = "dell-m81" },
3497 { .id = STAC_922X_DELL_M82, .name = "dell-m82" },
Takashi Iwaidfe495d2007-08-23 19:04:28 +02003498 /* for backward compatibility */
Takashi Iwai0a427842013-01-14 15:20:13 +01003499 { .id = STAC_INTEL_MAC_V3, .name = "macmini" },
3500 { .id = STAC_INTEL_MAC_V5, .name = "macbook" },
3501 { .id = STAC_INTEL_MAC_V3, .name = "macbook-pro-v1" },
3502 { .id = STAC_INTEL_MAC_V3, .name = "macbook-pro" },
3503 { .id = STAC_INTEL_MAC_V2, .name = "imac-intel" },
3504 { .id = STAC_INTEL_MAC_V3, .name = "imac-intel-20" },
3505 {}
Matt Porter403d1942005-11-29 15:00:51 +01003506};
3507
Takashi Iwai0a427842013-01-14 15:20:13 +01003508static const struct snd_pci_quirk stac922x_fixup_tbl[] = {
Takashi Iwaif5fcc132006-11-24 17:07:44 +01003509 /* SigmaTel reference board */
3510 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
3511 "DFI LanParty", STAC_D945_REF),
Matthew Ranostay577aa2c2009-01-22 22:55:44 -05003512 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
3513 "DFI LanParty", STAC_D945_REF),
Takashi Iwaif5fcc132006-11-24 17:07:44 +01003514 /* Intel 945G based systems */
3515 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101,
3516 "Intel D945G", STAC_D945GTP3),
3517 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202,
3518 "Intel D945G", STAC_D945GTP3),
3519 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606,
3520 "Intel D945G", STAC_D945GTP3),
3521 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601,
3522 "Intel D945G", STAC_D945GTP3),
3523 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111,
3524 "Intel D945G", STAC_D945GTP3),
3525 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115,
3526 "Intel D945G", STAC_D945GTP3),
3527 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116,
3528 "Intel D945G", STAC_D945GTP3),
3529 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117,
3530 "Intel D945G", STAC_D945GTP3),
3531 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118,
3532 "Intel D945G", STAC_D945GTP3),
3533 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119,
3534 "Intel D945G", STAC_D945GTP3),
3535 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826,
3536 "Intel D945G", STAC_D945GTP3),
3537 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049,
3538 "Intel D945G", STAC_D945GTP3),
3539 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055,
3540 "Intel D945G", STAC_D945GTP3),
3541 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048,
3542 "Intel D945G", STAC_D945GTP3),
3543 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110,
3544 "Intel D945G", STAC_D945GTP3),
3545 /* Intel D945G 5-stack systems */
3546 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404,
3547 "Intel D945G", STAC_D945GTP5),
3548 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303,
3549 "Intel D945G", STAC_D945GTP5),
3550 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013,
3551 "Intel D945G", STAC_D945GTP5),
3552 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417,
3553 "Intel D945G", STAC_D945GTP5),
3554 /* Intel 945P based systems */
3555 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b,
3556 "Intel D945P", STAC_D945GTP3),
3557 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112,
3558 "Intel D945P", STAC_D945GTP3),
3559 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d,
3560 "Intel D945P", STAC_D945GTP3),
3561 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909,
3562 "Intel D945P", STAC_D945GTP3),
3563 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505,
3564 "Intel D945P", STAC_D945GTP3),
3565 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707,
3566 "Intel D945P", STAC_D945GTP5),
Takashi Iwai8056d472009-01-23 09:09:43 +01003567 /* other intel */
3568 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0204,
3569 "Intel D945", STAC_D945_REF),
Takashi Iwaif5fcc132006-11-24 17:07:44 +01003570 /* other systems */
Takashi Iwai0a427842013-01-14 15:20:13 +01003571
Nicolas Boichat536319a2008-07-21 22:18:01 +08003572 /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */
Takashi Iwai0a427842013-01-14 15:20:13 +01003573 SND_PCI_QUIRK(0x8384, 0x7680, "Mac", STAC_INTEL_MAC_AUTO),
3574
Takashi Iwaidfe495d2007-08-23 19:04:28 +02003575 /* Dell systems */
3576 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7,
3577 "unknown Dell", STAC_922X_DELL_D81),
3578 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a9,
3579 "unknown Dell", STAC_922X_DELL_D81),
3580 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ab,
3581 "unknown Dell", STAC_922X_DELL_D81),
3582 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ac,
3583 "unknown Dell", STAC_922X_DELL_D82),
3584 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bf,
3585 "unknown Dell", STAC_922X_DELL_M81),
3586 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d0,
3587 "unknown Dell", STAC_922X_DELL_D82),
3588 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d1,
3589 "unknown Dell", STAC_922X_DELL_D81),
3590 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d2,
3591 "unknown Dell", STAC_922X_DELL_D81),
3592 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7,
3593 "Dell XPS M1210", STAC_922X_DELL_M82),
Mauro Carvalho Chehab8c650082008-08-04 10:39:59 -03003594 /* ECS/PC Chips boards */
Takashi Iwaidea0a502009-02-09 17:14:52 +01003595 SND_PCI_QUIRK_MASK(0x1019, 0xf000, 0x2000,
Herton Ronaldo Krzesinski8663ae52009-02-08 19:50:34 -02003596 "ECS/PC chips", STAC_ECS_202),
Matt Porter403d1942005-11-29 15:00:51 +01003597 {} /* terminator */
3598};
3599
Takashi Iwai29ac8362013-01-14 16:03:38 +01003600static const struct hda_pintbl ref927x_pin_configs[] = {
3601 { 0x0a, 0x02214020 },
3602 { 0x0b, 0x02a19080 },
3603 { 0x0c, 0x0181304e },
3604 { 0x0d, 0x01014010 },
3605 { 0x0e, 0x01a19040 },
3606 { 0x0f, 0x01011012 },
3607 { 0x10, 0x01016011 },
3608 { 0x11, 0x0101201f },
3609 { 0x12, 0x183301f0 },
3610 { 0x13, 0x18a001f0 },
3611 { 0x14, 0x18a001f0 },
3612 { 0x21, 0x01442070 },
3613 { 0x22, 0x01c42190 },
3614 { 0x23, 0x40000100 },
3615 {}
Matt Porter3cc08dc2006-01-23 15:27:49 +01003616};
3617
Takashi Iwai29ac8362013-01-14 16:03:38 +01003618static const struct hda_pintbl d965_3st_pin_configs[] = {
3619 { 0x0a, 0x0221401f },
3620 { 0x0b, 0x02a19120 },
3621 { 0x0c, 0x40000100 },
3622 { 0x0d, 0x01014011 },
3623 { 0x0e, 0x01a19021 },
3624 { 0x0f, 0x01813024 },
3625 { 0x10, 0x40000100 },
3626 { 0x11, 0x40000100 },
3627 { 0x12, 0x40000100 },
3628 { 0x13, 0x40000100 },
3629 { 0x14, 0x40000100 },
3630 { 0x21, 0x40000100 },
3631 { 0x22, 0x40000100 },
3632 { 0x23, 0x40000100 },
3633 {}
Tobin Davis81d3dbd2006-08-22 19:44:45 +02003634};
3635
Takashi Iwai29ac8362013-01-14 16:03:38 +01003636static const struct hda_pintbl d965_5st_pin_configs[] = {
3637 { 0x0a, 0x02214020 },
3638 { 0x0b, 0x02a19080 },
3639 { 0x0c, 0x0181304e },
3640 { 0x0d, 0x01014010 },
3641 { 0x0e, 0x01a19040 },
3642 { 0x0f, 0x01011012 },
3643 { 0x10, 0x01016011 },
3644 { 0x11, 0x40000100 },
3645 { 0x12, 0x40000100 },
3646 { 0x13, 0x40000100 },
3647 { 0x14, 0x40000100 },
3648 { 0x21, 0x01442070 },
3649 { 0x22, 0x40000100 },
3650 { 0x23, 0x40000100 },
3651 {}
Tobin Davis93ed1502006-09-01 21:03:12 +02003652};
3653
Takashi Iwai29ac8362013-01-14 16:03:38 +01003654static const struct hda_pintbl d965_5st_no_fp_pin_configs[] = {
3655 { 0x0a, 0x40000100 },
3656 { 0x0b, 0x40000100 },
3657 { 0x0c, 0x0181304e },
3658 { 0x0d, 0x01014010 },
3659 { 0x0e, 0x01a19040 },
3660 { 0x0f, 0x01011012 },
3661 { 0x10, 0x01016011 },
3662 { 0x11, 0x40000100 },
3663 { 0x12, 0x40000100 },
3664 { 0x13, 0x40000100 },
3665 { 0x14, 0x40000100 },
3666 { 0x21, 0x01442070 },
3667 { 0x22, 0x40000100 },
3668 { 0x23, 0x40000100 },
3669 {}
Takashi Iwai679d92e2009-05-24 19:00:08 +02003670};
3671
Takashi Iwai29ac8362013-01-14 16:03:38 +01003672static const struct hda_pintbl dell_3st_pin_configs[] = {
3673 { 0x0a, 0x02211230 },
3674 { 0x0b, 0x02a11220 },
3675 { 0x0c, 0x01a19040 },
3676 { 0x0d, 0x01114210 },
3677 { 0x0e, 0x01111212 },
3678 { 0x0f, 0x01116211 },
3679 { 0x10, 0x01813050 },
3680 { 0x11, 0x01112214 },
3681 { 0x12, 0x403003fa },
3682 { 0x13, 0x90a60040 },
3683 { 0x14, 0x90a60040 },
3684 { 0x21, 0x404003fb },
3685 { 0x22, 0x40c003fc },
3686 { 0x23, 0x40000100 },
3687 {}
Tobin Davis4ff076e2007-08-07 11:48:12 +02003688};
3689
Takashi Iwai29ac8362013-01-14 16:03:38 +01003690static void stac927x_fixup_ref_no_jd(struct hda_codec *codec,
3691 const struct hda_fixup *fix, int action)
3692{
Takashi Iwai29ac8362013-01-14 16:03:38 +01003693 /* no jack detecion for ref-no-jd model */
Takashi Iwai36c9db72013-01-17 17:07:59 +01003694 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3695 codec->no_jack_detect = 1;
Takashi Iwai29ac8362013-01-14 16:03:38 +01003696}
3697
3698static void stac927x_fixup_ref(struct hda_codec *codec,
3699 const struct hda_fixup *fix, int action)
3700{
3701 struct sigmatel_spec *spec = codec->spec;
3702
3703 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3704 snd_hda_apply_pincfgs(codec, ref927x_pin_configs);
3705 spec->eapd_mask = spec->gpio_mask = 0;
3706 spec->gpio_dir = spec->gpio_data = 0;
3707 }
3708}
3709
3710static void stac927x_fixup_dell_dmic(struct hda_codec *codec,
3711 const struct hda_fixup *fix, int action)
3712{
3713 struct sigmatel_spec *spec = codec->spec;
3714
3715 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3716 return;
3717
3718 if (codec->subsystem_id != 0x1028022f) {
3719 /* GPIO2 High = Enable EAPD */
3720 spec->eapd_mask = spec->gpio_mask = 0x04;
3721 spec->gpio_dir = spec->gpio_data = 0x04;
3722 }
Takashi Iwai29ac8362013-01-14 16:03:38 +01003723
3724 snd_hda_add_verbs(codec, dell_3st_core_init);
3725 spec->volknob_init = 1;
Takashi Iwai29ac8362013-01-14 16:03:38 +01003726}
3727
3728static void stac927x_fixup_volknob(struct hda_codec *codec,
3729 const struct hda_fixup *fix, int action)
3730{
3731 struct sigmatel_spec *spec = codec->spec;
3732
3733 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3734 snd_hda_add_verbs(codec, stac927x_volknob_core_init);
3735 spec->volknob_init = 1;
3736 }
3737}
3738
3739static const struct hda_fixup stac927x_fixups[] = {
3740 [STAC_D965_REF_NO_JD] = {
3741 .type = HDA_FIXUP_FUNC,
3742 .v.func = stac927x_fixup_ref_no_jd,
3743 .chained = true,
3744 .chain_id = STAC_D965_REF,
3745 },
3746 [STAC_D965_REF] = {
3747 .type = HDA_FIXUP_FUNC,
3748 .v.func = stac927x_fixup_ref,
3749 },
3750 [STAC_D965_3ST] = {
3751 .type = HDA_FIXUP_PINS,
3752 .v.pins = d965_3st_pin_configs,
3753 .chained = true,
3754 .chain_id = STAC_D965_VERBS,
3755 },
3756 [STAC_D965_5ST] = {
3757 .type = HDA_FIXUP_PINS,
3758 .v.pins = d965_5st_pin_configs,
3759 .chained = true,
3760 .chain_id = STAC_D965_VERBS,
3761 },
3762 [STAC_D965_VERBS] = {
3763 .type = HDA_FIXUP_VERBS,
3764 .v.verbs = d965_core_init,
3765 },
3766 [STAC_D965_5ST_NO_FP] = {
3767 .type = HDA_FIXUP_PINS,
3768 .v.pins = d965_5st_no_fp_pin_configs,
3769 },
3770 [STAC_DELL_3ST] = {
3771 .type = HDA_FIXUP_PINS,
3772 .v.pins = dell_3st_pin_configs,
3773 .chained = true,
3774 .chain_id = STAC_927X_DELL_DMIC,
3775 },
3776 [STAC_DELL_BIOS] = {
3777 .type = HDA_FIXUP_PINS,
3778 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai29ac8362013-01-14 16:03:38 +01003779 /* correct the front output jack as a hp out */
Takashi Iwaif3e351e2013-07-19 08:02:25 +02003780 { 0x0f, 0x0221101f },
Takashi Iwai29ac8362013-01-14 16:03:38 +01003781 /* correct the front input jack as a mic */
3782 { 0x0e, 0x02a79130 },
3783 {}
3784 },
3785 .chained = true,
3786 .chain_id = STAC_927X_DELL_DMIC,
3787 },
Takashi Iwaieefb8be2013-07-29 16:26:15 +02003788 [STAC_DELL_BIOS_AMIC] = {
3789 .type = HDA_FIXUP_PINS,
3790 .v.pins = (const struct hda_pintbl[]) {
3791 /* configure the analog microphone on some laptops */
3792 { 0x0c, 0x90a79130 },
3793 {}
3794 },
3795 .chained = true,
3796 .chain_id = STAC_DELL_BIOS,
3797 },
Takashi Iwai29ac8362013-01-14 16:03:38 +01003798 [STAC_DELL_BIOS_SPDIF] = {
3799 .type = HDA_FIXUP_PINS,
3800 .v.pins = (const struct hda_pintbl[]) {
3801 /* correct the device field to SPDIF out */
3802 { 0x21, 0x01442070 },
3803 {}
3804 },
3805 .chained = true,
3806 .chain_id = STAC_DELL_BIOS,
3807 },
3808 [STAC_927X_DELL_DMIC] = {
3809 .type = HDA_FIXUP_FUNC,
3810 .v.func = stac927x_fixup_dell_dmic,
3811 },
3812 [STAC_927X_VOLKNOB] = {
3813 .type = HDA_FIXUP_FUNC,
3814 .v.func = stac927x_fixup_volknob,
3815 },
Matt Porter3cc08dc2006-01-23 15:27:49 +01003816};
3817
Takashi Iwai29ac8362013-01-14 16:03:38 +01003818static const struct hda_model_fixup stac927x_models[] = {
3819 { .id = STAC_D965_REF_NO_JD, .name = "ref-no-jd" },
3820 { .id = STAC_D965_REF, .name = "ref" },
3821 { .id = STAC_D965_3ST, .name = "3stack" },
3822 { .id = STAC_D965_5ST, .name = "5stack" },
3823 { .id = STAC_D965_5ST_NO_FP, .name = "5stack-no-fp" },
3824 { .id = STAC_DELL_3ST, .name = "dell-3stack" },
3825 { .id = STAC_DELL_BIOS, .name = "dell-bios" },
Takashi Iwaieefb8be2013-07-29 16:26:15 +02003826 { .id = STAC_DELL_BIOS_AMIC, .name = "dell-bios-amic" },
Takashi Iwai29ac8362013-01-14 16:03:38 +01003827 { .id = STAC_927X_VOLKNOB, .name = "volknob" },
3828 {}
Takashi Iwaif5fcc132006-11-24 17:07:44 +01003829};
3830
Takashi Iwai29ac8362013-01-14 16:03:38 +01003831static const struct snd_pci_quirk stac927x_fixup_tbl[] = {
Takashi Iwaif5fcc132006-11-24 17:07:44 +01003832 /* SigmaTel reference board */
3833 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
3834 "DFI LanParty", STAC_D965_REF),
Matthew Ranostay577aa2c2009-01-22 22:55:44 -05003835 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
3836 "DFI LanParty", STAC_D965_REF),
Tobin Davis81d3dbd2006-08-22 19:44:45 +02003837 /* Intel 946 based systems */
Takashi Iwaif5fcc132006-11-24 17:07:44 +01003838 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST),
3839 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xa301, "Intel D946", STAC_D965_3ST),
Tobin Davis93ed1502006-09-01 21:03:12 +02003840 /* 965 based 3 stack systems */
Takashi Iwaidea0a502009-02-09 17:14:52 +01003841 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2100,
3842 "Intel D965", STAC_D965_3ST),
3843 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2000,
3844 "Intel D965", STAC_D965_3ST),
Tobin Davis4ff076e2007-08-07 11:48:12 +02003845 /* Dell 3 stack systems */
Takashi Iwaidfe495d2007-08-23 19:04:28 +02003846 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST),
Tobin Davis4ff076e2007-08-07 11:48:12 +02003847 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ed, "Dell ", STAC_DELL_3ST),
3848 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f4, "Dell ", STAC_DELL_3ST),
Matthew Ranostay8e9068b2007-12-17 11:58:13 +01003849 /* Dell 3 stack systems with verb table in BIOS */
Matthew Ranostay2f32d902008-01-10 13:06:26 +01003850 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS),
Daniel T Chen66668b62010-05-23 20:47:45 -04003851 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f7, "Dell XPS M1730", STAC_DELL_BIOS),
Matthew Ranostay2f32d902008-01-10 13:06:26 +01003852 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS),
Takashi Iwai29ac8362013-01-14 16:03:38 +01003853 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS_SPDIF),
Chengu Wang84d3dc22009-07-30 19:43:55 +08003854 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell Inspiron 1525", STAC_DELL_BIOS),
Matthew Ranostay8e9068b2007-12-17 11:58:13 +01003855 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS),
3856 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS),
3857 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS),
Takashi Iwai29ac8362013-01-14 16:03:38 +01003858 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0209, "Dell XPS 1330", STAC_DELL_BIOS_SPDIF),
Tobin Davis93ed1502006-09-01 21:03:12 +02003859 /* 965 based 5 stack systems */
Takashi Iwaidea0a502009-02-09 17:14:52 +01003860 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2300,
3861 "Intel D965", STAC_D965_5ST),
3862 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500,
3863 "Intel D965", STAC_D965_5ST),
Takashi Iwai54930532009-10-11 17:38:29 +02003864 /* volume-knob fixes */
3865 SND_PCI_QUIRK_VENDOR(0x10cf, "FSC", STAC_927X_VOLKNOB),
Matt Porter3cc08dc2006-01-23 15:27:49 +01003866 {} /* terminator */
3867};
3868
Takashi Iwaife6322c2013-01-14 14:46:51 +01003869static const struct hda_pintbl ref9205_pin_configs[] = {
3870 { 0x0a, 0x40000100 },
3871 { 0x0b, 0x40000100 },
3872 { 0x0c, 0x01016011 },
3873 { 0x0d, 0x01014010 },
3874 { 0x0e, 0x01813122 },
3875 { 0x0f, 0x01a19021 },
3876 { 0x14, 0x01019020 },
3877 { 0x16, 0x40000100 },
3878 { 0x17, 0x90a000f0 },
3879 { 0x18, 0x90a000f0 },
3880 { 0x21, 0x01441030 },
3881 { 0x22, 0x01c41030 },
3882 {}
Matt Porterf3302a52006-07-31 12:49:34 +02003883};
3884
Takashi Iwaidfe495d2007-08-23 19:04:28 +02003885/*
3886 STAC 9205 pin configs for
3887 102801F1
3888 102801F2
3889 102801FC
3890 102801FD
3891 10280204
3892 1028021F
Matthew Ranostay3fa2ef72008-01-11 11:39:06 +01003893 10280228 (Dell Vostro 1500)
Anisse Astier95e70e82009-12-23 17:28:45 +01003894 10280229 (Dell Vostro 1700)
Takashi Iwaidfe495d2007-08-23 19:04:28 +02003895*/
Takashi Iwaife6322c2013-01-14 14:46:51 +01003896static const struct hda_pintbl dell_9205_m42_pin_configs[] = {
3897 { 0x0a, 0x0321101F },
3898 { 0x0b, 0x03A11020 },
3899 { 0x0c, 0x400003FA },
3900 { 0x0d, 0x90170310 },
3901 { 0x0e, 0x400003FB },
3902 { 0x0f, 0x400003FC },
3903 { 0x14, 0x400003FD },
3904 { 0x16, 0x40F000F9 },
3905 { 0x17, 0x90A60330 },
3906 { 0x18, 0x400003FF },
3907 { 0x21, 0x0144131F },
3908 { 0x22, 0x40C003FE },
3909 {}
Takashi Iwaidfe495d2007-08-23 19:04:28 +02003910};
3911
3912/*
3913 STAC 9205 pin configs for
3914 102801F9
3915 102801FA
3916 102801FE
3917 102801FF (Dell Precision M4300)
3918 10280206
3919 10280200
3920 10280201
3921*/
Takashi Iwaife6322c2013-01-14 14:46:51 +01003922static const struct hda_pintbl dell_9205_m43_pin_configs[] = {
3923 { 0x0a, 0x0321101f },
3924 { 0x0b, 0x03a11020 },
3925 { 0x0c, 0x90a70330 },
3926 { 0x0d, 0x90170310 },
3927 { 0x0e, 0x400000fe },
3928 { 0x0f, 0x400000ff },
3929 { 0x14, 0x400000fd },
3930 { 0x16, 0x40f000f9 },
3931 { 0x17, 0x400000fa },
3932 { 0x18, 0x400000fc },
3933 { 0x21, 0x0144131f },
3934 { 0x22, 0x40c003f8 },
3935 /* Enable SPDIF in/out */
3936 { 0x1f, 0x01441030 },
3937 { 0x20, 0x1c410030 },
3938 {}
Tobin Davisae0a8ed2007-08-13 15:50:29 +02003939};
3940
Takashi Iwaife6322c2013-01-14 14:46:51 +01003941static const struct hda_pintbl dell_9205_m44_pin_configs[] = {
3942 { 0x0a, 0x0421101f },
3943 { 0x0b, 0x04a11020 },
3944 { 0x0c, 0x400003fa },
3945 { 0x0d, 0x90170310 },
3946 { 0x0e, 0x400003fb },
3947 { 0x0f, 0x400003fc },
3948 { 0x14, 0x400003fd },
3949 { 0x16, 0x400003f9 },
3950 { 0x17, 0x90a60330 },
3951 { 0x18, 0x400003ff },
3952 { 0x21, 0x01441340 },
3953 { 0x22, 0x40c003fe },
3954 {}
Tobin Davisae0a8ed2007-08-13 15:50:29 +02003955};
3956
Takashi Iwaife6322c2013-01-14 14:46:51 +01003957static void stac9205_fixup_ref(struct hda_codec *codec,
3958 const struct hda_fixup *fix, int action)
3959{
3960 struct sigmatel_spec *spec = codec->spec;
3961
3962 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3963 snd_hda_apply_pincfgs(codec, ref9205_pin_configs);
3964 /* SPDIF-In enabled */
3965 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0;
3966 }
3967}
3968
Takashi Iwaife6322c2013-01-14 14:46:51 +01003969static void stac9205_fixup_dell_m43(struct hda_codec *codec,
3970 const struct hda_fixup *fix, int action)
3971{
3972 struct sigmatel_spec *spec = codec->spec;
Takashi Iwai36c9db72013-01-17 17:07:59 +01003973 struct hda_jack_tbl *jack;
Takashi Iwaife6322c2013-01-14 14:46:51 +01003974
3975 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3976 snd_hda_apply_pincfgs(codec, dell_9205_m43_pin_configs);
3977
3978 /* Enable unsol response for GPIO4/Dock HP connection */
Takashi Iwaife6322c2013-01-14 14:46:51 +01003979 snd_hda_codec_write_cache(codec, codec->afg, 0,
3980 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10);
Takashi Iwai36c9db72013-01-17 17:07:59 +01003981 snd_hda_jack_detect_enable_callback(codec, codec->afg,
3982 STAC_VREF_EVENT,
3983 stac_vref_event);
3984 jack = snd_hda_jack_tbl_get(codec, codec->afg);
3985 if (jack)
3986 jack->private_data = 0x01;
Takashi Iwaife6322c2013-01-14 14:46:51 +01003987
3988 spec->gpio_dir = 0x0b;
3989 spec->eapd_mask = 0x01;
3990 spec->gpio_mask = 0x1b;
3991 spec->gpio_mute = 0x10;
3992 /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute,
3993 * GPIO3 Low = DRM
3994 */
3995 spec->gpio_data = 0x01;
3996 }
3997}
3998
3999static void stac9205_fixup_eapd(struct hda_codec *codec,
4000 const struct hda_fixup *fix, int action)
4001{
4002 struct sigmatel_spec *spec = codec->spec;
4003
4004 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4005 spec->eapd_switch = 0;
4006}
4007
4008static const struct hda_fixup stac9205_fixups[] = {
4009 [STAC_9205_REF] = {
4010 .type = HDA_FIXUP_FUNC,
4011 .v.func = stac9205_fixup_ref,
4012 },
4013 [STAC_9205_DELL_M42] = {
4014 .type = HDA_FIXUP_PINS,
4015 .v.pins = dell_9205_m42_pin_configs,
4016 },
4017 [STAC_9205_DELL_M43] = {
4018 .type = HDA_FIXUP_FUNC,
4019 .v.func = stac9205_fixup_dell_m43,
4020 },
4021 [STAC_9205_DELL_M44] = {
4022 .type = HDA_FIXUP_PINS,
4023 .v.pins = dell_9205_m44_pin_configs,
4024 },
4025 [STAC_9205_EAPD] = {
4026 .type = HDA_FIXUP_FUNC,
4027 .v.func = stac9205_fixup_eapd,
4028 },
4029 {}
Matt Porterf3302a52006-07-31 12:49:34 +02004030};
4031
Takashi Iwaife6322c2013-01-14 14:46:51 +01004032static const struct hda_model_fixup stac9205_models[] = {
4033 { .id = STAC_9205_REF, .name = "ref" },
4034 { .id = STAC_9205_DELL_M42, .name = "dell-m42" },
4035 { .id = STAC_9205_DELL_M43, .name = "dell-m43" },
4036 { .id = STAC_9205_DELL_M44, .name = "dell-m44" },
4037 { .id = STAC_9205_EAPD, .name = "eapd" },
4038 {}
Takashi Iwaif5fcc132006-11-24 17:07:44 +01004039};
4040
Takashi Iwaife6322c2013-01-14 14:46:51 +01004041static const struct snd_pci_quirk stac9205_fixup_tbl[] = {
Takashi Iwaif5fcc132006-11-24 17:07:44 +01004042 /* SigmaTel reference board */
4043 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
4044 "DFI LanParty", STAC_9205_REF),
Herton Ronaldo Krzesinski02358fc2009-07-04 01:44:59 -03004045 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xfb30,
4046 "SigmaTel", STAC_9205_REF),
Matthew Ranostay577aa2c2009-01-22 22:55:44 -05004047 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101,
4048 "DFI LanParty", STAC_9205_REF),
Takashi Iwaid9a42682009-01-22 17:40:18 +01004049 /* Dell */
Takashi Iwaidfe495d2007-08-23 19:04:28 +02004050 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1,
4051 "unknown Dell", STAC_9205_DELL_M42),
4052 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2,
4053 "unknown Dell", STAC_9205_DELL_M42),
Tobin Davisae0a8ed2007-08-13 15:50:29 +02004054 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f8,
Matthew Ranostayb44ef2f2007-09-18 00:52:38 +02004055 "Dell Precision", STAC_9205_DELL_M43),
Tobin Davisae0a8ed2007-08-13 15:50:29 +02004056 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f9,
4057 "Dell Precision", STAC_9205_DELL_M43),
4058 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fa,
4059 "Dell Precision", STAC_9205_DELL_M43),
Takashi Iwaidfe495d2007-08-23 19:04:28 +02004060 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc,
4061 "unknown Dell", STAC_9205_DELL_M42),
4062 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd,
4063 "unknown Dell", STAC_9205_DELL_M42),
Tobin Davisae0a8ed2007-08-13 15:50:29 +02004064 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fe,
4065 "Dell Precision", STAC_9205_DELL_M43),
4066 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ff,
Takashi Iwaidfe495d2007-08-23 19:04:28 +02004067 "Dell Precision M4300", STAC_9205_DELL_M43),
Takashi Iwaidfe495d2007-08-23 19:04:28 +02004068 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0204,
4069 "unknown Dell", STAC_9205_DELL_M42),
Takashi Iwai45499152008-06-12 16:27:24 +02004070 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0206,
4071 "Dell Precision", STAC_9205_DELL_M43),
4072 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021b,
4073 "Dell Precision", STAC_9205_DELL_M43),
4074 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021c,
4075 "Dell Precision", STAC_9205_DELL_M43),
Tobin Davisae0a8ed2007-08-13 15:50:29 +02004076 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021f,
4077 "Dell Inspiron", STAC_9205_DELL_M44),
Matthew Ranostay3fa2ef72008-01-11 11:39:06 +01004078 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228,
4079 "Dell Vostro 1500", STAC_9205_DELL_M42),
Anisse Astier95e70e82009-12-23 17:28:45 +01004080 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0229,
4081 "Dell Vostro 1700", STAC_9205_DELL_M42),
Takashi Iwaid9a42682009-01-22 17:40:18 +01004082 /* Gateway */
Hao Song42b95f02009-07-20 15:01:16 +08004083 SND_PCI_QUIRK(0x107b, 0x0560, "Gateway T6834c", STAC_9205_EAPD),
Takashi Iwaid9a42682009-01-22 17:40:18 +01004084 SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD),
Matt Porterf3302a52006-07-31 12:49:34 +02004085 {} /* terminator */
4086};
4087
Takashi Iwai36c9db72013-01-17 17:07:59 +01004088static int stac_parse_auto_config(struct hda_codec *codec)
Mattc7d4b2f2005-06-27 14:59:41 +02004089{
4090 struct sigmatel_spec *spec = codec->spec;
Takashi Iwaidc04d1b2009-03-06 10:00:05 +01004091 int err;
David Henningssonf390dad2013-03-21 12:16:30 +01004092 int flags = 0;
Mattc7d4b2f2005-06-27 14:59:41 +02004093
David Henningssonf390dad2013-03-21 12:16:30 +01004094 if (spec->headset_jack)
4095 flags |= HDA_PINCFG_HEADSET_MIC;
4096
4097 err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL, flags);
Takashi Iwaidc04d1b2009-03-06 10:00:05 +01004098 if (err < 0)
4099 return err;
4100
Takashi Iwai36c9db72013-01-17 17:07:59 +01004101 /* add hooks */
4102 spec->gen.pcm_playback_hook = stac_playback_pcm_hook;
4103 spec->gen.pcm_capture_hook = stac_capture_pcm_hook;
4104
4105 spec->gen.automute_hook = stac_update_outputs;
4106 spec->gen.hp_automute_hook = stac_hp_automute;
4107 spec->gen.line_automute_hook = stac_line_automute;
David Henningsson664389d2013-01-28 11:29:17 +01004108 spec->gen.mic_autoswitch_hook = stac_mic_autoswitch;
Takashi Iwai36c9db72013-01-17 17:07:59 +01004109
4110 err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg);
Takashi Iwaidc04d1b2009-03-06 10:00:05 +01004111 if (err < 0)
4112 return err;
4113
Takashi Iwai36c9db72013-01-17 17:07:59 +01004114 /* minimum value is actually mute */
4115 spec->gen.vmaster_tlv[3] |= TLV_DB_SCALE_MUTE;
Mattc7d4b2f2005-06-27 14:59:41 +02004116
Matthew Ranostay1cd22242008-07-18 18:20:52 +02004117 /* setup analog beep controls */
4118 if (spec->anabeep_nid > 0) {
Takashi Iwai36c9db72013-01-17 17:07:59 +01004119 err = stac_auto_create_beep_ctls(codec,
4120 spec->anabeep_nid);
Matthew Ranostay1cd22242008-07-18 18:20:52 +02004121 if (err < 0)
4122 return err;
4123 }
4124
4125 /* setup digital beep controls and input device */
4126#ifdef CONFIG_SND_HDA_INPUT_BEEP
Takashi Iwai7504b6c2013-03-18 11:25:51 +01004127 if (spec->gen.beep_nid) {
4128 hda_nid_t nid = spec->gen.beep_nid;
Takashi Iwai4d4e9bb2008-11-12 16:45:04 +01004129 unsigned int caps;
Matthew Ranostay1cd22242008-07-18 18:20:52 +02004130
Takashi Iwai36c9db72013-01-17 17:07:59 +01004131 err = stac_auto_create_beep_ctls(codec, nid);
Matthew Ranostay1cd22242008-07-18 18:20:52 +02004132 if (err < 0)
4133 return err;
Takashi Iwaid8d881d2009-12-22 07:52:49 +01004134 if (codec->beep) {
4135 /* IDT/STAC codecs have linear beep tone parameter */
Daniel J Blueman1b0e3722010-08-03 11:09:13 +01004136 codec->beep->linear_tone = spec->linear_tone_beep;
Takashi Iwaid8d881d2009-12-22 07:52:49 +01004137 /* if no beep switch is available, make its own one */
4138 caps = query_amp_caps(codec, nid, HDA_OUTPUT);
4139 if (!(caps & AC_AMPCAP_MUTE)) {
Takashi Iwai36c9db72013-01-17 17:07:59 +01004140 err = stac_beep_switch_ctl(codec);
Takashi Iwaid8d881d2009-12-22 07:52:49 +01004141 if (err < 0)
4142 return err;
4143 }
Takashi Iwai4d4e9bb2008-11-12 16:45:04 +01004144 }
Matthew Ranostay1cd22242008-07-18 18:20:52 +02004145 }
4146#endif
4147
Takashi Iwai36c9db72013-01-17 17:07:59 +01004148 if (spec->gpio_led)
4149 spec->gen.vmaster_mute.hook = stac_vmaster_hook;
Maxim Levitsky0fb87bb2007-09-03 15:29:04 +02004150
Takashi Iwai36c9db72013-01-17 17:07:59 +01004151 if (spec->aloopback_ctl &&
4152 snd_hda_get_bool_hint(codec, "loopback") == 1) {
4153 if (!snd_hda_gen_add_kctl(&spec->gen, NULL, spec->aloopback_ctl))
4154 return -ENOMEM;
Takashi Iwaidc04d1b2009-03-06 10:00:05 +01004155 }
Maxim Levitsky0fb87bb2007-09-03 15:29:04 +02004156
Takashi Iwai42875472013-01-22 09:34:48 +01004157 if (spec->have_spdif_mux) {
4158 err = stac_create_spdif_mux_ctls(codec);
4159 if (err < 0)
4160 return err;
4161 }
4162
Takashi Iwai36c9db72013-01-17 17:07:59 +01004163 stac_init_power_map(codec);
Takashi Iwai82bc9552006-03-21 11:24:42 +01004164
4165 return 0;
4166}
4167
Takashi Iwai36c9db72013-01-17 17:07:59 +01004168
4169static int stac_init(struct hda_codec *codec)
Richard Fish160ea0d2006-09-06 13:58:25 +02004170{
4171 struct sigmatel_spec *spec = codec->spec;
Takashi Iwaie4973e12008-11-18 09:32:42 +01004172 int i;
Mattc7d4b2f2005-06-27 14:59:41 +02004173
Takashi Iwai6565e4f2009-03-02 14:38:35 +01004174 /* override some hints */
4175 stac_store_hints(codec);
4176
Takashi Iwaif73d3582008-11-25 08:21:51 +01004177 /* set up GPIO */
Takashi Iwaif73d3582008-11-25 08:21:51 +01004178 /* turn on EAPD statically when spec->eapd_switch isn't set.
4179 * otherwise, unsol event will turn it on/off dynamically
4180 */
4181 if (!spec->eapd_switch)
Takashi Iwai1ea9a692013-07-19 07:58:02 +02004182 spec->gpio_data |= spec->eapd_mask;
4183 stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data);
Takashi Iwaif73d3582008-11-25 08:21:51 +01004184
Takashi Iwai36c9db72013-01-17 17:07:59 +01004185 snd_hda_gen_init(codec);
Takashi Iwaic8822462012-05-15 09:11:36 +02004186
4187 /* sync the power-map */
4188 if (spec->num_pwrs)
4189 snd_hda_codec_write(codec, codec->afg, 0,
4190 AC_VERB_IDT_SET_POWER_MAP,
4191 spec->power_map_bits);
Takashi Iwai36c9db72013-01-17 17:07:59 +01004192
4193 /* power down inactive ADCs */
4194 if (spec->powerdown_adcs) {
4195 for (i = 0; i < spec->gen.num_all_adcs; i++) {
4196 if (spec->active_adcs & (1 << i))
4197 continue;
4198 snd_hda_codec_write(codec, spec->gen.all_adcs[i], 0,
4199 AC_VERB_SET_POWER_STATE,
4200 AC_PWRST_D3);
4201 }
4202 }
4203
Mattc7d4b2f2005-06-27 14:59:41 +02004204 return 0;
4205}
4206
Takashi Iwai36c9db72013-01-17 17:07:59 +01004207static void stac_shutup(struct hda_codec *codec)
Takashi Iwai603c4012008-07-30 15:01:44 +02004208{
4209 struct sigmatel_spec *spec = codec->spec;
4210
Takashi Iwai36c9db72013-01-17 17:07:59 +01004211 snd_hda_shutup_pins(codec);
Takashi Iwai167eae52009-11-06 15:47:50 +01004212
4213 if (spec->eapd_mask)
4214 stac_gpio_set(codec, spec->gpio_mask,
4215 spec->gpio_dir, spec->gpio_data &
4216 ~spec->eapd_mask);
4217}
4218
Takashi Iwai7504b6c2013-03-18 11:25:51 +01004219#define stac_free snd_hda_gen_free
Matt2f2f4252005-04-13 14:45:30 +02004220
Takashi Iwai2d34e1b2008-11-28 14:35:16 +01004221#ifdef CONFIG_PROC_FS
4222static void stac92hd_proc_hook(struct snd_info_buffer *buffer,
4223 struct hda_codec *codec, hda_nid_t nid)
4224{
4225 if (nid == codec->afg)
4226 snd_iprintf(buffer, "Power-Map: 0x%02x\n",
Takashi Iwaic8822462012-05-15 09:11:36 +02004227 snd_hda_codec_read(codec, nid, 0,
4228 AC_VERB_IDT_GET_POWER_MAP, 0));
Takashi Iwai2d34e1b2008-11-28 14:35:16 +01004229}
4230
4231static void analog_loop_proc_hook(struct snd_info_buffer *buffer,
4232 struct hda_codec *codec,
4233 unsigned int verb)
4234{
4235 snd_iprintf(buffer, "Analog Loopback: 0x%02x\n",
4236 snd_hda_codec_read(codec, codec->afg, 0, verb, 0));
4237}
4238
4239/* stac92hd71bxx, stac92hd73xx */
4240static void stac92hd7x_proc_hook(struct snd_info_buffer *buffer,
4241 struct hda_codec *codec, hda_nid_t nid)
4242{
4243 stac92hd_proc_hook(buffer, codec, nid);
4244 if (nid == codec->afg)
4245 analog_loop_proc_hook(buffer, codec, 0xfa0);
4246}
4247
4248static void stac9205_proc_hook(struct snd_info_buffer *buffer,
4249 struct hda_codec *codec, hda_nid_t nid)
4250{
4251 if (nid == codec->afg)
4252 analog_loop_proc_hook(buffer, codec, 0xfe0);
4253}
4254
4255static void stac927x_proc_hook(struct snd_info_buffer *buffer,
4256 struct hda_codec *codec, hda_nid_t nid)
4257{
4258 if (nid == codec->afg)
4259 analog_loop_proc_hook(buffer, codec, 0xfeb);
4260}
4261#else
4262#define stac92hd_proc_hook NULL
4263#define stac92hd7x_proc_hook NULL
4264#define stac9205_proc_hook NULL
4265#define stac927x_proc_hook NULL
4266#endif
4267
Takashi Iwai2a439522011-07-26 09:52:50 +02004268#ifdef CONFIG_PM
Takashi Iwai36c9db72013-01-17 17:07:59 +01004269static int stac_suspend(struct hda_codec *codec)
Vitaliy Kulikov45eebda2011-07-26 16:56:20 -05004270{
Takashi Iwai36c9db72013-01-17 17:07:59 +01004271 stac_shutup(codec);
Vitaliy Kulikov45eebda2011-07-26 16:56:20 -05004272 return 0;
4273}
Takashi Iwai350eba432012-03-16 16:09:03 +01004274#else
Takashi Iwai36c9db72013-01-17 17:07:59 +01004275#define stac_suspend NULL
Takashi Iwai2faa3bf2012-03-12 12:30:22 +01004276#endif /* CONFIG_PM */
Vitaliy Kulikov45eebda2011-07-26 16:56:20 -05004277
Takashi Iwai36c9db72013-01-17 17:07:59 +01004278static const struct hda_codec_ops stac_patch_ops = {
4279 .build_controls = snd_hda_gen_build_controls,
4280 .build_pcms = snd_hda_gen_build_pcms,
4281 .init = stac_init,
4282 .free = stac_free,
David Henningsson29adc4b2012-09-25 11:31:00 +02004283 .unsol_event = snd_hda_jack_unsol_event,
Takashi Iwai2a439522011-07-26 09:52:50 +02004284#ifdef CONFIG_PM
Takashi Iwai36c9db72013-01-17 17:07:59 +01004285 .suspend = stac_suspend,
Mattff6fdc32005-06-27 15:06:52 +02004286#endif
Takashi Iwai36c9db72013-01-17 17:07:59 +01004287 .reboot_notify = stac_shutup,
Matt2f2f4252005-04-13 14:45:30 +02004288};
4289
Takashi Iwai36c9db72013-01-17 17:07:59 +01004290static int alloc_stac_spec(struct hda_codec *codec)
Takashi Iwai361dab32012-05-09 14:35:27 +02004291{
4292 struct sigmatel_spec *spec;
4293
4294 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4295 if (!spec)
4296 return -ENOMEM;
Takashi Iwai36c9db72013-01-17 17:07:59 +01004297 snd_hda_gen_spec_init(&spec->gen);
Takashi Iwai361dab32012-05-09 14:35:27 +02004298 codec->spec = spec;
4299 codec->no_trigger_sense = 1; /* seems common with STAC/IDT codecs */
Takashi Iwai361dab32012-05-09 14:35:27 +02004300 return 0;
4301}
4302
Matt2f2f4252005-04-13 14:45:30 +02004303static int patch_stac9200(struct hda_codec *codec)
4304{
4305 struct sigmatel_spec *spec;
Mattc7d4b2f2005-06-27 14:59:41 +02004306 int err;
Matt2f2f4252005-04-13 14:45:30 +02004307
Takashi Iwai36c9db72013-01-17 17:07:59 +01004308 err = alloc_stac_spec(codec);
Takashi Iwai361dab32012-05-09 14:35:27 +02004309 if (err < 0)
4310 return err;
Matt2f2f4252005-04-13 14:45:30 +02004311
Takashi Iwai361dab32012-05-09 14:35:27 +02004312 spec = codec->spec;
Daniel J Blueman1b0e3722010-08-03 11:09:13 +01004313 spec->linear_tone_beep = 1;
Takashi Iwai36c9db72013-01-17 17:07:59 +01004314 spec->gen.own_eapd_ctl = 1;
4315
4316 codec->patch_ops = stac_patch_ops;
Takashi Iwaiba615b82013-03-13 14:47:21 +01004317 codec->power_filter = snd_hda_codec_eapd_power_filter;
Takashi Iwai36c9db72013-01-17 17:07:59 +01004318
4319 snd_hda_add_verbs(codec, stac9200_eapd_init);
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01004320
4321 snd_hda_pick_fixup(codec, stac9200_models, stac9200_fixup_tbl,
4322 stac9200_fixups);
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01004323 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai117f2572008-03-18 09:53:23 +01004324
Takashi Iwai36c9db72013-01-17 17:07:59 +01004325 err = stac_parse_auto_config(codec);
Mattc7d4b2f2005-06-27 14:59:41 +02004326 if (err < 0) {
Takashi Iwai36c9db72013-01-17 17:07:59 +01004327 stac_free(codec);
Mattc7d4b2f2005-06-27 14:59:41 +02004328 return err;
4329 }
Matt2f2f4252005-04-13 14:45:30 +02004330
Takashi Iwaid39a3ae2013-01-14 14:06:26 +01004331 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
4332
Matt2f2f4252005-04-13 14:45:30 +02004333 return 0;
4334}
4335
Tobin Davis8e21c342007-01-08 11:04:17 +01004336static int patch_stac925x(struct hda_codec *codec)
4337{
4338 struct sigmatel_spec *spec;
4339 int err;
4340
Takashi Iwai36c9db72013-01-17 17:07:59 +01004341 err = alloc_stac_spec(codec);
Takashi Iwai361dab32012-05-09 14:35:27 +02004342 if (err < 0)
4343 return err;
Tobin Davis8e21c342007-01-08 11:04:17 +01004344
Takashi Iwai361dab32012-05-09 14:35:27 +02004345 spec = codec->spec;
Daniel J Blueman1b0e3722010-08-03 11:09:13 +01004346 spec->linear_tone_beep = 1;
Takashi Iwai36c9db72013-01-17 17:07:59 +01004347 spec->gen.own_eapd_ctl = 1;
4348
4349 codec->patch_ops = stac_patch_ops;
4350
4351 snd_hda_add_verbs(codec, stac925x_core_init);
Mauro Carvalho Chehab9cb36c22008-08-11 10:18:39 +02004352
Takashi Iwaid2077d42013-01-14 14:20:16 +01004353 snd_hda_pick_fixup(codec, stac925x_models, stac925x_fixup_tbl,
4354 stac925x_fixups);
Takashi Iwaid2077d42013-01-14 14:20:16 +01004355 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
4356
Takashi Iwai36c9db72013-01-17 17:07:59 +01004357 err = stac_parse_auto_config(codec);
Tobin Davis8e21c342007-01-08 11:04:17 +01004358 if (err < 0) {
Takashi Iwai36c9db72013-01-17 17:07:59 +01004359 stac_free(codec);
Tobin Davis8e21c342007-01-08 11:04:17 +01004360 return err;
4361 }
4362
Takashi Iwaid2077d42013-01-14 14:20:16 +01004363 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
4364
Tobin Davis8e21c342007-01-08 11:04:17 +01004365 return 0;
4366}
4367
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01004368static int patch_stac92hd73xx(struct hda_codec *codec)
4369{
4370 struct sigmatel_spec *spec;
Takashi Iwai361dab32012-05-09 14:35:27 +02004371 int err;
Takashi Iwaic21ca4a2008-12-19 09:26:08 +01004372 int num_dacs;
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01004373
Takashi Iwai36c9db72013-01-17 17:07:59 +01004374 err = alloc_stac_spec(codec);
Takashi Iwai361dab32012-05-09 14:35:27 +02004375 if (err < 0)
4376 return err;
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01004377
Takashi Iwai361dab32012-05-09 14:35:27 +02004378 spec = codec->spec;
Daniel J Blueman1b0e3722010-08-03 11:09:13 +01004379 spec->linear_tone_beep = 0;
Takashi Iwai27487462013-01-21 16:25:18 +01004380 spec->gen.mixer_nid = 0x1d;
Takashi Iwai42875472013-01-22 09:34:48 +01004381 spec->have_spdif_mux = 1;
Takashi Iwai55e30142013-01-14 17:30:04 +01004382
Takashi Iwai36c9db72013-01-17 17:07:59 +01004383 num_dacs = snd_hda_get_num_conns(codec, 0x0a) - 1;
Takashi Iwaic21ca4a2008-12-19 09:26:08 +01004384 if (num_dacs < 3 || num_dacs > 5) {
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01004385 printk(KERN_WARNING "hda_codec: Could not determine "
4386 "number of channels defaulting to DAC count\n");
Takashi Iwai36c9db72013-01-17 17:07:59 +01004387 num_dacs = 5;
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01004388 }
Takashi Iwai55e30142013-01-14 17:30:04 +01004389
Takashi Iwaic21ca4a2008-12-19 09:26:08 +01004390 switch (num_dacs) {
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01004391 case 0x3: /* 6 Channel */
Takashi Iwai36c9db72013-01-17 17:07:59 +01004392 spec->aloopback_ctl = &stac92hd73xx_6ch_loopback;
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01004393 break;
4394 case 0x4: /* 8 Channel */
Takashi Iwai36c9db72013-01-17 17:07:59 +01004395 spec->aloopback_ctl = &stac92hd73xx_8ch_loopback;
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01004396 break;
4397 case 0x5: /* 10 Channel */
Takashi Iwai36c9db72013-01-17 17:07:59 +01004398 spec->aloopback_ctl = &stac92hd73xx_10ch_loopback;
Takashi Iwaid78d7a92009-03-02 14:26:25 +01004399 break;
Takashi Iwaic21ca4a2008-12-19 09:26:08 +01004400 }
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01004401
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01004402 spec->aloopback_mask = 0x01;
4403 spec->aloopback_shift = 8;
4404
Takashi Iwai7504b6c2013-03-18 11:25:51 +01004405 spec->gen.beep_nid = 0x1c; /* digital beep */
Takashi Iwai6479c632009-07-28 18:20:25 +02004406
Takashi Iwai55e30142013-01-14 17:30:04 +01004407 /* GPIO0 High = Enable EAPD */
4408 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
4409 spec->gpio_data = 0x01;
Matthew Ranostay6b3ab212008-11-03 08:12:43 -05004410
Takashi Iwai55e30142013-01-14 17:30:04 +01004411 spec->eapd_switch = 1;
Matthew Ranostaya7662642008-02-21 07:51:14 +01004412
Matthew Ranostaya64135a2008-01-10 16:55:06 +01004413 spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids);
4414 spec->pwr_nids = stac92hd73xx_pwr_nids;
4415
Takashi Iwai36c9db72013-01-17 17:07:59 +01004416 spec->gen.own_eapd_ctl = 1;
Takashi Iwaif4f678d2013-01-24 18:02:43 +01004417 spec->gen.power_down_unused = 1;
Takashi Iwai36c9db72013-01-17 17:07:59 +01004418
4419 codec->patch_ops = stac_patch_ops;
4420
4421 snd_hda_pick_fixup(codec, stac92hd73xx_models, stac92hd73xx_fixup_tbl,
4422 stac92hd73xx_fixups);
Takashi Iwai55e30142013-01-14 17:30:04 +01004423 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
4424
4425 if (!spec->volknob_init)
4426 snd_hda_add_verbs(codec, stac92hd73xx_core_init);
4427
Takashi Iwai36c9db72013-01-17 17:07:59 +01004428 err = stac_parse_auto_config(codec);
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01004429 if (err < 0) {
Takashi Iwai36c9db72013-01-17 17:07:59 +01004430 stac_free(codec);
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01004431 return err;
4432 }
4433
David Henningsson303985f2013-03-14 15:28:29 +01004434 /* Don't GPIO-mute speakers if there are no internal speakers, because
4435 * the GPIO might be necessary for Headphone
4436 */
4437 if (spec->eapd_switch && !has_builtin_speaker(codec))
4438 spec->eapd_switch = 0;
4439
Takashi Iwai2d34e1b2008-11-28 14:35:16 +01004440 codec->proc_widget_hook = stac92hd7x_proc_hook;
4441
Takashi Iwai55e30142013-01-14 17:30:04 +01004442 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
4443
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01004444 return 0;
4445}
4446
Takashi Iwai372f8c72013-01-14 18:06:34 +01004447static void stac_setup_gpio(struct hda_codec *codec)
Matthew Ranostayd0513fc2008-07-27 10:30:30 +02004448{
Takashi Iwai372f8c72013-01-14 18:06:34 +01004449 struct sigmatel_spec *spec = codec->spec;
Vitaliy Kulikove108c7b2010-01-28 19:21:07 +01004450
Takashi Iwai1ea9a692013-07-19 07:58:02 +02004451 spec->gpio_mask |= spec->eapd_mask;
Takashi Iwaib4e81872009-11-18 17:20:24 +01004452 if (spec->gpio_led) {
Takashi Iwaif1a73742011-12-04 13:44:06 +01004453 if (!spec->vref_mute_led_nid) {
Vitaliy Kulikov45eebda2011-07-26 16:56:20 -05004454 spec->gpio_mask |= spec->gpio_led;
4455 spec->gpio_dir |= spec->gpio_led;
4456 spec->gpio_data |= spec->gpio_led;
4457 } else {
Takashi Iwaidfc6e462014-01-13 16:09:57 +01004458 codec->power_filter = stac_vref_led_power_filter;
Vitaliy Kulikov45eebda2011-07-26 16:56:20 -05004459 }
Takashi Iwaib4e81872009-11-18 17:20:24 +01004460 }
Takashi Iwaib4e81872009-11-18 17:20:24 +01004461
Takashi Iwai62cbde12012-09-14 11:58:54 +02004462 if (spec->mic_mute_led_gpio) {
4463 spec->gpio_mask |= spec->mic_mute_led_gpio;
4464 spec->gpio_dir |= spec->mic_mute_led_gpio;
4465 spec->mic_mute_led_on = true;
4466 spec->gpio_data |= spec->mic_mute_led_gpio;
Takashi Iwai36c9db72013-01-17 17:07:59 +01004467
Takashi Iwaia90229e2013-01-18 14:10:00 +01004468 spec->gen.cap_sync_hook = stac_capture_led_hook;
Takashi Iwai62cbde12012-09-14 11:58:54 +02004469 }
Takashi Iwai372f8c72013-01-14 18:06:34 +01004470}
4471
4472static int patch_stac92hd83xxx(struct hda_codec *codec)
4473{
4474 struct sigmatel_spec *spec;
4475 int err;
4476
Takashi Iwai36c9db72013-01-17 17:07:59 +01004477 err = alloc_stac_spec(codec);
Takashi Iwai372f8c72013-01-14 18:06:34 +01004478 if (err < 0)
4479 return err;
4480
4481 codec->epss = 0; /* longer delay needed for D3 */
Takashi Iwai372f8c72013-01-14 18:06:34 +01004482
4483 spec = codec->spec;
4484 spec->linear_tone_beep = 0;
Takashi Iwai36c9db72013-01-17 17:07:59 +01004485 spec->gen.own_eapd_ctl = 1;
Takashi Iwaif4f678d2013-01-24 18:02:43 +01004486 spec->gen.power_down_unused = 1;
Takashi Iwai27487462013-01-21 16:25:18 +01004487 spec->gen.mixer_nid = 0x1b;
Takashi Iwai36c9db72013-01-17 17:07:59 +01004488
Takashi Iwai7504b6c2013-03-18 11:25:51 +01004489 spec->gen.beep_nid = 0x21; /* digital beep */
Takashi Iwai372f8c72013-01-14 18:06:34 +01004490 spec->pwr_nids = stac92hd83xxx_pwr_nids;
4491 spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids);
Takashi Iwai36c9db72013-01-17 17:07:59 +01004492 spec->default_polarity = -1; /* no default cfg */
4493
4494 codec->patch_ops = stac_patch_ops;
4495
4496 snd_hda_add_verbs(codec, stac92hd83xxx_core_init);
Takashi Iwai372f8c72013-01-14 18:06:34 +01004497
4498 snd_hda_pick_fixup(codec, stac92hd83xxx_models, stac92hd83xxx_fixup_tbl,
4499 stac92hd83xxx_fixups);
Takashi Iwai372f8c72013-01-14 18:06:34 +01004500 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
4501
4502 stac_setup_gpio(codec);
Takashi Iwai62cbde12012-09-14 11:58:54 +02004503
Takashi Iwai36c9db72013-01-17 17:07:59 +01004504 err = stac_parse_auto_config(codec);
Matthew Ranostayd0513fc2008-07-27 10:30:30 +02004505 if (err < 0) {
Takashi Iwai36c9db72013-01-17 17:07:59 +01004506 stac_free(codec);
Matthew Ranostayd0513fc2008-07-27 10:30:30 +02004507 return err;
4508 }
4509
Takashi Iwai2d34e1b2008-11-28 14:35:16 +01004510 codec->proc_widget_hook = stac92hd_proc_hook;
4511
Takashi Iwai372f8c72013-01-14 18:06:34 +01004512 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
4513
Matthew Ranostayd0513fc2008-07-27 10:30:30 +02004514 return 0;
4515}
4516
Vitaliy Kulikov4e637c62013-01-31 17:58:59 -06004517static const hda_nid_t stac92hd95_pwr_nids[] = {
4518 0x0a, 0x0b, 0x0c, 0x0d
4519};
4520
4521static int patch_stac92hd95(struct hda_codec *codec)
4522{
4523 struct sigmatel_spec *spec;
4524 int err;
4525
4526 err = alloc_stac_spec(codec);
4527 if (err < 0)
4528 return err;
4529
4530 codec->epss = 0; /* longer delay needed for D3 */
4531
4532 spec = codec->spec;
4533 spec->linear_tone_beep = 0;
4534 spec->gen.own_eapd_ctl = 1;
4535 spec->gen.power_down_unused = 1;
4536
Takashi Iwai7504b6c2013-03-18 11:25:51 +01004537 spec->gen.beep_nid = 0x19; /* digital beep */
Vitaliy Kulikov4e637c62013-01-31 17:58:59 -06004538 spec->pwr_nids = stac92hd95_pwr_nids;
4539 spec->num_pwrs = ARRAY_SIZE(stac92hd95_pwr_nids);
4540 spec->default_polarity = -1; /* no default cfg */
4541
4542 codec->patch_ops = stac_patch_ops;
4543
4544 err = stac_parse_auto_config(codec);
4545 if (err < 0) {
4546 stac_free(codec);
4547 return err;
4548 }
4549
4550 codec->proc_widget_hook = stac92hd_proc_hook;
4551
4552 return 0;
4553}
4554
Matthew Ranostaye035b842007-11-06 11:53:55 +01004555static int patch_stac92hd71bxx(struct hda_codec *codec)
4556{
4557 struct sigmatel_spec *spec;
Takashi Iwai2b635362011-05-02 12:33:43 +02004558 const struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init;
Takashi Iwai361dab32012-05-09 14:35:27 +02004559 int err;
Matthew Ranostaye035b842007-11-06 11:53:55 +01004560
Takashi Iwai36c9db72013-01-17 17:07:59 +01004561 err = alloc_stac_spec(codec);
Takashi Iwai361dab32012-05-09 14:35:27 +02004562 if (err < 0)
4563 return err;
Matthew Ranostaye035b842007-11-06 11:53:55 +01004564
Takashi Iwai361dab32012-05-09 14:35:27 +02004565 spec = codec->spec;
Daniel J Blueman1b0e3722010-08-03 11:09:13 +01004566 spec->linear_tone_beep = 0;
Takashi Iwai36c9db72013-01-17 17:07:59 +01004567 spec->gen.own_eapd_ctl = 1;
Takashi Iwaif4f678d2013-01-24 18:02:43 +01004568 spec->gen.power_down_unused = 1;
Takashi Iwai27487462013-01-21 16:25:18 +01004569 spec->gen.mixer_nid = 0x17;
Takashi Iwai42875472013-01-22 09:34:48 +01004570 spec->have_spdif_mux = 1;
Matthew Ranostaye035b842007-11-06 11:53:55 +01004571
Takashi Iwai36c9db72013-01-17 17:07:59 +01004572 codec->patch_ops = stac_patch_ops;
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01004573
4574 /* GPIO0 = EAPD */
4575 spec->gpio_mask = 0x01;
4576 spec->gpio_dir = 0x01;
4577 spec->gpio_data = 0x01;
Takashi Iwai41c3b642008-11-18 10:45:15 +01004578
Matthew Ranostay541eee82007-12-14 12:08:04 +01004579 switch (codec->vendor_id) {
4580 case 0x111d76b6: /* 4 Port without Analog Mixer */
4581 case 0x111d76b7:
Herton Ronaldo Krzesinski23c7b522009-02-08 19:51:28 -02004582 unmute_init++;
Matthew Ranostay541eee82007-12-14 12:08:04 +01004583 break;
Matthew Ranostayaafc4412008-06-13 18:04:33 +02004584 case 0x111d7608: /* 5 Port with Analog Mixer */
Matthew Ranostay8daaaa92008-08-15 07:45:52 +02004585 if ((codec->revision_id & 0xf) == 0 ||
Takashi Iwai8c2f7672008-12-01 11:54:35 +01004586 (codec->revision_id & 0xf) == 1)
Matthew Ranostay8daaaa92008-08-15 07:45:52 +02004587 spec->stream_delay = 40; /* 40 milliseconds */
Matthew Ranostay8daaaa92008-08-15 07:45:52 +02004588
Matthew Ranostayaafc4412008-06-13 18:04:33 +02004589 /* disable VSW */
Matthew Ranostayca8d33f2009-01-26 09:33:52 -05004590 unmute_init++;
Takashi Iwai330ee992009-02-20 14:33:36 +01004591 snd_hda_codec_set_pincfg(codec, 0x0f, 0x40f000f0);
4592 snd_hda_codec_set_pincfg(codec, 0x19, 0x40f000f3);
Matthew Ranostayaafc4412008-06-13 18:04:33 +02004593 break;
4594 case 0x111d7603: /* 6 Port with Analog Mixer */
Takashi Iwai8c2f7672008-12-01 11:54:35 +01004595 if ((codec->revision_id & 0xf) == 1)
Matthew Ranostay8daaaa92008-08-15 07:45:52 +02004596 spec->stream_delay = 40; /* 40 milliseconds */
Matthew Ranostay8daaaa92008-08-15 07:45:52 +02004597
Takashi Iwai5207e102009-07-30 13:09:08 +02004598 break;
Matthew Ranostay541eee82007-12-14 12:08:04 +01004599 }
4600
David Henningsson5e68fb32012-08-16 14:11:09 +02004601 if (get_wcaps_type(get_wcaps(codec, 0x28)) == AC_WID_VOL_KNB)
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01004602 snd_hda_add_verbs(codec, stac92hd71bxx_core_init);
David Henningsson5e68fb32012-08-16 14:11:09 +02004603
Matthew Ranostayca8d33f2009-01-26 09:33:52 -05004604 if (get_wcaps(codec, 0xa) & AC_WCAP_IN_AMP)
4605 snd_hda_sequence_write_cache(codec, unmute_init);
4606
Takashi Iwai36c9db72013-01-17 17:07:59 +01004607 spec->aloopback_ctl = &stac92hd71bxx_loopback;
Matthew Ranostay4b33c762008-10-10 09:07:23 -04004608 spec->aloopback_mask = 0x50;
Matthew Ranostay541eee82007-12-14 12:08:04 +01004609 spec->aloopback_shift = 0;
4610
Matthew Ranostay8daaaa92008-08-15 07:45:52 +02004611 spec->powerdown_adcs = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01004612 spec->gen.beep_nid = 0x26; /* digital beep */
Takashi Iwai36c9db72013-01-17 17:07:59 +01004613 spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids);
Matthew Ranostayaafc4412008-06-13 18:04:33 +02004614 spec->pwr_nids = stac92hd71bxx_pwr_nids;
Matthew Ranostaye035b842007-11-06 11:53:55 +01004615
Takashi Iwai36c9db72013-01-17 17:07:59 +01004616 snd_hda_pick_fixup(codec, stac92hd71bxx_models, stac92hd71bxx_fixup_tbl,
4617 stac92hd71bxx_fixups);
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01004618 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Vitaliy Kulikov5bdaaad2009-11-04 07:57:45 +01004619
Takashi Iwai372f8c72013-01-14 18:06:34 +01004620 stac_setup_gpio(codec);
Matthew Ranostay6a14f582008-09-12 12:02:30 -04004621
Takashi Iwai36c9db72013-01-17 17:07:59 +01004622 err = stac_parse_auto_config(codec);
Matthew Ranostaye035b842007-11-06 11:53:55 +01004623 if (err < 0) {
Takashi Iwai36c9db72013-01-17 17:07:59 +01004624 stac_free(codec);
Matthew Ranostaye035b842007-11-06 11:53:55 +01004625 return err;
4626 }
4627
Takashi Iwai2d34e1b2008-11-28 14:35:16 +01004628 codec->proc_widget_hook = stac92hd7x_proc_hook;
4629
Takashi Iwai0f6fcb72013-01-14 17:05:25 +01004630 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
4631
Matthew Ranostaye035b842007-11-06 11:53:55 +01004632 return 0;
Takashi Iwai86d190e2009-05-26 15:18:58 +02004633}
Matthew Ranostaye035b842007-11-06 11:53:55 +01004634
Matt2f2f4252005-04-13 14:45:30 +02004635static int patch_stac922x(struct hda_codec *codec)
4636{
4637 struct sigmatel_spec *spec;
Mattc7d4b2f2005-06-27 14:59:41 +02004638 int err;
Matt2f2f4252005-04-13 14:45:30 +02004639
Takashi Iwai36c9db72013-01-17 17:07:59 +01004640 err = alloc_stac_spec(codec);
Takashi Iwai361dab32012-05-09 14:35:27 +02004641 if (err < 0)
4642 return err;
Matt2f2f4252005-04-13 14:45:30 +02004643
Takashi Iwai361dab32012-05-09 14:35:27 +02004644 spec = codec->spec;
Daniel J Blueman1b0e3722010-08-03 11:09:13 +01004645 spec->linear_tone_beep = 1;
Takashi Iwai36c9db72013-01-17 17:07:59 +01004646 spec->gen.own_eapd_ctl = 1;
Ivan N. Zlatev5d5d3bc2007-05-29 16:03:00 +02004647
Takashi Iwai36c9db72013-01-17 17:07:59 +01004648 codec->patch_ops = stac_patch_ops;
Matt2f2f4252005-04-13 14:45:30 +02004649
Takashi Iwai0a427842013-01-14 15:20:13 +01004650 snd_hda_add_verbs(codec, stac922x_core_init);
4651
Takashi Iwai807a46362007-05-29 19:01:37 +02004652 /* Fix Mux capture level; max to 2 */
4653 snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT,
4654 (0 << AC_AMPCAP_OFFSET_SHIFT) |
4655 (2 << AC_AMPCAP_NUM_STEPS_SHIFT) |
4656 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
4657 (0 << AC_AMPCAP_MUTE_SHIFT));
4658
Takashi Iwai36c9db72013-01-17 17:07:59 +01004659 snd_hda_pick_fixup(codec, stac922x_models, stac922x_fixup_tbl,
4660 stac922x_fixups);
4661 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
4662
4663 err = stac_parse_auto_config(codec);
4664 if (err < 0) {
4665 stac_free(codec);
4666 return err;
4667 }
4668
Takashi Iwai0a427842013-01-14 15:20:13 +01004669 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
4670
Matt Porter3cc08dc2006-01-23 15:27:49 +01004671 return 0;
4672}
4673
Takashi Iwai42875472013-01-22 09:34:48 +01004674static const char * const stac927x_spdif_labels[] = {
4675 "Digital Playback", "ADAT", "Analog Mux 1",
4676 "Analog Mux 2", "Analog Mux 3", NULL
4677};
4678
Matt Porter3cc08dc2006-01-23 15:27:49 +01004679static int patch_stac927x(struct hda_codec *codec)
4680{
4681 struct sigmatel_spec *spec;
4682 int err;
4683
Takashi Iwai36c9db72013-01-17 17:07:59 +01004684 err = alloc_stac_spec(codec);
Takashi Iwai361dab32012-05-09 14:35:27 +02004685 if (err < 0)
4686 return err;
Matt Porter3cc08dc2006-01-23 15:27:49 +01004687
Takashi Iwai361dab32012-05-09 14:35:27 +02004688 spec = codec->spec;
Daniel J Blueman1b0e3722010-08-03 11:09:13 +01004689 spec->linear_tone_beep = 1;
Takashi Iwai36c9db72013-01-17 17:07:59 +01004690 spec->gen.own_eapd_ctl = 1;
Takashi Iwai42875472013-01-22 09:34:48 +01004691 spec->have_spdif_mux = 1;
4692 spec->spdif_labels = stac927x_spdif_labels;
Matt Porter3cc08dc2006-01-23 15:27:49 +01004693
Takashi Iwai7504b6c2013-03-18 11:25:51 +01004694 spec->gen.beep_nid = 0x23; /* digital beep */
Matthew Ranostay8e9068b2007-12-17 11:58:13 +01004695
Takashi Iwai29ac8362013-01-14 16:03:38 +01004696 /* GPIO0 High = Enable EAPD */
4697 spec->eapd_mask = spec->gpio_mask = 0x01;
4698 spec->gpio_dir = spec->gpio_data = 0x01;
Takashi Iwaiaf6ee302009-09-14 15:03:12 +02004699
Takashi Iwai36c9db72013-01-17 17:07:59 +01004700 spec->aloopback_ctl = &stac927x_loopback;
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01004701 spec->aloopback_mask = 0x40;
4702 spec->aloopback_shift = 0;
Matthew Ranostayc0cea0d2008-11-16 11:42:34 -05004703 spec->eapd_switch = 1;
Matthew Ranostay8e9068b2007-12-17 11:58:13 +01004704
Takashi Iwai36c9db72013-01-17 17:07:59 +01004705 codec->patch_ops = stac_patch_ops;
4706
4707 snd_hda_pick_fixup(codec, stac927x_models, stac927x_fixup_tbl,
4708 stac927x_fixups);
Takashi Iwaif6655d52013-01-17 08:49:01 +01004709 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
4710
Takashi Iwai29ac8362013-01-14 16:03:38 +01004711 if (!spec->volknob_init)
4712 snd_hda_add_verbs(codec, stac927x_core_init);
4713
Takashi Iwai36c9db72013-01-17 17:07:59 +01004714 err = stac_parse_auto_config(codec);
Mattc7d4b2f2005-06-27 14:59:41 +02004715 if (err < 0) {
Takashi Iwai36c9db72013-01-17 17:07:59 +01004716 stac_free(codec);
Mattc7d4b2f2005-06-27 14:59:41 +02004717 return err;
4718 }
Matt2f2f4252005-04-13 14:45:30 +02004719
Takashi Iwai2d34e1b2008-11-28 14:35:16 +01004720 codec->proc_widget_hook = stac927x_proc_hook;
4721
Takashi Iwai52987652008-01-16 16:09:47 +01004722 /*
4723 * !!FIXME!!
4724 * The STAC927x seem to require fairly long delays for certain
4725 * command sequences. With too short delays (even if the answer
4726 * is set to RIRB properly), it results in the silence output
4727 * on some hardwares like Dell.
4728 *
4729 * The below flag enables the longer delay (see get_response
4730 * in hda_intel.c).
4731 */
4732 codec->bus->needs_damn_long_delay = 1;
4733
Takashi Iwai29ac8362013-01-14 16:03:38 +01004734 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwaie28d8322008-12-17 13:48:29 +01004735
Matt2f2f4252005-04-13 14:45:30 +02004736 return 0;
4737}
4738
Matt Porterf3302a52006-07-31 12:49:34 +02004739static int patch_stac9205(struct hda_codec *codec)
4740{
4741 struct sigmatel_spec *spec;
Takashi Iwai82599802007-07-31 15:56:24 +02004742 int err;
Matt Porterf3302a52006-07-31 12:49:34 +02004743
Takashi Iwai36c9db72013-01-17 17:07:59 +01004744 err = alloc_stac_spec(codec);
Takashi Iwai361dab32012-05-09 14:35:27 +02004745 if (err < 0)
4746 return err;
Matt Porterf3302a52006-07-31 12:49:34 +02004747
Takashi Iwai361dab32012-05-09 14:35:27 +02004748 spec = codec->spec;
Daniel J Blueman1b0e3722010-08-03 11:09:13 +01004749 spec->linear_tone_beep = 1;
Takashi Iwai36c9db72013-01-17 17:07:59 +01004750 spec->gen.own_eapd_ctl = 1;
Takashi Iwai42875472013-01-22 09:34:48 +01004751 spec->have_spdif_mux = 1;
Matt Porterf3302a52006-07-31 12:49:34 +02004752
Takashi Iwai7504b6c2013-03-18 11:25:51 +01004753 spec->gen.beep_nid = 0x23; /* digital beep */
Matt Porterf3302a52006-07-31 12:49:34 +02004754
Takashi Iwaife6322c2013-01-14 14:46:51 +01004755 snd_hda_add_verbs(codec, stac9205_core_init);
Takashi Iwai36c9db72013-01-17 17:07:59 +01004756 spec->aloopback_ctl = &stac9205_loopback;
Takashi Iwai6479c632009-07-28 18:20:25 +02004757
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01004758 spec->aloopback_mask = 0x40;
4759 spec->aloopback_shift = 0;
Matthew Ranostay87d48362007-07-17 11:52:24 +02004760
Takashi Iwaife6322c2013-01-14 14:46:51 +01004761 /* GPIO0 High = EAPD */
4762 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
4763 spec->gpio_data = 0x01;
Matt Porter33382402006-12-18 13:17:28 +01004764
Takashi Iwaife6322c2013-01-14 14:46:51 +01004765 /* Turn on/off EAPD per HP plugging */
4766 spec->eapd_switch = 1;
Matthew Ranostay4fe51952008-01-29 15:28:44 +01004767
Takashi Iwai36c9db72013-01-17 17:07:59 +01004768 codec->patch_ops = stac_patch_ops;
4769
4770 snd_hda_pick_fixup(codec, stac9205_models, stac9205_fixup_tbl,
4771 stac9205_fixups);
Takashi Iwaife6322c2013-01-14 14:46:51 +01004772 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Matthew Ranostay87d48362007-07-17 11:52:24 +02004773
Takashi Iwai36c9db72013-01-17 17:07:59 +01004774 err = stac_parse_auto_config(codec);
Matt Porterf3302a52006-07-31 12:49:34 +02004775 if (err < 0) {
Takashi Iwai36c9db72013-01-17 17:07:59 +01004776 stac_free(codec);
Matt Porterf3302a52006-07-31 12:49:34 +02004777 return err;
4778 }
4779
Takashi Iwai2d34e1b2008-11-28 14:35:16 +01004780 codec->proc_widget_hook = stac9205_proc_hook;
4781
Takashi Iwaife6322c2013-01-14 14:46:51 +01004782 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
4783
Matt Porterf3302a52006-07-31 12:49:34 +02004784 return 0;
4785}
4786
Matt2f2f4252005-04-13 14:45:30 +02004787/*
Guillaume Munch6d859062006-08-22 17:15:47 +02004788 * STAC9872 hack
Takashi Iwaidb064e52006-03-16 16:04:58 +01004789 */
4790
Takashi Iwai2b635362011-05-02 12:33:43 +02004791static const struct hda_verb stac9872_core_init[] = {
Takashi Iwai1624cb92007-07-05 13:10:51 +02004792 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */
Takashi Iwaidb064e52006-03-16 16:04:58 +01004793 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
4794 {}
4795};
4796
Takashi Iwaifc268c12013-01-14 14:29:36 +01004797static const struct hda_pintbl stac9872_vaio_pin_configs[] = {
4798 { 0x0a, 0x03211020 },
4799 { 0x0b, 0x411111f0 },
4800 { 0x0c, 0x411111f0 },
4801 { 0x0d, 0x03a15030 },
4802 { 0x0e, 0x411111f0 },
4803 { 0x0f, 0x90170110 },
4804 { 0x11, 0x411111f0 },
4805 { 0x13, 0x411111f0 },
4806 { 0x14, 0x90a7013e },
4807 {}
Takashi Iwai307282c2009-03-12 18:17:58 +01004808};
4809
Takashi Iwaifc268c12013-01-14 14:29:36 +01004810static const struct hda_model_fixup stac9872_models[] = {
4811 { .id = STAC_9872_VAIO, .name = "vaio" },
4812 {}
Takashi Iwai307282c2009-03-12 18:17:58 +01004813};
4814
Takashi Iwaifc268c12013-01-14 14:29:36 +01004815static const struct hda_fixup stac9872_fixups[] = {
4816 [STAC_9872_VAIO] = {
4817 .type = HDA_FIXUP_PINS,
4818 .v.pins = stac9872_vaio_pin_configs,
4819 },
Takashi Iwai307282c2009-03-12 18:17:58 +01004820};
4821
Takashi Iwaifc268c12013-01-14 14:29:36 +01004822static const struct snd_pci_quirk stac9872_fixup_tbl[] = {
Takashi Iwaib04add92009-07-20 08:01:36 +02004823 SND_PCI_QUIRK_MASK(0x104d, 0xfff0, 0x81e0,
4824 "Sony VAIO F/S", STAC_9872_VAIO),
Takashi Iwai307282c2009-03-12 18:17:58 +01004825 {} /* terminator */
4826};
4827
Guillaume Munch6d859062006-08-22 17:15:47 +02004828static int patch_stac9872(struct hda_codec *codec)
Takashi Iwaidb064e52006-03-16 16:04:58 +01004829{
4830 struct sigmatel_spec *spec;
Takashi Iwai1e137f92009-01-21 07:41:22 +01004831 int err;
Takashi Iwaidb064e52006-03-16 16:04:58 +01004832
Takashi Iwai36c9db72013-01-17 17:07:59 +01004833 err = alloc_stac_spec(codec);
Takashi Iwai361dab32012-05-09 14:35:27 +02004834 if (err < 0)
4835 return err;
4836
4837 spec = codec->spec;
Daniel J Blueman1b0e3722010-08-03 11:09:13 +01004838 spec->linear_tone_beep = 1;
Takashi Iwai36c9db72013-01-17 17:07:59 +01004839 spec->gen.own_eapd_ctl = 1;
4840
4841 codec->patch_ops = stac_patch_ops;
4842
4843 snd_hda_add_verbs(codec, stac9872_core_init);
Takashi Iwaicaa10b62009-01-20 17:19:01 +01004844
Takashi Iwaifc268c12013-01-14 14:29:36 +01004845 snd_hda_pick_fixup(codec, stac9872_models, stac9872_fixup_tbl,
4846 stac9872_fixups);
Takashi Iwaifc268c12013-01-14 14:29:36 +01004847 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwaicaa10b62009-01-20 17:19:01 +01004848
Takashi Iwai36c9db72013-01-17 17:07:59 +01004849 err = stac_parse_auto_config(codec);
Takashi Iwai1e137f92009-01-21 07:41:22 +01004850 if (err < 0) {
Takashi Iwai36c9db72013-01-17 17:07:59 +01004851 stac_free(codec);
Takashi Iwai1e137f92009-01-21 07:41:22 +01004852 return -EINVAL;
Takashi Iwaicaa10b62009-01-20 17:19:01 +01004853 }
Takashi Iwaifc268c12013-01-14 14:29:36 +01004854
4855 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
4856
Takashi Iwaidb064e52006-03-16 16:04:58 +01004857 return 0;
4858}
4859
4860
4861/*
Matt2f2f4252005-04-13 14:45:30 +02004862 * patch entries
4863 */
Takashi Iwai2b635362011-05-02 12:33:43 +02004864static const struct hda_codec_preset snd_hda_preset_sigmatel[] = {
Matt2f2f4252005-04-13 14:45:30 +02004865 { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 },
4866 { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x },
4867 { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x },
4868 { .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x },
4869 { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x },
4870 { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x },
4871 { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x },
Matt Porter22a27c72006-07-06 18:49:10 +02004872 { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x },
4873 { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x },
4874 { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x },
4875 { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x },
4876 { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x },
4877 { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x },
Matt Porter3cc08dc2006-01-23 15:27:49 +01004878 { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x },
4879 { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x },
4880 { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x },
4881 { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x },
4882 { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x },
4883 { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x },
4884 { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x },
4885 { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x },
4886 { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x },
4887 { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x },
Tobin Davis8e21c342007-01-08 11:04:17 +01004888 { .id = 0x83847632, .name = "STAC9202", .patch = patch_stac925x },
4889 { .id = 0x83847633, .name = "STAC9202D", .patch = patch_stac925x },
4890 { .id = 0x83847634, .name = "STAC9250", .patch = patch_stac925x },
4891 { .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x },
4892 { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x },
4893 { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x },
Takashi Iwai7bd3c0f2008-05-02 12:28:02 +02004894 { .id = 0x83847645, .name = "92HD206X", .patch = patch_stac927x },
4895 { .id = 0x83847646, .name = "92HD206D", .patch = patch_stac927x },
Guillaume Munch6d859062006-08-22 17:15:47 +02004896 /* The following does not take into account .id=0x83847661 when subsys =
4897 * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are
4898 * currently not fully supported.
4899 */
4900 { .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 },
4901 { .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 },
4902 { .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 },
Simos Xenitellisa5c0f882009-06-10 16:33:31 +01004903 { .id = 0x83847698, .name = "STAC9205", .patch = patch_stac9205 },
Matt Porterf3302a52006-07-31 12:49:34 +02004904 { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 },
4905 { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 },
4906 { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 },
4907 { .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 },
4908 { .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 },
4909 { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 },
4910 { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 },
4911 { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 },
Matthew Ranostayaafc4412008-06-13 18:04:33 +02004912 { .id = 0x111d7603, .name = "92HD75B3X5", .patch = patch_stac92hd71bxx},
Matthew Ranostayd0513fc2008-07-27 10:30:30 +02004913 { .id = 0x111d7604, .name = "92HD83C1X5", .patch = patch_stac92hd83xxx},
Vitaliy Kulikova9694fa2010-02-04 08:58:23 +01004914 { .id = 0x111d76d4, .name = "92HD83C1C5", .patch = patch_stac92hd83xxx},
Matthew Ranostayd0513fc2008-07-27 10:30:30 +02004915 { .id = 0x111d7605, .name = "92HD81B1X5", .patch = patch_stac92hd83xxx},
Matthew Ranostayff2e7332009-04-01 14:49:48 -04004916 { .id = 0x111d76d5, .name = "92HD81B1C5", .patch = patch_stac92hd83xxx},
Charles Chin8a345a02010-08-10 11:43:25 +02004917 { .id = 0x111d76d1, .name = "92HD87B1/3", .patch = patch_stac92hd83xxx},
4918 { .id = 0x111d76d9, .name = "92HD87B2/4", .patch = patch_stac92hd83xxx},
Charles Chin36706002010-01-29 12:05:51 +01004919 { .id = 0x111d7666, .name = "92HD88B3", .patch = patch_stac92hd83xxx},
4920 { .id = 0x111d7667, .name = "92HD88B1", .patch = patch_stac92hd83xxx},
4921 { .id = 0x111d7668, .name = "92HD88B2", .patch = patch_stac92hd83xxx},
4922 { .id = 0x111d7669, .name = "92HD88B4", .patch = patch_stac92hd83xxx},
Matthew Ranostayaafc4412008-06-13 18:04:33 +02004923 { .id = 0x111d7608, .name = "92HD75B2X5", .patch = patch_stac92hd71bxx},
Matthew Ranostay541eee82007-12-14 12:08:04 +01004924 { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx },
4925 { .id = 0x111d7675, .name = "92HD73C1X5", .patch = patch_stac92hd73xx },
Matthew Ranostaye1f0d662007-12-13 17:47:21 +01004926 { .id = 0x111d7676, .name = "92HD73E1X5", .patch = patch_stac92hd73xx },
Vitaliy Kulikov4e637c62013-01-31 17:58:59 -06004927 { .id = 0x111d7695, .name = "92HD95", .patch = patch_stac92hd95 },
Matthew Ranostay541eee82007-12-14 12:08:04 +01004928 { .id = 0x111d76b0, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
4929 { .id = 0x111d76b1, .name = "92HD71B8X", .patch = patch_stac92hd71bxx },
4930 { .id = 0x111d76b2, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
4931 { .id = 0x111d76b3, .name = "92HD71B7X", .patch = patch_stac92hd71bxx },
4932 { .id = 0x111d76b4, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
4933 { .id = 0x111d76b5, .name = "92HD71B6X", .patch = patch_stac92hd71bxx },
4934 { .id = 0x111d76b6, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
4935 { .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx },
Charles Chin4d8ec5f2010-08-19 08:06:16 +02004936 { .id = 0x111d76c0, .name = "92HD89C3", .patch = patch_stac92hd73xx },
4937 { .id = 0x111d76c1, .name = "92HD89C2", .patch = patch_stac92hd73xx },
4938 { .id = 0x111d76c2, .name = "92HD89C1", .patch = patch_stac92hd73xx },
4939 { .id = 0x111d76c3, .name = "92HD89B3", .patch = patch_stac92hd73xx },
4940 { .id = 0x111d76c4, .name = "92HD89B2", .patch = patch_stac92hd73xx },
4941 { .id = 0x111d76c5, .name = "92HD89B1", .patch = patch_stac92hd73xx },
4942 { .id = 0x111d76c6, .name = "92HD89E3", .patch = patch_stac92hd73xx },
4943 { .id = 0x111d76c7, .name = "92HD89E2", .patch = patch_stac92hd73xx },
4944 { .id = 0x111d76c8, .name = "92HD89E1", .patch = patch_stac92hd73xx },
4945 { .id = 0x111d76c9, .name = "92HD89D3", .patch = patch_stac92hd73xx },
4946 { .id = 0x111d76ca, .name = "92HD89D2", .patch = patch_stac92hd73xx },
4947 { .id = 0x111d76cb, .name = "92HD89D1", .patch = patch_stac92hd73xx },
4948 { .id = 0x111d76cc, .name = "92HD89F3", .patch = patch_stac92hd73xx },
4949 { .id = 0x111d76cd, .name = "92HD89F2", .patch = patch_stac92hd73xx },
4950 { .id = 0x111d76ce, .name = "92HD89F1", .patch = patch_stac92hd73xx },
David Henningsson46724c22011-09-20 09:02:22 +02004951 { .id = 0x111d76df, .name = "92HD93BXX", .patch = patch_stac92hd83xxx},
Vitaliy Kulikovab5a6eb2010-09-08 09:00:17 +02004952 { .id = 0x111d76e0, .name = "92HD91BXX", .patch = patch_stac92hd83xxx},
Vitaliy Kulikov4dfb8a42011-02-22 17:32:19 -06004953 { .id = 0x111d76e3, .name = "92HD98BXX", .patch = patch_stac92hd83xxx},
4954 { .id = 0x111d76e5, .name = "92HD99BXX", .patch = patch_stac92hd83xxx},
Vitaliy Kulikovab5a6eb2010-09-08 09:00:17 +02004955 { .id = 0x111d76e7, .name = "92HD90BXX", .patch = patch_stac92hd83xxx},
Charles Chinad5d8752011-11-02 07:56:58 +01004956 { .id = 0x111d76e8, .name = "92HD66B1X5", .patch = patch_stac92hd83xxx},
4957 { .id = 0x111d76e9, .name = "92HD66B2X5", .patch = patch_stac92hd83xxx},
4958 { .id = 0x111d76ea, .name = "92HD66B3X5", .patch = patch_stac92hd83xxx},
4959 { .id = 0x111d76eb, .name = "92HD66C1X5", .patch = patch_stac92hd83xxx},
4960 { .id = 0x111d76ec, .name = "92HD66C2X5", .patch = patch_stac92hd83xxx},
4961 { .id = 0x111d76ed, .name = "92HD66C3X5", .patch = patch_stac92hd83xxx},
4962 { .id = 0x111d76ee, .name = "92HD66B1X3", .patch = patch_stac92hd83xxx},
4963 { .id = 0x111d76ef, .name = "92HD66B2X3", .patch = patch_stac92hd83xxx},
4964 { .id = 0x111d76f0, .name = "92HD66B3X3", .patch = patch_stac92hd83xxx},
4965 { .id = 0x111d76f1, .name = "92HD66C1X3", .patch = patch_stac92hd83xxx},
4966 { .id = 0x111d76f2, .name = "92HD66C2X3", .patch = patch_stac92hd83xxx},
4967 { .id = 0x111d76f3, .name = "92HD66C3/65", .patch = patch_stac92hd83xxx},
Matt2f2f4252005-04-13 14:45:30 +02004968 {} /* terminator */
4969};
Takashi Iwai1289e9e2008-11-27 15:47:11 +01004970
4971MODULE_ALIAS("snd-hda-codec-id:8384*");
4972MODULE_ALIAS("snd-hda-codec-id:111d*");
4973
4974MODULE_LICENSE("GPL");
4975MODULE_DESCRIPTION("IDT/Sigmatel HD-audio codec");
4976
4977static struct hda_codec_preset_list sigmatel_list = {
4978 .preset = snd_hda_preset_sigmatel,
4979 .owner = THIS_MODULE,
4980};
4981
4982static int __init patch_sigmatel_init(void)
4983{
4984 return snd_hda_add_codec_preset(&sigmatel_list);
4985}
4986
4987static void __exit patch_sigmatel_exit(void)
4988{
4989 snd_hda_delete_codec_preset(&sigmatel_list);
4990}
4991
4992module_init(patch_sigmatel_init)
4993module_exit(patch_sigmatel_exit)